mcpField
L
ln-1000-pipeline-orchestrator

ln-1000-pipeline-orchestrator

github.com/levnikolaevichエージェントワークフロー584360 回インストール2 日前に更新
リポジトリ

ln-1000-pipeline-orchestrator について

ln-1000-pipeline-orchestratorは、選択したStoryをタスク計画、検証、実行、品質ゲートの順に進めるスキルです。各段階の成果物を基準に状態を進め、再開、再試行、手戻り、レポート作成を扱います。

主な機能

  1. 01カンバンを解析してStoryを選択
  2. 02業務上の質問を一括収集
  3. 034つのコーディネーター段階を実行
  4. 04成果物を基に進行・復旧
  5. 05失敗、再試行、手戻りに対応
  6. 06パイプラインレポートを作成

活用シーン

  1. 01Storyをエンドツーエンドで処理
  2. 02中断したパイプラインを再開
  3. 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.md
references/
agent_skill_roots_contract.md
auto_discovery_pattern.md
checkpoint_format.md
environment_state_contract.md
epistemic_protocol.md
git_scope_detection.md
git_worktree_fallback.md
kanban_parser.md
kanban_update_algorithm.md
loop_health_contract.md
meta_analysis_protocol.md
pipeline_states.md
research_tool_fallback.md
references/phases/
phase4_flow.md
phase6_meta_analysis.md
references/scripts/coordinator-runtime/lib/
artifacts.mjs
cli-helpers.mjs
core.mjs
loop-health.mjs
runtime-constants.mjs
schemas.mjs
validate.mjs
references/scripts/coordinator-runtime/test/
cli-test-helpers.mjs
references/scripts/evaluation-runtime/
cli.mjs
references/scripts/evaluation-runtime/lib/
guards.mjs
store.mjs
references/scripts/hooks/
prevent-sleep.ps1
references/scripts/planning-runtime/lib/
cli.mjs
guards.mjs

詳細

パス: ファイルパス(references/、../ln-*)は、このスキルディレクトリからの相対パスです。

タイプ: L1 オーケストレーター カテゴリ: 1000 パイプライン

パイプラインオーケストレーター

選択した Story を、コーディネーターを単一のコンテキスト内で Skill() 呼び出しとして実行し、コーディネーターのステージ成果物に基づいて次の段階へ進みながら、タスク計画 -> 検証 -> 実行 -> 品質ゲートの全パイプラインを通して進行させます。

目的と範囲

  • カンバンボードを解析し、ユーザーが選択できる Story を表示します
  • 実行前にビジネス上の質問を一括で一度に尋ね、技術的な判断は自律的に行います
  • 選択した Story を4つのステージ(ln-300 -> ln-310 -> ln-400 -> ln-500)で進行させます
  • 報告と復旧のために、各ステージ後にステージノートとチェックポイントを書き込みます
  • 失敗、再試行、手戻りサイクル、ユーザーへのエスカレーションに対応します
  • ブランチ名、git 統計、エージェントレビュー情報を含むパイプラインレポートを生成します

階層

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 が1つあり、ユーザーがどれを処理するか選択する場合
  • タスク計画 -> 検証 -> 実行 -> 品質ゲートまでのエンドツーエンドの自動化が必要な場合
  • パイプラインレポートを使って 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)
