# plastic-labs/honcho architecture

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

- Interactive diagram: https://gitdiagram.com/plastic-labs/honcho
- Repository: https://github.com/plastic-labs/honcho

## Overview

Honcho is a memory service for stateful agents: clients store session messages, background reasoning updates peer representations, and clients query context, search, or natural-language answers for use in an agent. The graph preserves the documented store–reason–query–inject loop and major reasoning, retrieval, SDK, and webhook capabilities. Evidence is limited to the README, SOURCE INDEX references, and shown excerpts; unsampled subsystems are represented conservatively, with no speculative call chains.

Main entry points: [`src/main.py`](https://github.com/plastic-labs/honcho/blob/main/src/main.py) (FastAPI service), [`src/deriver/queue_manager.py`](https://github.com/plastic-labs/honcho/blob/main/src/deriver/queue_manager.py) (Work queue), [`src/routers`](https://github.com/plastic-labs/honcho/tree/main/src/routers) (Resource endpoints), [`src/dreamer/dream_scheduler.py`](https://github.com/plastic-labs/honcho/blob/main/src/dreamer/dream_scheduler.py) (Dream scheduling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Client interfaces"]
  node_py_sdk["Python SDK<br/>[client.py]"]
  node_ts_sdk["TypeScript SDK<br/>[client.ts]"]
  node_mcp["MCP tools<br/>[server.ts]"]
  node_cli["Honcho CLI<br/>[main.py]"]
  node_integrations["Agent integrations<br/>[hook.ts]"]
end

subgraph group_service["Honcho service"]
  node_api["FastAPI service<br/>[main.py]"]
  node_routers["Resource endpoints"]
  node_schemas["API schemas<br/>[api.py]"]
  node_crud["Resource operations"]
  node_webhooks["Webhook delivery"]
end

subgraph group_reasoning["Background reasoning"]
  node_queue["Work queue<br/>[queue_manager.py]"]
  node_deriver["Representation derivation<br/>[deriver.py]"]
  node_dream_scheduler["Dream scheduling<br/>[dream_scheduler.py]"]
  node_dreamer["Dream orchestration<br/>[orchestrator.py]"]
  node_dialectic["Natural-language reasoning<br/>[core.py]"]
end

subgraph group_memory["Memory and retrieval"]
  node_representations["Peer representations<br/>[representation.py]"]
  node_search["Hybrid search<br/>[search.py]"]
  node_embeddings["Embedding service"]
  node_llm["LLM runtime<br/>[runtime.py]"]
end

subgraph group_platform["Data and operations"]
  node_database[("Relational database<br/>[db.py]")]
  node_vector_store[("Vector stores")]
  node_cache[("Cache<br/>[client.py]")]
  node_configuration["Service configuration<br/>[config.py]"]
  node_telemetry["Telemetry<br/>[logging.py]"]
end

node_agent(("Agent application"))

node_agent -->|"uses"| node_py_sdk
node_agent -->|"uses"| node_ts_sdk
node_agent -.->|"uses"| node_mcp
node_agent -->|"starts or inspects"| node_cli
node_agent -->|"connects through"| node_integrations
node_py_sdk -->|"calls API"| node_api
node_ts_sdk -->|"calls API"| node_api
node_mcp -.->|"calls API"| node_api
node_cli -.->|"administers"| node_api
node_integrations -.->|"uses memory"| node_api
node_api -->|"registers"| node_routers
node_routers -->|"uses"| node_schemas
node_routers -->|"delegates to"| node_crud
node_crud -->|"reads and writes"| node_database
node_api -.->|"queues background work"| node_queue
node_queue -->|"dispatches"| node_dream_scheduler
node_dream_scheduler -->|"enqueues work"| node_queue
node_dreamer -->|"uses schedules"| node_dream_scheduler
node_dreamer -->|"runs reasoning"| node_llm
node_deriver -.->|"derives memory"| node_llm
node_deriver -.->|"updates"| node_representations
node_api -.->|"serves queries"| node_representations
node_api -.->|"serves search"| node_search
node_search -.->|"searches vectors"| node_vector_store
node_embeddings -.->|"provides vectors"| node_vector_store
node_webhooks -->|"loads endpoints"| node_database
node_api -->|"routes webhook operations"| node_webhooks
node_api -->|"uses settings"| node_configuration
node_api -->|"initializes"| node_cache
node_queue -->|"uses cache"| node_cache
node_queue -->|"claims work"| node_database
node_api -.->|"logs operations"| node_telemetry

click node_py_sdk "https://github.com/plastic-labs/honcho/blob/main/sdks/python/src/honcho/client.py"
click node_ts_sdk "https://github.com/plastic-labs/honcho/blob/main/sdks/typescript/src/client.ts"
click node_mcp "https://github.com/plastic-labs/honcho/blob/main/mcp/src/server.ts"
click node_cli "https://github.com/plastic-labs/honcho/blob/main/honcho-cli/src/honcho_cli/main.py"
click node_integrations "https://github.com/plastic-labs/honcho/blob/main/integrations/cursor/src/hook.ts"
click node_api "https://github.com/plastic-labs/honcho/blob/main/src/main.py"
click node_routers "https://github.com/plastic-labs/honcho/tree/main/src/routers"
click node_schemas "https://github.com/plastic-labs/honcho/blob/main/src/schemas/api.py"
click node_crud "https://github.com/plastic-labs/honcho/tree/main/src/crud"
click node_webhooks "https://github.com/plastic-labs/honcho/blob/main/src/webhooks/webhook_delivery.py"
click node_queue "https://github.com/plastic-labs/honcho/blob/main/src/deriver/queue_manager.py"
click node_deriver "https://github.com/plastic-labs/honcho/blob/main/src/deriver/deriver.py"
click node_dream_scheduler "https://github.com/plastic-labs/honcho/blob/main/src/dreamer/dream_scheduler.py"
click node_dreamer "https://github.com/plastic-labs/honcho/blob/main/src/dreamer/orchestrator.py"
click node_dialectic "https://github.com/plastic-labs/honcho/blob/main/src/dialectic/core.py"
click node_representations "https://github.com/plastic-labs/honcho/blob/main/src/crud/representation.py"
click node_search "https://github.com/plastic-labs/honcho/blob/main/src/utils/search.py"
click node_embeddings "https://github.com/plastic-labs/honcho/blob/main/src/embedding_client.py"
click node_llm "https://github.com/plastic-labs/honcho/blob/main/src/llm/runtime.py"
click node_database "https://github.com/plastic-labs/honcho/blob/main/src/db.py"
click node_vector_store "https://github.com/plastic-labs/honcho/tree/main/src/vector_store"
click node_cache "https://github.com/plastic-labs/honcho/blob/main/src/cache/client.py"
click node_configuration "https://github.com/plastic-labs/honcho/blob/main/src/config.py"
click node_telemetry "https://github.com/plastic-labs/honcho/blob/main/src/telemetry/logging.py"

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_py_sdk,node_ts_sdk,node_mcp,node_cli,node_integrations toneBlue
class node_api,node_routers,node_schemas,node_crud,node_webhooks toneAmber
class node_queue,node_deriver,node_dream_scheduler,node_dreamer,node_dialectic toneMint
class node_representations,node_search,node_embeddings,node_llm toneRose
class node_database,node_vector_store,node_cache,node_configuration,node_telemetry,node_agent toneIndigo
```

## Components

### Client interfaces

- [Python SDK](https://github.com/plastic-labs/honcho/blob/main/sdks/python/src/honcho/client.py): `sdks/python/src/honcho/client.py`
- [TypeScript SDK](https://github.com/plastic-labs/honcho/blob/main/sdks/typescript/src/client.ts): `sdks/typescript/src/client.ts`
- [MCP tools](https://github.com/plastic-labs/honcho/blob/main/mcp/src/server.ts): `mcp/src/server.ts`
- [Honcho CLI](https://github.com/plastic-labs/honcho/blob/main/honcho-cli/src/honcho_cli/main.py): `honcho-cli/src/honcho_cli/main.py`
- [Agent integrations](https://github.com/plastic-labs/honcho/blob/main/integrations/cursor/src/hook.ts): `integrations/cursor/src/hook.ts`

### Honcho service

- [FastAPI service](https://github.com/plastic-labs/honcho/blob/main/src/main.py): `src/main.py`
- [Resource endpoints](https://github.com/plastic-labs/honcho/tree/main/src/routers): `src/routers`
- [API schemas](https://github.com/plastic-labs/honcho/blob/main/src/schemas/api.py): `src/schemas/api.py`
- [Resource operations](https://github.com/plastic-labs/honcho/tree/main/src/crud): `src/crud`
- [Webhook delivery](https://github.com/plastic-labs/honcho/blob/main/src/webhooks/webhook_delivery.py): `src/webhooks/webhook_delivery.py`

### Background reasoning

- [Work queue](https://github.com/plastic-labs/honcho/blob/main/src/deriver/queue_manager.py): `src/deriver/queue_manager.py`
- [Representation derivation](https://github.com/plastic-labs/honcho/blob/main/src/deriver/deriver.py): `src/deriver/deriver.py`
- [Dream scheduling](https://github.com/plastic-labs/honcho/blob/main/src/dreamer/dream_scheduler.py): `src/dreamer/dream_scheduler.py`
- [Dream orchestration](https://github.com/plastic-labs/honcho/blob/main/src/dreamer/orchestrator.py): `src/dreamer/orchestrator.py`
- [Natural-language reasoning](https://github.com/plastic-labs/honcho/blob/main/src/dialectic/core.py): `src/dialectic/core.py`

### Memory and retrieval

- [Peer representations](https://github.com/plastic-labs/honcho/blob/main/src/crud/representation.py): `src/crud/representation.py`
- [Hybrid search](https://github.com/plastic-labs/honcho/blob/main/src/utils/search.py): `src/utils/search.py`
- [Embedding service](https://github.com/plastic-labs/honcho/blob/main/src/embedding_client.py): `src/embedding_client.py`
- [LLM runtime](https://github.com/plastic-labs/honcho/blob/main/src/llm/runtime.py): `src/llm/runtime.py`

### Data and operations

- [Relational database](https://github.com/plastic-labs/honcho/blob/main/src/db.py): `src/db.py`
- [Vector stores](https://github.com/plastic-labs/honcho/tree/main/src/vector_store): `src/vector_store`
- [Cache](https://github.com/plastic-labs/honcho/blob/main/src/cache/client.py): `src/cache/client.py`
- [Service configuration](https://github.com/plastic-labs/honcho/blob/main/src/config.py): `src/config.py`
- [Telemetry](https://github.com/plastic-labs/honcho/blob/main/src/telemetry/logging.py): `src/telemetry/logging.py`

### Other components

- **Agent application**

## Connections

- Agent application → Python SDK: uses (evidence: `README.md`)
- Agent application → TypeScript SDK: uses (evidence: `README.md`)
- Agent application → MCP tools: uses
- Agent application → Honcho CLI: starts or inspects (evidence: `README.md`)
- Agent application → Agent integrations: connects through (evidence: `README.md`)
- Python SDK → FastAPI service: calls API (evidence: `README.md`)
- TypeScript SDK → FastAPI service: calls API (evidence: `README.md`)
- MCP tools → FastAPI service: calls API
- Honcho CLI → FastAPI service: administers
- Agent integrations → FastAPI service: uses memory
- FastAPI service → Resource endpoints: registers (evidence: `src/main.py`)
- Resource endpoints → API schemas: uses (evidence: `src/routers/webhooks.py`)
- Resource endpoints → Resource operations: delegates to (evidence: `src/routers/webhooks.py`)
- Resource operations → Relational database: reads and writes (evidence: `src/crud/webhook.py`)
- FastAPI service → Work queue: queues background work
- Work queue → Dream scheduling: dispatches (evidence: `src/deriver/queue_manager.py`)
- Dream scheduling → Work queue: enqueues work (evidence: `src/dreamer/dream_scheduler.py`)
- Dream orchestration → Dream scheduling: uses schedules (evidence: `src/dreamer/orchestrator.py`)
- Dream orchestration → LLM runtime: runs reasoning (evidence: `src/dreamer/orchestrator.py`)
- Representation derivation → LLM runtime: derives memory
- Representation derivation → Peer representations: updates
- FastAPI service → Peer representations: serves queries
- FastAPI service → Hybrid search: serves search
- Hybrid search → Vector stores: searches vectors
- Embedding service → Vector stores: provides vectors
- Webhook delivery → Relational database: loads endpoints (evidence: `src/webhooks/webhook_delivery.py`)
- FastAPI service → Webhook delivery: routes webhook operations
- FastAPI service → Service configuration: uses settings (evidence: `src/main.py`)
- FastAPI service → Cache: initializes (evidence: `src/main.py`)
- Work queue → Cache: uses cache (evidence: `src/deriver/queue_manager.py`)
- Work queue → Relational database: claims work (evidence: `src/deriver/queue_manager.py`)
- FastAPI service → Telemetry: logs operations (evidence: `src/main.py`)
