paseo-loop

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Loop Skill

Loop Skill

You are setting up an autonomous loop. An agent runs repeatedly until an exit condition is met.
User's arguments: $ARGUMENTS

你正在设置一个自主循环。Agent会重复运行,直至满足退出条件。
用户参数: $ARGUMENTS

Prerequisites

前置要求

Load the Paseo skill first — it contains the CLI reference for all agent commands.
请先加载Paseo skill——它包含所有Agent命令的CLI参考文档。

What Is a Loop

什么是Loop

A loop runs an agent repeatedly until it's done. There are two modes:
循环会让Agent重复运行,直至任务完成。它有两种模式:

Self-terminating (no verifier)

自终止模式(无验证器)

A single worker agent runs each iteration. It returns
{ done: boolean, reason: string }
via structured output. The loop exits when
done
is true.
每次迭代由一个worker agent运行。它会通过结构化输出返回
{ done: boolean, reason: string }
。当
done
为true时,循环终止。

Worker + Verifier

Worker+验证器模式

A worker agent runs each iteration (detached, no structured output). After the worker finishes, a separate verifier agent evaluates the verification prompt and returns
{ done: boolean, reason: string }
. The loop exits when
done
is true.
每次迭代由一个worker agent运行(独立执行,无结构化输出)。worker完成后,会由一个独立的verifier agent评估验证提示词,并返回
{ done: boolean, reason: string }
。当
done
为true时,循环终止。

Feedback between iterations

迭代间的反馈

In both modes, the
reason
from the previous iteration is fed back to the next worker as
<previous-iteration-result>
. This gives the worker context about what happened last time.
在两种模式下,上一次迭代的
reason
会以
<previous-iteration-result>
的形式反馈给下一个worker。这能让worker了解上一次迭代的情况。

Live Steering

实时调控

Each loop run persists state in:
text
~/.paseo/loops/<loop-id>/
  worker-prompt.md     # worker prompt (live-editable)
  verifier-prompt.md   # verifier prompt (live-editable, only when verifier is used)
  last_reason.md       # latest iteration result
  history.log          # per-iteration records
Edits to prompt files are picked up on the next iteration without restarting the loop.
每次循环运行的状态会持久化存储在以下路径:
text
~/.paseo/loops/<loop-id>/
  worker-prompt.md     # worker提示词(可实时编辑)
  verifier-prompt.md   # 验证器提示词(仅在使用验证器时可实时编辑)
  last_reason.md       # 最新迭代结果
  history.log          # 每次迭代的记录
无需重启循环,对提示文件的修改会在下次迭代时生效。

Parsing Arguments

解析参数

Parse
$ARGUMENTS
to determine:
  1. Worker prompt — what the worker does each iteration
  2. Verifier prompt (optional) — what the verifier checks after each worker iteration
  3. Worker — which agent does the work (default: Codex)
  4. Verifier — which agent verifies (default: Claude sonnet)
  5. Sleep (optional) — delay between iterations
  6. Name — a short name for tracking
  7. Max iterations — safety cap (default: unlimited)
  8. Archive — whether to archive agents after each iteration
  9. Worktree — whether to run in an isolated git worktree
解析
$ARGUMENTS
以确定以下内容:
  1. Worker提示词 —— worker每次迭代需要执行的操作
  2. 验证器提示词(可选) —— 每次worker迭代后,验证器需要检查的内容
  3. Worker —— 执行任务的Agent(默认:Codex)
  4. Verifier —— 执行验证的Agent(默认:Claude sonnet)
  5. 休眠时长(可选) —— 两次迭代之间的延迟
  6. 名称 —— 用于追踪的简短名称
  7. 最大迭代次数 —— 安全上限(默认:无限制)
  8. 归档 —— 是否在每次迭代后归档Agent
  9. Worktree —— 是否在独立的git worktree中运行

Examples

示例

