Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Run the DOS enforcement-policy self-tuning loop. Use when Codex should tune `[intervention_policy]`, `[intervention]`, or `[improve]` knobs from observed false-deny vs held-catch outcomes with `dos enforce-tune`, measuring candidates in an isolated worktree and keeping only kernel-witnessed improvements: suite green, truth clean, strict net_task_delta gain, and no runtime-logic edits. Driven by `dos` verbs and workspace `dos.toml`; escalate after repeated non-keeps. (docs/365).
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 103% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 33% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 107% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 169% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 77% | 0% |
> DOS is a sound PDP with no feedback from the PEP. The kernel decides an > intervention verdict, a host acts on it, the act is journaled — but nothing fed > whether the act was right back into the policy that drove it. This loop closes > that. It learns the enforcement thresholds from the journal's own ground truth: > a deny the operator later overrode is a false-DENY (too aggressive); a deny > that stood is a held catch. The loop tunes the policy to drive false-DENIES down > while holding the catches — and keeps an edit only if the kernel, not the > agent, measures that it helped.
This is dos-self-improve]] pointed at the enforcement policy, with one twist: the metric is not a generic count, it is the docs/143 net_task_delta of the policy over labelled cases the loop did not author.
> A self-tuner's fatal failure mode is grading its own homework — relabelling its > outcomes so its policy edit looks good. dos enforce-tune closes that hole the same > way dos improve does: the metric is computed BY THE KERNEL from cases the loop did > not author (a frozen corpus ∪ the live enforcement journal). The loop cannot keep > a policy edit by claiming it is better. The only path to KEEP is to actually move > net_task_delta.
| Step | Who | What | |---|---|---| | Read the outcomes | dos enforce-outcomes | the live false-DENY / held-catch ledger — what to tune toward | | Propose ONE policy-knob edit | YOU (a subagent) | the untrusted step — edit [intervention_policy] / [intervention] ranks / [improve] in a worktree | | Measure | dos enforce-tune | score the candidate policy's net_task_delta over the corpus, on the worktree | | Keep / revert / escalate | dos enforce-tune (rides dos improve) | the kernel's typed verdict over env-authored facts — NOT your opinion | | Merge / discard / escalate | YOU (or the autonomous cadence) | carry out the kernel's verdict |
--cases <corpus.jsonl> (required) — the labelled InterventionCase corpus thecandidate policy is scored over (the docs/143 §13.2 ground truth). The reference corpus is the benchmark's intervention_cases.jsonl.
dos enforce-tune EXIT CODE and merges ona KEEP. Run interactively WITHOUT auto-merge to inspect the verdict first (the safe default); let the cadence auto-merge once you trust it. Either way the verdict is the kernel's, and the runtime-logic rail still reverts a candidate that edited adjudication logic.
--max-cycles <N> (default 5) — the backstop cap.--max-reverts <N> (default 3) — ESCALATE to a human after this many non-keeps in arow (the breaker).
--lane <name> (optional) — the lane to take; a bare loop auto-picks a free one.bashdos enforce-outcomes --workspace . --json
This folds the OP_ENFORCE journal into the false-DENY / held-catch ledger. A standing false_denies count is the signal: the policy is refusing edits the workspace genuinely makes. (The dos pulse heartbeat surfaces the same count when it crosses the threshold, so an always-on operator sees it without asking.) Note the targets being over-blocked — they tell you which way to tune (usually: loosen a rung or raise a confidence bar so a marginal mint earns WARN, not BLOCK).
bashdos doctor --workspace . --json dos arbitrate --workspace . --lane <LANE> RID=$(dos run-id mint dos-enforce-tune \ | python -c "import sys,json;print(json.load(sys.stdin)['run_id'])") python -m pytest -q # MUST be green to start dos enforce-tune --cases <corpus> --suite-passed --truth-clean \ --baseline-work 0 --json --workspace . # read measured_work = the BASELINE policy's score
Record the baseline measured_work B. You cannot measure improvement from a red baseline — if the suite is red, fix it first (an ordinary task, not a tuning cycle). RID is the loop's correlation run-id; pass it with --observe on every dos enforce-tune call so dos observe --loops can fold this always-on tuner's trajectory while it runs (docs/383) — otherwise a long-lived cadence is invisible between its commits.
The enforcement policy is the kernel's own config — editing it on the live tree is the SELF_MODIFY hazard (self-modification-hazard]]). Work in an isolated worktree:
bashgit worktree add ../_et-candidate HEAD
Spawn ONE subagent with a tight brief, working in that worktree:
> Improve DOS's enforcement policy to reduce false-DENIES without losing catches. > Edit ONLY the policy KNOBS: the [intervention_policy] confidence-gating values > (on_high_confidence / on_low_confidence / floor / ceiling), the > [intervention] ladder ranks, or the [improve] thresholds — in dos.toml. Make > the SMALLEST edit that should move net_task_delta. Do NOT touch enforcement LOGIC > (self_modify.py, admission.py, arbiter.py, the ladder code) — that edit will > be reverted regardless of its metric. Commit your change. Return what you changed > and why. If you cannot find a real improvement, say so — do not invent one.
Gather the env-authored witnesses on the worktree, then ask the kernel:
bashcd ../_et-candidate && python -m pytest -q ; SUITE=$? CHANGED=$(git diff --name-only HEAD~1 HEAD) # the candidate's diff — for the rail dos enforce-tune --cases <corpus> \ --policy-toml ../_et-candidate/dos.toml \ --baseline-work "$B" \ $( [ "$SUITE" -eq 0 ] && echo --suite-passed ) \ --truth-clean \ --changed-files $CHANGED \ --max-reverts <N> \ --observe --run-id "$RID" --subject "cycle-$CYCLE" --json --workspace .
The --observe --run-id "$RID" --subject "cycle-$CYCLE" line records the cycle to the verdict journal so dos observe --loops folds this loop's trajectory live (docs/383).
dos enforce-tune re-scores the CANDIDATE policy (loaded from its worktree dos.toml), applies the runtime-logic rail to --changed-files, and rides dos improve. The verdict IS the exit code:
0 KEEP — suite green, truth clean, candidate net_task_delta strictly beatB, no runtime-logic edit. Witnessed. Go to Step 4-KEEP.
3 REVERT — a regression (suite red / a runtime-logic edit / truth dirty) or ano-op (the metric did not beat B). Go to Step 4-REVERT.
4 ESCALATE — the breaker is open (--max-reverts non-keeps in a row). STOP.candidate's measured_work (the ratchet), reset the revert count. The autonomous cadence does this on exit 0; by hand: git merge --ff-only <sha> then B=<measured_work>.
revert count. git worktree remove --force ../_et-candidate.
dos decisions entry with the kernel's reason, STOP.The loop has run dry of witnessed improvements; a person decides what matters next.
Re-create a fresh worktree off the (possibly advanced) lane HEAD and return to Step 2 until --max-cycles or an ESCALATE.
To run continuously, wire a durable scheduler (a cron / Windows Task via a gitignored .dos/ runner — the dos pulse runner sibling pattern). The runner does ONE bounded cycle per firing and merges on a KEEP by reading the exit code:
bash# per firing, in an isolated worktree the runner created off the lane HEAD: dos enforce-tune --cases <corpus> --policy-toml <wt>/dos.toml \ --baseline-work "$B" --suite-passed --truth-clean \ --changed-files $(git -C <wt> diff --name-only HEAD~1 HEAD) \ --observe --run-id "$RID" --subject "cycle-$N" --workspace . case $? in 0) git merge --ff-only <candidate-sha> ;; # KEEP — auto-merge + ratchet B 4) dos decisions ... ; exit 0 ;; # ESCALATE — surface to a human, stop *) : ;; # REVERT — discard, leave the policy esac
The cadence keeps ONE $RID across all its firings (persist it in the runner's .dos/ state), so every cycle folds into the SAME trajectory — an always-on tuner that would otherwise be invisible between commits becomes a live curve in dos observe --loops.
Each firing is bounded (one cycle; over many firings the breaker + cap still hold), so it always terminates — never an unbounded run. dos pulse keeps its observe leg, so the heartbeat surfaces the false-DENY rate the loop acts on.
Watch the tuner live: dos observe --loops (every loop) or dos observe --loops --run "$RID" (this tuner's full per-cycle curve) — the metric high-water, the breaker N/max distance-to-escalate, and the ACTIVE/STALLED/ESCALATED band, all folded from the kernel's own verdicts (docs/383).
dos enforce-tune KEEPs only on akernel-measured strict net_task_delta gain with the suite green and truth clean. A no-op or regression auto-REVERTs — the loop cannot narrate its way to a merge.
human-in-the-loop seed, preserved even when fully autonomous.
adjudication logic (self_modify._DISPATCH_RUNTIME_FILES), regardless of its metric. The loop owns the policy KNOBS; the SELF_MODIFY guard still owns the LOGIC blast radius. A tuner that rewrote the arbiter to make a number go up is the self-modification hazard DOS refuses — refused here too, before merge.
logic edit is auto-reverted; the brief forbids it.
net_task_delta is computed by the kernel fromcases the loop did not author (the frozen corpus ∪ the live journal). A metric the subagent computes about itself is back to grading its own homework — refuse it.
dos enforce-tune; onlythe kernel verdict decides KEEP.
cannot see.
coverage (catchesheld), which net_task_delta penalizes; the kernel will REVERT an over-loosened candidate because the metric balances both.
Other measured skills in the registry, with their headline benchmark lift.