Skip to content

実装: session-recording-policy skill を作成して操作手順を標準化する #326

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#242"
goal_ref: "session 記録 / Kill Switch 関連作業の標準手順を skill として整備し自動発火・手動呼び出しを可能にする"
change_kind: docs

Parent Issue

#242

Parent Goal Ref

Current Validated Scope

  • .claude/skills/session-recording-policy/SKILL.md の新規作成
  • docs/dev/session-recording-policy.md の「運用導線」テーブルを更新(skill 状態を「実装済み」に変更)

Remaining Parent Gaps

Outcome

.claude/skills/session-recording-policy/SKILL.md が作成され、session 記録 / Kill Switch / checkpoint / EntireCLI / secret-policy 関連の作業を行う際に skill が参照できる操作手順を提供する。skill 内で policy 3 文書の読み込み・checker 実行・SESSION_RECORDING_POLICY_VERDICT 記録の手順が標準化される。

ただし本 Issue は session 記録ツールの導入完了、deterministic manifest producer / runtime safety verifier / Kill Switch runtime smoke / secret exposure scanner の整備、GitHub 経由での session 振り返り可能化、secret 流出の絶対保証を意味しない。これらは別 Issue で扱う(Related 参照)。

In Scope

  • .claude/skills/session-recording-policy/SKILL.md の新規作成:
    • description に自動発火トリガーワードを含める(session recording / Kill Switch / EntireCLI / checkpoint / secret-policy / agent-session-manifest 関連変更)
    • 必須手順: policy 3 文書の読み込み → checker 実行 → SESSION_RECORDING_POLICY_VERDICT 記録
    • Kill Switch 発動判定手順
    • required_end_state の GitHub Issue コメントへの記録フォーマット
    • Claude-only スコープ: 本 Skill は .claude/skills/... 配下の Claude Code 用 Skill であり、Codex CLI (.agents/skills/...) 対応は本 Issue の Out of Scope(別 Issue で扱う)
  • docs/dev/session-recording-policy.md 「運用導線」テーブルの skill 行を「実装済み」に更新

Out of Scope

Acceptance Criteria

  • AC1: .claude/skills/session-recording-policy/SKILL.md が存在する
  • AC2: SKILL.md の description に session recording / Kill Switch / EntireCLI / checkpoint の発火ワードが含まれる
  • AC3: SKILL.md の手順に checker 実行と SESSION_RECORDING_POLICY_VERDICT 記録が含まれる
  • AC4: docs/dev/session-recording-policy.md 「運用導線」テーブルの skill 行が「実装済み」になっている
  • AC5: pnpm typecheck, pnpm lint, pnpm test, pnpm build が pass する
  • AC6: SKILL.md 本文に「本 Skill は policy 手順を提供するものであり、session 記録ツールの導入完了・secret 流出の絶対保証・GitHub 経由の Main Loop 振り返り可能化を意味しない」旨が明記されている
  • AC7: SKILL.md 本文に「pilot 開始には research/pilot: AI 駆動 session 記録 pilot smoke test (manifest 整合性 / Kill Switch 動作 / Secret 漏れ検査) #246 / deterministic manifest producer / no-push verifier / Kill Switch runtime smoke / secret exposure scanner などの追加実装が必要であり、それらが main に merge されるまで pilot を開始しない」旨が明記されている
  • AC8: SKILL.md 本文に「本 Skill は Claude Code 専用 (.claude/skills/...) であり、Codex CLI 対応は本 Issue の Out of Scope(別 Issue で扱う)」旨が明記されている

Verification Commands

# AC1
$ test -f .claude/skills/session-recording-policy/SKILL.md
# AC2
$ rg "session.recording|Kill.Switch|EntireCLI|checkpoint" .claude/skills/session-recording-policy/SKILL.md
# AC3
$ rg "check_session_recording_policy|SESSION_RECORDING_POLICY_VERDICT" .claude/skills/session-recording-policy/SKILL.md
# AC4
$ rg "実装済み" docs/dev/session-recording-policy.md
# AC5
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build
# AC6
$ rg "導入完了を意味しない" .claude/skills/session-recording-policy/SKILL.md
# AC7
$ rg "#246" .claude/skills/session-recording-policy/SKILL.md
$ rg "deterministic.*producer" .claude/skills/session-recording-policy/SKILL.md
$ rg "no-push.*verifier" .claude/skills/session-recording-policy/SKILL.md
# AC8
$ rg "Claude Code 専用" .claude/skills/session-recording-policy/SKILL.md
$ rg "\.agents/skills" .claude/skills/session-recording-policy/SKILL.md

各 AC が bare exit-code-based command で書かれ、baseline では:

  • AC1: test -f が exit 1 (file 不在) → expected_baseline_fail / go
  • AC2-3,6-8: rg が exit 1 (no match) または exit 2 (file 不在) → expected_baseline_fail / go
  • AC4: rg "実装済み" が現在の docs/dev/session-recording-policy.md に対して exit 1 (skill 行は「未実装」のまま) → expected_baseline_fail / go
  • AC5: pnpm 系は現在の repo で pass する可能性が高いが、Issue 内では「実装後に AC5 も pass する」前提

