coding-agent-work-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>incoding-agent.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 /coding-agent-work-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/coding-agent-work-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/coding-agent-work-loop. setup.shprints next-step guidance when done — relay it to the user verbatim.
status
User wants the state. Steps:
systemctl --user list-timers 'coding-agent-poll@*' --no-pager— timer healthsystemctl --user list-units 'coding-agent-poll@*.service' --no-pager— last execution- For each registered
~/.config/coding-agent-work-loop/*.conf:tail -20 $STATE_DIR/poll.log(readSTATE_DIRfrom the conf)gh issue list --repo $REPO --label pending/agent+gh pr list --repo $REPO --label pending/agent
- Summarize for the user
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 incoding-agent.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 (
systemctl --user list-timers 'coding-agent-poll@*') systemctl --user disable --now coding-agent-poll@<key>.timer- Optional: remove the
~/.config/systemd/user/coding-agent-poll@<key>.{service,timer}instance symlinks (leave the actual template alone) - Optional: remove
~/.config/coding-agent-work-loop/<key>.conf - Report back
What does NOT land in the host project
After setup, the host project's worktree gains only two things:
- One
.gitignoreline (excludingcoding-agent.config) - A
coding-agent.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/coding-agent-work-loop/prompts/)systemd/—[email protected]/.timertemplate units; setup copies them to~/.config/systemd/user/coding-agent.config.example— config template