Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#136"
goal_ref: "AI agent session を Main Loop の phase 別に metadata-only で観測するための agent_session_manifest/v1 schema と運用 SSOT を確定する"
change_kind: mixedParent Issue
Parent Goal Ref
- Goal: AI agent session 記録ツール(EntireCLI 等)の採否 Decision と、採用時の運用前提を確定する
- Desired Destination: metadata-first 方針のもと、session 観測可能性の基盤 schema を docs に定義し、hook 実装 Issue が参照できる状態にする
Current Validated Scope
docs/schemas/agent-session-manifest.mdの新規作成(agent_session_manifest/v1 schema 定義 Markdown)docs/schemas/agent-session-manifest.schema.jsonの新規作成(機械可読 JSON Schema)docs/schemas/examples/配下の valid / invalid fixturestests/agent-session-manifest.test.tsの新規作成(schema validation テスト)docs/dev/agent-skill-boundaries.mdへの cross-link 追加(Hook-based Ledger Optional Design セクション周辺)docs/dev/schema-governance.mdへのagent_session_manifest/v1登録
Remaining Parent Gaps
- SubagentStop hook 実装(別 follow-up Issue)
- 自動 publish / 自動集計スクリプト(別 Issue)
- token_usage 取得手段の実装(別 Issue)
Source / Context
- Parent (research / decision): 調査: AI agent session 記録ツール(EntireCLI 等)導入の是非と運用前提を決定する #136
- Anchor decision: 調査: AI agent session 記録ツール(EntireCLI 等)導入の是非と運用前提を決定する #136 (comment)
- 関連: 実装・検証・レビュー・PR本文更新をAIエージェントに自律ループさせる際の停止条件が弱かった #131 (PR feat: gemini-cli-headless-delegation に read-only ACP transport(実験的)を追加する #81 振り返り), 実装: docs/dev/agent-skill-boundaries.md に Loop Sequencing & Preconditions セクションを追加する #44 (SubAgent Execution Ledger), 実装: schema 変更 PR に Schema Consumer Inventory を本文必須化し pr-review-judge で consumer 未更新を検出する #135 (Schema Consumer Inventory)
- 既存設計:
docs/dev/agent-skill-boundaries.mdの「Hook-based Ledger Optional Design」セクション(SubagentStop hook 設計案) - 人間レビュー: https://github.com/squne121/loop-protocol/pull/314#issuecomment-4525755997(PR docs(#243): agent_session_manifest/v1 schema SSOT 定義と Main Loop phase 別記録運用確定 #314 REQUEST_CHANGES — JSON Schema 欠如・phase 矛盾・型曖昧・fence 破損・evidence 衝突を指摘)
Outcome
docs/schemas/agent-session-manifest.md (Markdown 仕様書) と docs/schemas/agent-session-manifest.schema.json (JSON Schema、SSOT) が追加され、Main Loop の各 phase で GitHub Issue/PR コメントに残す metadata が機械検証可能な形で定義された状態。valid / invalid fixtures と pnpm テストにより schema バリデーションが自動検証される。さらに docs/dev/agent-skill-boundaries.md の Hook-based Ledger 設計と cross-link され、docs/dev/schema-governance.md に agent_session_manifest/v1 が登録されている。
Background
PR #81 / #131 振り返りで「AC 読み落とし」「test-runner 呼び出し有無」「SKIP exit 0 黙認」「PR 本文全面置換」「token/context 圧迫」を事後検証する手段が無いことが判明(codebase-investigator が #131 / #136 を辿って確認済み)。#136 の Decision として「metadata-first / full transcript は疑義発生時のみ」が採択された。初回 PR #314 では Markdown 表 + rg 文字列検証のみで「schema governance の定義する machine-readable contract」に達せず、人間レビューで REQUEST_CHANGES(PR #314 comment #4525755997)。JSON Schema + fixtures + テストを追加してやり直す。
In Scope
Markdown 仕様書(docs/schemas/agent-session-manifest.md)
- YAML フロントマター:
schema_version: v1 - フィールド定義表(グローバル必須フィールドとオプションフィールド):
- グローバル必須(全 phase 共通):
schema / manifest_id / recorded_at / repository / actor / phase / redaction - オプション(phase 条件 or nullable):
head_sha / issue_number / pr_number / commit_sha / token_usage / invoked_subagents / verification / evidence / human_intervention / next_action_issue
- グローバル必須(全 phase 共通):
- schema fields 定義:
schema: "agent_session_manifest/v1"(string, 固定)manifest_id: UUID v4 形式、"asm-"prefix 付き(例:"asm-550e8400-e29b-41d4-a716-446655440000")recorded_at: ISO 8601repository: 文字列(例:"squne121/loop-protocol")head_sha: 40-hex SHA または nullactorオブジェクト:type (ai_agent | human | github_action),name,session_id (UUID または null)issue_number,pr_number,commit_sha(nullable、commit_sha は 40-hex または null)phase構造体:phase.main_loop(enum: issue_create / issue_review / impl / pr_open / pr_review / merge / followup_create)phase.ledger_phase(enum scalar または null: issue_contract_preflight / runtime_preflight / implementation / post_commit_verification / pr_body_update / semantic_review / pre_merge_judgment / followup_issue_materialization)phase.phase_instance_id(文字列,"issue-N:phase:001"形式)- 1 manifest = 1 ledger phase 原則:
implphase はimplementationとpost_commit_verificationの 2 manifest を残す(ledger_phaseは scalar のため複数値不可)
token_usage構造体(availability 付き):availability: measured | estimated | unavailablesource: provider_api | tool_log | entire_cli | manual_report | noneprompt: null | intcompletion: null | inttotal: null | int- 禁止:
unavailable時にprompt: 0等の偽値を入れることを MUST NOT と明記
invoked_subagents(list of {name, count, duration_ms?})evidenceリスト:[{source_kind, source_ref, source_sha256, visibility}]source_kind:github_comment | ci_check | hook_jsonl | artifact | transcript | local_filevisibility:public_github_comment | private_artifact | local_only- 制約:
visibility: public_github_commentの場合はsource_kind: transcriptおよびsource_kind: local_fileを MUST NOT source_ref:visibility: public_github_commentの場合は GitHub URL または artifact URL のみ(ローカル絶対パス禁止)
redactionオブジェクト:raw_transcript_included (bool),local_paths_included (bool),secret_scan_statusverification構造体:overall: pass | fail | partial | blocked | not_applicableskipped_count: int(skipped_count > 0 かつ overall: pass の組み合わせを MUST NOT と明記)fallback_detected: boolac_results: [{ac, verdict (pass | fail | skip | blocked | not_applicable), command, exit_code, artifact_ref, waiver_ref}]
human_interventionオブジェクト:required (bool),type,summarynext_action_issue(issue#, nullable)
- Main Loop phase と SubAgent Execution Ledger phase の対応表(1 manifest = 1 ledger phase 前提):
issue_review -> issue_contract_preflight impl (1st) -> implementation impl (2nd) -> post_commit_verification pr_open -> pr_body_update pr_review -> semantic_review merge (AI) -> pre_merge_judgment merge (human) -> github_merge_event (actor.type: human, session_id: null 可) followup_create -> followup_issue_materialization - 各 phase の必須フィールド / 任意フィールド 表(phase 別)
- GitHub comment には raw transcript / local path / API key / .env content / agent-local settings を含めない方針の明記(MUST NOT ポリシー)
- GitHub Comment テンプレート(4 backticks で囲んだ fenced code block):
<!-- agent_session_manifest:v1 start --> ```yaml schema: agent_session_manifest/v1 manifest_id: "asm-550e8400-e29b-41d4-a716-446655440000" ... ``` <!-- agent_session_manifest:v1 end -->
JSON Schema(docs/schemas/agent-session-manifest.schema.json)
- JSON Schema Draft 2020-12 形式
- グローバル
required:["schema", "manifest_id", "recorded_at", "repository", "actor", "phase", "redaction"] manifest_idの pattern:"^asm-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"head_sha/commit_shaの pattern:"^[0-9a-f]{40}$"または nullphase.ledger_phaseの enum:["issue_contract_preflight", "runtime_preflight", "implementation", "post_commit_verification", "pr_body_update", "semantic_review", "pre_merge_judgment", "followup_issue_materialization", null]evidenceアイテムの if/then:visibility: public_github_commentの場合source_kindにtranscript/local_fileを禁止(not+enumで表現)token_usage.availabilityenum:["measured", "estimated", "unavailable"]verification.overallenum:["pass", "fail", "partial", "blocked", "not_applicable"]actor.typeenum:["ai_agent", "human", "github_action"]phase.main_loopenum:["issue_create", "issue_review", "impl", "pr_open", "pr_review", "merge", "followup_create"]
Fixtures(docs/schemas/examples/)
Valid fixtures(schema validation PASS):
agent-session-manifest.issue_review.valid.yaml— issue_review + issue_contract_preflightagent-session-manifest.impl.implementation.valid.yaml— impl + implementationagent-session-manifest.impl.post_commit_verification.valid.yaml— impl + post_commit_verificationagent-session-manifest.pr_review.valid.yaml— pr_review + semantic_reviewagent-session-manifest.merge.human.valid.yaml— merge + actor.type: human + session_id: null
Invalid fixtures(schema validation FAIL):
invalid.skipped_count_pass.yaml— skipped_count: 1 かつ overall: pass(MUST NOT 相当)invalid.token_unavailable_zero.yaml— availability: unavailable かつ prompt: 0invalid.public_transcript_evidence.yaml— visibility: public_github_comment かつ source_kind: transcriptinvalid.short_sha.yaml— head_sha が 7 文字の短縮 SHA
テスト(tests/agent-session-manifest.test.ts)
- vitest で valid fixtures 全件をスキーマ validation → PASS
- vitest で invalid fixtures 全件をスキーマ validation → FAIL(各 fixture が期待通り reject されること)
- GitHub Comment テンプレートを Markdown から抽出して YAML parse できること(AC15 の決定論的検証)
docs 更新
docs/dev/agent-skill-boundaries.md: Hook-based Ledger Optional Design セクション周辺にagent-session-manifest.md/agent-session-manifest.schema.jsonへの参照リンクを追加docs/dev/schema-governance.md:agent_session_manifest/v1を schema_id として登録(producer / consumer / detection_patterns / validation_commands)
Out of Scope
- SubagentStop hook 実装そのもの(別 follow-up Issue)
- 自動 publish / 自動集計スクリプト
- EntireCLI 等の外部 session 記録ツール導入そのもの(調査: AI agent session 記録ツール(EntireCLI 等)導入の是非と運用前提を決定する #136 で deferred)
- token_usage の取得手段の実装(schema 定義のみ)
- CI gate(GitHub Actions への追加は別 Issue)
- Markdown 表から JSON Schema を自動生成するスクリプト(別 Issue)
Acceptance Criteria
- AC1:
docs/schemas/agent-session-manifest.mdが存在し、YAML フロントマターにschema_version: v1を持つ - AC2: schema Markdown 内に
manifest_id / recorded_at / repository / head_sha / actor / phase.main_loop / phase.ledger_phase / issue_number / pr_number / commit_sha / token_usage.availability / invoked_subagents / verification.overall / verification.ac_results / evidence / redaction / human_intervention / next_action_issueの全 fields が記述されている - AC3: phase.main_loop enum が
issue_create / issue_review / impl / pr_open / pr_review / merge / followup_createの 7 値で JSON Schema に定義されている - AC4: 各 phase の必須フィールド / 任意フィールド表が Markdown に記述されている
- AC5: GitHub Comment テンプレートが 4 backticks (
` ```)で囲まれた fenced code block として記述されており、内部の YAML が<!-- agent_session_manifest:v1 start -->/endmarker で囲まれている - AC6:
docs/dev/agent-skill-boundaries.md内にagent-session-manifestへの参照リンクが追加されている - AC7:
pnpm typecheck,pnpm lint,pnpm test,pnpm buildがすべて pass する - AC8:
docs/dev/schema-governance.mdにagent_session_manifest/v1がschema_idとして登録されている - AC9:
docs/dev/schema-governance.mdのagent_session_manifest/v1エントリ内にproducer / consumer / detection_patternsが記述されている - AC10: schema Markdown 本文に Main Loop phase と SubAgent Execution Ledger phase の対応表(1 manifest = 1 ledger phase 前提)が含まれている
- AC11: schema Markdown 本文に
token_usage.availabilityフィールドがあり、unavailableを 0 と偽装しない旨が明記されている - AC12: schema Markdown 本文に GitHub comment への raw transcript 禁止ポリシーが明記されている
- AC13:
docs/schemas/agent-session-manifest.schema.jsonが存在し、pnpm testで valid fixtures 全件 PASS・invalid fixtures 全件 FAIL となる(schema validation テストが通る) - AC14: JSON Schema に
evidenceのvisibility: public_github_comment時はsource_kind: transcript/local_fileを禁止する制約が含まれている - AC15: GitHub Comment テンプレートの外側 fence が 4 backticks で囲まれており、テスト内で Markdown から YAML を抽出して parse できる
- AC16: JSON Schema に
manifest_idがasm-<UUIDv4>パターン、head_sha/commit_shaが 40-hex パターン(または null)として定義されている - AC17: JSON Schema に
phase.ledger_phaseが enum(scalar)として定義されており、implphase で 2 manifest を残す方式が Markdown に明記されている
Verification Commands
test -f docs/schemas/agent-session-manifest.md && rg "^schema_version: v1$" docs/schemas/agent-session-manifest.md && echo "PASS" || echo "FAIL"# AC1rg "manifest_id|recorded_at|repository|head_sha|actor|phase.*main_loop|token_usage.*availability|invoked_subagents|verification.*overall|evidence|redaction" docs/schemas/agent-session-manifest.md && echo "PASS" || echo "FAIL"# AC2test -f docs/schemas/agent-session-manifest.schema.json && rg "issue_create|issue_review|impl|pr_open|pr_review|merge|followup_create" docs/schemas/agent-session-manifest.schema.json && echo "PASS" || echo "FAIL"# AC3rg "必須|任意|required|optional" docs/schemas/agent-session-manifest.md && echo "PASS" || echo "FAIL"# AC4rg "agent_session_manifest:v1 start" docs/schemas/agent-session-manifest.md && grep -c '^\```' docs/schemas/agent-session-manifest.md | awk '{if($1>=2) print "PASS"; else print "FAIL"}'` # AC5rg "agent-session-manifest" docs/dev/agent-skill-boundaries.md && echo "PASS" || echo "FAIL"# AC6pnpm typecheck && pnpm lint && pnpm test && pnpm build# AC7rg "agent_session_manifest/v1" docs/dev/schema-governance.md && echo "PASS" || echo "FAIL"# AC8rg -A 30 "agent_session_manifest/v1" docs/dev/schema-governance.md | rg "producer|consumer|detection_patterns" && echo "PASS" || echo "FAIL"# AC9rg "impl.*implementation|impl.*post_commit|1 manifest.*1 ledger|ledger.*scalar" docs/schemas/agent-session-manifest.md && echo "PASS" || echo "FAIL"# AC10rg "availability" docs/schemas/agent-session-manifest.md | rg "measured|estimated|unavailable" && echo "PASS" || echo "FAIL"# AC11rg "raw.transcript|transcript.*禁止|MUST NOT.*transcript" docs/schemas/agent-session-manifest.md && echo "PASS" || echo "FAIL"# AC12test -f docs/schemas/agent-session-manifest.schema.json && pnpm test -- --reporter=verbose 2>&1 | rg "agent-session-manifest" | rg "PASS|✓|passed" && echo "PASS" || echo "FAIL"# AC13rg "public_github_comment" docs/schemas/agent-session-manifest.schema.json | rg "transcript|local_file" && echo "PASS" || echo "FAIL"# AC14grep -c '^\```' docs/schemas/agent-session-manifest.md | awk '{if($1>=2) print "PASS"; else print "FAIL"}'` # AC15rg "asm-.*[0-9a-f]{8}|manifest_id.*pattern|pattern.*asm" docs/schemas/agent-session-manifest.schema.json && rg "[0-9a-f]{40}|40.*hex|head_sha.*pattern" docs/schemas/agent-session-manifest.schema.json && echo "PASS" || echo "FAIL"# AC16rg "ledger_phase" docs/schemas/agent-session-manifest.schema.json | rg "enum" && rg "1 manifest.*1 ledger|impl.*2 manifest|2.*manifest.*impl" docs/schemas/agent-session-manifest.md && echo "PASS" || echo "FAIL"# AC17
Allowed Paths
docs/schemas/agent-session-manifest.md(新規作成・修正)docs/schemas/agent-session-manifest.schema.json(JSON Schema 新規作成)docs/schemas/examples/(fixtures 新規作成)tests/agent-session-manifest.test.ts(validation テスト 新規作成)docs/dev/agent-skill-boundaries.md(cross-link 追加のみ。Hook-based Ledger Optional Design セクション周辺)docs/dev/schema-governance.md(agent_session_manifest/v1 の初期登録)
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- Outcome / Scope / AC が VC で検証できない形式に崩れた場合
- schema fields を anchor decision (調査: AI agent session 記録ツール(EntireCLI 等)導入の是非と運用前提を決定する #136 comment 4523810449) と矛盾する形で省略・改変した場合
Runtime Verification Applicability
- decision: not_applicable
- reason: 本 Issue は docs + schema ファイル + テストの変更。pnpm test は schema validation 自体の確認であり runtime artifact の動作検証ではない。AC13〜AC17 はすべてファイル存在・JSON Schema 構造・rg パターン一致・pnpm test exit code で完結する静的検証。
Required Skills
- JSON Schema Draft 2020-12(
required,enum,pattern,if/then,oneOf,additionalProperties,not) - vitest(TypeScript test runner)
Scope Delta
N/A(Allowed Paths に新規追加分を明示済み)
Handoff Contract
- Current Objective: agent_session_manifest/v1 schema SSOT 確定(機械可読 JSON Schema + バリデーションテスト付き)
- Bounded Current Context: 調査: AI agent session 記録ツール(EntireCLI 等)導入の是非と運用前提を決定する #136 Decision の metadata-first 方針、実装・検証・レビュー・PR本文更新をAIエージェントに自律ループさせる際の停止条件が弱かった #131 振り返り、既存 Hook-based Ledger 設計、PR docs(#243): agent_session_manifest/v1 schema SSOT 定義と Main Loop phase 別記録運用確定 #314 人間レビュー REQUEST_CHANGES(comment #4525755997)
- Open Questions: phase 数の最終確定(7 値で十分か)、token_usage 取得手段(別 Issue)
- Next Action: 本 Issue 完了後、SubagentStop hook 実装 Issue を follow-up として起票(schema を参照する側)
- Artifact Refs: docs/dev/agent-skill-boundaries.md Hook-based Ledger Optional Design セクション, 実装・検証・レビュー・PR本文更新をAIエージェントに自律ループさせる際の停止条件が弱かった #131 振り返り分析, PR docs(#243): agent_session_manifest/v1 schema SSOT 定義と Main Loop phase 別記録運用確定 #314 REQUEST_CHANGES comment
Activity
squne121 commentedon May 23, 2026
判定: REQUEST_CHANGES
#243 は方向性は妥当です。#136 の「metadata-first / full transcript は疑義発生時のみ」という判断を、GitHub Issue/PR コメントで観測可能な
agent_session_manifest/v1に落とす流れは正しいです。ただし、現状の Issue contract のまま実装すると “SSOT を名乗るが schema governance・既存 ledger・Kill Switch と噛み合わない孤立ドキュメント” になるリスクが高いです。#243 自体は open でコメントなし、本文上はdocs/schemas/agent-session-manifest.md新規作成とdocs/dev/agent-skill-boundaries.mdへの cross-link だけを許可しています。致命的ブロッカー
1.
agent_session_manifest/v1が schema governance から漏れる#135 は、Markdown 内 YAML・PR comment YAML・log artifact などを「producer/consumer 境界をまたぐ machine-readable contract」と定義し、schema 変更時は Schema Consumer Inventory を必須にしています。
agent_session_manifest/v1は明らかにこの定義に該当します。しかし #243 の Allowed Paths は
docs/schemas/agent-session-manifest.mdとdocs/dev/agent-skill-boundaries.mdだけで、既存のdocs/dev/schema-governance.mdを更新できません。現在の schema governance にはagent_session_manifest/v1が初期 schema として登録されておらず、producer / consumer / detection pattern / validation command も定義されていません。これは SSOT としては破綻です。最低限、#243 の Allowed Paths に
docs/dev/schema-governance.mdを追加し、AC に以下を足すべきです。登録例:
2. 既存 SubAgent Execution Ledger と phase が二重化している
#44 で既に
SubAgent Execution Ledgerと phase table が導入済みです。既存 ledger はissue_contract_preflight / runtime_preflight / implementation / post_commit_verification / pr_body_update / semantic_review / pre_merge_judgmentを扱い、test-runner 未実行・SKIP-only・fallback PASS・stale head_sha・ledger 不完全を APPROVE 禁止条件にしています。一方 #243 は
issue_create / issue_review / impl / pr_open / pr_review / merge / followup_createという Main Loop phase を新設します。これは抽象度が異なります。放置すると、pr_reviewが既存のsemantic_reviewなのかpre_merge_judgmentなのか曖昧になり、implとimplementationも別物として集計されます。修正案は、
phaseを単一 enum にしないことです。最低限こう分けるべきです。さらに schema 本文に対応表が必要です。
mergeは特に危険です。人間が GitHub UI で merge した場合、AI agent session は存在しません。session_id必須にすると記録不能になります。actor_type: ai | human | github_actionとsession_id: nullableを入れるべきです。3. provenance が弱く、stale / self-report を検出できない
#44 の現行 ledger は、PR 本文 ledger は summary にすぎず、GitHub comment / CI check / hook_jsonl / transcript / artifact のような非 PR-body evidence を required phase ごとに要求しています。
#243 の schema fields には
recorded_at,head_sha,evidence.source_kind,evidence.source_ref,manifest_id,producer,source_sha256がありません。これでは後から「この manifest はどの head_sha を観測したのか」「PR 本文の自己申告なのか」「hook 出力なのか」「stale なのか」を判定できません。最低限の top-level fields はこうするべきです。
4.
token_usageを必須 field にすると偽データを誘発する#243 は
token_usageを schema field に入れていますが、同じ Issue 内でtoken_usage 取得手段の実装は別 Issue としています。これは危険です。AI agent は AC を満たすために
0や推定値を入れがちです。PR #81 の教訓は「SKIP や fallback を成功扱いするな」です。測定不能な値をそれらしく埋める設計は、同じ失敗を token 計測に持ち込みます。PR #81 では SKIP exit 77 / fallback PASS / schema consumer 破壊が実際に問題化しています。修正案:
AC は「数値があること」ではなく、「availability と source が明示され、unavailable を 0 と偽装しないこと」にするべきです。
5.
verification_resultが粗すぎる#243 の
verification_result (PASS / FAIL / SKIP per AC)は方向性は正しいですが、PR #81 の失敗を止めるには粒度不足です。PASS / FAIL / SKIPだけでは、SKIP-only、fallback PASS、deferred、blocked、not_applicable を区別できません。推奨:
SKIPがある場合はoverall: passを禁止する、というルールを schema 本文に明記するべきです。外部技術調査に基づく高品質化
Claude Code hooks はこの用途に合いますが、限界があります。公式 docs 上、hooks は lifecycle point で実行される shell command / HTTP endpoint / LLM prompt であり、
PostToolUseは tool completion 後にduration_msなどを受け取れます。SubagentStopはagent_id,agent_type,agent_transcript_path,last_assistant_messageを受け取れます。([Claude API Docs]1)ただし Stop hook は hard gate ではありません。公式 docs では Stop hook が連続ブロックされた場合、8 回後に Claude が hook を override して終了するとされています。したがって #243 の manifest は「記録」には使えますが、merge 防止の hard gate は pr-review-judge / CI / branch protection 側に置くべきです。([Claude API Docs]1)
EntireCLI については、README 上は Git workflow に hook し、prompt/response transcript、files touched、token usage、tool calls を commit と紐付けて保存できるため、#136 の観測目的には合っています。一方、session metadata は
entire/checkpoints/v1branch に保存され、--skip-push-sessions,--checkpoint-remote,entire disable,--telemetry=falseなどの制御点があります。セキュリティ面では、EntireCLI の security docs は、transcripts / prompts / checkpoint metadata が
entire/checkpoints/v1に commit され、public repo では internet に見えること、transcript が file contents / MCP calls / tool interactions を含み得ること、temporary shadow branch の code-file snapshots は raw blob で redaction されないことを明記しています。つまり #243 の metadata-only 方針は正しいですが、full transcript を GitHub comment に貼る運用は明確に禁止すべきです。Vite 側も注意が必要です。Vite は
VITE_prefix の env を client bundle に露出し、公式 docs はVITE_*に sensitive information を入れるべきではないと明記しています。さらに GitHub Secret Scanning は public repository では Git history だけでなく issues / PRs / discussions / wikis なども対象にしますが、これは検出機構であって「貼ってよい」根拠ではなく、漏洩時は credential rotation が必要です。([vitejs]2)#241 / #242 との依存関係が弱い
#241 は Secret Inventory と no-secret boundary を SSOT 化する open Issue で、
current / publish_secret / app_runtime_secret / agent_local_secret / checkpoint_tokenを分類対象にしています。#242 は session recording Kill Switch policy の open Issue で、
secrets_mode,full_transcript_allowed,github_public_checkpoint_branch_allowed: false,auto_push_sessions_allowed: false,manual_review_required_before_push: trueを定義し、git ls-remote origin refs/heads/entire/checkpoints/v1や secret token grep を検証コマンドにしています。#243 は #241/#242 が未完でも schema 定義だけなら進められます。ただし、#243 の Outcome に「hook 実装 Issue が参照できる」と書くなら、schema 本文に以下の注意が必要です。
推奨パッチ方針
#243 を高品質化するなら、Issue contract を次の順で修正するのがよいです。
Allowed Paths 追加
docs/dev/schema-governance.mddocs/dev/session-recording-policy.mdへの forward reference 追加AC 追加
agent_session_manifest/v1が schema-governance に登録されているtoken_usage.availabilityにより unavailable / estimated / measured を区別するschema fields 拡張
manifest_idrecorded_atrepositoryhead_shaactor.typephase.main_loopphase.ledger_phaseevidence[]redactiontoken_usage.availability/sourceverification schema を per-AC にする
overallac_results[]exit_codeartifact_refwaiver_reffallback_detectedコメントテンプレを parse-safe にする
現状案の fenced code block は悪くありませんが、検出性を上げるために marker を付けるべきです。
修正版 schema の最小例
結論
#243 は 採用すべきだが、このまま実装してはいけません。特に
schema-governance.md未登録、既存SubAgent Execution Ledgerとの phase 不整合、token_usageの偽装リスク、evidence/provenance 不足は blocker です。最小修正は次です。
これを入れれば、#136 の「Main Loop の実測改善」と #131 の「PR #81 型の失敗再発防止」に接続できる schema になります。
squne121 commentedon May 23, 2026
Issue 本文更新報告
reviewer_feedback(squne121 による REQUEST_CHANGES)に基づき、以下の変更を Issue 本文に反映しました。
変更一覧
変更1: Allowed Paths に追加
docs/dev/schema-governance.md(agent_session_manifest/v1 の初期登録) を追加変更2: In Scope の schema fields を拡張
manifest_id(UUID, "asm-" 形式)recorded_at(ISO 8601 タイムスタンプ)repository(文字列, "squne121/loop-protocol")head_sha(nullable)actorオブジェクト (type / name / session_id)phaseを構造体に変更 (main_loop / ledger_phase / phase_instance_id)evidenceリスト (source_kind / source_ref / source_sha256)redactionオブジェクト (raw_transcript_included / local_paths_included / secret_scan_status)token_usageを availability 付き構造体に変更verification構造体に変更 (overall / skipped_count / fallback_detected / ac_results)変更3: In Scope に追加コンテンツ
docs/dev/schema-governance.mdへのagent_session_manifest/v1登録仕様 (producer / consumer / detection_patterns)変更4 & 5: Acceptance Criteria 更新
変更6 & 7: Verification Commands 更新
その他
バックアップ:
/tmp/issue-243-backup.txtに保存済み(7804 bytes)squne121 commentedon May 23, 2026
issue-refinement-loop: 完了 (2026-05-23T13:17:14Z)
改善履歴
docs/dev/schema-governance.mdを追加(agent_session_manifest/v1 初期登録用)manifest_id/recorded_at/repository/head_sha/actor/phase.main_loop/phase.ledger_phase/evidence[]/redaction/token_usage.availability/verification.overall等を追加反映したフィードバック
schema-governance.mdへの登録を Allowed Paths / AC に追加manifest_id/recorded_at/head_sha/actor.type/evidence[]を schema fields に追加(provenance 強化)token_usageをavailability: measured | estimated | unavailable付き構造体に変更verification_result→verification.overall + ac_results[]の per-AC 構造体に変更次アクション
issue-contract-reviewを実行して実装着手前 preflight を通してください。squne121 commentedon May 23, 2026
Contract Review: BLOCKED (2026-05-23T13:30:00Z)
不足項目
VC9 が想定外 PASS(VCが緩すぎる)
VC 精度確認
VC9 修正案
または、AC8 と AC9 を統合した VC(agent_session_manifest/v1 ブロック内に producer/consumer 等があること)にする。
参考: 正常 PASS の VC について
推奨アクション
選択肢 A: VC9 を修正してから再実行(推奨)
選択肢 B: このまま承認して実装継続
squne121 commentedon May 23, 2026
Contract Snapshot (2026-05-23T13:28:46Z)
docs/schemas/agent-session-manifest.mdにagent_session_manifest/v1schema が定義され、Main Loop phase 別の metadata 記録 SSOT が確定した状態。docs/dev/schema-governance.mdにagent_session_manifest/v1が登録され、docs/dev/agent-skill-boundaries.mdに cross-link が追加されている。rg -A 30 "agent_session_manifest/v1" docs/dev/schema-governance.md | rg "producer|consumer|detection_patterns")docs/schemas/agent-session-manifest.md(新規作成)docs/dev/agent-skill-boundaries.md(cross-link 追加のみ)docs/dev/schema-governance.md(agent_session_manifest/v1 の初期登録).claude/worktrees/issue-243-agent-session-manifest-v1-schema-main-loworktree-issue-243-agent-session-manifest-v1-schema-main-losqune121 commentedon May 23, 2026
implement-issue: 実装完了 (2026-05-23T13:37:00Z)
.claude/worktrees/issue-243-agent-session-manifest-v1-schema-main-loworktree-issue-243-agent-session-manifest-v1-schema-main-losqune121 commentedon May 23, 2026
impl-review-loop: 完了 (2026-05-23T14:59:04Z)
squne121 commentedon May 23, 2026
Contract Snapshot (2026-05-23T15:15:37Z)
docs/schemas/agent-session-manifest.md+docs/schemas/agent-session-manifest.schema.json(JSON Schema) + fixtures + テストが追加され、Main Loop phase 別 metadata 記録が機械検証可能な形で SSOT 化された状態。docs/schemas/agent-session-manifest.md(新規作成・修正)docs/schemas/agent-session-manifest.schema.json(JSON Schema 新規作成)docs/schemas/examples/(fixtures 新規作成)tests/agent-session-manifest.test.ts(validation テスト 新規作成)docs/dev/agent-skill-boundaries.md(cross-link 追加)docs/dev/schema-governance.md(agent_session_manifest/v1 登録).claude/worktrees/issue-243-agent-session-manifest-v1-schema-main-lo(前イテレーション継続使用)worktree-issue-243-agent-session-manifest-v1-schema-main-lo(前イテレーション継続使用)fix(#243): iteration 1 — JSON Schema 追加・Markdown 矛盾修正・visibility 制約・f…
squne121 commentedon May 23, 2026
implement-issue: iteration 1 実装完了 (2026-05-24T00:26:00Z)
.claude/worktrees/issue-243-agent-session-manifest-v1-schema-main-loworktree-issue-243-agent-session-manifest-v1-schema-main-loREQUEST_CHANGES 対応サマリ
docs/schemas/agent-session-manifest.schema.json新規作成後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
squne121 commentedon May 23, 2026
impl-review-loop: 完了 (2026-05-23T15:33:00Z)
変更サマリー(iteration 0 → 1)
iteration 0: Markdown 仕様書 + schema-governance 登録(PR #314 初回コミット)
iteration 1: 人間レビュー REQUEST_CHANGES(#issuecomment-4525755997)対応
docs/schemas/agent-session-manifest.schema.json追加(JSON Schema Draft 2020-12)docs/schemas/examples/)追加tests/agent-session-manifest.test.ts追加(25 件テスト、全 PASS)docs(#243): agent_session_manifest/v1 schema SSOT 定義と Main Loop phase…
squne121 commentedon May 23, 2026
post-merge-cleanup: 完了 (2026-05-23T15:37:17Z)
cleanup サマリー
.claude/worktrees/issue-243-agent-session-manifest-v1-schema-main-lo削除済みworktree-issue-243-agent-session-manifest-v1-schema-main-lo削除済みdocs: add session-recording-tool.md onboarding guide (#245) (#347)
fix: agent_session_manifest/v1 詳細登録セクションを復元する (#1507)
feat: issue-reviewer compact 出力の決定論的 fail-closed 検証を追加 (#1507) (#1519)