ステージスキル入力ステータス出力ステータス
0ln-300-task-coordinatorBacklog(タスクなし)Backlog(タスク作成済み)
1ln-310-multi-agent-validatorBacklog(タスクあり)Todo
2ln-400-story-executorTodo / To ReworkTo Review
3ln-500-story-quality-gateTo ReviewDone / 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 を読み込みます。

  1. docs/tasks/kanban_board.md を自動検出します(またはストレージモードの操作を介して Linear API を使用します)
  2. 対象プロジェクトの CLAUDE.md(skills リポジトリではありません)からプロジェクト概要を抽出します:
    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" }
    
  3. すべてのステータスセクションを解析します:Backlog、Todo、In Progress、To Review、To Rework
  4. Story の一覧から以下を抽出します:ID、タイトル、ステータス、Epic 名、タスクの有無
  5. Done、Postponed、Canceled の Story は除外します
  6. Story ごとにタスクの有無を検出します:
    • _(tasks not created yet)_ がある -> タスクなし -> ステージ0
    • タスク行(インデント4つ)がある -> タスクあり -> ステージ1以降
  7. Story ごとの対象ステージを判定します(references/pipeline_states.md の「ステージとステータスの対応」を参照)
  8. 選択可能な Story を表示し、ユーザーに1つ選ぶよう尋ねます:
    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."
    
  9. 選択した 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:事前確認の質問(一括で一度に)
  1. 選択した Story の説明を読み込みます(メタデータのみ)
  2. ビジネス上の曖昧さを調べます。次のような質問が該当します:
    • コードベース、ドキュメント、規約から答えが見つからない
    • ビジネス/製品上の判断(決済プロバイダー、認証フロー、UI の好みなど)が必要
  3. ビジネス上の質問をすべて集め、1回の AskUserQuestion にまとめます
  4. 技術的な質問は project_brief を使って解決します:
    • ライブラリのバージョン:MCP Ref / Context7(project_brief.tech のエコシステム向け)
    • アーキテクチャパターン:project_brief.key_rules
    • 規約への準拠:ln-310 のフェーズ2で対応します

フェーズ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"(コーディネーターが起動するエージェントワーカーに必須)
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 Phase 1 step 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 = $!
Phase 4:パイプラインの実行

必ず読むこと: ASSERT ガード、ステージノート、コンテキストの復元、エラー処理については references/phases/phase4_flow.md を読み込みます。 必ず読むこと: チェックポイントのスキーマについては 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: 詳細をユーザーに警告

2. ステージノートを読み込む

stage_notes = {} FOR N IN 0..3: IF .hex-skills/pipeline/stage_{N}notes{id}.md が存在する: stage_notes[N] = ファイルの内容を読み込む ELSE: stage_notes[N] = "(メモは記録されていません)"

3. ブランチ情報を抽出

branch_name = git branch --show-current git_stats_final = git diff --stat origin/{base_branch}..HEAD (まだ取得していない場合)

4. パイプラインレポートを確定

durations = {N: stage_timestamps.stage_{N}end - stage_timestamps.stage{N}_start FOR N IN 0..3 IF 両方のタイムスタンプが存在する}

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)

判定準備状況エージェントレビュー所要時間
{verdict}{score}/10{agents_info}{durations[1]}

{stage_notes[1]}

実装(ln-400)

状態ファイル行数所要時間
{result}{files_changed}+{added}/-{deleted}{durations[2]}

{stage_notes[2]}

品質ゲート(ln-500)

