Skip to content
KurrentDB

The installed harness

kcap setup installs capture integrations, MCP tools, skills, session-start context, and a global git hook for your coding agents. This page describes the v1.2.1 install so you can inspect what changed on your machine and turn individual parts off.

The examples use Claude Code. The other eight supported agents use the files listed below. Custom agent config directories are respected; see Setup CLI.

The complete installed harness. On your machine, the coding agent (Claude Code shown) contains kcap hooks, the agent transcript, injected session-start context, and twelve kcap skills. The agent makes tool calls to eight kcap MCP servers, which send authenticated requests to the kcap server. Hooks send events to the server and spawn the watcher, which tails the transcript and streams it to the server. The kcap CLI and the optional kcap daemon also talk to the server; the daemon launches hosted agents and reviewers on the server's instruction. On your kcap server, the kcap server appends to the KurrentDB event store, projections build read models, and the subsystems — sessions, evals, work items, insights, team memory, flows, notifications — consume them; the kcap UI reads from the server. A dashed feedback edge runs from the server back into the agent's injected context for the next session.

The dashed edge is the one no other diagram shows: context flowing back into the agent. That loop is the point — what sessions produce (mined guidance, the team memory agents saved, live coordination state) flows back in at the next session start.

Setup asks one consent question per machine — “Install kcap for these agents (hooks, skills, instructions, MCP)?” — or, when you use the browser first-run flow, records a per-agent answer with two independent axes: Record (capture) and Tools (MCP). The tables below list the integration files. Uninstall removes kcap-owned entries while preserving unrelated agent configuration.

For Claude Code, the entire integration is one plugin registration:

ArtifactPathWhat it does
Plugin registration~/.claude/settings.json — extraKnownMarketplaces.kcap + enabledPlugins["kcap@kcap"]Points Claude Code at the plugin directory inside the npm package. Everything else Claude-side comes from the plugin bundle.
Version marker~/.claude/.kcap-plugin-versionLets kcap status and upgrades detect what is installed.
Hooksplugin bundle hooks/hooks.jsonEleven event types — the full list is below. Capture and tool-policy events use kcap hook --claude; the prompt event runs the title script.
MCP serversplugin bundle .mcp.jsonEight servers, detailed below. The installer configures the command used to start each server.
Skillsplugin bundle skills/Twelve skills, surfaced to the agent as kcap:<name> — list below.
Session-id scriptplugin hooks/persist-session-id.sh (SessionStart)Exports KCAP_SESSION_ID into the agent’s shell environment so terminal commands in the session can name it.
Title scriptplugin hooks/set-title-prompt.sh (UserPromptSubmit)Once per session, asks the agent to run kcap set-title so the dashboard shows a human title.

kcap does not edit CLAUDE.md or any other instructions file for Claude Code. (Five other agents get a marker-delimited steering block — see the differences table.)

Off to the side of any one agent, setup also writes the CLI’s own state:

ArtifactPathWhat it does
Profile~/.config/kcap/config.jsonServer URL, default session visibility, daemon name, feature toggles.
Tokens~/.config/kcap/tokens/Your login token, shared by the CLI, hooks, watcher, and daemon.
Watcher state~/.config/kcap/watchers/Pid, heartbeat, and marker files for live-session watchers.

When setup or kcap plugin install installs any agent’s hooks, it also adds one entry to your global git config (~/.gitconfig): a config-based hook named kcap on post-commit and post-merge. Config-based hooks need git 2.54 or later; an older git ignores the entry.

After each commit or merge, git runs kcap git-hook. It contacts no server, prints nothing, and always exits 0. It finds the coding agent process above the commit and files the commit — SHA, repository, branch, and message, with secrets redacted — under that agent’s session. The watcher sends it with the transcript. Because git itself places the commit, one made from a subfolder, a nested repository, or a script lands in the right repository and pull request, and a quiet (-q) commit is not missed.

AgentHow commits are found
Claude Code, Codex, Copilot CLI, Kiro, PiThe git hook, when it is installed and enabled.
Cursor, OpenCode, AntigravityRead from the agent’s shell commands. One of their processes can host several sessions, so a commit cannot be tied to one of them.

Without the hook — an older git, the hook turned off, or kcap not yet set up again after an update — commits are read from the agent’s shell commands as before. The hook runs beside hooks you already have (core.hooksPath, husky, pre-commit) and does not replace them.

Terminal window
git hook list post-commit # shows kcap when it is installed
git config --global hook.kcap.enabled false # turn it off

Updating kcap does not add the hook; it only repoints an existing entry at the new binary. Run kcap setup or kcap plugin install once to add it. kcap uninstall removes it.

All eight run locally as kcap mcp <name> and translate the agent’s tool calls into authenticated requests against your kcap server — reads are filtered by your session-visibility permissions, and writes act as you. The tool inventory follows the installed CLI version.

