Skip to content

Add a Claude Code runner for the guided workflow - #345

Open
dipeshbabu wants to merge 1 commit into
mainfrom
feat/claude-code-runner
Open

dipeshbabu wants to merge 1 commit into
mainfrom
feat/claude-code-runner

Conversation

@dipeshbabu

Copy link
Copy Markdown
Owner

Adds `examples/claude_code_runner.py`, the Claude Code counterpart of the Codex runner.

  • Runs `claude -p --output-format stream-json --verbose` in `--cd`, prompt on stdin, with only `Read,Grep,Glob` pre-approved via `--allowedTools`; extra args after `--` go to `claude` unchanged.
  • One `model_call` per API response (`message.id`), so content blocks streamed as separate events count once; usage is set (not summed) per response with `usage_scope: request`, and input tokens include cache reads/writes (also kept in metadata).
  • One `tool_call` per `tool_use`, ending at its `tool_result`; `is_error` results are errors.
  • The `result` event supplies the scored answer; turns, durations and reported cost go on the root span; error results fail the attempt.

Tests cover the conversion against the documented stream shape and an end-to-end run through a stand-in `claude` executable (argv, cwd, stdin prompt, written trace). Not yet run against a live Claude Code install; the guide says so.

Docs: `docs/CLAUDE_CODE.md`, integrations index, mkdocs nav, changelog.

🤖 Generated with Claude Code

examples/claude_code_runner.py runs `claude -p --output-format
stream-json --verbose` with only Read, Grep and Glob pre-approved and
converts the stream into a native trace: one model span per API response
(content blocks of one message.id count once), per-request provider usage
including cache reads and writes, and one tool span per tool_use ending
at its tool_result. docs/CLAUDE_CODE.md documents the mapping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown

Important

  • Trigger review

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

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown

AgentLoop replay self-test

This required repository check evaluates generated synthetic demo traces. It tests the replay and CI machinery; it does not show that this PR improves application performance.

AgentLoop CI Report

  • Status: passed
  • Replay: Replay passed: latency improvement 69.67%, cost improvement 78.82%, retry delta -1.
  • Merge recommendation: synthetic self-test only; assess application traces before merge
  • Findings: 1 total, 0 high severity, 1 patchable

Performance Gates

Gate Status Detail
latency_regression pass 0.00% regression <= 0.00% allowed
cost_regression pass 0.00% regression <= 0.00% allowed
latency_improvement pass 69.67% improvement >= 20.00% required
cost_improvement pass 78.82% improvement >= 5.00% required
retry_non_increase pass 0 candidate retries <= 1 baseline retries

Trace inputs

This comparison includes synthetic data. It does not establish application performance gains from a pull request.

Side Run ID Path Synthetic marker Source
baseline run_c5250229cfa04e57 runs/research_agent_baseline.json yes agentloop_demo
candidate run_9af9a00adccf4cf4 runs/research_agent_optimized.json yes agentloop_demo

Metric Impact

Metric Impact
Latency improvement 69.67%
Cost improvement 78.82%
Retry delta -1
Candidate schema validity not provided
Candidate quality score not provided

Top Findings

Finding Severity Type Rewrite
al_cache_context_c3ae06951b9e: Cache repeated prompt/context prefix medium cache_context Move stable instructions into cached prefixes, summaries, or framework-level memory instead of resending full text.

This branch has not been deployed

No deployments
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