Build Until Green
An agent loop that runs your build and tests, fixes the first real error, and repeats until everything passes or it hits the iteration cap.
Copy the Build Until Green loop
Stops when the build, type check, and test commands all exit with code 0, or after 10 iterations. Edit the settings block, then paste the whole prompt into your agent.
You are running the "Build Until Green" loop. Settings (edit before running): - Build command: npm run build - Type check command: npm run typecheck - Test command: npm test - Max iterations: 10 Goal: get every command above to exit with code 0. Each iteration: 1. Run the commands in order. Stop at the first one that fails and read its full output. 2. Find the earliest error in that output. Treat later errors as possible side effects of it. 3. Make the smallest code change that fixes the root cause of that one error. 4. Re-run the commands. Write one line: iteration number, failing command, error count before and after. Stop when: - All three commands exit 0. Success. - You reach the max iteration count. - The same error survives two consecutive attempts. Explain what you tried and what you suspect. Rules: - Do not delete, skip, or weaken tests, and do not add ts-ignore, eslint-disable, or "any" to silence errors. - Do not change build configuration, lockfiles, or CI files unless the error is in them, and say so if you do. - Never run destructive git commands (reset --hard, push --force, clean -fd). Leave changes uncommitted for review. Final report: list each file you changed with a one-sentence reason, and anything left failing.
When this loop fits
- A branch stopped compiling after a merge, a rebase, or a large dependency bump.
- You changed a shared type or function signature and now dozens of call sites are broken.
- You want a clean build before opening a pull request and would rather not fix errors one at a time yourself.
What happens on each pass
The agent repeats these steps until the stop condition holds or it runs out of iterations.
- Run the checks. Run the build, type check, and test commands in that order and capture the full output of the first one that fails.
- Pick one root cause. Read the earliest error, not the last one. Later errors are often knock-on effects of the first.
- Make the smallest fix. Change only the code needed to clear that error, without touching tests to make them pass or silencing the compiler.
- Re-run and log. Run the checks again, note the error count before and after, and continue with the next failure.
- Stop and report. Stop when every command exits 0, when the cap is reached, or when the same error survives two attempts, then summarize the changes.
MCP servers for this loop
The 6 strongest of 857 matching servers, ranked by how closely they fit and then by trust score.
- 75Trust score 75 of 100, Good
seekstone
by shaqmughal · TypeScript
Filesystem-direct Obsidian MCP server — search and edit your vault with low context-tax.
RegistryLicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 12 days ago. - 69Trust score 69 of 100, Good
Standalone MCP filesystem tools server — view, edit, shell, workdir.
RegistryLicenseQualityMaintenanceLicense: A. Apache-2.0 is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 10 days ago. - 66Trust score 66 of 100, Good
Money, FX, capital-market and metadata-only China macro evidence with source clocks and limits.
RegistryRemoteLicenseQualityMaintenanceLicense: C. AGPL-3.0 is a strong copyleft license: derived works must use the same license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: B. Last commit or release 7 days ago. Down one letter for 32 open issues against 1 stars. - 65Trust score 65 of 100, Good
cldsh-Cloudinary-Shell
by sheldon1999 · JavaScript
Unix-style shell, scriptable CLI and MCP server for Cloudinary asset management.
RegistryLicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 12 days ago. - 64Trust score 64 of 100, Good
Terminal Tax
by maxdhs · CSS
Tax software: your AI agent sends the facts, we calculate and e-file; you review and sign.
RegistryRemoteLicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 4 days ago. - 63Trust score 63 of 100, Good
Agentic Terminal Directory
by observer-protocol · TypeScript
Verified merchants accepting agentic payments on Lightning/L402/BOLT12/USDT — search, verify, pay.
RegistryRemoteLicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: C. 65/100 for listing completeness. Lost points: no listed tools, short summary.Maintenance: B. Last commit or release 36 days ago.
How to run this loop
- Connect the tools. Install a server the loop can use, for example seekstone, or rely on your agent's built-in terminal and file access.
- Edit the settings block. Replace the example commands, targets, and limits with your project's own. Keep the iteration cap low on the first run.
- Paste it into an agent session. Start a fresh session in Claude Code, Cursor, or VS Code agent mode, in the repository root, and paste the prompt.
- Review before you merge. Read the final report and the diff. The loop leaves its work for you to review rather than shipping it.
Build Until Green questions
When does the Build Until Green loop stop?
It stops as soon as the build, type check, and test commands all exit with code 0. It also stops after 10 iterations by default, or earlier when the prompt's own stop rules say it is stuck, and then reports what changed and what is left. Change the cap in the settings block at the top of the prompt.
Why does the loop fix the earliest error instead of all of them at once?
Compilers and test runners cascade: one broken import can produce fifty errors further down. Fixing the first error and re-running often clears many others for free, and each change stays small enough to review.
What happens if the agent gets stuck on one error?
The prompt tells it to stop when the same error survives two attempts. That prevents the agent from thrashing, editing unrelated files, or reaching for suppressions. You get a short explanation of what it tried, which is usually enough to finish the fix yourself.