prune-workflows
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePrune Workflows Skill
Prune Workflows Skill
VCS Provider
VCS Provider
This skill's safeguards use VCS operations internally (open PR detection).
The orchestrate handler manages VCS provider dispatch automatically.
No // commands needed — the MCP server handles provider dispatch.
ghglabaz此Skill的防护机制内部使用VCS操作(检测未合并PR)。编排处理程序会自动管理VCS提供商的调度。无需使用//命令——MCP服务器会处理提供商调度。
ghglabazOverview
概述
Bulk-cancel stale non-terminal workflows that have accumulated in the pipeline. Wraps the orchestrate action with an interactive dry-run-then-confirm UX so the user always sees the candidate set before any state mutates.
prune_stale_workflowsPruning is a maintenance operation -- not a workflow phase. It produces events alongside the standard events emitted by the underlying cancel path, so downstream views can distinguish user-intent cancellations from batch cleanup.
workflow.prunedworkflow.cancelled批量取消流水线中累积的过时非终端工作流。该Skill为编排操作封装了“试运行+确认”的交互式体验,确保用户在任何状态变更前都能查看待清理的候选集。
prune_stale_workflows清理是一项维护操作——而非工作流阶段。除了底层取消流程生成的标准事件外,它还会生成事件,以便下游视图区分用户主动发起的取消与批量清理操作。
workflow.cancelledworkflow.prunedTriggers
触发条件
Activate this skill when:
- User runs command
/prune - User says "prune workflows", "clean stale workflows", "pipeline cleanup"
- shows many inactive workflows the user wants to clear in bulk
mcp__exarchos__exarchos_view({ action: "pipeline" })
满足以下任一条件时激活此Skill:
- 用户运行命令
/prune - 用户说出“prune workflows”“clean stale workflows”“pipeline cleanup”
- 显示大量用户想要批量清理的非活跃工作流
mcp__exarchos__exarchos_view({ action: "pipeline" })
Prerequisites
前置条件
- An exarchos state directory with one or more non-terminal workflows
- For safeguard checks against live PRs: available in PATH (the orchestrate handler shells out)
gh - For safeguard checks against branch activity: available in PATH
git
- 存在包含一个或多个非终端工作流的exarchos状态目录
- 若要针对实时PR执行防护检查:PATH中需存在(编排处理程序会调用shell命令)
gh - 若要针对分支活动执行防护检查:PATH中需存在
git
Process
流程
Step 1: Dry-Run Preview
步骤1:试运行预览
Always start with . This call performs candidate selection and safeguard evaluation but does not mutate any workflow state.
dryRun: truetypescript
mcp__exarchos__exarchos_orchestrate({
action: "prune_stale_workflows",
args: {
dryRun: true
}
})The response shape is:
ts
{
candidates: [
{ featureId: string, phase: string, workflowType: string, stalenessMinutes: number }
],
skipped: [
{ featureId: string, reason: "open-pr" | "active-branch" }
]
}Optional args:
- -- staleness cutoff. Default is 10080 (7 days).
thresholdMinutes - -- whether to include
includeOneShotworkflows in the candidate set. Defaultoneshot.true - -- not relevant in dry-run; only honored in apply mode (Step 4).
force
始终以启动。此调用会执行候选工作流筛选和防护机制评估,但不会修改任何工作流状态。
dryRun: truetypescript
mcp__exarchos__exarchos_orchestrate({
action: "prune_stale_workflows",
args: {
dryRun: true
}
})响应格式如下:
ts
{
candidates: [
{ featureId: string, phase: string, workflowType: string, stalenessMinutes: number }
],
skipped: [
{ featureId: string, reason: "open-pr" | "active-branch" }
]
}可选参数:
- -- 过时时长阈值,默认值为10080(7天)
thresholdMinutes - -- 是否将
includeOneShot工作流纳入候选集,默认值为oneshottrue - -- 在试运行阶段无效;仅在执行阶段(步骤4)生效
force
Step 2: Display Candidate Table
步骤2:展示候选工作流表格
Render a table to the user so they can review what would be pruned. Use this format:
markdown
undefined向用户渲染表格,以便其查看待清理内容,使用以下格式:
markdown
undefinedPrune Candidates (3)
待清理候选工作流(3个)
| Feature ID | Type | Phase | Stale (min) |
|---|---|---|---|
| feat-old-experiment | feature | implementing | 14430 |
| oneshot-typo-fix | oneshot | plan | 9120 |
| debug-flaky-test | debug | investigate | 8650 |
| Feature ID | 类型 | 阶段 | 过时时长(分钟) |
|---|---|---|---|
| feat-old-experiment | feature | implementing | 14430 |
| oneshot-typo-fix | oneshot | plan | 9120 |
| debug-flaky-test | debug | investigate | 8650 |
Skipped by Safeguards (2)
被防护机制跳过的工作流(2个)
| Feature ID | Reason |
|---|---|
| feat-active-pr | open-pr |
| feat-recent-work | active-branch |
If `candidates.length === 0` AND `skipped.length === 0`, output:
> No stale workflows to prune. Pipeline is clean.
Then exit -- no further action.| Feature ID | 原因 |
|---|---|
| feat-active-pr | open-pr |
| feat-recent-work | active-branch |
若`candidates.length === 0`且`skipped.length === 0`,则输出:
> 无过时工作流需要清理,流水线已处于整洁状态。
随后退出,无需执行后续操作。Step 3: Prompt for Confirmation
步骤3:确认提示
Ask the user one of three choices:
proceed -- prune the listed candidates (skipped workflows stay) abort -- exit without changes force -- bypass safeguards and prune skipped workflows too
Wait for explicit user input. Do not auto-proceed.
向用户提供三个选项:
proceed -- 清理列出的候选工作流(被跳过的工作流保留) abort -- 退出且不做任何变更 force -- 绕过防护机制,同时清理被跳过的工作流
等待用户明确输入,请勿自动执行。
Step 4a: Apply (proceed)
步骤4a:执行(proceed)
On , invoke the same action with . Pass through and if the user set them in Step 1.
proceeddryRun: falsethresholdMinutesincludeOneShottypescript
mcp__exarchos__exarchos_orchestrate({
action: "prune_stale_workflows",
args: {
dryRun: false
}
})The response now includes a array:
prunedts
{
candidates: [...],
skipped: [...],
pruned: [
{ featureId: string, previousPhase: string }
]
}Each entry in corresponds to a workflow that transitioned to and emitted a event.
prunedcancelledworkflow.pruned用户选择时,调用相同操作并设置。若用户在步骤1中设置了和,则需一并传入。
proceeddryRun: falsethresholdMinutesincludeOneShottypescript
mcp__exarchos__exarchos_orchestrate({
action: "prune_stale_workflows",
args: {
dryRun: false
}
})此时响应会包含数组:
prunedts
{
candidates: [...],
skipped: [...],
pruned: [
{ featureId: string, previousPhase: string }
]
}prunedcancelledworkflow.prunedStep 4b: Apply (force)
步骤4b:执行(force)
On , set . Safeguards are bypassed but the bypass is recorded in the event payload as so the audit trail is intact.
forceforce: trueworkflow.prunedskippedSafeguards: [...]typescript
mcp__exarchos__exarchos_orchestrate({
action: "prune_stale_workflows",
args: {
dryRun: false,
force: true
}
})In force mode, workflows that were in the list during dry-run are now eligible for pruning.
skipped用户选择时,设置。防护机制会被绕过,但绕过操作会被记录在事件的字段中,确保审计轨迹完整。
forceforce: trueworkflow.prunedskippedSafeguards: [...]typescript
mcp__exarchos__exarchos_orchestrate({
action: "prune_stale_workflows",
args: {
dryRun: false,
force: true
}
})在强制模式下,试运行阶段处于列表中的工作流现在也可被清理。
skippedStep 4c: Apply (abort)
步骤4c:执行(abort)
On , exit without invoking the action a second time. The dry-run has not mutated any state.
abort用户选择时,退出且不再调用操作。试运行阶段未修改任何状态。
abortStep 5: Report Results
步骤5:结果报告
After the apply call returns, summarize the outcome:
markdown
undefined执行调用返回后,总结结果:
markdown
undefinedPrune Complete
清理完成
Pruned: 3 workflows transitioned to cancelled
Skipped: 2 workflows preserved by safeguards
Force bypass: no
已清理: 3个工作流转为已取消状态
已跳过: 2个工作流被防护机制保留
强制绕过: 否
Pruned Workflows
已清理工作流
- feat-old-experiment (was: implementing)
- oneshot-typo-fix (was: plan)
- debug-flaky-test (was: investigate)
If `force` was used, also list any safeguards that were bypassed:
```markdown- feat-old-experiment(原阶段:implementing)
- oneshot-typo-fix(原阶段:plan)
- debug-flaky-test(原阶段:investigate)
若使用了`force`模式,还需列出被绕过的防护机制:
```markdownSafeguards Bypassed
被绕过的防护机制
- feat-active-pr: open-pr
- feat-recent-work: active-branch
undefined- feat-active-pr: open-pr
- feat-recent-work: active-branch
undefinedSafeguards Explained
防护机制说明
Two safeguards run automatically in the orchestrate handler before each cancel:
| Safeguard | Behavior | Reason key |
|---|---|---|
| Open PR | Skip if | |
| Recent commits | Skip if | |
A workflow without a in state (e.g., abandoned at ideate/plan before delegation) cannot have a PR or branch activity, so safeguards short-circuit and the workflow is eligible for pruning.
branchNameforce: trueworkflow.pruned编排处理程序在每次取消操作前会自动运行两项防护检查:
| 防护机制 | 行为 | 原因标识 |
|---|---|---|
| 未合并PR检查 | 若 | |
| 近期提交检查 | 若 | |
状态中无的工作流(例如在委派前已停滞在ideate/plan阶段的工作流)无法进行PR或分支活动检查,因此防护机制会直接放行,该工作流可被清理。
branchNameforce: trueworkflow.prunedAnti-Patterns
反模式
| Don't | Do Instead |
|---|---|
| Skip the dry-run step | Always start with |
| Auto-confirm without showing the table | Render the candidate table and wait for explicit user input |
Use | Reserve |
Manually call | Use this skill -- it batches the cancel loop and emits the |
| Run on every session | Pruning is a maintenance operation; run when pipeline accumulation is observable |
| 请勿 | 建议做法 |
|---|---|
| 跳过试运行步骤 | 始终以 |
| 不展示表格直接自动确认 | 渲染候选工作流表格并等待用户明确输入 |
默认启用 | 仅在用户明确选择时使用 |
手动为每个过时工作流调用 | 使用此Skill——它会批量处理取消循环并生成 |
| 每次会话都运行清理 | 清理是维护操作;仅当流水线中累积大量非活跃工作流时运行 |
Examples
示例
Example 1: Clean dry-run, user proceeds
示例1:试运行无跳过,用户选择继续
> /prune> /prunePrune Candidates (2)
待清理候选工作流(2个)
| Feature ID | Type | Phase | Stale (min) |
|---|---|---|---|
| feat-old-spike | feature | plan | 12880 |
| oneshot-readme-tweak | oneshot | implementing | 9700 |
| Feature ID | 类型 | 阶段 | 过时时长(分钟) |
|---|---|---|---|
| feat-old-spike | feature | plan | 12880 |
| oneshot-readme-tweak | oneshot | implementing | 9700 |
Skipped by Safeguards (0)
被防护机制跳过的工作流(0个)
(none)
Proceed? (proceed/abort/force)
proceed
(无)
是否继续?(proceed/abort/force)
proceed
Prune Complete
清理完成
Pruned: 2 workflows transitioned to cancelled
Skipped: 0
Force bypass: no
已清理: 2个工作流转为已取消状态
已跳过: 0个
强制绕过: 否
Pruned Workflows
已清理工作流
- feat-old-spike (was: plan)
- oneshot-readme-tweak (was: implementing)
undefined- feat-old-spike(原阶段:plan)
- oneshot-readme-tweak(原阶段:implementing)
undefinedExample 2: Safeguard skip, user forces
示例2:存在防护跳过,用户选择强制清理
> /prune> /prunePrune Candidates (1)
待清理候选工作流(1个)
| Feature ID | Type | Phase | Stale (min) |
|---|---|---|---|
| feat-stale-no-pr | feature | implementing | 11200 |
| Feature ID | 类型 | 阶段 | 过时时长(分钟) |
|---|---|---|---|
| feat-stale-no-pr | feature | implementing | 11200 |
Skipped by Safeguards (1)
被防护机制跳过的工作流(1个)
| Feature ID | Reason |
|---|---|
| feat-stale-with-pr | open-pr |
Proceed? (proceed/abort/force)
force
| Feature ID | 原因 |
|---|---|
| feat-stale-with-pr | open-pr |
是否继续?(proceed/abort/force)
force
Prune Complete
清理完成
Pruned: 2 workflows transitioned to cancelled
Skipped: 0
Force bypass: yes
已清理: 2个工作流转为已取消状态
已跳过: 0个
强制绕过: 是
Pruned Workflows
已清理工作流
- feat-stale-no-pr (was: implementing)
- feat-stale-with-pr (was: implementing)
- feat-stale-no-pr(原阶段:implementing)
- feat-stale-with-pr(原阶段:implementing)
Safeguards Bypassed
被绕过的防护机制
- feat-stale-with-pr: open-pr
undefined- feat-stale-with-pr: open-pr
undefinedExample 3: Empty pipeline
示例3:流水线无过时工作流
> /prune
No stale workflows to prune. Pipeline is clean.> /prune
无过时工作流需要清理,流水线已处于整洁状态。Schema Discovery
Schema 发现
For the canonical argument schema and any future fields, use:
typescript
mcp__exarchos__exarchos_orchestrate({
action: "describe",
actions: ["prune_stale_workflows"]
})如需获取标准参数Schema及未来新增字段,请使用:
typescript
mcp__exarchos__exarchos_orchestrate({
action: "describe",
actions: ["prune_stale_workflows"]
})Exarchos Integration
Exarchos 集成
The action emits two events per pruned workflow:
prune_stale_workflows- (auto-emitted by the underlying
workflow.cancelledpath)handleCancel - (emitted by this handler with
workflow.prunedand optionaltriggeredBy: 'manual')skippedSafeguards
Both are projected into the workflow state's array by the standard projection. Downstream views can filter on to identify batch cleanups versus user-initiated cancels.
_eventsworkflow.prunedprune_stale_workflows- (由底层
workflow.cancelled流程自动生成)handleCancel - (由此处理程序生成,包含
workflow.pruned及可选的triggeredBy: 'manual'字段)skippedSafeguards
两个事件都会被标准投影写入工作流状态的数组中。下游视图可通过筛选事件区分批量清理与用户主动发起的取消操作。
_eventsworkflow.pruned