# crow-execute-bench — dataset pipeline & compaction training (2026-11-26)

Project: `~/src/crow-execute-bench` (git). Data mirrored to
`thomas-wood@192.168.1.175:~/crow-execute-bench` (coast-after-3, 124GB RAM).
Full training brief: `README_TRAINING.md` in that repo.

## What exists

- `scripts/mine_instances.py` — crow.db ⋈ `Session-Id:` commit trailers →
  SWE-bench-like instances (execute-harness sessions only). Verify commands
  resolved against the BASE tree (repos get restructured; HEAD lies).
- `scripts/score_trace.py` — rubric R1–R7 (proc discipline, no reimports,
  orchestration density, context hygiene, handler reuse, async polling,
  **research-before-changes**). AST-based, top-level-await aware, per-fork.
- `scripts/mine_compaction.py` — THE compaction dataset. Compaction mints a
  new `agent_idx` under the same session (compact.py); nothing is deleted.
  Input = generation N history + dangling-tool repairs + COMPACTION_PROMPT
  (tool_choice="none"); target = summary recovered from generation N+1's
  first user message by splitting on `\n\nLast messages:\n\n`.
  **Autonomous generations** (handoff = only user message) contain no human
  text — model-generated all the way down. 552 gens → 117 autonomous → 95
  successful; 85 pairs (~180k input), 95 full segments, 82 turn-boundary
  32k prefix cuts (cut at recorded per-turn prompt_tokens — exact).
- `scripts/rollout.py` / `batch_rollouts.py` — clean clone at base (future
  pruned), crow-cli run -a v2-agent, rubric judge + verify + fork-repair.
  Every best trace was a critique-fork (trunks 5–8 → forks 9–12).
- `scripts/export_sft.py` — messages-format SFT with tool_call_id integrity.

## Hard-won findings

1. **R7 was missing and it showed**: 10 of 11 first-round rollout agents did
   ZERO web research. Cause: the rollout prompt said "work only from the code
   in this directory" — the harness prompt's own wording suppressed the
   system prompt's search mandate. Prompts are behavior; audit them.
2. **Census of real sessions**: R1 mean 0.31 (shell bypasses dominate),
   R7 near-zero on real data. The behavior gap IS the training signal.
3. **Packing + target-token loss weighting** (LongAlign 2401.18058) is the
   key knob for long-input/short-output compaction pairs; naive averaging
   underweights them to nothing. CompactionRL (2607.05378): judge summaries
   by downstream continuation, not ROUGE; joint execution+summary training
   gave +6.6 Pass@1 SWE-bench Verified.
4. **Inkling-2-Mini**: 1M context, looped MoE 26B/3B active, llama.cpp
   support shipped. 190k training needs no position extension.
5. Handoff tails compound if uncapped (11k→172k chars over 6 gens measured
   in compact.py comments) — summaries must compress, and the dataset's
   compression_ratio field tracks this.
6. Privacy rule: NO human-trace data to HF, even private. Public sets must
   be fully synthetic (rollout rig + fresh tasks / SWE-smith bug injection).

## Loop integration

Bench instances for harness optimization can now come from
`data/instances.jsonl` (364) with real verify commands; judge rollouts with
`score_trace.py` critiques (GEPA reflection text is built in). Compaction
sharpness is a bench dimension: run a session past max_compact_tokens
(per-model config override — set it LOW to generate events cheaply) and
score the successor's orientation from the handoff.
