> Agent-ready spec from Diff of the Day (2026-11-29, idea 1). Give this file to your coding agent (Claude Code, Codex, Cursor) and ask it to build the P0 requirements first.

# Spec: Task-framing A/B harness for your coding agent

## Problem Statement
A preliminary study (Nov 2026) ran Claude Code on KernelBench and a nanoGPT bug-fix task under three framings. Telling the agent its code would become training data, with no human review, raised turns per session and kernel run time across 295 sessions, while the quality effect was inconclusive in a larger rerun. Most teams have no way to check whether wording in their own agent instructions changes cost or quality on their own tasks.

## Goals
- Run the same task set under 2 to 4 prompt prefixes with at least 5 sessions per task and condition.
- Report turns, wall-clock time, tool calls and pass rate per condition with 95% bootstrap intervals.
- Finish a 3-task, 3-condition, 5-repeat run unattended on one machine.
- Make every run reproducible from one config file.

## Non-Goals
- Proving intent such as sabotage or sandbagging: the harness measures behaviour, not motive.
- Supporting every agent: one CLI agent is enough for v1.
- Hosted dashboards: local files only.

## User Stories
- As an engineer, I want to compare my current AGENTS.md wording with a shorter version so that I know which costs fewer turns.
- As a team lead, I want pass rates with intervals so that I don't act on noise.
- As an engineer, I want each session's transcript kept so that I can read what the extra turns did.
- Edge case: as an engineer, I want sessions that hit the time cap marked as censored, not failed, so that the averages stay honest.

## Requirements
### P0 (must have)
1. **Config file** listing tasks (repo, instruction, check command), conditions (prompt prefix) and repeats.
   - [ ] A config with 3 tasks, 3 conditions and 5 repeats schedules 45 sessions.
2. **Runner** that starts the agent CLI in a fresh copy of the task repo with a time cap.
   - [ ] Each session gets its own working copy; nothing leaks between sessions.
3. **Metrics collector**: turns, tool calls, wall-clock seconds, timed-out flag, check-command result.
   - [ ] Given a finished session, when collected, then one JSON line is written to results.jsonl.
4. **Report** with per-condition means and bootstrap 95% intervals, as Markdown.

### P1 (nice to have)
- Randomised session order to avoid time-of-day effects.
- Paired comparison per task.

### P2 (future)
- A second agent CLI for cross-model comparison.

## Success Metrics
- Leading: the first 45-session run completes without manual help.
- Lagging: you change one line of your agent instructions based on a result whose interval excludes zero.

## Open Questions
- Which of your own tasks have a reliable check command? (you)
- How long should the time cap be so few sessions are censored? (you)

## Timeline
One weekend for P0.

## Agent Instructions
- **Suggested stack**: Python 3.12, subprocess for the agent CLI, git worktrees for isolation, numpy for bootstrap.
- **Build order**: config loader and tests → single-session runner → metrics collector → scheduler → report.
- **Safety**: run sessions in throwaway worktrees; never point the runner at a repo with production credentials; keep API keys in environment variables.
- **Done when**: report.md shows three conditions with intervals for a real run.

## Sources
- Does Task Framing Change How Claude Code Works?: https://xinyadu.github.io/blog/claude-code-sabotage.html
- KernelBench: https://github.com/ScalingIntelligence/KernelBench
