Recurring prompt scheduler for ACP agents. Inspired by Claude Code's /loop command.
Run prompts on a recurring interval:
# Run every 5 minutes
acp-loop --interval 5m "check if deploy succeeded"
# Cron-style scheduling
acp-loop --cron "*/10 * * * *" "summarize new issues"
# Use acpx's configured/default agent
acp-loop --interval 1h "review open PRs"
# Use an acpx short alias / configured agent name
acp-loop --interval 1h -a claude "review open PRs"
# Pass a raw ACP agent command through to acpx --agent
acp-loop --interval 5m --agent "npx -y @zed-industries/claude-agent-acp" "say hello to me"
# Auto-approve permission requests for unattended runs
acp-loop --interval 5m -a claude --approve-all "check latest Twitter mentions"- Monitoring - Periodic health checks
- Polling - Watch for changes (new issues, PR updates)
- Scheduled tasks - Daily summaries, weekly reports
- Long-running workflows - Check progress, auto-retry failed tasks
--interval <duration>: Run on a fixed interval such as30s,5m, or1h--cron <expression>: Run on a cron schedule instead of a fixed interval-a, --agent-name <name>: Use anacpxshort alias or configured agent name such asclaudeorcodex--agent <command>: Pass a raw ACP agent command straight through toacpx --agent--auth-policy <policy>: Pass through toacpx --auth-policy--approve-all: Pass through toacpx --approve-all--approve-reads: Pass through toacpx --approve-reads--deny-all: Pass through toacpx --deny-all--non-interactive-permissions <policy>: Pass through toacpx --non-interactive-permissions--max <n>: Stop afterniterations--timeout <duration>: Stop after a total elapsed duration--until <string>: Stop when output contains a matching string--quiet: Suppress loop progress logs and stream only agent output
Agent selection rules:
- Omit both
--agentand-ato useacpx execwith its configured default agent - Use
-a claudefor the normal short-alias path - Use
--agent "npx -y @zed-industries/claude-agent-acp"when you need to pass a full custom command - Use
--approve-allor--approve-readsfor unattended loops that would otherwise stop on permission prompts --agentand-aare mutually exclusive--approve-all,--approve-reads, and--deny-allare mutually exclusive
- New session per loop iteration? Or reuse session?
- Claude Code's /loop runs within a session
- acp-loop is a standalone CLI
- Log to file?
- Send to inbox?
- Conditional execution (only run if previous check found something)?
# Run until condition met
acp-loop --until "deploy succeeded" --interval 1m "check deploy status"
# Max iterations
acp-loop --max 10 --interval 5m "check status"
# Timeout
acp-loop --timeout 1h --interval 5m "monitor build"acp-loop
├── scheduler (cron/interval)
├── executor (calls acpx)
└── logger
acpx loop --interval 5m "prompt"
// Minimal loop runner
async function loop(options: {
interval: number; // ms
prompt: string;
agent?: string; // forwarded to acpx --agent
agentName?: string; // maps to acpx short alias / configured name
maxIterations?: number;
until?: string; // stop condition
}) {
let iteration = 0;
while (true) {
iteration++;
// Run prompt via acpx
const result = await exec(`acpx ${options.agent} exec "${options.prompt}"`);
// Check stop conditions
if (options.maxIterations && iteration >= options.maxIterations) break;
if (options.until && result.includes(options.until)) break;
// Wait for next interval
await sleep(options.interval);
}
}- Claude Code /loop:
Added /loop command to run a prompt or slash command on a recurring interval (e.g. /loop 5m check the deploy)
If acp-loop stalls at [client] initialize (running), check your acpx config:
acpx config showacp-loop --agent <value> now maps directly to acpx --agent <value> exec .... For acpx short aliases such as claude or codex, use --agent-name <name>. If you want the default/configured acpx agent, omit both flags. If your acpx config overrides claude to the raw claude CLI command, ACP initialization will hang. Either:
# Fix the acpx config override
acpx config show
# Or bypass the override with an explicit ACP adapter command
acp-loop --interval 5m --agent "npx -y @zed-industries/claude-agent-acp" "say hello to me"If a loop exits after a permission request, pass the same permission flags you would give acpx directly:
acp-loop --interval 5m -a claude --approve-all "check latest Twitter mentions"
acp-loop --interval 5m -a claude --approve-reads "summarize new issues"- Define CLI interface
- Implement interval scheduler
- Implement cron scheduler
- Add stop conditions
- Logging and output handling