Today's software is generated once and frozen. Tomorrow's software improves itself.
Point it at any API or codebase. It builds an agent-native CLI, grades it against reality, and refactors until the grade stops climbing β then tells you what it learned.
The "I'm going to the beach" workflow: give it a target and a goal, walk away, and come back to a measurably better tool plus a report on how it got there β every iteration recorded, every regression rolled back, every unsafe change blocked.
π― 10+ things you can put in a loop β loop-anything-hub
Point the loop at a domain and it turns "generate once, hope it's good" into
"improve until an independent referee says it's good." The
loop-anything-hub is a
live catalog of these loops, auto-published from demos/ on every push β each card
headlines the loop outcome (grade trajectory + convergence + report), which a
plain CLI gallery can't.
Not aspiration β recorded runs, graded by the independent CLI-Judge referee and
refined by a free-tier LLM (no Anthropic quota), recorded via demo record (the
only path to a live_verified card):
| Loop | What it automated | Outcome | Proof |
|---|---|---|---|
| automate-your-job | a team-lead's daily standup digest, graded against a captured day of real activity | F β A |
PROOF |
| factcli | a CLI brought up to the agent-native (non-interactive) contract | F β A |
PROOF |
| one-person-industrial-engine | a 2-slice product fleet (API β dependent digest), both slices converged in dependency order with the upstream outcome routed downstream | F β A Γ2 |
PROOF |
| Domain | What "improving itself" looks like |
|---|---|
| π PR lifecycle | a loop that drives a PR green β tests, review comments, conflicts β until it merges |
| βοΈ Legal | clause/contract tooling refined against a rubric of real redlines |
| π§ͺ Clinical trials | eligibility/protocol tooling graded against real trial criteria |
| 𧬠Biotech | assay/pipeline CLIs improved against captured lab data |
| π Quant | a strategy/backtest tool refined against held-out market data |
| πΌ VC | deal-screening tooling graded against a real diligence rubric |
| ποΈ Software architecture | architecture-review CLIs climbing a quality rubric |
| π Education | tutoring/grading tools refined against answer keys + rubrics |
| β‘ Smart grid | load/forecast tooling graded against real telemetry |
| π¦ Supply chain | routing/inventory CLIs improved against real logistics data |
β Your application here. Each row is a loop waiting to be built. Add one in a single PR β see
CONTRIBUTING-demos.md. Domains beyond the engine's current reach ship as loop recipes (the map, not fake demos); starter cards are badgedillustrativeuntil a live run is recorded.
loop-anything demo list # registered demos + recipes
loop-anything showcase --out showcase.html # the self-contained gallery
# Turn a real catalog CLI into a verified before/after proof (refine-only):
loop-anything demo proof <id> --catalog cli-anything --name <entry> \
--sha <full-40-char-commit-sha> --install-kind pip_git_subdir --dry-runProofs validate the refine loop, not the generate frontier.
demo proofadopts an already-generated catalog CLI as the baseline ("before"), runs the loop (judge β/ce-workβ re-judge β/ce-compound), and records alive_verifiedcard with the before/after grade, the per-dimension diff, iterations, and the regression tests it compounded.
Building agent-native tooling today is a one-shot act: generate a CLI, eyeball it, stop. Nothing closes the gap between "it exists" and "it's actually good."
- π Compounding, not one-shot β each iteration makes the tool measurably better, and the fix is captured as a regression test so a solved problem never comes back.
- π Grounded in reality, not vibes β quality comes from an independent referee grading the tool against real captured payloads, never from the model admiring its own code.
- π‘οΈ Degradation-proof β a multi-signal convergence policy (plateau + regression rollback + budget) stops the recursive "flying turd" effect where agents slowly make things worse.
- π΄ Autonomous by design β kick it off, go to sleep, read the research report in the morning.
- π Safety is a hard gate β an unsafe tool can never ship, no matter how high it otherwise scores.
It treats the generated tool as a Heuristic System β code, rules, detectors, tests β and runs an agentic "nutrition pipeline" that evolves it continuously. Fast code-based heuristics execute (System 1); the slow LLM agent reflects and refines (System 2).
flowchart LR
T([π― target + goal]) --> R{route}
R -->|service / API| F1[CLI-Printing-Press]
R -->|codebase| F2[CLI-Anything]
F1 --> TOOL[(agent-native CLI)]
F2 --> TOOL
TOOL --> J[CLI-Judge\nreport.json]
J -->|grade < A & safe & budget left| W[/ce-work refactor/]
W --> TOOL
J -->|grade A| WIN([β
converged])
J -->|safety fail| STOP([π blocked, never ships])
W -.accepted fix.-> C[/ce-compound\nlearning + regression test/]
loop-engineering-anything is not another CLI generator. It is the controller, memory, and
convergence policy that wire four existing tools into a closed feedback loop:
| Stage | Tool | Role in the loop |
|---|---|---|
| ποΈ route + generate | CLI-Printing-Press Β· CLI-Anything | build the agent-native CLI (service lane / codebase lane) |
| βοΈ judge | CLI-Judge | grade it against reality β 5 dimensions, AβF, report.json |
| π§ refactor | /ce-work |
fix the lowest-scoring dimensions |
| π compound | /ce-compound |
record the learning + a regression test |
These are installable dependencies, wrapped behind adapters β never forked. The orchestrator stays thin; the upstreams evolve on their own.
| Today's pain point | What loop-engineering-anything does |
|---|---|
| πͺ¦ Generated CLIs are frozen the moment they're built | Keeps refactoring until the grade converges |
| π€· "Looks fine to me" is the only quality bar | Grades against real payloads via an independent referee |
| π Agents recursively degrade what they touch | Plateau detection + regression rollback + hard budget |
| πΈ Overnight runs balloon in cost | Iteration/token budget enforced by the convergence policy |
| β οΈ Unsafe code slips through on a high score | Safety failure is a terminal state β capped, blocked, never shipped |
| π§ The same bug gets re-fixed forever | Every accepted fix is compounded into a regression test |
|
Hand it a URL, HAR capture, or OpenAPI spec. It routes to the service lane and keeps improving the CLI against real responses. |
Hand it a local repo. It routes to the codebase lane and grinds the generated CLI up the grade scale. |
One command, unattended. Wake up to a converged tool, a full grade trajectory, and a research report. |
Every accepted fix is compounded into a learning the next run reuses. Those learnings
used to live only in a machine-local database (loopeng.db, gitignored) β training notes
locked in one gym. Now the corpus is a versioned artifact: export it as diff-able
JSONL, commit it, review it in a PR, import it on any machine β the learning-reuse
flywheel keeps compounding across laptops and teammates.
loop-anything learnings export --redact -o learnings/corpus.jsonl # commit this file
loop-anything learnings import learnings/corpus.jsonl # idempotent merge--redact strips target-specific tokens (URLs, paths, long ids) so a shared corpus
carries the transferable lesson, not your target's internals. Imports flow through the
same sanitize-on-write path as recorded learnings (MemoryStore.record_learning), so a
hostile line in a corpus file can't forge prompt structure β and re-importing the same
file inserts nothing.
| π Multi-signal convergence | Stops at the first of: target grade reached, plateau (no gain over N), iteration/token budget, or a safety block. No single "until Grade A" naΓ―vetΓ©. |
| πͺ Reflective refinement | Each refactor brief carries why the last attempt scored what it did β the referee's dimension-level feedback, which failures keep resisting, and whether the prior edit was kept or rolled back β so the refiner aims instead of re-guessing blind (the GEPA "actionable side information" idea, borrowed additively; judge-sourced only, so makerβ checker holds). |
| β»οΈ Learning-reuse flywheel | Lessons compounded on past runs of a target are retrieved and fed into future runs' briefs (ranked by the grade gain they produced), so accumulated usage makes each run start less blind β and per-target trend queries make the compounding measurable (does it converge faster as history grows?). Reused lessons feed the refiner only, never the referee (makerβ checker), and are sanitized on the way into storage. |
| π‘ Spec-synthesis loop | The same loop runs one stage up: hand it a vague idea and a deterministic rubric spec-grader scores the draft spec (completeness, testability, cross-reference consistency, scope, grounding) while the spec-refiner improves it β idea β spec β grade β refine β so spec quality compounds with usage too. The grader reads only the spec (makerβ checker), and the stage reuses the same controller, learning-reuse, and ablation-proof machinery. The live ideaβspec / spec-refiner hookup is wired (and the reuse-vs-blind ablation proof harness with it); the real graded runs open with quota. |
| π‘οΈ Unbypassable safety gate | A safety-failing verdict is a terminal BLOCKED_SAFETY state β the change is rolled back and the tool can never ship. |
| β©οΈ Regression rollback | A refactor that doesn't raise the grade is reverted to the prior git checkpoint; the better verdict is kept. |
| π Compound-on-accept | /ce-compound fires only on a kept improvement β never on a transient gain that's later rolled back. |
| ποΈ Local-first memory | Every run/iteration/grade/learning lands in SQLite, enabling cross-run queries (trend, plateau, recurring failures). |
| π Protocol-driven core | The controller depends only on Judge/Refiner/Compounder/Checkpoint protocols β so loop dynamics are proven against recorded verdicts, no live tool required. |
The popular "agent loop" anatomy (state β reason β act β observe β reflect β terminate) describes one agent improving its own answer. This is an outer loop that improves a generated tool and is opinionated about three things on purpose β they are design choices, not missing features:
- Outer-loop sovereignty β we referee the refiner's output, never its inner tokens. The inner agent loop is a swappable vendor; we are the meta-loop it plugs into.
- Single referee of record β quality comes only from the independent CLI-Judge verdict, never from the maker's self-report. That single authority is the makerβ checker moat.
- Gated human confirm β a converged result is a claim until a human confirms; the gate is on by default and its verdict is recorded for audit but never auto-ships.
Full rationale, with the failure mode each choice accepts: docs/solutions/outer-loop-non-gaps.md.
A single loop improves one target. A fleet coordinates many self-improving loops toward one goal β the orchestration layer above the loop:
- Dependency-ordered β items run in topological waves over the worktree fan-out; a cycle fails closed before any work starts.
- Feedback-routed β when an item converges, its outcome is routed into its dependents' briefs automatically (no human forwarding).
- Human-efficient β only high-judgment forks (a safety block, a gated result, a stuck worker) reach a human; everything else proceeds. You can re-brief a single worker without re-running the fleet.
loop-anything fleet run fleet.json --goal "ship the feature across these targets"
loop-anything fleet run fleet.json --dry-run # materialize only, don't execute
loop-anything fleet status <fleet_id>
loop-anything fleet report <fleet_id>
loop-anything fleet escalations <fleet_id>Each fleet item carries its own target (and optional goal/lane); fleet run
executes the DAG by default β generating, judging, and refining each item inside
its own git worktree, with the referee held immutable to the maker per item.
--dry-run keeps the old materialize-only behavior.
This is a loop engine coordinating our own loops β not an issueβPRβCI Agent
IDE. Boundary + rationale:
docs/solutions/fleet-orchestration-boundary.md.
flowchart TD
User([user / agent]) -->|"/loop-anything <target> --goal"| Skill[loop-anything skill / CLI]
Skill --> Runner[autonomous runner]
Runner --> Router{target router}
Router --> PP[Printing-Press adapter]
Router --> CA[CLI-Anything adapter]
PP --> Tool[(generated CLI)]
CA --> Tool
Tool --> Ctrl[loop controller]
Ctrl --> Judge[judge adapter β CLI-Judge]
Judge -->|verdict| Ctrl
Ctrl -->|refactor brief| Work[/ce-work/]
Work --> Tool
Ctrl -->|accepted fix| Compound[/ce-compound/]
Ctrl <--> Mem[(SQLite memory)]
Runner --> Report[research report]
loop-engineering-anything/
βββ src/loopeng/
β βββ cli.py # loop-anything entrypoint (run / preflight / status / report / demo proof)
β βββ config.py # budgets, convergence knobs, dependency table
β βββ preflight.py # per-mechanism dependency detection (+ refine-only gate)
β βββ adopt.py # catalog tool adopter β venv-isolated, env-pruned, full-SHA pin
β βββ proof.py # ProofPack builder + store-backed compounder
β βββ router.py # target β lane classification
β βββ adapters/
β β βββ base.py # Verdict / GenerateResult + Judge/Refiner/Compounder/Checkpoint protocols
β β βββ safety.py # shell=False exec, metachar rejection, workspace jail
β β βββ printing_press.py # service lane factory shell
β β βββ cli_anything.py # codebase lane factory shell
β β βββ judge.py # CLI-Judge wrapper + strict report.json parsing
β βββ memory/ # SQLite store + trend/plateau/recurring queries
β βββ loop/ # controller state machine, convergence, brief, compound, GitCheckpoint
β βββ autonomous/ # research report + autonomous runner
βββ skills/loop-anything/ # the /loop-anything agent skill
βββ tests/ # 286 tests β loop dynamics validated against recorded verdicts
βββ docs/plans/ # the implementation plan
git clone https://github.com/wjlgatech/loop-engineering-anything
cd loop-engineering-anything
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
loop-anything preflight # check the four dependencies
pytest -q # 286 passingPreflight tells you exactly what's wired:
[MISSING] CLI-Printing-Press (service/API lane) -- not on PATH (looked for: printing-press, cli-printing-press)
[MISSING] CLI-Anything (codebase lane) -- not on PATH (looked for: cli-anything, cli-hub)
[MISSING] CLI-Judge (referee) -- not on PATH (looked for: cli-judge)
[ok ] compound-engineering plugin (/ce-work, /ce-compound) -- plugin found
Drive a target (auto-routes by lane; gates on preflight; generates β judges β refines to Grade A):
loop-anything run https://api.example.com --goal "make this agent-native and keep improving it"
loop-anything run ./my-repo --goal "raise correctness and safety to Grade A"
loop-anything run ./my-repo --refiner chain # claude, then free-tier LLM on infra failure (default)
loop-anything run ./my-repo --judge-adapter path/to/adapter.py # override adapter auto-discovery
loop-anything status # recorded runs
loop-anything report <run_id> --json # the research reportThe CLI-Judge adapter is auto-located from the generated tool (override with
--judge-adapter); an adapter inside the tool itself is refused so the referee
stays immutable to the maker. A converged run is marked shippable only after a
human confirms it (--confirm); --scheduled --confirm is rejected so an
unattended run can't pre-confirm itself.
CLI-Judge's safety gate caps a tool's grade at C on any safety failure. The loop treats this
as a terminal BLOCKED_SAFETY state: the offending change is rolled back, the run halts, and
the tool is never shipped (R3) β regardless of how high it scored elsewhere. Autonomous runs
apply code only inside a workspace boundary, read credentials from the environment (never logged),
and checkpoint every iteration so any regression reverts cleanly.
Built from an 8-unit plan (docs/plans/). Loop dynamics are already validated against recorded
verdicts β so the hardest part (does the loop converge without degrading?) is proven before any
live run.
- U1 β Scaffold,
loop-anythingCLI,/loop-anythingskill, dependency preflight - U2 β SQLite memory layer (trend / plateau / recurring-failure queries)
- U3 β Target router (service vs. codebase lane)
- U6 β Loop controller core: state machine, convergence policy, safety hard-gate, regression rollback
- U4 β Factory adapter shells (Printing-Press / CLI-Anything)
- U5 β Judge adapter shell (strict
report.jsonsafety derivation) - U8 β Autonomous runner shell (preflight + credential + workspace guards)
- U7 β History Compression Engine (grade-neutral-or-better System-2 pass)
- P0 #1 mechanism β headless
/ce-work+/ce-compoundviaclaude -p - P0 #2 mechanism β grade-variance probe + noise-aware acceptance band
- Judge live-binding β
CLIJudgepinned to the realreport.json(safety_blocker,D1..D5dims,--out) and verified against an installedcli-judge - Real loop run β
LoopControllerdriven by the livecli-judgeto a correct terminal state - Factory live-binding β CLI-Anything generation is an agentic
claude -p "/cli-anything β¦"skill; CLI-Printing-Press needs a Go toolchain - Full agentic e2e β real generate (
/cli-anything) + real refine (/ce-work) on a live target
Both feasibility gates are resolved. P0 #2 is empirical: the live CLI-Judge is deterministic (variance probe spread
0.0), so grades are a safe control signal. P0 #1 is mechanical:/ce-work+/ce-compoundrun headlessly viaclaude -p. The loop has been run end-to-end against the real referee; the remaining frontier is the agentic generate/refine steps and the Go-based service lane β see the runbook.
| Tool | What it brings |
|---|---|
| CLI-Printing-Press | URL/HAR/OpenAPI β a CLI with a local SQLite mirror and domain archetypes |
| CLI-Anything | local software β an agent-native Click CLI with a SKILL.md |
| CLI-Judge | reality-grounded referee β 5 dimensions / 100 pts, hard safety gate |
| compound-engineering | the brain β /ce-work refactors, /ce-compound captures learnings |
PRs welcome. The repo enforces a simple bar: CI must be green (pytest on Python 3.11β3.13) and
behavior changes carry a CHANGELOG.md entry plus synced docs. See AGENTS.md for
architecture boundaries β chiefly wrap-don't-fork, the protocol-only controller, and the
unbypassable safety gate.
MIT β free to use, modify, and distribute.
A self-improving loop for the age of AI agents Β· grounded in reality Β· safe by construction
Built by driving CLI-Printing-Press Β· CLI-Anything Β· CLI-Judge Β· compound-engineering around a closed loop.
Thanks for visiting β¨