Docs/Counterfactual replay▾

Counterfactual replay

constant replay turns archived Dry Master records into a deterministic benchmark and model-migration harness. Instead of judging a new model or harness on toy prompts, replay real multi-turn sessions from the exact turn where the work mattered.

Usage

# Replay an entire corpus directory across harness:model cells with objective scoring
constant replay \
  --corpus ./eval-corpus/ \
  --targets claude:sonnet,claude:opus,codex:o3 \
  --with-tools \
  --render triage \
  --isolate worktree \
  --verify-cmd "cargo test" \
  --out replay-report.json
 
# Replay one conversation from Turn 6, pinning worktrees to its recorded git SHA
constant replay \
  --corpus cobalt-37 \
  --turn 6 \
  --targets claude,antigravity \
  --pin-commit \
  --json

How truncation works (--turn)

  • --turn auto (default): when --question is omitted, Constant finds the last user turn, truncates the Dry Master right before it (keeping all prior turns and attached redacted tool events), replays that exact user prompt against every target in parallel, and records the original runtime's reply as baseline_answer.
  • --turn K: truncates after conversational turn K (keeping attached tool traffic on turns 1..K). If turn K+1 is a user turn and --question is omitted, its verbatim text becomes the replay prompt automatically.

Historical commit pinning (--pin-commit)

Every constant/v2 Dry Master stamps subconscious.git_commit when sealed. Passing --pin-commit with --isolate worktree checks out that exact historical commit in each target's detached worktree rather than current HEAD so counterfactual runs see the real codebase state from when the conversation happened.

Report output (--out)

Reports are written atomically (temp sibling, fsync, rename) and include:

  • summary.total_cases, summary.divergent_cases, and summary.per_target (succeeded, failed, avg_elapsed_ms, total_patches, unique_ref_cases, verify_passed, verify_failed)
  • cases[] containing original_runtime, original_model, pinned_commit, replayed_after_turn, question, baseline_answer, and the full multi-mind report (per-target answers, worktree diffs, and deterministic divergence).

Next: Agents & skill guide.