bench: cache+branch-sim profiles, hypothesis-granular ledger memory, long-poll read_verdict

- Profiles regenerated with callgrind --cache-sim --branch-sim for both
  targets: per-function D1/LL miss and branch-mispredict columns unlock
  playbook class-4 preconditions (comrak: syntect write_highlighted owns
  31% of D1 read misses; tokei: parse_lines owns 56% of Ir).
- tokei workspace: accepted Phase 0 wins banked as a local commit so
  stash-based baseline rebuilds attribute only the marginal patch to new
  attempts (false-accept trap closed before grinding).
- read_ledger now returns per-attempt history (class, hotspot,
  hypothesis, verdict): a class may be re-entered with a materially new
  hypothesis, never a duplicate one. Task prompt updated to match.
- read_verdict long-polls the ledger up to 45s server-side (under the
  60s MCP cap), cutting the agent's polling turn burn ~15x.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EcKPWQ3MQD4NdEHwar96u2
This commit is contained in:
Claude
2026-07-10 04:49:19 +00:00
parent e0c5018008
commit 017491010b
7 changed files with 52055 additions and 66 deletions
+8 -3
View File
@@ -75,9 +75,14 @@ async def run_attempt(target: str, run_id: str, max_turns: int, repo_root: str)
task = (
f"Perform ONE optimization attempt on target '{target}'. You have NO shell, file, or "
f"web tools — only the seven mcp__harness__ tools. Do not attempt any other tool.\n"
f"1. read_ledger to see attempted classes; read_profile for hotspots.\n"
f"2. Pick the cheapest UNTRIED playbook class whose preconditions the profile "
f"satisfies; read_playbook for it.\n"
f"1. read_ledger for the attempt history (class, hotspot, hypothesis, verdict per "
f"prior attempt); read_profile for hotspots (includes cache-miss and branch-miss "
f"columns from cache simulation).\n"
f"2. Pick the cheapest playbook class whose preconditions the profile satisfies AND "
f"whose (hotspot, class, hypothesis) would be materially NEW — an attempted class "
f"may be re-entered with a different hotspot or a genuinely different mechanism, "
f"but never re-submit a hypothesis equivalent to one already in the ledger; "
f"read_playbook for it.\n"
f"3. Read the relevant source with read_target_source — for large files pass "
f"offset/limit and page through in windows (do NOT attempt any shell). State your "
f"hypothesis, then propose_patch (unified diff, a/ b/ prefixes, paths relative to the "