Cheat sheets

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

Source

Plan, delegate, integrate#

storeApproved planwaves fromdependenciesprocessAPI work unitowns its pathsprocessDocs work unitowns its pathsstoreProof and handoffAPI unitstoreProof and handoffdocs unitmodelIntegration reviewread onlyprocessFull verificationgatecross-unitstoreApproved planwaves from dependenciesprocessAPI work unitowns its pathsprocessDocs work unitowns its pathsstoreProof and handoffAPI unitstoreProof and handoffdocs unitmodelIntegration reviewread onlyprocessFull verificationgatecross-unit

The ratchet loop#

1Observerecord a concrete signal.2Connectlink it to an outcome, constraint or assumption.3Locatefind the earliest system layer that owns thecause.4Changecreate a bounded change with one owner.5Verifyprove that recurrence becomes less likely.6Reviewdecide to keep, revise or retire the control.

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#

FactorDelegateKeep serial
FilesDisjoint files and contractsSame files
DecisionsDifferent unknownsSame unresolved decision
EnvironmentSeparate worktrees or sandboxesSame mutable environment
Lab exampleAPI and docs units, disjoint pathsDocs 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#

TaskCode
Check plan receiptsvalidate(items)
Compute plan wavesexecution_waves(items)
Plan status ready or blockedplan_document(items)
Detect parent path overlappaths_overlap(left, right)
Delegation statusdelegation_plan(units)
Correction to controlpromote(correction)
Dedupe by fingerprintratchet(corrections)
Signals to sorted actionsbacklog(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#

CommandWhat it does
python3 scripts/project_test.py workflow-hooks --init learning-artifacts/workflow-hooksMakes the learner workspace
python3 scripts/project_test.py workflow-hooks --stage <n> --path learning-artifacts/workflow-hooksTests one stage
python3 scripts/project_test.py workflow-hooks --all --solution --strictChecks the reference solution
node <dir>/cli.ts capture <store> <corrections.jsonl>Ingests corrections and saves the store
node <dir>/cli.ts inspect <store>Lists rules with approval_digest
node <dir>/cli.ts approve <store> <digest>Approves the rule with the exact current digest
node <dir>/cli.ts emit <store> <scope>Prints additional_context for approved rules in scope
node <dir>/cli.ts retire <store> <digest>Removes the rule from emits. Evidence stays

Rule lifecycle in code#

const c = ingest(raw);scope lowercased, rule case kept
const rules = consolidate(corrections);group by scope and rule text
rule.sessions.lengthunique sessions, not events
transition(rule, "approve");needs minimumSessions = 2
transition(rule, "retire");retired cannot be approved
hook(rules, "orchard");approved, scope or global
ruleDigest(rule);sha256 of scope, text, evidence
await save("rules.json", rules);temp file, then fs.rename
await load("rules.json");ENOENT gives an empty list

Defaults and limits#

SettingDefaultNote
minimumSessions2Independent sessions to approve
c.rule.length500Larger rule is "too large"
c.source.length2000Larger source is "too large"
Store version1Other versions give "invalid store"
Temp file mode0o600Owner-only permissions
recurrence floor1Below it the correction is skipped
Control fingerprint12Hex characters of sha256
Signal severityrange(1, 6)Frequency must be positive

Errors and fixes#

SymptomCauseFix
has no repository evidenceA work item has no receiptAdd a file path and line
has no proof commandEmpty proofName the exact check that closes it
dependency cycle amongItems wait on each otherFind the hidden product disagreement
overlap at in conflictsDocs unit owns app/, a parent pathGive each unit exclusive paths
insufficient independent sessionsOne session, many eventsWait for a second session
exact current rule digest requiredDigest is old after new evidenceRun inspect, approve the new digest
credential-like contentRule or source holds a key shapeRedact before ingestion
conflicting correction idSame id, different contentNever reuse an id for new content