Shining a light into a dark software factory: AI loop engineering
There is a lot of noise in AI trends which can seem abstract or theoretical to those not following every day, so I’ll try not to add to that but instead show a public example of a living, breathing open source project and how it is using terms like “loop engineering”, “dark factories” and “agent graphs” to get things done today.
The evidence is public and live in our GitHub issues - you can follow along here: https://github.com/sunholo-data/ailang/issues/399
Work in progress
This has slowly developed as we’ve experimented with different workflows and is still a work in progress, but that’s the first point to make: these flows will always be a work in progress - it’s the self-modification and self-improvement and self-healing aspect of the process that is distinctly AI vs non-AI.
The main driver is dubbed the outer mission loop that scans a task list, decides which one to do, plans it out in sequence: this then executes the inner sprint loop that plans and executes then evaluates.
But within both of these loops includes the directives to modify its own instructions. If for example the task picker is picking the wrong tasks or the planner didn’t help, the AI can recognise this and change the text of the files that will direct the next iteration.
Anthropic Fable is the current main designer and whom I interact with when administrating the mission loop. The sprint loop is what has developed over time and encoded in the skills (design doc, sprint planner, sprint executor etc) in the last 6 months, and is now trusted and stable - it was this trust that prompted me to start handing over its coordination.
The sprint loop is the “dark factory” - I trust it enough that I don’t need to inspect its details - I now trust it enough that the outer mission loop is where I monitor it. The abstraction has moved outwards the boundary where a human reviews.
We were also inspired by Lillian Weng’s article on harness engineering that came out as we were developing this outer loop.
Anatomy of a self-improving mission loop
Here is how we built an autonomous engineering loop that has run ~55 iterations in nine days, landed 25+ changes with CI green, coordinated four AI providers, and — most importantly — caught and fixed its own bugs along the way.
The shape of the thing: mission loop around sprint loop
The mission loop is an outer mission loop around an inner sprint loop, scheduled on the always-on office Mac Studio:

There are three artifact documents that serve as the loop’s entire memory, all plain text files:
- The charter — the mission’s bar (what “1.0.0” means), the work queue with status tags, the guardrails, and the model-routing policy. Mutable, but only under written rules.
- The append-only log — one entry per iteration: what shipped, evaluator score, a routing evidence row (provider, agent, model, task-class, score, corrections, cost), and a ruled-out ledger so no future iteration re-chases a dead end.
- The skills — markdown playbooks the controller follows (the gates above, plus one per inner-loop stage). The loop is allowed to edit its own skills, but only via the retro gate: max one edit per iteration, and only when two independent recorded frictions point at the same gap.
That last rule is the self-improvement engine, and it is deliberately throttled. Every incident becomes a written rule; no rule gets written on a single anecdote.
Model routing: the biggest lesson
We designed a routing table early: a top-tier model coordinates and judges, a mid-tier model plans and executes, cheap models do mechanical work. We found this was best defined in the architecture with the rule: routing must live in deterministic code, not prompts.
This also enshrines our entropy philosophy, where we move as many decisions up-front into the design doc stage, so it is not paid for in expensive downstream bugs or code complexity - see the “Give me the freedom of a tight brief” post for more details:
AI: Give me the freedom of a tight brief
Every iteration’s log records the models that ran, so a regression is visible rather than silent.
Lilian Weng’s framing of harness engineering describes this exactly: improvements that live only as prompt-level aspiration haven’t been internalized into the harness.