Five sorting experiments Watch & Poke
The parcel desk
Three Ways In · Layer 3 of 3 · Node.js 22+ · Zero Dependencies
Build With Your Coding Agent — 5 Rungs + Planted Traps
Build a leak-free, safety-guarded specialist model cascade with your coding agent across five rungs: counterfactual episode logging, hard pre-commit deterministic guards, split-safe abstain calibration, lookup + shallow-tree baselines, and queue-coupled end-to-end replay. Each rung gives you an architect prompt for Claude Code, Codex, or Cursor, a planted bug that unguided agents write, and a deterministic test suite that catches it.
- Leak-free episode log: Group-split counterfactual candidate logging frozen strictly before dispatch — Planted trap: Recording post-dispatch queue outcomes inside input features (target leakage).
- Hard pre-commit guard: Deterministic capacity/customs invariant check gating every model proposal — Planted trap: Validating the fast model's proposal while letting fallback routes bypass the hard guard.
- Abstain calibration: Validation-only threshold selection bounding violation risk before test evaluation — Planted trap: Tuning the abstain threshold on the evaluation shift itself.
- Lookup & tree baselines: 0-ms exact-match table and depth-2 rule tree benchmarked before neural/specialist claims — Planted trap: Comparing the specialist only against a random coin flip instead of deterministic baselines.
- Coupled queue replay: Stateful shift simulator where each dispatch mutates live lane backlogs for future parcels — Planted trap: Scoring accuracy on fixed historical snapshots without simulating downstream queue buildup.
unzip parcel-desk.zip && cd specialist-cascade-lab/agent-track
node --test test/*.test.mjs
CASCADE_IMPL=learner node --test test/rung-01.test.mjs
node run.mjs reference
Download 5-Rung Agent Track (parcel-desk.zip) Read AGENT-TRACK.md on GitHub Open agent-track/README.md on GitHub
Apply the same checks to wire paths on circuit boards · 13 lessons · 13 milestones
Read the opening of Lesson 1
Welcome. You’ll help a program choose where a wire should run on a circuit board, the flat panel that connects the parts inside a device. We draw the board as a grid of squares. A wire that passes too close to another part can make an unwanted connection. Count the squares between them to check the gap.
A program trained on earlier boards gives each possible path a score. We call this program a specialist because it does one job. A guard checks each path against a rule. The rule for this board requires a gap of at least two squares. The guard marks a path that breaks the rule as off-limits (MASKED) before the specialist can choose it. Which gap would you allow, one square or three?
You will add the guard, let the specialist choose among the remaining paths, then check its choice. These checks and choices run in order. That sequence is the cascade.
Which wire path clears both checks?
Six paths could connect two parts on a circuit board. A wire needs two empty squares between it and an obstacle. The first gate checks that gap. A specialist, a program trained to score paths, picks its favorite from those left. The last gate checks the chosen path for spacing and crowding. Predict what happens if you turn off the first check.
Act I (Lessons 1–5): rule guards, comparing alternatives and a 5.7 KB edge router
A model's confidence score measures how familiar an option looks, not whether physical safety rules hold. Masking illegal moves before the model picks—and checking the finished path afterward—drops hard violations from 22/24 boards to 0/24 with the same learned scoring numbers (model weights).
Across Milestones M1–M5, you enforce maskLegalActions and verifyRoute, fix imitation learning’s 14/24 retry stall by comparing alternative moves on the same board, separate boards with identical summary averages using 16x16 local grid snapshots, compress expert teacher decisions into a self-shrinking three-tier cascade, and compile the router into a standalone 5,742-byte JavaScript module.
Clone and start
You need Git, Node.js 22 or newer and comfortable JavaScript. These commands check out the pinned project and run both Act I and Act II probes offline:
git clone https://github.com/itsHabib/free-to-learn.git
cd free-to-learn
git switch -c my-specialist-cascade 7dba0d743224c10a707307769782b0db3f9a2a1a
cd courses/specialist-cascade-lab
node lab.mjs start
node check.mjs m1
node lab.mjs guard b-104
node lab.mjs committee c-201
node lab.mjs ablateThe untouched starter fails node check.mjs m1 and node check.mjs m6 with targeted TODO hints until you implement each milestone in workspace/starter.mjs. Read lesson 1 (download the revised lesson text), jump into Act II at lesson 6, or open the project README. Serve the folder locally (python3 -m http.server) to open the 13-lesson reader at public/index.html and the 3-tab simulator, edge compiler and ablation composer at bench/index.html.
Act II (Lessons 6–13): escalation gates, calibrated sets and safe offline replay
Cascading means knowing when to step back and hand a tricky input to a smarter tier or extra compute. Milestones M6–M11 answer the three questions every real cascade faces: when to escalate (3-model committee disagreement, nearest-neighbor k-NN novelty checks, and 0 ms lookup patches for past failure twins), what the fast tier sees (multi-scale 64x64 + 16x16 grid views at 8x compression), and what solves hard cases (a 3.0 ms deterministic Tier-2 lookahead simulator and drafting 8 fast steps ahead to verify in one pass at 7.2x speed).
In Milestone M11, you wire the full cascade across 60 multi-failure boards—hitting 60/60 safety at 1.7% Teacher calls and 2.43 ms average latency while proving why redundant checks bloat latency 7.6x for zero extra safety. Milestones M12–M13 add calibrated confidence sets, gradient-boosted decision trees (GBDTs), safe offline traffic replay, and per-branch cloud latency histograms.