Implement closed-loop workspace follow-ups

This commit is contained in:
2026-07-15 23:48:12 +04:00
parent 3a48ecd24f
commit ed7efb6072
51 changed files with 702 additions and 54 deletions
@@ -0,0 +1,12 @@
# Capability accretion
Make run N+1 better through deterministic, replay-safe facts mined from validated prior runs—not model training or mutable hidden memory.
Promote a validated failure-to-fix pair by a reusable class key: gate, evaluator/toolchain kind, and normalized failure fingerprint. Store a reference to the validated fix artifact/diff and the evidence that it passed.
1. Extend the concept rails to retain `classKey`, `fixRef`, confidence, and contradiction state.
2. Deliver high-confidence facts deterministically at plan compilation (contract/gate tightening) or as a bounded stage instruction. L3 remains an instance-recall fallback.
3. Mine positive patterns separately: successful plan shapes, resolved commands, and useful retrievals.
4. Revoke or decay facts when later recorded evidence contradicts them.
Every promotion and delivery is event-derived and recorded; replay never re-mines live state.
@@ -0,0 +1,18 @@
# Closed-loop workspace
## Invariant
After every code-producing stage, the workspace has a recorded verification observation. A passing observation is the only state the next implementation stage may treat as known-good; replay reads the event rather than re-running a command.
## Seams
1. Before locking a plan, ground declared writes, referenced paths, and build prerequisites against the workspace/index. Unknown or absent prerequisites return the plan to the architect.
2. For each write-declaring stage, run the appropriate static/build command and record its result. Failures retry or route through recovery before downstream work continues.
3. Repeated hard precondition observations (for example `REFERENCE_EXISTS`) become a stage failure or bootstrap/clarification decision rather than independent rejected tool calls.
## Delivery order
- Per-write-stage build gates and truthful deferred contract verdicts (#162).
- Consume repeated build-critical `REFERENCE_EXISTS` blocks (#163): three blocks for one manifest/config path now create a recovery-eligible precondition failure.
- Ground plan prerequisites before plan lock; then use the verified observation as the next-stage planning baseline.
- Preserve recovery escalation for failures that still cannot reach a verified increment (#165).
@@ -0,0 +1,15 @@
# Stage prompt audit and audition
## Audit
Inventory each system-role/context block, its origin, token estimate, and outcome evidence. Remove redundant or stale text before adding rules. Inspect retry feedback separately: only the latest failure belongs in the prompt.
## Candidate additions
- Project build manifests, configs, and entry files are normal in-scope setup when required by the authoritative intent.
- Resolve a necessary scope edge from the authoritative intent; do not spend turns re-deciding it.
- Read/observe before writing and verify before declaring completion.
## Audition harness
Run a fixed task and seed through baseline, trimmed, curated-rules, and reworded-scope variants. Record completion, gate pass rate, rejected/wasted tool rounds, retries, token budget use, and context truncation. Choose the smallest variant that improves the 12B results; structural gates remain preferred where a deterministic mechanism exists.