feat(lab): coding_markdown_v4 - .toc index files + window-agnostic budget prompt

↗ view on GitHub · Eli Ziff · 2026-08-06 · 4f931f17

Two pilots (acq v1, tax v2) whole-read into auto-compaction with zero
Grep calls: the surface mechanics work, but nothing marks whole-read
infeasible from where the model sits (no felt cost - compaction rescues
silently) and nothing teaches the strategy switch. v4 makes both
visible, one flag (MIKE_CODING_TOC_FILES):

- Companion .toc virtual files: every docx with an anchorable spine gets
  "<name>.toc" - grep -n convention rows ("LINE:verbatim section lead",
  colon-no-space, document-true text) with a one-line header. Listed by
  Glob with sizes ("*.toc" lists only indexes), served by Read cat-n,
  round-trips (toc 147: -> Read offset=147 -> the same lead). Derived
  metadata: no evidence segments, no body-exposure counting. Orientation
  is demand-paged files, not prompt injection - tool results are not
  sha-gated and body line numbers stay pure. Two-plane resolver
  (anchoredSectionSpine) - skeleton-on-markdown finds 0 nodes.
- CONTEXT BUDGET prompt block (v4 serves the budget variant of the
  neutral prompt): bare-filename file_path, start with Glob (sizes +
  .toc files are in-band), overflow/compaction stated as a true
  environment fact, scoped-read strategy, batch related calls per turn.
  Deliberately window-agnostic - no 200K constants anywhere - so the
  same arm transfers to the Opus 5 A/B (one task) unchanged.
- Route leak-guard: under CC parity "Glob" is a served tool, not a leak
  term; frozen arms keep the original list.

Arm = v3 env + flag; per-arm conformance (coding_toc_files), fail-closed
reset += MIKE_CODING_TOC_FILES, delta tags/clusters wired. Proofs: toc
plane probe 18/18 (round-trip, *.toc filter, v2/v3 emit no .toc),
coding4/3/2 surface probes 8/8, suites 45/45, tsc clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011pfUVhNFTRvhYGXBwoKNj6
Repository eliziff/Beaver
Author Eli Ziff <eliasziff@gmail.com>
Authored
Parents 2a8e787b
Stats 5 files changed , +257 , -28
Part of Evaluation harness: Beaver-CAN and LegalBench-RAG adapters

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-4f931f17.md from inside the repo you want the change in.

⬇ Download capture-commit-4f931f17.md