Skip to content

実装: open-pr skill が safety-sensitive ファイル変更検出時に Safety Claim Matrix テンプレートを PR 本文に自動挿入する #253

Closed as not planned

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "open-pr skill の PR 本文生成ステップで safety-sensitive 変更検出時に Safety Claim Matrix テンプレートを自動挿入し、BLOCKER ループを未然に防ぐ"
change_kind: workflow

Parent Issue

なし(単独改善)

Parent Goal Ref

  • Goal: open-pr skill が safety-sensitive ファイルを含む PR を起票する際、Safety Claim Matrix セクションを人間が手動追記する前に自動挿入することで、pr-review-judge による BLOCKER 差し戻しを事前排除する
  • Desired Destination: N/A(単独改善 Issue のため)

Current Validated Scope

  • .claude/skills/open-pr/SKILL.md の Procedure に、PR 本文生成時の Safety Claim Matrix テンプレート自動挿入手順を追加する(changed paths が .claude/skills/** または .claude/agents/** にマッチする場合)

Remaining Parent Gaps

なし(単独改善 Issue のため)

Outcome

.claude/skills/open-pr/SKILL.md の Procedure が更新され、changed paths に .claude/skills/** または .claude/agents/** が含まれる場合は PR 本文生成時点で Safety Claim Matrix テンプレートが自動挿入される手順が明文化される。かつ pnpm typecheck && pnpm lint && pnpm test && pnpm build が PASS する。

Background

PR #240 の iteration 0 において、implementation-worker が .claude/skills/** を変更する PR を起票した際、Safety Claim Matrix セクションが含まれていなかったため pr-review-judge に BLOCKER として指摘された(iteration 1 で PR 本文修正により解消)。

現時点の open-pr SKILL.md(Step 2.5)は Safety Claim Matrix Guard として「セクションが存在しなければ E_SAFETY_CLAIM_MATRIX_MISSING で停止する」ガードを持つが、テンプレートの自動挿入は行わない。このため implement-issue / impl-review-loop が渡す pr_body にセクションが欠落していた場合、guard で止まるだけで再起動ループが発生する。

決定論的修正方針(ステップ 2: 決定論的修正の検討):
SKILL.md の PR 本文生成フローに「safety-sensitive パターンにマッチした場合、pr_body に ## Safety Claim Matrix テンプレートブロックを自動挿入してから guard を通過させる」手順を追記する。

workaround との比較:
prompt 注記で SubAgent に「Safety Claim Matrix を書くこと」を毎回指示する方法は再現性・保守性が低く、同様の見落としが再発するリスクが高い。SKILL.md への決定論的記述が優先される。

In Scope

  • .claude/skills/open-pr/SKILL.md の Procedure に、PR 本文生成時の Safety Claim Matrix テンプレート自動挿入手順を追加する
    • 対象パターン: .claude/skills/** / .claude/agents/**(既存 Step 2.5 の safety-sensitive 判定パターンと整合させる)
    • テンプレートブロック: 必須列(Claim / Implemented? / Not controlled / Evidence / Follow-up)を持つ Markdown テーブルのスケルトン
    • 挿入タイミング: Step 2.5 guard 実行前(guard は挿入後の本文に対して実行)

Out of Scope

  • open_pr.py(Python wrapper)のコード変更(SKILL.md の手順記述変更のみ)
  • .claude/agents/** 以外の safety-sensitive パターン(*transport* / *permission* 等)への自動挿入拡張
  • Safety Claim Matrix の内容を AI が自動埋めすること(スケルトン挿入のみ)
  • #170(E_SCHEMA_CONSUMER_INVENTORY_MISSING guard の open_pr.py 実装)のスコープを変更すること

Acceptance Criteria

  • AC1: .claude/skills/open-pr/SKILL.md の Procedure に、changed paths が .claude/skills/** または .claude/agents/** にマッチする場合に ## Safety Claim Matrix テンプレートブロックを pr_body へ自動挿入する手順が記述されている
  • AC2: 自動挿入のテンプレートブロックが必須列(Claim / Implemented? / Not controlled / Evidence / Follow-up)を含む Markdown テーブルスケルトンである
  • AC3: 挿入ステップが Step 2.5(Safety Claim Matrix Guard)の前に配置されており、guard は挿入後の pr_body を対象とすることが明記されている
  • AC4: pnpm typecheck && pnpm lint && pnpm test && pnpm build が PASS する

Verification Commands

# AC1: 自動挿入手順が SKILL.md に存在することを確認
rg -n "自動挿入" .claude/skills/open-pr/SKILL.md
rg -n "Safety Claim Matrix" .claude/skills/open-pr/SKILL.md

# AC2: テンプレートブロックに必須列が記述されていることを確認
rg -nA 10 "Safety Claim Matrix.*テンプレート\|自動挿入.*テンプレート" .claude/skills/open-pr/SKILL.md | rg "Claim|Implemented|Not controlled|Evidence|Follow-up"

# AC3: 挿入ステップが 2.5 の前に配置されている記述が存在することを確認
rg -n "2\.5.*前\|guard.*挿入後\|挿入後.*guard" .claude/skills/open-pr/SKILL.md

# AC4: 品質ゲート
pnpm typecheck && pnpm lint && pnpm test && pnpm build

Allowed Paths

  • .claude/skills/open-pr/SKILL.md

Stop Conditions

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

Required Skills

なし

Scope Delta(任意)

N/A

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本 Issue の変更対象は .claude/skills/open-pr/SKILL.md(workflow 記述変更)であり、実動作検証は静的テキスト確認のみで完結する。PR 本文生成の実動作確認は後続の open-pr 呼び出し時に自然に検証される

Delivery Rule

  • 1 Issue = 1 PR
  • Draft PR 既定
  • worktree: 任意

Source

follow-up:squne121/loop-protocol:pr/240:open-pr-safety-claim-auto-insert

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    triage-required
    on May 23, 2026
  2. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    Superseded by #371 / #330 / #144 (2026-05-24T11:40:58Z)

    本 Issue は pr-review-judge / open-pr / implement-issue の SKILL.md に Safety Claim Matrix の prose/template 雛形を追記する設計として起票されたが、Issue #244 の validator-script-centric 方針と #295 の SKILL.md 行数中立性制約に従い、同一フォーマットの雛形を複数 SKILL.md に重複記述する方針を採用しない。

    機械検証への一元化により本 Issue は standalone 実装せず close する。

    吸収先(責務分界):

    関連根拠:

    termination_reason: superseded_by_decision
    closed via: issue-refinement-loop (#371 iter 完了後の follow-up cleanup)

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

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions