Skip to content

Add Claude Code harness adapter - #1

Open
courtlandleer wants to merge 1 commit into
mainfrom
feat/claude-code-harness
Open

Add Claude Code harness adapter#1
courtlandleer wants to merge 1 commit into
mainfrom
feat/claude-code-harness

Conversation

@courtlandleer

Copy link
Copy Markdown
Collaborator

Adds Claude Code as a third harness: harnesses/claude_code.py plus one registry line, per the documented extension point.

What it reads: ~/.claude/projects/<slug>/<uuid>.jsonl transcripts directly -- no capture plugin needed. Claude Code already persists what the other harnesses need plugins for:

  • real per-call provider usage (input / cache-read / cache-write / output) -- streamed assistant chunks are merged by message.id into one message per API call
  • hook-injected context: SessionStart + UserPromptSubmit additionalContext attachments feed the per-turn injected-context lane (UserPromptSubmit attachments are written after the user record they annotate, so the adapter binds them to the preceding user message)
  • tool calls with arguments, paired to results via tool_use_id

Not available: the compiled system prompt (Claude Code never writes it) -- system layer is a stub + the captured SessionStart injection. Sidechain records are skipped.

Perf: sessions list is a regex-cheap line scan with an mtime/size cache; 150 sessions index in ~0.7s cold, instant warm. Full JSON parse only on trace load.

Env overrides: CLAUDE_HOME, ROTOM_CLAUDE_PROJECTS. Session ids prefixed cc:. README section added mirroring the OpenClaw one.

Tested against live session stores on two machines (macOS, Python 3.9).

New harnesses/claude_code.py + registry line. No capture plugin needed:
Claude Code transcripts already persist real per-call provider usage
(merged from streamed chunks by message.id), hook-injected context
(SessionStart + UserPromptSubmit attachments -- the injected-context lane),
and tool calls paired to results. Compiled system prompt is not persisted
by Claude Code, so the system layer is a stub plus the captured
SessionStart injection. Sidechain (subagent) records are skipped.
Sessions list uses a regex-cheap scan with an mtime cache.
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 105d06bd-f92d-446e-9711-9a872bc95e2a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant