watch-loop
Skill2 starsChanged 2 months agoMITView on GitHub
Run one fresh idempotent watch tick against a task, queue, deployment, PR, issue tracker, inbox, or other changing source. Use when a loop should poll safely, save cursor state, stay quiet when nothing changed, and stop at a clear success or retry limit.
In this repository19 other files it gives its agents.
- access-checkSkill
- babysit-prsSkill
- browser-proofSkill
- bugfixSkill
- bug-reproSkill
- cleanupSkill
- contextSkill
- dev-flowSkill
- docs-managerSkill
- hot-reloadSkill
- jira-managerSkill
- polishSkill
- pr-managerSkill
- release-proofSkill
- status-reportSkill
- sync-projectSkill
- whatsapp-meSkill
- workflowSkill
- worktreeSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 9 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
Never re-send the same event just because the loop ran again.
- Distinctive: line 51
Use stable event keys when the source provides them.
- Distinctive: line 53
If a mutation is authorized, it must be safe to retry or must record an explicit completion marker before another attempt.
- Distinctive: line 55
Never infer progress from a stale local note when the remote source can be checked directly.
- Distinctive: line 62
Keep a consecutive failure counter in the cursor store.
- Very specific: line 63
When the counter reaches retry_cap, stop returning retryable and return blocked with the exact reason.
- Distinctive: line 65
Do not hide repeated failure behind silence.
- Distinctive: line 70
When nothing meaningful changed:
- Distinctive: line 76
Do not send raw logs, stack traces, or repeated "still working" messages.
- Distinctive: line 92
check a queue or inbox for a matching event
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Watch Loop
This skill runs one tick, not a daemon. That keeps each run fresh, resumable,
and easy to reason about. Scheduling belongs to /loop, /schedule, cron,
launchd, systemd, or another external scheduler.
Contract
- One invocation performs one fresh check.
- The tick must be idempotent.
- The tick must save enough cursor state to avoid re-reporting old events.
- The quiet path is success: if nothing relevant changed, emit no noisy summary.
- Mutation is off by default. A watch tick may mutate only if the current task explicitly authorizes that exact action. Polling is cheap; accidental writes are not.
Required Inputs
The caller must define:
subject: what is being watchedcursor_store: where last-seen state livesauthority: read-only, or the exact allowed mutationstop_condition: what ends the loopretry_cap: how many consecutive retryable failures are allowedreport_route: where a meaningful update should go
Tick Workflow
- Load the saved cursor. If none exists, create an empty baseline.
- Discover current state from the source of truth, not from cached chat memory.
- Compare current state with the cursor.
- Classify the result:
quiet: nothing actionable changedupdate: something changed and should be reporteddone: the stop condition is satisfiedblocked: progress requires a human or unavailable dependencyretryable: a transient error occurred and the loop may try again later
- Save the new cursor only after the current tick is fully understood. This avoids losing an event because a half-failed run moved the pointer.
- Emit a compact update only for
update,done,blocked, orretryable.
Idempotence Rules
- Never re-send the same event just because the loop ran again.
- Use stable event keys when the source provides them. Otherwise store a conservative tuple such as state plus updated-at plus target identity.
- If a mutation is authorized, it must be safe to retry or must record an explicit completion marker before another attempt.
- Never infer progress from a stale local note when the remote source can be checked directly.
Retry Rules
- Retry only transient failures: timeout, rate limit, temporary auth cache, or known flaky upstream response.
- Keep a consecutive failure counter in the cursor store.
- When the counter reaches
retry_cap, stop returningretryableand returnblockedwith the exact reason. - Do not hide repeated failure behind silence. If the loop keeps failing, that is the update.
Quiet Path
When nothing meaningful changed:
WATCH LOOP | subject=<name> | state=quietDo not send raw logs, stack traces, or repeated "still working" messages. The point is signal, not chatter.
Update Contract
WATCH LOOP | subject=<name> | state=<update|done|blocked|retryable>
CURSOR | before=<summary> | after=<summary>
PROOF | check=<command-or-api> | result=<short-result>
NEXT | action=<next-step-or-none>Good Uses
- poll a PR until checks finish
- watch a deployment until the expected revision is live
- check a queue or inbox for a matching event
- babysit a long-running agent until it needs a decision
- monitor a ticket, review thread, or approval gate
Bad Uses
- long-lived background loops embedded inside one prompt
- mutation without explicit authority
- progress spam every tick
- raw log forwarding as the primary output
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

