# richardzhengquan/neo architecture

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

- Interactive diagram: https://gitdiagram.com/richardzhengquan/neo
- Repository: https://github.com/richardzhengquan/neo

## Overview

NEO is a personal AI assistant available through web, desktop, mobile, and terminal clients. Users connect or pair a client, configure an AI and memory policy, then chat; the server runs agent turns, returns streamed responses, and can use memory and tools. Separate product branches cover memory management, reminders and productivity, notifications, and generated UI. The map follows documented architecture and SOURCE INDEX references; unsampled subsystems and some runtime wiring are represented only where the README supports them.

Main entry points: [`packages/server/src/services.ts`](https://github.com/richardzhengquan/neo/blob/main/packages/server/src/services.ts) (Service composition), [`packages/memory/src/service.ts`](https://github.com/richardzhengquan/neo/blob/main/packages/memory/src/service.ts) (Memory service), [`apps/web/src/App.tsx`](https://github.com/richardzhengquan/neo/blob/main/apps/web/src/App.tsx) (Web app), [`packages/cli/src/commands/chat.ts`](https://github.com/richardzhengquan/neo/blob/main/packages/cli/src/commands/chat.ts) (Terminal client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client apps"]
  node_web["Web app<br/>[App.tsx]"]
  node_cli["Terminal client<br/>[chat.ts]"]
  node_generatedui["Generated UI renderer<br/>[blocks.tsx]"]
  node_terminalui["Terminal renderer<br/>[render.ts]"]
end

subgraph group_api["API and contracts"]
  node_client["API client<br/>[client.ts]"]
  node_server["HTTP and WebSocket API<br/>[app.ts]"]
  node_contracts["Shared contracts<br/>[services.ts]"]
end

subgraph group_assistant["Assistant runtime"]
  node_services["Service composition<br/>[services.ts]"]
  node_runtime["Agent runtime<br/>[runtime.ts]"]
  node_turn["Turn orchestration<br/>[turn.ts]"]
end

subgraph group_capabilities["Memory and tools"]
  node_memory["Memory service<br/>[service.ts]"]
  node_recall["Memory recall<br/>[recall.ts]"]
  node_writeback["Memory write-back<br/>[write.ts]"]
  node_embedding["Memory embeddings<br/>[embedder.ts]"]
  node_tools["Tool registry<br/>[registry.ts]"]
  node_productivity["Tasks, notes, reminders<br/>[tasks.ts]"]
  node_scheduler["Reminder scheduler<br/>[scheduler.ts]"]
end

subgraph group_infrastructure["Persistence and providers"]
  node_providers["AI providers<br/>[index.ts]"]
  node_storage[("SQLite storage<br/>[db.ts]")]
end

node_user(("User"))

node_user -->|"uses"| node_web
node_user -->|"uses"| node_cli
node_web -->|"calls API"| node_client
node_cli -->|"calls API"| node_client
node_client -->|"sends requests"| node_server
node_server -->|"uses services"| node_services
node_server -->|"implements API"| node_contracts
node_services -->|"creates runtime"| node_runtime
node_services -->|"composes memory"| node_memory
node_services -->|"creates registry"| node_providers
node_services -->|"loads plugins"| node_tools
node_runtime -->|"runs turns"| node_turn
node_turn -.->|"requests completion"| node_providers
node_turn -.->|"uses context"| node_memory
node_memory -->|"delegates recall"| node_recall
node_memory -->|"delegates writes"| node_writeback
node_memory -->|"embeds text"| node_embedding
node_memory -->|"reads and writes"| node_storage
node_tools -.->|"registers tools"| node_productivity
node_scheduler -.->|"schedules reminders"| node_productivity
node_services -->|"opens database"| node_storage
node_web -->|"renders UI"| node_generatedui
node_cli -->|"renders text"| node_terminalui

click node_web "https://github.com/richardzhengquan/neo/blob/main/apps/web/src/App.tsx"
click node_cli "https://github.com/richardzhengquan/neo/blob/main/packages/cli/src/commands/chat.ts"
click node_client "https://github.com/richardzhengquan/neo/blob/main/packages/client/src/client.ts"
click node_server "https://github.com/richardzhengquan/neo/blob/main/packages/server/src/app.ts"
click node_contracts "https://github.com/richardzhengquan/neo/blob/main/packages/protocol/src/services.ts"
click node_services "https://github.com/richardzhengquan/neo/blob/main/packages/server/src/services.ts"
click node_runtime "https://github.com/richardzhengquan/neo/blob/main/packages/core/src/runtime.ts"
click node_turn "https://github.com/richardzhengquan/neo/blob/main/packages/core/src/turn.ts"
click node_providers "https://github.com/richardzhengquan/neo/blob/main/packages/providers/src/index.ts"
click node_memory "https://github.com/richardzhengquan/neo/blob/main/packages/memory/src/service.ts"
click node_recall "https://github.com/richardzhengquan/neo/blob/main/packages/memory/src/recall.ts"
click node_writeback "https://github.com/richardzhengquan/neo/blob/main/packages/memory/src/write.ts"
click node_embedding "https://github.com/richardzhengquan/neo/blob/main/packages/memory/src/embedder.ts"
click node_tools "https://github.com/richardzhengquan/neo/blob/main/packages/tools/src/registry.ts"
click node_productivity "https://github.com/richardzhengquan/neo/blob/main/packages/tools/src/builtins/tasks.ts"
click node_scheduler "https://github.com/richardzhengquan/neo/blob/main/packages/tools/src/scheduler.ts"
click node_storage "https://github.com/richardzhengquan/neo/blob/main/packages/storage/src/db.ts"
click node_generatedui "https://github.com/richardzhengquan/neo/blob/main/packages/ui/src/blocks.tsx"
click node_terminalui "https://github.com/richardzhengquan/neo/blob/main/packages/cli/src/render.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_web,node_cli,node_generatedui,node_terminalui,node_user toneBlue
class node_client,node_server,node_contracts toneAmber
class node_services,node_runtime,node_turn toneMint
class node_memory,node_recall,node_writeback,node_embedding,node_tools,node_productivity,node_scheduler toneRose
class node_providers,node_storage toneIndigo
```

## Components

### Client apps

- [Web app](https://github.com/richardzhengquan/neo/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Terminal client](https://github.com/richardzhengquan/neo/blob/main/packages/cli/src/commands/chat.ts): `packages/cli/src/commands/chat.ts`
- [Generated UI renderer](https://github.com/richardzhengquan/neo/blob/main/packages/ui/src/blocks.tsx): `packages/ui/src/blocks.tsx`
- [Terminal renderer](https://github.com/richardzhengquan/neo/blob/main/packages/cli/src/render.ts): `packages/cli/src/render.ts`

### API and contracts

- [API client](https://github.com/richardzhengquan/neo/blob/main/packages/client/src/client.ts): `packages/client/src/client.ts`
- [HTTP and WebSocket API](https://github.com/richardzhengquan/neo/blob/main/packages/server/src/app.ts): `packages/server/src/app.ts`
- [Shared contracts](https://github.com/richardzhengquan/neo/blob/main/packages/protocol/src/services.ts): `packages/protocol/src/services.ts`

### Assistant runtime

- [Service composition](https://github.com/richardzhengquan/neo/blob/main/packages/server/src/services.ts): `packages/server/src/services.ts`
- [Agent runtime](https://github.com/richardzhengquan/neo/blob/main/packages/core/src/runtime.ts): `packages/core/src/runtime.ts`
- [Turn orchestration](https://github.com/richardzhengquan/neo/blob/main/packages/core/src/turn.ts): `packages/core/src/turn.ts`

### Memory and tools

- [Memory service](https://github.com/richardzhengquan/neo/blob/main/packages/memory/src/service.ts): `packages/memory/src/service.ts`
- [Memory recall](https://github.com/richardzhengquan/neo/blob/main/packages/memory/src/recall.ts): `packages/memory/src/recall.ts`
- [Memory write-back](https://github.com/richardzhengquan/neo/blob/main/packages/memory/src/write.ts): `packages/memory/src/write.ts`
- [Memory embeddings](https://github.com/richardzhengquan/neo/blob/main/packages/memory/src/embedder.ts): `packages/memory/src/embedder.ts`
- [Tool registry](https://github.com/richardzhengquan/neo/blob/main/packages/tools/src/registry.ts): `packages/tools/src/registry.ts`
- [Tasks, notes, reminders](https://github.com/richardzhengquan/neo/blob/main/packages/tools/src/builtins/tasks.ts): `packages/tools/src/builtins/tasks.ts`
- [Reminder scheduler](https://github.com/richardzhengquan/neo/blob/main/packages/tools/src/scheduler.ts): `packages/tools/src/scheduler.ts`

### Persistence and providers

- [AI providers](https://github.com/richardzhengquan/neo/blob/main/packages/providers/src/index.ts): `packages/providers/src/index.ts`
- [SQLite storage](https://github.com/richardzhengquan/neo/blob/main/packages/storage/src/db.ts): `packages/storage/src/db.ts`

### Other components

- **User**

## Connections

- User → Web app: uses (evidence: `README.md`)
- User → Terminal client: uses (evidence: `README.md`)
- Web app → API client: calls API
- Terminal client → API client: calls API (evidence: `packages/cli/src/commands/chat.ts`)
- API client → HTTP and WebSocket API: sends requests (evidence: `README.md`)
- HTTP and WebSocket API → Service composition: uses services (evidence: `packages/server/src/index.ts`)
- HTTP and WebSocket API → Shared contracts: implements API (evidence: `packages/server/src/app.ts`)
- Service composition → Agent runtime: creates runtime (evidence: `packages/server/src/services.ts`)
- Service composition → Memory service: composes memory (evidence: `packages/server/src/services.ts`)
- Service composition → AI providers: creates registry (evidence: `packages/server/src/services.ts`)
- Service composition → Tool registry: loads plugins (evidence: `packages/server/src/services.ts`)
- Agent runtime → Turn orchestration: runs turns
- Turn orchestration → AI providers: requests completion
- Turn orchestration → Memory service: uses context
- Memory service → Memory recall: delegates recall (evidence: `packages/memory/src/service.ts`)
- Memory service → Memory write-back: delegates writes (evidence: `packages/memory/src/service.ts`)
- Memory service → Memory embeddings: embeds text (evidence: `packages/memory/src/service.ts`)
- Memory service → SQLite storage: reads and writes (evidence: `packages/memory/src/service.ts`)
- Tool registry → Tasks, notes, reminders: registers tools
- Reminder scheduler → Tasks, notes, reminders: schedules reminders
- Service composition → SQLite storage: opens database (evidence: `packages/server/src/services.ts`)
- Web app → Generated UI renderer: renders UI (evidence: `README.md`)
- Terminal client → Terminal renderer: renders text (evidence: `packages/cli/src/commands/chat.ts`)
