Generated banner for honcho
Generated logo for honcho

honcho

Memory frameworkOfficial Plastic Labs project

Created by Plastic Labs

Published in plastic-labs/honcho. Publisher page

8,063 GitHub stars

What it is

Memory library for building stateful agents
— the description by Plastic Labs

AutoGineer overview, from the brain’s own files

Honcho is a memory infrastructure layer designed to give AI agents persistent, reasoning-first memory. It operates on a peer-centric model where users, agents, and groups are tracked as entities that evolve. By processing conversations and events in the background, Honcho extracts conclusions and maintains representations that can be queried to provide context-aware, personalized responses. It supports multi-peer sessions and provides a unified interface for agents to store, reason about, and retrieve information, helping to build data moats and improve agent trust.

How it works

Memory model: Hybrid

AutoGineer overview, from the brain’s own files

Honcho functions as a memory loop: it stores messages and events in sessions, processes them asynchronously in the background to update peer representations, and allows agents to query this context. It uses a hybrid storage approach with Postgres for relational data and vector databases for semantic search. The system is accessible via a FastAPI server, client SDKs for Python and TypeScript, and various agent-specific plugins that integrate with tools like Claude Code and Cursor.

Folders
FolderRoleFiles
.claudeagent-config1
.githubagent-config24
assetsattachments1
docsdocs175
examplesexamples35
scriptsscripts17
skillsagent-instructions12
srcsource-code175
teststests417
.agentsfolder1
.cursor-pluginfolder1
.vscodefolder2
databasefolder1
dockerfolder3
harness-plugin-corefolder12
hermes-plugin-honchofolder62
honcho-clifolder57
integrationsfolder24
kilo-honchofolder37
mcpfolder37
migrationsfolder50
sandboxfolder11
schemasfolder1
sdksfolder87
typingsfolder1

The agent reads

The agent writes

Requirements

Apps: Docker

Runtimes: Python >=3.13

Databases: Chroma, LanceDB, PostgreSQL, Qdrant, Redis

API keys (by name): AUTH_JWT_SECRET, HONCHO_API_KEY, LANGFUSE_SECRET_KEY, LLM_ANTHROPIC_API_KEY, LLM_GEMINI_API_KEY, LLM_OPENAI_API_KEY, VECTOR_STORE_CHROMA_API_KEY, VECTOR_STORE_QDRANT_API_KEY, VECTOR_STORE_TURBOPUFFER_API_KEY, WEBHOOK_SECRET

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Google Antigravity, Kiro, OpenCode, Amp, Roo Code, Cline, JetBrains Junie, Devin (ex-Windsurf)

Set it up

  1. This brain runs code automatically: 3 hooks (claude-code), 3 scripts. Review honcho-cli/src/honcho_cli/commands/install.py, honcho-cli/src/honcho_cli/commands/setup.py, honcho-cli/src/honcho_cli/local/setup.py, integrations/cursor/hooks/hooks.json before opening the folder in Claude Code. No step below turns a hook on for you.

    • honcho-cli/src/honcho_cli/commands/install.py: python honcho-cli/src/honcho_cli/commands/install.py
    • honcho-cli/src/honcho_cli/commands/setup.py: python honcho-cli/src/honcho_cli/commands/setup.py
    • honcho-cli/src/honcho_cli/local/setup.py: python honcho-cli/src/honcho_cli/local/setup.py
    • integrations/cursor/hooks/hooks.json: bun run ${CURSOR_PLUGIN_ROOT}/dist/hook.js session-start
    • integrations/cursor/hooks/hooks.json: bun run ${CURSOR_PLUGIN_ROOT}/dist/hook.js before-submit-prompt
    • integrations/cursor/hooks/hooks.json: bun run ${CURSOR_PLUGIN_ROOT}/dist/hook.js after-agent-response
  2. Not scanned by AutoGineerThe author’s README also describes installing it from a clone of its repository. Read its install section: AutoGineer did not scan that path. https://github.com/plastic-labs/honcho/blob/fae27192ac153a035b245e7b5217628f04bc23df/README.md#quick-start-from-source-docker
  3. Created by Plastic Labs. Published in plastic-labs/honcho. Licence: GNU Affero General Public License v3.0 only.

Usage

AutoGineer overview, from the brain’s own files

  • Store interaction history across sessions
  • Query peer-specific representations or workspace-wide context
  • Inject prompt-ready context into LLM calls
  • Perform hybrid search using BM25 and vector embeddings
  • Manage multi-peer conversation sessions
  • Inspect background processing and queue status
“What learning styles does the user respond to best?”
The agent retrieves the peer representation from Honcho to provide a personalized answer based on historical interactions.
“Get context for the current session.”
The agent fetches a summary and relevant tokens from the session to inject into an LLM completion request.

Documentation by Plastic Labs

<!-- markdownlint-disable MD033 -->

<div align="center"> <a href="https://app.honcho.dev" target="_blank"> <img src="assets/honcho.svg" alt="Honcho" width="400"> </a> </div> <!-- markdownlint-enable MD033 -->


Image: Static Badge Image: PyPI version Image: NPM version Image: CLI Image: Discord

Honcho is memory infrastructure for building stateful agents that understand changing people, agents, groups, projects, and ideas over time.

Store messages and events, let Honcho reason in the background, then query peer representations, session context, search results, or natural-language insights from any model or framework. Use it managed at api.honcho.dev, run a local stack with honcho start, or self-host the FastAPI server yourself.

Using Honcho as your memory system will earn your agents higher retention, more trust, and help you build data moats to out-compete incumbents.

Honcho has defined the Pareto Frontier of Agent Memory. Watch the video, check out our evals page, and read the blog post for more detail.

Contents

  • Start Here

  • Why Honcho

  • The Honcho Loop

  • Quickstart

  • What Honcho Gives You

  • Integrations

  • CLI

  • Core Concepts

  • Benchmarks & Evals

  • Self-hosting

  • Configuration

  • Architecture

  • SDKs

  • Learn More

  • Contributing

  • License

The Honcho project is split between several repositories, with this one hosting the core service logic — implemented as a FastAPI server. Client SDKs for Python and TypeScript live in the sdks/ directory. The honcho-cli package lives here too.

