Install any skill in seconds. Free to start, no credit card required.
Get Started Free →The optimizer brain for the ladder-foundry pretraining loop. Runs the two-level nested batch loop, delegates gating to gate_eval, attributes a failing batch to one weight (attribute-first), and recovers from disk after compaction. Control flow is fully scripted; only the backprop attribution is a judgment call.
.claude/skills/yogsoth-ai-optimization-loop/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 124% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 8% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 90% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 89% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 81% | 0% |
You are the optimizer. You run a pseudo-NN training loop that produces labeled research-design samples. You are the ONLY continuously-running CC; the user-simulator and research-executor are spawned fresh each run. Disk is the only source of truth — your memory is not.
LOOP-2 (epochs/batches, runs to convergence) wraps LOOP-1 (one batch = 48 runs = 8 topics × 6 rungs).
Epoch start (once):
python ../../scripts/new_run_id.py --runs-root runs → capture run_id.Emit trace run_start.
Batch start (each batch):
batch_id = the highest batch-N in runs/<run_id>/weights/ (cold start =batch-0; do NOT pre-increment). Emit batch_start.
../../generator/gen_configs.py main(out_dir, w) (it is main(out_dir, w), NOT an argparse CLI — invoke via a one-line python -c that imports it and passes the loaded weights/<batch_id>.json). M1 note: gen_configs names configs config_{rung}.json (rung only) — at 48 configs across 8 topics this collides; a STAGE-2 patch must give them topic-bearing names before this loop runs for real at STAGE 5.
Per run (8 topics × 6 rungs = 48):
research_config.2 mandatory rules (the executor MUST load formated-specs then formated-results).
dialogue_turnper exchange.
--sample <sample> --out runs/<run_id>/transcripts/<sample>.md. --logs-dir is REQUIRED, no default (privacy red line).
python ../../scripts/concat_triple.py --run-dir runs/<run_id> --sample <sample>.../injection-fidelity/SKILL.md --out runs/<run_id>/loss/<sample>.loss1.json. Emit rung_done.
Per topic (after its 6 rungs):
--intended-order id0,id1,id2,id3,id4,id5 --skill-md ../ladder-quality-order/SKILL.md --out runs/<run_id>/loss/<topic>.loss2.json --seed <fixed>.
--mono <loss2.monotonicity_pass> --endpoint <loss2.endpoint_separation_pass>. Emit topic_done.
--out-root dataset --loss1 … --topic-pass … ×6 (one per rung).
Batch close:
python ../../scripts/gate_eval.py batch --flags <8 topic-pass bools>. Emitbatch_done (include recent_ratios).
python ../../scripts/gate_eval.py converged --recent <last-3 batch ratios>.converged + run_end. Done.Follow this section exactly; no improvisation in the control flow.
Delegate ALL gate arithmetic to ../../scripts/gate_eval.py (pure, no CC/codex):
fidelity_rate ≥ FIDELITY_MIN ∧ monotonicity_pass ∧endpoint_separation_pass).
pass_ratio ≥ BATCH_RATIO_MIN, hard integer line ≥ 7/8 topics.recent_ratios, last 3 all ≥ BATCH_RATIO_MIN.Thresholds are NOT restated here. FIDELITY_MIN and BATCH_RATIO_MIN are the module constants in ../../scripts/gate_eval.py — the single source of truth. New numbers the judges use (τ line, 丙 line, K, endpoint allowance, drift ε) live in references/gate-thresholds.md, which also points back, never copies.
check-blind: you read only fidelity_rate, tau, monotonicity_pass, endpoint_separation_pass, and codex verdicts. You never see or reason about any quality-check list. rigor_floor_flag is an orthogonal alarm — it is NOT in the AND.
One batch changes ONE weight. First attribute the failure, then act. Read the trace coarse→fine (batch_done → topic_done → loss/*.json) and stop when decided.
Decision table:
| Signal read | Target weight | Key | | --- | --- | --- | | loss-1 fidelity fails (an axis collapsed) | axis_prose | the collapsed AXIS.LEVEL cell | | loss-2 endpoints NOT separated, rigor_floor_flag == true | NONE | alarm only — do NOT train ② (coords are frozen_label-locked; training ② is a no-op). Record and move on. | | loss-2 endpoints NOT separated, rigor_floor_flag == false | axis_prose | the id0 or id5 endpoint cell | | loss-2 middle collision (τ < TAU_MIN but endpoints separated) | interp_params | one of collision_offset_axis (B1/expression only), endpoint_spread, granularity_map | | ≥ 4/8 topics double-collapse (both losses fail) | assembler_params | the structural knob implicated |
Priority: loss-1 > loss-2 middle-collision > whole-card. Pre-gate: if a topic's z⊥C confound check is NOT flat, that topic's loss-2 is void — do NOT change any weight on it this batch.
Execution: the attribution is YOUR decision (no script). Then EITHER python ../../scripts/apply_weight_update.py --weights-dir runs/<run_id>/weights --batch-id <batch_id> --target <target> --key <key> --new <new-text> --reason <why> (F2: writes weights/<batch+1>.json + appends revision_log.jsonl), OR the same with --copy (F1: byte-copy forward, no log — when you decide NOT to change a weight this batch).
Before committing new axis_prose text, run it through generator/leak_audit.py (it must not name any check vocabulary). W5: your attribution inputs are only fidelity / τ / endpoint / codex verdicts — never a check list. Detail in references/backprop-heuristic.md.
Memory is not trustworthy across a /compact. Three persisted artifacts: runs/<run_id>/trace.jsonl, runs/<run_id>/weights/<batch>.json, runs/<run_id>/revision_log.jsonl.
At each batch end: run /compact, reload THIS skill, and recover from disk:
weights/<batch+1>.json (the new weights for the next gen_configs),revision_log.jsonl (the change history),trace.jsonl tail (recent_ratios + batch_id + last seq → +1 tocontinue numbering).
Privacy: the trace's transcript_path is always relative; save_transcript.py --logs-dir is required with no default. After recovery, verify the frozen_label lock is intact — weights.revise("frozen_label", …) must still raise.
Leaves are NOT moved into this skill (D1). Reference them by relative anchor from this skill dir:
../../scripts/new_run_id.py, ../../scripts/trace_emit.py,../../scripts/save_transcript.py, ../../scripts/concat_triple.py, ../../scripts/gate_eval.py, ../../scripts/apply_weight_update.py, ../../scripts/write_dataset.py
../../generator/gen_configs.py (main(out_dir, w), non-argparse; M1collision annotated — a STAGE-2 patch is a STAGE-5 prerequisite)
scripts/run_codex_loss.pyChild-CC launch (3 iron rules):
claude DIRECTLY in its own Bashtool: IS_SANDBOX=1 CLAUDE_CONFIG_DIR=<role-dir> bash -lc 'cd <child-cwd> && claude'. No driver script. No pseudo-terminal. No tmux for children (tmux hosts only the optimizer itself).
injected, so no context may carry over). Only the optimizer is continuous.
via --logs-dir).
All three CC layers are normal interactive REPLs. Never pass the print, resume, session-id, or allowed-tools flags to any claude invocation — those modes are forbidden in this loop and must not appear even in this skill's text.
Four role config-dirs:
/workspace/home/optim/.claude (this skill + superpowers)/workspace/home/sim/.claude (superpowers only; persona injected)/workspace/home/exec/.claude (the DARE skill library +formated-specs / formated-results + superpowers)
/workspace/home/loss/.codex (the 2 loss skills only)| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→fail | 17,612 | 14,762 | -16% | 1 | 1 | 0% | 2,096 | 2,777 | +32% | 0 | 0 | — |
case-03 | fail→fail | 25,350 | 15,900 | -37% | 1 | 1 | 0% | 1,946 | 2,801 | +44% | 0 | 0 | — |
case-01 | fail→fail | 17,113 | 14,323 | -16% | 1 | 1 | 0% | 2,383 | 2,712 | +14% | 0 | 0 | — |
case-04 | fail→pass | 13,989 | 9,397 | -33% | 1 | 1 | 0% | 1,468 | 3,287 | +124% | 0 | 0 | — |
case-05 | pass→pass | 18,225 | 12,877 | -29% | 1 | 1 | 0% | 2,273 | 4,007 | +76% | 0 | 0 | — |
case-06 | pass→pass | 15,589 | 25,700 | +65% | 1 | 1 | 0% | 1,896 | 4,643 | +145% | 0 | 0 | — |
case-07 | fail→pass | 23,347 | 9,771 | -58% | 1 | 1 | 0% | 3,104 | 3,344 | +8% | 0 | 0 | — |
case-08 | fail→pass | 16,025 | 10,206 | -36% | 1 | 1 | 0% | 1,898 | 3,602 | +90% | 0 | 0 | — |
case-09 | fail→pass | 14,967 | 8,507 | -43% | 1 | 1 | 0% | 1,677 | 3,162 | +89% | 0 | 0 | — |
case-10 | pass→pass | 13,325 | 6,701 | -50% | 1 | 1 | 0% | 1,326 | 2,787 | +110% | 0 | 0 | — |
case-11 | fail→pass | 14,096 | 7,251 | -49% | 1 | 1 | 0% | 1,581 | 2,864 | +81% | 0 | 0 | — |
case-12 | fail→pass | 22,105 | 11,022 | -50% | 1 | 1 | 0% | 2,722 | 3,575 | +31% | 0 | 0 | — |
case-13 | fail→pass | 16,180 | 9,005 | -44% | 1 | 1 | 0% | 1,722 | 3,123 | +81% | 0 | 0 | — |
case-14 | fail→pass | 13,079 | 7,658 | -41% | 1 | 1 | 0% | 1,201 | 2,985 | +149% | 0 | 0 | — |
case-15 | fail→pass | 19,780 | 8,169 | -59% | 1 | 1 | 0% | 2,123 | 3,113 | +47% | 0 | 0 | — |
case-16 | fail→fail | 24,241 | 10,103 | -58% | 1 | 1 | 0% | 3,035 | 3,521 | +16% | 0 | 0 | — |
case-17 | fail→pass | 13,767 | 7,689 | -44% | 1 | 1 | 0% | 1,349 | 2,982 | +121% | 0 | 0 | — |
case-18 | fail→pass | 15,617 | 10,065 | -36% | 1 | 1 | 0% | 2,065 | 3,497 | +69% | 0 | 0 | — |
case-19 | fail→pass | 10,390 | 7,425 | -29% | 1 | 1 | 0% | 914 | 2,894 | +217% | 0 | 0 | — |
case-20 | fail→pass | 17,129 | 8,036 | -53% | 1 | 1 | 0% | 2,006 | 3,087 | +54% | 0 | 0 | — |
case-21 | fail→pass | 15,462 | 9,040 | -42% | 1 | 1 | 0% | 1,549 | 3,145 | +103% | 0 | 0 | — |
case-22 | fail→pass | 16,416 | 8,696 | -47% | 1 | 1 | 0% | 2,124 | 3,199 | +51% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 19 counted toward the lift figure. The other 3 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +68 percentage points is the difference between those two pass rates over the 19 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.