dba43e47a2
Two clean-room reimplementations layered onto the native `!task` loop (`_run_native`), aimed at lifting a weak CPU-bound local model's autonomous pass rate. No code copied from the GPL sources studied; MIT throughout. NightShift-derived verify-then-repair gate: - `_classify_failure` maps a failing tool result to a (category, fix-hint) so the repair nudge names a concrete cause/next-action instead of "exited N". - `_relevant_excerpt` keeps the error-relevant tail of a FAILING run_shell result within the byte budget (the real error is usually at the tail). - read-dedupe guard short-circuits repeated idempotent `read_file` of a path already read this task. Exoshell-derived context discipline: - `_prune_native_messages` budgets the whole message list (~chars/4) and evicts oldest removable turns first once over `native_token_budget`, pinning index 0, the TASK_MARKER goal, and the most-recent turns — the native loop previously grew unbounded, silently pushing the goal out of a small model's window on long repair runs. - TASK_MARKER labels the goal so it is never pruned and re-anchors the model. - REPAIR_STANCE is appended to the turn system prompt after the first failure to swap the whole turn into a diagnose-then-act posture. Validated on qwen2.5-coder:3b: clean unstitched 7/9 (the local ceiling), no regression vs baseline; unit-tested pruning (pin survival, oldest-first eviction, under-budget no-op) and stance trigger. The two remaining fails are exact-match correctness tasks (a count, a fibonacci string), not harness gaps. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>