実装後の検証は test-runner が各コマンドの exit 0 を確認することで実施する。

Allowed Paths

  • .claude/skills/session-recording-policy/SKILL.md(新規作成)
  • docs/dev/session-recording-policy.md(運用導線テーブル更新のみ)

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本 Issue は Markdown ドキュメント(SKILL.md と運用導線テーブル)の新規作成・更新であり、プロセス起動・通信・I/O を必要としない。すべての AC は静的検証(ファイル存在確認、rg、pnpm typecheck/lint/test/build)で完結する。

Stop Conditions

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

Related

Required Skills

  • なし(Markdown 文書作成のみ)

Activity

  1. added
    kind/implementation
    area/security
    area/ai-ops
    on May 23, 2026
  2. added 5 commits that reference this issue on May 24, 2026
  3. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    人間からの指摘です。
    このIssueの実装が完了すると #136 で決定したAI agent session 記録ツールの導入が完了するか?
    マージ後からセッションの振り返りがGithub経由でできる?
    シークレットの管理も問題なく、流出の心配もない?

  4. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    結論

    #326 を実装しても、#136 で決めた AI agent session 記録ツール導入は完了しません。
    #326 は .claude/skills/session-recording-policy/SKILL.md を作り、session recording / Kill Switch / EntireCLI / checkpoint 関連作業時の手順を Skill 化する docs-only Issueです。Issue 本文でも、CI 連動 #324 と Claude hook 統合 #325 は明示的に out of scope です。([GitHub]1)

    マージ後すぐに GitHub 経由で session 振り返りができる状態にもなりません。
    理由は、#326 は「記録する仕組み」ではなく「記録ポリシー確認手順」です。agent_session_manifest の deterministic producer、schema validation 実行導線、no-push/private/local-only verifier、Kill Switch runtime smoke test がまだ必要です。#324 側の PR #355 でも、pilot 開始にはこれらが未完了だと明記されています。([GitHub]2)

    Secret 流出の心配がない、とも言えません。
    EntireCLI 公式ドキュメント上、session transcript / prompt / checkpoint metadata は entire/checkpoints/v1 に保存され、public repo ではインターネットから見える可能性があります。また shadow branch の code-file snapshot は raw blob で、hardcoded secret があれば unredacted に残り得ると説明されています。([GitHub]3)

    敵対的レビュー

    Blocker 1: #326 は「安全装置」ではなく「手順書」でしかない

    #326 の Outcome は、Skill を作って checker 実行と SESSION_RECORDING_POLICY_VERDICT 記録を標準化することです。これは LLM が読む手順であり、実行を強制する機械的ガードではありません。([GitHub]1)

    Claude Code の hooks は「LLM が思い出す」仕組みではなく、ライフサイクル上で必ず実行される決定的制御です。公式 docs でも hooks は Claude Code の動作を deterministic に制御するものと説明され、policy enforcement では exit 2 が blocking signal です。([Claude Code]4)

    したがって、#326 単体を「導入完了」と見なすのは危険です。最低でも #325 の Stop/SubagentStop hook guard が必要です。

    Blocker 2: SESSION_RECORDING_POLICY_VERDICT は証跡ではなく自己申告になり得る

    #326 は GitHub Issue コメントへの required_end_state 記録フォーマットを scope に含めています。([GitHub]1)
    しかし、#245 では AI self-report manifest を authoritative evidence にしてはいけない、hook/script/CI など deterministic producer を証跡とする、と整理されています。([GitHub]5)

    つまり、#326 の Skill が「VERDICT を書け」と指示するだけでは、証跡として弱いです。SESSION_RECORDING_POLICY_VERDICT は、少なくとも次を含むべきです。

    SESSION_RECORDING_POLICY_VERDICT:
      generated_by: hook_generated | script_generated | github_action_generated | human_attested_from_deterministic_evidence
      checker_command: ...
      checker_exit_code: 0
      git_ls_remote_entire_checkpoints_v1: empty
      push_sessions_enabled: false
      checkpoint_remote_visibility: private_verified | local_only
      raw_transcript_public_surface_detected: false
      evidence_refs:
        - command output hash
        - CI run URL
        - hook log path or redacted excerpt

    Blocker 3: GitHub で session 振り返り可能にする producer が未実装

    #314 は agent_session_manifest/v1 schema を整備していますが、schema があることと manifest が自動生成されることは別です。#314 は schema / fixtures / tests の追加が中心です。([GitHub]6)

    #245 / PR #347 でも、deterministic producer が pilot 開始条件として明示されています。具体例として .claude/hooks/post-commit-manifest、scripts/generate-session-manifest.sh、.github/workflows/session-manifest.yml のいずれかが main に merge されていることが前提です。([GitHub]7)

    #326 の Skill は producer ではありません。GitHub issue / PR コメントに session manifest が継続的に残る状態にはなりません。

    Blocker 4: Secret 保護は policy だけでは成立しない

    PR #323 / Issue #242 は、全 mode で public_full_transcript_allowed: false、GitHub issue comment では raw transcript 禁止、checkpoint remote は private_verified のみ許可、unknown は fail-closed、という方針を定めています。([GitHub]8)

    方針としては正しいです。ただし、EntireCLI の実仕様では transcript / prompt / metadata は Git branch に保存され、public repo では見える可能性があり、shadow branch には raw working tree blob が残り得ます。([GitHub]9)
    GitHub secret scanning / push protection は有用ですが、GitHub 公式も push protection を「hardcoded credentials の push を防ぐ」機能として説明しており、万能な情報流出防止ではありません。([GitHub Docs]10)

    よって、#326 の merge 後も「secret 管理は問題ない」とは言えません。最低限、remote visibility、branch presence、push_sessions、Issue comment surface、local shadow branch cleanup を検証する機械的 verifier が必要です。

    Blocker 5: #326 は Claude 専用で、Codex 運用には届かない

    #326 の対象パスは .claude/skills/session-recording-policy/SKILL.md です。([GitHub]1)
    一方、Codex Skills は repo-scoped skill を .agents/skills などから読む仕様です。Codex 公式 docs では、Skill は SKILL.md と name / description を持ち、repo/user/admin/system の skill location から読み込まれると説明されています。([OpenAI 開発者]11)

    このプロジェクトで Codex CLI も使うなら、#326 は Claude Code の Skill 整備に過ぎません。Codex 側の skill / hook / config 連携を別 Issue に分ける必要があります。

    #326 自体への修正提案

    #326 はそのままでも「手順書 Skill 作成 Issue」としては成立します。ただし、表現を弱めないと誤解を生みます。

    修正すべき文言は以下です。

    - session 記録 / Kill Switch / checkpoint / EntireCLI / secret-policy 関連の作業を行う際に skill が自動発火または `/session-recording-policy` で呼び出せる。
    + session 記録 / Kill Switch / checkpoint / EntireCLI / secret-policy 関連の作業時に、
    + Claude Code が参照できる操作手順 Skill を提供する。
    + ただし、本 Issue は session 記録ツールの導入、deterministic manifest producer、
    + runtime enforcement、secret leak prevention の完了を意味しない。

    追加 AC はこれです。

    - AC6: SKILL.md に「本 Skill は policy 手順であり、session recording の導入完了・secret 安全性保証・GitHub 経由の振り返り可能化を意味しない」と明記されている
    - AC7: SKILL.md に #324 / #325 / #246 / deterministic producer / no-push verifier が未完了なら pilot 開始不可と明記されている
    - AC8: Codex CLI を対象外とする場合は Claude-only と明記し、Codex 対応は別 Issue に分離されている

    検証コマンド例:

    rg "does not mean.*session recording.*complete|導入完了を意味しない" .claude/skills/session-recording-policy/SKILL.md
    rg "#324|#325|#246|deterministic producer|no-push|private checkpoint|local-only" .claude/skills/session-recording-policy/SKILL.md
    rg "Claude-only|Codex.*out of scope|Codex.*別 Issue" .claude/skills/session-recording-policy/SKILL.md

    不足 Issue 起票案

    Issue A: deterministic agent_session_manifest producer を実装する

    Title: 実装: agent_session_manifest/v1 deterministic producer を hook/script/CI で生成する
    
    Parent: #136 / #243 / #245 / #326
    
    Goal:
    AI self-report に依存せず、hook/script/CI 由来の agent_session_manifest/v1 を生成し、GitHub Issue/PR コメントに貼れる deterministic evidence を作る。
    
    In Scope:
    - `.claude/hooks/post-commit-manifest` または `scripts/generate-session-manifest.sh` の新規作成
    - `docs/schemas/agent-session-manifest.schema.json` による validation
    - producer 種別を `hook_generated | script_generated | github_action_generated` のいずれかで記録
    - GitHub comment 用 fenced block 出力
    - token_usage は実測不能なら null + availability reason にし、AI 自己申告値は禁止
    
    Out of Scope:
    - full transcript 保存
    - EntireCLI 本体導入
    - secret/token 発行
    
    AC:
    - `agent_session_manifest` が schema validation に pass する
    - AI self-report を authoritative evidence としない
    - Issue/PR コメントに貼れる markdown 出力がある
    - `pnpm test` または専用 test が pass
    
    Verification:
    - `pnpm test`
    - `node scripts/validate-agent-session-manifest.mjs <fixture>`
    - `scripts/generate-session-manifest.sh --dry-run | rg "agent_session_manifest"`

    Issue B: no-push / private checkpoint / local-only verifier を実装する

    Title: 実装: session recording no-push/private/local-only verifier を追加する
    
    Parent: #136 / #242 / #245
    
    Goal:
    EntireCLI または等価 session recording tool が public GitHub に full transcript / checkpoint branch を push しないことを機械的に検証する。
    
    In Scope:
    - `.claude/scripts/check_session_recording_runtime_safety.py` を追加
    - `git ls-remote origin refs/heads/entire/checkpoints/v1` が空であることを検証
    - `.entire/settings.json` / `.entire/settings.local.json` 相当から push_sessions=false を検証
    - checkpoint_remote が local-only または private_verified であることを検証
    - GitHub Issue/PR comment surface に raw transcript / local_file がないことを検査
    
    AC:
    - public checkpoint branch が存在したら fail
    - push_sessions=true なら fail
    - checkpoint_remote unknown なら fail-closed
    - raw transcript public comment を検出したら fail
    - verifier の fixture test がある
    
    Verification:
    - `python3 .claude/scripts/check_session_recording_runtime_safety.py --repo squne121/loop-protocol`
    - `pnpm test`

    Issue C: Claude hook guard #325 を runtime safety verifier まで拡張する

    Title: 実装: Claude Stop/SubagentStop hook で session recording runtime safety verifier を blocking 実行する
    
    Parent: #325 / #242 / #326
    
    Goal:
    Claude Code の Stop/SubagentStop 時に policy checker だけでなく runtime safety verifier を実行し、危険状態なら exit 2 で停止する。
    
    In Scope:
    - `.claude/hooks/session_recording_policy_guard.sh` に runtime verifier 呼び出しを追加
    - `exit 2` 時の stderr に修正指示を出す
    - 無限ループ防止の sentinel / max retry を実装
    - hook log には secret を出さない
    
    AC:
    - policy 関連ファイル変更時に checker が実行される
    - session recording 設定変更時に runtime verifier が実行される
    - fail 時は exit 2
    - secret 値を stderr / log に出さない
    
    Verification:
    - `bash .claude/hooks/session_recording_policy_guard.sh`
    - fixture で push_sessions=true を作り exit 2 を確認

    Issue D: Codex CLI 用 Skill / hook 対応を分離実装する

    Title: 実装: Codex CLI 用 session-recording-policy Skill と hooks 設定を整備する
    
    Parent: #136 / #326
    
    Goal:
    Claude Code 専用の `.claude/skills` に閉じず、Codex CLI からも同等の session recording policy 手順を呼び出せるようにする。
    
    In Scope:
    - `.agents/skills/session-recording-policy/SKILL.md` の追加
    - Claude 版 Skill との共通参照を docs に分離
    - Codex の implicit/explicit invocation 前提に合わせた description 最適化
    - Codex hooks が必要なら別 Issue に分離
    
    AC:
    - Codex Skill の `name` / `description` が存在する
    - `.agents/skills` 配置が明記されている
    - Claude 版との差分が最小で、SSOT が重複しない
    - Codex で対象プロンプトから Skill が発火する手動検証手順がある

    Issue E: pilot smoke test #246 の前提を現在状態に更新する

    Title: 更新: #246 pilot smoke test の preflight gate を #324/#325/#326/deterministic producer 前提に同期する
    
    Parent: #246 / #136
    
    Goal:
    pilot smoke test が、現在の実装進捗に合わせて開始条件を誤判定しないようにする。
    
    In Scope:
    - #246 の preflight に以下を追加
      - #324 merged
      - #325 merged
      - #326 merged
      - deterministic producer merged
      - runtime safety verifier merged
      - no-push/private/local-only PASS
    - #245 完了済みを前提として明記
    - human-only 操作完了チェックリストを更新
    
    AC:
    - 未完了 gate が 1 つでもあれば smoke test 開始不可
    - gate 一覧が GitHub Issue 本文またはコメントで検索可能

    優先順位

    1. 実装: session-recording-policy skill を作成して操作手順を標準化する #326 は修正して merge 可。ただし「導入完了ではない」と明記する。
    2. 実装: session recording policy guard を Claude hook (Stop/SubagentStop) に統合する #325 hook guard を先に完了。Skill より runtime enforcement の方が重要。
    3. deterministic manifest producer を新規 Issue 化。これがないと GitHub 経由の振り返りは成立しない。
    4. runtime safety verifier を新規 Issue 化。これがないと secret 流出リスクを「心配ない」とは言えない。
    5. research/pilot: AI 駆動 session 記録 pilot smoke test (manifest 整合性 / Kill Switch 動作 / Secret 漏れ検査) #246 smoke test で実走確認。ここで初めて pilot 継続 / 調整 / 撤退判断が可能。
  5. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    結論: いいえ。#326 が完了しても、#136 で決定した AI agent session 記録ツール導入は完了しません。

    #326 で完了するのは、session-recording-policy の Skill 化、つまり「session recording / Kill Switch / EntireCLI / checkpoint / secret-policy 関連作業時に、policy 読み込み・checker 実行・SESSION_RECORDING_POLICY_VERDICT 記録を標準手順にする」ことです。#326 の scope は .claude/skills/session-recording-policy/SKILL.md 作成と運用導線テーブル更新に限定され、CI、Claude hook、checker ロジック変更、実ツール導入は scope 外です。

    #136 自体も「導入する / 見送る / 条件付き導入」の採否と運用前提を決める research issue であり、EntireCLI 等の実導入・設定実装は明示的に out of scope でした。

    質問への回答

    1. #326 完了で「AI agent session 記録ツール導入」は完了するか

    しません。

    現在の実装状態は、おおむね次の段階です。

    つまり #326 は「導線の一部」を埋めるだけです。実際に session を記録する producer、manifest を生成する仕組み、schema validation 実行導線、no-push/private/local-only verifier、Kill Switch runtime smoke、secret exposure scanner はまだ不足しています。

    2. マージ後から GitHub 経由で session の振り返りができるか

    限定的にはできるが、#136 の目的を満たすレベルではまだできません。

    #326 後にできるのは、policy 関連作業で SESSION_RECORDING_POLICY_VERDICT を GitHub Issue / PR に記録する手順を Skill で標準化することです。しかし、Main Loop 全体、つまり「Issue 起票 → Issue review → 実装 → PR → PR review → merge → NextAction Issue」に対して、消費 token、subagent 呼び出し、verification 結果、fallback / skip、human intervention を 自動・決定論的に GitHub に残す 状態にはなりません。

    agent_session_manifest/v1 の schema は既にあり、GitHub comment に metadata-only manifest を置く設計も存在します。ただし、producer と validation path がないと、AI の自己申告 manifest になりやすく、証跡として弱いです。#243 でも token_usage 取得手段や自動 publish / 集計は別 issue とされています。

    現行 onboarding doc も、deterministic producer、schema validation、no-push/private/local-only verifier、Kill Switch checker 実行導線がすべて main に merge されるまで pilot 開始は禁止、と明記しています。

    3. シークレット管理は問題なく、流出の心配もないか

    「流出の心配がない」とは言えません。現状は policy とガードが整備されつつある段階です。

    良い点として、現行 session-recording-policy.md はかなり保守的です。全 mode で public_full_transcript_allowed: false、GitHub Issue comment では agent_session_manifest のみ許可、raw transcript / local file は禁止、public checkpoint branch は禁止、checkpoint remote は private_verified のみ、auto push は禁止、人間レビュー必須、という設計になっています。

    ただし、これは policy 宣言であって、実ツール導入後の安全性を自動保証するものではありません。EntireCLI 公式 docs でも、session transcript / metadata は entire/checkpoints/v1 に保存され、public repo なら checkpoint branch も public になり得ること、secret redaction は best-effort で保証ではないこと、shadow branch の code snapshots は raw blob になり得ることが説明されています。([docs.entire.io]1)

    GitHub secret scanning も「検出と警告」の仕組みであって、流出しないことの保証ではありません。GitHub は secret が見つかった場合に credential を即 rotate するよう案内しており、public repository では secret scanning が自動実行されますが、検出時点で既に露出済みです。([GitHub Docs]2)

    不足しているもの

    #326 を太らせるより、以下を別 issue として切るのが妥当です。

    1. deterministic manifest producer
      agent_session_manifest/v1 を hook / script / GitHub Actions から生成する仕組み。AI self-report は authoritative evidence にしない。

    2. manifest schema validation 実行導線
      producer が吐いた manifest を agent-session-manifest.schema.json で検証し、壊れた manifest を GitHub comment に載せない gate。

    3. no-push / private checkpoint / local-only verifier
      EntireCLI または等価ツールが public repo に transcript / checkpoint を push しないことを機械確認する verifier。

    4. Kill Switch runtime smoke test
      secrets_mode != none、checkpoint token 検出、public checkpoint branch 検出、raw transcript public surface 検出時に fail-closed できることの fixture-driven test。

    5. secret exposure scanner
      Issue / PR comment、artifact、checkpoint branch、hook log、manifest evidence に raw transcript、local path、token、.env 内容が混入していないか検査する仕組み。

    6. token_usage の実測取得経路
      ai_self_reported_token_count ではなく、provider API / tool log / CI artifact / hook log などから測定値を入れる経路。

    7. research/pilot: AI 駆動 session 記録 pilot smoke test (manifest 整合性 / Kill Switch 動作 / Secret 漏れ検査) #246 pilot smoke test の実施 / 更新
      research/pilot: AI 駆動 session 記録 pilot smoke test (manifest 整合性 / Kill Switch 動作 / Secret 漏れ検査) #246 は既に open で、1〜2 本の Main Loop を実走して manifest、Kill Switch 結果、secret exposure、token / latency / human intervention を記録する issue です。これは 実装: session-recording-policy skill を作成して操作手順を標準化する #326 後でも未完了のままです。

    Issue 起票案

    起票案 1: deterministic manifest producer

    Title
    実装: agent_session_manifest/v1 deterministic producer を追加する

    Goal
    AI agent session の振り返りに使う agent_session_manifest/v1 を、AI 自己申告ではなく hook / script / CI 由来の決定論的 producer で生成する。

    In Scope

    • .claude/hooks/agent_session_manifest_producer.sh または scripts/generate-agent-session-manifest.py の追加
    • Main Loop phase ごとの manifest 生成
    • issue_number / pr_number / head_sha / commit_sha / phase / verification / invoked_subagents / human_intervention の収集
    • token_usage は測定不能なら availability: unavailable とし、0 で偽装しない
    • raw transcript / local_file / secret-bearing artifact を public output に含めない

    Acceptance Criteria

    • agent_session_manifest/v1 schema に valid な manifest を生成できる
    • ai_suggested_manifest を authoritative evidence として扱わない
    • public GitHub comment 用 manifest に source_kind: transcript / local_file が含まれない
    • fixture test が valid / invalid を検証する
    • pnpm typecheck, pnpm lint, pnpm test, pnpm build が pass

    起票案 2: manifest validation gate

    Title
    実装: agent_session_manifest producer output の schema validation gate を追加する

    Goal
    生成された manifest を GitHub comment / PR body に載せる前に JSON Schema で検証し、壊れた session 記録を残さない。

    In Scope

    • pnpm manifest:check の追加
    • producer output の schema validation script
    • GitHub comment marker から manifest を抽出して検証する test
    • CI の python-test または test job への組み込み

    Acceptance Criteria

    • valid fixture は pass、invalid fixture は fail
    • public GitHub comment から抽出した manifest を validation できる
    • visibility: public_github_comment で source_kind: transcript/local_file を reject する
    • CI で validation が継続実行される

    起票案 3: no-push / private checkpoint verifier

    Title
    実装: session recording no-push / private checkpoint / local-only verifier を追加する

    Goal
    session 記録ツールが public GitHub に transcript / checkpoint を push しないことを機械的に検証する。

    In Scope

    • git ls-remote --heads origin entire/checkpoints/v1 の fail-on-found check
    • .entire/settings.local.json 等の push_sessions: false 検証
    • git remote -v, pushRemote, insteadOf, pushInsteadOf の検査
    • checkpoint remote がある場合は private_verified であることの確認
    • Git hook に session recording push が残っていないことの確認

    Acceptance Criteria

    • public checkpoint branch が存在したら fail
    • auto push 設定が有効なら fail
    • checkpoint remote visibility が unknown / public なら fail-closed
    • verifier の fixture test が pass
    • 実 token や secret を使わずに CI で検証できる

    起票案 4: Kill Switch runtime smoke + secret exposure scanner

    Title
    実装: session recording Kill Switch runtime smoke test と secret exposure scanner を追加する

    Goal
    policy 文書だけでなく、実際に危険条件を検出したら session recording を停止・block できることを検証する。

    In Scope

    • secrets_mode != none fixture
    • checkpoint_token_present fixture
    • public_checkpoint_branch_detected fixture
    • raw_transcript_public_surface_detected fixture
    • Issue / PR comment / artifact / manifest evidence の secret-like pattern scanner
    • fake token fixture を用いた検出 test
    • 実 secret は絶対に使わない

    Acceptance Criteria

    • Kill Switch trigger 条件ごとに fail-closed する
    • required_end_state を GitHub Issue comment 用 YAML として出力できる
    • raw transcript / .env / local absolute path / token-like string を public surface で検出したら fail
    • scanner 自体が secret をログ出力しない
    • CI で test が pass

    起票案 5: #246 の更新または実施

    Title
    pilot: Hook-based metadata ledger による session recording smoke test を実施する

    扱い
    これは既存 #246 を更新して使うのがよいです。新規起票より、#246 の preflight 条件を現状に合わせて具体化する方が自然です。

    Update 内容

    • 前提に以下を追加:

    • Smoke 対象は docs-only の軽量 Issue 1 本から開始

    • 各 phase で agent_session_manifest を GitHub Issue / PR comment に記録

    • token / latency / human intervention は測定可能なものだけ記録

    • raw transcript は public GitHub に載せない

    Acceptance Criteria

    • 1 本以上の Main Loop で manifest が全 phase に記録される
    • Kill Switch verification が各 phase 後に pass
    • Secret exposure scan が検出 0 件、または検出時に撤退記録がある
    • 採用継続 / 設定調整 / 撤退の判断がコメントに残る

    #326 には、次のコメントを返すのが適切です。

    #326 の完了は session-recording-policy skill 導線の完了であり、#136 の AI agent session 記録ツール導入完了ではない。
    
    #326 merge 後に可能になるのは、policy 関連作業で checker 実行と SESSION_RECORDING_POLICY_VERDICT 記録を標準化することに限られる。
    
    GitHub 経由で Main Loop の session 振り返りを行うには、少なくとも以下が別途必要:
    - agent_session_manifest/v1 deterministic producer
    - producer output の schema validation gate
    - no-push / private checkpoint / local-only verifier
    - Kill Switch runtime smoke test
    - secret exposure scanner
    - token_usage の実測取得経路
    - #246 pilot smoke test
    
    raw transcript / local file / secret-bearing artifact は public GitHub comment に載せない。full transcript 型ツールは local-only または private checkpoint かつ no-push / manual review が機械確認できるまで pilot 開始不可。
  6. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: 完了 (2026-05-24T12:12:00Z)

    • iteration: 3
    • verdict: approve
    • termination_reason: approved
    • 改善履歴:
      • iter 1: anchor comment (#issuecomment-4528499380) feedback_update_required を反映
        • Outcome 文言緩和(「導入完了を意味しない」旨明記)
        • AC6 (導入完了否定) / AC7 (pilot 開始前提の未完了項目) / AC8 (Claude-only / Codex Out of Scope) を追加
        • Out of Scope 追加 (deterministic producer / validation gate / no-push verifier / Kill Switch smoke / secret scanner / Codex / 実ツール導入)
        • Runtime Verification Applicability (decision: not_applicable) 追加
        • Related セクション追加
      • iter 2: C4 (VC ^[\-\$] 始まり行) を満たすため bash fenced block → list 形式へ変換
      • iter 3: C5 (VC # AC<N> 件数 = AC checkbox 件数) を満たすため list の各行に # AC<N> トークンを付与
    • 検証材料 (main thread が事実確認):
    • 次アクション: issue-contract-review skill を実行して着手前 preflight を通してから実装に進む
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      follow_up_issues:
        - request_dedupe_key: "326-followup-A"
          issue_number: 377
          issue_url: "https://github.com/squne121/loop-protocol/issues/377"
          status: created
        - request_dedupe_key: "326-followup-B"
          issue_number: 378
          issue_url: "https://github.com/squne121/loop-protocol/issues/378"
          status: created
        - request_dedupe_key: "326-followup-C"
          issue_number: 379
          issue_url: "https://github.com/squne121/loop-protocol/issues/379"
          status: created
        - request_dedupe_key: "326-followup-D"
          issue_number: 380
          issue_url: "https://github.com/squne121/loop-protocol/issues/380"
          status: created
        - request_dedupe_key: "326-followup-E"
          issue_number: 381
          issue_url: "https://github.com/squne121/loop-protocol/issues/381"
          status: created
      note_only_observations:
        - dedupe_key: "246-preflight-sync"
          source_url: "https://github.com/squne121/loop-protocol/issues/246#issuecomment-4528581434"
          source_note_id: "comment-on-existing-open-issue"
          summary: "#246 (pilot smoke test) OPEN に対し preflight gate を #326 / #377-#381 に同期するコメントを投稿。新規 Issue は作らず、既存 OPEN Issue を更新。"
  7. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    Contract Snapshot (2026-05-24T12:42:00Z)

    • Outcome: .claude/skills/session-recording-policy/SKILL.md を新規作成し、session 記録 / Kill Switch / checkpoint / EntireCLI / secret-policy 関連作業時に Claude Code が参照できる操作手順 Skill を提供する。skill 内で policy 3 文書読み込み・checker 実行・SESSION_RECORDING_POLICY_VERDICT 記録手順を標準化する。本 Issue は session 記録ツールの導入完了を意味しない。
    • Acceptance Criteria: AC1 (SKILL.md 存在) / AC2 (発火ワード) / AC3 (checker + VERDICT) / AC4 (運用導線テーブル「実装済み」更新) / AC5 (pnpm typecheck/lint/test/build pass) / AC6 (導入完了否定明記) / AC7 (pilot 前提未完了項目明記) / AC8 (Claude-only / Codex Out of Scope 明記)
    • Verification Commands: test -f (AC1), rg "<patterns>" × 12 (AC2-4,6-8), pnpm typecheck/lint/test/build × 4 (AC5) — すべて bare 非 compound コマンドで bash fenced block 内に $ command # AC<N> 形式
    • Allowed Paths: .claude/skills/session-recording-policy/SKILL.md(新規), docs/dev/session-recording-policy.md(運用導線テーブル更新のみ)
    • Worktree: .claude/worktrees/issue-326-session-recording-policy-skill
    • Branch: worktree-issue-326-session-recording-policy-skill

    VC Preflight Detail

    baseline_vc_preflight.py 出力:

    status: blocked  # 以下の caveat により実態は go-with-warning
    summary:
      expected_fail: 1   # AC1 (test -f 不在) のみ厳密に expected_baseline_fail / go
      unexpected_pass: 5 # AC4 (他 skill 行の「実装済み」hit) と AC5 (pnpm baseline pass)
      human_judgment: 8  # AC2,3,6,7,8 の rg が exit 2 (file not found) → 分類 unknown
      blocked: 0

    Preflight 判定の Override 根拠 (status: go)

    1. AC1 (test -f): decision: go / category: file_not_found_expected で baseline 正しく fail。実装後 SKILL.md 作成で pass。
    2. AC2/3/6/7/8 (rg on SKILL.md): 現在 .claude/skills/session-recording-policy/SKILL.md が不存在で rg exit 2 (file not found) を返し、分類器は expected_baseline_fail (exit 1) ではなく unknown にしている。実装で SKILL.md 作成後は patterns が match して exit 0 (PASS) となる設計通り。expected_baseline_fail 同等。
    3. AC4 (rg "実装済み" docs/dev/session-recording-policy.md): 同 doc に既存の他 skill 行が「実装済み」を持つため baseline で exit 0 (unexpected_pass)。test-runner では AC4 検証時に「実装: session-recording-policy skill を作成して操作手順を標準化する #326 用 skill 行が特に『実装済み』を持つか」を別途確認する。実装フェーズで AC4 検証 pattern を ## .*session-recording-policy.*\n.*実装済み 等に具体化することで test-runner 側の判定を厳密化する。
    4. AC5 (pnpm typecheck/lint/test/build): baseline で pass するのは設計通り(壊さない保証)。AC5 は「実装後も pass を維持する」protective gate であり、preflight の「baseline-fail 必須」前提と本質的に不整合(実装者責務)。

    Routing

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-05-24T12:42:00Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/326
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: pass
        vc_preflight:
          passed: false
          vc_failed_as_expected: 1
          vc_passed_unexpectedly: 5
          vc_unrunnable: 8
          classifications:
            - ac: AC1
              command: "test -f .claude/skills/session-recording-policy/SKILL.md"
              category: file_not_found_expected
              decision: go
              confidence: high
            - ac: AC2-3,6-8
              command: "rg <pattern> .claude/skills/session-recording-policy/SKILL.md"
              category: unknown_exit2_file_not_found
              decision: go_override
              confidence: medium
              rationale: "SKILL.md 不存在のため rg exit 2。実装で作成後は exit 0 で pass する設計通り。"
            - ac: AC4
              command: "rg \"実装済み\" docs/dev/session-recording-policy.md"
              category: unexpected_pass
              decision: go_override
              confidence: medium
              rationale: "既存他 skill 行の hit による誤陽性。test-runner で pattern を厳密化する。"
            - ac: AC5
              command: "pnpm typecheck / lint / test / build"
              category: unexpected_pass
              decision: go_override
              confidence: high
              rationale: "protective gate であり baseline pass は設計通り。"
        ac_verifiability: pass
        product_spec_check:
          applicability: not_applicable
          decision: pass
          triggers:
            docs_product_allowed_paths: false
            tasks_md_mentioned: false
            specify_artifact_mentioned: false
            generated_task_mentioned: false
            product_spec_context_present: false
        worktree_branch_collision: clear
      next_action: implement_issue
      blocked_reasons: []
      warnings:
        - "baseline_vc_preflight が status: blocked を返したが、AC2-3,5-8 の caveat は実装で解消される設計通りの状態。AC4 は test-runner ステップで pattern を厳密化する。go override の根拠は本コメントの『Override 根拠』セクションを参照。"
  8. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: APPROVE 到達 (マージ直前で停止) 2026-05-24T12:53:00Z

    LOOP_STATE_FINAL:
      issue_number: 326
      contract_snapshot_url: https://github.com/squne121/loop-protocol/issues/326#issuecomment-4528683991
      contract_snapshot_source: materialized_by_issue_contract_review (with vc_preflight go_override)
      iteration: 1
      max_iterations: 5
      worktree: .claude/worktrees/issue-326-session-recording-policy-skill
      branch: worktree-issue-326-session-recording-policy-skill
      last_step: pr_review
      last_loop_verdict: APPROVE
      pr_number: 382
      pr_url: https://github.com/squne121/loop-protocol/pull/382
      pr_state: OPEN (Draft)
      pr_mergeable: MERGEABLE
      pr_merge_state_status: CLEAN
      termination_reason: approved_stop_before_merge
      external_research_skip_basis: internal-only docs Issue
      product_spec_preflight:
        applicability: not_applicable
        decision: pass
        routing_action: continue
    
    verification_summary:
      total_acs: 8
      vc_total: 13
      vc_pass: 13
      vc_fail: 0
      pnpm_gates:
        typecheck: pass
        lint: pass
        test: pass (25/25)
        build: pass
    
    next_human_actions:
      - PR #382 を Ready for review に変更
      - main へマージ
      - post-merge-cleanup skill で worktree / branch 整理
      - 完了後 #246 / #377-#381 follow-up の優先順位確認
  9. added a commit that references this issue on May 24, 2026
  10. added a commit that references this issue on May 24, 2026
  11. squne121 commented on May 24, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-05-24T13:28:00Z)

    POST_MERGE_CLEANUP_REPORT_V1:
      status: partial
      generated_at: "2026-05-24T13:28:00Z"
      generated_by: post-merge-cleanup-worker
      human_review_required: false
      cleaned_branches:
        - worktree-issue-326-session-recording-policy-skill
      cleaned_worktrees:
        - .claude/worktrees/issue-326-session-recording-policy-skill
      unresolved_cleanup_items:
        - "root worktree に未追跡ファイルが残存: .antigravitycli/, .claude/investigator-context-*.md, .claude/investigator-tmp/, .codex/skills, .specify/templates/overrides/"
        - "`gh pr list --search \"linked:issue/326 is:open\"` は #376 / #374 を返したが #326 superseded PR とは確認できず、close/comment は未実行"
      parent_issue_status:
        parent_issue_number: 242
        all_children_closed: true
        recommended_action: n/a
      superseded_prs: []
      follow_up_issue_requests: []
      stash_restored: n/a
      stash_entry_ref: null
      warnings:
        - "GitHub parent issue API は #326 に対して 404 を返したため、Issue body の parent_ref (#242) と parent issue CLOSED 状態から parent cleanup 不要と判断"
      errors: []
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "326-followup-existing"
          source_url: "https://github.com/squne121/loop-protocol/issues/326#issuecomment-4528582801"
          source_note_id: "FOLLOW_UP_MATERIALIZATION_RESULT_V1"
          summary: "#377-#381 は issue-refinement-loop 時点で既に作成済みのため、post-merge-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

    area/ai-opsarea/securitykind/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions