Loading...
Loading...
Monitor running agent loops, triage failures, clean up after completion, and decide when to intervene. Use when a loop is running and needs babysitting, when a loop just finished and needs post-merge verification, when stories are skipping/failing and need diagnosis, or when stale test artifacts need cleanup. Triggers on: 'check the loop', 'what happened with the loop', 'loop finished', 'clean up after loop', 'why did that story skip', 'monitor loop', 'nanny the loop', or any post-start loop management task. Distinct from agent-loop skill (which handles starting loops).
npx skill4agent add joelhooks/joelclaw loop-nannyjoelclaw loop status <LOOP_ID>joelclaw| Status | Meaning | Action |
|---|---|---|
| Story completed | None |
| Exhausted retries | Check if code landed anyway (common — see Skip Triage) |
| Implementor running | Wait |
| Reviewer running | Wait |
| Judge evaluating | Wait |
| Failed, retrying | Check attempt output for patterns |
| Loop finishing (merge-back) | Wait for merge, then verify |
| Not yet started | Normal — queued |
# 1. Read the attempt output
cat /tmp/agent-loop/<LOOP_ID>/<STORY_ID>-<ATTEMPT>.out | tail -40
# 2. Check if the files exist on main after merge
ls <project>/path/to/expected/file
# 3. Check git log for the story's commits
cd <project> && git log --oneline --grep="<STORY_ID>" -5| Pattern | Cause | Prevention |
|---|---|---|
| "Already exists" | Story duplicates work from prior story | Write more atomic stories; planner didn't know current state |
| Test assertion failure | Agent-generated tests over-specify implementation | Acceptance criteria should test behavior, not implementation |
| TypeScript compile error | Story depends on types from a skipped story | Order stories so type-providing stories run first |
| Timeout | Implementor took too long | Smaller story scope |
RETRO.COMPLETEDcd <project> && git log --oneline -5
# Should show: "Merge branch 'agent-loop/<LOOP_ID>'"cd <project> && bun test 2>&1 | tail -5__tests__/<story-id>-*.test.ts# Find agent-generated test files
ls <project>/__tests__/*-*.test.ts 2>/dev/null
# Check which fail
bun test __tests__/ 2>&1 | grep "(fail)"
# Delete ALL agent-generated acceptance tests (they served their purpose)
rm <project>/__tests__/<prefix>-*.test.ts
# Verify clean
bun test 2>&1 | tail -3cd <project> && bunx tsc --noEmitkubectl -n joelclaw rollout restart deployment/system-bus-worker
kubectl -n joelclaw rollout status deployment/system-bus-worker --timeout=180s
joelclaw refresh
joelclaw statuscd <project> && git add -A && git commit -m "chore: post-loop cleanup for <LOOP_ID>
Delete stale acceptance tests, verify N pass / 0 fail / tsc clean"joelclaw logs errorscd <project> && git merge --abortjoelclaw statuskubectl -n joelclaw rollout restart deployment/system-bus-workerjoelclaw runs --count 5joelclaw loop cancel <LOOP_ID>
# Clean up worktree manually (cancel doesn't auto-merge)
cd <project>
git worktree remove /tmp/agent-loop/<LOOP_ID> --force 2>/dev/null
git branch -D agent-loop/<LOOP_ID> 2>/dev/null
git worktree prune/tmp/agent-loop/<LOOP_ID>/<STORY_ID>-<ATTEMPT>.out# Quick scan — last 40 lines usually has the verdict
tail -40 /tmp/agent-loop/<LOOP_ID>/<STORY_ID>-<ATTEMPT>.out
# Check all attempts for a story
ls /tmp/agent-loop/<LOOP_ID>/<STORY_ID>-*.out
# Grep for errors across all attempts
grep -i "error\|fail\|reject" /tmp/agent-loop/<LOOP_ID>/*.out1. joelclaw loop status <LOOP_ID> — where are we?
2. (if story running) wait 3 min, re-check
3. (if story skipped) check attempt output — did the work land anyway?
4. (if loop completed) verify merge, run tests, delete stale tests, restart worker
5. (if stuck) joelclaw runs --count 5 + joelclaw logs errors — diagnosejoelclaw~/Code/joelhooks/joelclaw/joelclaw loop statuskubectl logsjoelclaw logsfixrespondError()# Commands are in packages/cli/src/commands/ — one file per command
# Response helpers in packages/cli/src/response.ts
# Inngest client methods in packages/cli/src/inngest.ts
# Test your change
joelclaw <command> 2>&1 | python3 -m json.tool
# Commit
git add -A && git commit -m "feat: joelclaw <command> — <what you added>"# Quick diagnosis of all loops
joelclaw loop diagnose all -c
# Diagnose + auto-fix (clears claims, re-fires plan events)
joelclaw loop diagnose all -c --fix
# Verify fix worked (~30s later)
joelclaw loop status <loop-id> -c--fix--fix--fix--fixgit add -Apackages/system-bus__tests__/