In short:
ak-looppushes a measurable number up or down: coverage, bundle size, lint error count. Each round it makes one small change, commits, re-measures, keeps the change if it is better and reverts it if not, then ends with a final report. It does not handle subjective goals: those go toak-cook.
Disclosure: I maintain AgentKit and have an affiliate relationship with it: the AgentKit link in this post is an affiliate link; buying through it gets you 30% off.
Summary
Use it when you have a command that prints exactly one number and you want that number to improve over many rounds, such as raising coverage, shrinking a bundle, clearing lint errors or cutting latency. You do not need it when the goal cannot be measured as a number, like "make the code cleaner" (use ak-cook), or for a bug whose cause you already know (use ak-fix or ak-debug). It only runs when you ask for it explicitly.
flowchart LR
A["A concrete metric"] --> B["ak-loop"]
X["A subjective goal"] --> Y["ak-cook"]
B --> C["Kept commits"]
B --> D["loop-results.tsv"]
B --> E["Final report"]
E --> F["Stop: out of rounds, stuck, or you stop it"]There are 4 things to know:
| Concept | Question | Example |
|---|---|---|
| Verify: one number | What tells you whether this round is better or worse? | A command that prints exactly 82.4 (percent of lines covered by tests), with Direction: higher |
| Scope and Guard | Which files may it change, and what must it not break? | Scope: src/utils/**/*.ts, Guard: npx tsc --noEmit && npm test |
| One round, one change | How much does it do per round? | "Add a test for the empty string in parseDate". If the description needs the word "and", split it into two rounds. |
| When it stops | How long does the loop run? | 10 rounds by default (Iterations). After 5 discarded rounds in a row it changes direction, after 10 in a row it stops and tells you. |
It commits first and measures after, and a discarded round is undone with git revert rather than deleted, so the history keeps what was tried. The files Guard checks are read-only, and a weakened test counts as a regression.
Sample prompt for raising coverage:
/ak-loop
Goal: Raise coverage of src/<module> from about 60% to 80%
Scope: src/<module>/**/*.ts, tests/<module>/**/*.test.ts
Verify: npx jest tests/<module> --coverage --coverageReporters=json-summary 2>/dev/null >/dev/null; node -e "console.log(require('./coverage/coverage-summary.json').total.lines.pct)"
Guard: npx tsc --noEmit
Iterations: 15
Direction: higherThis skill has no flags.
Below is the detailed version: the run flow, 5 situations with prompts, how to pass options when the skill has no flags, the change history by ak release, and common pitfalls. The detailed version and the interactive page are for subscribers. Your agent can also search them through the portal's MCP.
Opens when your account has subscriber access
This guide is for subscribers
Once your account has access, the full piece, the interactive visual and the agent call all open.
- Sign in or create a modernEngineer accountReading access belongs to your account email.
- Choose a plan on the pricing page1, 3 or 12 months, paid by VietQR bank transfer. Access opens about a minute after the money arrives.
- Or redeem a Facebook subscriber codePeople supporting the page on Facebook get an activation code by message each month.
Already a subscriber? Sign in to read.
Use this piece in your agent
Get an API keyCopy the text below and paste it into Claude Code, Codex or whichever agent you use. The agent reads the piece and checks it against the repo you have open.
Read "ak-loop: change and measure until the number improves" on modernEngineer and apply it to this repo.
1. Call the content_get tool of the modernengineer MCP server with locale "en", slug "ak-loop". If the modernengineer MCP server is not connected, stop and walk me through connecting it from https://modernengineer.dev/en/mcp.
2. Summarize the main steps of the piece and point out which apply to this repo.
3. Propose concrete changes and ask me before editing any file.Connect MCP in Claude Code (once)
claude mcp add --transport http modernengineer \
https://api.modernengineer.dev/mcp \
--header "Authorization: Bearer <API key>"Reading the full piece over MCP needs an API key from a subscriber account or one that bought this guide. Without access, the agent only gets the opening.
- Version
- v1.0.0
- Updated
- 22/10/2026
- Licence
- All rights reserved
- Slug
- ak-loop