Start Here

I want to...PathGet started
Give my coding agent persistent memoryClaude Code, Cursor, Grok Bot, OpenCode, Kilo Code, OpenClaw, Hermes, or any MCP clientIntegrations
Add memory to my productPython or TypeScript SDKQuickstart
Run Honcho locallyInstall CLI, then honcho start --setupCLI
Inspect a deploymenthoncho workspace inspect, honcho doctorCLI
Self-host from sourceDocker Compose or local developmentSelf-hosting

Why Honcho

CapabilityWhat it means
Reasoning-first memoryExtracts conclusions from conversations and events, not just matching chunks.
Peer-centric modelTracks users, agents, groups, projects, and ideas as entities that change over time.
Multi-peer perspectiveModels what one peer knows about another when configured.
Managed or self-hostedUse api.honcho.dev, honcho start locally, or run the FastAPI server yourself.
Agent-tool integrationsMCP, Claude Code, Cursor, Grok Bot, OpenCode, Kilo Code, OpenClaw, Hermes.

The Honcho Loop

  1. Store conversations, events, documents, or tool traces as messages on a session.

  2. Reason — Honcho processes the queue in the background and updates peer representations.

  3. Query — ask Honcho for context, search results, peer representations, or a natural-language answer.

  4. Inject — drop the result into any LLM call or agent framework.

Concretely: workspaces hold peers, peers participate in sessions, messages live on sessions, and Honcho builds a per-peer representation that you query through the Chat Endpoint or directly.

Quickstart

Get an API key at app.honcho.dev — when you sign up you'll be prompted to join an organization, which gets its own dedicated Honcho instance. Or install the CLI and run honcho start --setup, then point the SDK at http://localhost:8000.

Python
pip install honcho-ai
# or: uv add honcho-ai
# or: poetry add honcho-ai
import os
from honcho import Honcho

# Managed service uses api.honcho.dev by default. For self-hosted, pass
# base_url="http://localhost:8000" or set HONCHO_URL.
honcho = Honcho(
    workspace_id="my-app-testing",
    api_key=os.environ["HONCHO_API_KEY"],
)

# 1. Store: peers and messages on a session
alice = honcho.peer("alice")
tutor = honcho.peer("tutor")
session = honcho.session("session-1")
session.add_messages([
    alice.message("Hey there — can you help me with my math homework?"),
    tutor.message("Absolutely. Send me your first problem!"),
])

# 2. Reason: happens asynchronously in the background.

# 3. Query: ask Honcho what it knows, or pull prompt-ready context.
answer = alice.chat("What learning styles does the user respond to best?")
context = session.context(summary=True, tokens=10_000)

# 4. Inject: hand the context to your model of choice.
from openai import OpenAI
client = OpenAI()
completion = client.chat.completions.create(
    model=os.environ.get("OPENAI_MODEL", "gpt-4o-mini"),
    messages=context.to_openai(assistant=tutor),
)
TypeScript
npm install @honcho-ai/sdk
# or: bun add @honcho-ai/sdk
import { Honcho } from "@honcho-ai/sdk";
import OpenAI from "openai";

const honcho = new Honcho({
  workspaceId: "my-app-testing",
  apiKey: process.env.HONCHO_API_KEY,
});

const alice = await honcho.peer("alice");
const tutor = await honcho.peer("tutor");
const session = await honcho.session("session-1");
await session.addMessages([
  alice.message("Hey there — can you help me with my math homework?"),
  tutor.message("Absolutely. Send me your first problem!"),
]);

const answer = await alice.chat(
  "What learning styles does the user respond to best?",
);
const context = await session.context({ summary: true, tokens: 10_000 });

const openai = new OpenAI();
const completion = await openai.chat.completions.create({
  model: process.env.OPENAI_MODEL ?? "gpt-4o-mini",
  messages: context.toOpenAI({ assistant: tutor }),
});

Note: background reasoning is asynchronous. Newly-added messages may take a moment to be reflected in chat/representation responses; for low-latency reads, use the representation endpoint.

What Honcho Gives You

NeedAPI
Save interaction historysession.add_messages(...)
Ask what Honcho knows about a peerpeer.chat(...)
Ask across the whole workspacehoncho.chat(...) / honcho.chat_stream(...)
Get prompt-ready contextsession.context(...).to_openai(...) / .to_anthropic(...)
Hybrid search (BM25 + vector)peer.search(...), session.search(...), honcho.search(...)
Low-latency static representationspeer.representation(...), session.representation(...)
Import documentssession.upload_file(...)
Inspect background processinghoncho.queue_status(...)

See the full SDK Reference and API Reference.

Integrations

Honcho ships a first-party memory plugin for every major coding agent. They all read the same ~/.honcho/config.json, so one key configures all of them — and pointing two at the same workspace gives them one shared memory.

AgentInstallSource
Claude Code/plugin marketplace add plastic-labs/claude-honchoclaude-honcho
Codexnpm install -g @honcho-ai/codex-honchocodex-honcho
CursorInstall Honcho from the Cursor Marketplaceintegrations/cursor
Grok BotAdd to Grok Bot from the Honcho plugin pageintegrations/cursor
DeepSeek Harnessdsh plugin --profile <name> add @honcho-ai/dsh-honchodsh-honcho
OpenCodeopencode plugin "@honcho-ai/opencode-honcho" --globalopencode-honcho
Kilo Codekilo plugin @honcho-ai/kilo-honcho --globalkilo-honcho
OpenClawopenclaw plugins install @honcho-ai/openclaw-honchoopenclaw-honcho
Hermeshermes memory setupbuilt in upstream
Any MCP clientclaude mcp add honcho --transport http ...MCP guide

Get a key at app.honcho.dev, then honcho init (or uv tool install honcho-cli && honcho init) writes it to ~/.honcho/config.json once for every integration. Cursor and Grok Bot are the exception: the marketplace plugin signs in with OAuth, and honcho init is optional there (in Cursor it turns on automatic capture).

Claude Code

Two ways, depending on how deep you want to go:

Plugin (richer integration — recommended for Claude Code users):

