Skip to content

実装: issue-refinement-loop SKILL.md を thin entrypoint + references 構成へ分割する #393

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#391"
goal_ref: "issue-refinement-loop/SKILL.md を薄い entrypoint に縮小し、長文 procedure を references/ に分割する"
change_kind: workflow

Parent Issue

#391

Parent Goal Ref

  • Goal: issue-refinement-loop を script-first / thin entrypoint に再構成し、固定 token cost を削減する
  • Desired Destination: SKILL.md を 500 行以下に縮小し、詳細 procedure は references/ に progressive disclosure 構成で分割。判定ロジックは Phase 1 の planner script を SSOT として consume する。

Current Validated Scope

  • .claude/skills/issue-refinement-loop/SKILL.md の thin entrypoint 化
  • .claude/skills/issue-refinement-loop/references/ 配下への詳細 procedure 移設
  • references/index.md による progressive disclosure 表の整備
  • planner 判定条件の prose 重複を SKILL.md から除去
  • disable-model-invocation: true / paths frontmatter 採否の明示決定

Remaining Parent Gaps

Required Skills

  • Markdown / YAML フロントマター編集
  • Claude Code skill / subagent 構造(frontmatter フィールド・progressive disclosure)の理解
  • pytest によるテキスト fixture / forbidden-fragment 検証
  • rg / wc / gh CLI による静的検証

Depends On

Background

  • Phase 1 で deterministic planner/checker を導入した後、SKILL.md 本文から長文 procedure / guard 詳細 / schema 重複を削減する。
  • 目的は単なるファイル分割ではなく、スキル起動時に毎回読む本文を薄くし、必要な詳細だけを references/ から読む progressive disclosure 構成にすること。

Baseline

Outcome

  • issue-refinement-loop/SKILL.md は entrypoint / Inputs / LOOP_STATE summary / planner 呼び出し / SubAgent routing / Stop Conditions のみを保持する。
  • 詳細 procedure は references に分割される。

In Scope

  • references/ の新規作成または再編
  • SKILL.md から以下を references へ移動:
  • SKILL.md の行数・bytes を baseline と比較して PR 本文に記録
  • Phase 1 planner の JSON contract を正本として参照
  • 既存 VC の更新
  • references/index.md を作成し、topic / file / loaded_when / owner / moved_from / must_not の表で progressive disclosure 構造を可視化する
  • disable-model-invocation: true の採否を明示的に決定し PR 本文に記録する
  • paths frontmatter の適用可否を明示的に決定し PR 本文に記録する
  • planner 判定条件の prose 重複(現 Step 1 等)を SKILL.md から除去する

Out of Scope

