AI Initiative logoAI Initiative
Reading room / Amigo

AMIGO Frontend Architecture & Maestro Integration Plan

Source account of AMIGO Frontend Architecture & Maestro Integration Plan.

Technical source document
This is the retained source text, not a new validation of its claims. Numerical results and comparative claims require the accompanying source review before public reuse.

Read the connected case study or article →

Author not established in the source · Date not established

Provenance, authorship and editorial notes

AMIGO Frontend Architecture & Maestro Integration Plan

Id

ideas-frontend-architecture

Project

Amigo

Source path

amigo-service/FRONTEND_ARCHITECTURE.md

Source sha256

d4363afedb27bfd0cc4282d89e7ac397006875fb2655ab398a081ea4a80af361

Repo head
Not recorded
Date
Not recorded
Author
Not recorded
Document status

Technical source document

Publication status

Retained source / publication not established

Summary

Source account of AMIGO Frontend Architecture & Maestro Integration Plan.

Topics

No entries recorded.

Related ids

No entries recorded.

Evidence concerns
  • Retained source claims are not a fresh implementation or runtime certification.
  • Historical concept and design language must not be presented as delivered functionality.
Headings
  • AMIGO Frontend Architecture & Maestro Integration Plan
  • Overview
  • Architecture Overview
  • Technology Stack
  • Frontend
  • Integration
  • Project Structure
  • Key Features
  • 1. Dashboard (Landing Page)
  • 2. Persona Profile
  • 3. Memory Browser
  • 4. Draft Generator
  • 5. Brief Generator
  • 6. Settings
  • Maestro Integration
  • Integration Approach
  • Integration Interface
  • Maestro Integration SDK
  • API Integration Layer
  • API Client Setup
  • TypeScript Types
  • React Query Integration
  • Example: Memory Hooks
  • UI Components (shadcn/ui)
  • Key Components Needed
  • Environment Configuration
  • API Configuration
  • Maestro Integration
  • Features
  • Debug
  • Development Setup
  • Installation
  • Create frontend project
  • Install dependencies
  • Install shadcn/ui
  • Development Server
  • Run frontend
  • Run backend (separate terminal)
  • Deployment Strategy
  • Standalone Deployment
  • Build frontend
  • Serve with nginx or similar
  • Output: dist/
  • Maestro Embedded Deployment
  • Build with Maestro integration
  • Deploy to Maestro CDN or serve as widget
  • Demo Flow (POC)
  • User Journey
  • Demo Data
  • Timeline
  • Week 6: Frontend Foundation (5 days)
  • Week 7: Core Features (5 days)
  • Week 8: Polish & Demo (3 days)
  • Success Metrics
  • Technical
  • User Experience
  • Integration
  • Next Steps
Opening excerpt

A lightweight, modern frontend for AMIGO that demonstrates core functionality and integrates seamlessly with Maestro platform.

AMIGO Frontend Architecture & Maestro Integration Plan

Overview

A lightweight, modern frontend for AMIGO that demonstrates core functionality and integrates seamlessly with Maestro platform.


Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                    Maestro Platform UI                       │
│  (Main orchestration interface - existing)                  │
└──────────────────┬──────────────────────────────────────────┘
                   │
                   │ Embedded Widget / iframe
                   ▼
┌─────────────────────────────────────────────────────────────┐
│                   AMIGO Frontend (React)                     │
│                                                              │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
│  │   Persona    │  │   Memory     │  │    Draft     │     │
│  │   Profile    │  │   Browser    │  │  Generator   │     │
│  └──────────────┘  └──────────────┘  └──────────────┘     │
│                                                              │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
│  │    Brief     │  │ Integration  │  │   Settings   │     │
│  │  Generator   │  │   Status     │  │              │     │
│  └──────────────┘  └──────────────┘  └──────────────┘     │
└──────────────────┬──────────────────────────────────────────┘
                   │
                   │ REST API
                   ▼
┌─────────────────────────────────────────────────────────────┐
│              AMIGO Backend (FastAPI)                         │
│                  Port 3101                                   │
└─────────────────────────────────────────────────────────────┘

Technology Stack

Frontend

Integration


Project Structure