ServerToolsWrites?Plan
kcap-sessionssearch_sessions, list_repo_sessions, list_repo_plans, get_declared_plans, get_session_summary, get_session_transcript, list_turns, get_turnread-onlyall plans
kcap-reviewget_pr_summary, list_pr_files, get_file_context, search_context, list_sessions, get_transcriptread-onlyall plans
kcap-memorysearch_memories, get_memory, save_memory, update_memory, rescope_memory, archive_memorywrites memoriesall plans
kcap-workitemsdeclare_work_item, get_session_work_items, declare_work_breakdown, retract_work_breakdown, declare_work_relation, retract_work_relation, get_work_item_topology, merge_work_item, detach_work_item, declare_loose_endwrites work-item stateTeam+
kcap-flowsstart_review_flow, submit_review_round, get_review_flow_status, close_review_flow, start_flow, send_to_participant, get_flow_status, close_flow, list_flow_definitions, list_reviewer_vendorslaunches agents — never auto-approvedall plans (runs on your own daemon)
kcap-plansdeclare_plan_document, set_plan_tasks, update_plan_task, get_planwrites plan documents and tasksall plans
kcap-artefactspublish_artefact, await_artefact_responses, get_artefact_results, close_artefact_responses, list_my_artefacts, set_artefact_visibilitypublishes pages — never auto-approvedall plans
kcap-analyticsget_analytics_schema, query_analyticsread-onlyTeam+

kcap-artefacts publishes self-contained HTML pages; see Artefacts.

Every kcap tool advertises MCP annotations (read-only, destructive, idempotent), so a harness that decides approval from them — Codex, for one — runs reads and additive writes without asking and prompts before a tool that removes or overwrites something. Where a harness has a per-server trust setting, registration also pre-approves the servers that only read or write to the session’s own record: Codex (default_tools_approval_mode = "approve") and Gemini CLI ("trust": true) pre-approve kcap-sessions, kcap-review, kcap-analytics, kcap-workitems, and kcap-plans. kcap-flows, kcap-memory (a save can widen who sees a memory), and kcap-artefacts (can widen who may open a page) keep prompting. Re-running kcap setup updates a Codex entry an earlier kcap wrote; an entry you edited is left alone. The Codex kcap-flows entry also sets tool_timeout_sec = 600 so Codex’s own timeout does not cut a flow call short.

Two more MCP servers exist in the binary but are deliberately not registered into your agents: kcap mcp judge (session-quality tooling, manual use only) and kcap mcp flow-result (injected by the daemon into hosted reviewer agents only — it is how a reviewer returns its verdict, and a normal session never has it).

Skills are instruction documents your agent can load when the request matches their purpose. They guide tool use inside the session.

SkillWhat it triggers on
recapRead, search, or recall past sessions (“what did we do last time?”).
errorsExtract the tool errors and failures from a recorded session.
validate-planCheck every item of the session’s plan was actually completed.
review-flowsRun a structured review loop with a separate reviewer agent until sign-off.
agent-flowsRun any named flow definition with a hosted participant agent.
suggest-review-flowOffer (never auto-start) an independent second-agent review when work wraps up.
plansRecord a plan, spec, design document, or task list and keep task progress current.
work-itemsDeclare a work item’s breakdown and dependencies (Team+ — calls kcap-workitems).
guided-tourA product tour for someone who just installed kcap.
eval-watchFollow the history import kcap setup started and summarize the first evals on those sessions (“Follow my kcap import”).
hideSet the current session’s visibility to owner-only.
disableStop recording, or delete the current session.

Session start: what fires, and what gets injected

Section titled “Session start: what fires, and what gets injected”

When you start a session, Claude Code fires the SessionStart hook. The hook starts the watcher before posting to the server, then supplies session-start context when available. A temporarily unavailable server does not prevent your agent session from starting.

Session-start sequence: the agent fires the SessionStart hook; the hook spawns the watcher, then posts to the kcap server; the server responds with guidance and notices while the hook fetches the memory index in parallel; the hook adds the locally built fragments (such as the work-items, plans, and new-harness nudges) and assembles everything into a single additionalContext envelope injected into the agent's context; the watcher begins streaming the transcript.

Session-start context can include the fragments below. Each is individually removable via kcap config set (the disable_* keys take true; update_check takes false), and the server-backed fragments fail open — if the server is slow or down, they are simply absent and your session starts normally.

