Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "GitHub CLI コマンドを display-readonly / readonly-artifact-export / github-issue-mutation / github-pr-metadata / destructive の 5 分類に再編し、AI workflow 必須の gh issue create/edit/comment/close/reopen を github_issue_mutation_command として許可し、gh issue view の tmp/ への redirect を readonly_artifact_export_command として許可する。docs / rules / hooks / skills の分類語彙を統一する"
change_kind: codeParent Issue
none(単独改善)
Parent Goal Ref
- Goal: PR fix(guard): gh issue/pr GitHub ops を allowlist-closed から除外し post-merge-cleanup 操作を復元する #1120 (fix: gh issue/pr GitHub ops を allowlist-closed から除外し post-merge-cleanup 操作を復元) のフォローアップとして、GitHub CLI コマンドの 5 分類体系を確立する
- Desired Destination: guard スクリプト・tests・hook-boundaries.md・agent-skill-boundaries.md・AGENTS.md・.codex/rules/default.rules が同じ分類語彙を使い、AI workflow 必須の gh issue create/edit が hook に阻害されない状態
Current Validated Scope
scripts/agent-guards/local_main_branch_guard.py:github_issue_mutation_commandreason_code 追加gh issue create(非対話・repo 限定・body-file 付き)を allowgh issue edit(非対話・repo 限定・body-file 付き)を allowgh issue view > tmp/*.md(readonly_artifact_export_commandとして allow)gh pr merge/gh pr checkout/gh pr update-branchは block 維持- bare / interactive / wrong-repo / unsafe-redirect は block
tests/codex/test_local_main_branch_guard.py: AC1〜AC15 の境界テスト追加.claude/hooks/tests/test_local_main_branch_guard.py: AC1〜AC15 の境界テスト追加docs/dev/hook-boundaries.md: 5 分類の判断基準セクション追加docs/dev/agent-skill-boundaries.md: gh CLI 分類語彙を hook-boundaries.md に揃えるAGENTS.md: 「direct gh issue create/edit は禁止」記述を「managed skill 経由は許可」に更新.codex/rules/default.rules:gh issue create/edit/close/reopenの approval mode をautoに更新
Remaining Parent Gaps
なし(このフォローアップが完了すれば PR #1120 の関連 tech debt と #1089 の分類未整理 gap は解消)
Outcome
scripts/agent-guards/local_main_branch_guard.py が 5 分類(display-readonly / readonly-artifact-export / github-issue-mutation / github-pr-metadata / destructive)を実装し、tests/codex/test_local_main_branch_guard.py および .claude/hooks/tests/test_local_main_branch_guard.py の境界テストが PASS しており、docs/dev/hook-boundaries.md に 5 分類の判断基準が記録され、関連ドキュメント(AGENTS.md、.codex/rules/default.rules、docs/dev/agent-skill-boundaries.md)が同じ分類語彙を使っている状態。
Background
PR #1120(2026-06-21 マージ済み)は gh issue/pr 系コマンドを allowlist-closed から除外し、post-merge-cleanup で必須の gh issue close / gh issue comment 等を github_remote_ops_command reason_code で記録するよう修正した。
しかし以下の問題が残存する:
-
分類が 2 つ(display-readonly / github_remote_ops_command)しかなく不十分:
gh issue view > tmp/foo.md(ローカルファイル出力)は pure display-readonly とは異なる。gh issue edit・gh issue createは mutation だが AI workflow に必須であり、display-readonly でも github_remote_ops_command でもない。 -
AI workflow 必須コマンドが阻害されている:
gh issue edit(edit-issue skill が使用)・gh issue create(create-issue skill が使用)はis_gh_mutation_command()に分類されブロックされている。これらはgithub_issue_mutation_commandとして first-class 化が必要。 -
ドキュメント間の語彙不統一:
AGENTS.mdは "direct gh issue create/edit は forbidden" と書いており、agent-skill-boundaries.mdの skill 経由許可と矛盾する。.codex/rules/default.rulesはgh issue create/edit/close/reopenをprompt扱いにしており、hook 設計と乖離している。
新 5 分類語彙(このIssueの中核成果):
| 分類 | reason_code | 代表コマンド |
|---|---|---|
display_readonly_command |
readonly_command |
gh issue view, gh pr view, stdout のみ |
readonly_artifact_export_command |
readonly_command |
gh issue view ... > tmp/*.md |
github_issue_mutation_command |
github_remote_ops_command |
gh issue create/edit/comment/close/reopen |
github_pr_metadata_command |
github_remote_ops_command |
gh pr comment/review |
github_destructive_command |
gh_mutation_denied |
gh pr merge, gh pr checkout |
Source
dedupe_key: "follow-up:squne121/loop-protocol:pr/1120:github-remote-ops-classification"
pr_source: "https://github.com/squne121/loop-protocol/pull/1120"
materialization_phase: post-merge-cleanup
anchor_comment: "https://github.com/squne121/loop-protocol/issues/1124#issuecomment-4762317985"In Scope
local_main_branch_guard.pyの 5 分類ロジック実装(github_issue_mutation_command追加)gh issue create(非対話・--repo squne121/loop-protocol必須・--body-file tmp/*.md必須)を allowgh issue edit <N>(非対話・--repo squne121/loop-protocol必須・--body-file tmp/*.md必須)を allow- bare / interactive(
--editor/--web/-e/-w)/--repo不一致 /--body-file -は block gh issue view ... > tmp/*.md(readonly_artifact_export_command)を allowgh issue view ... > src/.../> docs/.../> .env/>> ...は blockdisplay_readonly_commandとreadonly_artifact_export_commandの分離gh pr merge/gh pr checkout/gh pr update-branch/gh pr createは block 維持- 境界テストを
tests/codex/test_local_main_branch_guard.pyと.claude/hooks/tests/test_local_main_branch_guard.pyに追加 docs/dev/hook-boundaries.mdへの 5 分類判断基準セクション追記docs/dev/agent-skill-boundaries.mdの gh CLI 語彙更新AGENTS.mdの "direct gh issue create/edit は forbidden" → "managed skill 経由は許可" に修正.codex/rules/default.rulesのgh issue create/edit/close/reopenの approval mode 更新
Out of Scope
- PR fix(guard): gh issue/pr GitHub ops を allowlist-closed から除外し post-merge-cleanup 操作を復元する #1120 本体の変更取り消し
gh pr merge/gh pr checkoutを許可することgh api系コマンドの分類変更(別途検討)- CI ワークフローファイルの変更
--body-fileのパス policy 詳細実装(follow-up Issue)
Acceptance Criteria
- AC1:
local_main_branch_guard.pyにgithub_issue_mutation_commandを分類する関数または判定ロジックが実装されている - AC2:
gh issue view/gh pr view/gh issue list等の display-readonly コマンドが guard でreadonly_commandとして扱われ、github_issue_mutation_commandでブロックされない - AC3:
gh issue close/gh issue comment <N> --body <text>/gh issue reopen等がgithub_remote_ops_commandreason_code として allow される - AC4:
tests/codex/test_local_main_branch_guard.pyに AC1〜AC3 の境界テストが追加され PASS する - AC5:
.claude/hooks/tests/test_local_main_branch_guard.pyに AC1〜AC3 の境界テストが追加され PASS する - AC6:
docs/dev/hook-boundaries.mdに 5 分類(display-readonly / readonly-artifact-export / github-issue-mutation / github-pr-metadata / destructive)の判断基準セクションが追加されている - AC7: 既存テストが退行していない
- AC8:
gh issue edit <N> --repo squne121/loop-protocol --body-file tmp/foo.mdが guard で allow される - AC9:
gh issue create --repo squne121/loop-protocol --title "タイトル" --body-file tmp/foo.md --label enhancementが guard で allow される - AC10: bare
gh issue create(--body-fileなし)と baregh issue edit 123(--body-fileなし)は block される - AC11:
gh issue view 123 --repo squne121/loop-protocol --json body --jq .body > tmp/issue_123.mdが guard で allow される(readonly_artifact_export_command) - AC12:
gh issue view 123 > src/foo.md/> docs/foo.md/> .env/>> tmp/foo.mdは block される - AC13:
gh issue create/edit/comment/close/reopenはreadonly_commandでないことを両 flavor テストで確認する - AC14:
gh pr merge 123/gh pr checkout 123/gh pr update-branchは block される - AC15:
AGENTS.md、.codex/rules/default.rules、docs/dev/hook-boundaries.md、docs/dev/agent-skill-boundaries.mdの policy 語彙が 5 分類に統一されている
Verification Commands
# AC1
$ rg -n "github_issue_mutation" scripts/agent-guards/local_main_branch_guard.py
# AC2
$ uv run pytest tests/codex/test_local_main_branch_guard.py -v -k "display_readonly or gh_readonly"
# AC3
$ uv run pytest tests/codex/test_local_main_branch_guard.py -v -k "gh_issue_close or gh_issue_comment or gh_issue_reopen"
# AC4
$ uv run pytest tests/codex/test_local_main_branch_guard.py -v
# AC5
$ uv run pytest .claude/hooks/tests/test_local_main_branch_guard.py -v
# AC6
$ rg -n "readonly_artifact_export" docs/dev/hook-boundaries.md
$ rg -n "github_issue_mutation" docs/dev/hook-boundaries.md
$ rg -n "github_destructive" docs/dev/hook-boundaries.md
# AC7
$ uv run pytest tests/codex/test_local_main_branch_guard.py .claude/hooks/tests/test_local_main_branch_guard.py -q
# AC8
$ rg -n "gh_issue_edit" tests/codex/test_local_main_branch_guard.py
# AC9
$ rg -n "gh_issue_create" tests/codex/test_local_main_branch_guard.py
# AC10
$ rg -n "bare_gh_issue" tests/codex/test_local_main_branch_guard.py
# AC11
$ rg -n "artifact_export_allow" tests/codex/test_local_main_branch_guard.py
# AC12
$ rg -n "artifact_export_block" tests/codex/test_local_main_branch_guard.py
# AC13
$ rg -n "gh_mutation_not_readonly" tests/codex/test_local_main_branch_guard.py
# AC14
$ rg -n "gh_pr_merge" tests/codex/test_local_main_branch_guard.py
# AC15
$ rg -n "readonly_artifact_export" docs/dev/hook-boundaries.md
$ rg -n "github_issue_mutation" docs/dev/hook-boundaries.md
$ rg -n "github_destructive" docs/dev/hook-boundaries.md
$ rg -n "github_issue_mutation" docs/dev/agent-skill-boundaries.md
$ rg -n "github_issue_mutation" AGENTS.md
$ rg -n "github_issue_mutation" .codex/rules/default.rules
# 全体品質ゲート
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm buildAllowed Paths
scripts/agent-guards/local_main_branch_guard.pytests/codex/test_local_main_branch_guard.py.claude/hooks/tests/test_local_main_branch_guard.pydocs/dev/hook-boundaries.mddocs/dev/agent-skill-boundaries.mdAGENTS.md.codex/rules/default.rules
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Runtime Verification Applicability
decision: deferred
deferred_destination: 本 Issue の実装完了後(AC8〜AC13 の境界テストが tests/codex/test_local_main_branch_guard.py に追加された時点)
deferred_verification_condition: uv run pytest tests/codex/test_local_main_branch_guard.py .claude/hooks/tests/test_local_main_branch_guard.py -v が全 PASS
Required Skills
- Python(guard スクリプト実装・pytest)
- GitHub CLI コマンド分類設計(5 分類境界)
- hook boundary design(display-readonly / artifact-export / mutation / destructive 分類)
Scope Delta(任意)
Scope Delta 適用: anchor comment(issuecomment-4762317985)の人間フィードバックに基づき、以下を拡張。
gh issue create/gh issue editを許可対象に追加(github_issue_mutation_command新設)gh issue view > tmp/*.mdをreadonly_artifact_export_commandとして許可- Allowed Paths に
AGENTS.md、.codex/rules/default.rules、docs/dev/agent-skill-boundaries.mdを追加 - AC8〜AC15 追加(anchor comment 修正提案)
- 5 分類語彙を In Scope・Outcome・Background に明示
Delivery Rule
1 Issue = 1 PR。worktree issue-1124-github-remote-ops-classification で作業する。Draft PR から開始する。
Activity
squne121 commentedon Jun 21, 2026
you asked
message time: 2026-06-21 23:25:03
#1124
内容について関連Issue、PR、コメントを参照した上で敵対的レビューして。
取り扱う技術や配布物の実装をWEB調査し高品質化してほしい。
chatgpt response
対象 Issue と関連する Issue/PR/コメントをまず取得し、実装・配布物に関わる主張は外部ドキュメントで裏取りします。その上で、採用可否・欠陥・追加すべき受け入れ条件まで絞ってレビューします。
ここまでで、#1124 自体にコメントはなく、実質的な参照元はマージ済み PR #1120 と、その元 Issue #1108 です。既に #1120 の本文と差分上に「許可対象の過大化→最小集合へ戻す」文脈が見えています。
関連元の Issue/PR は確認済みですが、#1124 を直接参照する実装 PR が既に出ていないかだけ追加で確認します。これでレビュー対象の漏れを潰します。
判定
REQUEST_CHANGES。
#1124 の方向性、つまり
display-readonlyとgithub_remote_ops_commandを分離すること自体は正しいです。ただし、Issue 本文の分類対象が現行実装・#1089 の既存 contract・PR #1120 の実装後状態と一部衝突しています。このまま実装すると、単なる境界明確化ではなく false allow の再導入 になります。#1124 自体に追加コメントはありません。前提整理
#1089 / PR #1100 の元 contract はかなり明確です。
gh issue view/listとgh pr view/list/statusはdisplay_readonly_command、それ以外のgh issue/prmutation は fail-closed でした。特に #1089 の AC11 はgh issue edit/comment/close、gh pr checkout/merge/update-branchを fail-closed とする設計です。#1108 は、その fail-closed 化で
post-merge-cleanupに必要なgh issue close/commentまで止まったことへの regression fix でした。ただし #1108 初期案はgh issue create/edit/commentやgh pr create/edit/commentを regex で広く allow する案で、レビューコメントでは「read-only / remote mutation / interactive / branch-dependent を混同する」と強く指摘されています。PR #1120 はその後、
REASON_GITHUB_REMOTE_OPS = "github_remote_ops_command"と token-based classifier を追加し、gh issue close/comment/reopen、gh pr comment/editの一部を allow する実装へ寄せています。現行mainでもdisplay-readonlyはDISPLAY_READONLY_PATTERNS、remote ops はis_github_remote_ops_command()、その他gh issue/prはis_gh_mutation_command()で block という構造です。重大ブロッカー
B1. #1124 は
gh issue editとgh pr mergeを “AI workflow 必須” として混ぜており、現行実装と衝突している#1124 の本文は
gh issue close/gh issue commentに加えて、gh issue edit、gh pr merge、gh pr commentなどをgithub_remote_ops_commandとして明示分類するよう読めます。特に検索結果上の #1124 本文では、AI workflow 必須コマンドの例にgh issue editとgh pr mergeが含まれています。これは危険です。現行実装は
gh issue editを明示的に除外し、テストでも block しています。gh pr mergeはさらに危険です。GitHub CLI の公式 manual ではgh pr merge --delete-branchが local / remote branch の削除を含み得ます。これは local root branch guard の目的に直接関わるため、github_remote_ops_commandではなく fail-closed 維持が妥当です。(GitHub CLI)修正: #1124 の scope / AC から
gh pr mergeを削除してください。gh issue editも初回では block 維持、必要なら別 Issue で「許可 flag matrix」を定義すべきです。B2.
--body-fileの扱いが粗く、ファイル読込経由の情報漏えいを許容している現行実装は
gh issue comment <N> --body-file <path>とgh pr comment <N> --body-file <path>を allow しています。テストにも/tmp/body.txtを allow するケースがあります。GitHub CLI 公式 manual では
--body-fileはファイルから本文を読み込み、-なら stdin から読むオプションです。これは「コメント追加」ではなく「ローカルファイル内容を remote に送信する」操作です。(GitHub CLI) (GitHub CLI)修正: 初回の #1124 では
--body-file/-Fを block に寄せるべきです。どうしても許可するなら、少なくとも--body-file -のみ許可、または repo-relative な安全な一時ファイルパスだけに限定してください。/tmp, absolute path,.., home path,/proc,/etcは block です。B3. comment 系の destructive / interactive flag block が不足している
現行実装で明示 block しているのは
--delete-last,--editor,--webだけです。しかし公式 manual 上、
gh issue comment/gh pr commentには--edit-last、--create-if-none、--yes、短縮形-e/-w、-Fなどもあります。--edit-lastは既存コメント編集、--delete-lastは削除、--editor/--webは外部 UI / 対話系です。(GitHub CLI) (GitHub CLI)修正: block list は最低限次を含めるべきです。
--body-fileを許可する場合でも、別の path policy を必須にしてください。B4.
has_body判定が flag の存在だけで、値の存在を検証していない現行実装は
--body,-b,--body-fileの token が含まれていればhas_body = Trueになります。つまりgh issue comment 123 --bodyのような「値なし flag」を guard が allow し得ます。修正:
--body text,--body=text,-b textの値あり形式だけを allow してください。値なし、次 token が別 flag、空文字相当は block です。--body-fileは B2 の通り初回 block が安全です。B5.
gh pr edit <N>が広すぎる現行実装は
gh pr editについて、PR 番号が数字ならその後の flag matrix を見ずに allow します。公式 manual では
gh pr editは base branch、body file、labels、projects、reviewers、assignees など多くの PR metadata を変更できます。また引数なしの場合は current branch の PR を選択します。(GitHub CLI)修正:
gh pr editは初回 #1124 では block 維持が妥当です。必要なら次のような極小許可に限定してください。B6.
--repo/-Rの repo 境界が未定義gh issue/prには inherited--repoがあり、別 repo を対象にできます。公式 manual でも--repo <[HOST/]OWNER/REPO>が共通 option として示されています。(GitHub CLI) (GitHub CLI)現行 classifier は
--repoを見ません。local root context で実行される前提でも、AI workflow の guard としては「この repo に対する remote mutation だけを許す」ことを明示した方が安全です。修正: どちらかを AC に入れてください。
実装上は B の方が既存運用への影響が少ないです。
B7. docs が現行実装と矛盾している
docs/dev/hook-boundaries.mdはまだreason_code一覧にgithub_remote_ops_commandを含めておらず、gh mutation コマンド(edit/close/merge 等)は fail-closedと記載しています。これは PR #1120 後の現行実装と矛盾します。修正: #1124 の中心成果物は code より doc の正本化です。
hook-boundaries.mdに次を明記してください。B8. 評価順により drifted / detached root でも remote ops が通るが、#1124 の AC に明記されていない
現行
evaluate()はis_github_remote_ops_command()を root state 判定より前に置いています。そのためgithub_remote_ops_commandは drifted / detached root でも allow されます。これは設計としてはあり得ます。GitHub Issue コメントや close は local checkout を壊さないためです。ただし、guard policy としては重大な判断です。#1124 の docs / tests に明記されていないと、後続レビューで「なぜ drifted root でも allow なのか」が再びブレます。
修正: AC に次を追加してください。
推奨する allow / block matrix
初回 #1124 ではこの程度まで絞るのが妥当です。
gh issue view <N>readonly_commandgh issue listreadonly_commandgh pr view <N>readonly_commandgh pr listreadonly_commandgh pr statusreadonly_commandgh issue close <N> [--reason ...] [--comment ...]github_remote_ops_commandgh issue reopen <N> [--comment ...]github_remote_ops_commandgh issue comment <N> --body <text>github_remote_ops_commandgh pr comment <N> --body <text>github_remote_ops_commandgh issue edit ...unparseable_branch_mutationgh issue create ...unparseable_branch_mutationgh pr create ...unparseable_branch_mutationgh pr edit ...unparseable_branch_mutationgh pr merge ...unparseable_branch_mutationgh pr checkout ...gh api ...unparseable_branch_mutationgh pr createは current branch が fully pushed でない場合に push 先を尋ねたり fork / push に関与し得るため、remote metadata 操作として扱うべきではありません。(GitHub CLI)gh pr checkoutは local git checkout を行うコマンドなので、local root branch guard の対象そのものです。(GitHub CLI)gh issue createも bare 実行では対話入力や--web、--editor、--body-fileなどを含むため、#1124 の初回対象から外すのが安全です。(GitHub CLI)追加すべき AC
#1124 の AC は現状だと「境界を明示する」には弱いです。以下を追加してください。
検証コマンドの差し替え
#1124 の
rg -c "github_remote_ops_command"のような検証は弱いです。分類境界の品質保証になりません。次を canonical gate にしてください。最終提案
#1124 は 実装 Issue としては採用可 ですが、着手前に Issue 本文を修正すべきです。特に
gh issue editとgh pr mergeをgithub_remote_ops_commandに含める表現は削除してください。#1124 の目的は「GitHub remote ops を read-only に誤分類しないこと」であって、「GitHub CLI mutation を広く許可すること」ではありません。実テストはこの場では実行していません。上記は GitHub 上の Issue / PR / コメント / 現行ファイルと、GitHub CLI 公式 manual に基づく静的レビューです。
you asked
message time: 2026-06-21 23:34:42
「gh issue edit」は許容でしょ。あとview をリダイレクトでmdファイルへ出力とかも許可。
「gh issue create」は許可じゃないの?そうじゃななかったらどういう手段で実行スべきなのかエージェントフレンドリーに出力して。
AI運用設計を網羅的に確認して。hook、スキルなど。
chatgpt response
方針を修正します。あなたの運用前提では
gh issue editとgh issue createは禁止ではなく、非対話・repo限定・本文/ラベル/readback付きの管理された mutation として許可対象に寄せるべきです。今から repo の hook/skill/rules/docs 側の整合を確認します。訂正結論
あなたの指摘どおり、
gh issue editは許容対象にすべきです。前回の「初回 #1124 では block 維持」は、この repo の実運用に合っていません。ただし分類名は重要です。
gh issue edit/gh issue createは read-only ではない。分類はgithub_issue_mutation_commandかgithub_remote_ops_command。条件は 非対話・repo限定・body-file/validator/readback付き です。gh issue view ... > tmp/foo.mdも許容でよいです。ただしこれも純粋なdisplay_readonly_commandではなく、read-only remote fetch + local artifact write です。現在の guard は>を shell metachar として一律 block する構造なので、#1124 はここも明示的に直す必要があります。gh issue createは許可でよいgh issue createは許可対象です。GitHub CLI 公式でも、--bodyを省略すると prompt、--titleを省略すると prompt、--body-fileはファイルから本文を読む、と定義されています。つまり baregh issue createは不可、非対話フラグ付きは可 です。(GitHub CLI)この repo にはすでに
create-issueskill があり、説明文で「人間承認なしでcreate_issue_txn.pyを実行する」と定義されています。 また、validator 通過後にcreate_issue_txn.pyを実行し、helper が--title/--body-file/--label/--parent-issue/--dependencyを受けて read-back まで行う設計です。したがって、agent-friendly な実行経路はこれです。
gh issue editの扱いgh issue editも許可対象です。公式 manual では issue 番号または URL を指定して issue を編集し、--body-file、--title、--add-label、--parent、--repo等を持ちます。(GitHub CLI)この repo の
edit-issueskill もgh issue editを前提にしています。バックアップ取得、guard-issue-body.py、contract_readiness_check.py、gh issue edit --repo --body-file、read-back、ready tuple 検証、変更コメントまで手順化されています。許可形はこうです。
禁止すべきなのは
gh issue edit 123のような 変更内容なし / 対話・曖昧・repo不明 の形です。gh issue view > mdの扱い許可でよいです。
gh issue viewは title/body 等を表示する read operation で、--jsonと--jqも公式に用意されています。(GitHub CLI)ただし、shell 的には
>はローカルファイル write なので、既存のdisplay_readonly_commandとは分けるべきです。分類案:
repo-tracked
.mdへ直接 Bash redirect するのは避け、tmp/や.claude/artifacts/に限定するのがよいです。repo-tracked docs を更新する場合はWrite/Edit/MultiEditの Allowed Paths 管理に載せるべきです。いまの設計上の不整合
大きい不整合は 4 つあります。
1つ目。
.claude/settings.jsonはgh issue edit/create/close/comment/view、gh pr merge/create/review/comment/view、gh apiまで広く allow しています。 一方、local_main_branch_guard.pyはgh issue createとgh issue editを現状の remote ops allowlist から外しており、gh issue close/comment/reopenとgh pr comment/editだけを許可しています。2つ目。
.codex/rules/default.rulesはrtk gh issue create/edit/close/reopen/deleteをprompt、つまり明示レビュー要求扱いにしています。 これは「Issue/PR 投稿に人間承認不要」という現行運用と衝突します。3つ目。
AGENTS.mdは directgh issue create/editを forbidden と書いています。 ただしagent-skill-boundaries.mdではissue-authorがcreate-issue/edit-issueを使い、Issue を起票・修正する役割と定義されています。 ここは「raw directは禁止、managed skill経由は許可」と明文化すべきです。4つ目。
docs/dev/hook-boundaries.mdはまだgithub_remote_ops_commandを reason_code 一覧に含めず、gh mutation コマンド(edit/close/merge 等)は fail-closedと書いています。 PR #1120 後の実装と docs が drift しています。#1124 のあるべき修正方針
#1124 は「read-only と mutation を分ける」Issue ではなく、より正確には AI workflow 用 GitHub mutation を first-class に分類する Issue に変えるべきです。
分類はこうです。
gh pr mergeはgithub_remote_ops_commandに入れない方がよいです。post-merge-cleanup-workerは cleanup カテゴリで、branch 削除や PR merge のような取り消し困難な操作を含むためpermissionMode: defaultを維持すると設計されています。#1124 に追加すべき AC
そのまま渡せる修正プロンプト
**Standard Title: **
Issue #1124 修正指示
対象:
squne121/loop-protocolIssue #1124目的: GitHub CLI の read-only / artifact export / issue mutation / destructive operation を AI workflow 向けに再分類し、Claude Code / Codex / hooks / skills / docs の不整合を解消する。
方針
gh issue editとgh issue createは禁止ではない。ただし
readonly_commandではなく、github_issue_mutation_commandとして分類する。許可するのは以下の非対話・repo限定・validated な形のみ。
gh issue create --repo squne121/loop-protocol --title <title> --body-file tmp/<file>.md --label <label>...gh issue edit <N> --repo squne121/loop-protocol --body-file tmp/<file>.mdgh issue edit <N> --repo squne121/loop-protocol --title <title> --body-file tmp/<file>.mdgh issue comment <N> --repo squne121/loop-protocol --body-file tmp/<file>.mdgh issue close <N> --repo squne121/loop-protocol --reason completedgh issue reopen <N> --repo squne121/loop-protocolbare / interactive / repo不明の形は block する。
gh issue creategh issue edit 123gh issue create --webgh issue create --editorgh issue edit 123 --body-file -gh issue edit 123 --repo other/repo ...gh issue viewのファイル出力は許可する。ただしdisplay_readonly_commandではなく、readonly_artifact_export_commandとして分類する。許可例:
gh issue view <N> --repo squne121/loop-protocol --json body --jq .body > tmp/issue_<N>.mdgh issue view <N> --repo squne121/loop-protocol --json title,labels,body > tmp/issue_<N>_readback.json禁止例:
gh issue view <N> > src/foo.mdgh issue view <N> > docs/foo.mdgh issue view <N> >> tmp/foo.mdgh issue view <N> > .env変更対象
scripts/agent-guards/local_main_branch_guard.pytests/codex/test_local_main_branch_guard.py.claude/hooks/tests/test_local_main_branch_guard.pydocs/dev/hook-boundaries.mddocs/dev/agent-skill-boundaries.mdAGENTS.md.codex/rules/default.rules.claude/skills/create-issue/SKILL.md.claude/skills/edit-issue/SKILL.md実装要件
github_issue_mutation_commandreason_code を追加する。github_remote_ops_commandは残すか、github_issue_mutation_commandに統合する。統合する場合は docs と tests も同時更新する。display_readonly_commandとreadonly_artifact_export_commandを分離する。gh issue create/edit/comment/close/reopenは token-based classifier で判定する。--repo/-Rが指定された場合はsqune121/loop-protocolのみ許可する。--repo省略を許す場合は current repo がsqune121/loop-protocolであることを別途解決する。解決不能なら block。--body-fileは repo-localtmp/または.claude/artifacts/配下だけ許可する。--body-file -は block。--web/--editor/-w/-eは block。gh pr merge/gh pr checkout/gh pr update-branchはこの Issue では allow しない。cleanup/destructive policy に残す。gh apiは blanket allow しない。GET read-only と mutation endpoint を分ける follow-up を残す。検証
以下を実行して PASS させる。
完了条件
gh issue create/editが managed mutation として通るgh issue view > tmp/*.mdが通る最終レビュー判定
#1124 は REQUEST_CHANGES だが、方向性は拡張するべきです。
前回のように
gh issue edit/createを禁止寄りにするのではなく、AI workflow の中核 mutation として first-class 化するのが正しいです。当前の敵はgh issue edit/create自体ではなく、bare 実行・対話実行・wrong repo・unsafe redirection・blanketgh api・docs/rules/hook/skill の drift です。squne121 commentedon Jun 21, 2026
feat(guard): GitHub remote ops 5 分類実装 - gh issue create/edit を github…
feat(guard): GitHub remote ops 5 分類実装 - gh issue create/edit を github…
fix(#1124): add RB1 web-flag block and RB2 AC12 test cases
fix(#1124): RB1 web-flag block in is_readonly_artifact_export + RB2 A…
fix(#1124): iteration 2 blockers — web-flag block + AC12 test cases
squne121 commentedon Jun 22, 2026
review subagent verdict: iteration 2 APPROVE. RB1/RB2 resolved. LOOP_VERDICT_V2 posted on PR #1126.
feat(guard): GitHub remote ops 5 分類実装 — gh issue create/edit を github…
fix: hook-boundaries.md の gh CLI 5分類テーブル欠落を修正 (#2262)
fix: repository-wide の stale hook wiring claim(PreToolUse/.codex/hook…