run-with-it

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Run With It

自动执行工具

Use this skill to process ready-for-agent issues without manually selecting a runner.
Preferred upstream flow:
  1. break-req
    resolves requirements and constraints.
  2. create-git-issue
    publishes PRD + implementation slices with routing hints.
  3. run-with-it
    performs final runtime routing and executes the selected run.
使用该Skill处理标记为ready-for-agent的问题,无需手动选择运行器。
推荐上游流程:
  1. break-req
    解析需求与约束条件。
  2. create-git-issue
    发布PRD与实现切片,并附带路由提示。
  3. run-with-it
    执行最终运行时路由,并启动选中的运行任务。

OS Detection

操作系统检测

Detect the current OS before asset discovery and runner selection:
  • Windows (native PowerShell):
    $env:OS
    equals
    Windows_NT
    and no
    uname
    command. Use
    .ps1
    runners and
    $env:USERPROFILE
    for home dir.
  • macOS / Linux / Git Bash / WSL:
    uname -s
    returns
    Darwin
    ,
    Linux
    ,
    MINGW*
    ,
    MSYS*
    , or
    CYGWIN*
    . Use
    .sh
    runners and
    $HOME
    for home dir.
Adapt all shell commands in this skill to the detected runtime:
OperationPowerShell (Windows)Bash (Mac/Linux/Git Bash)
Home dir
$env:USERPROFILE
$HOME
Create dir
New-Item -ItemType Directory -Force
mkdir -p
Check command
Get-Command X -ErrorAction SilentlyContinue
command -v X
Check dir
Test-Path
[ -d ... ]
Temp file
[System.IO.Path]::GetTempFileName()
mktemp -t name.XXXXXX
Copy file
Copy-Item -Force
cp -f
Make executable(not needed)
chmod +x
在资源发现和运行器选择前,先检测当前操作系统:
  • Windows(原生PowerShell)
    $env:OS
    等于
    Windows_NT
    且无
    uname
    命令。使用
    .ps1
    运行器,主目录使用
    $env:USERPROFILE
  • macOS / Linux / Git Bash / WSL
    uname -s
    返回
    Darwin
    Linux
    MINGW*
    MSYS*
    CYGWIN*
    。使用
    .sh
    运行器,主目录使用
    $HOME
根据检测到的运行环境适配本Skill中的所有Shell命令:
操作PowerShell(Windows)Bash(Mac/Linux/Git Bash)
主目录
$env:USERPROFILE
$HOME
创建目录
New-Item -ItemType Directory -Force
mkdir -p
检查命令
Get-Command X -ErrorAction SilentlyContinue
command -v X
检查目录
Test-Path
[ -d ... ]
临时文件
[System.IO.Path]::GetTempFileName()
mktemp -t name.XXXXXX
复制文件
Copy-Item -Force
cp -f
设置可执行权限(无需操作)
chmod +x

Goal

目标

Resolve required assets, score complexity deterministically, choose required capability, select installed agent/model targets from registry, emit parseable routing and status reports, coordinate one or more agents when work can safely run in parallel, and execute
run-agent.sh
.
解析所需资源,确定性评估复杂度,选择所需能力,从注册表中挑选已安装的Agent/模型目标,生成可解析的路由与状态报告,在任务可安全并行执行时协调一个或多个Agent,并执行
run-agent.sh

Inputs

输入参数

Collect these values before execution:
  • Task summary
  • Optional pre-fetched issue context (otherwise fetch with
    gh
    )
  • Optional asset root override:
    ASSETS_DEST
  • Optional registry override:
    AGENT_REGISTRY_FILE
  • Optional intake overrides:
    • ISSUE_LABEL
      (default
      ready-for-agent
      )
    • ISSUE_LIMIT
      (default
      10
      )
    • ISSUE_STATE
      (default
      open
      )
    • COMMITS_LIMIT
      (default
      5
      )
    • MAX_ITERATIONS
      (default
      20
      )
  • Optional routing overrides:
    • AGENT
    • MODEL
    • COMPLEXITY_LEVEL
    • COMPLEXITY_SCORE
  • Optional routing filters:
    • AGENT_ALLOWLIST
      (comma-separated)
    • AGENT_DENYLIST
      (comma-separated)
  • Optional fallback bound:
    • MAX_AGENT_FALLBACKS
      (default
      2
      )
  • Optional multi-agent bound:
    • MAX_PARALLEL_AGENTS
      (default
      3
      )
    • ALLOW_PARALLEL_AGENTS
      (default
      true
      )
