Files
Nicolò Boschi 188eaa3dc7 fix(coding-agents): honor retainSessions in the hook harnesses (#3596) (#3607)
* fix(coding-agents): honor retainSessions in the hook harnesses (#3596)

`retainSessions` was parsed, defaulted, env-mapped and accepted as a known
config key, but only `RuntimeCore` (opencode, Kilo, Cline, Prime Agent, dsh)
ever read it. The shared Stop-hook flow behind every hook harness — claude-code,
codex, cursor-cli, copilot-cli, devin-cli, grok-build, antigravity-cli — checked
`disabled` twice and `retainSessions` never, so `retainSessions: false` (global,
per-harness or in a `banks.<id>` section) wrote the transcript back anyway. The
comment claimed this was deliberate while the docs sold the flag as a general
write-back opt-out, including a per-bank example.

Gate the write-back in `runRetainHook`, after `applyBankConfig` so a bank
section can flip it either way, and before `ensureDaemon` — a session that
writes nothing has no reason to bring a server up. A `retain_disabled` diag
record replaces the `retain_ok` that used to appear, so the opt-out is
verifiable in the diagnostic log.

`deepen`'s conversation-history import is the same door one session later: it
reads the harness's own history files and files them as `chat:<id>`. Honoring
the flag in only one of the two places would have left the opt-out cosmetic, so
it skips the import too. Git ingest, seeding, knowledge pages, recall and the
memory tools are all untouched — that separation is what distinguishes this flag
from the `disabled` kill switch.

Tests: four end-to-end `runRetainHook` cases (default writes; global false
writes nothing and builds no client; a bank override opts one repo out; a bank
override re-enables under a global opt-out), two of which fail against the
pre-fix code. Plus a family-wide structural guard in the shape of
`daemon.test.ts`'s "every harness entrypoint reaches a daemon": every module
calling `retainLiveSession` or `ingestChats` must consult the flag. The path
that forgot is by definition the one with no test, so the guard is asserted over
the whole family rather than per-harness.

* chore(docs): re-sync the coding-agents page after the README reflow
2026-08-19 11:51:25 +02:00
..

Hindsight Integrations

First-party integrations that give popular AI agents, frameworks, and CLIs persistent long-term memory via Hindsight.

Each integration lives in its own subdirectory with its own README, configuration, and tests. Pick the one that matches the agent or framework you're using.

Coding agents & CLIs

Integration What it does Install
Claude Code Hooks-based memory for Anthropic's Claude Code. Auto-retains every session, recalls context on each prompt. npx hindsight-cc
OpenCode TypeScript plugin with retain/recall/reflect tools, auto-retain on idle, memory injection on session start, compaction preservation. Add @vectorize-io/opencode-hindsight to opencode.json
Codex CLI Python hook scripts for OpenAI's Codex CLI. Auto-recall on UserPromptSubmit, auto-retain on Stop. curl -fsSL https://hindsight.vectorize.io/get-codex | bash
Cursor CLI Python hook scripts for Cursor CLI. Auto-recall on beforeSubmitPrompt, auto-retain on stop, final flush on sessionEnd. ./scripts/install.sh
Copilot CLI Python hook scripts for GitHub Copilot CLI. Auto-recall on sessionStart/subagentStart, auto-retain on agentStop, final flush on sessionEnd. pip install hindsight-copilot-cli && hindsight-copilot-cli install
Continue.dev HTTP context provider for precise @hindsight recall in chat, plus optional MCP-server + rules for automatic recall/retain in agent mode. pip install hindsight-continue
GitHub Copilot (VS Code) MCP server config (.vscode/mcp.json) + a recall/retain rule for VS Code Copilot's agent mode. pip install hindsight-copilot
Devin Desktop Native MCP server config + always-on recall/retain rule for Devin Desktop (formerly Windsurf). pip install hindsight-devin-desktop
Roo Code Persistent memory for Roo Code VS Code extension. See README
Hermes (OpenAI Agents SDK) Memory layer for OpenAI Agents SDK. See README
Grok Build Hooks for Grok Build (xAI). See README
Claude Code Skills Skills integration for Claude Code agents. See README

Agent frameworks

Integration What it does
LiteLLM Proxy callbacks — every model proxied through LiteLLM gets memory. Zero code changes.
CrewAI Long-term memory tools for CrewAI agents.
Pydantic AI Dependency-injected memory for Pydantic AI agents.
Vercel AI SDK Persistent memory for Vercel AI SDK apps.
Vercel Chat Drop-in memory for the Vercel AI Chatbot.
LangGraph / LangChain Memory Tools, Graph Nodes, and BaseStore adapter patterns.
LlamaIndex Agent-driven (BaseToolSpec) and automatic (BaseMemory) memory.
Google ADK BaseMemoryService implementation for ADK.
Strands Agents Retain/recall/reflect tools for Strands.
AG2 Cross-conversation memory tools.
AutoGen FunctionTool instances for retain/recall/reflect.
Aider hindsight-aider wraps the aider CLI — recalls project memory before each session, retains the transcript after.
OpenAI Agents SDK FunctionTool-based memory.
OpenHands Native MCP server config + recall/retain rule for OpenHands (formerly OpenDevin).
NemoClaw One-command setup for NemoClaw sandboxes.
Right Agent Native memory provider for Right Agent sandboxes.
Pipecat Memory nodes for Pipecat voice pipelines.
AgentCore Memory tools for AgentCore agents.
Smolagents Retain/recall/reflect tools for HuggingFace Smolagents.
OpenClaw Memory for OpenClaw workflows.

Workflow & automation platforms

Integration What it does
n8n Community node — drop retain/recall/reflect into any n8n workflow.
Zapier Zapier app — retain/recall/reflect actions plus instant memory-event triggers.
Dify Persistent memory for Dify apps.
Flowise Memory nodes for Flowise flows.
Vapi Persistent memory for Vapi voice agents.
Gemini Spark Memory for Gemini Spark.
Roo Code Memory for the Roo Code VS Code extension.
Google ADK BaseMemoryService for Google ADK.
Cloudflare OAuth Proxy OAuth proxy so you can run Hindsight behind Cloudflare Access.
Paperclip Memory layer for Paperclip workflows.

Adding a new integration

See CLAUDE.md → "Adding New Integrations" for the checklist (tests, CI job, release registration, code standards).

Releases

Each integration is versioned and released independently:

./scripts/release-integration.sh <integration-name> <version>
# e.g.
./scripts/release-integration.sh cursor-cli patch

The release script reads the version from the integration's settings.json / package.json / pyproject.toml, generates a changelog entry, and tags integrations/<name>/v<version>.