amigo-frontend/
├── public/
│   ├── favicon.ico
│   └── amigo-logo.svg
├── src/
│   ├── components/
│   │   ├── ui/              # shadcn/ui components
│   │   │   ├── button.tsx
│   │   │   ├── card.tsx
│   │   │   ├── input.tsx
│   │   │   ├── textarea.tsx
│   │   │   ├── select.tsx
│   │   │   ├── dialog.tsx
│   │   │   └── toast.tsx
│   │   ├── layout/
│   │   │   ├── Header.tsx
│   │   │   ├── Sidebar.tsx
│   │   │   └── Layout.tsx
│   │   ├── persona/
│   │   │   ├── PersonaCard.tsx
│   │   │   ├── PersonaEditor.tsx
│   │   │   └── ToneSelector.tsx
│   │   ├── memory/
│   │   │   ├── MemoryList.tsx
│   │   │   ├── MemoryCard.tsx
│   │   │   ├── MemorySearch.tsx
│   │   │   └── MemoryForm.tsx
│   │   ├── drafts/
│   │   │   ├── DraftGenerator.tsx
│   │   │   ├── DraftEditor.tsx
│   │   │   ├── DraftPreview.tsx
│   │   │   ├── PlatformSelector.tsx
│   │   │   └── DraftList.tsx
│   │   └── briefs/
│   │       ├── BriefGenerator.tsx
│   │       ├── BriefViewer.tsx
│   │       └── BriefExport.tsx
│   ├── lib/
│   │   ├── api/
│   │   │   ├── client.ts        # Axios instance
│   │   │   ├── auth.ts          # Auth endpoints
│   │   │   ├── memory.ts        # Memory endpoints
│   │   │   ├── drafts.ts        # Draft endpoints
│   │   │   ├── briefs.ts        # Brief endpoints
│   │   │   └── types.ts         # TypeScript types
│   │   ├── hooks/
│   │   │   ├── useAuth.ts
│   │   │   ├── useMemories.ts
│   │   │   ├── useDrafts.ts
│   │   │   ├── useBriefs.ts
│   │   │   └── useMaestro.ts    # Maestro integration
│   │   └── utils/
│   │       ├── format.ts
│   │       ├── validation.ts
│   │       └── storage.ts
│   ├── pages/
│   │   ├── Dashboard.tsx
│   │   ├── Persona.tsx
│   │   ├── Memories.tsx
│   │   ├── Drafts.tsx
│   │   ├── Briefs.tsx
│   │   └── Settings.tsx
│   ├── App.tsx
│   ├── main.tsx
│   └── index.css
├── package.json
├── tsconfig.json
├── vite.config.ts
├── tailwind.config.js
└── README.md

Key Features

1. Dashboard (Landing Page)

Purpose: Overview of AMIGO activity and quick actions

Components:

API Calls:


2. Persona Profile

Purpose: Configure writing style and preferences

Components:

API Calls:


3. Memory Browser

Purpose: View, search, and manage memories

Components:

API Calls:


4. Draft Generator

Purpose: Generate persona-aware communication drafts

Components:

API Calls:

Flow:

User Input → Generate → Preview → Edit (optional) → Approve → Copy/Send

5. Brief Generator

Purpose: Generate communication briefs from context

Components:

API Calls:


6. Settings

Purpose: Manage integrations and preferences

Components:


Maestro Integration

Integration Approach

AMIGO will be integrated into Maestro as:
1. Standalone Widget - Accessible from Maestro sidebar
2. Context Menu - Right-click actions in Maestro (e.g., "Generate draft from selection")
3. Command Palette - Quick actions via CMD+K in Maestro

Integration Interface

1. Maestro → AMIGO Communication

PostMessage API:

// From Maestro to AMIGO iframe
window.postMessage({
  type: 'MAESTRO_CONTEXT',
  payload: {
    selectedText: string,
    currentView: 'github' | 'jira' | 'calendar',
    authToken: string,
    userId: string,
    tenantId: string
  }
}, '*');
2. AMIGO → Maestro Communication

PostMessage API:

// From AMIGO to Maestro parent
parent.postMessage({
  type: 'AMIGO_ACTION',
  payload: {
    action: 'draft_generated' | 'memory_created',
    data: {...}
  }
}, '*');

Maestro Integration SDK

File: src/lib/hooks/useMaestro.ts

export interface MaestroContext {
  selectedText?: string;
  currentView?: string;
  authToken?: string;
  userId?: string;
  tenantId?: string;
}

export interface MaestroSDK {
  context: MaestroContext;
  sendDraft: (draft: Draft) => void;
  notifySuccess: (message: string) => void;
  notifyError: (error: string) => void;
  openInNew: (url: string) => void;
}

export function useMaestro(): MaestroSDK {
  // Implementation
}

API Integration Layer

API Client Setup

File: src/lib/api/client.ts

import axios from 'axios';

export const apiClient = axios.create({
  baseURL: import.meta.env.VITE_API_URL || 'local-service',
  headers: {
    'Content-Type': 'application/json',
  },
});

// Request interceptor - add auth token
apiClient.interceptors.request.use((config) => {
  const token = localStorage.getItem('amigo_token');
  if (token) {
    config.headers.Authorization = `Bearer ${token}`;
  }
  return config;
});

// Response interceptor - handle errors
apiClient.interceptors.response.use(
  (response) => response,
  (error) => {
    if (error.response?.status === 401) {
      // Redirect to login or request new token from Maestro
      window.location.href = '/login';
    }
    return Promise.reject(error);
  }
);

TypeScript Types

File: src/lib/api/types.ts

