Skip to content

docs: 運用単位別の詳細設計書 (workflows/*-design.md) を導入する #422

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "docs/dev/workflows/ ディレクトリを新設し、issue-refinement-loop と impl-review-loop の詳細設計書を 14 セクション構造で作成する"
change_kind: docs

Parent Issue

none(単独改善)

Parent Goal Ref

  • Goal: 運用単位別の詳細設計書 (workflows/*-design.md) を導入し、「なぜこの構造か」「planner 責務境界」「human escalation 条件」などの運用判断を設計書で説明できる状態にする
  • Desired Destination: N/A(単独 Issue)

Current Validated Scope

  • docs/dev/workflows/ ディレクトリを新設(README または index ノート含む)
  • docs/dev/workflows/issue-refinement-loop-design.md を 14 セクション構造で作成(SubAgent 全文を含まない、Contract Matrix のみ)
  • docs/dev/workflows/impl-review-loop-design.md を 14 セクション構造で作成(SubAgent 全文を含まない、Contract Matrix のみ)
  • docs/dev/workflow.md の Routing Table または docs 更新ルールに docs/dev/workflows/*.md への参照を追加
  • docs/dev/ssot-registry.md に docs/dev/workflows/ エントリを追加(ssot_classification: derived_design_note として)
  • .claude/skills/ssot-discovery/ の対応するパス参照を更新(必要な場合のみ。詳細はファイル探索で決定)

Remaining Parent Gaps

なし(本 Issue で対象 2 ループ分の詳細設計書が完成)

Outcome

docs/dev/workflows/ ディレクトリに issue-refinement-loop-design.md と impl-review-loop-design.md の 2 ファイルが 14 セクション構造で作成され、各設計書は ssot_classification: derived_design_note かつ conflict_rule: canonical_sources_win を frontmatter に持ち、独立の ## Authority Map セクションを含む。docs/dev/workflow.md から参照が張られ、docs/dev/ssot-registry.md に derived_design_note として登録された状態で、pnpm typecheck && pnpm lint && pnpm test && pnpm build が PASS している。

Background

個人趣味開発の自作エージェントスキル運用において、ChatGPT に運用設計レビューを依頼した結果、以下が判明した:

  • 現状 docs/dev/workflow.md は SSoT として「SSOT → Skill/SubAgent → Hooks/CI」三層分離を定義済みで方向性は妥当
  • ただし issue-refinement-loop / impl-review-loop は既に状態機械・委譲・判定・停止条件・証跡管理を持つ「運用システム」化しており、SKILL.md だけでは「なぜこの構造か」「planner 責務境界」「human escalation 条件」などの運用判断ができない
  • 詳細設計書を増やすべき。ただし SSOT を増やすのではなく、workflow.md 配下に「運用単位別 詳細設計ノート」として派生文書(derived_design_note)として置くべき
  • SubAgent 定義の実体は含めず、Contract Matrix(role / input / output / allowed mutation / failure signal) のみ含める
  • split-brain 防止のため、各設計書は YAML frontmatter で conflict_rule: canonical_sources_win を宣言し、独立の ## Authority Map セクションで「何を参照するか / 何を書いてよいか / 何を書いてはいけないか」を明示する

issue-refinement-loop-design.md で扱う設計判断:

  • planner が正本、orchestrator は prose 再判定しない
  • web research は opaque に扱う
  • anchor comment の raw snapshot を writer に直接流さない
  • scope change signal で停止する条件
  • follow-up materialization の dedupe key
  • state/blocked / state/queued hygiene の範囲
  • max_iterations=1 の理由
  • human escalation 分類表

impl-review-loop-design.md で扱う設計判断:

  • control-plane / data-plane 境界
  • CONTRACT_REVIEW_RESULT_V1 を作業計画正本として扱う理由
  • LOOP_STATE の field owner
  • product_spec_preflight の routing table
  • external_research_skip_basis の記録規則
  • PR conflict / dirty / blocked 時の escalation 方針

In Scope

  1. docs/dev/workflows/ ディレクトリの新設
  2. 以下 2 本の詳細設計書を作成(優先順):
    • docs/dev/workflows/issue-refinement-loop-design.md
    • docs/dev/workflows/impl-review-loop-design.md
  3. 各設計書のテンプレートとして以下 14 セクションを採用:
    Status / Purpose / Non-goals / Invocation Contract / Workflow Topology / State Model / SubAgent Contract Matrix / Artifact and Evidence Contract / Context Loading Policy / Guardrails / Failure Modes and Recovery / Observability / Verification Plan / Change Management
  4. docs/dev/workflow.md の docs 更新ルールに「運用単位の状態機械・契約変更は docs/dev/workflows/*.md」を追加(Routing Table 更新のみ、本文の詳細は記載しない)
  5. docs/dev/ssot-registry.md に docs/dev/workflows/ エントリを追加(ssot_classification: derived_design_note として)
  6. .claude/skills/ssot-discovery/ の対応するパス参照を更新(必要な場合のみ)

Out of Scope

  • 全 Skill に対する詳細設計書作成(edit-issue / open-pr 等の単発手順は SKILL.md + references で十分)
  • SubAgent 定義全文 / SKILL.md 手順全文 / .claude/agents/*.md 本文を設計書にコピーすること(SSoT 分裂を招く)
  • workflow.md 本体への詳細追記
  • 既存 SKILL.md の構造変更(本 Issue は docs-only)

Acceptance Criteria

Runtime Verification Applicability

  • classification: not_applicable
  • reason: docs-only 変更で runtime behavior を変更しない。VC は静的存在確認 + 既存品質ゲート (pnpm typecheck/lint/test/build) のみ。

Verification Commands

# AC1
test -d docs/dev/workflows

# AC2
test -f docs/dev/workflows/issue-refinement-loop-design.md

# AC3
test -f docs/dev/workflows/impl-review-loop-design.md

# AC4
# preflight-scope: pr_review_only
rg -l 'docs/dev/workflows' docs/dev/workflow.md

# AC6 (regression gates: 個別実行で baseline pass を期待)
pnpm typecheck
pnpm lint
pnpm test
pnpm build

# AC7/AC8 — Authority Map / SSOT 分類 / Context Loading Policy のキー存在確認
# preflight-scope: pr_review_only
rg -n "^## Authority Map$" docs/dev/workflows/issue-refinement-loop-design.md docs/dev/workflows/impl-review-loop-design.md
# preflight-scope: pr_review_only
rg -n "design_doc_schema_version|ssot_classification|canonical_sources|conflict_rule|loaded_when|not_loaded_when|summary_budget" docs/dev/workflows/issue-refinement-loop-design.md docs/dev/workflows/impl-review-loop-design.md

# AC9 — Contract Matrix 拡張列の存在確認
# preflight-scope: pr_review_only
rg -n "Producer.*Consumer.*Schema|Fields read by orchestrator|Opaque forwarded fields|Must-not-read fields|Mutation owner|Failure class|Verification fixture" docs/dev/workflows/issue-refinement-loop-design.md docs/dev/workflows/impl-review-loop-design.md

# AC2/AC3 — 14 セクション存在
# preflight-scope: pr_review_only
rg -n "^## (Status|Purpose|Non-goals|Invocation Contract|Workflow Topology|State Model|SubAgent Contract Matrix|Artifact and Evidence Contract|Context Loading Policy|Guardrails|Failure Modes and Recovery|Observability|Verification Plan|Change Management)$" docs/dev/workflows/issue-refinement-loop-design.md docs/dev/workflows/impl-review-loop-design.md

# AC5/AC13 — SubAgent 全文の非複製チェック(実体への参照リンクが末尾にある)
# preflight-scope: pr_review_only
rg -n "\.claude/agents/|\.claude/skills/" docs/dev/workflows/issue-refinement-loop-design.md docs/dev/workflows/impl-review-loop-design.md

# AC10 — ssot-registry に新規エントリ
# preflight-scope: pr_review_only
rg -n "docs/dev/workflows" docs/dev/ssot-registry.md

Allowed Paths

  • docs/dev/workflows/**
  • docs/dev/workflow.md
  • docs/dev/ssot-registry.md
  • .claude/skills/ssot-discovery/**

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

なし

Scope Delta(任意)

Delivery Rule

  • 1 Issue = 1 PR
  • docs-only 変更のため Draft PR 不要
  • pnpm typecheck && pnpm lint && pnpm test && pnpm build を PR 前に必ず通す

References

関連 Issue:

外部参考:

Activity

  1. added
    docs
    area/docs
    area/ai-ops
    phase/implementation
    on May 27, 2026
  2. squne121 commented on May 27, 2026

    @squne121
    OwnerAuthor

    you asked

    message time: 2026-05-27 23:07:59

    個人趣味開発で自作エージェントスキルを作って運用している。
    https://github.com/squne121/loop-protocol/tree/main/.claude/skills/impl-review-loop
    https://github.com/squne121/loop-protocol/tree/main/.claude/skills/issue-refinement-loop

    運用設計書を作成してSSoTとして運用しているが、Issueレビュー、実装レビューなど大まかな運用単位ごとの詳細設計書は書いたほうがいいか?サブエージェント定義はその設計書に含めるべき?
    また書いた方がいい場合、AI駆動開発におけるモダンな運用詳細設計書とはどのようなものがいいか教えて。
    https://github.com/squne121/loop-protocol/blob/main/docs/dev/workflow.md


    chatgpt response

    まず既存の workflow.md と2つの skill 定義を確認し、現在のSSoTと重複しない粒度を切り分けます。あわせて、最近のエージェント運用・スキル設計の一次情報に照らして提案します。

    確認した範囲では、すでに「SSOT → Skill/SubAgent → Hooks/CI」の三層分離と、Skill/SubAgentの責務境界はかなり明確です。論点は「さらに詳細設計書を増やすか」ではなく、「SKILL.mdに肥大化している運用知識を、どの文書に逃がすか」です。

    結論: 書いた方がいいです。ただし、SSOTを増やすのではなく、workflow.md 配下の「運用単位別 詳細設計」として置くべきです。

    現状の workflow.md は、すでに「SSOT → Skill/SubAgent → Hooks/CI」という三層構造を定義しており、workflow.md を正本、Skill/SubAgent を実行コンテキスト、Hooks/CI を物理強制層として分けています。これは方向性として妥当です。 また、AI向け手順は背景説明を抱え込まず progressive disclosure を優先すると明記されています。

    1. 詳細設計書は必要か

    必要です。理由は、issue-refinement-loop と impl-review-loop は単なるプロンプトではなく、すでに 状態機械・委譲・判定・停止条件・証跡管理を持つ運用システム になっているためです。

    特に issue-refinement-loop は thin entrypoint 化され、planner / reviewer / worker の判定を再実装しない設計になっています。 これは SKILL.md を実行入口に限定する良い設計ですが、逆に「なぜこの構造なのか」「どこまでが planner の責務か」「どの失敗を human escalation にするか」は、SKILL.md だけでは運用判断しづらくなります。

    impl-review-loop も control-plane に責務を限定し、implementation / verification / PR review を SubAgent に委譲する設計です。 LOOP_STATE、終了条件、contract snapshot、product spec gate まで持っており、これは詳細設計書の対象です。

    したがって、書くべき対象は「全Skill」ではなく、次の条件を満たす運用単位です。

    書くべき対象 理由
    issue-refinement-loop planner / web research / codebase investigation / issue rewrite / follow-up materialization を横断する
    impl-review-loop 実装、検証、PR review、loop termination、contract snapshot を横断する
    issue-contract-review 実装着手 gate の正本に近い
    pr-review-judge APPROVE / REQUEST_CHANGES の判定基準が運用品質に直結する
    web-researcher / gemini-cli-headless-delegation 外部調査失敗時の fallback / retry / evidence contract が重要なら対象

    逆に、edit-issue や open-pr のような単発手順は、SKILL.md と references で十分です。

    2. SubAgent定義は詳細設計書に含めるべきか

    実体は含めない。契約だけ含める。

    現在の agent-skill-boundaries.md は、SubAgent定義に詳細手順を書くとコンテクスト汚染になるため、この文書を正本にすると明記しています。 また、SubAgent = 役割、Skill = 作業手順という責務分離も定義済みです。

    そのため、詳細設計書に含めるべきなのは以下です。

    ## SubAgent Contract Matrix
    
    | SubAgent | Role | Called by | Allowed mutation | Required output | Failure signal |
    |---|---|---|---|---|---|
    | issue-reviewer | read-only issue quality judge | issue-refinement-loop Step 2 | none | REVIEW_ISSUE_RESULT_V1 | status != ok |
    | issue-author | issue body writer | issue-refinement-loop Step 4 | gh issue edit | EDIT_ISSUE_RESULT_V1 | human_review_required |
    | implementation-worker | implementation executor | impl-review-loop Step 1 | code / tests / PR | IMPLEMENT_RESULT_V1 | human_review_required |
    | test-runner | verification executor | impl-review-loop Step 2 | PR comment only | TEST_VERDICT_MACHINE v1 | failed / inconclusive |
    | pr-reviewer | PR judge | impl-review-loop Step 4 | review comment only | LOOP_VERDICT | REQUEST_CHANGES |

    一方で、以下は詳細設計書にコピーしない方がいいです。

    • .claude/agents/*.md の全文
    • permissionMode の実体定義全文
    • SubAgent のプロンプト本文
    • SKILL.md の手順全文
    • references の長文再掲

    これらをコピーすると、SSOTが分裂します。詳細設計書では 「この運用単位におけるインターフェース」 だけを定義し、実体は .claude/agents/ と .claude/skills/ にリンクするのがよいです。

    Claude Code の公式ドキュメント上も、SubAgent は独立した context window、個別 system prompt、tool access、permissions を持つものとして扱われます。(Claude API Docs) また、SubAgent には tools、disallowedTools、permissionMode、skills などの frontmatter があり、Skill の preload も可能ですが、preload すると full content が context に入るため、契約と実体の分離は重要です。(Claude API Docs)

    3. 置き場所

    おすすめはこれです。

    docs/dev/workflows/
      issue-refinement-loop-design.md
      impl-review-loop-design.md
      issue-contract-review-design.md
      pr-review-judge-design.md
    

    または、より運用色を強めるなら:

    docs/dev/operations/
      issue-refinement-loop.md
      implementation-review-loop.md
      pr-review.md
      issue-contract-review.md
    

    workflow.md には詳細を書き足さず、Routing Table にだけ追加するのがよいです。すでに workflow.md には「AI向け実行手順の変更は .claude/skills/ / .claude/agents/」「SubAgent / Skill 責務境界の変更は agent-skill-boundaries.md」という docs 更新ルールがあります。 ここに「運用単位の状態機械・契約変更は docs/dev/workflows/*.md」を追加する形が自然です。

    4. モダンなAI駆動開発の詳細設計書の形

    AI駆動開発では、詳細設計書は「人間向け説明書」では足りません。人間が読める運用設計 + AIが参照できる契約 + 検証可能なガードレール設計 の三点セットにするべきです。

    テンプレートは以下がよいです。

    # <Workflow Name> Operational Design
    
    ## 1. Status
    - status: active | experimental | deprecated
    - owner: docs/dev/workflows/<file>
    - implementation entrypoint: .claude/skills/<skill>/SKILL.md
    - related agents:
    - related scripts:
    - related CI / hooks:
    - last reviewed:
    
    ## 2. Purpose
    この運用単位が解決する問題。
    何を自動化し、何を人間判断に残すか。
    
    ## 3. Non-goals
    やらないこと。
    他Skill / 他SubAgent / 他Issueに逃がすこと。
    
    ## 4. Invocation Contract
    - user trigger
    - required inputs
    - optional inputs
    - preconditions
    - hard stop conditions
    - expected final output
    
    ## 5. Workflow Topology
    prompt chaining / routing / orchestrator-workers / evaluator-optimizer のどれか。
    必要なら Mermaid で state machine を書く。
    
    ## 6. State Model
    LOOP_STATE / REVIEW_RESULT / CONTRACT_RESULT などの schema。
    field owner と mutation timing を明記する。
    
    ## 7. SubAgent Contract Matrix
    SubAgentの全文ではなく、role / input / output / allowed mutation / failure signal の表だけ。
    
    ## 8. Artifact and Evidence Contract
    Issue comment、PR body、PR comment、log、trace、test result、script output の保存先。
    machine-readable marker 名もここで定義する。
    
    ## 9. Context Loading Policy
    - SKILL.md に常時置くもの
    - references/ に逃がすもの
    - scripts/ に落とすもの
    - auto-load 禁止のもの
    - stale snapshot 判定
    
    ## 10. Guardrails
    - deterministic script
    - hook
    - git hook
    - CI
    - schema validation
    - fail-close 条件
    
    ## 11. Failure Modes and Recovery
    - auth_error
    - stale issue body
    - conflicting PR
    - test inconclusive
    - web research unavailable
    - max iteration exceeded
    - human escalation
    
    ## 12. Observability / Session Recording
    - run id
    - issue number
    - PR number
    - iteration
    - subagent result
    - command result
    - trace/log location
    - replay procedure
    
    ## 13. Verification Plan
    - golden issue fixtures
    - golden PR fixtures
    - regression tests
    - smoke commands
    - adversarial cases
    - expected failure cases
    
    ## 14. Change Management
    この文書、SKILL.md、SubAgent、scripts、hooks、CI のどれを同一PRで更新すべきか。

    5. 既存設計への具体的な当てはめ

    issue-refinement-loop-design.md

    これは最優先で作る価値があります。理由は、現SKILLがすでに thin entrypoint で、詳細を references に分離しているためです。

    この設計書では、特に以下を定義するとよいです。

    • planner が正本で、orchestrator は prose 再判定しない
    • web research は opaque に扱う
    • anchor comment は raw snapshot を直接 writer に流さない
    • scope change signal で停止する条件
    • follow-up materialization の dedupe key
    • state/blocked / state/queued hygiene の範囲
    • max_iterations=1 の理由
    • human escalation の分類表

    impl-review-loop-design.md

    こちらも必要です。ただし、impl-review-loop は現状 SKILL.md に状態管理・Product Spec Gate・Contract Snapshot 参照ルールまで比較的多く入っています。 今後肥大化するなら、設計意図は docs 側、実行順序は SKILL 側に逃がした方がよいです。

    特に以下を設計書に移す候補です。

    • control-plane / data-plane 境界
    • CONTRACT_REVIEW_RESULT_V1 を作業計画の正本として扱う理由
    • LOOP_STATE の field owner
    • product_spec_preflight の routing table
    • external_research_skip_basis の記録規則
    • max_iterations の fail-close 方針
    • PR conflict / dirty / blocked 時の escalation 方針
    • AI駆動プレイテスト証跡、ログ設計、検証コマンド証跡

    impl-review-loop/steps/context-protocol-and-guardrails.md には、各Step完了直後に LOOP_STATE を記録し、SubAgent出力を構造化フォーマットで受け取る方針が定義されています。 これは詳細設計書の「State Model」「Artifact and Evidence Contract」に昇格させる価値があります。

    6. 設計思想として押さえるべきこと

    Anthropic は、成功する agentic system は複雑な framework よりも simple / composable pattern を使う傾向があり、複雑性は必要になったときだけ増やすべきだと述べています。(Anthropic) その観点では、あなたの現行設計は「巨大な自律Agent」ではなく、orchestrator-workers と evaluator-optimizer を小さく組み合わせているため、方向性はよいです。

    また、coding agent は自動テストで検証でき、テスト結果を feedback として反復できるため agent 適性が高い一方、人間レビューは broader system requirements の整合確認として必要です。(Anthropic) これはあなたの「AIが仕組み・定量検証、人間がUX・感情・最終判断」という方針と整合します。

    GitHub Spec Kit も、仕様を static docs ではなく living / executable artifact とし、spec を source of truth として実装・checklist・task breakdown を駆動する設計を示しています。(The GitHub Blog) その意味で、詳細設計書も「読まれるだけの文書」ではなく、Skill、SubAgent、script、hook、CI の更新先を明示する operational contract にするべきです。

    7. 最終判断

    あなたのリポジトリでは、次の方針が最もよいです。

    1. workflow.md はトップレベルSSOTのまま維持する。
    2. 運用単位ごとの詳細設計書を docs/dev/workflows/ に追加する。
    3. SubAgent定義の全文は含めず、SubAgent Contract Matrix だけ含める。
    4. SKILL.md は executable entrypoint と routing に絞る。
    5. references は詳細手順、scripts は決定論的判定、docs は設計判断の置き場にする。
    6. 詳細設計書には observability / session recording / failure mode / eval を必ず含める。

    最初に作るなら、順番はこの2つです。

    docs/dev/workflows/issue-refinement-loop-design.md
    docs/dev/workflows/impl-review-loop-design.md
    

    この2つを作るだけで、現在の運用で一番事故りやすい「判定責務の越境」「SubAgentへの過剰委譲」「SKILL.md肥大化」「証跡不足」を抑えられます。

  3. squne121 commented on May 27, 2026

    @squne121
    OwnerAuthor

    you asked

    message time: 2026-05-27 22:01:58

    https://arxiv.org/abs/2512.08296 の観点から
    https://github.com/squne121/loop-protocol/tree/main/.claude%2Fskills%2Fimpl-review-loop と https://github.com/squne121/loop-protocol/tree/main/.claude%2Fskills%2Fissue-refinement-loop のエージェントスキルの実装を評価してください。

    エージェントスキルを評価するため https://github.com/squne121/loop-protocol/blob/main/docs%2Fdev%2Fsession-recording-policy.md の整備を開始している。

    個人趣味開発であり、運用開発の趣味のため評価のためにAIエージェントのトークンを消費するのは避けたい。
    また作業品質の最大化よりもフロンティアモデルを単純・決定論的な作業に使わないコストパフォーマンスを最大化したい。


    chatgpt response

    論文側の主張、対象スキルの実装、session-recording-policy の現状を突き合わせて評価します。公開 arXiv と GitHub の現物を確認し、最後に「趣味開発でトークン消費を抑える」前提で優先度を切ります。


    chatgpt response

    現時点の読みでは、両スキルとも「中央集権的な verifier / planner に寄せる」方向で、論文の失敗パターン回避にはかなり寄っています。一方で、評価ログ設計はまだ「再現可能な比較実験」より「人間が読める運用証跡」に寄りすぎている可能性があります。

    結論

    arXiv:2512.08296 の観点では、現状の impl-review-loop と issue-refinement-loop は 「エージェント数を増やして品質を上げる」設計ではなく、「必要な場合だけ専門サブエージェントを呼び、中央の薄い control-plane が routing する」設計になっており、論文の主張とはかなり整合しています。

    特に論文は、エージェント協調は常に有利ではなく、単体エージェント性能が高い場合は協調の限界効用が下がり、tool-heavy task では multi-agent overhead が出やすく、中央検証なしの構成はエラー伝播しやすい、と述べています。(arXiv)
    この前提に立つと、あなたの方針である 「趣味開発なので、フロンティアモデルを単純・決定論的作業に使わず、トークン費用対効果を最大化する」 は妥当です。

    評価は以下です。

    対象 評価 理由
    issue-refinement-loop A- thin entrypoint / planner SSOT / max_iterations=1 / conditional research が論文の方向性に合う
    impl-review-loop B+ 中央 PR review 判定と fail-close は良いが、実装→検証→レビューの反復は token 消費が膨らみやすい
    session-recording-policy B Secret / transcript 漏洩制御は強いが、agent skill 評価用の最小 manifest としてはまだ重い・評価軸が不足

    論文から見た設計原則

    この論文から引ける実務上の示唆は、次の 4 点です。

    1. multi-agent は分解可能タスクには効くが、逐次計画や tool-heavy task では悪化しうる。
      論文は、構成によって単一エージェント比で +80.8% から -70.0% まで振れるとし、architecture-task alignment が重要だとしています。(arXiv)

    2. 中央検証・中央調停が重要。
      中央検証を持たない architecture はエラー伝播しやすい、という主張があるため、サブエージェントに judgment を分散しすぎる設計は危険です。(arXiv)

    3. 高性能単体モデルが十分な場合、協調の追加価値は逓減する。
      趣味開発では特に、レビュー用・調査用・実装用に毎回 frontier model を複数起動するより、deterministic script / schema validation / grep / pytest に寄せる方が合理的です。

    4. 評価には「作業成功」だけでなく「協調 overhead」を記録すべき。
      単に「最終的に approve した」だけでは不十分で、何回 subagent を呼んだか、どこで retry したか、人間がどこで介入したか、外部調査を本当に使ったか、を最小限で記録する必要があります。


    issue-refinement-loop 評価

    issue-refinement-loop は、かなり良いです。

    この skill は、plan_refinement_loop.py が生成する REFINEMENT_LOOP_PLAN_V1 を consume し、判定ロジックを再実装しない設計になっています。
    また、本文でも control-plane 専用の thin entrypoint と明記し、詳細 procedure は references/ を必要時だけ読む progressive disclosure にしています。

    これは論文の観点では強いです。理由は、LLM に毎回「判断」させるのではなく、planner / reviewer / worker の責務境界を固定し、orchestrator は routing だけを行うためです。

    さらに max_iterations の既定が 1 で、needs-fix の場合も追加反復ではなく needs_second_pass に逃がす構造になっています。
    趣味開発のコスト最適化としては、この設計が最も重要です。Issue 本文改善は「2 回目の AI 改善」が費用対効果で急速に落ちやすいため、既定 1 回は妥当です。

    特に良い点は以下です。

    設計 評価
    plan_refinement_loop.py を SSOT にする LLM 判断の再実行を避けられる
    Web research を conditional にする 外部調査 token を抑制できる
    WEB_RESEARCH_RESULT_V1 を opaque に扱う orchestrator が余計な再解釈をしない
    max_iterations=1 趣味開発の費用対効果に合う
    scope change で human escalation 自動改善が scope creep を起こすリスクを抑える

    弱点は、評価ログが「なぜ 1 回で止めたか」を後から比較可能な形で残す設計がまだ薄いことです。LOOP_STATE には policy や result はありますが、評価研究的には次が不足します。

    agent_eval_summary:
      task_kind: issue_refinement
      architecture: centralized_planner_with_conditional_workers
      frontier_model_calls: 0 | 1 | 2 | ...
      deterministic_checks_run: []
      subagents_invoked: []
      skipped_subagents:
        - name: web-researcher
          reason_code: internal_only | no_external_claim | low_value
      final_outcome: approved | needs_second_pass | human_escalation
      human_minutes_estimate: null
      token_cost_class: none | low | medium | high

    実 token 数を正確に取らなくても、token_cost_class と subagents_invoked だけで十分です。趣味開発なら、まずはこの粒度でよいです。


    impl-review-loop 評価

    impl-review-loop は、実装系ループとしては堅いですが、費用対効果の観点では issue-refinement-loop より危険です。

    この skill は、implementation child issue を 実装 → 検証 → PR review の 3 ステップループで完了させる orchestrator と定義されています。
    実際の loop は implementation-worker、test-runner、pr-reviewer を順に呼び、LOOP_VERDICT が APPROVE なら終了、REQUEST_CHANGES なら Step 1 に戻る構造です。

    論文の観点では、これは 中央集権 verifier 付き multi-agent に近く、分散的な agent 群より安全です。pr-reviewer の LOOP_VERDICT を単一の終了判定にしている点も、中央検証の観点では妥当です。

    ただし、実装タスクは tool-heavy になりやすいです。Git 操作、テスト、lint、PR 作成、差分確認、mergeability 確認が絡むため、論文が指摘する multi-agent overhead の対象に入りやすいです。(arXiv)

    良い点は以下です。

    設計 評価
    max_iterations 既定 5 + fail-close 無限修正を防げる
    contract snapshot を正本化 実装中の仕様揺れを抑えられる
    VC preflight を再実行せず snapshot 参照 deterministic 結果の再利用として良い
    product spec gate を mutation-free CLI に分離 LLM 判断ではなく script routing に寄せている
    SubAgent 出力を YAML / KEY=VALUE として扱う 散文解釈による drift を抑えられる

    懸念は 3 つあります。

    1. max_iterations=5 は趣味開発には高い

    実装ループで frontier model を使うなら、5 回は費用対効果が悪化しやすいです。論文の「coordination の逓減」と整合しません。

    推奨は以下です。

    max_iterations:
      default: 2
      allow_override: true
      hard_cap: 5

    個人趣味開発では、2 回で通らない PR は設計・Issue・AC が悪い可能性が高いです。3 回目以降は agent に続けさせるより、人間が Issue contract を見直す方が安いです。

    2. test-runner は原則 deterministic に寄せるべき

    test-runner SubAgent が LLM 的に「確認しました」と判断する構造だと、tool-heavy overhead と hallucinated verification のリスクがあります。ここはできるだけ以下に寄せるべきです。

    verification:
      primary: deterministic_commands
      allowed:
        - pnpm typecheck
        - pnpm lint
        - pnpm test
        - pnpm build
        - uv run pytest ...
      llm_summary: optional
      llm_verdict: prohibited

    LLM はログの要約だけでよく、pass/fail の正本は exit code と machine-readable output にするべきです。

    3. PR review を毎回 frontier model に任せる必要はない

    pr-reviewer の LOOP_VERDICT は中央検証として良いですが、すべての PR で重い review をする必要はありません。

    推奨 routing は以下です。

    review_tier:
      tier0_deterministic:
        when: only_docs_or_skill_text_and_schema_tests_pass
        action: skip_frontier_pr_review
      tier1_small_model_review:
        when: bounded_markdown_or_script_change
        action: run_structural_review_only
      tier2_frontier_review:
        when: code_path_changes or security/routing/automation changes
        action: run_pr-reviewer

    この方が、論文の architecture-task alignment に合います。


    session-recording-policy 評価

    session-recording-policy は、現状では 評価基盤というより、記録・公開・Secret 漏洩制御ポリシーです。

    本文書は session_recording_policy/v1 YAML と Kill Switch 手順の SSOT として定義され、secrets_mode が none 以外に遷移した場合の session 記録制御と Kill Switch 手順を定めています。
    また、公開 GitHub コメントには session metadata summary のみを置き、raw transcript / local_file を禁止する設計になっています。(GitHub)

    これは安全面では正しいです。特に、全 mode で public full transcript を禁止し、checkpoint branch / token / public surface / secret scan を kill switch trigger にしている点は、公開リポジトリ運用として妥当です。(GitHub)

    ただし、agent skill 評価用としては不足があります。

    不足しているのは raw transcript ではなく、以下のような 低コスト manifest です。

    agent_session_manifest/v1:
      task_id: "issue-418"
      skill: impl-review-loop | issue-refinement-loop
      task_kind: implementation | issue_refinement | review | research
      architecture:
        orchestrator: centralized
        subagents_invoked:
          - implementation-worker
          - test-runner
          - pr-reviewer
        skipped_subagents:
          - name: web-researcher
            reason_code: internal_only
      deterministic_checks:
        - command: pnpm test
          result: pass
        - command: uv run pytest ...
          result: pass
      loop:
        iterations: 1
        max_iterations: 2
        termination_reason: approved
      cost_proxy:
        frontier_model_calls: 1
        non_frontier_model_calls: 0
        external_research_used: false
        transcript_recorded: false
      outcome:
        pr_created: true
        pr_approved_by_agent: true
        human_escalation: false

    これなら raw transcript を保存せず、token も厳密計測せず、評価に必要な比較軸だけ残せます。


    推奨する設計判断

    1. 評価のために full transcript を取らない

    これは正しい判断です。

    趣味開発では、評価のために AI agent の token と transcript 管理コストを増やすのは割に合いません。session-recording-policy も、full transcript の pilot / 本番運用を開始しない条件をかなり強く置いています。(GitHub)

    代わりに、manifest-only 評価にしてください。

    recording_mode: manifest_only
    raw_transcript: prohibited
    local_file_source: prohibited
    public_surface: github_issue_comment

    2. impl-review-loop の既定 iteration を 5 → 2 に下げる

    現在の max_iterations 既定 5 は、品質最大化には寄りますが、費用対効果最大化には寄りません。

    推奨:

    - max_iterations(任意、デフォルト 5)
    + max_iterations(任意、デフォルト 2、hard cap 5)

    5 回回すのは、明示的に「品質優先」とした場合だけでよいです。

    3. issue-refinement-loop は現状維持でよい

    max_iterations=1、planner SSOT、conditional web research はよくできています。
    大きく変えるより、manifest 出力だけ足すのが良いです。

    4. session-recording-policy に「agent evaluation manifest」を追加する

    session-recording-policy には Secret / Kill Switch が主に書かれているため、評価目的の最小 schema を別節で追加するのが良いです。

    追加するなら、以下の節が適切です。

    ## Agent Skill Evaluation Manifest Policy
    
    - raw transcript は保存しない
    - GitHub public surface には manifest summary のみ許可
    - token 実数ではなく cost_proxy を使う
    - subagent invocation / skipped reason / deterministic checks / termination reason を記録する
    - 評価のために追加の AI agent call を発生させてはならない

    最後の 1 行が重要です。

    evaluation_overhead_policy:
      additional_agent_calls_for_evaluation: prohibited
      raw_transcript_for_evaluation: prohibited
      manifest_generated_from_existing_loop_state: required

    優先度

    P0: すぐやる価値がある

    1. impl-review-loop の default max_iterations を 5 → 2 に下げる
    2. LOOP_STATE から manifest を生成するだけの agent_eval_summary を追加する
    3. session-recording-policy に「評価目的で追加 AI call を発生させない」ルールを明記する

    P1: 次にやる価値がある

    1. test-runner の verdict を LLM ではなく exit code / deterministic command に固定する
    2. PR review を tier0 deterministic / tier1 cheap review / tier2 frontier review に分ける
    3. external_research_skip_basis を reason_code enum にする

    P2: 今は不要

    1. full transcript 記録
    2. token 数の厳密集計
    3. agent architecture の実験比較
    4. frontier model による毎回の meta-evaluation

    最終評価

    あなたの現在の方向性は、論文の観点からは 「multi-agent を盲信せず、中央集権 routing・deterministic gate・必要時だけ delegation に寄せる」設計であり、かなり妥当です。

    ただし、impl-review-loop はまだ品質最大化寄りです。趣味開発で費用対効果を最大化するなら、次の設計に寄せるのがよいです。

    default_policy:
      issue_refinement_loop:
        max_iterations: 1
        frontier_review: conditional
        web_research: conditional
      impl_review_loop:
        max_iterations: 2
        deterministic_verification_first: true
        frontier_pr_review: only_when_risk_high
      evaluation:
        mode: manifest_only
        additional_agent_calls: prohibited
        raw_transcript: prohibited

    この方針なら、arXiv:2512.08296 の主張と、個人趣味開発における token cost 最適化の両方に合います。

  4. squne121 commented on May 27, 2026

    @squne121
    OwnerAuthor

    結論

    REQUEST_CHANGES。現状の #422 は、意図は妥当だが、そのまま実装すると「設計書を増やしてSSOT分裂を作る」リスクが高いです。
    #422 は docs/dev/workflows/ 配下に issue-refinement-loop-design.md と impl-review-loop-design.md を追加し、14セクション構成で運用単位別の詳細設計を書く提案です。対象には planner 境界、SubAgent Contract Matrix、LOOP_STATE、human escalation、external research skip basis など、実質的な運用判断が含まれています。(GitHub)

    確認できた範囲では、#422 自体は Relationships なし / Development に branch・PR なし です。一方で周辺には #392、#393、#394、#384、#385、#387、#410 など、issue-refinement-loop と impl-review-loop の責務分離・SSOT・preflight・planner 化に関する関連Issueが多数あります。(GitHub)


    最重要ブロッカー

    1. docs/dev/workflows/*-design.md が SSOT なのか派生文書なのか曖昧

    #422 は「workflow.md 配下に詳細設計を置く」としつつ、設計判断・Contract Matrix・Failure Modes・Change Management を書かせています。これは単なる説明文書ではなく、実質的に 運用仕様の正本 になり得ます。(GitHub)

    しかし docs/dev/ssot-registry.md は、新しいSSOT文書を追加する場合は registry に登録し、ssot-discovery も必要に応じて更新する前提になっています。現行 #422 の Allowed Paths は docs/dev/workflows/** と docs/dev/workflow.md のみで、registry / discovery を更新できません。(GitHub)

    修正要求: どちらかに寄せるべきです。

    ssot_classification: derived_design_note
    canonical_sources:
      - docs/dev/workflow.md
      - docs/dev/agent-skill-boundaries.md
      - .claude/skills/<skill>/SKILL.md
    conflict_rule: canonical_sources_win
    

    または、正本にするなら Allowed Paths に最低限これを追加すべきです。

    docs/dev/ssot-registry.md
    .claude/skills/ssot-discovery/**
    

    2. 既存SSOTとの重複で split-brain を起こす

    #422 が書かせようとしている control-plane/data-plane boundary、SubAgent Contract Matrix、LOOP_STATE field owner、human approval は、既に agent-skill-boundaries.md に相当する規範があります。特に Orchestrator が読んでよいフィールド、読んではいけない raw content、data-plane mutation の委譲、LOOP_STATE 管理は既存文書でかなり具体化されています。(GitHub)

    敵対的に見ると、#422 は「整理」ではなく 同じ設計判断の第3の置き場 を作るIssueです。#392 で planner/checker を script-first に寄せ、#393 で SKILL.md を thin entrypoint 化し、#394 / PR #416 で SubAgent 固有契約を SubAgent 側に移した流れと衝突します。(GitHub)

    修正要求: 各設計書に Authority Map を必須追加してください。14セクションに含めるだけでは弱いです。

    ## Authority Map
    
    Topic Canonical source This doc may do This doc must not do
    LOOP_STATE fields docs/dev/agent-skill-boundaries.md summarize and link redefine owner
    planner schema scripts/schema or skill reference explain consumer view change schema
    SubAgent output contract .claude/agents/*.md index required outputs copy full prompt

    3. Contract Matrix が弱すぎる

    #422 の Contract Matrix は「SubAgent Role / Called by / Allowed mutation / Required output / Failure signal」程度に見えます。これは運用レビューには不足です。(GitHub)

    PR #416 の過去レビューコメントでは、frontmatter 破損、Allowed Paths 違反、REVIEW_ISSUE_RESULT_V1 の split-brain などが実際に指摘されています。つまり、このリポジトリでは「契約名だけ書く」運用は既に事故っています。(GitHub)

    修正要求: Matrix は最低でも以下の列を持つべきです。

    必須列 理由
    -- --
    Producer どの Skill/SubAgent/script が出すか
    Consumer 誰が読むか
    Schema / version *_V1 の分裂防止
    Fields read by orchestrator orchestrator の越権防止
    Opaque forwarded fields 読まずに渡す領域の明示
    Must-not-read fields raw body / raw diff / raw grounding の混入防止
    Mutation owner Issue/PR/branch/worktree の変更責務
    Failure class retry / blocked / human_escalation の分岐
    Verification fixture 契約を壊した時に落ちるテスト

    4. Verification が docs 追加に対して甘い

    #422 の Verification は test -d、test -f、rg、pnpm typecheck/lint/test/build が中心です。docs-only PRとして最低限ではありますが、今回の文書は実質的に運用仕様です。存在確認だけでは品質保証になりません。(GitHub)

    Claude Code Skills の公式ドキュメントは、SKILL.md を簡潔に保ち、詳細情報は supporting files に逃がす設計を推奨していますが、同時に supporting files は必要時に参照される前提です。つまり、#422 の成果物は「長文を置けばよい」ではなく、ロード条件・正本関係・リンク健全性 まで検証対象にする必要があります。(Claude Code)

    追加すべきVC:

    # 14 headings are present in both docs
    python3 scripts/validate_workflow_design_docs.py docs/dev/workflows/*.md
    

    no copied full agent/skill prompt bodies

    python3 scripts/check_no_prompt_body_duplication.py docs/dev/workflows/*.md

    every contract name has an owner/source link

    python3 scripts/check_contract_matrix_sources.py docs/dev/workflows/*.md

    links and anchors resolve

    pnpm markdown:link-check

    スクリプトを増やさない方針なら、少なくとも rg で Authority Map、conflict_rule、canonical_sources、schema_version、.claude/agents/、.claude/skills/ の存在確認をACに入れるべきです。


    5. Context Loading Policy が逆流している

    #393 は SKILL.md の肥大化を避け、progressive disclosure に寄せるIssueでした。#422 で 14セクション×2本の詳細設計を追加すると、ssot-discovery や人間レビュー時に丸ごとロードされ、結局 context rot を再導入する危険があります。(GitHub)

    Claude Code の SubAgent は独立コンテキストと summary-only 返却を前提にでき、nested SubAgent は不可です。#422 の Stop Conditions に nested delegation 禁止があるのは正しいですが、設計書側でも「いつ全文を読むのか / いつ index だけ読むのか」を明示しないと、運用者が全文ロードします。(Claude API Docs)

    修正要求: 各設計書の冒頭にこれを必須化してください。

    loaded_when:

    • architecture review
    • contract migration
    • failure-mode update
      not_loaded_when:
    • normal loop execution
    • routine issue refinement
    • routine implementation review
      summary_budget: <= 1200 chars

    外部調査からの品質基準

    Anthropic の “Building effective agents” は、複雑なフレームワークよりも単純で合成可能なパターン、明確な停止条件、人間チェックポイント、ground truth に基づく検証を重視しています。#422 の設計書も「説明文」ではなく、停止条件・契約・検証可能性を中心にすべきです。(Anthropic)

    Claude Code SubAgents は YAML frontmatter、明確な description、tool/permission 制約、独立コンテキストを前提に設計されています。#422 の文書は SubAgent 定義をコピーせず、frontmatter・permissionMode・allowed tools・output contract へのリンクと責務境界だけを扱うべきです。(Claude API Docs)

    GitHub Spec Kit の考え方でも、spec は agent に曖昧さなく作業させる source of truth / living artifact です。#422 の文書が living spec を名乗るなら、更新ルール・正本関係・検証コマンドが必須です。(The GitHub Blog)


    #422 に入れるべき修正コメント案

    そのまま貼れる粒度で書くと、以下です。

    REQUEST_CHANGES
    
    

    このIssueは方向性は妥当だが、現状のままでは docs/dev/workflows/*-design.md が
    SSOTなのか派生設計ノートなのか不明で、workflow.md / agent-skill-boundaries.md /
    SKILL.md / SubAgent契約との split-brain を作るリスクが高い。

    修正要求:

    1. 各設計書の冒頭に以下を追加する:

      • design_doc_schema_version
      • ssot_classification
      • canonical_sources
      • conflict_rule
      • loaded_when / not_loaded_when
      • summary_budget
    2. 「Authority Map」を14セクションとは別に必須化する。
      各Topicについて canonical source / this doc may do / this doc must not do を明示する。

    3. SubAgent Contract Matrix を拡張する。
      最低限、Producer / Consumer / Schema version / Fields read by orchestrator /
      Opaque forwarded fields / Must-not-read fields / Mutation owner /
      Failure class / Verification fixture を含める。

    4. 正本文書にするなら Allowed Paths に docs/dev/ssot-registry.md と
      ssot-discovery 関連ファイルを追加する。
      派生文書にするなら conflict_rule: canonical_sources_win をACに入れる。

    5. Verification を存在確認から契約検証へ引き上げる。
      14 heading、リンク解決、Contract Matrix source link、prompt body duplication 禁止、
      canonical_sources/conflict_rule の存在を検証する。

    6. 関連Issueとして少なくとも #392, #393, #394, #384, #385, #387, #410 を明示する。


    最終判定

    現状: Merge不可 / 実装着手前にIssue修正が必要。

    理由は、docs-only に見えるが実際には運用アーキテクチャの正本追加であり、SSOT登録・責務境界・検証可能性が未定義だからです。
    このIssueの価値は「詳細設計を書くこと」ではなく、既存の workflow / Skill / SubAgent / script-first contract を壊さずに、人間が読める設計インデックスを作ること に限定すべきです。

    ## 結論

    REQUEST_CHANGES。現状の #422 は、意図は妥当だが、そのまま実装すると「設計書を増やしてSSOT分裂を作る」リスクが高いです。
    #422 は docs/dev/workflows/ 配下に issue-refinement-loop-design.md と impl-review-loop-design.md を追加し、14セクション構成で運用単位別の詳細設計を書く提案です。対象には planner 境界、SubAgent Contract Matrix、LOOP_STATE、human escalation、external research skip basis など、実質的な運用判断が含まれています。([GitHub]1)

    確認できた範囲では、#422 自体は Relationships なし / Development に branch・PR なし です。一方で周辺には #392、#393、#394、#384、#385、#387、#410 など、issue-refinement-loop と impl-review-loop の責務分離・SSOT・preflight・planner 化に関する関連Issueが多数あります。([GitHub]1)


    最重要ブロッカー

    1. docs/dev/workflows/*-design.md が SSOT なのか派生文書なのか曖昧

    #422 は「workflow.md 配下に詳細設計を置く」としつつ、設計判断・Contract Matrix・Failure Modes・Change Management を書かせています。これは単なる説明文書ではなく、実質的に 運用仕様の正本 になり得ます。([GitHub]1)

    しかし docs/dev/ssot-registry.md は、新しいSSOT文書を追加する場合は registry に登録し、ssot-discovery も必要に応じて更新する前提になっています。現行 #422 の Allowed Paths は docs/dev/workflows/** と docs/dev/workflow.md のみで、registry / discovery を更新できません。([GitHub]2)

    修正要求: どちらかに寄せるべきです。

    ssot_classification: derived_design_note
    canonical_sources:
      - docs/dev/workflow.md
      - docs/dev/agent-skill-boundaries.md
      - .claude/skills/<skill>/SKILL.md
    conflict_rule: canonical_sources_win
    

    または、正本にするなら Allowed Paths に最低限これを追加すべきです。

    docs/dev/ssot-registry.md
    .claude/skills/ssot-discovery/**
    

    2. 既存SSOTとの重複で split-brain を起こす

    #422 が書かせようとしている control-plane/data-plane boundary、SubAgent Contract Matrix、LOOP_STATE field owner、human approval は、既に agent-skill-boundaries.md に相当する規範があります。特に Orchestrator が読んでよいフィールド、読んではいけない raw content、data-plane mutation の委譲、LOOP_STATE 管理は既存文書でかなり具体化されています。([GitHub]3)

    敵対的に見ると、#422 は「整理」ではなく 同じ設計判断の第3の置き場 を作るIssueです。#392 で planner/checker を script-first に寄せ、#393 で SKILL.md を thin entrypoint 化し、#394 / PR #416 で SubAgent 固有契約を SubAgent 側に移した流れと衝突します。([GitHub]4)

    修正要求: 各設計書に Authority Map を必須追加してください。14セクションに含めるだけでは弱いです。

    ## Authority Map
    
    | Topic | Canonical source | This doc may do | This doc must not do |
    |---|---|---|---|
    | LOOP_STATE fields | docs/dev/agent-skill-boundaries.md | summarize and link | redefine owner |
    | planner schema | scripts/schema or skill reference | explain consumer view | change schema |
    | SubAgent output contract | .claude/agents/*.md | index required outputs | copy full prompt |
    

    3. Contract Matrix が弱すぎる

    #422 の Contract Matrix は「SubAgent Role / Called by / Allowed mutation / Required output / Failure signal」程度に見えます。これは運用レビューには不足です。([GitHub]1)

    PR #416 の過去レビューコメントでは、frontmatter 破損、Allowed Paths 違反、REVIEW_ISSUE_RESULT_V1 の split-brain などが実際に指摘されています。つまり、このリポジトリでは「契約名だけ書く」運用は既に事故っています。([GitHub]5)

    修正要求: Matrix は最低でも以下の列を持つべきです。

    必須列 理由
    Producer どの Skill/SubAgent/script が出すか
    Consumer 誰が読むか
    Schema / version *_V1 の分裂防止
    Fields read by orchestrator orchestrator の越権防止
    Opaque forwarded fields 読まずに渡す領域の明示
    Must-not-read fields raw body / raw diff / raw grounding の混入防止
    Mutation owner Issue/PR/branch/worktree の変更責務
    Failure class retry / blocked / human_escalation の分岐
    Verification fixture 契約を壊した時に落ちるテスト

    4. Verification が docs 追加に対して甘い

    #422 の Verification は test -d、test -f、rg、pnpm typecheck/lint/test/build が中心です。docs-only PRとして最低限ではありますが、今回の文書は実質的に運用仕様です。存在確認だけでは品質保証になりません。([GitHub]1)

    Claude Code Skills の公式ドキュメントは、SKILL.md を簡潔に保ち、詳細情報は supporting files に逃がす設計を推奨していますが、同時に supporting files は必要時に参照される前提です。つまり、#422 の成果物は「長文を置けばよい」ではなく、ロード条件・正本関係・リンク健全性 まで検証対象にする必要があります。([Claude Code]6)

    追加すべきVC:

    # 14 headings are present in both docs
    python3 scripts/validate_workflow_design_docs.py docs/dev/workflows/*.md
    
    # no copied full agent/skill prompt bodies
    python3 scripts/check_no_prompt_body_duplication.py docs/dev/workflows/*.md
    
    # every contract name has an owner/source link
    python3 scripts/check_contract_matrix_sources.py docs/dev/workflows/*.md
    
    # links and anchors resolve
    pnpm markdown:link-check
    

    スクリプトを増やさない方針なら、少なくとも rg で Authority Map、conflict_rule、canonical_sources、schema_version、.claude/agents/、.claude/skills/ の存在確認をACに入れるべきです。


    5. Context Loading Policy が逆流している

    #393 は SKILL.md の肥大化を避け、progressive disclosure に寄せるIssueでした。#422 で 14セクション×2本の詳細設計を追加すると、ssot-discovery や人間レビュー時に丸ごとロードされ、結局 context rot を再導入する危険があります。([GitHub]7)

    Claude Code の SubAgent は独立コンテキストと summary-only 返却を前提にでき、nested SubAgent は不可です。#422 の Stop Conditions に nested delegation 禁止があるのは正しいですが、設計書側でも「いつ全文を読むのか / いつ index だけ読むのか」を明示しないと、運用者が全文ロードします。([Claude API Docs]8)

    修正要求: 各設計書の冒頭にこれを必須化してください。

    loaded_when:
      - architecture review
      - contract migration
      - failure-mode update
    not_loaded_when:
      - normal loop execution
      - routine issue refinement
      - routine implementation review
    summary_budget: <= 1200 chars
    

    外部調査からの品質基準

    Anthropic の “Building effective agents” は、複雑なフレームワークよりも単純で合成可能なパターン、明確な停止条件、人間チェックポイント、ground truth に基づく検証を重視しています。#422 の設計書も「説明文」ではなく、停止条件・契約・検証可能性を中心にすべきです。([Anthropic]9)

    Claude Code SubAgents は YAML frontmatter、明確な description、tool/permission 制約、独立コンテキストを前提に設計されています。#422 の文書は SubAgent 定義をコピーせず、frontmatter・permissionMode・allowed tools・output contract へのリンクと責務境界だけを扱うべきです。([Claude API Docs]8)

    GitHub Spec Kit の考え方でも、spec は agent に曖昧さなく作業させる source of truth / living artifact です。#422 の文書が living spec を名乗るなら、更新ルール・正本関係・検証コマンドが必須です。([The GitHub Blog]10)


    #422 に入れるべき修正コメント案

    そのまま貼れる粒度で書くと、以下です。

    REQUEST_CHANGES
    
    このIssueは方向性は妥当だが、現状のままでは docs/dev/workflows/*-design.md が
    SSOTなのか派生設計ノートなのか不明で、workflow.md / agent-skill-boundaries.md /
    SKILL.md / SubAgent契約との split-brain を作るリスクが高い。
    
    修正要求:
    
    1. 各設計書の冒頭に以下を追加する:
       - design_doc_schema_version
       - ssot_classification
       - canonical_sources
       - conflict_rule
       - loaded_when / not_loaded_when
       - summary_budget
    
    2. 「Authority Map」を14セクションとは別に必須化する。
       各Topicについて canonical source / this doc may do / this doc must not do を明示する。
    
    3. SubAgent Contract Matrix を拡張する。
       最低限、Producer / Consumer / Schema version / Fields read by orchestrator /
       Opaque forwarded fields / Must-not-read fields / Mutation owner /
       Failure class / Verification fixture を含める。
    
    4. 正本文書にするなら Allowed Paths に docs/dev/ssot-registry.md と
       ssot-discovery 関連ファイルを追加する。
       派生文書にするなら conflict_rule: canonical_sources_win をACに入れる。
    
    5. Verification を存在確認から契約検証へ引き上げる。
       14 heading、リンク解決、Contract Matrix source link、prompt body duplication 禁止、
       canonical_sources/conflict_rule の存在を検証する。
    
    6. 関連Issueとして少なくとも #392, #393, #394, #384, #385, #387, #410 を明示する。
    

    最終判定

    現状: Merge不可 / 実装着手前にIssue修正が必要。

    理由は、docs-only に見えるが実際には運用アーキテクチャの正本追加であり、SSOT登録・責務境界・検証可能性が未定義だからです。
    このIssueの価値は「詳細設計を書くこと」ではなく、既存の workflow / Skill / SubAgent / script-first contract を壊さずに、人間が読める設計インデックスを作ること に限定すべきです。

  5. squne121 commented on May 27, 2026

    @squne121
    OwnerAuthor

    Contract Snapshot (2026-05-27T19:54:42Z)

    • Outcome: docs/dev/workflows/ に 2 本の運用単位別詳細設計書 (issue-refinement-loop-design / impl-review-loop-design) を 14 セクション構造で新設し、ssot-registry.md に derived_design_note として登録する
    • Acceptance Criteria: AC1〜AC13(Issue 本文 ## Acceptance Criteria 参照)
    • Verification Commands: pnpm typecheck / pnpm lint / pnpm test / pnpm build (regression gate) + 各種 test -d/-f + preflight-scope: pr_review_only 付きの rg 群
    • Allowed Paths: docs/dev/workflows/**, docs/dev/workflow.md, docs/dev/ssot-registry.md, .claude/skills/ssot-discovery/**
    • Worktree: .claude/worktrees/issue-422-workflows-design-docs
    • Branch: worktree-issue-422-workflows-design-docs
    • VC preflight: expected_fail = 3, expected_pass = 4, skipped (pr_review_only) = 7, unexpected_pass = 0, blocked = 0, human_judgment = 0
    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: 2026-05-27T19:54:42Z
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/422
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: pass
        vc_preflight:
          passed: true
          vc_failed_as_expected: 3
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
          vc_expected_pass: 4
          vc_skipped: 7
          classifications:
          - ac: AC_L2
            command: test -d docs/dev/workflows
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_L5
            command: test -f docs/dev/workflows/issue-refinement-loop-design.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_L8
            command: test -f docs/dev/workflows/impl-review-loop-design.md
            exit_code: 1
            classification: expected_fail
            category: file_not_found_expected
            scope_class: baseline_fail_expected
            confidence: high
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
          - ac: AC_L12
            command: rg -l 'docs/dev/workflows' docs/dev/workflow.md
            exit_code: null
            classification: skipped
            category: preflight_scope_pr_review_only
            scope_class: pr_review_only
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
            verification_owner: pr-review-judge
            deferred_reason: preflight-scope marker
            runtime_verification_required: false
          - ac: AC_L15
            command: pnpm typecheck
            exit_code: 0
            classification: expected_pass
            category: regression_gate
            scope_class: regression_gate
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: $ tsc --noEmit
          - ac: AC_L16
            command: pnpm lint
            exit_code: 0
            classification: expected_pass
            category: regression_gate
            scope_class: regression_gate
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: $ eslint .
          - ac: AC_L17
            command: pnpm test
            exit_code: 0
            classification: expected_pass
            category: regression_gate
            scope_class: regression_gate
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: " RUN  v4.1.6 /home/squne/projects/LOOP_PROTOCOL\n Test Files\
                \  6 passed (6)\n      Tests  61 passed (61)"
              stderr_excerpt: $ vitest run
          - ac: AC_L18
            command: pnpm build
            exit_code: 0
            classification: expected_pass
            category: regression_gate
            scope_class: regression_gate
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: "vite v8.0.13 building client environment for production...\n\e\
                [2K\ntransforming...✓ 22 modules transformed."
              stderr_excerpt: $ tsc && vite build
          - ac: AC_L22
            command: rg -n "^## Authority Map$" docs/dev/workflows/issue-refinement-loop-design.md
              docs/dev/workflows/impl-review-loop-design.md
            exit_code: null
            classification: skipped
            category: preflight_scope_pr_review_only
            scope_class: pr_review_only
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
            verification_owner: pr-review-judge
            deferred_reason: preflight-scope marker
            runtime_verification_required: false
          - ac: AC_L24
            command: rg -n "design_doc_schema_version|ssot_classification|canonical_sources|conflict_rule|loaded_when|not_loaded_when|summary_budget"
              docs/dev/workflows/issue-refinement-loop-design.md docs/dev/workflows/impl-review-loop-design.md
            exit_code: null
            classification: skipped
            category: preflight_scope_pr_review_only
            scope_class: pr_review_only
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
            verification_owner: pr-review-judge
            deferred_reason: preflight-scope marker
            runtime_verification_required: false
          - ac: AC_L28
            command: rg -n "Producer.*Consumer.*Schema|Fields read by orchestrator|Opaque forwarded
              fields|Must-not-read fields|Mutation owner|Failure class|Verification fixture"
              docs/dev/workflows/issue-refinement-loop-design.md docs/dev/workflows/impl-review-loop-design.md
            exit_code: null
            classification: skipped
            category: preflight_scope_pr_review_only
            scope_class: pr_review_only
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
            verification_owner: pr-review-judge
            deferred_reason: preflight-scope marker
            runtime_verification_required: false
          - ac: AC_L32
            command: rg -n "^## (Status|Purpose|Non-goals|Invocation Contract|Workflow Topology|State
              Model|SubAgent Contract Matrix|Artifact and Evidence Contract|Context Loading
              Policy|Guardrails|Failure Modes and Recovery|Observability|Verification Plan|Change
              Management)$" docs/dev/workflows/issue-refinement-loop-design.md docs/dev/workflows/impl-review-loop-design.md
            exit_code: null
            classification: skipped
            category: preflight_scope_pr_review_only
            scope_class: pr_review_only
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
            verification_owner: pr-review-judge
            deferred_reason: preflight-scope marker
            runtime_verification_required: false
          - ac: AC_L36
            command: rg -n "\.claude/agents/|\.claude/skills/" docs/dev/workflows/issue-refinement-loop-design.md
              docs/dev/workflows/impl-review-loop-design.md
            exit_code: null
            classification: skipped
            category: preflight_scope_pr_review_only
            scope_class: pr_review_only
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
            verification_owner: pr-review-judge
            deferred_reason: preflight-scope marker
            runtime_verification_required: false
          - ac: AC_L40
            command: rg -n "docs/dev/workflows" docs/dev/ssot-registry.md
            exit_code: null
            classification: skipped
            category: preflight_scope_pr_review_only
            scope_class: pr_review_only
            confidence: low
            decision: go
            evidence:
              stdout_excerpt: ''
              stderr_excerpt: ''
            verification_owner: pr-review-judge
            deferred_reason: preflight-scope marker
            runtime_verification_required: false
        ac_verifiability: pass
        product_spec_check:
          applicability: not_applicable
          decision: pass
          triggers:
            docs_product_allowed_paths: false
            tasks_md_mentioned: false
            specify_artifact_mentioned: false
            generated_task_mentioned: false
            product_spec_context_present: false
          conditions:
            docs_product_requires_spec_evidence:
              status: n/a
              evidence: []
            tasks_md_not_direct_source:
              status: n/a
              evidence: []
            specify_not_canonical:
              status: n/a
              evidence: []
            diff_first_rationale_present:
              status: n/a
              evidence: []
            generated_task_trace_present:
              status: n/a
              evidence: []
            task_dependencies_materialized:
              status: n/a
              evidence: []
          blocked_reasons: []
        worktree_branch_collision: clear
      next_action: implement_issue
      blocked_reasons: []
      warnings: []
  6. squne121 commented on May 27, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-05-27T20:02:36Z)

  7. added 4 commits that reference this issue on May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ai-opsarea/docsdocsphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions