See why your agent loop went round again.
A local tool for Claude Code users who script loops
LoopLens runs a Claude Code loop on your own machine under hard limits and records every pass: the prompt it sent, the model that answered, each tool call, the quota Claude Code reported, and the stop check that decided whether to go again. Afterwards you can replay the run, and re-check it with a different stop condition, without spending quota.
Not public yet. Built and tested on Windows 11 with Node 24; macOS and Linux have not been tested.
| Stop condition | Pass1 | Pass2 | Pass3 | Pass4 | Pass5 | Pass6 | Passes run |
|---|---|---|---|---|---|---|---|
As recordedoutput matches DONE$ |
Stop check not met, looping again | Stop check not met, looping again | Stop check not met, looping again | Stop check not met, looping again | Stop check not met, looping again | Stop check not met, run ended at the iteration limit | 6 |
Re-checkedoutput contains DONE |
Stop check not met, looping again | Stop check met, the loop stops here | Skipped | Skipped | Skipped | Skipped | 2 |
- Stop check not met: looping again
- Stop check met: the loop stops
- Skipped: the pass never runs
As recorded: output matches DONE$Re-checked: output contains DONE
DONE anywhere in the output would have stopped it at pass 2: four passes, 489 output tokens, US$0.0191 and 29.1 seconds sooner. No model is called.
One iteration, laid out
- Prompt sent. Your goal on the first pass, your continue prompt on every pass after it.
- Model requested and model served. You ask for haiku; the card shows claude-haiku-4-5-20251001 answered, so a quiet fallback cannot hide.
- Quota. Each usage report Claude Code sends, shown as it arrives.
- Tool calls and results. Claude Code's own Read, Edit and Bash calls, with failures in red.
- Stop check. The condition, its verdict, and what the loop did next: stop, or go round again.
What if it had stopped sooner?
A loop told to stop when the output ends in DONE keeps going when the model writes DONE. with a full stop. You only find out when the quota is gone.
Pick any recorded run and try a different stop condition, quota ceiling or cost cap. LoopLens re-checks every pass it recorded and tells you the pass it would have stopped at, and what the later passes used in tokens, estimated cost and time. No model is called.
In the example, the regex DONE$ ran all six passes. Checking for DONE anywhere shows the loop would have stopped at pass 2, four passes and just under US$0.02 sooner.
It only re-checks what was recorded. If a condition never matches, it says so rather than guessing how much longer the loop would have run.
Ceilings that stop a live loop
Set a quota ceiling and LoopLens stops the loop, including the request in flight, as soon as Claude Code reports usage at or above it. Set a cost cap and it stops after the pass that reaches it.
Every run also has an iteration limit, a time limit, a cap on the agent's own tool-use turns per pass, and a Stop button that ends the request in flight.
Cost is Claude Code's own estimate in US dollars. On a Pro or Max subscription it is not a bill.
Runs on your machine
- Where it runs
- One Node process bound to 127.0.0.1, with nothing to install beyond Node. Transcripts are plain JSONL files in a folder you choose.
- Whose login
- The Claude backend runs the
claudeCLI you already use, signed in the way it already is. No API key and no gateway. - Who it answers
- Only its own page. Requests from other websites are refused, prompts reach the CLI on standard input so text in a goal can never become a command-line option, and permission settings come only from your own environment.
- What it is not
- It is not made by or connected with Anthropic, and it is not a way around your plan's limits. You are responsible for using your subscription within Anthropic's terms.
Free early access
LoopLens is a free early access build. There's no billing set up, so there's nothing to pay and no card to enter.
Every feature is included while it's in early access:
- Claude Code and Mock backends, plus an unverified OmniRoute backend, off by default because it can send prompts to third-party relays
- Live iteration view with the stop check on every pass
- Iteration, time and inner-turn limits, and Stop
- Quota and cost ceilings that stop a live loop
- Recording and replay at 1x to 20x
- What-if checks on recorded runs, with no cap
- Two recorded runs side by side: settings, outcome and every iteration
- Export a recorded run as one HTML file, with paths, emails and keys redacted
It's still being worked on, so things may change. Feedback is welcome at [email protected].