/plugin marketplace add plastic-labs/claude-honcho
/plugin install honcho@honcho

Raw MCP (works in any MCP client — Cursor, Cline, Windsurf, etc.):

claude mcp add honcho \
  --transport http \
  --url "https://mcp.honcho.dev" \
  --header "Authorization: Bearer hch-your-key-here" \
  --header "X-Honcho-User-Name: YourName"

Details: Claude Code guide · MCP guide · repo.

Codex
npm install -g @honcho-ai/codex-honcho
codex-honcho install      # registers hooks + MCP + skill in ~/.codex

Restart Codex to load the hooks. Details: Codex guide · repo.

Cursor and Grok Bot

One Cursor Marketplace listing serves both. In Cursor, open Customize, install Honcho, authenticate the honcho MCP server, then run /honcho-setup once. In Grok Bot, add Honcho under Connect apps (or Add to Grok Bot from the plugin page) and ask a Bot to set up Honcho. The plugin connects to the hosted MCP server over OAuth and ships the skills that drive the memory loop, so nothing runs locally. Details: Cursor guide · Grok Bot guide · source.

DeepSeek Harness
dsh plugin --profile <name> add @honcho-ai/dsh-honcho

A native Cordis plugin. It injects memory into the system prompt and captures new information from the session event feed. The model gets three tools — honcho_search, honcho_chat, and honcho_remember — and you can run /honcho to check status. Details: DeepSeek Harness guide · repo.

OpenCode
opencode plugin "@honcho-ai/opencode-honcho" --global

Details: OpenCode guide · repo.

Kilo Code
kilo plugin @honcho-ai/kilo-honcho --global

One install covers the Kilo CLI, the VS Code extension, and the JetBrains plugin, since all three run the same Kilo server. Details: Kilo Code guide · source.

OpenClaw
openclaw plugins install @honcho-ai/openclaw-honcho
openclaw honcho setup
openclaw gateway --force

openclaw honcho setup prompts for your API key, writes the config, and optionally migrates legacy MEMORY.md / USER.md / IDENTITY.md files into Honcho (non-destructive — originals are never deleted). Details: OpenClaw guide · repo.

Hermes
hermes memory setup   # select "honcho", point at api.honcho.dev or your local server

Details: Hermes guide.

Add Honcho to your own codebase (agent skill)

For wiring the Honcho SDK into an existing application, install the integration skill — it explores your codebase, asks about integration preferences, generates the SDK setup, and verifies it works:

npx skills add plastic-labs/honcho

Then invoke /honcho-integration in Claude Code (or /honcho-dev:integrate via the plugin marketplace). The same command also installs the memory skills — honcho-memory (concepts: the recall/record loop, session and peer strategy, plus how to connect and drive an MCP-connected Honcho) and honcho-cli (inspecting a deployment, or running a local stack with honcho start). Details: agentic development guide.

Other MCP clients

The same claude mcp add form (or its client-specific equivalent) works in any MCP-compatible client. See MCP guide.

CLI

honcho-cli inspects a Honcho deployment from the terminal, or runs a personal local stack with Docker.

uv tool install honcho-cli
honcho init                 # Honcho API key or browser login + server URL
honcho start --setup basic  # local stack: LLM provider key + Docker
honcho doctor

honcho init authenticates the CLI against a Honcho server. honcho start --setup is a separate step: it writes the LLM provider key the local deriver needs and starts API + deriver + Postgres + Redis.

Full commands and local-stack details: CLI reference · honcho-cli/README.md. To develop the server from source, see Self-hosting.

Core Concepts

Honcho organises everything around peers — humans and AI agents alike are first-class entities. The peer model enables:

  • Multi-participant sessions with mixed human and AI agents

  • Configurable observation settings (which peers observe which others)

  • Flexible identity management for all participants

  • Support for complex multi-agent interactions

Peers exchange messages within sessions; Honcho reasons over those messages to build a representation of each peer that you can query.

  • Workspace (formerly App): top-level container; isolates data between use cases.

  • Peer (formerly User): any participant — human user or AI agent.

  • Session: a conversation context; many-to-many with peers.

  • Scope: a named grouping of sessions that bounds recall (chat, representation, search) to those members.

  • Message: an atomic data unit (peer-to-peer communication or ingested document chunk).

What you query out of Honcho:

  • Conclusions — what Honcho has extracted about a peer (deductive and inductive). Exposed via the conclusions API.

  • Representations — static, low-latency snapshots of what Honcho knows about a peer (optionally session-scoped).

  • Peer Cards — compact identity summaries.

  • Session context / summaries — prompt-ready bundles for long-running conversations.

<!-- markdownlint-disable MD033 -->

<details> <summary>Internal storage (Collections &amp; Documents)</summary>