Injected fragmentContentsOpt-out key
Guidance from past sessionsRecurring patterns mined from your team’s previous sessions in this repo — the feedback loop’s output.disable_session_guidelines
Shared memory indexRelevant repository, project, and organization memories, filtered by audience — slugs and one-line descriptions only; the agent reads a body when needed.disable_memory_index
Coordination noticesWarnings when teammates’ live sessions overlap the same files or work.disable_coordination_notices
Work-items nudgeThe session id and instructions to link the session to its issue or PR. Requires the MCP registration and is suppressed when the cached tenant plan excludes Work Items.disable_workitems_nudge
Plans nudgeInstructions to declare plan documents and task progress through kcap-plans, when that server is registered.disable_plans_nudge
First-run noticeOnce, in the first session that starts after kcap setup installed something: setup completed, the hooks are loaded, and an offer of the guided tour.disable_first_run_notice
New-harness nudgeA one-time offer to set up kcap for a newly detected coding agent (throttled to every 6 h).disable_harness_nudge
CLI-update nudgeA note when your kcap binary is older than what your server recommends.update_check (set to false)

Agent-specific output determines how this context appears. Claude can also receive an approval-policy diagnostic when its policy configuration is degraded.

Claude Code registers SessionStart, SessionEnd, SubagentStart, SubagentStop, PreToolUse, PostToolUse, PostToolUseFailure, Notification, Stop, PermissionRequest, and UserPromptSubmit. Tool hooks support local approval policy and tool outcomes. PermissionRequest bridges prompts to the dashboard; a prompt answered in the terminal is retired from the daemon too. UserPromptSubmit runs the title script.

Three things run concurrently while you work:

  • Capture. The watcher tails the agent’s own transcript file and streams it to the server over SignalR — prompts, responses, tool calls and results, thinking blocks, token counts. Subagents get their own watchers via SubagentStart/SubagentStop. The agent’s transcript file is never modified.
  • Tools. The agent can call the eight MCP servers above. Everything they return comes from your server, filtered by session visibility — an agent cannot read a session its user could not see in the dashboard.
  • Skills. If you (or the agent) invoke one, it runs inside the session like any other instruction document — recap searches history through kcap-sessions, review-flows starts a reviewer through kcap-flows, and so on.

Each commit the agent makes also runs the git hook, which files the commit under the session.

During the session: you and the agent converse; the watcher streams the growing transcript to the kcap server; the agent calls kcap MCP tools which send scoped requests to the server; permission requests bridge to the dashboard; teammates watch the session live in the kcap UI.

SessionEnd stamps the end time and posts it; the watcher notices the agent has exited (it watches the parent process) and reaps itself. Two agents without native end events — Kiro and OpenCode — get a synthesized session-end from the watcher instead.

Clearing a Claude Code chat with /clear ends its session and starts a new one. The new session’s start names the session its own terminal cleared, so two Claude terminals in the same repository no longer link to each other’s chats.

Server-side, the session is already durable: every captured event was appended to an immutable per-session stream in KurrentDB as it happened. Projections fold those streams into read models, and the subsystems consume them:

Session end and the loop closing: the end hook posts to the server; the session's immutable event stream in KurrentDB is projected into read models; the subsystems — evals, work items, insights, team memory, notifications — process the session; their outputs flow back into the next session's start as guidance, the memory index, and coordination notices.

  • Sessions & recall — the transcript your team browses, replays, and searches; the same data kcap-sessions serves back to agents.
  • Evaluations — configurable automatic evals judge the session (did the agent loop, waste context, fail tool calls?) and post suggestions.
  • Work items (Team+) — a signals extractor parses the transcript for issue keys, PR refs, and commit SHAs; correlation ties sessions to tracker items and drives progress views.
  • Insights (Team+) — cost, usage, and outcome analytics across sessions; the same governed query API kcap-analytics exposes to agents.
  • Shared memory — repository, project, and organization memories become searchable in future sessions, subject to their audience.
  • Flows — if the session started a review flow, the server orchestrates the reviewer rounds through your daemon until sign-off.
  • Notifications — session outcomes and collision detection fan out to the in-app inbox and Slack, per your preferences.

The next SessionStart in that repo receives the results: mined guidance from what worked and what failed, the updated memory index, and coordination notices about live teammates. That closed loop — capture → process → re-inject — is the workflow kcap actually ships, and it is why the install is larger than a transcript recorder.

Capture and hosted execution use separate background processes:

  • Watcher — follows transcript-based capture sessions and supported subagents; exits when the session ends or its agent process exits. Extension-based agents have their own capture wiring. State lives in ~/.config/kcap/watchers/.
  • Daemon (optional) — kcap daemon keeps your machine reachable from your server to run hosted agents in isolated git worktrees, and review-flow reviewers, whose workspace mode varies — borrowed checkout, snapshot, or context-only (see Review flows). Installed as an OS service only if you opt in (kcap daemon service install — launchd on macOS, systemd user unit on Linux, Scheduled Task on Windows). Every server-initiated launch is checked against a local consent policy you control (kcap daemon consent), and every decision is logged to consent-decisions.jsonl. No daemon, no remote execution — the capture pipeline works without it.