判定スコアエージェントレビュー再作業所要時間
{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 が存在 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 表示:"部分的な作業をブランチ {branch}(リモート)に保存しました。ワークツリーをクリーンアップしました。" IF final_state == "DONE" AND worktree_dir が存在 AND worktree_dir != project_root:

ln-500 は Phase 7 でコミットおよびプッシュ済み。ワークツリーのみクリーンアップします。

git worktree remove {worktree_dir} --force

7. スリープ防止を停止する(Windows)

IF sleep_prevention_pid: kill $sleep_prevention_pid 2>/dev/null || true

8. パイプラインの状態ファイルを削除する

Delete .hex-skills/pipeline/ directory

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"}

重要なルール

  1. 単一のストーリーを処理します。 ユーザーが処理するストーリーを選択します
  2. スキル経由でコーディネーターを呼び出します。 リードは Skill ツール経由で ln-300/ln-310/ln-400/ln-500 を呼び出します。各コーディネーターは独自の内部ワーカーのディスパッチ(Agent/Skill)を管理します
  3. スキルはそのまま使用します。 既存のスキルロジックを変更したり、迂回したりしないでください
  4. 成果物を優先して検証します。 Skill を呼び出すたびに、まずコーディネーターの成果物を読み、カンバンは二次的な確認としてのみ再読します。リードはチャットの状態にステージの事実をキャッシュしません
  5. 品質サイクルの上限。 1 つのストーリーにつき、品質 FAIL は最大 2 回(初回+1 回の再作業)です。2 回目の FAIL の後はユーザーにエスカレーションします
  6. ワークツリーのライフサイクル。 ln-1000 はフェーズ 3.4 でワークツリーを作成します。ブランチの最終処理(コミット、プッシュ)は ln-500 が行います。ワークツリーのクリーンアップはフェーズ 5 で ln-1000 が行います(リードはワークツリー内にいるため、ln-500 はクリーンアップをスキップします)
  7. ステージノート。 パイプラインレポート用に、リードは各ステージの後に .hex-skills/pipeline/stage_N_notes_{id}.md を書き込みます
  8. チェックポイント。 CLI スクリプトは各ステージの後に node $PIPELINE checkpoint を使って、実行単位のランタイム状態を .hex-skills/pipeline/runtime/runs/{run_id}/ に書き込みます

既知の問題

症状考えられる原因自動復旧
長時間の実行後、リードが一般的なテキストを出力するコンテキストの圧縮によって状態変数が失われたnode $PIPELINE status を実行 -> resume_action を抽出 -> そこから続行
ln-400 が同じタスクで停滞するタスクが再作業ループに入っているln-400 が内部で処理し、再作業 3 回後にエスカレーションします

アンチパターン

  • 実行後に品質ゲートをスキップする(ステージ 3 はステージ 2 の次の行のため、スキップできません)
  • コーディネーターの成果物ではなく、カンバンの状態を主な完了シグナルとして扱う
  • コーディネーターに任せず、mypy/ruff/pytest を直接実行する
  • ユーザーの選択なしに複数のストーリーを処理する
  • フェーズ 3.4 以外でワークツリーを作成する(コーディネーターは feature/* を自動検出します)
  • コーディネーターの内部ディスパッチを変更する(ln-400 の Agent/Skill パターンはそのままで正しい)

プランモードのサポート

プランモードで呼び出された場合は、利用可能なストーリーを表示し、どれを計画するかユーザーに尋ねます。

  1. カンバンボードを解析します(フェーズ 1 の手順 1~7)
  2. 利用可能なストーリーの表を表示します
  3. AskUserQuestion:「どのストーリーを計画しますか?番号またはストーリー ID を入力してください。」
  4. ビジネス上の曖昧さが見つかった場合は、フェーズ 2(事前確認の質問)を実行します
  5. skill_repo_path を解決します -- スキルリポジトリのルートへの絶対パス
  6. 選択したストーリーの実行計画を表示します
  7. 計画を計画ファイルに書き込み(以下の形式を使用)、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)

完了の定義(フェーズ 5 で自己検証)

  • ユーザーがストーリーを選択した(state.story_id が設定されている)
  • ビジネス上の質問を解決した(保存済み、またはスキップ)
  • ストーリーを最終状態まで処理した(state.phase IN ("DONE", "PAUSED"))
  • 各ステージの ASSERT 検証に合格した(成果物を優先し、カンバンは二次的に確認)
  • 完了した各ステージのステージノートを作成した
  • パイプラインレポートを生成した(docs/tasks/reports/ にファイルが存在する)
  • パイプラインの概要をユーザーに表示した
  • ワークツリーをクリーンアップした(フェーズ 5 の手順 6)
  • メタ分析を実行した(フェーズ 6)

フェーズ 6:メタ分析

必須の読み込み: と references/phases/phase6_meta_analysis.md を読み込みます

スキルタイプ:execution-orchestrator。要求された場合は、フェーズ 5 の後に実行します。復旧マップ、傾向の追跡、前提条件の監査、レポート形式など、パイプライン固有の実装については phase6_meta_analysis.md を参照してください。

参照ファイル

フェーズ 4~6 の手順(段階的な開示)
  • パイプラインの流れ: references/phases/phase4_flow.md(ASSERT ガード、ステージノート、コンテキストの復旧、エラー処理)
  • メタ分析: 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

コメント