[FEATURE] Headless/batch mode for automated benchmarks and CI

Status Fixed / completed
Maintainer reply None cached
Activity 3 comments · opened Apr 19, 2026 · closed Apr 21, 2026

Summary

There is no way to programmatically start a Claude Code session with a predefined prompt, let it execute autonomously, and capture structured results. This blocks automated benchmarks, regression tests, and A/B comparisons of different configurations.

Use Case

Benchmarking AI-assisted development tools:

  1. Define 5 test tasks ("add a feature", "fix a bug", "refactor a module")
  2. Run each task twice: once with tool X enabled, once without
  3. Compare: turns, corrections, outcome, time
  4. Report: "Tool X improved FTR by 15% but added 8% more tokens"

CI integration:

  • "Run these 5 tasks on every PR, fail if FTR drops below 80%"
  • Reproducible evaluation across different model versions or configurations

Today this requires manually running sessions and recording results by hand.

Proposed Solution

claude --headless \
  --prompt "Fix the null pointer exception in src/parser.rs" \
  --max-turns 20 \
  --output-json session-result.json

Output:

{
  "session_id": "...",
  "outcome": "completed",
  "turns": 8,
  "tokens_in": 24000,
  "tokens_out": 8000,
  "duration_seconds": 45,
  "files_modified": ["src/parser.rs"],
  "tools_used": ["search", "Read", "Edit"],
  "corrections": 0
}

Alternatives considered

  • claude -p "prompt" exists but is single-turn, not agentic
  • Recording manual sessions works but doesn't scale and introduces human variance
  • claude-code-action runs in CI but doesn't return structured metrics

Impact

This unlocks:

  • Automated quality benchmarks for AI-assisted development tools
  • A/B testing of prompt strategies, skills, or configurations
  • CI gating on AI session quality
  • Reproducible evaluation for researchers comparing AI coding assistants

View original on GitHub ↗

3 Comments

github-actions[bot] · 5 months ago

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/32622

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

jerrythomas · 5 months ago
github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.