执行前需收集以下值:
  • 任务摘要
  • 可选的预获取问题上下文(否则使用
    gh
    获取)
  • 可选的资源根目录覆盖:
    ASSETS_DEST
  • 可选的注册表覆盖:
    AGENT_REGISTRY_FILE
  • 可选的问题获取覆盖项:
    • ISSUE_LABEL
      (默认值
      ready-for-agent
    • ISSUE_LIMIT
      (默认值
      10
    • ISSUE_STATE
      (默认值
      open
    • COMMITS_LIMIT
      (默认值
      5
    • MAX_ITERATIONS
      (默认值
      20
  • 可选的路由覆盖项:
    • AGENT
    • MODEL
    • COMPLEXITY_LEVEL
    • COMPLEXITY_SCORE
  • 可选的路由过滤器:
    • AGENT_ALLOWLIST
      (逗号分隔)
    • AGENT_DENYLIST
      (逗号分隔)
  • 可选的回退限制:
    • MAX_AGENT_FALLBACKS
      (默认值
      2
  • 可选的多Agent限制:
    • MAX_PARALLEL_AGENTS
      (默认值
      3
    • ALLOW_PARALLEL_AGENTS
      (默认值
      true

Asset Discovery (Required)

资源发现(必填)

Resolve assets in this order:
  1. $ASSETS_DEST
    if set and complete.
  2. $HOME/.ai-skill-collections/assets
    .
  3. ./assets
    .
Required files:
  • prompt.md
  • run-agent.sh
  • agent-registry.json
Selection rules:
  • Use first path that contains all required files.
  • If none are complete, stop and report missing files.
  • Do not require git to resolve assets.
  • Resolved asset root is the single source for that run.
按以下顺序解析资源:
  1. $ASSETS_DEST
    已设置且资源完整,则使用该路径。
  2. $HOME/.ai-skill-collections/assets
  3. ./assets
必填文件:
  • prompt.md
  • run-agent.sh
  • agent-registry.json
选择规则:
  • 使用首个包含所有必填文件的路径。
  • 若没有完整的资源路径,则停止并报告缺失文件。
  • 无需依赖Git来解析资源。
  • 解析后的资源根目录为本次运行的唯一资源来源。

Fresh/No-Git Project Notes

全新/无Git项目注意事项

  • This skill must work in folders that are not initialized with git.
  • Asset discovery is filesystem-based, not git-root-based.
  • If assets are missing, report the platform-appropriate one-command fix:
PowerShell (Windows):
powershell
New-Item -ItemType Directory -Force "$env:USERPROFILE\.ai-skill-collections\assets"; Copy-Item -Force .\assets\prompt.md, .\assets\run-agent.ps1, .\assets\run-agent.sh, .\assets\agent-registry.json "$env:USERPROFILE\.ai-skill-collections\assets\"
Bash (macOS / Linux / Git Bash):
bash
mkdir -p "$HOME/.ai-skill-collections/assets" && cp -f ./assets/prompt.md ./assets/run-agent.sh ./assets/agent-registry.json "$HOME/.ai-skill-collections/assets/" && chmod +x "$HOME/.ai-skill-collections/assets/run-agent.sh"
  • 本Skill必须能在未初始化Git的文件夹中正常工作。
  • 资源发现基于文件系统,而非Git根目录。
  • 若资源缺失,报告适配当前平台的一键修复命令:
PowerShell(Windows):
powershell
New-Item -ItemType Directory -Force "$env:USERPROFILE\.ai-skill-collections\assets"; Copy-Item -Force .\assets\prompt.md, .\assets\run-agent.ps1, .\assets\run-agent.sh, .\assets\agent-registry.json "$env:USERPROFILE\.ai-skill-collections\assets\"
Bash(macOS / Linux / Git Bash):
bash
mkdir -p "$HOME/.ai-skill-collections/assets" && cp -f ./assets/prompt.md ./assets/run-agent.sh ./assets/agent-registry.json "$HOME/.ai-skill-collections/assets/" && chmod +x "$HOME/.ai-skill-collections/assets/run-agent.sh"

Responsibility Boundary

职责边界

This skill owns:
  • issue intake and context payload assembly
  • deterministic complexity scoring
  • capability-band requirement resolution
  • agent/model selection using
    agent-registry.json
  • multi-agent batch planning for independent ready issues
  • bounded fallback policy
  • status and routing report output
run-agent.sh
only executes selected parameters.
prompt.md
is implementation-only guidance.
本Skill负责:
  • 问题获取与上下文载荷组装
  • 确定性复杂度评分
  • 能力区间需求解析
  • 使用
    agent-registry.json
    选择Agent/模型
  • 为独立就绪问题制定多Agent批量计划
  • 有限回退策略
  • 状态与路由报告输出
run-agent.sh
仅执行选中的参数。
prompt.md
仅作为实现指导。

Multi-Agent Capability

多Agent协作能力

run-with-it
may run a single issue or coordinate a batch of multiple agents.
Use multiple agents when all are true:
  • two or more
    ready-for-agent
    issues are unblocked
  • ownership scopes do not overlap, or one agent has explicit ownership of shared files
  • verification can run independently before final integration
  • ALLOW_PARALLEL_AGENTS
    is not
    false
  • the batch size is within
    MAX_PARALLEL_AGENTS
Use sequential execution when any are true:
  • issues depend on one another
  • issues touch the same files without a clear owner
  • migrations, fixtures, generated assets, or shared contracts are involved
  • requirements are ambiguous enough that one result may change the next issue
For multi-agent batches, keep one coordinator in the main session. The coordinator selects issues, assigns ownership, reviews each result, integrates accepted changes, runs verification, commits per issue unless told otherwise, and updates or closes issues.
run-with-it
可处理单个问题,也可协调多个Agent的批量任务。
满足以下所有条件时使用多Agent:
  • 存在两个或多个未阻塞的
    ready-for-agent
    问题
  • 所有权范围无重叠,或某个Agent明确拥有共享文件的所有权
  • 验证可独立执行,无需等待最终集成
  • ALLOW_PARALLEL_AGENTS
    未设为
    false
  • 批量大小在
    MAX_PARALLEL_AGENTS
    限制内
满足以下任一条件时使用顺序执行:
  • 问题之间存在依赖关系
  • 问题涉及同一文件且无明确所有者
  • 涉及迁移、固定数据、生成资源或共享契约
  • 需求存在歧义,前一个任务的结果可能影响后续问题
对于多Agent批量任务,主会话中保留一个协调器。协调器负责选择问题、分配所有权、审核每个结果、集成已接受的变更、运行验证、按问题提交(除非另有指示),并更新或关闭问题。

Issue Intake

问题获取

If issue data is missing in context, fetch with
gh
.
Fallback policy:
  • Primary: GitHub issues via
    gh
    .
  • Fallback: local
    issues.md
    (
    LOCAL_ISSUES_FILE
    override supported).
  • If git metadata is unavailable, continue with empty commit context.
Build
CONTEXT_PAYLOAD_FILE
with:
  1. previous commits
  2. issue details
Then pass
CONTEXT_PAYLOAD_FILE
+
PROMPT_FILE
to unified runner.
若上下文中缺失问题数据,使用
gh
获取。
回退策略:
  • 首选:通过
    gh
    获取GitHub问题。
  • 回退:本地
    issues.md
    (支持
    LOCAL_ISSUES_FILE
    覆盖)。
  • 若Git元数据不可用,继续执行,提交上下文为空。
构建
CONTEXT_PAYLOAD_FILE
,包含:
  1. 历史提交记录
  2. 问题详情
然后将
CONTEXT_PAYLOAD_FILE
+
PROMPT_FILE
传递给统一运行器。

Deterministic Router

确定性路由机制

Complexity Scoring (8 dimensions, each 1-5)

复杂度评分(8个维度,每个维度1-5分)

Score each dimension from
1
(lowest) to
5
(highest):
  1. dependency complexity
  2. ownership overlap risk
  3. architecture risk
  4. orchestration burden
  5. verification risk
  6. ambiguity of requirements
  7. integration surface breadth
  8. rollback/recovery risk
Total score range:
8-40
.
每个维度评分从
1
(最低)到
5
(最高):
  1. 依赖复杂度
  2. 所有权重叠风险
  3. 架构风险
  4. 编排负担
  5. 验证风险
  6. 需求歧义性
  7. 集成范围广度
  8. 回滚/恢复风险
总分范围:
8-40

Model-First Selection

优先选择模型

The orchestrator selects the model first, then the agent that supports it. Agent defaults are ignored.
编排器优先选择模型,然后选择支持该模型的Agent。忽略Agent的默认设置。

Step 1 — Map Score to Target Weight Range

步骤1 — 将评分映射到目标权重范围

Look up the score in
model_routing.score_to_weight
from
agent-registry.json
:
ScoreLabelWeight range
8–12
quite-easy
1–3
13–17
easy
2–4
18–22
medium
4–6
23–27
medium-hard
6–7
28–32
complex
7–9
33–40
holy-fuck
9–10
agent-registry.json
model_routing.score_to_weight
中查找评分对应的范围:
评分标签权重范围
8–12
quite-easy
1–3
13–17
easy
2–4
18–22
medium
4–6
23–27
medium-hard
6–7
28–32
complex
7–9
33–40
holy-fuck
9–10

Step 2 — Apply Hard Minimum Overrides

步骤2 — 应用硬性最低权重覆盖

Before proceeding, raise
weight_min
if any condition is true:
  • dependency state unknown or conflicting →
    weight_min = 9
  • heavy shared-file ownership conflict risk →
    weight_min = 9
  • broad cross-module integration change →
    weight_min = 7
  • explicit user request for deep/complex orchestration →
    weight_min = 9
Use the higher of the table
weight_min
and any override.
在继续之前,若满足以下任一条件,提高
weight_min
  • 依赖状态未知或冲突 →
    weight_min = 9
  • 存在严重的共享文件所有权冲突风险 →
    weight_min = 9
  • 涉及跨模块的广泛集成变更 →
    weight_min = 7
  • 用户明确要求深度/复杂编排 →
    weight_min = 9
取表格中的
weight_min
与所有覆盖值中的较大值。

Step 3 — Build Pool and Randomly Select Model

步骤3 — 构建候选池并随机选择模型

From
model_catalog
in
agent-registry.json
:
  1. Collect all models where
    complexity_weight
    is within
    [weight_min, weight_max]
    .
  2. Keep only models available on at least one detected, non-filtered agent (check each agent's
    known_models
    list).
  3. Apply
    model_routing.provider_routing_rules
    : remove any model whose
    provider
    exceeds its
    max_band
    for the current complexity level. Example:
    google
    is excluded for
    medium-hard
    and above.
  4. Sort remaining candidates by
    (complexity_weight ASC, price_tier ASC, price_output_per_1m ASC)
    .
  5. Take the top
    selection_pool_size
    (default 4 from
    model_routing
    ) — this is the base pool.
  6. Append any models listed in
    model_routing.band_required_models[current_level]
    that are not already in the base pool. These are always available regardless of price ranking.
  7. Randomly pick one model from the final pool. This distributes load across agents and providers on every run.
  8. If fewer than 2 candidates exist after filtering, expand
    weight_max
    by 1 and retry (up to 3 expansions) until pool reaches at least 2, then fail with diagnostics.
agent-registry.json
model_catalog
中:
  1. 收集所有
    complexity_weight
    [weight_min, weight_max]
    范围内的模型。
  2. 仅保留至少在一个已检测且未被过滤的Agent上可用的模型(检查每个Agent的
    known_models
    列表)。
  3. 应用
    model_routing.provider_routing_rules
    :移除任何其
    provider
    超过当前复杂度级别
    max_band
    的模型。示例:
    google
    模型在
    medium-hard
    及以上级别被排除。
  4. (complexity_weight ASC, price_tier ASC, price_output_per_1m ASC)
    对剩余候选模型排序。
  5. 取前
    selection_pool_size
    个模型(默认从
    model_routing
    中取4个)—— 这是基础候选池
  6. model_routing.band_required_models[current_level]
    中未在基础候选池的模型添加进去。这些模型无论价格排名如何,始终可用。
  7. 从最终候选池中随机选择一个模型。这样每次运行时可在Agent和提供商之间分配负载。
  8. 若过滤后候选模型不足2个,将
    weight_max
    扩大1并重试(最多扩大3次),直到候选池至少有2个模型,否则输出诊断信息后失败。

Step 4 — Select Agent

步骤4 — 选择Agent

  1. Find all agents that list the chosen model in their
    known_models
    .
  2. Apply
    AGENT_ALLOWLIST
    and
    AGENT_DENYLIST
    .
  3. Keep only detected (installed) agents.
  4. Interchangeable group rule:
    codex
    and
    github-copilot
    are identical runners for GPT models. If both are in the candidate set, pick one at random. Do not prefer either.
  5. If one agent remains, use it.
  6. If multiple non-interchangeable agents remain, prefer:
    claude
    for Claude models,
    gemini
    for Gemini models, random pick for GPT models.
  7. If no agent remains, fail with clear filter diagnostics before attempting fallback.
  1. 找出所有在其
    known_models
    中包含所选模型的Agent。
  2. 应用
    AGENT_ALLOWLIST
    AGENT_DENYLIST
  3. 仅保留已检测(已安装)的Agent。
  4. 可互换组规则
    codex
    github-copilot
    对于GPT模型是相同的运行器。若两者都在候选集中,随机选择一个,不优先选择任何一个。
  5. 若仅剩一个Agent,使用该Agent。
  6. 若存在多个不可互换的Agent,优先选择:Claude模型对应
    claude
    、Gemini模型对应
    gemini
    、GPT模型随机选择。
  7. 若没有Agent剩余,在尝试回退前输出清晰的过滤诊断信息后失败。

Step 5 — Pass to Runner

步骤5 — 传递给运行器

Always pass both
AGENT
and
MODEL
explicitly. Never rely on the agent's registry default.
bash
run-agent.sh --agent "$AGENT" --model "$MODEL" --unattended
始终显式传递
AGENT
MODEL
。绝不依赖注册表中Agent的默认设置。
bash
run-agent.sh --agent "$AGENT" --model "$MODEL" --unattended

Override Precedence (highest first)

优先级覆盖规则(从高到低)

  1. AGENT
    +
    MODEL
    forced together (both must be valid and installed)
  2. MODEL
    forced alone → skip Steps 1–3, run Step 4 with forced model
  3. AGENT
    forced alone → skip Step 4, run Steps 1–3 restricted to that agent's
    known_models
  4. COMPLEXITY_LEVEL
    forced → use corresponding weight range from table, skip score computation
  5. COMPLEXITY_SCORE
    forced → use as computed score, run full Steps 1–4
  6. Computed score from eight dimensions → full Steps 1–4
Validation rules:
  • Forced
    AGENT
    not installed → fail fast.
  • Forced
    MODEL
    not in chosen agent's
    known_models
    → fail fast.
  • COMPLEXITY_LEVEL
    must be one of the documented labels.
  • COMPLEXITY_SCORE
    must be integer in
    8–40
    .
  1. 强制同时设置
    AGENT
    +
    MODEL
    (两者必须有效且已安装)
  2. 单独强制设置
    MODEL
    → 跳过步骤1–3,使用强制模型执行步骤4
  3. 单独强制设置
    AGENT
    → 跳过步骤4,限制在该Agent的
    known_models
    范围内执行步骤1–3
  4. 强制设置
    COMPLEXITY_LEVEL
    → 使用表格中对应的权重范围,跳过评分计算
  5. 强制设置
    COMPLEXITY_SCORE
    → 将其作为计算出的评分,完整执行步骤1–4
  6. 通过8个维度计算出的评分 → 完整执行步骤1–4
验证规则:
  • 强制设置的
    AGENT
    未安装 → 立即失败。
  • 强制设置的
    MODEL
    不在所选Agent的
    known_models
    中 → 立即失败。
  • COMPLEXITY_LEVEL
    必须是文档中列出的标签之一。
  • COMPLEXITY_SCORE
    必须是8–40之间的整数。

Allowlist and Denylist

白名单与黑名单

Apply filters before final selection:
  • Start from detected installed agents.
  • If
    AGENT_ALLOWLIST
    is set, keep only listed agents.
  • Then remove any in
    AGENT_DENYLIST
    .
  • If result is empty, fail with clear filter diagnostics.
Denylist wins on conflicts.
在最终选择前应用过滤器:
  • 从已检测到的已安装Agent开始。
  • 若设置了
    AGENT_ALLOWLIST
    ,仅保留列表中的Agent。
  • 然后移除
    AGENT_DENYLIST
    中的Agent。
  • 若结果为空,输出清晰的过滤诊断信息后失败。
冲突时黑名单优先级更高。

Bounded Fallback

有限回退机制

If selected agent fails preflight or execution start:
  • Attempt next compatible agent from registry fallback order.
  • Stop after
    MAX_AGENT_FALLBACKS
    attempts.
  • Emit final bounded-fallback failure with attempted chain.
若选中的Agent在预检查或执行启动时失败:
  • 尝试注册表回退顺序中的下一个兼容Agent。
  • 最多尝试
    MAX_AGENT_FALLBACKS
    次。
  • 输出最终的有限回退失败信息,包含尝试过的Agent链。

Preflight Checks

预检查

Before execution verify:
  1. resolved asset root exists
  2. prompt.md
    exists
  3. runner exists and is executable (
    run-agent.sh
    on Bash;
    run-agent.ps1
    on Windows)
  4. agent-registry.json
    exists
  5. gh
    auth when GitHub intake is required
  6. unified runner supports selected agent/model
执行前验证:
  1. 解析后的资源根目录存在
  2. prompt.md
    存在
  3. 运行器存在且可执行(Bash环境使用
    run-agent.sh
    ;Windows环境使用
    run-agent.ps1
  4. agent-registry.json
    存在
  5. 当需要从GitHub获取问题时,
    gh
    已授权
  6. 统一运行器支持选中的Agent/模型

Execution

执行流程

Use unified runner only. Select runner based on detected OS (see OS Detection table above).
Required environment/flags:
  • AGENT_REGISTRY_FILE="$ASSET_ROOT/agent-registry.json"
  • CONTEXT_PAYLOAD_FILE
  • PROMPT_FILE="$ASSET_ROOT/prompt.md"
    (or override)
  • selected
    AGENT
  • selected
    MODEL
    (optional; default from registry)
Bash (macOS / Linux / Git Bash):
bash
AGENT_REGISTRY_FILE="$ASSET_ROOT/agent-registry.json" \
CONTEXT_PAYLOAD_FILE="$CONTEXT_PAYLOAD_FILE" \
PROMPT_FILE="$ASSET_ROOT/prompt.md" \
"$ASSET_ROOT/run-agent.sh" --agent "$AGENT" --model "$MODEL" --unattended
PowerShell (Windows):
powershell
$env:AGENT_REGISTRY_FILE = "$ASSET_ROOT\agent-registry.json"
$env:CONTEXT_PAYLOAD_FILE = $CONTEXT_PAYLOAD_FILE
$env:PROMPT_FILE = "$ASSET_ROOT\prompt.md"
& "$ASSET_ROOT\run-agent.ps1" --agent $AGENT --model $MODEL --unattended
Never invoke legacy per-agent runner scripts from this skill.
仅使用统一运行器。根据检测到的操作系统选择运行器(见上方操作系统检测表格)。
必填环境变量/标志:
  • AGENT_REGISTRY_FILE="$ASSET_ROOT/agent-registry.json"
  • CONTEXT_PAYLOAD_FILE
  • PROMPT_FILE="$ASSET_ROOT/prompt.md"
    (可覆盖)
  • 选中的
    AGENT
  • 选中的
    MODEL
    (可选;默认从注册表获取)
Bash(macOS / Linux / Git Bash):
bash
AGENT_REGISTRY_FILE="$ASSET_ROOT/agent-registry.json" \
CONTEXT_PAYLOAD_FILE="$CONTEXT_PAYLOAD_FILE" \
PROMPT_FILE="$ASSET_ROOT/prompt.md" \
"$ASSET_ROOT/run-agent.sh" --agent "$AGENT" --model "$MODEL" --unattended
PowerShell(Windows):
powershell
$env:AGENT_REGISTRY_FILE = "$ASSET_ROOT\agent-registry.json"
$env:CONTEXT_PAYLOAD_FILE = $CONTEXT_PAYLOAD_FILE
$env:PROMPT_FILE = "$ASSET_ROOT\prompt.md"
& "$ASSET_ROOT\run-agent.ps1" --agent $AGENT --model $MODEL --unattended
绝不要从本Skill中调用旧版的Agent专属运行器脚本。

Routing Report (Required)

路由报告(必填)

Emit a parseable one-line route summary before execution:
text
ROUTE|agent=<agent>|model=<model>|complexity_level=<level>|complexity_score=<score>|target_weight=<min>-<max>|model_weight=<n>|price_tier=<tier>|fallback_budget=<n>|allowlist=<value>|denylist=<value>
Also provide human-readable details:
  1. per-dimension scores
  2. final score and complexity level
  3. target weight range and selected model (with
    complexity_weight
    and
    price_tier
    )
  4. agent selection reason (sole match / interchangeable random pick / provider match)
  5. runner command summary
  6. fallback attempts used
  7. completion status
执行前输出一行可解析的路由摘要:
text
ROUTE|agent=<agent>|model=<model>|complexity_level=<level>|complexity_score=<score>|target_weight=<min>-<max>|model_weight=<n>|price_tier=<tier>|fallback_budget=<n>|allowlist=<value>|denylist=<value>
同时提供人类可读的详细信息:
  1. 各维度评分
  2. 最终评分与复杂度级别
  3. 目标权重范围与选中的模型(包含
    complexity_weight
    price_tier
  4. Agent选择原因(唯一匹配 / 可互换随机选择 / 提供商匹配)
  5. 运行器命令摘要
  6. 使用的回退尝试次数
  7. 完成状态

Canonical Coordinator Contract (Required)

标准协调器协议(必填)

Apply these rules after routing and before invoking the selected agent.
在路由完成后、调用选中的Agent前,应用以下规则。

Issues

问题处理

  • Treat issue data already present in the context payload as the source of truth for selection and planning.
  • Use
    gh
    only when fresh issue data is needed or issue status must be updated.
  • Work only on
    ready-for-agent
    issues.
  • Continue selecting and completing ready tasks until no ready work remains for the run.
  • If all ready work is complete, output
    <promise>NO MORE TASKS</promise>
    .
  • 将上下文载荷中已有的问题数据作为选择和规划的事实来源。
  • 仅当需要获取新问题数据或更新问题状态时使用
    gh
  • 仅处理标记为
    ready-for-agent
    的问题。
  • 持续选择并完成就绪任务,直到本次运行中无就绪任务剩余。
  • 若所有就绪任务已完成,输出
    <promise>NO MORE TASKS</promise>

Operating Mode

运行模式

You are the coordinator. Your job is to plan, delegate, review, integrate, commit, and update issues. Implementation belongs to child agents or the selected external agent process.
  • Prefer a safe parallel batch when several ready issues have independent ownership.
  • Use sequential execution when tasks are dependency-sensitive, concentrated in the same files, or share migrations, fixtures, or architecture decisions.
  • Do not stop after one issue if other ready work remains.
  • Reassess the queue after each completed issue or batch.
你是协调器,负责规划、委派、审核、集成、提交和更新问题。 实现工作由子Agent或选中的外部Agent进程完成。
  • 当多个就绪问题的所有权相互独立时,优先选择安全的并行批量处理。
  • 当任务存在依赖关系、集中在同一文件中,或涉及迁移、固定数据或架构决策时,使用顺序执行。
  • 若存在其他就绪任务,完成一个问题后不要停止。
  • 完成每个问题或批量任务后重新评估任务队列。

Task Selection

任务选择

Before selecting a task, confirm dependencies are complete. If a task depends on another open or in-progress task, run the dependency first or mark the task blocked.
Prioritize in this order:
  1. critical fixes
  2. development infrastructure
  3. tracer-bullet feature slices
  4. polish and quick wins
  5. refactors
For each selected issue, define:
  • GitHub issue number and title
  • why it is ready now
  • dependency proof
  • expected file or module ownership
  • verification steps
选择任务前,确认依赖已完成。 若任务依赖于另一个未关闭或进行中的任务,优先运行依赖任务或将该任务标记为阻塞。
按以下顺序优先级选择:
  1. 关键修复
  2. 开发基础设施
  3. 探路者功能切片
  4. 优化与快速实现任务
  5. 重构
对于每个选中的问题,定义:
  • GitHub问题编号与标题
  • 当前就绪的原因
  • 依赖已完成的证明
  • 预期的文件或模块所有权
  • 验证步骤

Parallel Planning

并行规划

When multiple ready issues are available, build the largest safe batch.
  • Assign one issue per child agent.
  • Group only issues with minimal file overlap and low coordination cost.
  • Avoid batching issues that edit the same files unless one agent owns those files.
  • Keep one coordinator responsible for final integration, review, tests, commits, and issue updates.
当存在多个就绪问题时,构建最大的安全批量任务。
  • 每个子Agent分配一个问题。
  • 仅将文件重叠最少、协调成本低的问题归为一组。
  • 避免将编辑同一文件的问题批量处理,除非某个Agent拥有这些文件的所有权。
  • 保留一个协调器负责最终集成、审核、测试、提交和问题更新。

Coordination

协作规则

Each child agent receives a self-contained prompt with:
  • issue number and goal
  • exact ownership scope
  • paths it must not edit
  • relevant repo conventions copied directly into the prompt
  • required verification commands
  • instruction to keep changes minimal and compatible with other agents
  • TDD requirement when the issue requests test-first implementation
Review every child-agent result before accepting it. Reject or revise work that violates ownership, skips required tests, duplicates domain logic, or makes unrelated edits.
Child agent lifecycle rules:
  • close completed or blocked agents after their result is captured
  • record the decision immediately:
    integrate|revise|blocked
  • do not keep agents open only because more tasks might appear later
每个子Agent会收到一个独立的提示,包含:
  • 问题编号与目标
  • 明确的所有权范围
  • 禁止编辑的路径
  • 直接复制到提示中的相关仓库约定
  • 必填的验证命令
  • 要求变更最小化且与其他Agent兼容的指令
  • 当问题要求先测试再实现时,需遵循TDD要求
接受子Agent的结果前需进行审核。 拒绝或修改违反所有权规则、跳过必填测试、重复领域逻辑或进行无关编辑的工作。
子Agent生命周期规则:
  • 捕获结果后关闭已完成或阻塞的Agent
  • 立即记录决策:
    integrate|revise|blocked
  • 不要仅因为后续可能出现更多任务而保持Agent处于打开状态

Status Messages

状态消息

Emit parseable one-line status messages for multi-agent runs:
  • spawn:
    STATUS|type=spawn|batch=<batch-id>|agent=<agent-name>|issue=#<n>|phase=assigned|scope=<owned-paths>|eta=<rough-eta>
  • heartbeat:
    STATUS|type=heartbeat|batch=<batch-id>|agent=<agent-name>|issue=#<n>|phase=<exploring|implementing|testing|review>|progress=<short-text>|elapsed=<seconds>
  • completion:
    STATUS|type=completion|batch=<batch-id>|agent=<agent-name>|issue=#<n>|result=<done|needs-revision|blocked>|verify=<pass|fail|partial>|next=<integrate|revise|blocked>
  • stall:
    STATUS|type=stall|batch=<batch-id>|agent=<agent-name>|issue=#<n>|idle_for=<seconds>|action=<ping|replan|deparallelize|abort-agent>
  • batch summary:
    STATUS|type=batch|batch=<batch-id>|running=<count>|completed=<count>|blocked=<count>|next=<text>
  • integration:
    STATUS|type=integration|batch=<batch-id>|issue=#<n>|action=<merge|conflict-fix|follow-up-agent>|state=<in-progress|done>
  • close:
    STATUS|type=close|batch=<batch-id>|agent=<agent-name>|issue=#<n>|reason=<completed|blocked|replaced|failed-review>
Keep
progress
values under 8 words and
next
values under 5 words.
多Agent运行时输出一行可解析的状态消息:
  • 启动:
    STATUS|type=spawn|batch=<batch-id>|agent=<agent-name>|issue=#<n>|phase=assigned|scope=<owned-paths>|eta=<rough-eta>
  • 心跳:
    STATUS|type=heartbeat|batch=<batch-id>|agent=<agent-name>|issue=#<n>|phase=<exploring|implementing|testing|review>|progress=<short-text>|elapsed=<seconds>
  • 完成:
    STATUS|type=completion|batch=<batch-id>|agent=<agent-name>|issue=#<n>|result=<done|needs-revision|blocked>|verify=<pass|fail|partial>|next=<integrate|revise|blocked>
  • 停滞:
    STATUS|type=stall|batch=<batch-id>|agent=<agent-name>|issue=#<n>|idle_for=<seconds>|action=<ping|replan|deparallelize|abort-agent>
  • 批量摘要:
    STATUS|type=batch|batch=<batch-id>|running=<count>|completed=<count>|blocked=<count>|next=<text>
  • 集成:
    STATUS|type=integration|batch=<batch-id>|issue=#<n>|action=<merge|conflict-fix|follow-up-agent>|state=<in-progress|done>
  • 关闭:
    STATUS|type=close|batch=<batch-id>|agent=<agent-name>|issue=#<n>|reason=<completed|blocked|replaced|failed-review>
progress
内容不超过8个单词,
next
内容不超过5个单词。

Quality and Closure Loop

质量与闭环

  • Review each agent diff individually, then review the combined batch diff.
  • Run issue-specific checks before broader suites.
  • Commit per issue by default.
  • Update each issue with completion, verification, and follow-up notes.
  • Close completed issues with
    gh issue close
    unless explicitly left open.
  • 单独审核每个Agent的差异,然后审核批量合并后的差异。
  • 先运行问题专属检查,再运行更广泛的测试套件。
  • 默认按问题提交。
  • 更新每个问题的完成情况、验证结果和后续说明。
  • 已完成的问题使用
    gh issue close
    关闭,除非明确要求保持打开。

Guardrails

防护规则

  • Keep prompt content implementation-only.
  • Preserve local fallback behavior when GitHub or git is unavailable.
  • Keep changes minimal and focused to routing/control-plane behavior.
  • 提示内容仅用于实现细节。
  • 当GitHub或Git不可用时,保留本地回退行为。
  • 将变更最小化,聚焦于路由/控制平面行为。