cavil-loop
Skill20 starsChanged 2 days agoMITView on GitHub
GitHub label-driven workflow that lets a local AI handle issues / PRs; the daemon listens for `pending/agent` and dispatches work. Every issue's design proposal / discussion / code / Claude conversation / tmux history is filed under the issue number, so you can find or resume any of it later just by knowing the issue number. Commands include setup (deploy to a project), status (check daemon state), disable (turn off a project's daemon)
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Verify the path exists and is a git repo (has .git)
- Very specific: line 29
Check deps: git, gh (must be logged in via gh auth login), tmux, jq, flock, systemctl, plus the worker CLI selected by WORKER_AGENT …
- Very specific: line 42
Only when step 1 shows unknown or you need more detail: systemctl --user list-timers 'cavil-loop-poll@*' --no-pager / systemctl --user …
- Very specific: line 80
After setup, the host project's worktree gains only two things:
≈ “Common” is an estimate: at least 1 in 5 of the 383,637 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
cavil-loop
English · 中文
Turn GitHub issue / PR comments into the input and output of your local AI. A systemd timer + a few shell scripts + two GitHub labels let you talk to the AI directly through the GitHub web UI (or the iOS gh app).
This skill is agent-agnostic by design. Worker CLI is selected by
WORKER_AGENT=<name>incavil-loop.config; the daemon / dispatch scripts go through a thin driver layer that plugs in different agent CLIs. Built-in drivers:claude(default, Claude Code),opencode(sst/opencode),codex(OpenAI Codex CLI),cursor(Cursor Agent CLI). Add your own viascripts/drivers/<name>.sh— see docs/drivers.md.
When to invoke
The user calls this skill from the host agent runtime via /cavil-loop <command> or a natural-language request. Common forms:
- "Install this daemon on project X" → run the
setupflow - "What's the state of the coding agent?" → run the
statusflow - "Disable the coding agent on project X" → run the
disableflow
What you (the agent) should do when invoked
setup (deploy to a host project)
The user gives you a host project path (e.g. ~/github/myproject). Steps:
- Verify the path exists and is a git repo (has
.git) - Check deps:
git,gh(must be logged in viagh auth login),tmux,jq,flock,systemctl, plus the worker CLI selected byWORKER_AGENT(defaultclaude; other built-ins:opencode,codex,cursor). Each must resolve viacommand -v. - Run:
bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.agents/skills/cavil-loop}/setup.sh" <host-project-path>$CLAUDE_PLUGIN_ROOTis the skill-root env Claude Code injects; if absent, fall back to the canonical~/.agents/skills/cavil-loop. setup.shprints next-step guidance when done — relay it to the user verbatim. Its "worker 令牌检查" section says whether the worker has a GitHub token (a configuredGH_TOKEN, or the accountgh auth loginsigned in on this machine); a warning there means no work will be dispatched until the line it names is added to the file it names — tell the user.
status
User wants the state. Steps:
bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.agents/skills/cavil-loop}/scripts/install-status.sh"— one JSON object (read-only): where the daemon is installed and which version,ghlogin, every connected project (new and pre-rename names alike) with its scheduler state (running/stopped/unknown—unknownmeans the read failed, never report it as stopped), last poll time and missing dependencies of the agents its config uses. Fields: docs/operations.md- Only when step 1 shows
unknownor you need more detail:systemctl --user list-timers 'cavil-loop-poll@*' --no-pager/systemctl --user list-units 'cavil-loop-poll@*.service' --no-pager(macOS:launchctl print gui/$UID/dev.luosky.cavil-loop.<key>) - For each project in step 1's
projects[]:tail -20 $STATE_DIR/poll.log(state_dirin step 1's output)gh issue list --repo $REPO --label pending/agent+gh pr list --repo $REPO --label pending/agentbash "${CLAUDE_PLUGIN_ROOT:-$HOME/.agents/skills/cavil-loop}/scripts/poll-history.sh" --state-dir $STATE_DIR— what the last poll rounds did (result, last step, dispatches, GitHub calls), rounds that did not finish, and the latest snapshot (GitHub#344; see docs/operations.md). Read-onlyjq . $STATE_DIR/config-notice.json(if present) — new optional settings this project's config lacks, so the feature is off here while new installs have it on (GitHub#289; see docs/operations.md). List each missing key with the line that turns it on
- Summarize for the user
Projects installed before the rename still run under the old names: coding-agent-poll@* timers and ~/.config/coding-agent-work-loop/*.conf. Check both sets so an old project is not reported as missing; an idle old project is migrated automatically, and ~/.local/state/cavil-loop/migrate.log says what moved or why it is waiting (see docs/operations.md).
cleanup (after a PR is accepted / rejected)
User merged a PR or wants to abort work on an issue. Steps:
- Confirm the issue is finished (PR merged or closed)
- Run:
Optional flags:bash "$CLAUDE_PLUGIN_ROOT/scripts/cleanup-issue.sh" <issue-number>--force(clean even if the worker is busy),--keep-worktree(only kill the session),--delete-branch(also drop the local branch)
What cleanup-issue.sh does:
- Busy check (refuses by default unless
--force) - Runs the project-level
CLEANUP_HOOK(configured incavil-loop.config, e.g. tear down tailscale ports, stop dev server) - Kills the worker's tmux session
- Removes the worktree (default)
- Optionally removes the local branch
disable
User wants to stop one project. Steps:
- Confirm the instance name (
.projects[].keyfrom thestatusscript) bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.agents/skills/cavil-loop}/scripts/disconnect-project.sh" <key>— stops the poller (Linux timer or macOS LaunchAgent, old names for a pre-rename install), confirms it stopped, then removes the registration; the project config and state are kept. Exit 2 (RESULT=unknown) = the scheduler state could not be read and nothing was touched; exit 3 (RESULT=failed) = it would not stop and the registration was kept — relay the output, do not delete files by hand- Report back (including that the project config and state were kept, so re-running
setup.shreconnects it)
What does NOT land in the host project
After setup, the host project's worktree gains only two things:
- One
.gitignoreline (excludingcavil-loop.config) - A
cavil-loop.config(gitignored, config)
Scripts, systemd units, state, logs all live outside the host project (skill dir + ~/.config/ + ~/.local/state/).
Full architecture
See sibling README.md.
File listing
setup.sh— bootstrap a host projectscripts/— daemon + dispatch scripts (never copied to host project)prompts/— initial worker prompt templates (override via host project's.agents/skills/cavil-loop/prompts/)systemd/—cavil-loop-poll@.service/.timertemplate units; setup copies them to~/.config/systemd/user/cavil-loop.config.example— config template
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.