/loop babysit PR #42 until CI is green, check every 5 minutes
→ worker-prompt: "Check the CI status of PR #42 using `gh pr checks 42`. Report done when ALL checks
  have passed (no pending, no failures). If any checks are still running or have failed, report not
  done and list which checks are pending or failing."
  No verifier (self-terminating: the worker inspects CI and reports done when green)
  sleep: 5m
  archive: yes
  name: babysit-pr-42

/loop implement the auth refactor from the plan in /tmp/plan.md
→ worker-prompt-file: /tmp/plan.md
  verifier-prompt: "Verify every step of the plan was implemented. Check file changes, types, and
  run `npm run typecheck` and `npm test`. Report each criterion individually with evidence."
  name: auth-refactor
  worktree: auth-refactor

/loop run the test suite until it passes
→ worker-prompt: "Run `npm test`. If any tests fail, read the failure output, investigate the root
  cause in the source code, and fix it. Report done when `npm test` exits with code 0 and all
  tests pass. Report not done if any test still fails, and explain which tests failed and why."
  No verifier (self-terminating: worker reports done when tests pass)
  name: fix-tests

/loop watch error rates after deploy, check every 10 minutes
→ worker-prompt: "Check the error rate for the canary deployment by running `./scripts/check-canary.sh`.
  Report done when the error rate has been below 0.1% for at least 2 consecutive checks. Report not
  done with the current error rate and trend."
  No verifier (self-terminating: worker reports done when error rate is stable)
  sleep: 10m
  max-iterations: 30
  archive: yes
  name: canary-watch
/loop 持续监控PR #42直到CI变绿,每5分钟检查一次
→ worker-prompt: "使用`gh pr checks 42`检查PR #42的CI状态。当所有检查通过(无 pending、无失败)时报告任务完成。如果仍有检查在运行或失败,报告任务未完成并列出对应的检查项。"
  无验证器(自终止模式:worker自行检查CI状态,变绿时报告完成)
  sleep: 5m
  archive: yes
  name: babysit-pr-42

/loop 根据/tmp/plan.md中的方案实现认证重构
→ worker-prompt-file: /tmp/plan.md
  verifier-prompt: "验证方案中的每一步都已实现。检查文件变更、类型定义,运行`npm run typecheck`和`npm test`。逐个报告每个验证标准并提供证据。"
  name: auth-refactor
  worktree: auth-refactor

/loop 运行测试套件直到全部通过
→ worker-prompt: "运行`npm test`。如果有测试失败,读取失败输出,在源码中排查根本原因并修复。当`npm test`返回码为0且所有测试通过时报告完成。如果仍有测试失败,报告任务未完成并说明失败的测试项及原因。"
  无验证器(自终止模式:worker在测试通过时报告完成)
  name: fix-tests

/loop 部署后监控错误率,每10分钟检查一次
→ worker-prompt: "运行`./scripts/check-canary.sh`检查金丝雀部署的错误率。当错误率连续两次检查都低于0.1%时报告完成。如果未达标,报告当前错误率及趋势。"
  无验证器(自终止模式:worker在错误率稳定达标时报告完成)
  sleep: 10m
  max-iterations: 30
  archive: yes
  name: canary-watch

Using the Script

使用脚本

The loop is implemented as a bash script at
~/.claude/skills/paseo-loop/bin/loop.sh
.
bash
undefined
循环功能由
~/.claude/skills/paseo-loop/bin/loop.sh
这个bash脚本实现。
bash
undefined

Self-terminating: worker checks PR CI and reports done when all checks pass

自终止模式:worker检查PR的CI状态,全部通过时报告完成

~/.claude/skills/paseo-loop/bin/loop.sh
--worker-prompt "Check CI status of PR #42 using gh pr checks 42. Report done when ALL checks pass. Report not done with a list of pending/failing checks."
--name "babysit-pr"
--sleep 5m
--archive
~/.claude/skills/paseo-loop/bin/loop.sh
--worker-prompt "使用gh pr checks 42检查PR #42的CI状态。所有检查通过时报告完成。若有pending或失败的检查,报告未完成并列出对应项。"
--name "babysit-pr"
--sleep 5m
--archive

