# thecuong96/coucou architecture

> Architecture diagram of the GitHub repository thecuong96/coucou, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thecuong96/coucou
- Repository: https://github.com/thecuong96/coucou

## Overview

Coucou is a cross-platform companion for AI coding-agent sessions, centered on a Mac notch/island and companion desktop and phone apps. The main workflow is: an agent emits a hook event, Coucou surfaces session activity or an approval/question, and the user responds without leaving their work. Separate product branches cover offline dictation and call notes, local memory and Mochi agents, optional cloud execution, and phone continuity. Relationships are limited to those stated in the README or visible in the supplied excerpts and source index; many listed subsystems were not sampled.

Main entry points: [`cloud/src/engine.ts`](https://github.com/thecuong96/coucou/blob/main/cloud/src/engine.ts) (Cloud execution), [`NotchBuddy/Sources/Phone/CoucouPhoneApp.swift`](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/Phone/CoucouPhoneApp.swift) (Phone app), [`NotchBuddy/Sources/App/FlowHubMochiAgents.swift`](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/FlowHubMochiAgents.swift) (Mochi agents), [`windows/hook/src/main.rs`](https://github.com/thecuong96/coucou/blob/main/windows/hook/src/main.rs) (Agent hook relay)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Agent companion"]
  node_hook["Agent hook relay<br/>[main.rs]"]
  node_mac_state["Mac session state<br/>[AppState.swift]"]
  node_hook_server["Mac hook server<br/>[HookServer.swift]"]
  node_mac_mochi["Mochi animation<br/>[BotEngine.swift]"]
  node_windows_state["Desktop session state<br/>[state.ts]"]
  node_windows_mochi["Desktop Mochi<br/>[engine.ts]"]
end

subgraph group_voice["Voice and notes"]
  node_voice_engine["Voice coordinator<br/>[VoiceEngine.swift]"]
  node_dictation["Dictation"]
  node_notetaker["Call notetaker<br/>[NoteTaker.swift]"]
end

subgraph group_mochis["Memory and Mochis"]
  node_brain_cli["Memory index CLI<br/>[cli.ts]"]
  node_brain_mcp["Memory MCP server<br/>[server.ts]"]
  node_mochi_agents["Mochi agents"]
  node_cloud_engine["Cloud execution<br/>[engine.ts]"]
  node_cloud_billing["Cloud billing<br/>[billing.ts]"]
end

subgraph group_phone["Phone continuity"]
  node_phone_app["Phone app"]
  node_phone_link["Mac phone link<br/>[MochiLink.swift]"]
  node_android_link["Android link"]
end

subgraph group_desktop["Desktop experience"]
  node_desktop_ui["Desktop island UI<br/>[main.ts]"]
  node_desktop_bridge["Desktop command bridge<br/>[bridge.ts]"]
end

node_user(("User"))
node_agent_cli(("Coding agent"))
node_cloud_store[("Cloud service")]

node_agent_cli -->|"emits events"| node_hook
node_hook -->|"forwards events"| node_hook_server
node_hook_server -->|"updates state"| node_mac_state
node_mac_state -.->|"drives island"| node_mac_mochi
node_user -->|"views activity"| node_mac_mochi
node_user -->|"views activity"| node_windows_mochi
node_windows_state -.->|"drives rendering"| node_windows_mochi
node_user -->|"speaks or records"| node_voice_engine
node_voice_engine -.->|"coordinates speech"| node_dictation
node_user -->|"records a call"| node_notetaker
node_user -->|"indexes sessions"| node_brain_cli
node_brain_cli -.->|"exposes memory"| node_brain_mcp
node_brain_mcp -.->|"supplies memory"| node_mochi_agents
node_user -->|"configures agents"| node_mochi_agents
node_mochi_agents -->|"runs remotely"| node_cloud_engine
node_cloud_engine -->|"uses cloud service"| node_cloud_store
node_cloud_engine -->|"checks billing"| node_cloud_billing
node_user -->|"checks sessions"| node_phone_app
node_phone_app -->|"links to Mac"| node_phone_link
node_phone_app -.->|"links to Mac"| node_android_link
node_user -->|"uses desktop app"| node_desktop_ui
node_desktop_ui -->|"invokes commands"| node_desktop_bridge
node_desktop_bridge -->|"reads session state"| node_windows_state

click node_hook "https://github.com/thecuong96/coucou/blob/main/windows/hook/src/main.rs"
click node_mac_state "https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/AppState.swift"
click node_hook_server "https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/HookServer.swift"
click node_mac_mochi "https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/CoucouKit/BotEngine.swift"
click node_windows_state "https://github.com/thecuong96/coucou/blob/main/windows/src/core/state.ts"
click node_windows_mochi "https://github.com/thecuong96/coucou/blob/main/windows/src/mochi/engine.ts"
click node_voice_engine "https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/Voice/VoiceEngine.swift"
click node_dictation "https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/FlowDictation.swift"
click node_notetaker "https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/NoteTaker.swift"
click node_brain_cli "https://github.com/thecuong96/coucou/blob/main/brain/src/cli.ts"
click node_brain_mcp "https://github.com/thecuong96/coucou/blob/main/brain/src/mcp/server.ts"
click node_mochi_agents "https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/FlowHubMochiAgents.swift"
click node_cloud_engine "https://github.com/thecuong96/coucou/blob/main/cloud/src/engine.ts"
click node_cloud_billing "https://github.com/thecuong96/coucou/blob/main/cloud/src/billing.ts"
click node_phone_app "https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/Phone/CoucouPhoneApp.swift"
click node_phone_link "https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/PhoneLink/MochiLink.swift"
click node_android_link "https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/AndroidLink/AndroidLinkService.swift"
click node_desktop_ui "https://github.com/thecuong96/coucou/blob/main/windows/src/main.ts"
click node_desktop_bridge "https://github.com/thecuong96/coucou/blob/main/windows/src/core/bridge.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_hook,node_mac_state,node_hook_server,node_mac_mochi,node_windows_state,node_windows_mochi,node_user toneBlue
class node_voice_engine,node_dictation,node_notetaker,node_cloud_store toneAmber
class node_brain_cli,node_brain_mcp,node_mochi_agents,node_cloud_engine,node_cloud_billing toneMint
class node_phone_app,node_phone_link,node_android_link toneRose
class node_desktop_ui,node_desktop_bridge,node_agent_cli toneIndigo
```

## Components

### Agent companion

- [Agent hook relay](https://github.com/thecuong96/coucou/blob/main/windows/hook/src/main.rs): `windows/hook/src/main.rs`
- [Mac session state](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/AppState.swift): `NotchBuddy/Sources/App/AppState.swift`
- [Mac hook server](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/HookServer.swift): `NotchBuddy/Sources/App/HookServer.swift`
- [Mochi animation](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/CoucouKit/BotEngine.swift): `NotchBuddy/Sources/CoucouKit/BotEngine.swift`
- [Desktop session state](https://github.com/thecuong96/coucou/blob/main/windows/src/core/state.ts): `windows/src/core/state.ts`
- [Desktop Mochi](https://github.com/thecuong96/coucou/blob/main/windows/src/mochi/engine.ts): `windows/src/mochi/engine.ts`

### Voice and notes

- [Voice coordinator](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/Voice/VoiceEngine.swift): `NotchBuddy/Sources/App/Voice/VoiceEngine.swift`
- [Dictation](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/FlowDictation.swift): `NotchBuddy/Sources/App/FlowDictation.swift`
- [Call notetaker](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/NoteTaker.swift): `NotchBuddy/Sources/App/NoteTaker.swift`

### Memory and Mochis

- [Memory index CLI](https://github.com/thecuong96/coucou/blob/main/brain/src/cli.ts): `brain/src/cli.ts`
- [Memory MCP server](https://github.com/thecuong96/coucou/blob/main/brain/src/mcp/server.ts): `brain/src/mcp/server.ts`
- [Mochi agents](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/FlowHubMochiAgents.swift): `NotchBuddy/Sources/App/FlowHubMochiAgents.swift`
- [Cloud execution](https://github.com/thecuong96/coucou/blob/main/cloud/src/engine.ts): `cloud/src/engine.ts`
- [Cloud billing](https://github.com/thecuong96/coucou/blob/main/cloud/src/billing.ts): `cloud/src/billing.ts`

### Phone continuity

- [Phone app](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/Phone/CoucouPhoneApp.swift): `NotchBuddy/Sources/Phone/CoucouPhoneApp.swift`
- [Mac phone link](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/PhoneLink/MochiLink.swift): `NotchBuddy/Sources/App/PhoneLink/MochiLink.swift`
- [Android link](https://github.com/thecuong96/coucou/blob/main/NotchBuddy/Sources/App/AndroidLink/AndroidLinkService.swift): `NotchBuddy/Sources/App/AndroidLink/AndroidLinkService.swift`

### Desktop experience

- [Desktop island UI](https://github.com/thecuong96/coucou/blob/main/windows/src/main.ts): `windows/src/main.ts`
- [Desktop command bridge](https://github.com/thecuong96/coucou/blob/main/windows/src/core/bridge.ts): `windows/src/core/bridge.ts`

### Other components

- **User**
- **Coding agent**
- **Cloud service**

## Connections

- Coding agent → Agent hook relay: emits events (evidence: `windows/hook/src/main.rs`)
- Agent hook relay → Mac hook server: forwards events (evidence: `windows/hook/src/main.rs`)
- Mac hook server → Mac session state: updates state (evidence: `NotchBuddy/Sources/App/AppState.swift`)
- Mac session state → Mochi animation: drives island
- User → Mochi animation: views activity
- User → Desktop Mochi: views activity
- Desktop session state → Desktop Mochi: drives rendering (evidence: `windows/src/core/state.ts`)
- User → Voice coordinator: speaks or records
- Voice coordinator → Dictation: coordinates speech
- User → Call notetaker: records a call
- User → Memory index CLI: indexes sessions
- Memory index CLI → Memory MCP server: exposes memory
- Memory MCP server → Mochi agents: supplies memory
- User → Mochi agents: configures agents
- Mochi agents → Cloud execution: runs remotely
- Cloud execution → Cloud service: uses cloud service
- Cloud execution → Cloud billing: checks billing (evidence: `cloud/src/engine.ts`)
- User → Phone app: checks sessions
- Phone app → Mac phone link: links to Mac
- Phone app → Android link: links to Mac
- User → Desktop island UI: uses desktop app
- Desktop island UI → Desktop command bridge: invokes commands (evidence: `windows/src/main.ts`)
- Desktop command bridge → Desktop session state: reads session state (evidence: `windows/src/core/bridge.ts`)
