acp-loop: Recurring Prompt Scheduler
Schedule AI agent prompts to run at intervals or cron schedules.
When to Use This Skill
Use this skill when the user:
- - Wants to run a prompt repeatedly at fixed intervals
- Needs cron-style scheduling for agent tasks
- Wants to automate recurring AI workflows
- Asks about scheduling, looping, or periodic execution of prompts
Installation
CODEBLOCK0
Quick Start
Interval Mode
Run prompts at fixed intervals:
CODEBLOCK1
Cron Mode
Run prompts on cron schedules:
CODEBLOCK2
Options Reference
| Option | Description | Example |
|---|
| INLINECODE0 | Fixed interval (30s, 5m, 1h) | INLINECODE1 |
| INLINECODE2 |
Cron expression |
--cron "0 9 * * *" |
|
--agent <name> | Agent to use (default: codex) |
--agent claude |
|
--max <n> | Max iterations |
--max 10 |
|
--timeout <duration> | Max total runtime |
--timeout 2h |
|
--until <string> | Stop when output contains |
--until "DONE" |
|
--quiet | Minimal output |
--quiet |
Common Patterns
Conditional Stop
CODEBLOCK3
Limited Runs
CODEBLOCK4
Time-Boxed Execution
CODEBLOCK5
Daily Scheduled Task
CODEBLOCK6
Using Different Agents
CODEBLOCK7
Important Notes
- 1. Mutually exclusive: Use either
--interval OR --cron, not both - Cron library: Uses
croner (handles laptop sleep/wake better than node-cron) - Stop: Press Ctrl+C to stop the loop
- Agent support: Works with any ACP-compatible agent (codex, claude, gemini-cli)
Why acp-loop?
- - Claude Code's built-in
/loop command has bugs - Works with any ACP-compatible agent, not just Claude
- Proper cron expression support
- Better handling of laptop sleep/wake cycles
Resources
- - GitHub: https://github.com/femto/acp-loop
- npm: https://www.npmjs.com/package/acp-loop
acp-loop: 循环提示调度器
按时间间隔或cron计划调度AI代理提示。
何时使用此技能
当用户出现以下情况时使用此技能:
- - 希望按固定时间间隔重复运行提示
- 需要为代理任务设置cron式调度
- 希望自动化循环执行的AI工作流
- 询问关于调度、循环或周期性执行提示的问题
安装
bash
npm install -g acp-loop
快速入门
间隔模式
按固定时间间隔运行提示:
bash
每5分钟
acp-loop --interval 5m 检查日志中的错误
每30秒,10次迭代后停止
acp-loop --interval 30s --max 10 快速健康检查
每小时,8小时后超时
acp-loop --interval 1h --timeout 8h 每小时报告
Cron模式
按cron计划运行提示:
bash
每天凌晨3点
acp-loop --cron 0 3
* 夜间清理
每周一上午9点
acp-loop --cron 0 9
1 每周站会总结
每5分钟(cron风格)
acp-loop --cron
/5 * 监控状态
选项参考
| 选项 | 描述 | 示例 |
|---|
| --interval <持续时间> | 固定间隔(30s、5m、1h) | --interval 5m |
| --cron <表达式> |
Cron表达式 | --cron 0 9
* |
| --agent <名称> | 使用的代理(默认:codex) | --agent claude |
| --max
| 最大迭代次数 | --max 10 |
| --timeout <持续时间> | 最大总运行时间 | --timeout 2h |
| --until <字符串> | 输出包含时停止 | --until DONE |
| --quiet | 最小化输出 | --quiet |
常见模式
条件停止
bash
运行直到任务报告完成
acp-loop --interval 1m --until 所有测试通过 运行测试套件
限制运行次数
bash
精确运行5次
acp-loop --interval 10s --max 5 检查部署状态
限时执行
bash
最多运行1小时
acp-loop --interval 5m --timeout 1h 监控构建
每日定时任务
bash
每天午夜执行
acp-loop --cron 0 0 * 生成每日报告
使用不同代理
bash
使用Claude替代Codex
acp-loop --interval 10m --agent claude 审查代码变更
使用Gemini CLI
acp-loop --interval 5m --agent gemini-cli 检查状态
重要说明
- 1. 互斥使用:使用 --interval 或 --cron,不能同时使用
- Cron库:使用 croner(比node-cron更好地处理笔记本睡眠/唤醒)
- 停止:按Ctrl+C停止循环
- 代理支持:适用于任何ACP兼容代理(codex、claude、gemini-cli)
为什么选择acp-loop?
- - Claude Code内置的 /loop 命令存在bug
- 适用于任何ACP兼容代理,不仅限于Claude
- 完善的cron表达式支持
- 更好地处理笔记本睡眠/唤醒周期
资源
- - GitHub:https://github.com/femto/acp-loop
- npm:https://www.npmjs.com/package/acp-loop