The Core Loop From Task To Kept Win
Planner, actor, trace, evaluator, reflector, proposer, gate, and memory working in steady rhythm.
Roles with one job each
The planner reads the task and the recent diary and sets a narrow aim. The aim names one failure pattern or one cost gap. A narrow aim keeps review human scale and keeps search honest.
The actor does the work with file, test, search, and execution tools. The trace recorder saves prompts, outputs, tool calls, costs, and timings in a standard shape. Standard shape matters because later steps can only reason about what was saved.
The evaluator scores the trace with deterministic tests first and model judges second. The reflector turns scores into a short lesson. The proposer turns one lesson into one patch with one test. The gate checks scope and risk before any branch moves toward the mainline.
Rhythm of one cycle
One task enters the loop with goal, scope, budget, and stop rules. The planner drafts an approach. The actor writes code or an answer. The recorder saves the trace. The evaluator scores the result. The reflector writes a lesson in plain words.
The proposer suggests one small change. The safety gate checks frozen paths and change size. The patch moves to a separate branch. The full suite runs with judge review. An accept moves the mainline forward by one safe step. A reject returns to the archive with a reason. Both paths update memory for the next round.
Why separation works
The worker seeks value while the judge seeks truth. Different prompts and different context keep the two honest. The same model may play both roles across time, but never in the same verdict without a second check.
Promotion needs a full test pass. Partial tests guide search. Only the full suite can promote. The judge code, the gate code, and the loop entry point stay immutable, so a candidate that touches those paths is rejected by rule.
Records that move through the loop
| Record | Holds | Reader |
|---|---|---|
| Task | Goal, scope, budget, stop rules | Planner and gate |
| Trace | Steps, artifacts, costs, timings | Evaluator and reflector |
| Score | Test results, judge notes, cost delta | Reflector and gate |
| Lesson | Pattern, cause, repair, risk | Proposer |
| Patch | Diff, test plan, rollback note | Gate and reviewer |
| Verdict | Accept or reject plus reasons | Memory and humans |
Branch discipline in shell form
git checkout -b rsi/generation-004 python engine/rsi_loop.py --state engine_state --generation 4 --files worker/planner.py --changes 1 --passed true --gain 0.15 --cost -0.05 git status cat engine_state/generation_004/verdict.json