feat(lab): draft-edit lever - saved draft + Edit tool on the coding surface
Measured motivation (gen-4 acq/antitrust/tax, 2026-08-07): the exposure echo refuses the first generate_docx and the only revision path was re-emitting the entire deliverable - the draft is composed twice (acq: 65k vs gen-3's 41k output tokens), and a full redraft can compress detail out of draft #1 (tax gen-4: coverage fixed at 25/25 read yet 42/77 - the misses are output-side synthesis, not read-gaps). MIKE_DRAFT_EDIT=1 (default off, nothing changes when off - flag-off paths return the identical tool arrays and byte-identical strings): - A generate_docx refused by the coverage check saves its body as "draft.md" (LocalAssistantRequirementsState.draftMarkdown/Title/ Filename); the refusal text teaches the revision path just-in-time. - New Edit tool with Claude Code's exact contract (file_path/old_string/ new_string/replace_all; unique-match or typed refusal). applyDraftEdit uses index splicing, never String.replace with a string pattern, so $-tokens in legal text stay literal (probed 7/7). - generate_docx served with markdown optional under the flag: omitting it renders the saved draft as edited; re-sending a full body keeps the buffer in sync. Same appended-tool pattern as the requirements echo, so every existing arm's tool_schema_sha256 is untouched by construction. No system-prompt change - the gen-4 prompt sha stands. - chat.ts flags record gains draft_edit; DRAFT_EDIT_DELTA reserved for the arm wiring (separate commit when the gen-4 wave lands, keeping the running stratum 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 | d972f3e3 |
| Stats | 3 files changed , +261 , -5 |
| 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-6e841c9e.md
from inside the repo you want the change in.