How plastic-labs/honcho works
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: main.py FastAPI service · queue_manager.py Work queue · routers Resource endpoints · dream_scheduler.py Dream scheduling
Components 25
Client interfaces
- Python SDK
sdks/python/src/honcho/client.py - TypeScript SDK
sdks/typescript/src/client.ts - MCP tools
mcp/src/server.ts - Honcho CLI
honcho-cli/src/honcho_cli/main.py - Agent integrations
integrations/cursor/src/hook.ts
Honcho service
- FastAPI service
src/main.py - Resource endpoints
src/routers - API schemas
src/schemas/api.py - Resource operations
src/crud - Webhook delivery
src/webhooks/webhook_delivery.py
Background reasoning
- Work queue
src/deriver/queue_manager.py - Representation derivation
src/deriver/deriver.py - Dream scheduling
src/dreamer/dream_scheduler.py - Dream orchestration
src/dreamer/orchestrator.py - Natural-language reasoning
src/dialectic/core.py
Memory and retrieval
- Peer representations
src/crud/representation.py - Hybrid search
src/utils/search.py - Embedding service
src/embedding_client.py - LLM runtime
src/llm/runtime.py
Data and operations
- Relational database
src/db.py - Vector stores
src/vector_store - Cache
src/cache/client.py - Service configuration
src/config.py - Telemetry
src/telemetry/logging.py
Other components
- Agent application
Connections 32
- Agent application → Python SDK: uses
README.md - Agent application → TypeScript SDK: uses
README.md - Agent application → MCP tools: uses
- Agent application → Honcho CLI: starts or inspects
README.md - Agent application → Agent integrations: connects through
README.md - Python SDK → FastAPI service: calls API
README.md - TypeScript SDK → FastAPI service: calls API
README.md - MCP tools → FastAPI service: calls API
- Honcho CLI → FastAPI service: administers
- Agent integrations → FastAPI service: uses memory
- FastAPI service → Resource endpoints: registers
src/main.py - Resource endpoints → API schemas: uses
src/routers/webhooks.py - Resource endpoints → Resource operations: delegates to
src/routers/webhooks.py - Resource operations → Relational database: reads and writes
src/crud/webhook.py - FastAPI service → Work queue: queues background work
- Work queue → Dream scheduling: dispatches
src/deriver/queue_manager.py - Dream scheduling → Work queue: enqueues work
src/dreamer/dream_scheduler.py - Dream orchestration → Dream scheduling: uses schedules
src/dreamer/orchestrator.py - Dream orchestration → LLM runtime: runs reasoning
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
src/webhooks/webhook_delivery.py - FastAPI service → Webhook delivery: routes webhook operations
- FastAPI service → Service configuration: uses settings
src/main.py - FastAPI service → Cache: initializes
src/main.py - Work queue → Cache: uses cache
src/deriver/queue_manager.py - Work queue → Relational database: claims work
src/deriver/queue_manager.py - FastAPI service → Telemetry: logs operations
src/main.py