From agent-atelier
Background monitor lifecycle — spawn continuous monitors, poll for events, stop monitors, or check health. Use when starting the orchestration loop, polling for state changes, cleaning up on exit, diagnosing monitor health, or tracking CI runs. Triggers on 'spawn monitors', 'check monitors', 'stop monitors', 'monitor status', 'spawn ci monitor', 'poll events', 'respawn', 'dead monitor', 'background processes', 'ci monitor', 'start monitors', 'kill monitors'.
npx claudepluginhub ether-moon/agent-atelier --plugin agent-atelierThis skill uses the workspace's default tool permissions.
Monitors are long-running background processes that observe orchestration state and external systems, emitting structured NDJSON events to stdout. They **never write** to `.agent-atelier/**` — all state mutations triggered by monitor events are routed through the Orchestrator to the appropriate skill (watchdog, gate, execute).
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Guides code writing, review, and refactoring with Karpathy-inspired rules to avoid overcomplication, ensure simplicity, surgical changes, and verifiable success criteria.
Share bugs, ideas, or general feedback.
Monitors are long-running background processes that observe orchestration state and external systems, emitting structured NDJSON events to stdout. They never write to .agent-atelier/** — all state mutations triggered by monitor events are routed through the Orchestrator to the appropriate skill (watchdog, gate, execute).
/run skill starts the orchestration loop (Phase 2: spawn monitors)/agent-atelier:init)spawn-ci: a GitHub Actions run ID or PR number must existrun_in_background for spawn, TaskOutput for check, TaskStop for stop)git rev-parse --show-toplevel)This skill performs no state writes. It only manages background process lifecycles and reads their output. The sole artifacts are background task handles (session-scoped, non-persistent).
spawnStarts the 4 always-on monitors as background processes.
git rev-parse --show-toplevel<repo-root>/plugins/agent-atelier<repo-root>/.agent-atelierBash with run_in_background=true:| Monitor | Command |
|---|---|
| heartbeat | <plugin-root>/scripts/monitors/heartbeat-watch.sh --state-dir <state-dir> --poll-interval 60 |
| gate | <plugin-root>/scripts/monitors/gate-watch.sh --state-dir <state-dir> |
| events | <plugin-root>/scripts/monitors/event-tail.sh --state-dir <state-dir> --filter state_committed |
| divergence | <plugin-root>/scripts/monitors/branch-divergence.sh --base main --interval 300 --threshold 5 |
Bash.Output:
{
"spawned": {
"heartbeat": "<task_id>",
"gate": "<task_id>",
"events": "<task_id>",
"divergence": "<task_id>"
},
"spawned_at": "<ISO-8601 UTC>"
}
Idempotency: If monitors are already running (task IDs known from a previous spawn in this session), skip re-spawning and return the existing mapping with "already_running": true.
spawn-ci --run-id <ID> | --pr <NUM>Starts a ci-status monitor for a specific GitHub Actions run or PR. This is an on-demand monitor — it exits automatically when the CI run reaches a terminal state.
Bash with run_in_background=true:
--run-id: <plugin-root>/scripts/monitors/ci-status.sh --run-id <ID>--pr: <plugin-root>/scripts/monitors/ci-status.sh --pr <NUM>Output:
{
"monitor": "ci-status",
"task_id": "<task_id>",
"target": "<run-id or pr-number>",
"spawned_at": "<ISO-8601 UTC>"
}
check <task-ids-json>Reads accumulated output from all active monitors and classifies events by urgency.
<task-ids-json> — a JSON object mapping monitor names to task IDs:
{"heartbeat": "t1", "gate": "t2", "events": "t3", "divergence": "t4", "ci-status": "t5"}
TaskOutput with block=false to get current output without waiting.reference/event-classification.md for the full classification table and orchestrator response protocol.TaskOutput returns an error or the task has exited with a non-zero code (for always-on monitors), flag it.Output:
{
"checked_at": "<ISO-8601 UTC>",
"immediate": [
{"event": "heartbeat_warning", "severity": "expired", "work_item_id": "WI-014", "source": "heartbeat"}
],
"warning": [],
"info": [],
"dead_monitors": ["gate"],
"healthy_monitors": ["heartbeat", "events", "divergence"]
}
stop [all | <name>]Stops one or all monitors.
all: iterate all known task IDs and call TaskStop for each.<name>: call TaskStop for the specified monitor's task ID.{"stopped": [...], "stopped_at": "<ISO-8601 UTC>"}.Arguments:
all — stop all monitors (used during DONE cleanup)<name> — one of: heartbeat, gate, events, divergence, ci-statusstatusReports current health of all monitors.
task_id, alive boolean, and exit_code if dead.Start all monitors at loop begin:
/agent-atelier:monitors spawn
Poll for events during orchestration (pass the task IDs from spawn):
/agent-atelier:monitors check {"heartbeat":"bg_1","gate":"bg_2","events":"bg_3","divergence":"bg_4"}
Track a CI run for a PR:
/agent-atelier:monitors spawn-ci --pr 42
Stop everything at loop end:
/agent-atelier:monitors stop all
Diagnose a monitor that may have died:
/agent-atelier:monitors status
| Code | Meaning |
|---|---|
0 | Success |
1 | Usage error (missing arguments, invalid subcommand) |
4 | Runtime failure (unable to spawn, TaskOutput error) |
check accepts task IDs as a JSON object argument.spawn-ci requires either --run-id or --pr (mutually exclusive).stop accepts all or a monitor name.spawn skips already-running monitors (same session).stop on an already-stopped monitor returns "changed": false.check is inherently idempotent (read-only).| Condition | Exit Code | Action |
|---|---|---|
| Monitor script not found at expected path | 4 | Report missing path, suggest plugin integrity check |
gh not available (for spawn-ci) | 2 | Report dependency missing |
jq not available (for spawn heartbeat) | 4 | Report dependency missing |
| TaskOutput returns error | 0 | Flag monitor as dead in check report |
| All monitors dead on check | 0 | Return report with all in dead_monitors — orchestrator decides action |
.agent-atelier/**ci_status (success) → evaluate fast-track, then transition to IMPLEMENT or REVIEW_SYNTHESIScheck is created by the /run skill, not by this skill