关于 ln-1000-pipeline-orchestrator
ln-1000-pipeline-orchestrator 为项目团队将选定的 Story 依次推进任务规划、验证、执行和质量门禁。它通过阶段产物管理状态,并处理恢复、重试、返工与报告。
主要功能
- 01解析看板并选择 Story
- 02批量收集业务问题
- 03依次调用四个协调器阶段
- 04依据阶段产物推进与恢复
- 05处理失败、重试和返工
- 06生成流水线报告
适用场景
- 01端到端处理一个待办 Story
- 02从中断状态恢复流水线
- 03跟踪返工与质量门禁结果
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ levnikolaevich/ claude-code-skills --skill ln-1000-pipeline-orchestrator安装后在 Claude Code 中输入/ln-1000-pipeline-orchestrator确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
README.mdreferences/agent_skill_roots_contract.mdauto_discovery_pattern.mdcheckpoint_format.mdenvironment_state_contract.mdepistemic_protocol.mdgit_scope_detection.mdgit_worktree_fallback.mdkanban_parser.mdkanban_update_algorithm.mdloop_health_contract.mdmeta_analysis_protocol.mdpipeline_states.mdresearch_tool_fallback.mdreferences/phases/phase4_flow.mdphase6_meta_analysis.mdreferences/scripts/coordinator-runtime/lib/artifacts.mjscli-helpers.mjscore.mjsloop-health.mjsruntime-constants.mjsschemas.mjsvalidate.mjsreferences/scripts/coordinator-runtime/test/cli-test-helpers.mjsreferences/scripts/evaluation-runtime/cli.mjsreferences/scripts/evaluation-runtime/lib/guards.mjsstore.mjsreferences/scripts/hooks/prevent-sleep.ps1references/scripts/planning-runtime/lib/cli.mjsguards.mjs详细介绍
**路径:**文件路径(
references/、../ln-*)相对于此技能目录。
**类型:**L1 编排器 **类别:**1000 流水线
流水线编排器
通过在单一上下文中以 Skill() 调用协调器,并根据协调器阶段产物推进流程,驱动所选 Story 完成整个流水线(任务规划 -> 验证 -> 执行 -> 质量门禁)。
目的与范围
- 解析看板并显示可供用户选择的 Story
- 在执行前一次性提出业务问题;自主做出技术决策
- 驱动所选 Story 完成 4 个阶段:ln-300 -> ln-310 -> ln-400 -> ln-500
- 每个阶段结束后编写阶段说明和检查点,以便报告和恢复
- 处理失败、重试、返工循环,并在需要时升级给用户
- 生成包含分支名称、Git 统计信息和 Agent 审查信息的流水线报告
层级
L0: ln-1000-pipeline-orchestrator (sequential Skill calls, single context)
+-- Skill("ln-300") — task decomposition (internally manages stateful task-plan workers)
+-- Skill("ln-310") — validation (internally launches configured external review agents when available)
+-- Skill("ln-400") — execution (internally dispatches stateful task workers)
+-- Skill("ln-500") — quality gate (internally runs artifact-first ln-510/ln-520, verdict, finalization)
**核心原则:**ln-1000 通过 Skill 工具调用协调器。每个协调器负责管理自己的内部工作者调度,并生成阶段产物。ln-1000 不会修改现有技能——它会像人工操作员一样调用这些技能,并将协调器产物视为主要完成信号。
任务存储模式
**必须阅读:**加载 references/environment_state_contract.md 和 references/storage_mode_detection.md
提取:task_provider = Task Management -> Provider(linear | file)。
适用场景
- 有一个可处理的 Story——由用户选择
- 需要端到端自动化:任务规划 -> 验证 -> 执行 -> 质量门禁
- 希望通过流水线报告对 Story 进行受控处理
流水线:4 阶段状态机
**必须阅读:**加载 references/pipeline_states.md,了解状态转换规则和守卫条件。
**必须阅读:**加载 references/loop_health_contract.md
Backlog --> Stage 0 (ln-300) --> Backlog --> Stage 1 (ln-310) --> Todo
(no tasks) create tasks (tasks exist) validate |
| NO-GO |
v v
[retry/ask] Stage 2 (ln-400)
|
v
To Review
|
v
Stage 3 (ln-500)
| |
PASS FAIL
| v
Done To Rework -> Stage 2
(branch pushed) (max 2 cycles)
| 阶段 | 技能 | 输入状态 | 输出状态 |
|---|---|---|---|
| 0 | ln-300-task-coordinator | Backlog(无任务) | Backlog(已创建任务) |
| 1 | ln-310-multi-agent-validator | Backlog(存在任务) | Todo |
| 2 | ln-400-story-executor | Todo / To Rework | To Review |
| 3 | ln-500-story-quality-gate | To Review | Done / To Rework |
工作流
阶段 0:恢复检查
PIPELINE="{skill_repo}/ln-1000-pipeline-orchestrator/scripts/cli.mjs"
recovery = Bash: node $PIPELINE status
IF recovery.active == true:
# Previous run interrupted — resume from CLI state
1. Extract: story_id, stage, resume_action from recovery JSON
2. Read already-written stage artifacts and runtime state
3. Re-read kanban board -> secondary verification only
4. IF recovery.state.worktree_dir exists: cd {recovery.state.worktree_dir}
5. Jump to Phase 4, starting from resume_action
IF recovery.active == false:
# Fresh start — proceed to Phase 1
阶段 1:发现、解析看板并选择 Story
**必须阅读:**加载 references/kanban_parser.md,了解解析模式。
- 自动发现
docs/tasks/kanban_board.md(或通过存储模式操作调用 Linear API) - 从目标项目的 CLAUDE.md 提取项目概要(不是技能仓库):
project_brief = { name: <from H1 or first line>, tech: <from Development Commands / tech references>, type: <inferred: "CLI", "API", "web app", "library">, key_rules: <2-3 critical rules> } IF not found: project_brief = { name: basename(project_root), tech: "unknown" } - 解析所有状态分区:Backlog、Todo、In Progress、To Review、To Rework
- 提取 Story 列表,包含:ID、标题、状态、Epic 名称、是否存在任务
- 筛选:跳过状态为 Done、Postponed、Canceled 的 Story
- 检测每个 Story 是否存在任务:
- 存在
_(tasks not created yet)_-> 无任务 -> 阶段 0 - 存在任务行(缩进 4 个空格)-> 存在任务 -> 阶段 1+
- 存在
- 确定每个 Story 的目标阶段(参见
references/pipeline_states.md中的阶段到状态映射) - 显示可选 Story 并让用户选择一个:
Project: {project_brief.name} ({project_brief.tech}) Available Stories: | # | Story | Status | Stage | Skill | Epic | |---|-------|--------|-------|-------|------| | 1 | PROJ-42: Auth endpoint | To Review | 3 | ln-500 | Epic: Auth | | 2 | PROJ-55: CRUD users | Backlog (no tasks) | 0 | ln-300 | Epic: Users | | 3 | PROJ-60: Dashboard | Todo | 2 | ln-400 | Epic: UI | AskUserQuestion: "Which story to process? Enter # or Story ID." - 保存所选 Story。仅提取所选 Story 的概要:
description = tracker getStory(selected_story.id).body // provider-specific transport per tracker_provider_contract.md story_briefs[id] = parse markers IF no markers: story_briefs[id] = { tech: project_brief.tech, keyFiles: "unknown" }
阶段 2:执行前提问(一次性)
- 加载所选 Story 的描述(仅元数据)
- 检查业务歧义——以下问题:
- 无法在代码库、文档或标准中找到答案
- 需要业务/产品决策(支付服务商、身份验证流程、UI 偏好)
- 将所有业务问题汇总到单个 AskUserQuestion 中
- 技术问题——使用 project_brief 解决:
- 库版本:MCP Ref / Context7(针对
project_brief.tech生态) - 架构模式:
project_brief.key_rules - 标准合规性:由 ln-310 阶段 2 处理
- 库版本:MCP Ref / Context7(针对
**如果未发现业务问题,则跳过阶段 2。**直接进入阶段 3。
阶段 3:流水线设置
3.0 Linear 状态缓存(仅限 Linear 模式)
IF storage_mode == "linear":
statuses = list_issue_statuses(teamId=team_id)
status_cache = {status.name: status.id FOR status IN statuses}
REQUIRED = ["Backlog", "Todo", "In Progress", "To Review", "To Rework", "Done"]
missing = [s for s in REQUIRED if s not in status_cache]
IF missing: ABORT "Missing Linear statuses: {missing}. Configure workflow."
3.1 前置检查:设置验证
验证目标项目中的 .claude/settings.local.json:
defaultMode="bypassPermissions"(协调器生成的 Agent 工作线程必须使用此设置)
3.2 工作树隔离
必须阅读: 加载 references/git_worktree_fallback.md
branch_check = git branch --show-current
IF branch_check matches feature/* / optimize/* / upgrade/* / modernize/*:
worktree_dir = CWD
project_root = CWD
branch = branch_check
ELSE:
story_slug = slugify(selected_story.title)
branch = "feature/{selected_story.id}-{story_slug}"
worktree_dir = ".hex-skills/worktrees/story-{selected_story.id}"
project_root = CWD
changes = git diff HEAD
IF changes not empty:
git diff HEAD > .hex-skills/pipeline/carry-changes.patch
git fetch origin
base_branch = detect per references/git_scope_detection.md §Base Branch Detection
git worktree add -b {branch} {worktree_dir} origin/{base_branch}
IF .hex-skills/pipeline/carry-changes.patch exists:
git -C {worktree_dir} apply .hex-skills/pipeline/carry-changes.patch && rm .hex-skills/pipeline/carry-changes.patch
IF apply fails: WARN user "Patch conflicts -- continuing without uncommitted changes"
cd {worktree_dir} # All subsequent Skill calls inherit this CWD
协调器启动时会自行检测 feature/* -> 跳过创建自己的工作树(ln-400 阶段 1 步骤 5)。
3.3 初始化流水线状态
Bash: node $PIPELINE start \
--story {selected_story.id} \
--title "{selected_story.title}" \
--storage {storage_mode} \
--project-brief '{JSON.stringify(project_brief)}' \
--story-briefs '{JSON.stringify(story_briefs)}' \
--business-answers '{JSON.stringify(business_answers)}' \
--status-cache '{JSON.stringify(status_cache)}' \
--skill-repo-path "{skill_repo}" \
--worktree-dir "{worktree_dir}" \
--branch-name "{branch}"
IF result.recovery == true:
# Active run found — resume instead of fresh start
Jump to Phase 4 using result.state
3.4 防止休眠(仅限 Windows)
IF platform == "win32":
Bash: cp {skill_repo}/ln-1000-pipeline-orchestrator/references/scripts/hooks/prevent-sleep.ps1 .hex-skills/pipeline/prevent-sleep.ps1
Bash: powershell -ExecutionPolicy Bypass -WindowStyle Hidden -File .hex-skills/pipeline/prevent-sleep.ps1 &
sleep_prevention_pid = $!
阶段 4:流水线执行
必须阅读: 加载 references/phases/phase4_flow.md,了解 ASSERT 防护、阶段说明、上下文恢复和错误处理。
必须阅读: 加载 references/checkpoint_format.md,了解检查点架构。
# --- INITIALIZATION ---
id = selected_story.id
target_stage = determine_stage(selected_story) # pipeline_states.md / guards.mjs
# --- PROGRESS TRACKER (survives compaction) ---
TodoWrite([
{content: "Stage 0: Task Decomposition (ln-300)", status: "pending", activeForm: "Decomposing tasks"},
{content: "Stage 1: Validation (ln-310)", status: "pending", activeForm: "Validating story"},
{content: "Stage 2: Execution (ln-400)", status: "pending", activeForm: "Executing tasks"},
{content: "Stage 3: Quality Gate (ln-500)", status: "pending", activeForm: "Running quality gate"},
{content: "Pipeline Report + Cleanup", status: "pending", activeForm: "Generating report"}
])
# --- STAGE 0: Task Decomposition ---
IF target_stage <= 0:
Bash: node $PIPELINE advance --story {id} --to STAGE_0
Skill(skill: "ln-300-task-coordinator", args: "{id}")
Read Stage 0 coordinator artifact -> Bash: node $PIPELINE record-stage-summary --story {id} --payload '{...}'
ASSERT Stage 0 artifact: status=completed, stage=0
IF ASSERT fails: Bash: node $PIPELINE record-loop-health --story {id} --stage 0 --payload '{"error":"Stage 0 ASSERT failed","progress_detected":false}'
Re-read kanban only as secondary assertion
IF ASSERT fails: Bash: node $PIPELINE pause --story {id} --reason "Stage 0 artifact missing or invalid"; ESCALATE
Write stage notes: .hex-skills/pipeline/stage_0_notes_{id}.md (Key Decisions, Artifacts)
Bash: node $PIPELINE checkpoint --story {id} --stage 0 --plan-score {score} --tasks-remaining '{JSON tasks}' --last-action "Tasks created"
# --- STAGE 1: Validation ---
IF target_stage <= 1:
Bash: node $PIPELINE advance --story {id} --to STAGE_1
IF advance fails (guard rejection): handle per error.recovery
Skill(skill: "ln-310-multi-agent-validator", args: "{id}")
Read Stage 1 coordinator artifact -> Bash: node $PIPELINE record-stage-summary --story {id} --payload '{...}'
ASSERT artifact verdict = GO and readiness_score >= 5
IF NO-GO:
Bash: node $PIPELINE advance --story {id} --to STAGE_1 # retry (guard auto-increments validation_retries)
IF advance fails: Bash: node $PIPELINE pause --story {id} --reason "Validation retry exhausted"; ESCALATE
Skill(skill: "ln-310-multi-agent-validator", args: "{id}") # retry
Read retry Stage 1 artifact -> Bash: node $PIPELINE record-stage-summary --story {id} --payload '{...}'
IF same ASSERT failure repeats without new Stage 1 artifact/checkpoint/status evidence:
Bash: node $PIPELINE record-loop-health --story {id} --stage 1 --payload '{"error":"Stage 1 ASSERT failed","progress_detected":false}'
IF result.pause.pause == true: ESCALATE using result.state.paused_reason
Re-read kanban only as secondary assertion
IF still NOT Todo: Bash: node $PIPELINE pause --story {id} --reason "Validation artifact or status invalid"; ESCALATE
Extract agents_info from Stage 1 artifact metadata or review runtime state
Write stage notes: .hex-skills/pipeline/stage_1_notes_{id}.md (Verdict, Agent Review, Key Decisions)
Bash: node $PIPELINE checkpoint --story {id} --stage 1 --verdict {verdict} --readiness {score} --agents-info "{agents}" --last-action "Validated"
# --- COMPACTION RECOVERY (replaces old COMPACTION GUARD) ---
# If context compacted and vars lost: Bash: node $PIPELINE status --story {id}
# Extract resume_action from JSON -> continue from there. No manual JSON reads needed.
# --- STAGE 2+3 LOOP (rework cycle, managed by CLI guards) ---
WHILE true:
# STAGE 2: Execution
IF target_stage <= 2 OR (status shows rework cycle):
Bash: node $PIPELINE advance --story {id} --to STAGE_2
IF advance fails: Bash: node $PIPELINE pause --story {id} --reason "{error}"; ESCALATE; BREAK
Skill(skill: "ln-400-story-executor", args: "{id}")
Read Stage 2 coordinator artifact -> Bash: node $PIPELINE record-stage-summary --story {id} --payload '{...}'
ASSERT artifact story_status = To Review
IF ASSERT fails: Bash: node $PIPELINE record-loop-health --story {id} --stage 2 --payload '{"error":"Stage 2 ASSERT failed","progress_detected":false}'
Re-read kanban only as secondary assertion
IF ASSERT fails: Bash: node $PIPELINE pause --story {id} --reason "Stage 2 artifact missing or invalid"; ESCALATE; BREAK
git_stats = parse `git diff --stat origin/{base_branch}..HEAD`
Write stage notes: .hex-skills/pipeline/stage_2_notes_{id}.md (Key Decisions, Git commits)
Bash: node $PIPELINE checkpoint --story {id} --stage 2 --tasks-completed '{JSON done}' --git-stats '{JSON stats}' --last-action "Implementation complete"
# STAGE 3: Quality Gate (IMPOSSIBLE TO SKIP — next line after Stage 2)
Bash: node $PIPELINE advance --story {id} --to STAGE_3
Skill(skill: "ln-500-story-quality-gate", args: "{id}")
Read Stage 3 coordinator artifact -> Bash: node $PIPELINE record-stage-summary --story {id} --payload '{...}'
IF repeated identical quality FAIL has no new artifact/task/code delta:
Bash: node $PIPELINE record-loop-health --story {id} --stage 3 --payload '{"error":"Stage 3 repeated quality FAIL","progress_detected":false}'
IF result.pause.pause == true: ESCALATE using result.state.paused_reason
Extract quality verdict, score, agents_info from Stage 3 artifact
Re-read kanban only as secondary assertion
Write stage notes: .hex-skills/pipeline/stage_3_notes_{id}.md (Verdict, Score, Agent Review, Branch)
Bash: node $PIPELINE checkpoint --story {id} --stage 3 --verdict {verdict} --quality-score {score} --agents-info "{agents}" --last-action "Quality gate: {verdict}"
IF Story status = Done:
Bash: node $PIPELINE advance --story {id} --to DONE
BREAK
IF Story status = To Rework:
Read Stage 3 artifact `metadata.rework_hint` for blocking_categories and suggested_focus
Bash: node $PIPELINE advance --story {id} --to STAGE_2 # guard auto-increments quality_cycles
IF advance fails (quality_cycles >= 2):
Bash: node $PIPELINE pause --story {id} --reason "Quality gate failed 2 times"
ESCALATE: "Quality gate failed after max cycles. Manual review needed."
BREAK
# Pass rework focus to ln-400:
Skill(skill: "ln-400-story-executor", args: "{id} --rework-focus {blocking_categories}")
CONTINUE
Bash: node $PIPELINE pause --story {id} --reason "Unexpected Stage 3 outcome"
ESCALATE: "Story ended Stage 3 in unexpected status. Manual review needed."
BREAK
### Stop Conditions (Quality Cycle)
| Condition | Action |
|-----------|--------|
| All tasks Done + Story = Done | STOP — Story completed successfully |
| `quality_cycles >= 2` | STOP — ESCALATE: "Quality gate failed after max cycles. Manual review needed." |
| Validation retry fails (NO-GO after retry) | STOP — ESCALATE: ask user for direction |
| Stage 2 precondition fails | STOP — ESCALATE: "Stage 2 incomplete, manual intervention needed" |
| Same stage ASSERT failure repeats without new evidence | STOP — runtime `record-loop-health` pauses with actionable reason |
### Phase 5: Cleanup & Report
0. 标记流水线已完成
pre_cleanup_status = Bash: node $PIPELINE status --story {id} IF pre_cleanup_status.state.phase != "DONE": Bash: node $PIPELINE advance --story {id} --to DONE
1. 根据完成定义进行自我验证
status = Bash: node $PIPELINE status --story {id} final_state = status.state.phase OR "DONE" verification = { story_selected: status.state.story_id == id story_processed: final_state IN ("DONE", "PAUSED") } IF ANY verification == false: WARN user with details
2. 阅读阶段说明
stage_notes = {} FOR N IN 0..3: IF .hex-skills/pipeline/stage_{N}notes{id}.md exists: stage_notes[N] = read file content ELSE: stage_notes[N] = "(no notes captured)"
3. 提取分支信息
branch_name = git branch --show-current git_stats_final = git diff --stat origin/{base_branch}..HEAD (if not already captured)
4. 完成流水线报告
durations = {N: stage_timestamps.stage_{N}end - stage_timestamps.stage{N}_start FOR N IN 0..3 IF both timestamps exist}
Write docs/tasks/reports/pipeline-{date}.md:
流水线报告 -- {date}
事项: {id} -- {title} 分支: {branch_name} 最终状态: {final_state} 耗时: {now() - pipeline_start_time}
任务规划(ln-300)
| 任务数 | 计划得分 | 耗时 |
|---|---|---|
| 创建 {N} 项 | {score}/4 | {durations[0]} |
{stage_notes[0]}
验证(ln-310)
| 判定 | 就绪度 | Agent 评审 | 耗时 |
|---|---|---|---|
| {verdict} | {score}/10 | {agents_info} | {durations[1]} |
{stage_notes[1]}
实现(ln-400)
| 状态 | 文件 | 行数 | 耗时 |
|---|---|---|---|
| {result} | {files_changed} | +{added}/-{deleted} | {durations[2]} |
{stage_notes[2]}
质量门禁(ln-500)
| 判定 | 得分 | Agent 评审 | 返工 | 耗时 |
|---|---|---|---|---|
| {verdict} | {score}/100 | {agents_info} | {quality_cycles} | {durations[3]} |
{stage_notes[3]}
流水线指标
| 墙钟时间 | 返工轮次 | 验证重试次数 |
|---|---|---|
| {total_duration} | {quality_cycles} | {validation_retries} |
5. 向用户显示流水线摘要
流水线已完成:
| 事项 | 分支 | 规划 | 验证 | 实现 | 质量门禁 | 状态 |
|---|---|---|---|---|---|---|
| {id} | {branch} | {stage0} | {stage1} | {stage2} | {stage3} | {final_state} |
报告已保存:docs/tasks/reports/pipeline-{date}.md
6. 清理工作树
cd {project_root} IF final_state == "PAUSED" AND worktree_dir exists AND worktree_dir != project_root: git -C {worktree_dir} add -A git -C {worktree_dir} commit -m "WIP: {id} pipeline paused" --allow-empty git -C {worktree_dir} push -u origin {branch} git worktree remove {worktree_dir} --force Display: "部分工作已保存到分支 {branch}(远程)。工作树已清理。" IF final_state == "DONE" AND worktree_dir exists AND worktree_dir != project_root:
ln-500 在阶段 7 中已提交并推送。仅清理工作树。
git worktree remove {worktree_dir} --force
7. 停止防止睡眠(Windows)
IF sleep_prevention_pid: kill $sleep_prevention_pid 2>/dev/null || true
8. 移除流水线状态文件
删除 .hex-skills/pipeline/ 目录
9. 向用户报告结果位置
## Coordinator Artifacts as Orchestration Truth
- **Read coordinator artifact first** after each stage completion. Never treat prose output as completion truth
- Re-read board after each stage only as a secondary assertion for expected status transitions
- Coordinators (ln-300/310/400/500) update Linear/kanban via their own logic. Lead verifies the artifact first, then checks board consistency
- **Update algorithm:** Follow `references/kanban_update_algorithm.md` for Epic grouping and indentation
## Error Handling
| Situation | Detection | Action |
|-----------|----------|--------|
| ln-300 task creation fails | Skill returns error | Escalate to user: "Cannot create tasks for Story {id}" |
| ln-310 NO-GO (Score <5) | Stage 1 artifact verdict != GO | Retry once. If still NO-GO -> ask user |
| Task in To Rework 3+ times | ln-400 reports rework loop | Escalate: "Task X reworked 3 times, need input" |
| ln-500 FAIL | Stage 3 artifact verdict = FAIL | Fix tasks auto-created by ln-500. Stage 2 re-entry. Max 2 quality cycles |
| Skill call error | Exception from Skill() | `node $PIPELINE status` -> re-invoke same Skill (runtime + artifacts handle resume) |
| Context compression | PostCompact hook or manual detection | `node $PIPELINE status` -> extract resume_action -> continue |
## Worker Invocation (MANDATORY)
**Host Skill Invocation:** `Skill(skill: "...", args: "...")` is mandatory delegation.
- Claude: call the Skill tool exactly as shown.
- Codex: if no Skill tool exists, locate the named skill in available skills, read its `SKILL.md`, treat `args` as `$ARGUMENTS`, execute that skill workflow, then return here with its result/artifact.
- Do not inline worker logic or mark the worker complete without executing the target skill.
| Stage | Skill | Invocation |
|-------|-------|------------|
| 0 | ln-300-task-coordinator | `Skill(skill: "ln-300-task-coordinator", args: "{id}")` |
| 1 | ln-310-multi-agent-validator | `Skill(skill: "ln-310-multi-agent-validator", args: "{id}")` |
| 2 | ln-400-story-executor | `Skill(skill: "ln-400-story-executor", args: "{id}")` |
| 3 | ln-500-story-quality-gate | `Skill(skill: "ln-500-story-quality-gate", args: "{id}")` |
## TodoWrite format (mandatory)
```text
- Phase 1: Resolve Story and business context (pending)
- Phase 2: Ask targeted business questions only if needed (pending)
- Phase 3: Setup pipeline runtime and worktree state (pending)
- Phase 4: Execute stage 0 -> 3 sequentially with ASSERT guards (pending)
- Phase 5: Write report, clean worktree, and finalize runtime state (pending)
- Phase 6: Run pipeline meta-analysis (pending)
TodoWrite 格式(必填):
{content: "Stage N: {name} (ln-NNN)", status: "pending", activeForm: "{verb}ing"}
关键规则
- **单个 Story 处理。**由用户选择要处理的 Story
- **通过 Skill 调用协调器。**Lead 通过 Skill 工具调用 ln-300/ln-310/ln-400/ln-500。每个协调器负责管理自己的内部 Worker 调度(Agent/Skill)
- **保持 Skills 原样。**绝不修改或绕过现有 Skill 逻辑
- **优先验证工件。**每次 Skill 调用后,先读取协调器工件,再重新读取看板作为次要断言。Lead 绝不在聊天状态中缓存阶段状态
- **质量循环限制。**每个 Story 最多允许 2 次质量 FAIL(原始版本 + 1 次返工)。第 2 次 FAIL 后,升级给用户处理
- **Worktree 生命周期。**ln-1000 在 Phase 3.4 创建 worktree。ln-500 负责分支最终化(提交、推送)。ln-1000 在 Phase 5 清理 worktree(Lead 位于 worktree 中,因此 ln-500 会跳过清理)
- **阶段备注。**Lead 在每个阶段后写入
.hex-skills/pipeline/stage_N_notes_{id}.md,用于 Pipeline 报告 - **检查点。**CLI 脚本在每个阶段后通过
node $PIPELINE checkpoint将按运行范围划分的运行时状态写入.hex-skills/pipeline/runtime/runs/{run_id}/
已知问题
| 症状 | 可能原因 | 自行恢复 |
|---|---|---|
| 长时间运行后 Lead 输出泛泛的文本 | 上下文压缩破坏了状态变量 | node $PIPELINE status -> 提取 resume_action -> 从那里继续 |
| ln-400 卡在同一任务上 | 任务陷入返工循环 | ln-400 在内部处理;返工 3 次后升级处理 |
反模式
- 执行后跳过质量门禁(Stage 3 紧接在 Stage 2 后面,不可能跳过)
- 将看板状态视为主要完成信号,而不是协调器工件
- 直接运行 mypy/ruff/pytest,而不是让协调器处理
- 未经用户选择就处理多个 Story
- 在 Phase 3.4 之外创建 worktree(协调器会自行检测 feature/*)
- 修改协调器的内部调度(ln-400 的 Agent/Skill 模式本身就是正确的)
计划模式支持
在计划模式下调用时,显示可用的 Story,并询问用户要为哪个 Story 制定计划:
- 解析看板(Phase 1 步骤 1-7)
- 显示可用的 Story 表格
- AskUserQuestion:「要为哪个 Story 制定计划?输入 # 或 Story ID。」
- 如果发现业务歧义,则执行 Phase 2(执行前问题)
- 解析
skill_repo_path—— skills 仓库根目录的绝对路径 - 显示所选 Story 的执行计划
- 按照下方格式将计划写入计划文件,并调用 ExitPlanMode
计划输出格式:
## Pipeline Plan for {date}
> **BEFORE EXECUTING -- MANDATORY READ:** Load `{skill_repo_path}/ln-1000-pipeline-orchestrator/SKILL.md` (full file).
> After reading SKILL.md, start from Phase 3 (Pipeline Setup) using the context below.
**Story:** {ID}: {Title}
**Current Status:** {status}
**Target Stage:** {N} ({skill_name})
**Storage Mode:** {file|linear}
**Project Brief:** {name} ({tech})
**Business Answers:** {answers from Phase 2, or "none"}
**Skill Repo Path:** {skill_repo_path}
### Execution Sequence
1. Read full SKILL.md + references (Phase 3 prerequisites)
2. Setup worktree + initialize CLI-managed pipeline state (Phase 3)
3. Execute stages sequentially via Skill() calls (Phase 4)
4. Generate pipeline report (Phase 5)
5. Cleanup worktree + state files (Phase 5)
完成定义(在 Phase 5 自行验证)
- 用户已选择 Story(已设置
state.story_id) - 业务问题已解决(已存储或跳过)
- Story 已处理至终态(
state.phase IN ("DONE", "PAUSED")) - 每个阶段的 ASSERT 验证均已通过(优先验证工件,看板为次要依据)
- 每个已完成阶段均已写入阶段备注
- 已生成 Pipeline 报告(文件位于
docs/tasks/reports/) - 已向用户显示 Pipeline 摘要
- 已清理 worktree(Phase 5 步骤 6)
- 已运行 Meta-Analysis(Phase 6)
Phase 6:Meta-Analysis
**必须阅读:**加载 和 references/phases/phase6_meta_analysis.md
Skill 类型:execution-orchestrator。根据请求,在 Phase 5 之后运行。Pipeline 专属实现(恢复映射、趋势跟踪、假设审计、报告格式)见 phase6_meta_analysis.md。
参考文件
Phase 4-6 流程(渐进式披露)
- Pipeline 流程:
references/phases/phase4_flow.md(ASSERT 守卫、阶段备注、上下文恢复、错误处理) - Meta-analysis:
references/phases/phase6_meta_analysis.md(恢复映射、趋势跟踪、报告格式)
Core Infrastructure
- MANDATORY READ: Load
references/git_worktree_fallback.md - MANDATORY READ: Load
references/research_tool_fallback.md - Pipeline states:
references/pipeline_states.md - Checkpoint format:
references/checkpoint_format.md - Kanban parsing:
references/kanban_parser.md - Kanban update algorithm:
references/kanban_update_algorithm.md - Settings template:
references/templates/settings_template.json - Sleep prevention:
references/scripts/hooks/prevent-sleep.ps1 - Environment state:
references/environment_state_contract.md - Storage mode operations:
references/storage_mode_detection.md - Auto-discovery patterns:
references/auto_discovery_pattern.md
Delegated Skills
../ln-300-task-coordinator/SKILL.md../ln-310-multi-agent-validator/SKILL.md../ln-400-story-executor/SKILL.md../ln-500-story-quality-gate/SKILL.md
Version: 3.0.0 Last Updated: 2026-03-19