@vectorize-io/hindsight-coding-agents
v0.9.0
Published
Reflect-only Hindsight long-term memory for coding agents (harness-pluggable: opencode, …), with automatic background ingestion (no setup CLI).
Readme
hindsight-coding-agents
Long-term project memory for coding agents, backed by Hindsight. One package, several agents: a shared reflect-and-inject core with a thin entry point per agent (Claude Code, Codex CLI, DeepAgents Dcode, opencode, opencode 2, Kilo CLI, Cursor CLI, GitHub Copilot CLI, Grok Build, Qwen Code, Kimi Code, Factory Droid, ZCode, TraeCode, Antigravity CLI, Devin CLI, Cline CLI, pi, Prime Agent, DeepSeek Harness, WorkBuddy, CodeBuddy). Ingestion is fully automatic — there is no setup command: a repo's git history and conversations flow into its memory bank in the background as you work.
The premise: most of a real fix is derivable from the code, but the last mile often hinges on a project-specific decision that isn't in the code at all — a rounding rule, a retry allowlist, a tie-break policy. Those decisions live in git history and past conversations. This package puts them in front of the agent at the moment it starts working, and keeps a curated set of pages (architecture, conventions, in-flight initiatives) that future sessions start from.
The agent reads those pages through the hindsight_search_pages, hindsight_list_pages and
hindsight_read_page tools. Before the rename they were hindsight_search_knowledge_pages,
hindsight_list_knowledge_pages and hindsight_read_knowledge_page: a permission rule in your
agent's own settings that names an old tool needs the new name.
Does it work?
AMB's sdebench is the measurement: a coding agent over 61 real repository tasks, three runs each, with and without memory.
Accuracy is not what moves — every run solves 60–61 of the 61 either way. These are tasks a good agent can already do. What memory changes is how much it costs you to get there: how often you have to stop and correct the agent, and what the tokens cost.
| Agent | Corrections / task | Cost / task | | ----------- | ------------------ | ------------------- | | Claude Code | 0.85 → 0.36 | $0.445 → $0.338 | | Codex CLI | 1.34 → 0.47 | $0.577 → $0.276 | | opencode | 1.20 → 0.80 | $0.634 → $0.553 |
No memory → with Hindsight, mean of 3 runs. Corrections reproduce the labels AMB prints on its own chart; cost is derived from the same per-run table.
Both numbers move together, and that is the mechanism rather than a coincidence. A correction is a round trip: the agent guesses a project-specific decision wrong, you stop it, you explain, it redoes the work. Every one of those costs a turn of tokens and a turn of your attention. Handing the agent the decision before it starts — the rounding rule, the retry allowlist, the tie-break policy that was settled in a commit message or a conversation months ago — removes the guess, and the round trip with it.
Install
npx @vectorize-io/hindsight-coding-agents install all # every detected agent, wired natively
npx @vectorize-io/hindsight-coding-agents install claude-code # or just one
npx @vectorize-io/hindsight-coding-agents uninstall all # removes exactly what install added
npx @vectorize-io/hindsight-coding-agents update # refresh the runtime only, no rewiring
npx @vectorize-io/hindsight-coding-agents stats # how often each agent uses Hindsightinstall takes an explicit target — all, or one or more harness names. A bare
npx @vectorize-io/hindsight-coding-agents install changes nothing and prints the choice, so wiring every agent on
the machine is never something that happens by accident. Updating is the same install
command again — it re-copies the runtime in place.
Day to day you should not have to: once a day, a session start checks npm and re-stages a newer
runtime in the background (autoUpdate, on by default — set it to false to pin the version you
have). It only replaces a runtime that npx installed: a copy from npm i -g, a project dependency
or a local checkout is left alone. Running update or install yourself is different — it re-stages
the published release over whatever is installed, a local build included. update refreshes the copy
every wired agent already points at and deliberately touches no host config; re-run install
yourself after a release that adds a new hook, or to wire another agent.
On a terminal it also asks where memory should live — Hindsight Cloud, a server you run, or a
local daemon on this machine (see Where memory lives). Scripted installs pass
--server cloud|self-hosted|daemon instead; it is asked only once, and never again on re-install.
Already have a server called hindsight?
Each agent keeps one list of MCP servers, keyed by name, and this package registers its own as
hindsight. If one of yours already has that name (another Hindsight deployment, a team bank),
install stops with a message and leaves it alone. Give ours another name:
npx @vectorize-io/hindsight-coding-agents install all --mcp-name hindsight-codeThe name is saved as mcpServerName in ~/.hindsight/coding-agent.json, so later installs and
uninstalls use it without the flag. Installing again with another name moves our server to it.
Uninstall only ever removes the server this package wrote, whatever it is called. The tools keep
their names (hindsight_search_pages, …); only the prefix the agent adds follows the server
(mcp__hindsight-code__hindsight_search_pages in Claude Code). Dcode is the exception: its server
ships inside the plugin and Dcode prefixes it with the plugin's name, so it never clashes and the
flag does not change it.
Per agent
Same command, only the harness name changes. Run after installing the package globally.
Claude Code
npx @vectorize-io/hindsight-coding-agents install claude-code3 hooks in ~/.claude/settings.json, MCP via claude mcp add (user scope), and the companion skill.
Codex CLI
npx @vectorize-io/hindsight-coding-agents install codex3 hooks in ~/.codex/hooks.json plus [mcp_servers] in config.toml (needs codex_hooks = true).
DeepAgents Dcode
npx @vectorize-io/hindsight-coding-agents install dcodeThe installer registers this package as a local marketplace with Dcode, then invokes Dcode's own
plugin install command. The package is a native Agent Plugin: its root plugin.json contributes the shared skill, the
Hooks V2 SessionStart, UserPromptSubmit, and Stop lifecycle, and the namespaced
hindsight_* MCP server. Enable the plugin through Dcode's normal plugin manager; no Dcode config
patcher or compatibility bridge is required.
Dcode namespaces a plugin's MCP tools, so they appear as
plugin__hindsight-coding-…__hindsight_… rather than under their bare names — the agent resolves
them from the tool guide either way. In headless runs (dcode -n) Dcode allows the read-only
Hindsight tools and gates the two that write (hindsight_ingest_document,
hindsight_capture_initiative) behind an approval it has no UI for; use the interactive TUI to
capture an initiative or ingest a document. For the same reason Dcode gets no one-time codebase
survey: the survey runs only under the current agent's own CLI, and only Claude Code, Codex,
Antigravity and opencode v1 have a headless, read-only recipe for it.
opencode
npx @vectorize-io/hindsight-coding-agents install opencodeA plugin entry in ~/.config/opencode/opencode.json — native tools, no MCP needed.
opencode 2
npx @vectorize-io/hindsight-coding-agents install opencode2opencode v2 (npm @opencode/cli) exposes an opencode2 binary alias alongside opencode and
rewrote the plugin API, so it is a harness of its own. It writes the same plugin entry to the same
~/.config/opencode/opencode.json — the two CLIs share that file, and v1 rejects the whole config
if it sees v2's plugins key — and each CLI then loads its own entry point from the one registered
path. So installing either harness wires both, and uninstalling either removes the shared entry.
Two differences from v1, both because of the host: there is no one-time codebase survey (v2 plugins
cannot define the read-only agent the survey needs, and the survey never borrows another agent's
CLI), and the seed banner is written to the plugin log instead of a TUI toast (v2 plugins cannot
raise one). Recall, injection, the native hindsight_* tools and session write-back are identical.
The companion skill is identical too, but it is registered in memory through v2's skill API rather
than copied into a skills directory — opencode2 has none of its own, and the two it reads belong to
other agents.
Kilo CLI
npx @vectorize-io/hindsight-coding-agents install kiloA plugin entry in ~/.config/kilo/kilo.json[c].
Cursor CLI
npx @vectorize-io/hindsight-coding-agents install cursor-cliHooks in ~/.cursor/hooks.json, ~/.cursor/mcp.json, and the companion skill.
GitHub Copilot CLI
npx @vectorize-io/hindsight-coding-agents install copilot-cli~/.copilot/hooks/, mcp-config.json, and the companion skill.
Grok Build
npx @vectorize-io/hindsight-coding-agents install grok-buildNative hooks in ~/.grok/hooks/hindsight.json, MCP in ~/.grok/config.toml, plus the companion
skill. Grok also runs Claude Code's hooks from ~/.claude/settings.json; those stay silent inside
Grok, so a machine wired for both hosts records each Grok session once. Grok passes hook context to
the model only from tool hooks, so the session and prompt context arrive with the result of the
agent's first tool call after each prompt (a PostToolUse hook).
Qwen Code
npx @vectorize-io/hindsight-coding-agents install qwen-codeNative hooks in ~/.qwen/settings.json, plus MCP and the companion skill.
Qwen's hook
timeoutis in milliseconds (its own docs: "Timeout in milliseconds, default 60000"), unlike every other supported agent, so the installed values are30000/30000/60000. Recall fires on genuine submissions only —UserPromptSubmitalso fires on tool-result continuations, so interactive sessions recall once per prompt while headless (qwen -p),serve, SDK and ACP sessions seed and retain but do not recall.
Kimi Code
npx @vectorize-io/hindsight-coding-agents install kimi-codeNative hooks in ~/.kimi-code/config.toml, plus MCP in ~/.kimi-code/mcp.json and the companion skill.
(Hooks and MCP go under $KIMI_CODE_HOME instead when it is set.)
Kimi's SessionStart hook cannot reach the model, so the session briefing is silent there; recalled memory arrives on the first prompt instead, as a
<hook_result>block. Sessions are retained from every agent'swire.jsonlunder the session directory, subagents included.
Factory Droid
npx @vectorize-io/hindsight-coding-agents install factory-droid4 hook registrations in ~/.factory/hooks.json (user scope), including a cancellation-safe
Notification write-back, plus a stdio MCP registration under
mcpServers.hindsight in ~/.factory/mcp.json, and the companion skill in ~/.factory/skills.
The installer touches only JSON files - no Droid CLI round-trip - and refuses to overwrite a
user-managed MCP server already named hindsight. Droid's hook protocol matches Claude Code's
(session_id/transcript_path/cwd in, hookSpecificOutput.additionalContext out). Recall and
injection use the same protocol; write-back also handles Droid's cancellation notification because
Droid does not emit Stop after a cancelled turn.
ZCode
npx @vectorize-io/hindsight-coding-agents install zcodeThree hook registrations plus a stdio MCP server under mcp.servers.hindsight, both in ZCode's own
CLI config ~/.zcode/cli/config.json - never your real Claude Code settings, even though ZCode
embeds the Claude Code agent runtime and speaks its hook protocol. The companion skill goes to
~/.zcode/skills. Config hooks ship disabled, so the installer also sets hooks.enabled to
true; uninstall removes the whole block again when nothing else is registered there, and
refuses to touch an MCP server named hindsight that it did not write.
ZCode's hook
timeoutMsis in milliseconds (installed values30000/30000/60000), andhooks.maxOutputBytescaps what a hook may print - anything larger is dropped, injection and all. The installer seeds it at32768only when your config does not already set one.ZCode keeps no durable session transcript:
Stopcarries the reply plus a temp, assistant-only file it deletes as soon as the hook returns, and no user prompt at all. So this is the one agent whose conversation the plugin journals itself - the prompt hook records what you asked, theStophook records the reply - and the write-back then behaves like every other agent's, appending each new turn to the same session document.--import-conversationsis therefore not available for ZCode: there is no past history on disk to backfill from.
TraeCode
npx @vectorize-io/hindsight-coding-agents install traecodeThree hook registrations in TraeCode's user-level hooks.json, the companion skill under the
same dot-dir's skills/, and two filesystem.readWrite rules in sandbox.json — one for
~/.hindsight, without which the hooks fail silently (exit 0, no effect) because the sandbox
blocks those writes, and one for Trae's per-window storage DBs
(<userData>/User/workspaceStorage), which the SessionStart hook seeds with the workspace's
MCP enable switch. Network is allowed by default. TRAE ships two editions with different brand
roots — the CN build uses ~/.trae-cn and "Trae CN", the international build ~/.trae and
"Trae" — so every path resolves by probing for the edition dir that exists and defaulting to the
CN names. Plain JSON files, no CLI round-trip. TraeCode speaks Claude Code's hook protocol, so
recall and injection work exactly as they do there; the event map lives under the top-level
hooks key and the version field the host writes is preserved.
MCP is registered per repo, never at the user level: Trae launches user-level servers with the
Electron process's cwd (your home directory), where a hindsight entry either self-disables under
optInOnly (zero tools) or resolves the home bank instead of the repo's. So the installer
pre-seeds the per-repo registration for every repo opted in via mapPathToBank — a
mcpServers.hindsight stdio server in <repo>/.trae/mcp.json, pinned to that repo via
HINDSIGHT_MCP_PROJECT_CWD — migrates any stale user-level entry back out of
<userData>/User/mcp.json, and seeds the per-workspace enable switch directly. The SessionStart
hook re-checks both on every session and writes them only when missing or stale (idempotent
fallback) — Trae's hook sandbox cannot be relied on to perform those writes itself. The per-repo
file is merged not clobbered, and gitignored when the repo has a .gitignore (the path is
machine-specific). A foreign hindsight entry — in either file — is the user's own server and
is never touched.
Trae only reads that per-repo file once the global trae.mcp.enableWorkspaceMcp setting is on
(default off), so the installer handles the gate: an interactive run asks, a non-interactive run
takes --enable-workspace-mcp, and either way the setting is written and Trae windows must be
restarted to pick it up (declining, or a settings file with comments, prints the manual step).
Registrations and enable switches take effect on the NEXT window, so the MCP tools appear when
you reload after the first session; repos opted into mapPathToBank after install need one more
install traecode run, and if a repo's server still shows disabled in the MCP panel, flip it on
once there.
One manual step remains after install (UI state the installer cannot write): enable the hooks under TraeCode Settings > Hooks. If you declined the workspace-MCP prompt, enable it later in Trae settings (search "enableWorkspaceMcp").
TraeCode keeps no readable session transcript - sessions live in an encrypted local DB or the cloud. Like ZCode, its conversation is journaled by the plugin itself: the prompt hook records what you asked, and the
Stophook closes the turn with the reply it carries inlast_assistant_message.--import-conversationsis therefore not available for TraeCode: there is no past history on disk to backfill from.
Antigravity CLI
npx @vectorize-io/hindsight-coding-agents install agyLifecycle hooks, MCP, and the Hindsight · <bank> status line.
Devin CLI
npx @vectorize-io/hindsight-coding-agents install devin-cliHooks in ~/.config/devin/config.json plus MCP. Needs Node 22.5+ — see below.
Cline CLI
npx @vectorize-io/hindsight-coding-agents install cline-cliA native plugin via cline plugin install, plus MCP and the companion skill.
pi
npx @vectorize-io/hindsight-coding-agents install piAn extension entry in ~/.pi/agent/settings.json, plus the companion skill in
~/.pi/agent/skills — native tools, no MCP needed.
This command is the only supported route. Installing us as a pi package (pi install
npm:@vectorize-io/hindsight-coding-agents) is deliberately not wired: Prime Agent 0.9 read the same
pi key of a package's package.json, and a key that names one entry for two hosts makes one of
them report itself as the wrong agent. So the package carries no pi key at all.
Prime Agent
npx @vectorize-io/hindsight-coding-agents install prime-agentNeeds Prime Agent 0.10 or later (the Rust rewrite); 0.9 and earlier are no longer supported. 0.10 removed the extension system and has no hooks, so the install writes the three things it does load:
- an MCP server,
hindsight, in~/.prime/agent/settings.json. Prime's agent calls MCP tools from Python (await mcp.call_tool("hindsight", "hindsight_reflect", {...})), and starts the server on the first call. While it runs, the server also saves the session's transcript to memory. - a short block in
~/.prime/agent/AGENTS.md(or your existing globalCLAUDE.md) asking the agent to ask memory (hindsight_reflect) at the start of every task. Without a hook this is the only way to bring recall in, so it is up to the model to follow it. - the companion skill in
~/.prime/agent/skills.
A session where the agent never calls a Hindsight tool is not saved, because the server never
started. install prime-agent --import-conversations, run in the repo, backfills those from
Prime's session files. Re-running the install on a machine wired for 0.9 removes the old
extensions entry, which 0.10 ignores. Uninstall removes all three.
pi and Prime Agent share one bank per repo (the default coding-agent::{gitProject}), like any
other pair of agents, and each stamps its own agent on the documents it retains.
DeepSeek Harness
npx @vectorize-io/hindsight-coding-agents install dshA Cordis plugin row in $DSH_HOME/cordis.patch.yml (~/.dsh by default), which every dsh profile
composes — native tools, no MCP needed. Two dsh-specific notes: one dsh process serves several
repositories (its Web UI opens each session in whatever directory you pick), so the bank is
resolved per session workspace rather than once per process; and dsh has no plugin-facing notice
channel, so the seed line goes to the plugin log rather than the UI. A forked session saves only
the turns it adds after the fork — the part it inherited is already in the parent's conversation.
Everything model-facing —
recalled memory, the pages preamble, the hindsight_* tools — is unaffected. If you prefer the
published-package route, dsh plugin --profile web add @vectorize-io/hindsight-coding-agents works
too: the package ships the profile patch layer, so nothing else needs editing. Either route gets the
companion skill — a plugin wired by the host's own plugin manager installs it itself on the first
session, since that route never runs our installer.
WorkBuddy
npx @vectorize-io/hindsight-coding-agents install workbuddy3 hooks in ~/.workbuddy/settings.json, the stdio MCP server in ~/.workbuddy/mcp.json, and the
companion skill in ~/.workbuddy/skills. WorkBuddy (Tencent's AI workbench) is built on the shared
@genie/agent-cli engine, so its hooks follow Claude Code's protocol — the main difference is the
transcript schema (type:"message" records carrying top-level role/content), which the
package's own reader normalizes.
CodeBuddy
npx @vectorize-io/hindsight-coding-agents install codebuddy3 hooks in ~/.codebuddy/settings.json, the stdio MCP server in ~/.codebuddy/.mcp.json — the
recommended file: the installer follows CodeBuddy's documented fallback chain, merging into an
existing deprecated ~/.codebuddy/mcp.json or legacy ~/.codebuddy.json rather than shadowing it —
and the companion skill in ~/.codebuddy/skills. CodeBuddy Code runs the same @genie/agent-cli
engine as WorkBuddy — WorkBuddy merely ships it with a different home folder — so it reuses
WorkBuddy's hook runtime, and differs only in the root it writes to.
Both CodeBuddy hosts are covered, and they do not store sessions alike. CodeBuddy Code (the CLI)
writes the WorkBuddy JSONL that the shared reader parses. The IDE hands the Stop hook its own
per-conversation directory instead — CodeBuddyIDE/<uid>/history/<md5(workspace)>/<conversationId>/,
whose index.json is the transcript_path and whose prose sits one level down, in
messages/<messageId>.json — so the reader dispatches on the shape it was handed
(core/transcript-codebuddy-ide.ts).
Uninstall the same way: npx @vectorize-io/hindsight-coding-agents uninstall claude-code (or uninstall all).
Devin CLI needs Node 22.5 or newer. Its hooks pass only a session id — the conversation itself
lives in ~/.local/share/devin/cli/sessions.db — so reading it depends on Node's built-in
node:sqlite. Installing devin-cli checks for this first and refuses (with the reason) rather
than wiring hooks that could never retain anything. Every other agent works on any supported Node.
install copies what it needs into ~/.hindsight/coding-agents and points each agent's wiring
there, so nothing depends on where you ran it from. Updating is the same command again — it
re-copies the runtime in place, leaving the wiring valid and every new session on the new version.
install merges the native wiring (hooks + MCP registration where the host wants them) into each
agent's own config, preserving everything already there; it is idempotent (re-run after moving the
package) and backs up any pre-existing file it touches as <file>.hindsight-backup. uninstall
removes only our entries. On every skills-capable host the install also ships two companion
skills into that host's skills directory (on Claude Code, ~/.claude/skills/):
hindsight-coding-agent teaches the agent everyday use — what "store this in hindsight" should do,
the tool surface, correcting a wrong memory — and hindsight-coding-agent-setup covers install,
per-repo configuration and debugging, so users can ask the agent itself. Manual wiring per harness,
if you prefer:
opencode and opencode 2 install directly — point opencode.json at the package dir:
{ "plugin": ["/path/to/hindsight-coding-agents"] }One entry, both CLIs: v1 resolves that directory through package.json main, v2 through its
index.js, so each loads its own plugin.
Claude Code and Codex get their full three-hook + MCP wiring from this package's own
installer — npx @vectorize-io/hindsight-coding-agents install claude-code / install codex. This package's bin
entries (hindsight-claude-hook, hindsight-codex-hook,
hindsight-cursor-hook) are the individual injection-only UserPromptSubmit entrypoints for a
minimal, hand-wired setup.
Adding an agent: hook-based → write a HookSpec entry point (see src/cursor-hook.ts) and register
a hookAdapter in src/harness/registry.ts; persistent-plugin → implement HarnessAdapter
(src/core/types.ts) fully (see src/harness/opencode.ts), or bind the host's own plugin API to
RuntimeCore directly when it is not an opencode fork (see src/cline.ts, src/dsh.ts).
Migrating from the per-agent plugins
The older per-agent integrations (hindsight-claude-code, hindsight-cursor-cli, hindsight-codex, …) are superseded by this package. Two things move; nothing else does.
Your server moves automatically. If ~/.hindsight/claude-code.json or ~/.hindsight/codex.json
exists, install adopts its endpoint — hindsightApiUrl → apiUrl, hindsightApiToken →
apiToken, and an empty URL means the local daemon, as it did there. The agent you are installing
is checked first, so wiring Codex takes Codex's server even if an old claude-code.json is still
lying around. You already chose where your memory lives; defaulting to Cloud instead would quietly
send your prompts somewhere else. Pass --server to override. (Those two are the only old plugins
that shipped a user config — Cursor CLI, Copilot CLI, opencode and Cline have no endpoint to carry.)
Your conversations are re-imported from local disk, as new documents:
cd /path/to/your/repo
npx @vectorize-io/hindsight-coding-agents install claude-code --import-conversations # or: install codex --import-conversationsThis re-extracts the transcripts the agent already wrote, so it costs tokens roughly in proportion to the history imported, and it is safe to re-run (ingestion dedups by document id).
Local transcripts are the source rather than the old bank, because the old bank cannot be split by
repo. Its default was a single static bank — dynamicBankId defaults to false, so everything
landed in one bank named claude_code — and its documents record only retained_at,
message_count and session_id, nothing identifying the project. Working out which documents
belong to which repo means joining session_id back to the cwd in the local transcript, so the
transcripts are needed either way; going through them directly is simply the shorter path.
How sessions are matched. A conversation is imported only when the session itself records the
directory it ran in — never inferred from a file or folder name. Claude Code writes that directory
on its entries, Codex in its session_meta header and DeepSeek Harness in its session-log header,
and pi and Prime Agent in their session header, so all five can be attributed exactly, including
sessions started in a subdirectory of the repo. Guessing was tempting (Claude names its history
folders after the project path) but unsafe: / and . both encode to -, so repo-sub is either
the subdirectory repo/sub or an unrelated sibling repo — and a wrong guess files someone else's
conversation into your bank. Sessions that record nothing are skipped and the count is reported.
DeepSeek Harness logs are Zstandard-framed JSONL under $DSH_HOME/sessions, which needs Node 22.15+
to read; an older Node skips the import with that reason rather than silently importing nothing.
Dcode's transcripts record no directory at all — the working directory lives only in its LangGraph
checkpoint database — so the repo comes from dcode threads list --json, a declared, versioned
command contract rather than that internal schema; with the dcode CLI unavailable the import is
skipped with that reason. The other harnesses (opencode, opencode 2, Kilo, Cursor, Cline, Copilot, Devin) keep
history in internal SQLite databases with unversioned schemas and are skipped with a reason.
Nothing else is translated. The old plugin's behavioural settings — 12 recall*, 7 retain*,
bankMission/retainMission, dynamicBankGranularity — describe a pipeline this package replaced,
and reinterpreting them would be guesswork. Bank naming changes too: this package uses one bank per
repo (coding-agent::{gitProject}) shared by every agent. To keep the old naming instead:
{ "bankIdTemplate": "{harness}::{gitProject}" } // reproduces the old per-agent namingWhere memory lives
Three modes, chosen once when you install (install asks on a terminal; pass --server to script it):
| mode | what runs | needs |
| ------------- | ----------------------------------------- | ---------------------------------------- |
| cloud | Hindsight Cloud (default) | an API token |
| self-hosted | a Hindsight server you already run | its URL |
| daemon | a local hindsight-embed on this machine | uv on PATH + an LLM key for extraction |
npx @vectorize-io/hindsight-coding-agents install claude-code --server daemon
npx @vectorize-io/hindsight-coding-agents install claude-code --server self-hosted --api-url http://localhost:8888
npx @vectorize-io/hindsight-coding-agents install claude-code --server cloud --api-token <token>Re-running install never re-asks: a config that already names a server is left alone.
Local daemon mode
Nothing to sign up for and nothing to host — memory runs on your machine. The plugin starts
hindsight-embed on demand at 127.0.0.1:9077 and points every agent at it.
- A server already on the port is adopted, never restarted — so one daemon serves every agent
and every repo, and your own
hindsight-embedis reused if you already run one. - Cold starts happen in the background. The first start downloads the daemon and loads models, which takes longer than any hook is allowed to run, so it is launched detached at session start. A session that begins before it is ready simply has no memory for a turn or two — a daemon that isn't up is treated as an unreachable server, exactly like a Cloud or self-hosted outage, with the same error handling and the same diagnostics. Nothing downstream of the URL knows which mode it is.
- It keeps running until you stop it. There is deliberately no stop-on-exit: one daemon is shared, so ending one session must not cut memory out from under another agent still working.
- macOS additionally needs a current Rust toolchain.
litellm(a transitive dependency of the API) publishes wheels only for Linux and Windows, so a Mac compiles it from source through maturin and its crates pin a recentrustc. Install from rustup.rs and keep it updated — an out-of-date toolchain fails as surely as a missing one. Linux and Windows install from wheels and need none of this. - Fact extraction runs locally, so it needs an LLM.
HINDSIGHT_API_LLM_PROVIDERwins if set; otherwise the first ofOPENAI_API_KEY,ANTHROPIC_API_KEY,GEMINI_API_KEY,GROQ_API_KEY; otherwise the Claude Code CLI, which needs no key.installtells you which it found.
Daemon settings keep the names the old per-agent Claude Code plugin used, so an existing environment carries over unchanged:
| field | env | default | meaning |
| ------------------- | ------------------------------- | -------------- | ---------------------------------------------------------- |
| serverMode | HINDSIGHT_SERVER_MODE | cloud | cloud | self-hosted | daemon |
| apiPort | HINDSIGHT_API_PORT | 9077 | port the local daemon listens on |
| daemonIdleTimeout | HINDSIGHT_DAEMON_IDLE_TIMEOUT | — | deprecated, ignored: the daemon no longer exits on its own |
| daemonProfile | HINDSIGHT_DAEMON_PROFILE | coding-agent | which local database it uses |
| embedVersion | HINDSIGHT_EMBED_VERSION | latest | which hindsight-embed release to run |
| embedPackagePath | HINDSIGHT_EMBED_PACKAGE_PATH | — | run a local checkout instead (development) |
Any HINDSIGHT_API_* variable you export is forwarded to the daemon, so server-side settings need
no equivalent here.
Configuration
Configuration is one JSON file: ~/.hindsight/coding-agent.json. Layering, later wins per field:
- built-in defaults
- environment variables —
HINDSIGHT_API_URL,HINDSIGHT_API_TOKEN, and one per scalar setting (HINDSIGHT_<FIELD_IN_CAPS>), for containers and CI that inject config rather than write a file - the file's top level
- its
harnesses.<name>section — per-agent override - its
paths.<prefix>section — per-directory override, applied after the bank is resolved (see Per-directory overrides) - its
banks.<resolvedBankId>section — per-repo override, applied after the bank is resolved (see Per-repo opt-in/out)
Environment variables are a fallback: the file wins wherever it sets a value, so adding env to
an existing setup changes nothing. The list-valued settings, retainTags, recallTags and optInPaths, take
a comma-separated value (HINDSIGHT_RETAIN_TAGS="project:{gitProject},env:work"); entries are
trimmed and blanks dropped.
The map-valued settings (mapPathToBank, harnesses, paths, banks, retainMetadata) are file-only —
per-key branching doesn't survive flattening into one variable. maxParallelRetains is available
as HINDSIGHT_MAX_PARALLEL_RETAINS for containers and CI.
HINDSIGHT_CONFIG moves the file itself — point it at another path for a container or a test
harness where $HOME is not the right anchor. It is still exactly one file; only its location
changes. (The other variables that are not settings are HINDSIGHT_LOG_FILE, HINDSIGHT_DIAG_FILE,
HINDSIGHT_USAGE_FILE and HINDSIGHT_LOG_LEVEL — see Diagnostics & logging.)
When a change takes effect
Config is read when a process starts — the file is not watched — so when an edit applies depends on what reads it:
| host | reads the file | an edit applies |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | -------------------------- |
| hook harnesses (Claude Code, Codex CLI, Cursor CLI, GitHub Copilot CLI, Grok Build, Antigravity CLI, Devin) | once per hook invocation — each hook is its own short-lived process | on your next prompt |
| persistent plugins (opencode, opencode 2, Kilo CLI, Cline CLI, pi, DeepSeek Harness) | once per workspace, when the host loads the plugin | after restarting the agent |
| the MCP server behind the hindsight_* tools | once at startup | in your next session |
apiToken is the exception. Every host re-reads it when the server rejects a request, so enabling
authentication or rotating the key is picked up on the next call with nothing to restart —
otherwise a rotation would leave a long-running agent failing every memory call until it was
restarted. Everything else follows the table: apiUrl, disabled, bank routing, gitIngest, and
the survey and page settings.
hindsight_diagnose reports both sides of that gap — what the file says now, and what the running
client is actually using.
Opt-in only
By default every project gets memory — that is what makes the plugin zero-setup. If you would rather nothing be remembered until you say so, turn memory off everywhere and name the projects that may use it:
{
"optInOnly": true,
"optInPaths": ["~/work/client-x", "~/oss"],
}Anything outside those paths is inert: no bank is created, nothing is retained, no seed runs,
and the agent behaves exactly as it would without the plugin. Approving costs nothing else —
optInPaths says which projects, not which bank, so an approved repo keeps its usual
coding-agent::{gitProject} name. Paths are prefixes, so approving ~/work approves every repo
under it while each still gets its own bank.
A mapPathToBank entry counts as opted in too, since routing a path to a named bank already
declares that project. A bare bankId does not: it names a bank rather than a project, so it
cannot say which work may be remembered, and a privacy switch has to fail closed.
There is no per-repo opt-in file, for the same reason there is no repo-carried config at all: a cloned repository must not be able to turn memory on.
There is deliberately no repo-carried config file — per-repo bank routing is mapPathToBank,
per-agent differences are harnesses.<name>.
Each entry point knows which harness it is (the opencode plugin is loaded by opencode, the codex hook by Codex...), so one shared config serves several agents side by side:
{
"apiUrl": "https://api.hindsight.vectorize.io",
"harnesses": {
"opencode": { "reflectTimeoutMs": 60000 },
"claude-code": { "disabled": true }, // e.g. memory off for Claude only
},
}Reference
| field | default | meaning |
| ----------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| apiUrl | https://api.hindsight.vectorize.io | Hindsight API base URL (set to http://localhost:8888 for a local server) |
| apiToken | — | bearer token, required for Hindsight Cloud: with the Cloud URL and no token, memory stays off instead of sending requests Cloud would refuse. Picked up without restarting the agent: a long-lived host re-reads it after a rejected request, so enabling auth or rotating the key mid-session recovers on the next call |
| mcpServerName | hindsight | the name this package's MCP server is registered under in every agent, so it can sit beside a server of your own called hindsight. Set it with install --mcp-name <name>; letters, digits, - and _, up to 64. Top level only: never read from harnesses, banks or paths. Not used by Dcode |
| apiHeaders | — | extra HTTP headers sent with every request, as a map of name to value. For a server behind a proxy that checks its own header, e.g. Cloudflare Access: {"CF-Access-Client-Id": "<id>.access", "CF-Access-Client-Secret": "<secret>"} (a Cloudflare service token). Fixed values only; Authorization stays the plugin's own when apiToken is set. Can be set per directory under paths |
| bankId | — | explicit static bank; unset ⇒ per-repo dynamic resolution (below) |
| dynamicBankId | dynamic iff no bankId | force dynamic (true) or static (false) resolution |
| bankIdTemplate | "coding-agent::{gitProject}" | dynamic bank id format; the default makes every agent share one bank per repo |
| mapPathToBank | — | absolute path → bank; longest prefix wins; linked worktrees inherit their main checkout's mapping; overrides everything |
| optInOnly | false | run memory ONLY in opted-in projects — everything else is inert, with no bank created; see Opt-in only |
| optInPaths | — | directories opted in, matched as prefixes with ~ expanded; each repo beneath and its linked worktrees are approved while keeping their own dynamic bank |
| resolveWorktrees | true | linked worktrees inherit the main checkout's bank identity, path approval, and mapping |
| retainTags | — | extra tags on every document written by the integration, e.g. ["project:{gitProject}"] — see Recording where a memory came from below |
| retainMetadata | — | extra metadata on every document written by the integration, e.g. {"repo": "{gitProject}"} |
| retainContext | see description | the context sent with every session write-back. Extraction reads it to decide whose claim a sentence is, so the default names both speakers, and asks for an agent's own "fixed" or "passes" to be stored as its claim rather than as fact. Accepts the same {placeholder} templates as retainTags |
| keepToolInputs | — | tools whose input is what the agent said to the user, kept in full as an assistant turn instead of a bare action line: a chat bridge's reply tool (Claude Code Channels: Telegram, Discord, …), or a command-line tool that delivers the reply. Keyed by the tool name as the transcript records it, the value names the input field holding the text: {"mcp__plugin_telegram_telegram__reply": "text"}. For a shell tool that also runs everything else, add a regex the field must match: {"exec_command": {"field": "command", "match": "^send-reply "}}. Add a named group text to the regex to keep only the message, e.g. "^send-reply \"(?<text>[\\s\\S]*)\"$". Kept text is capped at 8000 characters. A call the host reports as failed stays a bare action line on Claude Code, Codex in code mode, opencode, opencode2 and kilo; on the other harnesses (and plain Codex function calls) a failed send is kept as said. Does nothing on antigravity-cli, cline-cli, copilot-cli, devin-cli, traecode and zcode, whose readers keep no tool calls. A bad rule is dropped with a warning. Global or per harness, not per bank; a harnesses.<name> entry replaces the global map rather than merging into it. File-only, like recallOptions |
| recallTags | — | tags every read is narrowed to: the automatic recall and reflect injected before a prompt, and hindsight_reflect. Same placeholders as retainTags, e.g. ["project:{gitProject}"] on a shared bank. Unset reads the whole bank. See Reading back only this repo's memories |
| recallTagsMatch | "any" | how recallTags match: "any" (any of the tags, plus untagged memories), "all", "any_strict" or "all_strict" (untagged memories left out) |
| manageBankConfig | true | let the plugin shape the bank's own configuration — the retain strategies it writes under, the knowledge entity-label group, and, on a bank that has none, the missions. Writing is additive: it adds what the bank does not define and never overwrites what is there, so your control-plane edits survive — the one exception is the extraction mode of its own strategies, which follows retainExtractionMode. Set false to keep it out of the bank config entirely — see A bank you shape yourself