// Generated from OpenAPI schema or manually defined
export interface Memory {
  id: string;
  user_id: string;
  tenant_id: string;
  memory_type: 'decision' | 'preference' | 'fact' | 'interaction';
  scope?: string;
  scope_id?: string;
  content: string;
  importance: number;
  source?: string;
  created_at: string;
  accessed_count: number;
  tags: string[];
}

export interface Draft {
  id: string;
  platform: 'email' | 'slack' | 'jira' | 'github' | 'generic';
  state: 'draft' | 'approved' | 'rejected' | 'sent';
  intent: string;
  content: string;
  subject?: string;
  recipients: string[];
  metadata: DraftMetadata;
  created_at: string;
  updated_at: string;
}

export interface Brief {
  id: string;
  context: string;
  sections: BriefSection[];
  summary: string;
  tone: string;
  word_count: number;
  memories_used: number;
  generated_at: string;
}

// ... other types

React Query Integration

Example: Memory Hooks

File: src/lib/hooks/useMemories.ts

import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import * as memoryApi from '../api/memory';

export function useMemories(filters?: MemoryFilters) {
  return useQuery({
    queryKey: ['memories', filters],
    queryFn: () => memoryApi.listMemories(filters),
  });
}

export function useMemory(id: string) {
  return useQuery({
    queryKey: ['memories', id],
    queryFn: () => memoryApi.getMemory(id),
  });
}

export function useCreateMemory() {
  const queryClient = useQueryClient();

  return useMutation({
    mutationFn: memoryApi.createMemory,
    onSuccess: () => {
      queryClient.invalidateQueries({ queryKey: ['memories'] });
    },
  });
}

export function useUpdateMemory() {
  const queryClient = useQueryClient();

  return useMutation({
    mutationFn: ({ id, data }: { id: string; data: MemoryUpdate }) =>
      memoryApi.updateMemory(id, data),
    onSuccess: (_, { id }) => {
      queryClient.invalidateQueries({ queryKey: ['memories'] });
      queryClient.invalidateQueries({ queryKey: ['memories', id] });
    },
  });
}

UI Components (shadcn/ui)

Key Components Needed

1. Button - Primary, secondary, outline variants
2. Card - Container for memory/draft cards
3. Input - Text input with validation
4. Textarea - Multi-line text input
5. Select - Dropdown selector
6. Dialog - Modal for forms
7. Toast - Success/error notifications
8. Badge - Status indicators
9. Tabs - Navigation between sections
10. Spinner - Loading indicator


Environment Configuration

File: .env.example

# API Configuration
VITE_API_URL=local-service
VITE_API_TIMEOUT=30000

# Maestro Integration
VITE_MAESTRO_MODE=embedded
VITE_MAESTRO_PARENT_ORIGIN=local-service

# Features
VITE_ENABLE_DRAFTS=true
VITE_ENABLE_BRIEFS=true
VITE_ENABLE_MEMORY_SEARCH=true

# Debug
VITE_DEBUG=false

Development Setup

Installation

# Create frontend project
npm create vite@latest amigo-frontend -- --template react-ts
cd amigo-frontend

# Install dependencies
npm install react-router-dom axios @tanstack/react-query
npm install -D tailwindcss postcss autoprefixer
npm install lucide-react date-fns
npm install react-hook-form zod @hookform/resolvers

# Install shadcn/ui
npx shadcn-ui@latest init
npx shadcn-ui@latest add button card input textarea select dialog toast

Development Server

# Run frontend
npm run dev        # Port 5173

# Run backend (separate terminal)
cd ../amigo-service
poetry run uvicorn src.main:app --reload --port 3101

Deployment Strategy

Standalone Deployment

# Build frontend
npm run build

# Serve with nginx or similar
# Output: dist/

Maestro Embedded Deployment

# Build with Maestro integration
npm run build:maestro

# Deploy to Maestro CDN or serve as widget

Demo Flow (POC)

User Journey

1. Login (via Maestro auth token)
2. Dashboard - See overview
3. Persona Setup - Configure writing style
4. Create Memory - Add a few sample memories
5. Generate Draft - Create email draft from intent
6. View Draft - Preview generated content
7. Edit & Approve - Make tweaks, approve
8. Generate Brief - Create summary from context
9. Export Brief - Download as Markdown

Demo Data

Pre-populated sample data for quick demo:


Timeline

Week 6: Frontend Foundation (5 days)

Week 7: Core Features (5 days)

Week 8: Polish & Demo (3 days)


Success Metrics

Technical

User Experience

Integration


Next Steps

1. ✅ Review and approve architecture
2. ✅ Set up frontend project structure
3. ✅ Implement API integration layer
4. ✅ Build core UI components
5. ✅ Create demo flow
6. ✅ Test Maestro integration
7. ✅ Deploy and demonstrate


Recommendation: Start with a lightweight, functional demo that demonstrates core AMIGO capabilities (persona, memory, drafts). Add polish and features incrementally based on feedback.

Continue exploring