Capture
The whole session, without changing how you work.
rh does not run your sessions. Each tool calls rh capture hook from its own hook; the hook reads the session from where the tool keeps it (prompts, replies, tool calls and results) and posts it to your node.
Wiring a tool
$ rh harness connect claude-code| Command | Does |
|---|---|
rh harness status [--json] | Shows which tools are found, how each captures, whether recall is wired, and the last capture time or “nothing captured yet”. |
rh harness connect <id> [--capture | --recall] [--dry-run] | Adds the hook or plug-in and the MCP entry, printing the diff and backing the file up first. |
rh harness disconnect <id> [--capture | --recall] [--dry-run] | Removes them again. |
The OpenCode capture plug-in is embedded in rh; RIVETHUB_OPENCODE_PLUGIN optionally overrides it. From 0.8.4, rh harness connect dsh connects DeepSeek Harness for capture and recall. It writes the capture plug-in and MCP recall entry into $DSH_HOME/cordis.patch.yml (default ~/.dsh/cordis.patch.yml), covering every profile. Capture and recall were tested with public @deepseek-ai/dsh 0.2.2-rc.1.
Supported tools
Codex: Open Codex in a terminal after connecting. When it says “Hooks need review”, choose “Trust all and continue”. Until you trust the hooks, codex exec silently skips them. Connecting again can require another review. From rh 0.8.6, rh harness status says whether Codex trusts the hooks and rh harness connect codex says what to answer.
OpenCode: OpenCode 2 (@opencode/cli) is the supported OpenCode. OpenCode 1.x is captured from rh 0.8.6: update rh, then run rh harness connect opencode again; rh harness status says when the installed plug-in is out of date. On older rh, 1.x refused the plug-in (opencode run --print-logs shows failed to load plugin). OpenCode 1.x gets no further work.
| Tool | --harness | Called on | Reads | Captured as |
|---|---|---|---|---|
| Claude Code | claude-code (default) | UserPromptSubmit, PostToolUse, Stop, SubagentStop, SessionEnd | the payload’s transcript_path | the session id |
| Grok Build | grok-build | Stop, PreCompact, SessionEnd | $GROK_HOME (~/.grok) | grok-build:<session> |
| Codex | codex | Stop, SessionEnd | $CODEX_HOME/sessions (~/.codex/sessions) | codex:<session> |
| OpenCode | opencode | session.idle, session.error, from an OpenCode plug-in | opencode.db under $XDG_DATA_HOME/opencode | opencode:<session> |
| DeepSeek Harness | dsh | turn/end, from a dsh plug-in | $DSH_HOME/sessions (~/.dsh) | dsh:<session> |
What rh harness connect claude-code writes is the same entry for each event in settings.json:
{ "hooks": { "Stop": [{ "hooks": [{ "type": "command", "command": "rh capture hook" }] }] } }What you can rely on
- Delivery failures spool. A missing config or failed delivery exits 0. If the batch cannot be saved to disk, the hook exits 1 with
capture batch was NOT saved; check free space and permissions. - A down node does not lose a session. What the node cannot take is spooled under
~/.rivethub/capture-spool/and replayed on the next run. - It never captures itself. A hook run with
RIVETHUB_MODEL_RUNset captures nothing, so the workers’ own model calls never become sessions. - It redacts on request.
memory.capture.redaction(orRIVETHUB_CAPTURE_REDACTION) strips secrets before they are stored. It is off by default. - It logs each capture. One line per capture in
~/.rivethub/<tool>-capture.log.
Who owns a captured session
Every captured row records its owner. A local hook sends the owner token and captures as the node’s owner, named by ownerUserId in the users file. Without a users file the owner is the literal owner, so a node that will later join a datahub should have its users file in place before it captures anything. See Tenancy.
Capturing to a node on another machine
A machine that runs no node can capture straight to a datahub’s gateway. It posts over HTTPS only, trusts only the certificate you name, and captures as the person whose users-file entry lists that token’s SHA-256.
memory:
capture:
gateway:
url: https://memory.example:5174
ca: ~/.rivethub/ca.crt
token: ${RIVETHUB_CAPTURE_TOKEN}Missing your tool?
Adding one means teaching rh capture hook where that tool keeps its sessions. Ask for a tool explains how to ask for one or add it.
Not capturing yet?
The quickstart gets one tool wired and one session on the record.