Delegation, Isolation and Feedback Ratchets
Plan from evidence, split work by exclusive ownership, and promote each correction to the earliest owning layer.
- Concepts and terms
- Tasks and commands
- Annotated code
- Diagrams
- Comparisons
- Defaults and numbers
- Troubleshooting
- Questions and tips
Plan, delegate, integrate#
The ratchet loop#
Five commitments per work item#
- Identifier
- stable reference for dependencies and handoff.
- Change
- the smallest behavior or contract change.
- Evidence
- repository facts that justify the change.
- Dependencies
- work that must be true first.
- Proof
- the exact check that closes the item.
- Wave
- items whose dependencies are all complete. They run together.
- Contract first
- implementation and docs wait for the contract.
Delegate or keep serial#
| Factor | Delegate | Keep serial |
|---|---|---|
| Files | Disjoint files and contracts | Same files |
| Decisions | Different unknowns | Same unresolved decision |
| Environment | Separate worktrees or sandboxes | Same mutable environment |
| Lab example | API and docs units, disjoint paths | Docs unit owns app/, plan blocks |
Three isolation layers#
- Filesystem
- separate worktrees or sandboxes stop accidental shared edits.
- Ownership
- contracts stop two workers from editing the same path.
- State
- separate logs and outputs keep each worker's evidence.
- Limit
- two clean worktrees can still produce conflicting designs.
- Integrator
- reads proof output, merges in dependency order, runs the full gate.
Route a signal to its layer#
- Wrong result, regression, false positive
- evaluation or test.
- Missing context, duplicate work, stale fact
- context source.
- Off-scope or unsafe action
- scope or permission policy.
- Timeout, retry storm
- runtime control.
- Repeated setup or command mistake
- automation or tool.
- Output-format mistake
- canonical example plus validator.
- Product disagreement
- human decision record or shaped backlog.
- Priority
- severity times frequency. Severity is one to five.
Lesson functions#
| Task | Code |
|---|---|
| Check plan receipts | validate(items) |
| Compute plan waves | execution_waves(items) |
| Plan status ready or blocked | plan_document(items) |
| Detect parent path overlap | paths_overlap(left, |
| Delegation status | delegation_plan(units) |
| Correction to control | promote(correction) |
| Dedupe by fingerprint | ratchet(corrections) |
| Signals to sorted actions | backlog(signals) |
Questions#
- When is evidence real?
- When it can change the plan.
- Integrator rewrites most of a result?
- The decomposition was wrong.
- Why count sessions, not events?
- Repeated hook delivery is not independent evidence.
- Promote every correction?
- No. Only when recurrence or consequence justifies it.
- Who owns public behavior changes?
- The human. Agents own bounded work.
Tips#
- Fix the cause, not the symptom. "The agent edited README" is a symptom.
- A focused test is stronger than a paragraph that asks the agent to remember.
- Give each control one owner, a verification and a retirement condition.
- Retire a control only with evidence. Do not delete it because it feels old.
- Keep the exact case of API_KEY in a rule.
Workflow hooks CLI#
| Command | What it does |
|---|---|
python3 scripts/ | Makes the learner workspace |
python3 scripts/ | Tests one stage |
python3 scripts/ | Checks the reference solution |
node <dir>/ | Ingests corrections and saves the store |
node <dir>/ | Lists rules with approval_digest |
node <dir>/ | Approves the rule with the exact current digest |
node <dir>/ | Prints additional_context for approved rules in scope |
node <dir>/ | Removes the rule from emits. Evidence stays |
Rule lifecycle in code#
const c = ingest(raw);scope lowercased, rule case keptconst rules = consolidate(corrections);group by scope and rule textrule.sessions.lengthunique sessions, not eventstransition(rule, "approve");needs minimumSessions = 2transition(rule, "retire");retired cannot be approvedhook(rules, "orchard");approved, scope or globalruleDigest(rule);sha256 of scope, text, evidenceawait save("rules.json", rules);temp file, then fs.renameawait load("rules.json");ENOENT gives an empty listDefaults and limits#
| Setting | Default | Note |
|---|---|---|
minimumSessions | 2 | Independent sessions to approve |
c.rule.length | 500 | Larger rule is "too large" |
c.source.length | 2000 | Larger source is "too large" |
Store version | 1 | Other versions give "invalid store" |
Temp file mode | 0o600 | Owner-only permissions |
recurrence floor | 1 | Below it the correction is skipped |
| Control fingerprint | 12 | Hex characters of sha256 |
Signal severity | range(1, 6) | Frequency must be positive |
Errors and fixes#
| Symptom | Cause | Fix |
|---|---|---|
has no repository evidence | A work item has no receipt | Add a file path and line |
has no proof command | Empty proof | Name the exact check that closes it |
dependency cycle among | Items wait on each other | Find the hidden product disagreement |
overlap at in conflicts | Docs unit owns app/, a parent path | Give each unit exclusive paths |
insufficient independent sessions | One session, many events | Wait for a second session |
exact current rule digest required | Digest is old after new evidence | Run inspect, approve the new digest |
credential-like content | Rule or source holds a key shape | Redact before ingestion |
conflicting correction id | Same id, different content | Never reuse an id for new content |