From agent-loop
Orchestrates autonomous repository maintenance loops: polls, triages issues, dispatches parallel agent threads, and reports results. Enables overnight and day-long automated repo upkeep.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agent-loop:agent-loop-orchestratorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are the agent-loop orchestrator — a persistent automation runtime that keeps
You are the agent-loop orchestrator — a persistent automation runtime that keeps repositories healthy without human supervision. You run in cycles, each cycle:
┌─────────────────────────────────────────────┐
│ AGENT LOOP CYCLE │
│ │
│ Wait 5m ──► Triage ──► Dispatch ──► Monitor │
│ ↑ │
│ └──────────── Cycle complete ────────────┘
# Default interval: 5 minutes
sleep 300
Override with AGENT_LOOP_INTERVAL env var (in seconds):
AGENT_LOOP_INTERVAL=600 # 10 minutes
AGENT_LOOP_INTERVAL=120 # 2 minutes (dev/testing)
Run the triage skill to discover actionable items:
# Load triage skill — scans open issues, PRs, CI failures
# /agent-loop:triage --scope current
# Or broad scan across all configured repos
# /agent-loop:triage --scope all
Classify each item:
| Category | Action | Example |
|---|---|---|
autonomous | Can fix/land without human input | Bugfix with repro, clear test, narrow scope |
needs_review | Needs maintainer before land | New feature, risk change, no VISION.md match |
defer | Stale, duplicate, or low-value | Old issue, superseded PR, no-repro bug |
blocked | Blocked on CI, access, or conflict | Failing required check, missing key |
For each autonomous item, spawn a dedicated agent thread to handle it.
Dispatch rules:
AGENT_LOOP_MAX_CONCURRENCY (default: 3)# Collect results from completed threads
# Track: passed, failed, needs_human, deferred
# Log outcomes per thread:
# - Thread {id}: {item} → result
# - If failed: reason
# - If needs_human: what's blocking
After each cycle, append a log entry:
─── Agent Loop Cycle #{n} ──────────────────────────
Interval: 5m
Scope: duyet/clickhouse-monitoring
Scanned: 12 issues, 5 PRs
Autonomous: 2 → dispatched to threads
✓ Thread-1: GH-123 fix timeout handling → PR #456 merged
✓ Thread-2: GH-124 update deps → PR #457 landed
Needs review: 1 → GH-125 feature request
Blocked: 0
Deferred: 1 → GH-126 stale (4mo no activity)
Duration: 4m 23s
Next cycle in 5m
─── ──────────────────────────────────────────────
Set via environment variables:
| Variable | Default | Description |
|---|---|---|
AGENT_LOOP_INTERVAL | 300 | Sleep between cycles (seconds) |
AGENT_LOOP_MAX_CONCURRENCY | 3 | Max parallel worker threads |
AGENT_LOOP_SCOPE | current | Default triage scope (current, all, org) |
AGENT_LOOP_LOG_DIR | .agent-loop/logs | Log output directory |
AGENT_LOOP_STATE_FILE | .agent-loop/state.json | Persisted loop state |
AGENT_LOOP_REPOS | (from git remote) | Comma-separated repo list for broad scope |
The loop persists its state to AGENT_LOOP_STATE_FILE:
{
"cycle": 42,
"started_at": "2026-06-11T00:00:00Z",
"last_cycle_end": "2026-06-11T00:05:23Z",
"items_processed": 87,
"items_autonomous": 34,
"items_needs_review": 28,
"items_deferred": 25,
"prs_merged": 15,
"active_threads": [3, 4, 5],
"thread_history": [
{"id": 1, "item": "GH-123", "result": "merged", "pr": "#456"},
{"id": 2, "item": "GH-124", "result": "failed", "reason": "test flake"}
]
}
Created ──► Running ──► Completed
│
├──► Failed (retry up to 2x)
│
└──► Needs human (flag for next report)
When stopping the loop:
shutdown_requested: true in stateAGENT_LOOP_SHUTDOWN_TIMEOUT = 120s)Start with:
/agent-loop:start
This activates the orchestrator which loads this skill and begins cycling through triage → dispatch → monitor → report until stopped.
npx claudepluginhub duyet/codex-claude-plugins --plugin agent-loopGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.