Acceptance Criteria

  • AC1: .claude/skills/issue-refinement-loop/references/index.md が存在する(references/ ディレクトリ自体は 実装: issue-refinement-loop の deterministic planner/checker script を抽出する #392 で既存のため、新規 index.md の存在を baseline 失敗の signal とする)
  • AC2: SKILL.md が thin entrypoint であることを示す sentinel marker がある
  • AC3: .claude/skills/issue-refinement-loop/SKILL.md の行数が 500 行以下である。500 行を超える場合は PR 本文に以下を表形式で記録する:
    • 残す section 名
    • references に移せない理由
    • 次 follow-up Issue 番号
    • SKILL.md lines / bytes
    • frontmatter description chars
    • when_to_use chars(存在する場合)
    • references/index.md chars
    • references file count
      単なる baseline 比減少は pass 条件にしない。VC は test "$(wc -l < ...)" -le 500 で機械的に判定する。500 超過時の PR 本文記録要件は維持。
  • AC4: references に分割された各 topic が SKILL.md からリンクされている
  • AC5: REFINEMENT_LOOP_PLAN_V1 を consume する記述が残っている
  • AC6: 既存 termination / follow-up / web research / anchor handling の意味論が失われていない
  • AC7: pnpm / pytest gate が PASS する
  • AC8: SKILL.md は REFINEMENT_LOOP_PLAN_V1 を consume するだけで、investigation_policy / web_research_policy / scope_signal_guard の判定条件を prose で再定義しない。
  • AC9: .claude/skills/issue-refinement-loop/tests/test_thin_entrypoint.py に forbidden-fragment test があり、SKILL.md 内に planner 判定条件の prose 再実装が残っていないことを CI で検証する。
  • AC10: references/index.md が存在し、topic / file / loaded_when / owner / moved_from / must_not 列を持つ表で全 references を一覧化している。
  • AC11: disable-model-invocation: true の採否と paths frontmatter の適用可否が PR 本文で明示決定されている。PR 本文の Frontmatter Decision セクションで実測値を記録(baseline_vc_preflight 対象外、pr-review-judge / 人間レビューで確認)。

Verification Commands

# AC1: 新規 references/index.md ファイルの存在を baseline で fail させる
$ test -f .claude/skills/issue-refinement-loop/references/index.md  # AC1

# AC2 / AC5: thin entrypoint sentinel + planner consume の明示
$ rg -n "thin entrypoint|判定ロジックは planner を SSOT|REFINEMENT_LOOP_PLAN_V1" .claude/skills/issue-refinement-loop/SKILL.md  # AC2  # AC5

# AC3: SKILL.md 行数が 500 以下であること(baseline 1280 行 → fail を担保)
$ test "$(wc -l < .claude/skills/issue-refinement-loop/SKILL.md)" -le 500  # AC3

# AC4: 分割対象 topic ごとの references ファイル参照リンクが SKILL.md に存在
$ rg -n "references/anchor-comment-handling\.md|references/web-research-routing\.md|references/follow-up-materialization\.md|references/termination-policy\.md|references/ac-vc-reflection\.md|references/scope-signal-guard\.md" .claude/skills/issue-refinement-loop/SKILL.md  # AC4

# AC6: 主要 topic 別ファイルが references/ に存在することを個別に検証
$ test -f .claude/skills/issue-refinement-loop/references/anchor-comment-handling.md  # AC6
$ test -f .claude/skills/issue-refinement-loop/references/web-research-routing.md  # AC6
$ test -f .claude/skills/issue-refinement-loop/references/follow-up-materialization.md  # AC6
$ test -f .claude/skills/issue-refinement-loop/references/termination-policy.md  # AC6
$ test -f .claude/skills/issue-refinement-loop/references/ac-vc-reflection.md  # AC6
$ test -f .claude/skills/issue-refinement-loop/references/scope-signal-guard.md  # AC6

# AC7: 必須検証コマンド(compound を回避するため 1 行 1 コマンドに分割)
$ pnpm typecheck  # AC7
$ pnpm lint  # AC7
$ pnpm test  # AC7
$ pnpm build  # AC7
$ uv run pytest .claude/skills/issue-refinement-loop/tests/ -v  # AC7

# AC8: planner 判定条件の prose 再実装が SKILL.md に残っていないこと(明示 wrap で baseline fail を担保)
$ if rg -nq "codebase_required\s*[:=]\s*true|web_research_policy\.required\s*[:=]\s*true" .claude/skills/issue-refinement-loop/SKILL.md; then exit 1; else exit 0; fi  # AC8

# AC9: forbidden-fragment test の存在
$ test -f .claude/skills/issue-refinement-loop/tests/test_thin_entrypoint.py  # AC9
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_thin_entrypoint.py -v  # AC9

# AC10: references/index.md が topic / file / loaded_when / owner / moved_from / must_not 列の表を持つ
$ rg -nq "\| topic \| file \| loaded_when \| owner \| moved_from \| must_not \|" .claude/skills/issue-refinement-loop/references/index.md  # AC10

Allowed Paths

  • .claude/skills/issue-refinement-loop/SKILL.md
  • .claude/skills/issue-refinement-loop/references/
  • .claude/skills/issue-refinement-loop/tests/
  • .claude/skills/issue-refinement-loop/fixtures/

Stop Conditions

Runtime Verification Applicability

decision: not_applicable
reason: skill documentation / reference structure change。静的検証と tests で確認する。

Delivery Rule

  • 1 Issue = 1 PR
  • Draft PR 既定
  • Phase 1 merge 後に着手

References

Activity

  1. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES。

    #393 の方向性、つまり issue-refinement-loop/SKILL.md を thin entrypoint にし、詳細手順を references/ に逃がす方針自体は正しいです。ただし現状の #393 contract は、親 #391 が要求している品質ゲートに届いていません。特に「baseline より減ればよい」という AC は弱すぎます。親 #391 は #393 に対して、SKILL.md <= 500 lines 原則、行数・bytes・description 長・when_to_use 長・references index size の記録、disable-model-invocation と paths frontmatter の検討を明示的に要求しています。

    Claude Code 公式 docs でも、複雑な skill は supporting files に分割し、SKILL.md は 500 行未満に保つこと、必要なときだけ supporting file を読む progressive disclosure が推奨されています。また skill content は呼び出し後に context に残るため、SKILL.md の各行は継続的 token cost になります。disable-model-invocation: true や paths frontmatter も activation/cost 制御として検討対象です。([Claude Code]1) ([Claude Code]1)

    Blockers

    1. AC3 が親 #391 の要求を満たしていない

    #393 の AC3 は「#295 後 baseline より減少、または減少しない理由を PR 本文に明記」となっていますが、これは pass 条件として甘すぎます。#295/PR #388 後の実態は、SKILL.md が 1226 → 1262 行、bytes も 66,875 → 約 69,200 に増えており、PR #388 自身が「固定 token cost は減っていない」と明記しています。

    修正案:

    AC3: `.claude/skills/issue-refinement-loop/SKILL.md` は 500 行以下である。
    500 行を超える場合は、PR 本文に以下を表で明記する:
    - 残す section 名
    - references に移せない理由
    - 次 follow-up Issue
    - lines / bytes / description chars / when_to_use chars / references index size
    
    単なる「baseline より減少」は pass 条件にしない。

    2. baseline が曖昧

    #393 は「#295 後 baseline」と書いていますが、#295 Issue 本文には 1226 lines / 65.3 KB の pre-change baseline があり、PR #388 merge 後は 1262 lines / 約 69.2 KB です。#393 の実装 PR が比較すべき baseline は、PR #388 merge 後、かつ PR #407 merge 後の current main に固定すべきです。#392 は既に closed/completed で、PR #407 により plan_refinement_loop.py、JSON Schema、fixture/tests、SKILL.md Step 0f wiring が入っています。

    修正案:

    Baseline:
    - base_ref: main after PR #407
    - required measurement:
      - wc -l SKILL.md
      - wc -c SKILL.md
      - frontmatter description chars
      - when_to_use chars, if present
      - references/ index chars
      - references/ file count

    3. Phase 1 planner SSOT を壊す危険が残っている

    #392/PR #407 で Step 0f は plan_refinement_loop.py による REFINEMENT_LOOP_PLAN_V1 生成・schema validation・fail_closed routing に移っています。にもかかわらず current main の SKILL.md には、Step 1 の直後に codebase_required=true の条件を prose で再列挙する記述が残っています。これは planner SSOT 化に逆行します。

    #393 では、単に文章を references/ に移すだけでなく、SKILL.md 側に planner 判定ロジックの再実装が残らないことを AC/pytest で検証すべきです。

    追加 AC 案:

    AC8: SKILL.md は `REFINEMENT_LOOP_PLAN_V1` を consume するだけで、
    `investigation_policy` / `web_research_policy` / `scope_signal_guard`
    の判定条件を prose で再定義しない。
    
    AC9: `tests/test_thin_entrypoint.py` に forbidden-fragment test があり、
    SKILL.md 内に planner 判定条件の再実装が残っていないことを検証する。

    4. web research handling の責務境界が危険

    #393 の In Scope には web research handling の移動が含まれていますが、これは #203 の経緯と衝突しやすいです。#203 では、人間コメントにより「auth_error retry は issue-refinement-loop ではなく gemini-cli-headless-delegation または web-researcher.md 側の責務」と整理され、#203 は not_planned で closed されています。

    したがって #393 で移してよいのは、orchestrator 側の 結果 routing だけです。Gemini retry、fallback query、attempt log、raw evidence collection は #394 / SubAgent-owned contract migration 側に残すべきです。#394 自体も、web-researcher の retry/fallback/attempt log contract を SubAgent 側へ移す Phase 3 として定義されています。

    修正案:

    Out of Scope に追加:
    - web-researcher / gemini-cli-headless-delegation の retry / fallback / attempt log 設計変更
    - orchestrator が Gemini retry_count / fallback query / raw evidence を保持すること
    - `.claude/agents/*.md` の変更
    
    In Scope を限定:
    - `WEB_RESEARCH_RESULT_V1` の orchestrator-side routing を references に移す
    - retry/fallback の詳細は link-only とし、#394 へ委譲する

    5. references 分割の品質ゲートが足りない

    #393 は references/ 作成と topic 移動を AC にしていますが、現 VC は rg "references/" や rg "anchor|scope|..." references/ 程度です。これでは「リンクがある」「単語がある」しか検証できず、progressive disclosure が成立しているかは検証できません。

    references/index.md を必須化し、各 reference に loaded_when / owner / moved_from / must_not を持たせるべきです。

    推奨構成:

    .claude/skills/issue-refinement-loop/references/
      index.md
      refinement-loop-plan-output.md   # #392 既存。schema SSOT を再定義しない
      anchor-comment-handling.md
      scope-signal-guard.md
      ac-vc-reflection.md
      follow-up-materialization.md
      web-research-routing.md          # retry/fallback ではなく result routing のみ
      termination-policy.md
    

    index.md 例:

    | topic | file | loaded_when | owner | moved_from |
    |---|---|---|---|---|
    | anchor comment handling | anchor-comment-handling.md | anchor_comment_url present | orchestrator | SKILL.md Step 0a-0c |
    | web research routing | web-research-routing.md | web_research_policy.required | orchestrator routing only | Step 1b handling |

    6. sentinel marker が曖昧

    #393 AC2 は「thin entrypoint であることを示す sentinel marker」としていますが、何を保証する marker なのか未定義です。単なる文字列なら意味がありません。

    修正案:

    <!-- ISSUE_REFINEMENT_LOOP_THIN_ENTRYPOINT_V1
    planner_ssot: REFINEMENT_LOOP_PLAN_V1
    max_skill_lines: 500
    no_prose_rejudgment: true
    subagent_contract_mode: link_only
    -->

    これに対応する pytest で、marker の存在だけでなく max_skill_lines と no_prose_rejudgment を実検証すべきです。

    7. SubAgent contract migration と混線している

    Claude Code の subagent は独立した context window、system prompt、tool access、permission を持ち、frontmatter の tools / disallowedTools / model / skills は実効挙動に影響します。skills preload は skill content を subagent context に読み込むため、Phase 2 で安易に SubAgent 側を触ると cost/behavior の変更になります。([Claude Code]2) ([Claude Code]2) (Claude Code)

    #393 は Phase 2 なので、.claude/agents/*.md は触らず、SubAgent contract は link-only に留めるべきです。SubAgent-owned contract migration は #394 の責務です。

    追加 Stop Condition:

    - `.claude/agents/*.md` の変更が必要になった場合 → #394 に defer
    - SubAgent frontmatter / tools / skills / model / retry / fallback の変更が必要になった場合 → #394 または別 Issue

    参考にすべき実装パターン

    #264 / PR #311 の gemini-cli-headless-delegation thin entrypoint 化は良い先例です。PR #311 は disable-model-invocation: true を追加し、SKILL.md を 225 → 190 → 111 行まで縮小し、詳細を references に移しています。#393 もこの水準の「薄い routing entrypoint」を目標にすべきです。

    最小修正セット

    #393 本文に最低限これを追加すべきです。

    ## Contract Amendments Required
    
    - Baseline is current main after PR #407.
    - `SKILL.md <= 500 lines` is the default pass condition.
    - Baseline reduction alone is not sufficient.
    - PR body must record:
      - SKILL.md lines
      - SKILL.md bytes
      - frontmatter description chars
      - when_to_use chars, if present
      - references index chars
      - references file count
    - `disable-model-invocation: true` adoption must be explicitly decided.
    - `paths` frontmatter applicability must be explicitly decided.
    - SKILL.md must consume `REFINEMENT_LOOP_PLAN_V1`; it must not re-derive planner decisions in prose.
    - Phase 2 is link-only for SubAgent-owned contracts.
    - Retry/fallback/attempt log behavior belongs to #394 or worker/wrapper Issues, not #393.

    投稿用レビュー案

    REQUEST_CHANGES
    
    #393 の方向性は妥当です。`issue-refinement-loop/SKILL.md` は PR #388 後に 1226 → 1262 行へ増えており、固定 token cost が未解決なので、thin entrypoint + references 分割は必要です。
    
    ただし現 contract は親 #391 の要求を満たしていません。
    
    Blockers:
    
    1. AC3 が弱いです。「#295 後 baseline より減少」ではなく、Claude Code docs の推奨に合わせ `SKILL.md <= 500 lines` を原則 AC にしてください。超過時は section 名 / references に移せない理由 / 次 follow-up を PR 本文に必須記録してください。
    
    2. baseline が曖昧です。比較対象は #295 Issue の 1226 lines ではなく、PR #388 merge 後かつ PR #407 merge 後の current main に固定してください。PR 本文には lines / bytes / description chars / when_to_use chars / references index size を記録してください。
    
    3. #392/PR #407 により `REFINEMENT_LOOP_PLAN_V1` が SSOT になっています。#393 では SKILL.md から planner 判定条件の prose 再実装を削除し、pytest で forbidden-fragment を検出してください。
    
    4. `web research handling` は retry/fallback まで含めると #203 の責務整理と衝突します。#393 では orchestrator-side result routing のみを references 化し、Gemini retry / fallback / attempt log は #394 または worker/wrapper 側に委譲してください。
    
    5. `references/` は単なる置き場ではなく、`references/index.md` に topic / file / loaded_when / owner / moved_from を持たせ、progressive disclosure が検証できる構造にしてください。
    
    6. Phase 2 は SubAgent-owned contract migration ではありません。`.claude/agents/*.md`、SubAgent frontmatter、tools/model/skills preload、retry/fallback behavior を触る必要が出た場合は #394 へ defer してください。
    
    この修正なしに実装すると、「長文を references に移しただけで SKILL.md がまだ太い」「planner SSOT を prose で再実装する」「web-researcher の内部復旧責務を orchestrator に戻す」という失敗モードが残ります。
  2. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES。

    #393 の方向性自体は妥当です。issue-refinement-loop/SKILL.md を thin entrypoint にし、詳細 procedure を references/ に逃がすのは、親 #391 の目的と一致しています。#391 は明示的に「500 行未満を原則」「行数 / bytes / description 長 / when_to_use 長 / references index size の記録」「disable-model-invocation と paths frontmatter の検討」を #393 に要求しています。

    ただし、現 #393 本文のまま実装すると 「分割しただけで SKILL.md がまだ太い」「planner SSOT を prose で再実装する」「web-researcher の retry/fallback 責務を orchestrator に戻す」 失敗モードが残ります。

    主要 Blocker

    1. AC3 が弱い

    #393 の AC3 は「#295 後 baseline より減少、または減少しない理由を PR 本文に明記」です。これは甘いです。PR #388 では SKILL.md が 1226 → 1262 行、bytes も 66,875 → 約 69,200 に増えており、固定 token cost は減っていないと明記されています。

    Claude Code docs でも、複雑な skill は supporting files に分割し、SKILL.md は 500 行未満に保つこと、また skill content は一度読み込まれると context に残るため各行が recurring token cost になることが説明されています。

    修正案:

    AC3: .claude/skills/issue-refinement-loop/SKILL.md は 500 行以下である。
    500 行を超える場合は、PR 本文に以下を表で明記する:

    • 残す section 名
    • references に移せない理由
    • 次 follow-up Issue
    • lines / bytes / description chars / when_to_use chars / references index size / references file count

    単なる「baseline より減少」は pass 条件にしない。

    1. baseline が曖昧

    #393 は「#295 後 baseline」と書いていますが、比較対象は #295 Issue の古い 1226 行 baseline ではなく、PR #388 merge 後かつ PR #407 merge 後の current main に固定すべきです。#392 / PR #407 は既に planner script、JSON Schema、fixture/tests、SKILL.md Step 0f wiring を導入済みです。

    追加すべき記述:

    Baseline:

    1. planner SSOT を壊すリスクが残っている

    #392 の Outcome は、plan_refinement_loop.py と REFINEMENT_LOOP_PLAN_V1 を SSOT にし、SKILL.md は planner output を consume するだけにすることです。

    しかし current main の SKILL.md には、Step 0f で planner を consume した直後に、Step 1 の prose として codebase_required=true の条件が再列挙されています。これは thin entrypoint 化の対象にすべきです。

    追加 AC:

    AC8: SKILL.md は REFINEMENT_LOOP_PLAN_V1 を consume するだけで、
    investigation_policy / web_research_policy / scope_signal_guard
    の判定条件を prose で再定義しない。

    AC9: tests/test_thin_entrypoint.py に forbidden-fragment test があり、
    SKILL.md 内に planner 判定条件の再実装が残っていないことを検証する。

    1. web research handling の責務境界が危険

    #393 の In Scope には web research handling の移動が含まれていますが、これは #203 の整理と衝突しやすいです。#203 はもともと issue-refinement-loop の Step 1b に auth_error retry を入れる Issue でしたが、最終的に not_planned で閉じられています。

    current main の SKILL.md も WEB_RESEARCH_RESULT_V1 を opaque に扱い、retry_count / fallback_query / raw_grounding_state を保存しない、と境界を明示しています。

    #393 で移してよいのは orchestrator-side result routing だけです。Gemini retry、fallback query、attempt log、raw evidence collection は #394 または SubAgent / wrapper 側に残すべきです。#394 も SubAgent-owned contract migration として web-researcher の retry / fallback / attempt log を扱う設計です。

    追加すべき Out of Scope:

    • web-researcher / gemini-cli-headless-delegation の retry / fallback / attempt log 設計変更
    • orchestrator が Gemini retry_count / fallback_query / raw_grounding_state を保持すること
    • .claude/agents/*.md の変更

    In Scope はこう絞るべきです。

    1. references 分割の品質ゲートが不足

    #393 の VC は rg "references/" や topic keyword 検索中心です。これでは「ファイルがある」「単語がある」以上を検証できません。progressive disclosure が成立しているかを検証するには、references/index.md を必須にすべきです。

    推奨構成:

    .claude/skills/issue-refinement-loop/references/
    index.md
    refinement-loop-plan-output.md
    anchor-comment-handling.md
    scope-signal-guard.md
    ac-vc-reflection.md
    follow-up-materialization.md
    web-research-routing.md
    termination-policy.md

    index.md には最低限これを持たせるべきです。

    topic file loaded_when owner moved_from must_not
    anchor comment handling anchor-comment-handling.md anchor_comment_url present orchestrator SKILL.md Step 0a-0c repo/web fact を推測で確定しない
    web research routing web-research-routing.md web_research_policy.required orchestrator routing only Step 1b handling retry/fallback/raw grounding を保持しない
    1. SubAgent frontmatter / skills preload を Phase 2 で触らない

    Claude Code の subagent は独立 context window、固有 prompt、tool access、permission を持ちます。tools / disallowedTools / skills は実効挙動に影響し、skills は full skill content を subagent startup context に inject します。

    したがって #393 は .claude/agents/*.md を触らず、SubAgent contract は link-only に留めるべきです。SubAgent-owned contract migration は #394 の責務です。

    追加 Stop Condition:

    参考にすべき先例

    #264 / PR #311 の gemini-cli-headless-delegation thin entrypoint 化は良い先例です。PR #311 は disable-model-invocation: true を追加し、SKILL.md を 225 → 190 → 111 行まで縮小し、詳細を references に移しています。

    #393 も「少し減らす」ではなく、routing entrypoint と references の明確な分離を目標にすべきです。

    投稿用レビュー案

    REQUEST_CHANGES

    #393 の方向性は妥当です。issue-refinement-loop/SKILL.md は PR #388 後に 1226 → 1262 行へ増えており、固定 token cost が未解決なので、thin entrypoint + references 分割は必要です。

    ただし現 contract は親 #391 の要求を満たしていません。

    Blockers:

    1. AC3 が弱いです。「perf(claude): issue-refinement-loop を軽量化する(max_iterations=1 デフォルト / SubAgent 条件付き) #295 後 baseline より減少」ではなく、Claude Code docs の推奨に合わせ SKILL.md <= 500 lines を原則 AC にしてください。超過時は section 名 / references に移せない理由 / 次 follow-up を PR 本文に必須記録してください。

    2. baseline が曖昧です。比較対象は perf(claude): issue-refinement-loop を軽量化する(max_iterations=1 デフォルト / SubAgent 条件付き) #295 Issue の 1226 lines ではなく、PR perf(#295): issue-refinement-loop の SubAgent spawn 上限を軽量化 — max_iterations=1 + policy state 化 #388 merge 後かつ PR feat(#392): extract refinement-loop prose planner to deterministic script #407 merge 後の current main に固定してください。PR 本文には lines / bytes / description chars / when_to_use chars / references index size / references file count を記録してください。

    3. 実装: issue-refinement-loop の deterministic planner/checker script を抽出する #392/PR feat(#392): extract refinement-loop prose planner to deterministic script #407 により REFINEMENT_LOOP_PLAN_V1 が SSOT になっています。実装: issue-refinement-loop SKILL.md を thin entrypoint + references 構成へ分割する #393 では SKILL.md から planner 判定条件の prose 再実装を削除し、pytest で forbidden-fragment を検出してください。

    4. web research handling は retry/fallback/attempt log まで含めると 改善: issue-refinement-loop の web-researcher Step 1b に transient auth failure への 1-retry 機構を追加する #203 の責務整理と衝突します。実装: issue-refinement-loop SKILL.md を thin entrypoint + references 構成へ分割する #393 では orchestrator-side result routing のみを references 化し、Gemini retry / fallback / attempt log は 実装: issue-refinement-loop の SubAgent-owned contract migration を行う #394 または worker/wrapper 側に委譲してください。

    5. references/ は単なる置き場ではなく、references/index.md に topic / file / loaded_when / owner / moved_from / must_not を持たせ、progressive disclosure が検証できる構造にしてください。

    6. Phase 2 は SubAgent-owned contract migration ではありません。.claude/agents/*.md、SubAgent frontmatter、tools/model/skills preload、retry/fallback behavior を触る必要が出た場合は 実装: issue-refinement-loop の SubAgent-owned contract migration を行う #394 へ defer してください。

    この修正なしに実装すると、「長文を references に移しただけで SKILL.md がまだ太い」「planner SSOT を prose で再実装する」「web-researcher の内部復旧責務を orchestrator に戻す」という失敗モードが残ります。

    最小修正セット

    #393 本文に最低限これを追加してください。

    Contract Amendments Required

    現状の #393 は実装に進めるより、まず Issue contract を上記の粒度まで補正した方が安全です。

  3. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    Issue body 更新(edit-issue skill / issue-author SubAgent)

    anchor comment #issuecomment-4537929910 を反映しました。verified by codebase-investigator + web-researcher(baseline = main after PR #407 merge)。

    変更内容(normalized amendments)

    1. AC3 強化(差し替え): 「baseline 比減少」基準を撤回し、「SKILL.md <= 500 行」を pass 条件に固定。500 行超過時は表形式で残す section / references に移せない理由 / 次 follow-up Issue / lines / bytes / frontmatter description chars / when_to_use chars / references/index.md chars / references file count を PR 本文に記録する義務を追加。
    2. Baseline セクション新規追加: base_ref = main after PR feat(#392): extract refinement-loop prose planner to deterministic script #407 merge、1280 行 / 69901 bytes を baseline として固定(perf(claude): issue-refinement-loop を軽量化する(max_iterations=1 デフォルト / SubAgent 条件付き) #295 当時 1226 行 baseline は使わない)。
    3. In Scope 絞り込み: 「web research handling」項を WEB_RESEARCH_RESULT_V1 の orchestrator-side routing 移設に限定(retry/fallback/attempt log は link-only、実装: issue-refinement-loop の SubAgent-owned contract migration を行う #394 または worker/wrapper 委譲)。references/index.md 作成 / disable-model-invocation 採否決定 / paths frontmatter 採否決定 / planner 判定条件の prose 重複除去を追加。
    4. Out of Scope 強化: web-researcher / gemini-cli-headless-delegation の retry/fallback/attempt log 設計変更、orchestrator 側での Gemini retry_count/fallback_query/raw_grounding_state 保持、.claude/agents/*.md 変更、SubAgent frontmatter / tools / disallowedTools / skills / model / retry / fallback 変更を明示的に除外。
    5. AC8/AC9/AC10/AC11 追加:
      • AC8: SKILL.md は REFINEMENT_LOOP_PLAN_V1 consume のみ、investigation_policy / web_research_policy / scope_signal_guard 判定条件の prose 再定義禁止
      • AC9: tests/test_thin_entrypoint.py に forbidden-fragment test
      • AC10: references/index.md に topic/file/loaded_when/owner/moved_from/must_not 列を持つ表
      • AC11: disable-model-invocation: true / paths frontmatter 採否を PR 本文で明示決定
    6. Verification Commands 追加: AC3 baseline コメントを「500 以下を期待」に更新、AC9 / AC10 行を追加。既存 VC(AC1/AC2/AC4/AC6/AC7)は保持。
    7. Stop Conditions 追加: .claude/agents/*.md 変更 → 実装: issue-refinement-loop の SubAgent-owned contract migration を行う #394 defer、SubAgent frontmatter 変更 → 実装: issue-refinement-loop の SubAgent-owned contract migration を行う #394 等、planner script 判定ロジック変更 → 実装: issue-refinement-loop の deterministic planner/checker script を抽出する #392 follow-up。
    8. References セクション新規追加: 親 perf(claude): issue-refinement-loop を script-first / thin entrypoint 化し OPEN 改善 Issue を段階統合する #391、兄弟 実装: issue-refinement-loop の deterministic planner/checker script を抽出する #392 / 実装: issue-refinement-loop の SubAgent-owned contract migration を行う #394、先例 実装: gemini-cli-headless-delegation SKILL.md を thin routing entrypoint に再設計する #264 / PR refactor(#264): gemini-cli-headless-delegation SKILL.md を thin routing entrypoint に再設計する #311、関連クローズ済 改善: issue-refinement-loop の web-researcher Step 1b に transient auth failure への 1-retry 機構を追加する #203、Claude Code Skills/Subagents 一次情報、anchor comment URL。

    Guards 通過状況

    Backup

    • pre-edit body backup: /tmp/issue_393_body_backup_20260526_082446.md(3790 bytes / 95 行)
  4. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    edit-issue: structural template alignment for C1/C5 deterministic checks

    review-issue verdict needs-fix の C1 / C5 blocker に対応した最小差分修正。

    変更セクション

    追加(Machine-Readable Contract 直後に挿入、既存セクションは破壊せず):

    Verification Commands ブロック修正(VC annotation の # AC<N> token を補完):

    • # AC8 を追加: ! rg -n "codebase_required..." SKILL.md(planner 判定条件 prose 再定義の不在検証)
    • # AC11 を追加: echo "AC11 は PR 本文の Frontmatter Decision セクションで実測値を記録"
    • # AC2 AC5 は既存どおり 91 行目に維持

    変更理由

    • C1 (required_sections): implementation テンプレ必須セクション欠落の解消
    • C5 (ac_vc_number_alignment): AC5 / AC8 / AC11 が VC ブロックに # AC<N> 形式で参照される状態を回復

    Guard 結果サマリ

    all_passed: true
    guards:
      template_guard: pass            # missing_sections: []
      outcome_quality_guard: pass
      diff_threshold:
        passed: true
        orig_lines: 140
        new_lines: 171
        diff_lines: +31
      ac_vc_alignment:
        passed: true
        vc_ac_count: 13

    破壊しなかったもの

    • 既存 Outcome / In Scope / Out of Scope / AC1-AC11 / Stop Conditions / References / Baseline / Allowed Paths / Delivery Rule / Runtime Verification Applicability
    • Machine-Readable Contract block の YAML key と値
    • anchor comment URL(raw snapshot は本文に複製していない)

    backup

    • tmp/issue_393_backup_1779751697.md
  5. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: 完了 (2026-05-25T23:33:37Z)

    改善履歴

    1. Iteration 1(anchor comment 反映 / opus): anchor comment の Contract Amendments を本文へ反映。AC3 を 500 行原則へ強化、## Baseline 新設、In Scope から web research 詳細を縮小して 実装: issue-refinement-loop の SubAgent-owned contract migration を行う #394 / worker 側へ defer、Out of Scope に .claude/agents/*.md / retry-fallback-attempt log / SubAgent frontmatter を追加、AC8(planner SSOT 重複禁止)/ AC9(forbidden-fragment test)/ AC10(references/index.md 表)/ AC11(disable-model-invocation / paths frontmatter 決定の明示)を追加、Verification Commands / Stop Conditions / References を補強。
    2. Iteration 2-a(構造補完 / opus): deterministic checker C1 fail を解消するため ## Parent Issue / ## Parent Goal Ref / ## Current Validated Scope / ## Remaining Parent Gaps / ## Required Skills を新設。AC8 / AC9 / AC11 の # AC<N> VC annotation を追加。
    3. Iteration 2-b(C5 mechanical fix): # AC2 AC5 単一コメント表記が checker regex #\s*AC(\d+) で AC5 を取りこぼす issue を解消し # AC2 # AC5 の 2 コメント表記に分割。

    Fact-check 結果(codebase-investigator + web-researcher / haiku)

    Deterministic checks

    C1-C11 すべて PASS(C12 n/a)。

    次アクション


    Model usage policy: codebase-investigator / web-researcher / issue-reviewer は Haiku、issue-author(公開向け本文編集)は Opus、最終判断(fact-check 統合・final_classification 確定・C5 root-cause 解析)は Opus(本メインスレッド)が担当。

  6. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    Contract Review: BLOCKED ($(date -u +%Y-%m-%dT%H:%M:%SZ))

    CONTRACT_REVIEW_RESULT_V1:
      status: blocked
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/393
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: pass
        ac_verifiability: pass
        product_spec_check:
          applicability: not_applicable
          decision: pass
        vc_preflight:
          passed: false
          vc_failed_as_expected: 2
          vc_passed_unexpectedly: 6
          vc_unrunnable: 2
          vc_human_judgment: 3
          blocked: true
        worktree_branch_collision: clear
      next_action: propose_refinement_loop
      blocked_reasons:
        - rule: vc_preflight
          detail: |
            AC1/AC3/AC4/AC6/AC7/AC11 は baseline で exit 0 を返す(unexpected_pass)。
            既存 references/ ディレクトリ(#392 由来の refinement-loop-plan-output.md /
            scope-rollup-policy.md)と SKILL.md 内既存の "references/" 参照、
            無条件 echo / wc コマンドが baseline 失敗を担保していない。
        - rule: vc_preflight
          detail: |
            AC7 `pnpm typecheck && pnpm lint && pnpm test && pnpm build` は
            compound command でありシングルラインに分割が必要。
        - rule: vc_preflight
          detail: |
            AC8 `! rg ...` は preflight が env_missing_dep に誤分類。
            bash 否定形式の VC は明示的な test wrap(例: `if ! rg ...; then exit 0; else exit 1; fi`)が望ましい。
        - rule: blocker_check
          detail: |
            native dependency API は空、fallback parser が `Depends on #295` を検出(mismatch)。
            #295 は CLOSED COMPLETED であり実質ブロッカーなし。GitHub native dependency を登録するか
            Issue 本文表記を整理することで解消可能。

    推奨アクション

    issue-refinement-loop を起動し、VC 契約を以下のように tighten すること:

    • AC1: test -f .claude/skills/issue-refinement-loop/references/index.md に置き換え
    • AC3: test "$(wc -l < .claude/skills/issue-refinement-loop/SKILL.md)" -le 500 に置き換え
    • AC4: 具体的な新規 references file 参照(例: rg -n "references/anchor-comment-handling.md|references/web-research-routing.md" .claude/skills/issue-refinement-loop/SKILL.md)に置き換え
    • AC6: 既存 references/ 配下の追加 topic ファイル存在を test -f で個別に検証
    • AC7: pnpm typecheck && pnpm lint && pnpm test && pnpm build を 4 行に分割
    • AC8: bash 否定形式を if ! rg ...; then exit 0; else exit 1; fi に wrap
    • AC11: PR 本文記録チェックのため baseline 用 VC から除外し、PR review 時のチェック項目として明示
    • 依存関係: Depends on #295 表記を見直すか GitHub native dependency を登録(perf(claude): issue-refinement-loop を軽量化する(max_iterations=1 デフォルト / SubAgent 条件付き) #295 は既に COMPLETED)

    これらの修正後に再度 issue-contract-review を実行し、status: go を確認した上で impl-review-loop を起動してください。

  7. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    ──────────────────────────────────────────────────────────────────
    ☐ 次 ア ク シ ョ ン
    Issue #393 の contract が VC preflight で BLOCKED( baseline で
    unexpected_pass / compound command
    等 が 複 数 ) に な り ま し た 。 impl-review-loop は contract gate
    で 着 手 不 可 で す 。 次 に ど う 進 め ま す か ?
    ❯ 1. issue-refinement-loop で VC を 再 tighten( Recommended)
    BLOCKED コ メ ン ト ( #issuecomment-4538075102) を anchor と し て
    issue-refinement-loop を 再 走 し 、 AC/VC を baseline で fail
    す る よ う に 修 正 し て か ら impl-review-loop を 再 起 動 。 所 要 1-2
    iteration。
    2. 私 が body を 直 接 surgical edit し て VC の み 修 正
    issue-refinement-loop を 介 さ ず 、 Opus が VC
    行 を 上 記 提 案 通 り に 直 接 書 き 換 え る 。 最 短 だ が review skill
    に よ る 品 質 確 認 は 省 略 。
    3. Contract gate を override し て impl-review-loop を 強 行
    skill の hard gate を 意 図 的 に 無 視 し て 実 装 を 開 始 。 preflight
    blocked の ま ま な の で test-runner / pr-reviewer
    段 階 で 同 じ 問 題 が 再 発 す る 可 能 性 が 高 い 。 非 推 奨 。
    4. Type something.
    ────────────────────────────────────────────────────────────────

  8. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    #393 (comment)
    #393 (comment)

    Issue作成、Issue編集、Issueレビューエージェントスキルと実装前Issue確認エージェントスキルの整合性を確認してほしい。改善案を出してほしい。

  9. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    edit-issue 変更経緯

    反映内容

    A. Verification Commands ブロック全面差し替え

    • AC1: test -d .../references → test -f .../references/index.md(baseline で確実に fail)
    • AC3: wc -l(常に exit 0)→ test "$(wc -l < ...)" -le 500(baseline 1280 行で fail 担保)
    • AC4: 汎用 rg "references/" → 個別 references ファイル名 6 件の anchor 検索
    • AC6: rg -n "anchor|scope|..." references/(既存 dir hit)→ topic 別 test -f 6 件
    • AC7: compound pnpm typecheck && pnpm lint && pnpm test && pnpm build(preflight 非対応)→ 1 行 1 コマンドに分割
    • AC8: bash ! invert(env_missing_dep 誤分類)→ if rg -nq ...; then exit 1; else exit 0; fi 明示 wrap
    • AC11: echo "..."(常に exit 0)→ VC ブロックから削除し、AC11 文言側で PR 本文記録要件を明記

    B. AC 文言の VC 整合

    C. Depends On 整理

    不変

    Background / Outcome / In Scope / Out of Scope / Baseline / AC リスト本体 / Allowed Paths / Stop Conditions / Runtime Verification Applicability / Delivery Rule / References / Parent Issue / Parent Goal Ref / Current Validated Scope / Remaining Parent Gaps / Required Skills / title は保持。

  10. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: 完了(needs_second_pass)

    iteration 1 で適用済みの改善(commit: changelog https://github.com/squne121/loop-protocol/issues/393#issuecomment-4538181498)

    • VC ブロック全 11 行差し替え(AC1/AC3/AC4/AC6/AC7/AC8/AC10/AC11)
    • AC1/AC3/AC11 文言を VC と整合
    • Depends On セクションから line-anchored - Depends on #N 表現を除去 → blocker check PASS

    iteration 2 検証結果(再 preflight)

    AC decision 状態
    AC1 / AC4 / AC6 (x6) / AC9 (x2) go OK(expected_baseline_fail / file_not_found_expected)
    AC3 human_judgment test "$(wc -l < ...)" -le 500 の command substitution が unknown 分類
    AC5 human_judgment rg -n "thin entrypoint|..." が unknown 分類
    AC7 (x5) blocked pnpm typecheck 等が baseline で既に PASS → unexpected_pass(regression gate と baseline-fail パターンの構造的不整合)
    AC8 blocked if rg ...; then ...; fi の ; を compound_command_disallowed と判定
    AC10 human_judgment rg -nq "table-header pattern" が unknown 分類

    残課題(loop 内では解決不可能)

    1. AC7 構造問題: pnpm/pytest は「baseline で fail し実装後 pass」ではなく「常に pass を維持する regression gate」。baseline_vc_preflight.py の expected_baseline_fail モデルでは表現不可。impl-review-loop 内の test-runner SubAgent が Step 2 で同等検証を行うため、本来 baseline preflight 対象外で良い。
    2. AC11 構造問題: PR body の Frontmatter Decision 記録は repo-baseline VC で検証不能(PR は未起票)。pr-review-judge が PR 起票後に検証すべき項目。
    3. AC3/AC5/AC10 classifier 限界: wc の command substitution / 複雑な rg pattern / table header 検索は baseline_vc_preflight.py classifier が unknown 判定。実装は問題なく動作するが preflight が human_judgment を返す。
    4. C5 (review-issue checker): AC11 が VC ブロックから除外されたため # AC11 annotation が見つからず C5 fail。

    推奨アクション(人間判断項目)

    以下のいずれかを選択して進める:

    選択肢 内容 影響
    A AC7/AC11 を VC ブロックから削除し、AC 本文に「VC は impl-review-loop の test-runner / pr-review-judge が検証する」と明記。AC8 は ! rg -q "pattern" file # AC8 で再表現。AC3/AC5/AC10 は受容(contract checker は status: human_judgment 返却で impl-review-loop は依然 stop) 部分解決。AC3/AC5/AC10 の human_judgment は残るため impl-review-loop の hard gate を override する判断が依然必要
    B baseline_vc_preflight.py の classifier を拡張(command substitution / regression-gate-mode / 否定 ! の正規化)。別 Issue として起票し、本 #393 は preflight 拡張後に再開 根本解決だが scope 拡大。新規 Issue 必要
    C impl-review-loop の hard gate を「contract に明示的 vc_preflight_override: true marker があれば preflight blocked でも続行」へ拡張。別 Issue 化 構造改善。実装規模中。
    D 本 #393 の現状 contract を受容し、impl-review-loop の vc_preflight: blocked ガードを手動 override して進行 短期解決。preflight 自動判定の安全性が一時的に失われる

    人間判断を待機する。

  11. squne121 commented on May 26, 2026

    @squne121
    OwnerAuthor

    確認結果としては、4スキルは方向性としては揃っているが、契約判定のSSOTが分散しており、実装前preflightで止まるIssueを create/edit/review 側が生成・承認しうる状態です。特に VC grammar、template guard、Outcome guard、Runtime Verification、Required Skills の扱いが重複・微妙に不一致です。

    結論

    #393 自体は issue-refinement-loop/SKILL.md の thin entrypoint 化であり、対象パスも issue-refinement-loop 配下に限定されています。本文上でも .claude/agents/*.md や planner 判定ロジック変更は Out of Scope / Stop Conditions に明示されています。したがって、4スキル横断の整合性修正を #393 に押し込むべきではありません。#393 では references 分割時に「他スキルとの責務境界を壊さない」ことだけを要求し、横断整合は別 Issue に切るのが適切です。

    整合している点

    review-issue は checker script を SSOT とし、LLM が自然言語で補完・再判定しない方針になっています。needs-fix 時も loop 呼び出しなら本文更新せず diff proposal を返し、更新は issue-refinement-loop / edit-issue 側に委ねる設計です。これは責務分離として妥当です。

    edit-issue は既存 Issue 更新時にバックアップ、template guard、Outcome guard、AC/VC alignment、rollback を持っており、create の既存Issue版として位置づけられています。更新系 mutation を安全に閉じ込める設計になっています。

    issue-contract-review は「実装着手直前 preflight」に限定し、Issue本文の品質レビューは review-issue / issue-refinement-loop の責務だと明記しています。これは review と preflight の分離として正しいです。

    主な不整合・リスク

    1. VC grammar が衝突している

    create-issue / body-authoring 側は grep ... && ... || ... や pnpm typecheck && pnpm lint && pnpm test && pnpm build のような compound command を例示しています。一方、issue-contract-review の baseline VC preflight は && / || / | / ; / heredoc を含む compound command を compound_command_disallowed として blocked に分類します。つまり、作成側が推奨したVCを、実装前preflightが拒否する可能性があります。

    改善方針は二択です。

    1. 厳格化案: VC は 1 command / 1 AC / no pipe / no shell compound に統一し、create/edit/body-authoring の例をすべて書き換える。

    2. 許容案: baseline_vc_preflight.py 側に safe compound profile を導入し、cmd1 && cmd2 や rg ... | rg ... など限定形だけ許可する。

    おすすめは 厳格化案です。preflight の分類が単純になり、Terminal Agent が fail reason を誤解しにくいです。

    1. grep と rg の方針が混在している

    edit-issue は VC 更新時に rg を使い、grep は環境差があるため避けるとしています。一方、create-issue / body-authoring には grep の削除確認パターンが残っています。

    改善案: body-authoring.md に VC_COMMAND_PROFILE_V1 を定義し、以下に寄せる。

    • 原則: rg / test / wc / python -m pytest / pnpm の単独コマンド
    • grep は禁止。既存例は rg に置換
    • compound command は禁止。必要なら複数VC行に分割
    • pipe は禁止。見出し配下確認は専用 Python helper か fixture test に寄せる
    1. template guard が fail-open / fail-closed で不一致

    edit-issue の guard-issue-body.py は template が存在しない issue_kind を fail にします。一方、review-issue の checker は template 読み込みに失敗した場合、ハードコード済み required sections に fallback します。これは 同じIssue本文が edit では fail、review では pass しうる原因になります。

    改善案: template 解決は fail-closed に統一する。fallback を残すなら legacy_missing_applicability のような warning ではなく、implementation Issue では blocker にするべきです。

    1. Outcome Quality Guard が3系統に分裂している

    create-issue は成果物形式・完了条件の欠落を prose でガードします。edit-issue は _OUTCOME_NG_RE で「決定される/整理される/完了する/検討する/改善する」などの末尾パターンを検出します。review-issue も VAGUE_OUTCOME_PATTERNS を持っていますが、検出語彙と判定粒度が一致していません。

    改善案: Outcome 判定を issue_contract_core.py に抽出し、create/edit/review で同じ関数を呼ぶ。prose ガイドだけでなく、fixture test で「作成時に通る本文は review/edit/preflight でも通る」ことを保証する。

    1. review-issue と issue-contract-review の責務境界がまだ曖昧

    文書上は分離されていますが、実際には両方が AC/VC の検証可能性を見ます。review-issue は構造・契約品質、issue-contract-review は実装前に VC を baseline 実行して runnable かを見る、という境界を check matrix として固定した方がよいです。

    推奨 matrix:

    項目 create-issue edit-issue review-issue issue-contract-review

    template required sections 生成時に保証 更新時に保証 静的判定 着手前再確認
    Outcome concrete 生成時に保証 更新時に保証 静的判定 原則見ない
    AC/VC番号一致 生成時に保証 更新時に保証 静的判定 着手前再確認
    VC grammar 生成時に保証 更新時に保証 静的判定 実行前判定
    baseline fail 原則実行しない、必要なら cheap dry-run 原則実行しない 実行しない 必ず実行
    blocker/dependency 重複確認のみ 触らない 触らない 必ず確認
    worktree/branch衝突 触らない 触らない 触らない 必ず確認

    #393 への追加要求案

    #393 に横断修正を入れるのではなく、references 分割時の破壊防止として以下だけ追加するのがよいです。

    Additional Constraint: Cross-skill Contract Boundary

    • issue-refinement-loop は create/edit/review/preflight の判定ロジックを再実装しない。
    • Issue本文品質判定は review-issue / check_issue_contract.py を consume する。
    • 本文 mutation は edit-issue または create-issue 経由に限定する。
    • 実装前 runnable / baseline VC 判定は issue-contract-review の責務とし、loop references に再定義しない。
    • references 分割で VC grammar / Outcome guard / Template guard の新規ルールを追加しない。

    別Issueとして切る改善案

    Issue 1: 契約判定コアの共通化

    タイトル:
    実装: Issue contract guard の共通 core を抽出し create/edit/review/preflight の判定差分を解消する

    Outcome:
    .claude/skills/shared/issue-contract-core/ または .claude/lib/issue_contract/ に Issue contract 判定の共通実装が追加され、create-issue / edit-issue / review-issue / issue-contract-review が同じ template / outcome / AC-VC / VC grammar ルールを参照する。

    In Scope:

    • required section 解決
    • Machine-Readable Contract parse
    • issue_kind 解決
    • Outcome concreteness 判定
    • AC/VC番号集合抽出
    • Required Skills guard
    • Runtime Verification Applicability parse
    • 共通 fixture の追加

    Out of Scope:

    • baseline VC の実行
    • GitHub mutation
    • issue-refinement-loop の大規模再設計
    • SubAgent prompt 変更

    Issue 2: VC grammar profile の統一

    タイトル:
    実装: VC_COMMAND_PROFILE_V1 を定義し create/edit/review/preflight の compound command 不一致を解消する

    Outcome:
    Issue本文に書ける Verification Commands の許容文法が VC_COMMAND_PROFILE_V1 として定義され、作成・編集・レビュー・実装前preflightの全段で同じ判定になる。

    Acceptance Criteria:

    • create-issue / body-authoring の grep / compound examples が削除または更新される
    • edit-issue の rg 方針と一致する
    • review-issue checker が同じ profile で静的判定する
    • issue-contract-review baseline preflight が同じ profile で実行可否を分類する
    • fixture で「authoring pass → review pass → contract-review parse pass」を検証する

    Issue 3: review/preflight responsibility matrix の明文化

    タイトル:
    実装: review-issue と issue-contract-review の責務境界 matrix を追加し重複判定を整理する

    Outcome:
    docs/dev/agent-skill-boundaries.md または各 SKILL.md の Related/Contract に、Issue authoring pipeline の責務 matrix が追加され、review-issue が見る項目と issue-contract-review が見る項目が機械可読に分離される。

    重要な決定:

    • review-issue: 静的な本文契約品質
    • issue-contract-review: 着手直前の runnable / dependency / baseline / worktree preflight
    • create/edit: mutation 前の authoring guard
    • issue-refinement-loop: orchestration のみ、判定ロジック再実装禁止

    投稿用コメント案

    #393 には横断整合性修正を直接入れず、責務境界の破壊防止だけを追加するのがよいです。

    現状、create-issue / edit-issue / review-issue / issue-contract-review は方向性としては揃っていますが、Issue contract 判定の SSOT が分散しています。特に以下が不整合です。

    1. VC grammar が衝突しています。create/body-authoring は grep ... && ... || ... や pnpm typecheck && pnpm lint && pnpm test && pnpm build を例示していますが、issue-contract-review の baseline preflight は && / || / | / ; を compound_command_disallowed として blocked にします。作成側が推奨したVCを実装前preflightが拒否しうる状態です。

    2. grep / rg 方針が混在しています。edit-issue は rg 優先・grep回避を明示していますが、create/body-authoring には grep 例が残っています。

    3. template guard が fail-open / fail-closed で揺れています。edit-issue は template missing を fail にしますが、review-issue checker は fallback required sections を使います。同じ本文が edit では fail、review では pass しうる状態です。

    4. Outcome Quality Guard が create prose / edit script / review script に分散し、検出語彙と判定粒度が一致していません。

    5. review-issue と issue-contract-review の責務境界は文書上は分離されていますが、AC/VC検証可能性の扱いが重複しています。review は静的本文品質、contract-review は runnable / baseline / dependency / worktree preflight に限定する matrix を明文化すべきです。

    #393 では以下の制約だけ追加してください。

    • issue-refinement-loop は create/edit/review/preflight の判定ロジックを再実装しない
    • Issue本文品質判定は review-issue / check_issue_contract.py を consume する
    • 本文 mutation は edit-issue または create-issue 経由に限定する
    • 実装前 runnable / baseline VC 判定は issue-contract-review の責務とし、loop references に再定義しない
    • references 分割で VC grammar / Outcome guard / Template guard の新規ルールを追加しない

    横断修正は別 Issue として切るべきです。候補は以下です。

    1. 実装: Issue contract guard の共通 core を抽出し create/edit/review/preflight の判定差分を解消する
    2. 実装: VC_COMMAND_PROFILE_V1 を定義し create/edit/review/preflight の compound command 不一致を解消する
    3. 実装: review-issue と issue-contract-review の責務境界 matrix を追加し重複判定を整理する

    この方針なら、#393 は thin entrypoint 化に集中でき、横断的な契約整合は独立した検証可能な Issue として扱えます。

  12. squne121 commented on May 26, 2026

    @squne121
    OwnerAuthor

    ● Refinement loop は 仕 様 通 り iter=2 max で needs_second_pass
    終 了i。HIssue body はu改l善 さ れiたtが/、pimpl-review-loop の/ hard
    gate(pVC preflight blocked) を 突 破 す る に は contract と script
    の 構R造r的v不e整:合sのl解-決u判h断rがd必r要v。e
    完 了e報g告 : #393 (comment)
    ssuecomment-4538201085
    選 択 肢 A〜 D を どsれuで-進oめtるaかt教rえvてeく だ さbいs:

    • A: AC7/AC11 をr VC 削a除i + AC8/AC11 簡n素で化は + AC3/AC5/AC10
      受R容側(の→ impl-review-loop はg依t然 stop、goverride 判で断到必達要し)て
    • B: baseline_vc_preflight.py classifier 拡 張 を 別 Issue
      化 ( 根 本 解 決 、 実装: issue-refinement-loop SKILL.md を thin entrypoint + references 構成へ分割する #393 は preflight 改 善 後 に 再 開 )
    • C: impl-review-loop に─ vc_preflight_override marker
      機 構 追 加 ( 別 Issue、 構 造 改 善 )
    • D: 現 状 受 容 で impl-review-loop の hard gate を override
      しtてp着:手/
  13. squne121 commented on May 26, 2026

    @squne121
    OwnerAuthor

    結論: B で進めるべきです。D は避けるべきです。

    理由は、今回止まっている原因が #393 の refinement 不足ではなく、baseline_vc_preflight.py が「baseline で fail すべき VC」と「baseline では検証不能・PR本文/人間レビューで確認すべき VC」を十分に分類できていない構造問題だからです。

    #393 本文はすでに、AC11 で disable-model-invocation / paths の採否を PR本文で明示決定し、さらに「baseline_vc_preflight 対象外、pr-review-judge / 人間レビューで確認」と明記しています。これは baseline で機械的に fail させる類の VC ではありません。にもかかわらず hard gate が止めているなら、Issue body ではなく preflight classifier 側の設計不足です。

    推奨方針:

    B: baseline_vc_preflight.py classifier 拡張を別 Issue 化

    そのうえで #393 は preflight 改善後に再開してください。

    A は非推奨です。AC7/AC11 の VC を削る・簡素化する方向は、Issue contract を preflight の都合に合わせて弱めるだけです。しかも提示文どおり、impl-review-loop は依然 stop するので根本解決になりません。

    C は「B の後続または補助策」としてはありです。ただし、vc_preflight_override marker は例外機構なので、先に classifier を直さずに導入すると hard gate の意味が薄くなります。入れるなら、baseline_non_applicable / human_review_only / runtime_gate などの明示理由を要求し、無条件 override にはしない方がよいです。

    D は今回選ばない方がよいです。#391 は #393 に対して、500行以下、計測値記録、frontmatter 採否、単なる baseline 減少では pass しない、という品質ゲートを明示しています。ここで hard gate を override すると、今後も「契約が正しいのに preflight が誤検知する」ケースと「契約が壊れている」ケースを区別できません。

    貼るなら、指示はこれで十分です。

    B で進めてください。

    #393 の Issue body 自体は refinement loop により改善済みで、AC11 も「baseline_vc_preflight 対象外、PR本文 / pr-review-judge / 人間レビューで確認」と明記されています。今回の停止原因は #393 contract の不足ではなく、baseline_vc_preflight.py が以下を分類できていない構造問題と判断します。

    • baseline で fail すべき implementation VC
    • baseline では pass してよい通常 gate(typecheck / lint / test / build)
    • PR 本文・人間レビューで確認すべき VC
    • runtime / post-implementation でのみ評価可能な VC

    したがって #393 の AC/VC を preflight 都合で削るのではなく、baseline_vc_preflight.py classifier 拡張を別 Issue 化してください。#393 はその preflight 改善後に再開します。

    D の hard gate override はしません。C の vc_preflight_override marker は、classifier 拡張後も必要な例外が残る場合に別途検討してください。

    補足: #394 は Phase 3 で、#393 Phase 2 の後続に依存しています。ここで無理に #393 を弱めて進めると、SubAgent-owned contract migration 側にも歪みが伝播します。

  14. squne121 commented on May 26, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop / impl-review-loop: 一時停止

    人間 Decision(#issuecomment-4539742533)に基づき、本 #393 の refinement / 実装は一時停止し、baseline_vc_preflight.py classifier 拡張を扱う #410 のマージ完了後に再開します。

    停止理由

    現 #393 の VC contract は人間 OWNER の方針通り(AC11 で「baseline_vc_preflight 対象外、PR本文 / pr-review-judge / 人間レビューで確認」と明記済み等)であり、AC を preflight 都合で弱める方向(A 案 / D 案)は採用しません。停止原因は preflight classifier 側の構造的不足であり、baseline_vc_preflight.py 拡張を先行させます。

    再開条件

    後続検討(本 #393 とは独立)

    • impl-review-loop の vc_preflight_override marker 機構(C 案): classifier 拡張完了後に必要性を再評価
    • pr-review-judge 側で pr_review_only VC を検証するロジック実装: follow-up Issue 候補

    Issue body 状態

  15. added 4 commits that reference this issue on May 26, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions