LDD (Loss-Driven Development) is gradient descent for coding agents. Every code change, every output revision, every skill edit, every reasoning step is an SGD step on one of four parameter spaces. LDD installs the loss, the gradient, the step-size rule, and the regularizer so that iteration converges instead of drifts. Full theory: ../theory.md.
θ_{k+1} = θ_k − η · ∇L(θ_k) + regularizer(θ_k)
Applied four times — once per parameter space (see the four-loop table below).
- θ — what changes. Four axes: code (inner), deliverable (refinement, y-axis), skills / rubrics (outer, m-axis), reasoning chain (CoT, t-axis, v0.8.0).
- L — loss. Failing test, rejected gate, critique defect, evaluation delta, rubric score, per-step dialectical synthesis.
- ∇L — the gradient. Computed via
root-cause-by-layer(5 layers deep); invalid without reproducible signal (reproducibility-first). - η — learning rate / step size. One-off bug → local tweak. Recurring defect → architectural edit (
loss-backprop-lens). Per-task rigor picked bythinking-levels. - regularizer — contracts, layer boundaries, invariants, docs. Enforced by
docs-as-definition-of-doneper commit anddrift-detectionperiodically.
| Loop | θ / y / m / t | L | Skill | Budget |
|---|---|---|---|---|
| Inner | θ = Code |
Failing test / gate | loop-driven-engineering + specialists |
K_MAX = 5 |
| Refinement | y = Deliverable |
Critique + gate rejections + eval deltas | iterative-refinement |
halve per iter; stop on regression/plateau |
| Outer | m = Skill / rubric |
Mean-loss across task suite | method-evolution |
N epochs; rollback on regression |
| CoT | t = Reasoning chain |
Per-step dialectic + ground-truth verification | dialectical-cot |
per-chain max_steps; backtracks ≤ 3 |
Step-size controller: thinking-levels picks L0…L4 per task before any of the four loops starts, setting k_max, reproduce_runs, max_refinement_iterations, mode, and the skill floor. Not a fifth loop — the learning-rate scheduler.
Mixing loops is the single biggest cause of "iteration that never converges." If you cannot name which loop you are in, stop and ask.
- Loss is well-defined and stable. Rubric does not change under your hand to fit the current answer.
- Gradient is honest. Causal story to layer 4/5 is written, not imagined.
- Step size matches the loss pattern. One-off → local. Recurring → architectural.
- Regularizers hold every iteration. Contracts, boundaries, docs.
K_MAXis real. Escalate at 5 iterations; never silently try a 6th.
Drop any one, expect divergence. See convergence.md for the formal version.
- Oscillation — fix A breaks B, fix B breaks A
- Drift — 20 reasonable commits compose into incoherence
- Noisy SGD — treating single failing run as gradient
- Moving-target loss — rubric edited to match current code
- Local-minimum trap — five 3-line patches in one function
Each has a catching skill in the bundle. See convergence.md §3.
- Symptom patches blocked by default —
root-cause-by-layerforbidstry/except/hasattr-shim / xfail / retry / "clean up later" until layer 4/5 named. - Recommendations auditable —
dialectical-reasoningforces thesis → antithesis → synthesis structure. - Docs always current —
docs-as-definition-of-doneblocks "done" until docs synced. - Cumulative drift detected before compounding —
drift-detectionscans periodically. - Iteration doesn't spiral — K_MAX = 5 + escalation shape.
- First-time user →
getting-started.md - Working a specific task →
task-types.md(the dispatch table) - Want the formal mental model →
convergence.md(four-loop practitioner view) and../theory.md(long-form) - How rigor is picked per task →
thinking-levels.md - Curious about origin →
in-awp.md