Agent loop orchestrator

From duyet/codex-claude-plugins · View interactive version

Agent loop orchestrator is an AI agent skill from the GitHub repository duyet/codex-claude-plugins. Run a repeating repo maintenance cycle that triages issues and PRs, dispatches autonomous fixes to parallel subagents, and reports results. Use when started by /agent-loop:start or when asked for unattended overnight repo upkeep.

How to use this skill

Skill file

Agent loop orchestrator

Each cycle runs four steps: triage, dispatch, monitor, report. This skill runs one cycle. Repetition comes from the harness, not from you.

Scheduling

Never sleep in a shell between cycles. Use the harness's recurring-run facility (Claude Code: /loop <interval> /agent-loop:resume, or the schedule skill). Without one, run one cycle, report, and tell the user how to rerun.

Cycle

  1. Triage. Follow ../agent-loop-triage/SKILL.md for the configured scope. It returns items classified as autonomous, needs_review, defer, or blocked.
  2. Dispatch. Spawn one background subagent per autonomous item, at most max_concurrency at a time. Give each one the item, the repo, and pointers to ../agent-loop-autoreview/SKILL.md and ../agent-loop-browser/SKILL.md. Never batch two items into one worker. Workers touching the same repo must use separate branches or worktrees.
  3. Monitor. Collect each worker's result: merged, pr_opened, failed (retry at most twice), or needs_human (with what blocks it).
  4. Report. Update the state file, append a cycle summary to .agent-loop/logs/, and print it: repo, counts per class, one line per worker result, duration.

Stop early if the state file has shutdown_requested: true. Let running workers finish, write final state, and print the summary.

Configuration

Flags, then env, then defaults: AGENT_LOOP_INTERVAL (300 s), AGENT_LOOP_MAX_CONCURRENCY (3), AGENT_LOOP_SCOPE (current, all, org), AGENT_LOOP_REPOS (git remote), AGENT_LOOP_STATE_FILE (.agent-loop/state.json).

State file

This is the single definition of the state file. All agent-loop commands read and write this shape.

{
  "cycle": 42,
  "started_at": "2026-10-19T00:00:00Z",
  "last_cycle_end": "2026-10-19T03:30:23Z",
  "shutdown_requested": false,
  "items_processed": 87,
  "items_autonomous": 34,
  "items_needs_review": 28,
  "items_deferred": 25,
  "prs_merged": 15,
  "active_threads": [3, 4],
  "thread_history": [
    { "id": 1, "item": "GH-123", "result": "merged", "pr": "#456" },
    { "id": 2, "item": "GH-124", "result": "failed", "reason": "test flake" }
  ],
  "last_error": null
}

Rules:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.