Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#136"
goal_ref: "secrets_mode 遷移時の session 記録 Kill Switch 手順と検証コマンドを SSOT 化する"
change_kind: docsParent Issue
Parent Goal Ref
- Goal: secrets_mode 遷移時の session 記録 Kill Switch 手順と検証コマンドを SSOT 化する
- Desired Destination: 調査: AI agent session 記録ツール(EntireCLI 等)導入の是非と運用前提を決定する #136 の policy 確定・EntireCLI 導入判断の前提整備
Current Validated Scope
docs/dev/session-recording-policy.mdの新規作成(YAML フロントマター付き Markdown)docs/dev/agent-skill-boundaries.mdへの cross-link 追加docs/dev/runtime-verification-policy.mdへの cross-link 追加.claude/scripts/check_session_recording_policy.pyの新規作成(policy 構造検証スクリプト)
Remaining Parent Gaps
- Secret Inventory 本体の作成(別 Issue)
- agent_session_manifest schema の定義(PR docs(#243): agent_session_manifest/v1 schema SSOT 定義と Main Loop phase 別記録運用確定 #314 で完了済み)
- 検証コマンドの CI 連動(別 Issue)
- session 記録ツール (EntireCLI 等) の実導入(別 Issue)
Outcome
docs/dev/session-recording-policy.md (新規) に session_recording_policy/v1 YAML(secret_policy/v1 から派生した taxonomy_mapping、全 mode で public_full_transcript_allowed: false、Kill Switch の trigger_conditions / required_end_state)と検証コマンドが SSOT として明文化された状態。secrets_mode が none 以外に遷移したときに「どのアクションを停止するか」「どう検証するか」が決定論的に追える。docs/dev/agent-skill-boundaries.md および docs/dev/runtime-verification-policy.md から cross-link されている。
Background
#136 anchor comment は、session 記録ツール (EntireCLI 等) を仮に導入する場合、Secret 管理開始時に full transcript を public GitHub に置く運用を停止できる Kill Switch が無いと「導入しただけ」で終わると指摘。EntireCLI の security docs(W6 で grounding 不十分のため未検証だが、anchor comment 主張ベース)も entire/checkpoints/v1 branch への自動 commit / shadow branch raw blob を懸念しており、policy 側で fail-closed を保証する必要がある。本 Issue は EntireCLI を実導入する前段として、policy + 検証コマンドを SSOT 化する。
前提となる確立済み SSOT:
- PR docs(#241): Secret Inventory と no-secret 運用境界の SSOT 化 (secret-policy.md) #317(docs: Secret Inventory と no-secret 運用境界の SSOT 化 (secret-policy.md) #241)で
docs/dev/secret-policy.md(secret_policy/v1、5区分: current / publish_secret / app_runtime_secret / agent_local_secret / checkpoint_token)が SSOT として確立済み。 - PR docs(#243): agent_session_manifest/v1 schema SSOT 定義と Main Loop phase 別記録運用確定 #314(implement: agent_session_manifest/v1 schema 定義と Main Loop phase 別記録運用 SSOT 化 #243)で
docs/schemas/agent-session-manifest.schema.json(agent_session_manifest/v1)が JSON Schema Draft 2020-12 で SSOT 化済み。public_github_comment時のsource_kind: transcript/local_file禁止制約を含む。 - 本 Issue の
session_recording_policy/v1はsecret_policy/v1から派生し、agent_session_manifest/v1を参照する形で設計する。
In Scope
docs/dev/session-recording-policy.mdの新規作成(YAML フロントマター付き Markdown)session_recording_policy/v1YAML 要件:schema: session_recording_policy/v1source_of_truth.secret_policy: docs/dev/secret-policy.md(secret_policy/v1明示参照)source_of_truth.manifest_schema: docs/schemas/agent-session-manifest.schema.json(agent_session_manifest/v1明示参照)derived_from_secret_policy.current_secrets_mode: nonederived_from_secret_policy.fail_closed_on_unknown_mapping: truetaxonomy_mapping:secret_policy/v1の 5 区分(current / publish_secret / app_runtime_secret / agent_local_secret / checkpoint_token)と session recording 許可フラグのマッピング- 全 mode で
public_full_transcript_allowed: false(none 時も public full transcript は禁止) public_surfaces.github_issue_comment.agent_session_manifest_allowed: true(metadata manifest のみ public 許可)public_surfaces.github_issue_comment.raw_transcript_allowed: falsegithub_public_checkpoint_branch_allowed: falsecheckpoint_remote.allowed_visibility: [private_verified](unknown は fail-closed)checkpoint_remote.verification_method.github_remote: "gh repo view <owner/repo> --json visibility"auto_push_sessions_allowed: falsemanual_review_required_before_push: true- Kill Switch(
kill_switchセクション):trigger_conditions: secrets_mode != none / checkpoint_token_present / public_checkpoint_branch_detected / raw_transcript_public_surface_detected / secret_scan_status == flaggedrequired_end_state: session_recording_tool_enabled: false / git_hooks_recording_enabled: false / public_checkpoint_branch_present: false / auto_push_sessions_allowed: false / full_transcript_remote_visibility: none / leaked_credentials_rotated_or_revoked: trueverification_required: true
- Kill Switch 手順(順序付き箇条書き、6 ステップ以上)
- cross-link:
docs/dev/agent-skill-boundaries.mdとdocs/dev/runtime-verification-policy.mdから本 policy への参照リンク追加 .claude/scripts/check_session_recording_policy.pyの新規作成(YAML parse / schema 参照 /public_full_transcript_allowed: false/ Kill Switchrequired_end_stateの構造検証)
Out of Scope
- session 記録ツール (EntireCLI 等) の実導入
- Secret Inventory 本体の作成(別 follow-up Issue で扱う)
- agent_session_manifest schema の定義(PR docs(#243): agent_session_manifest/v1 schema SSOT 定義と Main Loop phase 別記録運用確定 #314 で完了済み)
- 検証コマンドの CI ジョブ化(本 Issue では VC として記述するのみ。CI 連動は別 Issue)
Acceptance Criteria
- AC1:
docs/dev/session-recording-policy.mdが存在し YAML フロントマターを持つ - AC2:
session_recording_policy/v1YAML が文書内に fenced code block で記述され、secret_policy/v1とagent_session_manifest/v1をsource_of_truthセクションで明示参照している - AC3:
secret_policy/v1の 5 区分(current / publish_secret / app_runtime_secret / agent_local_secret / checkpoint_token)とのtaxonomy_mappingが YAML に含まれている - AC4: 全 mode で
public_full_transcript_allowed: falseが明示されている(none 時も true にしない) - AC5:
public_github_commentではraw_transcript_allowed: falseかつsource_kind: transcript / local_fileを禁止する記述がある - AC6:
kill_switchセクションがtrigger_conditionsとrequired_end_stateを持ち、6 ステップ以上の Kill Switch 手順が順序付きリストで記述されている - AC7:
checkpoint_remoteがprivate_verified | public | unknownの visibility 区分を持ち、unknownはfail_closed_on_unknown_visibility: trueである - AC8: 検証コマンドが
git ls-remote、Git hook 残存確認、git remote -v/pushRemote/insteadOf確認、GitHub comment surface 確認の 4 種類以上を含む - AC9:
docs/dev/agent-skill-boundaries.mdとdocs/dev/runtime-verification-policy.mdの両方から本 policy への参照リンクが追加されている - AC10:
.claude/scripts/check_session_recording_policy.pyが存在し、YAML parse / schema 参照 /public_full_transcript_allowed: false/ Kill Switchrequired_end_stateの構造を検証する - AC11:
pnpm typecheck,pnpm lint,pnpm test,pnpm buildがすべて pass する
Verification Commands
# AC1: policy ファイル存在
test -f docs/dev/session-recording-policy.md && echo "PASS: AC1" || echo "FAIL: AC1"
# AC2: session_recording_policy/v1 スキーマ参照
rg "schema: session_recording_policy/v1" docs/dev/session-recording-policy.md && echo "PASS: AC2-schema" || echo "FAIL: AC2-schema"
rg "secret_policy/v1|secret-policy\.md" docs/dev/session-recording-policy.md && echo "PASS: AC2-secret-ref" || echo "FAIL: AC2-secret-ref"
rg "agent_session_manifest/v1|agent-session-manifest" docs/dev/session-recording-policy.md && echo "PASS: AC2-manifest-ref" || echo "FAIL: AC2-manifest-ref"
# AC3: taxonomy_mapping に 5 区分が存在
rg "app_runtime_secret|agent_local_secret|checkpoint_token" docs/dev/session-recording-policy.md && echo "PASS: AC3" || echo "FAIL: AC3"
# AC4: 全 mode で public_full_transcript_allowed: false
! rg "public_full_transcript_allowed:\s*true" docs/dev/session-recording-policy.md && echo "PASS: AC4" || echo "FAIL: AC4"
# AC5: public_github_comment で transcript 禁止
rg "raw_transcript_allowed: false|transcript.*false" docs/dev/session-recording-policy.md && echo "PASS: AC5" || echo "FAIL: AC5"
# AC6: Kill Switch trigger_conditions と required_end_state
rg "trigger_conditions" docs/dev/session-recording-policy.md && echo "PASS: AC6-trigger" || echo "FAIL: AC6-trigger"
rg "required_end_state" docs/dev/session-recording-policy.md && echo "PASS: AC6-end-state" || echo "FAIL: AC6-end-state"
# AC7: checkpoint_remote visibility 区分
rg "private_verified|fail_closed_on_unknown_visibility" docs/dev/session-recording-policy.md && echo "PASS: AC7" || echo "FAIL: AC7"
# AC8: 強化された検証コマンド
rg "git ls-remote" docs/dev/session-recording-policy.md && echo "PASS: AC8-ls-remote" || echo "FAIL: AC8-ls-remote"
rg "\.git/hooks|git hook|pre-push|pre-commit" docs/dev/session-recording-policy.md && echo "PASS: AC8-hooks" || echo "FAIL: AC8-hooks"
rg "git remote -v|pushRemote|insteadOf" docs/dev/session-recording-policy.md && echo "PASS: AC8-remote-config" || echo "FAIL: AC8-remote-config"
rg "gh issue.*comment|public.*surface|transcript.*comment" docs/dev/session-recording-policy.md && echo "PASS: AC8-comment-surface" || echo "FAIL: AC8-comment-surface"
# AC9: cross-link
rg "session-recording-policy" docs/dev/agent-skill-boundaries.md && echo "PASS: AC9-skill-boundaries" || echo "FAIL: AC9-skill-boundaries"
rg "session-recording-policy" docs/dev/runtime-verification-policy.md && echo "PASS: AC9-runtime-verification" || echo "FAIL: AC9-runtime-verification"
# AC10: checker script 存在
test -f .claude/scripts/check_session_recording_policy.py && echo "PASS: AC10" || echo "FAIL: AC10"
# AC11: 品質ゲート
pnpm typecheck && echo "PASS: AC11-typecheck" || echo "FAIL: AC11-typecheck"
pnpm lint && echo "PASS: AC11-lint" || echo "FAIL: AC11-lint"
pnpm test && echo "PASS: AC11-test" || echo "FAIL: AC11-test"
pnpm build && echo "PASS: AC11-build" || echo "FAIL: AC11-build"Allowed Paths
docs/dev/session-recording-policy.md(新規作成)docs/dev/agent-skill-boundaries.md(cross-link 追加のみ)docs/dev/runtime-verification-policy.md(cross-link 追加のみ).claude/scripts/check_session_recording_policy.py(新規作成)
Stop Conditions
- Outcome / Scope / AC が VC で検証できない形式に崩れた場合は即停止
- Allowed Paths 外への書き込みを試みた場合は即停止
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合は即停止
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)は即停止
- 後続 Phase / 別スコープへの波及が判明した場合は即停止
- nested SubAgent delegation が必要になった場合は即停止
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合は即停止
- session 記録ツールの実導入を始めようとした場合は即停止(本 Issue は policy 整備のみ)
pnpm typecheck/lint/test/buildのいずれかが fail した場合は即停止
Runtime Verification Applicability
decision: immediate
rationale: docs-only 変更。VC コマンド (test -f, rg, pnpm) は実装直後に即時実行可能。
Handoff Contract
- Current Objective: Kill Switch policy + 検証コマンド SSOT 化
- Bounded Current Context: 調査: AI agent session 記録ツール(EntireCLI 等)導入の是非と運用前提を決定する #136 Decision (条件付き導入 / metadata-first)、既存 Hook-based Ledger 設計、PR docs(#241): Secret Inventory と no-secret 運用境界の SSOT 化 (secret-policy.md) #317 確立済み
secret_policy/v1(5区分)、PR docs(#243): agent_session_manifest/v1 schema SSOT 定義と Main Loop phase 別記録運用確定 #314 確立済みagent_session_manifest/v1 - Open Questions:
- secrets_mode 自動検知の手段(人間判断で都度 update か、CI から自動推定か)
session_recording_policy/v1YAML のtaxonomy_mappingでapp_secretをapp_runtime_secretに完全置換するか、後方互換で両方保持するか(実装時に判断)
- Next Action: 本 Issue 完了後、Secret Inventory Issue / agent_session_manifest schema Issue と整合性確認
- Artifact Refs: docs/dev/agent-skill-boundaries.md L604-L633
Required Skills
- なし(docs 編集のみ)
Activity
fix(#241): adversarial review フィードバック反映 (B1/B3-B9/M1)
docs(#241): Secret Inventory と no-secret 運用境界の SSOT 化 (secret-policy.…
squne121 commentedon May 23, 2026
判定
REQUEST_CHANGES 相当。
#242 の方向性は妥当ですが、このまま実装すると「Secret が出たら session 記録を止める」という安全境界が docs 上の宣言に留まり、検証不能・同期不能・撤退不能 になります。
#242 は
docs/dev/session-recording-policy.mdを作り、session_recording_policyYAML、Kill Switch、git ls-remote/rg検証、agent-skill-boundaries.md/runtime-verification-policy.mdからの cross-link を要求しています。Issue 自体にコメントはありません。親の #136 では、PR #81/#131 の反省として「AC 読み落とし、test-runner 呼び出し不明、SKIP exit 0、PR本文破壊、token/context pressure」を検証可能にするため、metadata-first / full transcript は疑義時のみ / public checkpoint 禁止 / Secret Kill Switch を決定しています。
重大ブロッカー
B1.
secrets_modeが #241 / PR #317 の Secret Inventory とズレる#242 の
secrets_modeはnone | publish_secret | app_secret | unknownですが、PR #317 でsecret-policy.mdはcurrent / publish_secret / app_runtime_secret / agent_local_secret / checkpoint_tokenの 5 区分を SSOT として導入済みです。さらに PR #317 はsecret_policy/v1、current_secrets_mode、taxonomy_mapping、VITE_* sensitive 不可、public full transcript制御を扱っています。この状態で #242 が独自に
secrets_modeを持つと、Secret Inventory と session 記録 policy が二重管理になります。特にagent_local_secretとcheckpoint_tokenが #242 側に明示されていないのは危険です。session transcript が最も漏らしやすいのは、アプリ runtime secret だけでなく、agent local 設定、checkpoint token、CLI認証情報、ローカルパスです。修正案: #242 の YAML は
secret_policy/v1を参照する形にする。B2.
none: trueで full transcript を許可するのは過剰に楽観的#136 の判断は「metadata-first / full transcript は疑義時のみ」であり、public full transcript を no-secret 時に通常許可する設計ではありません。#242 の元 YAML では
full_transcript_allowed.none: trueですが、これは危険です。transcript には Secret そのものがなくても、未公開設計、ローカル絶対パス、MCP/tool 出力、CLI認証状態、Issue未公開メモ、脆弱性調査内容が入り得ます。GitHub secret scanning は Git history 全 branch に加え、Issue / PR / Discussion / Wiki などもスキャン対象にしますが、これは事後検知であり、公開 transcript の投入を安全化する機構ではありません。検出時は credential を即時 rotate / revoke すべきものとされています。([GitHub Docs]1)
修正案: public に許可するのは manifest metadata のみに限定する。
B3.
git ls-remote origin refs/heads/entire/checkpoints/v1だけでは Kill Switch 検証にならない#242 の検証コマンドは
originの特定 branch を見るだけです。これは次を検出できません。origin以外の remote への checkpoint pushurl.*.insteadOfやpushRemoteによる意図しない push 先#245 でも onboarding 側に
no-push / private checkpoint / manual review / Kill Switchが要求され、#246 でも smoke test で Kill Switch 継続 PASS を前提条件にしています。つまり #242 は後続 issue の安全基盤であり、弱い検証はそのまま後続に伝播します。修正案: docs-only でも、最低限この粒度にする。
B4. PR #314 の
agent_session_manifest/v1と接続しないと、policy が孤立するPR #314 は
agent_session_manifest/v1を JSON Schema + fixtures + tests で SSOT 化し、public_github_commentの場合はsource_kind: transcript/local_fileを禁止する制約を導入しています。#242 がこの schema を直接参照しないと、session recording policy と manifest policy が別々に進化します。これは #136 の「metadata-first」決定に反します。
修正案: #242 の AC に以下を追加。
B5. 配布経路の Secret / Deploy capability の扱いが粗い
Vite は
VITE_*変数を client-side source code に露出し、VITE_*に API key 等の sensitive 情報を入れるべきでないと明記しています。([vitejs]2)GitHub Pages の custom workflow は
pages: writeとid-token: write権限を必要とします。これは長期 Secret ではありませんが、release integrity に関わる deploy capability です。([GitHub Docs]3)Cloudflare Pages の direct upload CI は GitHub Secrets に
CLOUDFLARE_ACCOUNT_IDとCLOUDFLARE_API_TOKENを設定する導線を公式に示しています。([Cloudflare Docs]4)itch.io butler は CI で
BUTLER_API_KEYを使い、公開 build log に出たら burned とみなして revoke すべきとしています。([itch.io]5) ([itch.io]5)したがって #242 は「現在 static Vite だから no-secret」だけでなく、将来の配布経路が入った瞬間に session recording policy を fail-closed へ遷移させる必要があります。
修正案:
publish_secretだけでなくdeploy_credential_boundaryを明示する。B6. Kill Switch が「手順」であって「状態遷移」になっていない
#242 の Kill Switch は 5 手順を要求していますが、手順列挙だけだと「実行後にどの状態になっていれば安全か」が曖昧です。
修正案: Kill Switch を state machine として書く。
これにより「disable したつもり」ではなく「disable 後の状態」を検証できます。
B7.
checkpoint_remote_required_when_full_transcript: privateは検証不能Git の
remote -vやls-remoteだけでは、その remote が private かどうかは判定できません。GitHub repository なら API で visibility を見られますが、任意 remote では不可能です。修正案:
privateを直接書かず、検証状態を分ける。B8. Allowed Paths が deterministic checker を許可していない
PR #317 は
.claude/scripts/check_secret_policy.pyを導入し、policy を script-first VC にしています。#242 は
docs/dev/session-recording-policy.mdと cross-link だけを allowed paths にすると、rgベースの脆い検証しかできません。修正案: #242 の Allowed Paths に checker を追加する。
checker では最低限次を検証します。
#242 の本文に追加すべき受け入れ条件
既存 AC に加えて、以下を追加した方がよいです。
最小パッチ方針
secret_policy/v1派生に変更する。noneでも public full transcript は禁止にする。agent_session_manifest/v1と接続し、public GitHub comment で transcript/local_file evidence を禁止する。check_session_recording_policy.pyを追加してrg依存を減らす。最終コメント
#242 は、単体の docs issue ではなく、#241 Secret Inventory、#243 manifest schema、#245 onboarding、#246 pilot smoke test の安全境界ハブです。
現状のままだと「危険なら止める」という意図はありますが、実装後に検証できるのは
rgと特定 branch の有無だけです。高品質化するなら、public transcript を原則禁止、metadata manifest のみ public 許可、Secret taxonomy は #241 から派生、Kill Switch は required end state で検証に寄せるべきです。squne121 commentedon May 23, 2026
Issue 本文更新 — review-issue feedback 反映
reviewer_feedback (REVIEW_ISSUE_RESULT_V1: needs-fix) および anchor_comment_feedback (feedback_update_required) を受けて、以下の変更を反映した。
対応した blocking issues
C1 — 必須セクション分割
## Parent / Sourceを## Parent Issue/## Parent Goal Ref/## Current Validated Scope/## Remaining Parent Gapsの 4 独立セクションに分割。C2 — Stop Conditions 定型 6 項目追加
C5 — AC の ACN ラベル統一
- [ ] AC1: <内容>〜- [ ] AC11: <内容>形式に統一。C9 — Runtime Verification Applicability セクション追加
decision: immediate/rationale: docs-only 変更。VC コマンド (test -f, rg, pnpm) は実装直後に即時実行可能。を追記。対応した anchor_comment edits (E1〜E5)
E1 — secrets_mode を secret_policy/v1 派生形式に変更
session_recording_policy/v1スキーマ、source_of_truthセクションでsecret_policy/v1とagent_session_manifest/v1を明示参照する形式に変更。public_full_transcript_allowed: falseを明示(none 時も true 禁止)。E2 — AC 追加(ACN ラベル付き)
E3 — VC 強化
git remote -v/pushRemote/insteadOf確認(AC8-remote-config).git/hooks残存確認(AC8-hooks)E4 — Allowed Paths に checker script 追加
.claude/scripts/check_session_recording_policy.pyを追加。E5 — Background に確立済み SSOT 追記
non_blocking 改善(NB1〜NB4)の対応
public_full_transcript_allowed: falseを全 mode で強制(E1 対応で解決)trigger_conditions/required_end_stateを追加(E1 対応で解決)squne121 commentedon May 23, 2026
issue-refinement-loop: iteration 1 本文修正 (2026-05-23T16:52:26Z)
<!-- runtime-verification: true -->タグを追加decision: immediate宣言に対して C11 チェック(AC に runtime-verification タグが 1 件以上必要)を満たすためsqune121 commentedon May 23, 2026
issue-refinement-loop: 完了 (2026-05-24T00:00:00Z)
改善履歴
<!-- runtime-verification: true -->タグ追加次アクション
issue-contract-review を起動してください。
squne121 commentedon May 23, 2026
Contract Snapshot (2026-05-24T01:57:00Z)
docs/dev/session-recording-policy.md(新規) にsession_recording_policy/v1YAML(secret_policy/v1から派生した taxonomy_mapping、全 mode でpublic_full_transcript_allowed: false、Kill Switch のtrigger_conditions/required_end_state)と検証コマンドが SSOT として明文化された状態。docs/dev/session-recording-policy.md存在・YAML スキーマ参照・taxonomy_mapping・transcript 禁止・Kill Switch・checkpoint visibility・VC 4種・cross-link・checker script・品質ゲート)test -f、rg(パターン存在確認)、pnpm typecheck/lint/test/builddocs/dev/session-recording-policy.md(新規作成)docs/dev/agent-skill-boundaries.md(cross-link 追加のみ)docs/dev/runtime-verification-policy.md(cross-link 追加のみ).claude/scripts/check_session_recording_policy.py(新規作成).claude/worktrees/issue-242-session-kill-switch-policy-session-recorworktree-issue-242-session-kill-switch-policy-session-recorsqune121 commentedon May 23, 2026
implement-issue: 実装完了 (2026-05-24T02:03:00Z)
fix(#242): checker 強化(グローバル安全フラグ・参照検証・VC パターン確認)と運用導線セクション追加
docs(#242): session 記録 Kill Switch policy と検証コマンド整備 (session-recordin…
squne121 commentedon May 23, 2026
post-merge-cleanup: 完了 (2026-05-24T02:40:00Z)
.claude/worktrees/issue-242-session-kill-switch-policy-session-recor削除済みworktree-issue-242-session-kill-switch-policy-session-recor削除済みdocs(#245): impl-review-loop iteration 3 fix — EntireCLI/Claude Code …
docs: add session-recording-tool.md onboarding guide (#245) (#347)