Skip to content

refactor: Issue 管理系 skill / agent を LOOP_PROTOCOL 用に適合 (phase C-1) - #17

Merged
squne121 merged 3 commits into
mainfrom
worktree-c1-issue-management-adapt
May 19, 2026
Merged

squne121 merged 3 commits into
mainfrom
worktree-c1-issue-management-adapt

Conversation

@squne121

Copy link
Copy Markdown
Owner

Summary

PR #12 のトリアージ判定(docs/dev/imported-harness-triage.md)に従い、流用してきた Issue 管理系 6 ファイルを LOOP_PROTOCOL 用に書き直しました。

ファイル 行数 適合内容
.claude/skills/create-issue/SKILL.md 631 → 317 大幅改修
.claude/skills/issue-body-authoring/SKILL.md 259 → 170 大幅改修
.claude/skills/issue-contract-review/SKILL.md 236 → 190 大幅改修
.claude/skills/review-issue/SKILL.md 252 → 187 大幅改修
.claude/agents/issue-author.md 510 → 509 軽微修正
.claude/agents/review-issue.md 78 → 78 変更なし

差分: +510 行 / -1,025 行(合計 515 行削減)

主な変更内容

機械的置換

  • .github/ISSUE_TEMPLATE/github-ops-{種別}.md → .github/ISSUE_TEMPLATE/{種別}.yml(PR feat: Issue テンプレート 4 種を採用 (phase B-2) #16 で Issue Forms 化済み)
  • just check / pytest → pnpm typecheck && pnpm lint && pnpm test && pnpm build
  • gpt-5.x モデル → Claude モデル(sonnet / opus / haiku)
  • CodexCLI / Codex CLI → Claude / Claude Code
  • scripts/github_ops/create_issue_txn.py → .claude/skills/create-issue/scripts/create_issue_txn.py

構造的除去(LOOP_PROTOCOL に不適合)

意味調整

  • Required Skills の意味を「ドメイン知識 skill」へ統一(PR feat: Issue テンプレート 4 種を採用 (phase B-2) #16 のレビュー指摘反映)
    • 除外: ワークフロー skill(issue-contract-review / implement-issue / pr-review-judge / ssot-discovery)
    • 含める: TypeScript / ECS / Canvas / Vitest BDD 等のドメイン知識
  • issue-author.md の Python AST 前提を TypeScript(pnpm test <specific-test> で実行系に委ねる)に置換

スコープ外

検証

  • pnpm typecheck ✅
  • pnpm lint ✅
  • pnpm test ✅ (4 files / 5 tests)
  • pnpm build ✅
  • 残骸 grep 全件 0 件:
    • .agents/rules/
    • shared-agent-skills-governance
    • kindle / wip/ / .kiro/ / .codex/ / uiautomation / pywinauto / ingestion_service / bootstrap_recipe
    • gpt-5 / CodexCLI
    • human-confirm
    • github-ops-
    • issueops-operations

関連

🤖 Generated with Claude Code

PR #12 のトリアージ判定に従い、流用してきた Issue 管理系 6 ファイルを
LOOP_PROTOCOL 用に書き直す。

スコープ:
- .claude/skills/create-issue/SKILL.md (631 → 317 行)
- .claude/skills/issue-body-authoring/SKILL.md (259 → 170 行)
- .claude/skills/issue-contract-review/SKILL.md (236 → 190 行)
- .claude/skills/review-issue/SKILL.md (252 → 187 行)
- .claude/agents/issue-author.md (510 → 509 行、軽微修正)
- .claude/agents/review-issue.md (78 → 78 行、変更なし)

主な変更:
- .github/ISSUE_TEMPLATE/github-ops-{種別}.md → {種別}.yml (Issue Forms 化済み)
- just check / pytest → pnpm typecheck/lint/test/build
- gpt-5.x / CodexCLI モデル → Claude モデル (sonnet/opus/haiku)
- .agents/rules/ 参照を除去 → per-directory CLAUDE.md + ssot-discovery で代替 (PR #15)
- shared-agent-skills-governance 参照を除去 (不採用方針)
- KindleAudiobookMakeSystem 例 (wip/, .kiro/, .codex/, ingestion_service.py, bootstrap_recipe.py 等) を除去
- human-confirm 参照を全削除 (テンプレ削除済み PR #16)
- Windows GUI live-verify / uiautomation / pywinauto 関連を除去
- doc-lint baseline / inventory.baseline.json セクションを除去 (KindleAudiobook 固有)
- AI 製品設定 (.codex/config.toml 等) Issue 専用ガードを除去 (LOOP_PROTOCOL 想定外)
- Required Skills の意味を「ドメイン知識スキル」へ統一 (TypeScript / ECS / Canvas / Vitest BDD)
- scripts/github_ops/create_issue_txn.py → .claude/skills/create-issue/scripts/create_issue_txn.py
- issue-author の Python AST 前提を TypeScript / pnpm test 経由に置換

issue-refinement-loop は C-1 のスコープから外し、C-4 (オーケストレーション系) で扱う。
adversarial-review は当面導入しない方針 (PR #12 で削除済み)。

検証:
- pnpm typecheck / lint / test (5) / build すべて通過
- 6 ファイルから .agents/rules/ / shared-agent-skills-governance / KindleAudiobook 残骸 /
  gpt-5 / human-confirm / github-ops- (テンプレ名) / issueops-operations を grep で全件確認 → 0 件

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Comment thread .claude/skills/create-issue/SKILL.md Resolved
Comment thread .claude/agents/issue-author.md Resolved
Comment thread .claude/agents/issue-author.md Resolved
Comment thread .claude/agents/issue-author.md Resolved
Comment thread .claude/skills/create-issue/SKILL.md Resolved
Comment thread .claude/skills/review-issue/SKILL.md Resolved
Comment thread .claude/skills/review-issue/SKILL.md Resolved
Comment thread .claude/skills/review-issue/SKILL.md Resolved
Comment thread .claude/skills/review-issue/SKILL.md Resolved
…化 / uv 化 / SubAgent 設計明確化

PR #17 のレビューコメント 12 件 (3262364450, 3262687877, 3262698145,
3262703209, 3262705372, 3262707821, 3262811151, 3262817721, 3262831491,
3262834912, 3262838780, 3262849910) を反映する。

## 反映内容

### 横断改善

- **`issue-body-authoring` skill を削除し create-issue/references/ に統合**
  共有参照を独立 skill にするのは skill ベストプラクティス違反
  (skill = 自己完結した capability、共有参照は references/ が適切)
  → `.claude/skills/create-issue/references/body-authoring.md` に集約
- **`python3 ` 直接実行 → `uv run python3` に統一** (create-issue 内 2 箇所)
- **責務分離記述を SKILL.md からプロジェクトドキュメントへ移動**
  `docs/dev/agent-skill-boundaries.md` を新設 (78 行)
  全 skill / agent の責務境界・SubAgent vs Skill 設計原則を集約
  SKILL.md 本体に書くとコンテクスト汚染になるため

### create-issue/SKILL.md

- PR スコープ判定を「単一意図 / アーキ層のまとまり / ロールバック単位 / AC 独立性」の決定論的基準で具体化
- issue-body-authoring 参照を新パス (`references/body-authoring.md`) に更新

### issue-author.md

- SubAgent description を「既存 Issue 本文更新専門 (create-issue とは別)」と明示
- 位置づけ表 + Why a SubAgent + Why model: sonnet セクション追加
- TypeScript AST (typescript パッケージ + ts.createSourceFile) を関数スコープ確認手段として明示
- Python AST 前提を撤去
- Pydantic 言及を TypeScript 文脈で Zod として注記 (本実装は別 Issue)
- 他リポジトリ Issue #1658 参照を削除

### review-issue/SKILL.md

- description を「AI Agent が作業に迷わない・ハーネス engineering 観点」で具体化
- 責務分離記述 (issue-contract-review との対比) を SKILL.md から除去
  docs/dev/agent-skill-boundaries.md へ集約 (コンテクスト汚染回避)
- decision-only 判定セクションを撤去
  human-confirm テンプレ削除 (PR #16) と整合させ、state/needs-human ラベルベースの軽量判定に簡素化
- 評価項目を「構造・テンプレ整合 / Outcome 品質 / AC・VC 検証可能性 /
  PR スコープ妥当性 / Required Skills 意味論」のカテゴリに整理

## 検証

- pnpm typecheck / lint / test (5) / build すべて通過
- C-1 範囲の issue-body-authoring 残骸 0 件

C-4 (オーケストレーション系) で扱う範囲に残るパターン:
- impl-review-loop, issue-refinement-loop, post-merge-cleanup, open-pr の
  python3 → uv 化、責務分離記述の docs 移動

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@squne121

Copy link
Copy Markdown
Owner Author

レビュー指摘 12 件をすべて反映し、横断的な改善も併せて push しました(f890d05)。

コメント別の対応

Discussion 対応
r3262364450 (PR スコープ曖昧) 「単一意図 / アーキ層のまとまり / ロールバック単位 / AC 独立性」の 4 基準で具体化。最初の 3 つは決定論的判定可能、4 番目は人間判断が残るとして区別
r3262687877 (issue-body-authoring 統合) issue-body-authoring skill を削除し create-issue/references/body-authoring.md に統合。共有参照を独立 skill にするのは skill ベストプラクティス違反
r3262698145 (TypeScript AST) TypeScript Compiler API (typescript パッケージ + ts.createSourceFile()) を関数スコープ確認手段として明示。Python AST 前提を撤去
r3262703209 (Pydantic / Issue 番号) 他リポジトリ Issue #1658 削除 + Pydantic → Zod 言及(TypeScript の型ベース validator)。本実装は別 Issue で扱う旨注記
r3262705372 (issue-body-authoring 統合) r3262687877 と同対応(削除済み)
r3262707821 (SubAgent 設計) issue-author description を「既存 Issue 本文更新専門(create-issue とは別役割、create-issue を呼ばない)」と明示。Why a SubAgent / Why model: sonnet セクション追加
r3262811151 (自然言語的手順) PR スコープ判定の決定論的化(r3262364450 と一体)、他の自然言語的手順は具体化したものを除き次フェーズで継続改善
r3262817721 (uv で実行) python3 .claude/skills/create-issue/scripts/create_issue_txn.py → uv run python3 .claude/skills/create-issue/scripts/create_issue_txn.py。create-issue 内 2 箇所修正
r3262831491 (責務分離コンテクスト汚染) 責務分離記述を SKILL.md から除去、docs/dev/agent-skill-boundaries.md に集約(プロジェクトドキュメント新設)
r3262834912 (ハーネスエンジニアリング観点) review-issue description を 「AI Agent が作業に迷わない・コンテクスト/ハーネスエンジニアリング観点で決定論的に判定」 と明示。評価項目を 5 カテゴリ(構造整合・Outcome 品質・AC/VC 検証可能性・PR スコープ妥当性・Required Skills 意味論)に再整理
r3262838780 (人間で判断できない) r3262834912 と一体対応。各評価項目に「具体的に何を見るか」を明記
r3262849910 (Issue 種別乖離) decision-only 判定セクションを撤去。human-confirm テンプレ削除 (PR #16) と整合させ、state/needs-human ラベルベースの軽量判定に簡素化

広範に適用した改善(横断調査の結果)

  • issue-body-authoring skill → create-issue/references/body-authoring.md に統合(149 行)
  • docs/dev/agent-skill-boundaries.md 新設(78 行、全 skill / agent の責務境界 + SubAgent vs Skill 設計原則)
  • issue-author SubAgent の位置づけテーブル追加(create-issue との対比明示)

次フェーズで継続対応する横断パターン

C-1 範囲外の以下は、各フェーズで同じ原則を適用する予定:

  • impl-review-loop / issue-refinement-loop / post-merge-cleanup / open-pr 内の python3 直接実行 → uv run python3 化(C-4)
  • implement-issue / issue-refinement-loop / test-runner 内の SKILL.md 責務分離記述 → docs/dev/agent-skill-boundaries.md への移動(C-2 / C-4)

検証

  • pnpm typecheck / lint / test (5) / build 全通過
  • C-1 範囲の issue-body-authoring 残骸 0 件

差し戻し・追加修正があればお知らせください。

Comment thread .claude/agents/issue-author.md Resolved
Comment thread .claude/agents/issue-author.md Resolved
Comment thread .claude/agents/issue-author.md Resolved
Comment thread .claude/agents/issue-author.md Resolved
Comment thread .claude/agents/issue-author.md Resolved
Comment thread .claude/skills/review-issue/SKILL.md Resolved
Comment thread docs/dev/agent-skill-boundaries.md Resolved
Comment thread docs/dev/agent-skill-boundaries.md Resolved
Comment thread docs/dev/agent-skill-boundaries.md Resolved
Comment thread docs/dev/agent-skill-boundaries.md Resolved
PR #17 のラウンド 2 レビューコメント 16 件 (3263128308, 3263136438,
3263137909, 3263141971, 3263269082, 3263517079, 3263526071, 3263529128,
3263531592, 3263533026, 3263536472, 3263547824, 3263549983, 3263555087,
3263556738, 3263558260, 3263589794) を反映する。

## 設計理解の根本的な修正

- **SubAgent = 役割、Skill = 作業手順、関係は「役割が手順を使う」**(責務分離ではない)
- 私の前回設計は「create-issue は新規、issue-author は既存」と誤って責務分離していた
- 正しい設計: issue-author SubAgent が create-issue / edit-issue Skill を使い分ける

## 主な変更

### 新設

- `.claude/skills/edit-issue/SKILL.md`(190 行)
  既存 Issue 本文の更新手順。バックアップ / Template Guard / Outcome Quality Guard /
  差分閾値監視 / AC/VC 番号一致 / gh issue edit --body-file / 変更経緯コメント /
  abort 時自動復旧。出力契約: ISSUE_EDIT_RESULT_V1

### 大幅変更

- `.claude/agents/issue-author.md`(535 → 41 行、494 行削減)
  「Issue を起票・修正する役割」として薄い役割定義のみに。新規起票は create-issue、
  既存修正は edit-issue を使う形に整理。
  削除: Why a SubAgent / Why model: sonnet / TypeScript JSON 検証代替 / 入力源限定 /
  Phase 2 JSON 構造化出力手順(edit-issue skill へ移動)

- `.claude/skills/issue-contract-review/SKILL.md`(190 → 164 行)
  スコープを「作業計画・コンテクストの事前確認」に縮小。
  VC preflight(baseline で fail することの確認)+ AC 検証可能性 + worktree/branch
  命名 preflight + 開発フロー適合性のみに。Issue 内容・文脈レビューは review-issue /
  issue-refinement-loop の責務として除去。出力契約: CONTRACT_REVIEW_RESULT_V1

- `.claude/skills/review-issue/SKILL.md`(186 → 119 行)
  抽象表現を運用可能な手順に。決定論的チェック C1-C8(テンプレ準拠 / Stop Conditions /
  AC checkbox / VC コマンド / AC⇔VC 番号 / 主観表現混入 / Required Skills 意味論 /
  Outcome 抽象パターン)を grep/awk で機械判定する形式に。
  Issue 種別は ISSUE_TEMPLATE を SSOT として参照(種別判定ロジック非保持)。
  PR スコープ判定で「別レイヤー接続要素を変更する場合は 1 PR にまとめる」例外を追加。
  Critical Guard / 責務分離注釈を SKILL.md から除去(コンテクスト汚染回避)。

- `docs/dev/agent-skill-boundaries.md`(78 → 107 行、書き直し)
  「SubAgent = 役割、Skill = 作業手順、関係性は役割が手順を使う」を基本モデルに据えた書き直し。
  各 SubAgent と使う Skill のマッピング表を更新。
  入力源を限定しない(issue-refinement-loop / post-merge-cleanup / main session
  いずれからも呼べることを明示)。
  アンチパターン明示(手順を SubAgent に埋め込む / 共有説明を独立 Skill にする 等)。

## 検証

- pnpm typecheck / lint / test (5) / build すべて通過

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@squne121

Copy link
Copy Markdown
Owner Author

ラウンド 2 のレビュー指摘 16 件を反映して push しました(d754044)。私の根本的な設計理解の誤りを正しました。

設計理解の修正

誤(前回の私): 「create-issue は新規 / issue-author は既存 → 別役割で責務分離」
正(ご指摘): 「SubAgent = 役割、Skill = 作業手順、関係は『役割が手順を使う』」

→ issue-author SubAgent は「Issue を起票・修正する役割」として、create-issue(新規起票)と edit-issue(既存修正、新設)の両 Skill を使う構造に再設計しました。

コメント別の対応

issue-author.md(535 → 41 行)

Discussion 対応
r3263128308 (Issue 起票・修正の役割) 薄い役割定義に再設計。create-issue / edit-issue Skill を使う形に
r3263136438 (Why a SubAgent 不要) 削除(普遍的説明は agent-skill-boundaries に移動)
r3263137909 (Why model: sonnet は ADR 責務) 削除
r3263141971 (利用動線限定不要) 削除。issue-refinement-loop / post-merge-cleanup / main session いずれからも呼べる旨を明示
r3263269082 (TypeScript JSON 検証代替案) 削除(別文書の責務)

新設: edit-issue/SKILL.md(190 行)

issue-author.md から移動した手順内容 + Template Guard / Outcome Quality Guard / 差分閾値監視 / AC/VC 番号一致 / 自動復旧。出力契約 ISSUE_EDIT_RESULT_V1。

issue-contract-review/SKILL.md(190 → 164 行)

Discussion 対応
r3263517079 (スコープ縮小) 「作業計画・コンテクストの事前確認」に縮小。Issue 内容・文脈レビューは review-issue / issue-refinement-loop の責務として除去
r3263526071 (VC preflight 決定論的化) VC preflight 追加: baseline で fail することを確認、想定外 pass / 実行不可なら BLOCKED → issue-refinement-loop を提案(自動起動はせず人間承認後実行)

review-issue/SKILL.md(186 → 119 行)

Discussion 対応
r3263529128 (運用手順に落とす) 決定論的チェック C1-C8 を grep/awk で機械判定する形式に書き換え
r3263531592 (説明 SKILL.md 不要) 責務分離注釈を削除
r3263533026 (作業手順のコンテクストか) Critical Guard セクション撤去、必要事項を Guardrails 末尾に統合
r3263536472 (AC/VC 整理) AC ⇔ VC 番号一致を C5 として機械判定項目に明示
r3263547824 (レイヤー分断) PR スコープ判定で「別レイヤーに接続する要素を変更する場合は 1 PR にまとめる」例外を追加
r3263549983 (Issue 種別 SSOT) Issue 種別判定は .github/ISSUE_TEMPLATE/{種別}.yml を SSOT として参照。本 skill は種別判定ロジックを保持しない

docs/dev/agent-skill-boundaries.md(78 → 107 行)

Discussion 対応
r3263555087 (入力源) 入力源を限定しない。各 Skill の呼び出し元例として複数を明示
r3263556738 (役割) issue-author を「Issue 起票・修正の役割」に統合
r3263558260 (構造的品質チェック責務分離) review-issue と issue-contract-review の使い分けセクションを追加(「呼ぶタイミング」と「次アクション」が異なる旨明示)
r3263589794 (SubAgent vs Skill 設計原則) 「SubAgent = 役割、Skill = 作業手順、関係は役割が手順を使う」を基本モデルに据えた全面書き直し。アンチパターン(手順を SubAgent に埋め込む / 共有説明を独立 Skill にする)も明示

ファイルサイズ変化

ファイル 行数変化
issue-author.md 535 → 41(-494、薄い役割定義に)
edit-issue/SKILL.md(新規) +190
issue-contract-review/SKILL.md 190 → 164
review-issue/SKILL.md 186 → 119
agent-skill-boundaries.md 78 → 107

差分: +486 / -854 行(368 行削減)

検証

pnpm typecheck / lint / test (5) / build 全通過。

差し戻し・追加修正があればお知らせください。

@squne121
squne121 merged commit ffa474f into main May 19, 2026
4 checks passed
@squne121
squne121 deleted the worktree-c1-issue-management-adapt branch May 19, 2026 09:52
squne121 added a commit that referenced this pull request May 19, 2026
* refactor: 実装系 skill / agent を LOOP_PROTOCOL 用に適合 (phase C-2)

PR #12 のトリアージ判定に従い、流用してきた実装系 3 ファイルを
PR #17 で確立した「SubAgent = 役割、Skill = 作業手順」モデルで書き直す。

スコープ:
- .claude/skills/implement-issue/SKILL.md (711 → 223 行)
- .claude/agents/implementation-worker.md (110 → 35 行)
- .claude/agents/test-runner.md (173 → 146 行)

主な変更:

### implement-issue (skill)
- LOOP_PROTOCOL 用に再設計 (pnpm typecheck / lint / test / build)
- worktree は `.claude/worktrees/issue-<番号>-<slug>/` に統一
- TDD + BDD (Vitest + GIVEN/WHEN/THEN) の実装方針を明示
- 出力契約 IMPLEMENT_RESULT_V1 を定義
- 削除した残骸:
  - Rules Loading Preflight (.agents/rules/ ベース、PR #15 で不採用方針)
  - shared-agent-skills-governance 参照
  - .kiro/steering/ 参照
  - wip/ ベースの worktree 配置
  - just check / pytest / uv run pytest
  - ulimit -v 4194304 (Python memory hazard 対策、不要)
  - KindleAudiobookMakeSystem 絶対パスのハードコード
  - human-confirm 経由制御 / decision-only fallback
  - proposal_only / gemini-cli-headless-delegation (今回は範囲外)
  - KH from Issue #1215 等の他リポジトリ Issue 番号

### implementation-worker (agent)
- 薄い役割定義に (110 → 35 行)
- 作業手順は implement-issue skill に委譲
- .agents/rules/ inline 注入機構 (Rules Injection) を撤去
- 「実装作業を担当する役割」として再定義

### test-runner (agent)
- LOOP_PROTOCOL 用に再設計
- 許可コマンド: pnpm typecheck/lint/test/build + grep/rg/ls/cat/test -f/gh pr view
- just check / pytest / ulimit 等の Python プロジェクト前提を撤去
- TEST_VERDICT_MACHINE v1 マーカーと YAML 報告フォーマットは維持
- Mergeable 検知 (CONFLICTING/DIRTY/BLOCKED) は維持

検証:
- pnpm typecheck / lint / test (5) / build すべて通過
- 残骸 grep 全件 0 件 (.agents/rules/ / shared-agent-skills-governance /
  KindleAudiobook / wip/ / .kiro/ / .codex/ / uiautomation / pywinauto /
  gpt-5 / CodexCLI / just check / pytest / github-ops- / human-confirm)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor: PR #18 レビュー指摘 2 件を反映 — `## Use When` 重複を全 my-authored skill から削除、PR 起票を open-pr へ委譲

PR #18 のレビューコメント (3265425040, 3265459750) を反映する。

## 局所修正

- implement-issue/SKILL.md L16: `## Use When` セクションを削除
  description (frontmatter) に既に「いつ使うか」が明記されており、本文への
  再記述はコンテクスト汚染
- implement-issue/SKILL.md L126: PR 起票ロジックを open-pr skill 委譲に変更
  PR 本文テンプレ・publish ゲート・idempotency チェック・Closes/Refs は
  open-pr の責務であり、implement-issue が `gh pr create` を直接呼ぶのは
  責務違反

## 横断適用 (前回方針: 同パターンは同 PR で fix)

私が書いた skill のうち `## Use When` セクションを持っていた全 5 ファイルから
削除:
- create-issue/SKILL.md
- edit-issue/SKILL.md
- issue-contract-review/SKILL.md
- review-issue/SKILL.md
- implement-issue/SKILL.md

(ssot-discovery は元から `## Use When` を持たず該当なし)

## スコープ外 (各フェーズで対応)

以下 6 skill は同じ `## Use When` 重複パターンがあるが、それぞれの
適合 PR で扱う:
- pr-review-judge (C-3)
- adversarial-review は導入しない方針 (削除済み)
- impl-review-loop (C-4)
- issue-refinement-loop (C-1 で除外、C-4 で扱う)
- post-merge-cleanup (C-4)
- open-pr (C-4)
- gemini-cli-headless-delegation (Issue #14)

## 検証

- pnpm typecheck / lint / test (5) / build すべて通過
- implement-issue: 223 → 200 行

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
squne121 added a commit that referenced this pull request May 19, 2026
PR #12 のトリアージ判定 + PR #17-18 で確立した「SubAgent = 役割、Skill = 作業手順」
モデルに従い、レビュー系 skill / agent を LOOP_PROTOCOL 用に書き直す。

スコープ:
- .claude/skills/pr-review-judge/SKILL.md (388 → 189 行)
- .claude/skills/pr-review-judge/references/best-practices.md (41 → 71 行、書き直し)
- .claude/skills/pr-review-judge/references/review-output-contract.md → 削除 (SKILL.md と重複)
- .claude/skills/pr-review-judge/references/step-3x-domain-verification-template.md → 削除 (KindleAudiobook 固有)
- .claude/skills/pr-review-judge/agents/openai.yaml → 削除 (CodexCLI 設定、LOOP_PROTOCOL 不要)
- .claude/agents/pr-reviewer.md (82 → 40 行、薄い役割定義)

主な変更:

### pr-review-judge (skill)
- LOOP_PROTOCOL 用に書き直し
- TEST_VERDICT_MACHINE v1 マーカー経由の mergeable 状態取得は維持
- LOOP_VERDICT YAML 出力契約は維持 (impl-review-loop との連携)
- self-authored PR ガード (--comment のみ) 維持

削除した残骸:
- adversarial-review / adversarial-reviewer 参照 (不採用方針 PR #12)
- structured comment (FINDING_REF) — adversarial 連携用、不要
- Normalized Findings Reference 章
- HALT_BASELINE verdict / baseline-only failure 複雑判定 (簡素化)
- local-ci/just-check / just check → pnpm typecheck/lint/test/build
- KindleAudiobookMakeSystem 絶対 API パスのハードコード
- .codex/agents/*.toml / AGENTS.md / GEMINI.md exempt path patterns
- cc-sdd profile checks (doc-lint / structure チェッカー PR 専用)
- live verification 検証ステップ (LOOP_PROTOCOL はブラウザゲームで live verify なし)
- .agents/rules/ / shared-agent-skills-governance/ 参照
- ## Use When セクション (description で代替)
- ## 責務分離原則 章 (docs/dev/agent-skill-boundaries.md に集約済み)

### pr-reviewer (agent)
- 薄い役割定義に (82 → 40 行)
- 作業手順は pr-review-judge skill に委譲
- Rules Injection 機構を撤去
- adversarial-reviewer / security-reviewer 言及を削除

### references
- best-practices.md: shared-agent-skills-governance 参照を除去、PR 用 worktree を
  tmp/pr-review-* → .claude/worktrees/pr-review-* に更新
- review-output-contract.md: SKILL.md と重複のため削除
- step-3x-domain-verification-template.md: KindleAudiobook 固有 (Kindle for PC2
  実機検証、.kiro/specs/) のため削除

検証:
- pnpm typecheck / lint / test (5) / build すべて通過
- 残骸 grep 全件 0 件

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
squne121 added a commit that referenced this pull request May 19, 2026
…LOOP_PROTOCOL 用に適合 (phase C-4b) (#21)

* refactor: オーケストレーター 2 件 (impl-review-loop + issue-refinement-loop) を LOOP_PROTOCOL 用に適合 (phase C-4b)

C-4 後半。adversarial-review を採用しない方針 (PR #12) に従い、両オーケストレーターから
Step 3 (adversarial review) と Step 1.5 (spec document review) を撤去し、構造を簡素化。

スコープ:
- .claude/skills/impl-review-loop/SKILL.md (142 → 106 行)
- .claude/skills/impl-review-loop/steps/preparation.md (500 → 68 行)
- .claude/skills/impl-review-loop/steps/step-1-implementation.md (184 → 60 行)
- .claude/skills/impl-review-loop/steps/step-2-verification.md (183 → 50 行)
- .claude/skills/impl-review-loop/steps/step-4-pr-review.md (104 → 52 行)
- .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md (383 → 77 行)
- .claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md (185 → 61 行)
- .claude/skills/impl-review-loop/steps/conflicting-pr-escalation-runbook.md (105 → 70 行)
- .claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md (67 → 52 行)
- .claude/skills/impl-review-loop/steps/step-1-5-spec-document-review.md (70) → 削除 (KindleAudiobook 固有)
- .claude/skills/impl-review-loop/steps/step-3-adversarial-review.md (254) → 削除 (adversarial 不採用)
- .claude/skills/issue-refinement-loop/SKILL.md (956 → 200 行)
- .claude/skills/issue-refinement-loop/references/issue-ops-and-handoff-sidecar.md (136 → 54 行)

主な変更:

### impl-review-loop
- ループ構造を 3 ステップに簡素化: 実装 → 検証 → PR レビュー (Step 番号は履歴互換のため 1→2→4→5 のまま保持)
- LOOP_STATE YAML を control-plane の正本として明示
- 責務分離原則を表で明示 (implementation-worker / test-runner / pr-reviewer)
- LOOP_VERDICT 抽出を最新コメント時系列ソートに統一
- CONFLICTING PR Escalation を独立ステップとして整理

### issue-refinement-loop
- 4 段ループ → 3 段ループ (調査 → レビュー → 改善ライト)
- Step 4 で issue-author SubAgent + edit-issue skill 経由の書き戻しに統一 (PR #17 で確立した SubAgent = 役割 / Skill = 手順モデル)
- Critical Guard (refinement では AC を実行しない) を維持
- references/sidecar.md を Parent Mode / GitHub Ops Logging / Scope 変更検出に集約

### 共通: 除去した残骸
- adversarial-review / adversarial-reviewer 参照 (不採用方針)
- spec-document-reviewer / spec document review step
- CodexCLI / gpt-5.x モデル指定例
- .agents/rules/, .agents/skills/shared-agent-skills-governance/
- .kiro/steering/ 参照
- KindleAudiobookMakeSystem 固有 Issue/PR 番号
- Rules Loading Preflight / role manifest 抽出 inline 注入機構
- Human Intent Ledger (decision-only に置き換え可能、現状不要)
- 大量のフォローアップ条件 / 復旧分岐 (簡素化)
- Use When セクション (description で代替)

検証:
- pnpm typecheck / lint / test (5) / build すべて通過
- 残存パターンの 2 件は「adversarial-review を採用しない」旨の意図的注記

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor: PR #21 レビュー指摘 5 件を反映 — 設計記述を docs/dev/ に集約、ループ内人間承認原則を明示

PR #21 のレビュー指摘 5 件 (r3265791383, r3265797212, r3265813497, r3265820430,
r3265826768) + 人間承認原則の追加方針を反映する。

## 局所修正

- impl-review-loop/SKILL.md L34 (責務分離原則章) → docs/dev/agent-skill-boundaries.md へ移動
- impl-review-loop/steps/context-protocol-and-guardrails.md L31 (control-plane / data-plane), L50 (Context 効率) → docs/dev/agent-skill-boundaries.md へ移動。本ファイルは作業手順だけに削減 (52 → 25 行)
- issue-refinement-loop/SKILL.md L41 (責務分離原則章) → docs/dev/agent-skill-boundaries.md へ移動
- issue-refinement-loop/references/issue-ops-and-handoff-sidecar.md (54 行) → 削除。GitHub Ops ルールは docs/dev/github-ops.md に集約

## 横断: 設計原則の docs/dev/ への集約

新規ファイル + 拡張:
- docs/dev/agent-skill-boundaries.md: 「オーケストレーター設計原則」セクションを追加 (+56 行):
  - control-plane / data-plane の分離
  - ループ内の人間承認原則 (新規)
  - LOOP_STATE による状態管理
  - Context 効率 (既存コンテクスト最大活用)
  - 無限ループ防止と冪等性
- docs/dev/github-ops.md (新規 119 行):
  - Body File Guidance (gh issue/pr edit/comment 共通)
  - Pre-edit guard (空ファイル / HEREDOC エスケープ検知)
  - HEREDOC 内コードフェンス規約 (~~~ 推奨)
  - Parent Issue Machine-Readable Contract enum + fail-close
  - Issue / PR コメント記録プロトコル (iteration 開始 / 完了 / ループ終了テンプレ)
  - 認証 / リポジトリ指定 / ラベル運用

## 人間承認原則 (新規方針)

ユーザーがループを起動した時点でループ全体の実行が承認されているため、ループ内では以下を追加承認なしに自動進行する:
- イテレーション継続判断 (REQUEST_CHANGES → 次イテレーション)
- Issue 本文の修正適用 (refinement loop 中の書き戻し)
- 各 Step 間の SubAgent 委譲

例外 (人間判断を仰ぐ): max_iterations 超過 / SubAgent からの human_review_required: true / 想定外エラー。

詳細は docs/dev/agent-skill-boundaries.md「ループ内の人間承認原則」セクション。

## 結果

- skill / step ファイルは作業手順に専念 (設計記述を排除)
- 開発運用ドキュメントが設計原則 + GitHub 運用ルールの SSOT になる
- 検証: pnpm typecheck / lint / test (5) / build すべて通過

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor: PR #21 追加レビュー指摘を反映 — 「docs を正本とする」meta 記述自体を除去

PR #21 のレビューコメント r3265905380 を反映する。

「設計原則は docs を正本とする」「本 skill は作業手順に専念する」といった meta 記述
それ自体が context 汚染。skill ファイルに書く意味はない (エージェントの作業品質を
向上させないし、トークンを消費するだけ)。

横断的に同パターンを除去:

- impl-review-loop/SKILL.md: 冒頭 meta 段落を削除 (97 → 95 行)
- impl-review-loop/steps/context-protocol-and-guardrails.md: 冒頭 meta 段落を削除 (25 → 23 行)
- issue-refinement-loop/SKILL.md: Loop Structure 直後の meta 段落を削除 (192 → 190 行)

skill ファイル冒頭は description + 必要な手順だけにし、設計原則は docs/dev/ に独立して
存在することは Related セクション末尾のリンクだけで示す。

検証: pnpm typecheck / lint / test (5) / build すべて通過

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
squne121 added a commit that referenced this pull request May 19, 2026
#22)

* refactor: 補助系 (codebase-investigator) を LOOP_PROTOCOL 用に適合 (phase C-5)

設計記述・責務境界の長い説明を agent ファイルから削除(PR #21 の方針: 設計は
docs/dev/agent-skill-boundaries.md に集約、agent / skill は作業手順に専念)。

スコープ:
- .claude/agents/codebase-investigator.md (93 → 64 行)

主な変更:
- 「責務境界: ローカルコード調査専念」セクション削除(設計記述)
- 「役割と責務」「制約」の冗長記述削除(description と disallowedTools で表現)
- web-researcher への委任フロー → gemini-cli-headless-delegation 経由 (呼び出し元の責務として簡素化)
- 入力契約をコンパクトに

web-researcher は保留方針 (PR #12) のため本 PR では触らない。

検証: pnpm typecheck / lint / test (5) / build すべて通過

これで Phase C (流用 skill / agent の LOOP_PROTOCOL 適合) が完了:
- C-1: Issue 管理系 (PR #17 マージ済み)
- C-2: 実装系 (PR #18 マージ済み)
- C-3: レビュー系 (PR #19 マージ済み)
- C-4a: open-pr + post-merge-cleanup (PR #20 マージ済み)
- C-4b: impl-review-loop + issue-refinement-loop (PR #21 マージ済み)
- C-5: 補助系 (本 PR)

次は Phase D (統合検証)。

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor: PR #22 レビュー指摘を反映 — codebase-investigator は必ず gemini-cli-headless-delegation 経由で委譲

PR #22 のレビュー指摘 r3266005474 を反映する。

> .claude/agents/codebase-investigator.md も gemini-cli-headless-delegation で必ず作業を委譲するようにして。

実調査 (Read / Grep / Glob による大規模スキャン) はすべて gemini-cli-headless-delegation
skill 経由で Gemini に委譲する設計に変更。本 SubAgent 自身はリクエスト構築 + 委譲 +
結果整形に専念する。

主な変更:

- tools から Grep / Glob を削除 (disallowedTools に移動して技術的にもブロック)
- 残った tools: Bash (wrapper 起動) + Read (結果読み取り)
- 振る舞いセクションを「実調査は Gemini に委譲」と明示
- 入力モードを 2 種類定義し、それぞれの delegation_request_v1 JSON 雛形を例示
  - ローカル調査モード: tool_profile=local_asset_research, role=code_research
  - gh 調査モード: tool_profile=github_research, role=github_research, gh_commands で gh issue list を委譲実行
- 報告形式に「委譲メタ」(wrapper exit / model / request path) を追加
- 委譲不可時 (wrapper ok: false、preflight 失敗) は fail-close (自力代替調査しない)

検証: pnpm typecheck / lint / test (5) / build すべて通過

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant