Add AI-native memory to OpenCode
Give OpenCode long-term memory that survives context wipes, session restarts, and fresh chats. Honcho remembers what you're working on, durable preferences, and prior context across your projects.
- Go to app.honcho.dev
- Sign up or log in
- Copy your API key
This package installs the Honcho plugin into OpenCode and writes the Honcho command templates into your global OpenCode config.
npx @honcho-ai/opencode-honcho installThis installer expects the opencode CLI to already be installed and available on your PATH.
If the installer cannot find opencode, restart your shell or source your shell config and run the command again.
- Start OpenCode
- Run
/honcho:setup - Keep the default
Honcho Cloudoption unless you explicitly want a self-hosted or local endpoint - Enter your Honcho API key
- Run
/honcho:statusto verify the runtime
/honcho:interview
This captures durable preferences or stable project context into Honcho memory.
- Persistent Memory - OpenCode can retain durable context across sessions
- Cloud or Local Deployments - Use Honcho Cloud or point at a self-hosted or local Honcho instance
- Workspace Mapping - OpenCode projects map to Honcho workspaces
- Session Mapping - Sessions can be scoped per directory, repo, branch, chat instance, or globally
- Durable Writes - Honcho can retain stable conclusions and session context
- Memory Retrieval - Search memory, query Honcho knowledge, and inject relevant context into prompts
- Peer Modeling - Supports the default classic peer model and optional hierarchical modeling for delegated agent flows
The installer:
- registers
@honcho-ai/opencode-honchowith OpenCode - enables both native server and TUI plugin targets
- writes Honcho command templates into global OpenCode config
- activates the plugin globally for all OpenCode projects
OpenCode Honcho configuration lives in:
- global config:
~/.config/opencode/honcho.json - optional project override:
.opencode/honcho.json
The global config is the normal place to start. Project config is only needed when a specific repo should behave differently.
For Honcho Cloud:
honchoApiKeyis requiredbaseUrlshould remainhttps://api.honcho.dev
For self-hosted or local Honcho:
baseUrlshould point to your deployment, for examplehttp://127.0.0.1:8000honchoApiKeyis required only if that deployment requires authentication
If OpenCode is running in Docker or another remote environment, localhost may not refer to your machine. The configured baseUrl must be reachable from the OpenCode host runtime.
| Strategy | Behavior | Best for |
|---|---|---|
per-directory |
One session per working directory | Default project memory |
per-repo |
One session per repository | Repos with multiple entry directories |
git-branch |
Session changes with the current branch | Branch-specific workflows |
per-session |
New session for each OpenCode session id | Short-lived isolated work |
chat-instance |
Session follows the current chat instance | Highly ephemeral usage |
global |
One session for everything | Shared memory across all work |
| Command | Description |
|---|---|
/honcho:setup |
First-time setup for cloud or local Honcho |
/honcho:status |
Show effective Honcho status for the current OpenCode project |
/honcho:settings |
Show effective config values and config paths |
/honcho:set |
Persist a config field in .opencode/honcho.json |
/honcho:unset |
Reset a project config field back to its default |
/honcho:mode |
Change recallMode |
/honcho:write |
Change writeFrequency only. This does not create memory |
/honcho:interview |
Capture durable memory or preferences into Honcho |
The plugin exposes these tools inside OpenCode:
| Tool | Description |
|---|---|
honcho_setup |
Validate setup and persist shared credentials or endpoint settings |
honcho_status |
Show effective runtime status |
honcho_get_config |
Read effective and persisted settings |
honcho_set_config |
Update a persisted project setting |
honcho_search |
Search Honcho session memory |
honcho_chat |
Query Honcho for reasoning-backed context |
honcho_create_conclusion |
Save a durable memory conclusion |
The plugin uses these OpenCode plugin capabilities:
eventchat.messagetool.execute.aftercommand.execute.beforeexperimental.chat.system.transformexperimental.session.compactingshell.envtool
npm install
npm run build
npm test
npm run check
{ "enabled": true, "honchoApiKey": "hch-...", "baseUrl": "https://api.honcho.dev", "peerName": "", "aiPeer": "", "workspace": "", "globalOverride": false, "linkedHosts": [], "recallMode": "hybrid", "observation": "directional", "peerModel": "classic", "writeFrequency": "async", "sessionStrategy": "per-directory", "dialecticReasoningLevel": "low", "dialecticDynamic": true, "dialecticMaxChars": 600, "messageMaxChars": 25000, "saveMessages": true, "contextRefresh": { "messageThreshold": 30, "ttlSeconds": 300, "skipTrivialPrompts": true, "useSessionStartDialectic": true }, "hosts": { "opencode": { "workspace": "opencode", "aiPeer": "opencode", "linkedHosts": [] } } }