ZenLoop: a Claude Code Stop hook that won't let your agent say "done" until Kane CLI verifies the change in a real browser, and sends any failure back for it to fix.
ZenLoop puts Kane CLI inside the coding agent's own loop. When Claude Code tries to finish a task, a Stop hook works out which plain-English specs (kane/*.kane.md, kept next to the code) cover the changed files. It runs them with kane-cli in real Chrome against the running app. If Kane fails a spec, ZenLoop returns {"decision":"block"}, so Claude has to keep working. Claude gets Kane's verdict, the failed assertion with its observed value, Kane's own root-cause triage and suggested fix, a screenshot of the failing step, and console and network errors from the evidence pack. Claude fixes the code and tries to finish again, and Kane re-verifies, with no human in between. It stops after 3 attempts and never traps a session. It's for developers who let agents ship UI and want proof instead of "looks done". Install: npm i -g github:rohanjain1648/zenloop && zenloop init The demo target is MyZenn, our mental-health app, where the "Need help now" crisis button must never break. While the agent was building an unrelated MyPeace feature, Kane caught a real silent failure that was already in the code: Begin Session did nothing when microphone access was denied. The hook blocked, and the agent fixed two real bugs. Kane then confirmed the fix locally and on the live deploy. In two other real agent runs, the agent read the specs and kept crisis help working, and Kane confirmed both green.
How the agent and Kane talk: - The Claude Code Stop hook runs `zenloop gate`, which runs `kane-cli run "<spec>" --agent --headless` and parses Kane's NDJSON (run_end, step events, and the per-assertion verdicts in context.memory). - It opens Kane's .evidence pack to read Kane's root cause, category and suggested fix, the failing screenshot, console errors and failed requests. - On a failure it replies {"decision":"block","reason":…} to Claude Code. On a pass it adds "✓ Kane verified N specs". Keeping the loop honest: - It's change-aware: unchanged code costs no credits, and only specs whose watch globs match the changed files run, plus any spec that failed last time. - Kane tool errors and timeouts are retried and never blamed on the agent. A concrete violation is always a failure. - If the agent edits a spec while it's failing, ZenLoop flags it. If Kane's triage blames the test, the agent is told to escalate to the human, not edit the spec. - At most 3 attempts, then it hands back to the human with a report. What Kane caught: - A real silent failure in MyPeace, which the agent fixed. The fix was verified on production. - A regression that hid the crisis button during a breathing session: assertion failed, observed false. The hook blocked and the loop closed in 2 attempts. - An agent that, while adding a mood check-in, chose a non-modal dialog because a Radix modal would make the crisis button unclickable. Kane confirmed it green. Run it: npm i -g @testmuai/kane-cli && kane-cli login --oauth npm i -g github:rohanjain1648/zenloop cd your-app && zenloop init --url http://localhost:3000 --dev "npm run dev" zenloop doctor && zenloop run --all && zenloop report --open Also in the box: - `zenloop add security` adds a 5-spec pack: keys in network requests, secrets in storage, env leaks, insecure cookies, hidden 5xx and console errors. - `zenloop run --url <deploy>` verifies previews and production. - kaneMode "testmd" is about 2.3x cheaper: 8–11 credits instead of 23–27, and it still caught the regression. - An HTML loop report with Kane screenshots, and a GitHub Action (experimental). - 24 unit tests, MIT license. What's next: - Kane record and replay caching. - Stop hooks for Cursor, Codex and Gemini CLI. - `zenloop suggest`, to draft specs from a diff.
Built in two weeks for the KaneCLI Online Hackathon.
See the hackathon →