Internally, Honcho stores peer-related observations in collections of vector-embedded documents. Collections are keyed by (observer, observed) peer pairs — the same mechanism powers self-representation (observer == observed) and cross-peer modelling (peer X's understanding of peer Y). These primitives are not exposed directly; the Conclusions API is the public surface.

</details> <!-- markdownlint-enable MD033 -->

<!-- TODO(vineeth/marketing): write the "Honcho vs RAG / vector DB / memory-only" comparison. Audit recommendation referenced; copy intentionally deferred to avoid inventing positioning claims unsupported by primary sources. -->

Benchmarks & Evals

Honcho's evals span LongMemEval, LoCoMo, and other long-conversation benchmarks. See the evals page, the research blog post, and the Pareto-frontier announcement video for methodology and reproducible results.

Self-hosting

Honcho is open source under AGPL-3.0. To run a personal instance, install the CLI (uv tool install honcho-cli) and then honcho start --setup. The paths below are for building from source, contributing, or deploying without the CLI.

Quick start (from source, Docker)
git clone https://github.com/plastic-labs/honcho.git
cd honcho
cp docker-compose.yml.example docker-compose.yml
cp .env.template .env       # set LLM_OPENAI_API_KEY (see "LLM provider" below for OpenRouter etc.)
docker compose up

Then point the SDKs at it:

honcho = Honcho(workspace_id="my-app-testing", base_url="http://localhost:8000")
# or: export HONCHO_URL=http://localhost:8000

<!-- markdownlint-disable MD033 -->

<details> <summary>Without Docker (manual setup)</summary>

Everything below runs directly on the host — no Docker required. You need:

  • uv (it installs the required Python, 3.13+, for you)

  • PostgreSQL with the pgvector extension, local or managed

  • An API key for one LLM provider

Redis is optional; caching is off by default (CACHE_ENABLED=false).

  1. Clone and install

git clone https://github.com/plastic-labs/honcho.git
cd honcho
uv sync
  1. Set up PostgreSQL with pgvector

Install Postgres and pgvector natively, then create a honcho role and database and enable the extensions in it as a superuser.

On Ubuntu/Debian:

# Postgres and pgvector majors must match the distro's packaged version.
# Ubuntu 24.04:
sudo apt install postgresql-16 postgresql-16-pgvector
# Debian 12:
sudo apt install postgresql-15 postgresql-15-pgvector
# Other versions: add the PostgreSQL APT repo (apt.postgresql.org) first.

sudo -u postgres psql -c "CREATE ROLE honcho LOGIN PASSWORD 'honcho';"
sudo -u postgres createdb -O honcho honcho
sudo -u postgres psql -d honcho -c "CREATE EXTENSION IF NOT EXISTS vector;"
sudo -u postgres psql -d honcho -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"  # optional, speeds up message search

On macOS, Homebrew makes your login user the superuser, so drop the sudo -u postgres:

brew install postgresql@17 pgvector
brew services start postgresql@17

psql -d postgres -c "CREATE ROLE honcho LOGIN PASSWORD 'honcho';"
createdb -O honcho honcho
psql -d honcho -c "CREATE EXTENSION IF NOT EXISTS vector;"
psql -d honcho -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"

A managed Postgres that offers pgvector (Supabase, Neon, RDS, and so on) works too. Enable the same extensions in its database.

  1. Configure .env

cp .env.template .env

Only two settings are required:

DB_CONNECTION_URI=postgresql+psycopg://honcho:honcho@localhost:5432/honcho
LLM_OPENAI_API_KEY=sk-...

DB_CONNECTION_URI must use the postgresql+psycopg prefix (a SQLAlchemy requirement).

LLM provider. You need one key, not one per vendor. Every feature defaults to openai / gpt-5.4-mini, and embeddings default to openai / text-embedding-3-small. To use OpenRouter or another OpenAI-compatible endpoint (Together, Fireworks, vLLM, Ollama, LiteLLM), put that provider's key in LLM_OPENAI_API_KEY and set the model and base URL on each feature in .env:

LLM_OPENAI_API_KEY=sk-or-v1-...
DERIVER_MODEL_CONFIG__MODEL=google/gemini-2.5-flash
DERIVER_MODEL_CONFIG__OVERRIDES__BASE_URL=https://openrouter.ai/api/v1
# ...repeat for DIALECTIC_LEVELS__*, SUMMARY_*, DREAM_*

Models must support tool calling. If your provider doesn't serve embeddings, point EMBEDDING_MODEL_CONFIG__* at one that does. See .env.template for every per-feature line, and the configuration guide for direct Anthropic/Gemini keys and mixing providers.

Auth. Auth is off by default (AUTH_USE_AUTH=false). Turn it on before exposing the server to a network. Enabling it requires a JWT secret, which you can generate with:

python scripts/generate_jwt_secret.py

This will generate a JWT secret and print it to the console. You can then set the AUTH_JWT_SECRET environment variable. This is required for AUTH_USE_AUTH:

AUTH_JWT_SECRET=<generated_secret>

Once auth is enabled, use scripts/generate_jwt.py to mint tokens for local development and scripting:

# Admin token (full access, no expiry)
uv run python scripts/generate_jwt.py --admin

# Admin token expiring in 24 hours
uv run python scripts/generate_jwt.py --admin --expires 24h

# Admin token for a tenant -- required when MULTI_TENANT is enabled, since a
# token with no tenant claim is rejected for every caller, admin included
uv run python scripts/generate_jwt.py --admin --tenant acme

# Workspace-scoped token
uv run python scripts/generate_jwt.py --workspace my-workspace --expires 30d

# Capture a token for use in curl/scripts
TOKEN=$(uv run python scripts/generate_jwt.py --admin --print-only)
curl -H "Authorization: Bearer $TOKEN" http://localhost:8000/v3/workspaces

Duration units: s (seconds), m (minutes), h (hours), d (days), w (weeks), y (years).

  1. Run database migrations

uv run alembic upgrade head

Migrations hold a session-level advisory lock, so they need a session-mode connection (direct Postgres or a session pooler), not a transaction-mode pooler. A Supabase-style :6543 port is rewritten to :5432 automatically.

  1. Launch Honcho

Two processes need to run alongside the database.

Start the API server:

uv run fastapi dev src/main.py                  # local development, reloads on code changes
uv run fastapi run --host 0.0.0.0 src/main.py   # on a server

Start a background worker (deriver):

In a separate terminal, run:

uv run python -m src.deriver

The deriver generates representations, summaries, peer cards, and manages dreaming tasks. You can increase the number of derivers to improve runtime efficiency.

For verification steps and production notes, see Self-hosting docs → Manual Setup.

</details> <!-- markdownlint-enable MD033 -->

Contributors: install the git hooks with uv run pre-commit install --hook-type pre-commit --hook-type commit-msg --hook-type pre-push. Tests only run at push time, so a clean commit is not a clean push. Deploying to Fly.io: see Self-hosting docs → Deploying on Fly.io.

Multi-tenant mode

MULTI_TENANT=true makes one Honcho serve many tenants on one database, with row-level security scoping every query to the tenant bound on the connection. Honcho does not create the roles itself; the startup validator checks them and refuses to boot otherwise. The database needs these roles (the first and the last may be one role):

  • the migration role (DB_OWNER_CONNECTION_URI, falling back to DB_CONNECTION_URI when unset), which owns the schema and runs alembic upgrade head, created WITH LOGIN BYPASSRLS. Message search runs through a SECURITY DEFINER function owned by this role: the full-text and ILIKE operators are not leakproof, so under RLS the content indexes cannot serve them, and the function reads as its owner, pinned to the bound tenant. If the function was created by a role without BYPASSRLS, boot fails with the repair: ALTER FUNCTION message_text_matches_page(...) OWNER TO <the BYPASSRLS role> (the full signature is in the error);

  • the app role (DB_CONNECTION_URI), an ordinary role with no BYPASSRLS, which every tenant-scoped query runs as. It needs GRANT EXECUTE ON FUNCTION message_text_matches_page(...) TO <app role>, which alembic upgrade head grants with the flag on: EXECUTE is revoked from PUBLIC so no other role can reach the function's RLS bypass, and boot fails with the exact statement when the grant is missing;

  • the service role (DB_SERVICE_CONNECTION_URI), WITH LOGIN BYPASSRLS, for the cross-tenant background work (the deriver claim, the reconciler).

Every tenant table needs ENABLE and FORCE ROW LEVEL SECURITY, a policy USING (tenant_id = current_setting('app.tenant', true)) WITH CHECK (...), and SELECT, INSERT, UPDATE, DELETE granted to the app and service roles. With the flag on, alembic upgrade head applies all of that itself after the revisions run, so a release that adds a tenant table needs nothing by hand; the roles come from DB_CONNECTION_URI and DB_SERVICE_CONNECTION_URI. The connection must not go through a transaction-mode pooler. Self-hosted single-tenant installs leave the flag off; none of this applies then.

A single-tenant instance can still name the tenant that owns its data with TENANT_ID, with the flag off.

Configuration

Honcho uses a flexible configuration system that supports both TOML files and environment variables. Configuration values are loaded in priority order: environment variables > .env file > config.toml > defaults.

Copy the example file to get started:

cp config.toml.example config.toml

The file is organized by subsystem — [app], [db], [auth], [cache], [llm], [deriver], [dialectic], [summary], [dream], [peer_card], [webhook], [metrics], [telemetry], [vector_store], and [sentry]. Any value can be overridden by an environment variable named {SECTION}_{KEY}, using __ for nesting (DIALECTIC_LEVELS__low__MODEL_CONFIG__MODEL), or just {KEY} for app-level settings.

See the configuration reference for every available option, and .env.template for an annotated list of environment variables.

Architecture

Honcho splits into two services: Storage (workspaces, peers, sessions, scopes, messages, internal collections) and Insights (reasoning, conclusions, representations, summaries, the chat endpoint). Storage is synchronous via the API; Insights is asynchronous via a background queue consumed by the deriver worker process.

Key features:

  • Rich Reasoning System — multiple implementation methods that extract conclusions from interactions and build comprehensive representations of peers

  • Chat Endpoint — reasoning-informed responses that integrate conclusions with current context

  • Background Processing — asynchronous processing pipeline for expensive operations like representation updates and session summarization

  • Multi-Provider Support — configurable LLM providers for different use cases

<!-- markdownlint-disable MD033 MD001 -->

<details> <summary>Storage primitives in detail</summary>

Honcho contains several different primitives used for storing application and peer data. This data is used for managing conversations, modeling peer identity, building RAG applications, and more.

The philosophy behind Honcho is to provide a platform that is peer-centric and easily scalable from a single user to a million.

Below is a mapping of the different primitives and their relationships.

Workspaces
├── Peers ←──────────────────┐
│   ├── Sessions             │
│   └── (internal collections, keyed by observer/observed peer pair)
│                            │
├── Scopes ←─────────────────┤ (many-to-many with sessions)
│                            │
└── Sessions ←───────────────┤ (many-to-many with peers)
    ├── Peers ───────────────┘
    └── Messages (session-level)

Relationship Details:

  • A Workspace contains multiple Peers and Scopes.

  • Peers and Sessions have a many-to-many relationship (peers can participate in multiple sessions, sessions can have multiple peers).

  • Scopes and Sessions have a many-to-many relationship (a session can belong to several scopes; a scope groups many sessions).

  • Messages belong to a session and are labelled by their source peer.

  • Internal collections of vector-embedded documents are keyed by (observer, observed) peer pairs. They are not directly exposed via the API; the observations stored in them are exposed as Conclusions.

Users familiar with APIs such as the OpenAI Assistants API will be familiar with much of the mapping here.

Workspaces

This is the top level construct of Honcho. Developers can register different Workspaces for different assistants, agents, AI enabled features, etc. It is a way to isolate data between use cases and provide multi-tenant capabilities.

Peers

Within a Workspace everything revolves around a Peer. The Peer object represents any participant in the system — whether human users or AI agents. This unified model enables complex multi-participant interactions.

Sessions

The Session object represents a set of interactions between Peers within a Workspace. Other applications may refer to this as a thread or conversation. Sessions can involve multiple peers with configurable observation settings. A session can optionally join one or more Scopes at creation, or later via the scopes API.

Scopes

A Scope is a named grouping of sessions inside a Workspace. It is a visibility boundary on recall: chat, representation, session context, and workspace search answered through a scope see only what happened in that scope's member sessions. The underlying peers keep their unified representations across everything they have participated in.

Developers manage scopes through the scopes API (honcho.scope(...) / honcho.scopes()) and an optional scopes field on session create — not through observer/observed configuration. Adding a session that already has messages copies its existing explicit conclusions into the scope (no re-derivation); removing one reconciles those copies back out. Query backfill progress with the scope status endpoint.

A single scope name answers from that scope's collection and card. A list of scopes restricts recall to the union of their member sessions. Empty scopes fail closed. scope is mutually exclusive with session / filters on the same read.

Messages

The Message represents an atomic data unit that exists at the session level: communication between peers within a session context. All messages are labelled by their source peer and can be processed asynchronously to update their representations. This flexible design allows for both conversational interactions and broader data ingestion for personality modelling.

</details> <!-- markdownlint-enable MD033 MD001 -->

<!-- markdownlint-disable MD033 -->

<details> <summary>Reasoning pipeline</summary>

The reasoning functionality of Honcho is built on top of the Storage service. As Messages and Sessions are created for Peers, Honcho will asynchronously reason about peer psychology to derive facts about them and store them in reserved internal collections.

A high level summary of the pipeline is as follows:

  1. Messages are created via the API.

  2. Derivation tasks are enqueued for background processing, including:

    • representation: update representations of Peers.

    • summary: create summaries of Sessions.

  3. Session-based queue processing ensures proper ordering.

  4. Results are stored internally and surfaced via the Conclusions API, Representations, Peer Cards, and the Chat Endpoint.

</details> <!-- markdownlint-enable MD033 -->

<!-- markdownlint-disable MD033 MD001 -->

<details> <summary>Retrieving data and insights</summary>

Honcho exposes several different ways to retrieve data from the system to best serve the needs of any given application.

Get Context

In long-running conversations with an LLM, the context window can fill up quickly. To address this, Honcho provides a context endpoint that returns a combination of messages, conclusions, summaries from a session up to a provided token limit.

Use this to keep sessions going indefinitely. If you'd like to see this in action, try out Honcho Chat.

There are several search endpoints that let developers query messages at the Workspace, Session, or Peer level using a hybrid search strategy.

Requests can include advanced filters to further refine the results.

Chat API

The flagship interface for using these insights is the Chat Endpoint (POST /peers/{peer_id}/chat). It takes natural-language requests to get data about a peer and returns reasoning-grounded responses. Examples:

  • Asking Honcho for a generic or specific insight about the peer.

  • Asking Honcho to hydrate a prompt with data about the peer's behaviour.

  • Asking Honcho for a second opinion on how to respond.

  • Getting personalised responses that incorporate long-term facts and context.

Representations

For low-latency use cases, Honcho provides access to a representation endpoint that returns a static document with insights about a peer in the context of a particular session. Use this to quickly add context to a prompt without having to wait for an LLM response.

</details> <!-- markdownlint-enable MD033 MD001 -->

SDKs

SDKs are versioned independently of the server. Current SDK versions track each other; the server badge above reflects the deployed server version.

See the SDK Reference for full API surface, the API Reference for the raw HTTP API, and per-SDK example folders for runnable demos.

Learn More

Contributing

Pull requests are limited to maintainers. If you find a bug or want a change, please open an issue instead. If you think your work is an exception, make the case in Discord, where maintainers are most active.

See CONTRIBUTING.md for the full process, an architecture walkthrough, and a map of where to change what. For vulnerabilities, see SECURITY.md — note that Honcho does not operate a bug bounty.

License

Honcho is licensed under the AGPL-3.0 License. Learn more at the License file.

docs/README.md

Honcho Docs

These docs are built using Next.js via mintlify.

Setting Up Honcho's Docs Locally

  1. Clone the repository:

git clone [e-mail address on the upstream page](https://github.com/plastic-labs/honcho/blob/fae27192ac153a035b245e7b5217628f04bc23df/docs/README.md):plastic-labs/honcho.git
  1. Navigate into the docs folder:

cd honcho/docs/

The docs folder contains the markdown files that make up the documentation. The majority of the files are in the pages directory. Some notable files in this folder include:

  1. Verify that you have Node.js and npm installed in your system. You can check by running:

node --version
npm --version
  1. If not installed, download Node.js and npm from the respective official websites.

  2. Once you have Node.js and npm running, proceed to install pnpm - another package manager that helps to manage project dependencies:

npm install -g pnpm
  1. Install the project dependencies using pnpm:

pnpm i
  1. After the successful installation of the project dependencies, start the local server:

pnpm dev

Now, you should be able to view the docs on your local environment by visiting http://localhost:3000. You can explore the different markdown files and make changes as you see fit.

512 files · 498 not served here

Advantages

  • Extracts conclusions from conversations rather than just performing chunk matching. evidence: README.md
  • Models relationships and knowledge between multiple peers, users, and agents. evidence: README.md

Limitations

  • Background reasoning is asynchronous, meaning new messages may not be immediately reflected in chat responses. evidence: README.md
  • Requires careful management of database sessions to avoid holding connections during slow network I/O. evidence: CLAUDE.md

Security

Risk level: Medium risk

This brain runs

Git hooks (15)

  • .pre-commit-config.yaml: pre-commit hooks from https://github.com/pre-commit/pre-commit-hooks at v4.5.0 (contributor tooling: runs only after pre-commit install) · uses the network
  • .pre-commit-config.yaml: pre-commit hooks from https://github.com/astral-sh/ruff-pre-commit at v0.15.12 (contributor tooling: runs only after pre-commit install) · uses the network
  • .pre-commit-config.yaml: pre-commit hooks from https://github.com/PyCQA/bandit at 1.7.10 (contributor tooling: runs only after pre-commit install) · uses the network
  • .pre-commit-config.yaml: bash -c 'cd sdks/typescript && bun run lint:fix'
  • .pre-commit-config.yaml: uv run basedpyright
  • .pre-commit-config.yaml: uv run pytest -x tests/ --ignore=tests/alembic/
  • .pre-commit-config.yaml: uv run python scripts/run_alembic_tests.py
  • .pre-commit-config.yaml: uv run python scripts/ensure_alembic_tests.py
  • .pre-commit-config.yaml: uv run python scripts/check_alembic_heads.py
  • .pre-commit-config.yaml: bash -c 'if [ -d "sdks/python/tests" ]; then cd sdks/python && uv run pytest; fi'
  • .pre-commit-config.yaml: bash -c 'cd sdks/typescript && bun run test'
  • .pre-commit-config.yaml: bash -c 'if [ -f "sdks/typescript/package.json" ]; then cd sdks/typescript && bun run build; fi'
  • .pre-commit-config.yaml: bash -c 'if [ -f "sdks/typescript/package.json" ]; then cd sdks/typescript && bun run typecheck; fi'
  • .pre-commit-config.yaml: pre-commit hooks from https://github.com/igorshubovych/markdownlint-cli at v0.37.0 (contributor tooling: runs only after pre-commit install) · uses the network
  • .pre-commit-config.yaml: pre-commit hooks from https://github.com/commitizen-tools/commitizen at v3.13.0 (contributor tooling: runs only after pre-commit install) · uses the network

Agent instructions that run or fetch something (71)

  • CLAUDE.md: Setup: `uv sync`
  • CLAUDE.md: Run server: `uv run fastapi dev src/main.py`
  • CLAUDE.md: Run tests: `uv run pytest tests/`
  • CLAUDE.md: Run single test: `uv run pytest tests/path/to/test_file.py::test_function`
  • CLAUDE.md: Linting: `uv run ruff check src/`
  • CLAUDE.md: Typechecking: `uv run basedpyright`
  • CLAUDE.md: Format code: `uv run ruff format src/`
  • CLAUDE.md: The TypeScript SDK tests run against a real Honcho server.
  • CLAUDE.md: `bun run test` (not bare `bun test`, which has no server to talk to) starts one for them: `scripts/run_ts_sdk_tests.py` creates a throwaway database on the Postgres named by `DB_CONNECTION_URI`, migrates it, starts the API and the mock LLM provider (`src/mock_provider`), runs `bun test` …[+24 chars]
  • CLAUDE.md: They are not part of `uv run pytest`.
  • CLAUDE.md: cd sdks/typescript && bun run test # whole suite
  • CLAUDE.md: cd sdks/typescript && bun run test peer.test # bun test args pass through
  • CLAUDE.md: **To type-check the TypeScript SDK (this is fine to run directly):**
  • CLAUDE.md: cd sdks/typescript && bun run tsc --noEmit
  • CLAUDE.md: These run in AUTOCOMMIT mode with no transaction: writes are NOT blocked by the database — they silently commit immediately, and `begin_nested()` savepoints break.
  • CLAUDE.md: **Startup validators (`src/startup/`).** Both the API lifespan and the deriver entrypoint run them before serving traffic or claiming work, and each fails closed: `validate_embedding_schema` (pgvector column dims vs settings), `validate_tenant_isolation` (above), and `validate_queue_it …[+209 chars]
  • CLAUDE.md: **Under `MULTI_TENANT`, the tenant-claim check in `auth()` must run before the admin short-circuit.** An admin JWT (`ad: true`) is admin only within its own tenant;
  • CLAUDE.md: **API server** (`uv run fastapi dev src/main.py`) — handles HTTP, enqueues background work, returns immediately.
  • CLAUDE.md: **Deriver worker** (`uv run python -m src.deriver`) — long-running queue consumer (uvloop).
  • CLAUDE.md: Can run multiple process replicas (a deployment concern, orthogonal to config);
  • CLAUDE.md: (The Dreamer specialists also use tools, but run off the queue.)
  • CLAUDE.md: **Cross-tenant paths pass the row's prefix explicitly, and contain the failure per row.** The reconciler and the soft-delete sweep run across all tenants on `service_db` with no ambient tenant, so they call `prefix_for_tenant(row.tenant_id)` and hand the result to `get_vector_namespace( …[+18 chars]
  • CLAUDE.md: │ ├── __main__.py # `python -m src.deriver` entry point
  • CLAUDE.md: Always use `uv run` or `uv` to prefix any commands related to python to ensure you use the virtual environment
  • examples/zo/SKILL.md: Get a Honcho API key at [honcho.dev](https://honcho.dev). · uses the network
  • examples/zo/SKILL.md: Install dependencies:
  • integrations/cursor/skills/honcho-grok-bot/SKILL.md: **A routine run** (scheduled or event-triggered work with no user in the loop): `<bot>-routine-<routine-name>-<YYYY-MM-DD>`.
  • integrations/cursor/skills/honcho-grok-bot/SKILL.md: If the metadata is missing, run `honcho-setup` rather than guessing.
  • integrations/cursor/skills/honcho-memory/SKILL.md: If a tool call fails with an authentication error, stop calling tools and run the `honcho-setup` skill instead of retrying.
  • integrations/cursor/skills/honcho-setup/SKILL.md: It is get-or-create, so this is safe on every run.
  • integrations/cursor/skills/honcho-setup/SKILL.md: When asked for Honcho's status, run Step 5 without changing anything, and add how many sessions `search` finds for the current session name.
  • skills/honcho-cli/SKILL.md: run `honcho init` to confirm or set them.
  • skills/honcho-cli/SKILL.md: Run `honcho peer inspect` before `honcho peer chat` to understand context.
  • skills/honcho-cli/SKILL.md: # Always dry-run first: it reads both sides and writes nothing
  • skills/honcho-cli/SKILL.md: honcho workspace replay --from <src> --to <dst> --dry-run --json | jq '.actions, .messages_to_send'
  • skills/honcho-cli/SKILL.md: Each session's `action` in the dry run is `create`, `resume`, `up_to_date` or `conflict`.
  • skills/honcho-integration/SKILL.md: Install the SDK (see [Installation](#installation))
  • skills/honcho-integration/SKILL.md: If the Honcho CLI is available, run `honcho doctor` to confirm connectivity before testing the integration code
  • skills/honcho-integration/SKILL.md: **Get an API key** ask the user to get a Honcho API key from <https://app.honcho.dev> and add it to the environment. · uses the network
  • skills/honcho-integration/SKILL.md: If the user has the Honcho CLI installed (`uv install honcho-cli`), they can validate their setup before writing any integration code:
  • skills/honcho-integration/SKILL.md: uv add honcho-ai
  • skills/honcho-integration/SKILL.md: bun add @honcho-ai/sdk
  • skills/honcho-integration/SKILL.md: [ ] Install SDK with `uv add honcho-ai` (Python) or `bun add @honcho-ai/sdk` (TypeScript)
  • skills/honcho-integration/SKILL.md: [ ] (Optional) Run `honcho doctor` to verify connectivity before testing integration code
  • skills/honcho-memory/SKILL.md: Use it.** In Claude Code, install the [Claude Code plugin](https://honcho.dev/docs/v3/guides/integrations/claude-code.md) (`/plugin marketplace add plastic-labs/claude-honcho`) for persistent memory out of the box;
  • skills/honcho-memory/SKILL.md: You need a Honcho API key — get one free at <https://app.honcho.dev> (starts with `hch-`). · uses the network
  • skills/pre-pr/SKILL.md: git diff main...HEAD --stat
  • skills/pre-pr/SKILL.md: | Surface touched | Required | | --- | --- | | `src/` (non-prompt) | unit tests under the matching `tests/` tree | | deriver / dialectic / dreamer / LLM path | unit + consider live-llm (`tests/live_llm`) | | queue, config hierarchy, multi-turn, SDK contract | unified (`uv run python -m …[+217 chars]
  • skills/pre-pr/SKILL.md: Lint/type before claiming tests are green: `uv run ruff check src/` → `uv run basedpyright` → the pytest command for the layer.
  • skills/property-repro/SKILL.md: HONCHO_FUZZ_EXAMPLES=1000 uv run pytest tests/property/test_api_no_server_errors.py \
  • skills/property-repro/SKILL.md: HONCHO_FUZZ_STATS=/tmp/stats.txt uv run pytest --fuzz tests/property/test_api_no_server_errors.py
  • skills/property-repro/SKILL.md: Hypothesis runs with `database=None`, so a property failure is not replayed on the next run unless you pin it.
  • skills/property-repro/SKILL.md: Background work does not run under test (the deriver, deletion cleanup, the reconciler).
  • skills/property-repro/SKILL.md: re-run with `-n 0` and a fixed `--hypothesis-seed` to replay it.
  • skills/verify/SKILL.md: Docker Compose is the preferred way to run the stack — `docker-compose.yml` at the repo root brings up Postgres (pgvector), Redis, the API server, and the deriver worker together.
  • skills/verify/SKILL.md: If Docker Compose isn't available, the stack can also run directly on the host (see Launch below);
  • skills/verify/SKILL.md: Copy `.env` from the main checkout (that's where the provider keys live), and run `bun install` in `sdks/typescript` if you'll run the full test suite — otherwise the pre-push gate fails on a phantom `Cannot find package 'zod'`.
  • skills/verify/SKILL.md: docker compose ps # look for api / deriver / database / redis
  • skills/verify/SKILL.md: docker compose up -d # start it if not
  • skills/verify/SKILL.md: For verifying a diff, the cheap path is to reuse the stack's Postgres/Redis containers but run the branch's API as a host process on a spare port:
  • skills/verify/SKILL.md: uv run uvicorn src.main:app --port 8901 # branch code, stack's DB/Redis
  • skills/verify/SKILL.md: uv run python -m src.deriver # if the diff touches the worker
  • skills/verify/SKILL.md: Without Docker at all, run the two processes the same way against host Postgres + Redis (API default port 8000 via `uv run fastapi dev src/main.py`).
  • skills/verify/SKILL.md: And for load-time config behavior, `uv run python -c "import src.config;
  • skills/verify/SKILL.md: **Capture the real plan repeatedly.** Save ORM-emitted SQL and bound parameters after tenant hooks, then run natural `EXPLAIN (ANALYZE, BUFFERS)` under the same role/settings for both revisions.
  • skills/verify/SKILL.md: Check bound tenant predicates and partition pruning, including planning/partition lock evidence when relevant, not only which partitions execute.
  • skills/verify/SKILL.md: All run in CI, but they're also runnable locally with whatever API keys and configuration you have — Honcho's config surface is large, so options like per-agent timeouts and provider base URLs can be pointed at your own keys/proxies to exercise a change:
  • skills/verify/SKILL.md: uv run pytest tests/
  • skills/verify/SKILL.md: uv run python -m tests.unified.run
  • skills/verify/SKILL.md: uv run python -m tests.unified.run --test-dir tests/unified/test_cases
  • skills/verify/SKILL.md: uv run pytest tests/live_llm -n 0 --live-llm --no-header -q

Install scripts (3)

  • honcho-cli/src/honcho_cli/commands/install.py: python honcho-cli/src/honcho_cli/commands/install.py
  • honcho-cli/src/honcho_cli/commands/setup.py: python honcho-cli/src/honcho_cli/commands/setup.py
  • honcho-cli/src/honcho_cli/local/setup.py: python honcho-cli/src/honcho_cli/local/setup.py

Hooks (3)

  • integrations/cursor/hooks/hooks.json (sessionStart): bun run ${CURSOR_PLUGIN_ROOT}/dist/hook.js session-start
  • integrations/cursor/hooks/hooks.json (beforeSubmitPrompt): bun run ${CURSOR_PLUGIN_ROOT}/dist/hook.js before-submit-prompt
  • integrations/cursor/hooks/hooks.json (afterAgentResponse): bun run ${CURSOR_PLUGIN_ROOT}/dist/hook.js after-agent-response
  • Medium risk: runs-git-hook-remote-exec (.pre-commit-config.yaml:4)
  • Medium risk: runs-git-hook-remote-exec (.pre-commit-config.yaml:26)
  • Medium risk: runs-git-hook-remote-exec (.pre-commit-config.yaml:38)
  • Medium risk: runs-git-hook-remote-exec (.pre-commit-config.yaml:138)
  • Medium risk: runs-git-hook-remote-exec (.pre-commit-config.yaml:146)
  • Medium risk: runs-instruction-instruction-network (examples/zo/SKILL.md:18)
  • Medium risk: runs-instruction-instruction-network (skills/honcho-integration/SKILL.md:119)
  • Medium risk: runs-instruction-instruction-network (skills/honcho-memory/SKILL.md:61)
  • Low risk: network-instructions (examples/zo/SKILL.md:29)
  • Low risk: scripts-present (honcho-cli/src/honcho_cli/commands/install.py)
  • Low risk: scripts-present (honcho-cli/src/honcho_cli/commands/setup.py)
  • Low risk: scripts-present (honcho-cli/src/honcho_cli/local/setup.py)
  • Low risk: scripts-present (scripts/check_alembic_heads.py)
  • Low risk: scripts-present (scripts/ensure_alembic_tests.py)
  • Low risk: scripts-present (scripts/run_alembic_tests.py)

Attribution and licence

Created by
Plastic Labs
Declared authors
  • Plastic Labs (declared in pyproject.toml)
Publisher
Plastic Labs (Official Plastic Labs project)
Source
plastic-labs/honcho · commit fae2719
Licence
GNU Affero General Public License v3.0 only (files served here)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Plastic Labs.

Install from source

498 of its files are not served here, so there is no ZIP. plastic-labs/honcho at fae2719