Worker + verifier: worker implements, verifier independently checks

Worker+验证器模式:worker负责实现,验证器独立检查

~/.claude/skills/paseo-loop/bin/loop.sh
--worker-prompt "Implement the auth refactor: ..."
--verifier-prompt "Verify the auth refactor is complete. Run npm run typecheck and npm test. Check that all file changes match the plan. Report each criterion with evidence."
--name "auth-refactor"
--worktree "auth-refactor"
undefined
~/.claude/skills/paseo-loop/bin/loop.sh
--worker-prompt "实现认证重构:..."
--verifier-prompt "验证认证重构已完成。运行npm run typecheck和npm test。检查所有文件变更是否符合方案要求。逐个报告每个验证标准并提供证据。"
--name "auth-refactor"
--worktree "auth-refactor"
undefined

Arguments

参数说明

FlagRequiredDefaultDescription
--worker-prompt
Yes*Prompt given to the worker each iteration
--worker-prompt-file
Yes*Read the worker prompt from a file
--worker
No
codex
Worker agent (
provider/model
, e.g.
codex/gpt-5.4
,
claude/sonnet
)
--verifier-prompt
No*Verification prompt for a separate verifier agent
--verifier-prompt-file
No*Read the verifier prompt from a file
--verifier
No
claude/sonnet
Verifier agent (
provider/model
)
--name
YesName prefix for agents
--sleep
NoDelay between iterations (e.g.
30s
,
5m
,
1h
)
--max-iterations
NounlimitedSafety cap on iterations
--archive
NooffArchive agents after each iteration
--worktree
NoWorktree name. Created on first use, reused after.
--thinking
No
medium
Thinking level for worker
* Provide exactly one of
--worker-prompt
or
--worker-prompt-file
. Provide at most one of
--verifier-prompt
or
--verifier-prompt-file
.
参数标识是否必填默认值说明
--worker-prompt
是*每次迭代给worker的提示词
--worker-prompt-file
是*从文件中读取worker提示词
--worker
codex
Worker agent(格式为
provider/model
,例如
codex/gpt-5.4
,
claude/sonnet
--verifier-prompt
否*给独立验证器agent的提示词
--verifier-prompt-file
否*从文件中读取验证器提示词
--verifier
claude/sonnet
验证器agent(格式为
provider/model
--name
Agent的名称前缀
--sleep
两次迭代之间的延迟(例如
30s
,
5m
,
1h
--max-iterations
unlimited迭代次数的安全上限
--archive
off每次迭代后是否归档Agent
--worktree
Worktree名称。首次使用时创建,后续复用。
--thinking
medium
Worker的思考深度
* 必须提供
--worker-prompt
--worker-prompt-file
其中之一。最多提供
--verifier-prompt
--verifier-prompt-file
其中之一。

Behavior by parameters

按参数区分的行为

ParametersModeUse case
--worker-prompt
only
Self-terminating workerWorker does work and decides when done
--worker-prompt
+
--verifier-prompt
Worker + verifierWorker implements, verifier independently checks
--worker-prompt
+
--sleep
Polling with self-terminationPeriodic check until a condition is met
--worker-prompt
+
--verifier-prompt
+
--sleep
Periodic work + verifierPeriodic work with independent verification
参数组合模式使用场景
--worker-prompt
自终止workerWorker执行任务并自行判断完成时机
--worker-prompt
+
--verifier-prompt
Worker+验证器Worker负责实现,验证器独立检查
--worker-prompt
+
--sleep
带自终止的轮询模式定期检查直到满足条件
--worker-prompt
+
--verifier-prompt
+
--sleep
定期执行+验证模式定期执行任务并进行独立验证

Agent Naming

Agent命名规则

Without verifier: agents are named
{name}-{N}
:
babysit-1     # First iteration
babysit-2     # Second iteration
With verifier: workers are
{name}-{N}
, verifiers are
{name}-verify-{N}
:
feat-1          # First worker
feat-verify-1   # First verifier
feat-2          # Second worker (with previous result context)
feat-verify-2   # Second verifier
无验证器时:Agent命名为
{name}-{N}
:
babysit-1     # 第一次迭代
babysit-2     # 第二次迭代
有验证器时:Worker命名为
{name}-{N}
,验证器命名为
{name}-verify-{N}
:
feat-1          # 第一个worker
feat-verify-1   # 第一个验证器
feat-2          # 第二个worker(带上一次迭代结果的上下文)
feat-verify-2   # 第二个验证器

Worktree Support

Worktree支持

When
--worktree
is passed, all agents run in the same git worktree. The worktree is created on first launch and reused for all subsequent agents.
bash
~/.claude/skills/paseo-loop/bin/loop.sh \
  --worker-prompt "Implement the feature..." \
  --verifier-prompt "Verify the feature works and typecheck passes" \
  --name "feature-x" \
  --worktree "feature-x"
当传入
--worktree
参数时,所有Agent都会在同一个git worktree中运行。Worktree会在首次使用时创建,后续迭代复用。
bash
~/.claude/skills/paseo-loop/bin/loop.sh \
  --worker-prompt "实现该功能..." \
  --verifier-prompt "验证功能可用且typecheck通过" \
  --name "feature-x" \
  --worktree "feature-x"

Your Job

你的任务

  1. Understand the task from the conversation context and
    $ARGUMENTS
  2. Decide the mode — does this need a separate verifier, or can the worker self-terminate?
  3. Write the worker prompt — what the worker does each iteration. Must be self-contained (the agent has zero prior context).
  4. Write the verifier prompt (if needed) — what the verifier checks. Should be factual and verifiable.
  5. Choose sleep — if the task is polling/monitoring, add a sleep duration
  6. Choose archive — use
    --archive
    for long-running or polling loops to keep the agent list clean
  7. Choose agents — default:
    codex
    worker +
    claude/sonnet
    verifier
  8. Choose a name — short, descriptive
  9. Run the script — call
    loop.sh
    with all the arguments
  1. 理解任务:从对话上下文和
    $ARGUMENTS
    中明确需求
  2. 确定模式:判断是否需要独立验证器,还是使用worker自终止模式
  3. 编写worker提示词:定义worker每次迭代的操作。必须自包含(Agent无前置上下文)
  4. 编写验证器提示词(如需要):定义验证器的检查内容。需基于事实、可验证
  5. 选择休眠时长:如果是轮询/监控任务,添加延迟时长
  6. 选择归档设置:对于长期运行或轮询的循环,使用
    --archive
    保持Agent列表整洁
  7. 选择Agent:默认使用
    codex
    作为worker,
    claude/sonnet
    作为验证器
  8. 选择名称:简短、有描述性
  9. 运行脚本:调用
    loop.sh
    并传入所有参数

When to use a verifier vs self-terminating

何时使用验证器 vs 自终止模式

Use a verifier (
--verifier-prompt
) when:
  • The worker's job is to implement something and you want independent verification
  • You want the verification done by a different agent than the worker
  • The worker should focus on doing work, not on judging its own work
Use self-terminating (no verifier) when:
  • The worker is checking/polling an external condition (CI status, deployment health)
  • The worker can objectively determine when it's done (tests pass, file exists)
  • You want a single agent doing both the work and the evaluation
当以下情况时使用验证器(
--verifier-prompt
):
  • Worker的任务是实现功能,你需要独立验证
  • 你希望由与worker不同的Agent执行验证
  • Worker应专注于执行任务,而非自我评估
当以下情况时使用自终止模式(无验证器):
  • Worker需要检查/轮询外部条件(CI状态、部署健康度)
  • Worker可以客观判断任务完成时机(测试通过、文件存在)
  • 你希望单个Agent同时执行任务和评估

Writing a Good Worker Prompt

编写优质Worker提示词

The worker prompt is what the agent receives each iteration. It must be:
  1. Self-contained — The agent starts with zero context. Everything needed is in the prompt.
  2. Specific — Name files, functions, types, URLs. Be concrete.
  3. Action-oriented — Tell the agent what to do, not what to think about.
Worker提示词是Agent每次迭代收到的指令,必须满足:
  1. 自包含:Agent无前置上下文,所有必要信息都需包含在提示词中
  2. 具体:指定文件、函数、类型、URL。内容要具体
  3. 动作导向:告诉Agent要做什么,而非思考什么

Writing a Good Verifier Prompt

编写优质验证器提示词

The verifier prompt defines what the verifier checks after each worker iteration. It can range from strict factual checks to qualitative code review:
Factual / objective checks:
  • "Run
    npm test
    and
    npm run typecheck
    . Report done only if both pass with zero failures."
  • "Check that PR #42 has all CI checks green and no unresolved review comments."
  • "Verify the API responds to
    GET /health
    with status 200 within 500ms."
Code quality / style checks:
  • "Review the changes for DRY violations. Report done when there is no duplicated logic across files."
  • "Check that the implementation does not over-engineer. No unnecessary abstractions, no premature generalization, no feature flags for single-use code."
  • "Verify the code follows the project's conventions: functional style, no classes, explicit types, no
    any
    ."
Performance / resource checks:
  • "Run the benchmark suite. Report done when p99 latency is under 100ms."
  • "Check bundle size. Report done when the production build is under 500KB gzipped."
Comprehensive verification:
  • "Verify every step of the plan was implemented. Check file changes, types, test output. Run
    npm run typecheck
    and
    npm test
    . Report each criterion individually with evidence."
The verifier should report facts with evidence, not suggest fixes.
验证器提示词定义了每次worker迭代后验证器的检查内容,范围可以从严格的事实检查到定性的代码审查:
事实/客观检查:
  • "运行
    npm test
    npm run typecheck
    。仅当两者都无失败时报告完成。"
  • "检查PR #42的所有CI检查是否通过,且无未解决的评审意见。"
  • "验证API对
    GET /health
    的响应状态为200,且响应时间在500ms内。"
代码质量/风格检查:
  • "审查变更是否存在DRY原则违反。当文件间无重复逻辑时报告完成。"
  • "检查实现是否过度设计。无不必要的抽象、无过早的通用化、无仅单次使用的功能开关。"
  • "验证代码符合项目规范:函数式风格、无类、显式类型、无
    any
    。"
性能/资源检查:
  • "运行基准测试套件。当p99延迟低于100ms时报告完成。"
  • "检查包体积。当生产构建的gzip压缩后体积小于500KB时报告完成。"
全面验证:
  • "验证方案中的每一步都已实现。检查文件变更、类型定义、测试输出。运行
    npm run typecheck
    npm test
    。逐个报告每个验证标准并提供证据。"
验证器应基于事实提供证据,而非建议修复方案。

Skill Stacking

技能叠加

You can instruct the worker to use other skills:
bash
~/.claude/skills/paseo-loop/bin/loop.sh \
  --worker-prompt "Use /committee to plan, then fix the provider list bug. The bug is..." \
  --verifier-prompt "The provider list renders correctly and npm run typecheck passes" \
  --name "provider-fix"
你可以指示worker使用其他技能:
bash
~/.claude/skills/paseo-loop/bin/loop.sh \
  --worker-prompt "使用/committee进行规划,然后修复供应商列表的bug。bug详情为..." \
  --verifier-prompt "供应商列表渲染正常且npm run typecheck通过" \
  --name "provider-fix"

Composing with Handoff

与Handoff组合使用

A handoff can launch a loop:
/handoff a loop in a worktree to babysit PR #42
可以通过Handoff启动循环:
/handoff 在worktree中启动循环持续监控PR #42