Self-Driving AgentsGitHub →

Claude Code

Anthropic's Claude Code CLI with the Hindsight Memory plugin — auto-recall, auto-retain, and the agent_knowledge_* tools, all wired in.

--harness claude-code

The claude-code harness drops the Hindsight Memory plugin into Claude Code. The plugin's hooks auto-recall relevant memories before every user prompt and auto-retain the conversation after every response; its MCP server exposes the agent_knowledge_* tools for managing pages and ingesting content. The self-driving-agents CLI takes care of installing the plugin, configuring the Hindsight connection, staging seed content, and allowlisting the right tools.

Who it's for: Use this harness if you already use Claude Code in your terminal and want a self-driving agent backed by Hindsight memory — no skill zip, no separate gateway.

How to run it

  1. 1

    Install the agent

    Verifies `claude` is on PATH; adds the `vectorize-io/hindsight` plugin marketplace and installs (or updates) the `hindsight-memory` plugin; prompts for your Hindsight connection if you don't already have one configured; writes plugin config to `~/.hindsight/claude-code.json`; stages content under `~/.self-driving-agents/claude-code/<agent>/`; allowlists the plugin tools and the create-agent skill in `~/.claude/settings.json`.

    npx @vectorize-io/self-driving-agents install marketing/seo --harness claude-code
  2. 2

    cd into the project directory the agent should be scoped to

    The bank is derived from `(agent_name, project_basename)` — the working directory at session start is part of the binding. Always start `claude` from the same project directory if you want this agent to keep the same memory across sessions.

  3. 3

    Start Claude Code

    Run `claude` in that directory. The plugin's session-start hook health-checks Hindsight, so if the connection is wrong you'll see it immediately.

    claude
  4. 4

    Run the printed prompt

    The CLI printed a one-liner at the end of install. Pasting it triggers the create-agent skill, which writes a Claude Code subagent at `~/.claude/agents/<name>.md` wired up to the Hindsight MCP, ingests every staged file via `agent_knowledge_ingest_file`, and creates three initial knowledge pages.

    /hindsight-memory:create-agent marketing-seo from ~/.self-driving-agents/claude-code/marketing-seo

Mapping into a Hindsight bank

Where the agent → bank binding lives, and how to change it.

Under the hood

  • The Hindsight Memory plugin is installed via Claude Code's plugin marketplace (`vectorize-io/hindsight` → `hindsight-memory`). It bundles four hooks, an MCP server, and the create-agent skill.
  • Hooks: `SessionStart` runs a health check; `UserPromptSubmit` auto-recalls relevant memories and injects them as invisible `additionalContext`; `Stop` auto-retains the transcript with chunked retention (default: every 10 turns with 2-turn overlap); `SessionEnd` cleans up the auto-managed daemon if one was started.
  • MCP server (stdio): exposes `agent_knowledge_list_pages`, `get_page`, `create_page`, `update_page`, `delete_page`, `recall`, `ingest`, `ingest_file`, and `get_current_bank`. The bank ID is auto-resolved at runtime — tools never take a `bank_id` parameter.
  • Connection lives in `~/.hindsight/claude-code.json`. Three modes are supported: external Hindsight server (set `hindsightApiUrl` + `hindsightApiToken`), auto-managed local daemon (leave URL empty; the plugin starts `hindsight-embed` via `uvx` and uses an LLM key like `OPENAI_API_KEY` for fact extraction), or an existing local daemon.
  • Tool/skill allowlist in `~/.claude/settings.json` under `permissions.allow`: `mcp__plugin_hindsight-memory_hindsight__*`, `Skill(hindsight-memory:create-agent)`, `Bash(ls ~/.self-driving-agents/*)`, `Bash(cat ~/.self-driving-agents/*)` — so the next steps run without approval prompts.