Everything else is scoped to a session or shorter: the eight kcap mcp stdio servers run as child processes of your agent (one set per session, started and stopped by the agent itself), hook processes and kcap git-hook run for moments, and a detached helper Claude Code’s session-end spawns so final capture work isn’t cut off by the agent’s hook timeout.

The harness is layered, and each layer has its own switch:

  • Per injection — the opt-out keys in the table above, via kcap config set (the disable_* keys take true; update_check takes false).
  • Per piece, per agent — browser setup separates Record and Tools choices. Terminal setup also has agent-specific skip flags; use kcap setup --help for the supported combinations. Claude bundles its integration in a plugin, so flags are not symmetrical across agents.
  • Commit capture — git config --global hook.kcap.enabled false turns the git hook off; commits are then read from the agent’s shell commands.
  • Per repository or directory — allow lists and exclusions constrain live capture, imports, and unattended hosted launches.
  • Per session — the hide and disable skills, or kcap CLI equivalents.
  • Everything — kcap uninstall enumerates and removes every artifact in the tables above and the git hook (pass --keep-config to preserve ~/.config/kcap), stops watchers and daemons, and removes OS service units.

The server checks plan entitlements when tools are called. Work Items and Insights require Team or Enterprise, so their MCP servers can be installed on Free while their API calls remain unavailable. The CLI suppresses the work-items reminder once the server has reported that the plan excludes the feature. A machine with no cached entitlement can still show the reminder.

Capture, session recall, shared memory, and flows using your own daemon are available on every plan. See Plans & seats for feature availability and usage limits.

All twelve agents have capture integrations, with different hooks and transcript formats; the table shows which also get MCP tools, skills, and steering. Claude Code loads everything from one plugin; the rest get discrete files:

AgentCapture mechanismMCP registrationSkills treeSteering file
Claude Codeplugin hooks (11 event types)plugin .mcp.jsonplugin bundle—
Codex~/.codex/hooks.json~/.codex/config.toml~/.agents/skills/—
Cursor~/.cursor/hooks.json~/.cursor/mcp.json~/.agents/skills/—
Copilot CLI~/.copilot/hooks/kcap.json~/.copilot/mcp-config.json~/.agents/skills/~/.copilot/copilot-instructions.md
Gemini CLI~/.gemini/settings.json hooks block~/.gemini/settings.json~/.gemini/skills/~/.gemini/GEMINI.md
Kirocloned agent ~/.kiro/agents/kcap.json, set as default agent~/.kiro/settings/mcp.json~/.kiro/skills/—
PiTypeScript extension ~/.pi/agent/extensions/kcap.tsextension bridge (Pi has no native MCP)~/.agents/skills/~/.pi/agent/AGENTS.md
OpenCodeplugin ~/.config/opencode/plugins/kcap.ts on the event bus~/.config/opencode/opencode.json~/.agents/skills/~/.config/opencode/AGENTS.md
Antigravityplugin dir ~/.gemini/config/plugins/kcap/~/.gemini/config/mcp_config.json~/.gemini/skills/~/.gemini/GEMINI.md (shared)
Muse Code~/.config/muse/settings.json hooks~/.config/muse/settings.json (mcp_servers)~/.agents/skills/—
Grok Build~/.grok/hooks/kcap.json—~/.agents/skills/—
Mistral Vibe~/.vibe/hooks.toml~/.vibe/config.toml~/.agents/skills/—

Worth knowing before you diff:

  • Steering blocks are one canonical text between <!-- BEGIN kcap --> / <!-- END kcap --> markers — five agents carry one, in four files (Gemini CLI and Antigravity share ~/.gemini/GEMINI.md). It tells the agent when to prefer kcap’s context tools (PR summary before gh pr diff, session search before git log archaeology, memory search before assuming no prior art) and to offer — never auto-start — a second-agent review when work completes.
  • Kiro’s install is the most invasive: kcap clones your default Kiro agent, adds its hook, and sets the clone as the default (the original is recorded and restored on uninstall). Setup says so before you consent.
  • Kiro Crew regenerates its agent profiles at every start and reads only ~/.kiro/hooks/*.sh as hooks and ~/.kiro/crew/skills as skills. When Crew is present, kcap also writes ~/.kiro/hooks/kcap-spawn.sh and copies its skills into ~/.kiro/crew/skills. See Setup CLI.
  • Pi and OpenCode have no shell-hook mechanism, so they get small TypeScript extensions instead; the extension source is right there in the path above.
  • Session-start context uses each agent’s supported mechanism. Work-item and plan reminders require their MCP tools to be installed, and the configuration opt-outs apply independently.