LoopFlow

Your agent needs a process,
not another prompt

LoopFlow is structured pseudocode for AI coding agents.

Write goals, context, checks, memory, human gates, and retry rules in one readable workflow file. Prompts disappear. Process files compound.

Global install
npm i -g @loop-lang/loop @loop-lang/runtime

Ask any agent for a loop

Agent drafts a .loop file
youwrite a .loop for checkout tax bug
agentDrafting fix-checkout.loop from your request.
loop "fix checkout tax bug":
  goal: checkout shows the right tax total
  done when "pnpm test checkout" passes 3 times
  look at: src/checkout/, tests/checkout/, and the last failure
  each cycle: plan, then act, then observe
  when it fails: reflect on the mismatch, then plan again
  after 6 tries: stop and warn "stuck"
agentNow review or run the file with the runner you use today.

That produces a .loop file

fix-checkout.loop
loop "fix checkout tax":
  goal: checkout shows the right tax
  done when "pnpm test checkout" passes
  look at: src/checkout/, tests/checkout/, and the last failure
  each cycle: plan, then act, then observe
  when it fails: reflect, then plan again
  after 6 tries: stop and warn "stuck"

What is a loop?

A loop is the thing you already do around an AI agent: ask it to change something, check the result, give it the failure, and repeat until the work is actually done.

planactobservereflect

LoopFlow writes that cycle down. The model does the work; your tests, scanners, curl scripts, review skills, or humans decide when it is finished.

Why LoopFlow?

The first prompt is not the problem. The problem is everything after it: checking, reviewing, copying failures back into chat, asking for one more fix, and hoping the agent actually ran the command.

A .loop file says what the agent may edit, what it must check, when it should reflect, and when it must stop.

The process has structure.

LoopFlow reads like pseudocode, but every line has a job the runner can honor.

Goals

Say what success means in plain English.

goal: checkout shows the right tax

Verification

Done is proven by tests, scanners, evals, or humans.

done when "pnpm test checkout" passes

Context

Keep the agent focused on the right files.

look at: src/checkout/, tests/checkout/

Memory

Failures feed the next plan; lessons can survive future runs.

look at: src/, and the last failure
remember in "checkout.memory.md"

Human gates

Let the agent work, but pause before risk.

ask me before migrations or pushes

Composition

Turn stories and epics into repeatable process files.

flow "bmad sprint":
  for each story in "sprint.yaml":
    run "story.loop"

Real-life examples

PR review

The PR keeps bouncing for missing tests, style issues, or a broken API contract. Put the review bar in the loop and rerun it until it passes.

loop "make PR reviewable":
  done when "pnpm test" passes
  done when the skill "code-review" approves

Feature implementation

You keep saying “run the test,” “try curl,” “check the response,” and “fix what failed.” Make those checks the workflow.

loop "prove search API":
  done when "pnpm test api/search" passes
  done when "./scripts/curl-search.sh" passes

Bug fix

The agent says “done,” but the original test is still red. Make the failing test the finish line.

loop "fix billing apostrophe":
  done when the test "billing::apostrophe" passes
  when it fails: reflect, then plan again

Risky changes

Let edits happen automatically, but pause before migrations, deploys, payment changes, or pushes.

loop "safe migration":
  allow edits automatically, but ask me before migrations
  a human approves before deploy

A loop is just a file.

Claude, Codex, Cursor, Copilot — they all get the same artifact: a plain .loop file you can review, commit, copy to the next repo, and run when ready.

Because the workflow lives in a file, it becomes versioned, shareable, and repeatable — not trapped in one chat session.

loop "fix checkout tax":
  goal: checkout shows the right tax
  done when "pnpm test checkout" passes

  look at: src/checkout/, tests/checkout/, and the last failure
  allow edits automatically, but ask me before migrations

  each cycle: plan, then act, then observe
  when it fails: reflect, then plan again
  after 6 tries: stop and warn "stuck"

And the file can say more.

A loop starts with a goal and a check, but it can also describe the judgment, gates, and workflow shape around the work.

Human gates

a human approves the plan first
a human approves before deploy
a human reviews before stopping

Evals for judgment

done when the skill "code-review" approves
  the bar: no weakened tests; clear errors

Feature pipelines

pipeline "checkout v2":
  stage "cart totals": ...
  stage "submit order": ...

Project defaults

git:
  work on a branch
  commit when the goal is met
models: fast haiku, strong opus

Not magic. Just the missing loop.

No fake done. No hidden checklist. No unbounded agent. LoopFlow is a visible control structure around the tools you already trust: tests, scanners, curl scripts, code review, and human gates.

Documentation that leads somewhere.

This page is the landing page. The full docs have the language, syntax, examples, and runner details.