Repository navigation
docs(#243): agent_session_manifest/v1 schema SSOT 定義と Main Loop phase 別記録運用確定 - #314
Conversation
… 別記録運用確定 PR #81 / #131 振り返りで明らかになった事後検証困難を解消するために、 Main Loop 各 phase で GitHub Issue/PR コメントに残す metadata の SSOT を確定する。 - docs/schemas/agent-session-manifest.md (新規): agent_session_manifest/v1 schema 定義 - phase.main_loop(7 値 enum)と phase.ledger_phase の対応表 - 各 phase の必須/任意 fields 表 - token_usage.availability: unavailable を 0 と偽装しない方針 - raw transcript 禁止ポリシー(MUST NOT) - HTML marker 付き GitHub comment テンプレート - docs/dev/agent-skill-boundaries.md: Hook-based Ledger Optional Design セクションに cross-link 追加 - docs/dev/schema-governance.md: agent_session_manifest/v1 を producer/consumer/detection_patterns 付きで登録 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
検証結果レポートIssue #243: agent-session-manifest v1 schema
総合判定
```yaml ✓ すべての Acceptance Criteria を Worktree 内で検証完了。PR は merge-ready です。 |
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
AC coverage: 12/12 PASS
AC1 through AC12 are all marked PASS in the PR body with specific verification commands and results. The test-runner SubAgent (<!-- TEST_VERDICT_MACHINE v1 -->) independently confirmed all 12 ACs pass with verification_commands_fail: 0.
Allowed Paths: Compliant
Changed files (3): docs/schemas/agent-session-manifest.md (new), docs/dev/agent-skill-boundaries.md (cross-link only), docs/dev/schema-governance.md (initial registration). All three are within the Allowed Paths defined by Issue #243.
CI Verification: All 5 checks pass — build, lint, python-test, test, typecheck (via GitHub Actions run 26334104493).
検証コマンド結果: All 12 AC verification commands are recorded in the PR body with specific rg/test commands and exit results. No placeholder text remains.
Schema Change Applicability: Declared as schema_change (new schema added). Schema Consumer Inventory is present with before/after diff, rg-enumerated consumer list, and all consumers marked updated or N/A with rationale. Compatibility Decision: additive / backward_compatible — no migration required since no prior consumers exist.
Safety Claim Matrix: PR declares N/A. Changed paths (docs/schemas/, docs/dev/agent-skill-boundaries.md, docs/dev/schema-governance.md) do not match safety-sensitive path patterns. No permission, sandbox, auth, MCP, or transport keywords in a safety-boundary context. N/A declaration is appropriate.
Scope: No out-of-scope modifications. Changes are strictly docs — schema definition, cross-link, and governance registration. Hook implementation is deferred to a future Issue as stated.
Blockers
- なし
Non-blockers
- なし
LOOP_VERDICT
LOOP_VERDICT:
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: d970ab8502a1502330a41d3a690a27d07bb40d62
follow_up_issue_requests: []
判定: REQUEST_CHANGESPR #314 は方向性は妥当ですが、現状では 「schema SSOT」ではなく、schema 風の Markdown 仕様書です。#243 の要求は「Main Loop 各 phase で GitHub Issue/PR コメントに残す metadata の SSOT 化」ですが、PR が追加しているのは Markdown の表と Blockers1. 「schema」と言いながら機械検証できない
修正方針: Markdown を説明書に降格し、SSOT は 2. トップレベル必須フィールド表と phase 別必須表が矛盾している新規 schema 文書は、トップレベル必須として これは consumer 実装時に致命的です。parser が「トップレベル必須」を信じるのか、「phase 別必須」を信じるのか決められません。 修正方針:
推奨のグローバル必須は次程度です。 required:
- schema
- manifest_id
- recorded_at
- repository
- actor
- phase
- redaction
3.
|
…ixtures / vitest テスト REQUEST_CHANGES 対応(iteration 1): - docs/schemas/agent-session-manifest.schema.json を新規追加(JSON Schema Draft 2020-12 SSOT) - manifest_id: asm-<UUIDv4> pattern, head_sha/commit_sha: 40-hex pattern or null - phase.ledger_phase: scalar enum(1 manifest = 1 ledger phase 原則) - evidence.visibility + if/then: public_github_comment 時に transcript/local_file 禁止 - hook_event / sanitization_status を optional fields として追加 - docs/schemas/agent-session-manifest.md を修正 - フィールド定義表をすべてのフィールド列挙(グローバル必須/非必須を明示) - phase 別必須表と JSON Schema の required を整合(グローバル必須最小化) - 1 manifest = 1 ledger phase 原則セクション追加、impl 2 manifest 方式を明記 - GitHub Comment テンプレートの外側 fence を 4 backticks に修正 - manifest_id 例を asm-<UUIDv4> 形式に統一 - docs/schemas/examples/ に valid(3) + invalid(5) fixtures を追加 - tests/agent-session-manifest.test.ts を新規追加(vitest 25 テスト、全 AC カバー) - docs/dev/schema-governance.md に schema_json / fixtures / test_file パスを追記 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
検証結果レポート — Issue #243AC 検証結果
総合判定
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: CLEAN
baseline_only: false
verification_commands_pass: 17
verification_commands_fail: 0 |
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
- AC coverage: 17/17 PASS。PR 本文の受け入れ条件達成状況表で全 AC が根拠付き
[x]で記録されており、TEST_VERDICT_MACHINE(17/17 PASS)と一致する - Allowed Paths: 完全遵守。変更ファイル 13 件(docs/schemas/agent-session-manifest.md、docs/schemas/agent-session-manifest.schema.json、docs/schemas/examples/*.yaml 8 件、tests/agent-session-manifest.test.ts、docs/dev/schema-governance.md、docs/dev/agent-skill-boundaries.md)はすべて Allowed Paths に含まれる
- CI Verification: build/lint/python-test/test/typecheck の全 5 チェックが pass。GitHub Actions 実行済み
- 検証コマンド結果: pnpm typecheck/lint/test(25/25)/build が全 PASS。PR 本文に各コマンドの結果が記録されている
前 iteration Blocker 7 件の確認
| Blocker | 確認結果 |
|---|---|
| B1: JSON Schema ファイル未存在 | PASS — docs/schemas/agent-session-manifest.schema.json が新規追加(JSON Schema Draft 2020-12、385 行) |
| B2: フィールド定義表の矛盾 | PASS — 「フィールド定義表」に全フィールド列挙、グローバル required を JSON Schema に寄せた |
| B3: ledger_phase scalar 原則 | PASS — Markdown に「1 manifest = 1 ledger phase 原則」セクションあり。impl の 2 manifest 方式が表で明記されている |
| B4: GitHub Comment fence 衝突 | PASS — 外側 fence が 4 backticks に修正済み(Markdown diff で ````markdown を確認) |
| B5: evidence.visibility + if/then 制約 | PASS — JSON Schema の evidence items に if/then が実装され、visibility: public_github_comment 時に source_kind: transcript/local_file を禁止する |
| B6: hook_event / sanitization_status | PASS — optional fields として Markdown および JSON Schema に追加済み |
| B7: manifest_id UUID パターン + 40-hex SHA | PASS — 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}$(正確な UUIDv4)、head_sha/commit_sha: ^[0-9a-f]{40}$(or null)が JSON Schema に定義されている |
Schema Consumer Inventory Gate
PR 本文に Schema Change Applicability(decision: schema_change)と Schema Consumer Inventory セクションが存在する。consumer 列挙コマンド(rg -l)の出力結果が PR 本文に含まれ、全 consumer が「更新済み」または「不要(理由付き)」と記録されている。Compatibility Decision は backward_compatible かつ migration_required: no。APPROVE 禁止条件に該当しない。
Safety Claim Matrix Gate
changed paths および diff キーワードに safety-sensitive 条件(transport/permission/sandbox/auth/mcp/tool/safe/execute 等)を含まない。PR 本文に "N/A — docs のみの変更" と明示されており妥当。Safety Claim Matrix の提出を要求しない。
Blockers
なし
Non-blockers
なし
LOOP_VERDICT
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: a19b892a366b685163c9c04a1a1da52f232e44a4
follow_up_issue_requests: []
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
- AC coverage: 17/17 PASS。PR 本文の受け入れ条件達成状況表で全 AC が根拠付き [x] で記録されており、TEST_VERDICT_MACHINE(17/17 PASS)と一致する
- Allowed Paths: 完全遵守。変更ファイル 13 件(docs/schemas/agent-session-manifest.md、docs/schemas/agent-session-manifest.schema.json、docs/schemas/examples/*.yaml 8 件、tests/agent-session-manifest.test.ts、docs/dev/schema-governance.md、docs/dev/agent-skill-boundaries.md)はすべて Allowed Paths に含まれる
- CI Verification: build/lint/python-test/test/typecheck の全 5 チェックが pass。GitHub Actions 実行済み
- 検証コマンド結果: pnpm typecheck/lint/test(25/25)/build が全 PASS。PR 本文に各コマンドの結果が記録されている
前 iteration Blocker 7 件の確認
| Blocker | 確認結果 |
|---|---|
| B1: JSON Schema ファイル未存在 | PASS — docs/schemas/agent-session-manifest.schema.json が新規追加(JSON Schema Draft 2020-12、385 行) |
| B2: フィールド定義表の矛盾 | PASS — 「フィールド定義表」に全フィールド列挙、グローバル required を JSON Schema に寄せた |
| B3: ledger_phase scalar 原則 | PASS — Markdown に「1 manifest = 1 ledger phase 原則」セクションあり。impl の 2 manifest 方式が表で明記されている |
| B4: GitHub Comment fence 衝突 | PASS — 外側 fence が 4 backticks に修正済み(Markdown diff で ````markdown を確認) |
| B5: evidence.visibility + if/then 制約 | PASS — JSON Schema の evidence items に if/then が実装され、visibility: public_github_comment 時に source_kind: transcript/local_file を禁止する |
| B6: hook_event / sanitization_status | PASS — optional fields として Markdown および JSON Schema に追加済み |
| B7: manifest_id UUID パターン + 40-hex SHA | PASS — manifest_id pattern: ^asm-UUIDv4$(正確な UUIDv4 regex)、head_sha/commit_sha: ^[0-9a-f]{40}$(or null)が JSON Schema に定義されている |
Schema Consumer Inventory Gate
PR 本文に Schema Change Applicability(decision: schema_change)と Schema Consumer Inventory セクションが存在する。consumer 列挙コマンド(rg -l)の出力結果が PR 本文に含まれ、全 consumer が「更新済み」または「不要(理由付き)」と記録されている。Compatibility Decision は backward_compatible かつ migration_required: no。APPROVE 禁止条件に該当しない。
Safety Claim Matrix Gate
changed paths および diff キーワードに safety-sensitive 条件(transport/permission/sandbox/auth/mcp/tool/safe/execute 等)を含まない。PR 本文に「N/A — docs のみの変更」と明示されており妥当。Safety Claim Matrix の提出を要求しない。
Blockers
なし
Non-blockers
なし
LOOP_VERDICT
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: a19b892a366b685163c9c04a1a1da52f232e44a4
follow_up_issue_requests: []B1 iter2: Producer actor type and evidence source kind subset enforcement - Add PRODUCER_ACTOR_TYPES = ['ai_agent', 'github_action'] - Add PRODUCER_EVIDENCE_SOURCE_KINDS = ['hook_jsonl', 'ci_check', 'artifact'] - Validate producer constraints before manifest generation, exit 1 on mismatch - Validator still accepts full schema enum (human, transcript, local_file, etc.) B2 iter2: --format json default fail-closed secret detection - Secret detection is now mandatory for all formats (was optional for json) - Add --allow-local-path flag to downgrade to warning (escape hatch) - Apply redaction scan to markdown output as well B3 iter2: Validator and producer contract responsibility separation - Split validation module into 3 functions: * validateManifestAgainstSchema() - Ajv 2020-12 schema only * validateManifestSemantics() - token_usage null, visibility constraints * validateProducerContractForIssue377() - producer subset + verification rules - generate-session-manifest.mjs calls all 3 - validate-agent-session-manifest.mjs calls first 2 only (no producer constraint) M1 iter2: Default validation for all formats - Schema + semantic validation runs by default (was only with --validate flag) - Add --no-validate flag as escape hatch to skip validation - format=github-comment still mandatory validates M2 iter2: Verification semantic rules + input structure - Add CLI flags: --verification-skipped-count, --verification-fallback-detected - Semantic rules: skipped_count > 0 with overall=pass → exit 1 (incoherent) - Semantic rules: fallback_detected=true with overall=pass → exit 1 (PR #314) M3 iter2: tests/temp cleanup and .gitignore - Remove committed temp files from git (git rm --cached) - Add tests/.gitignore to exclude temp/ directory - Tests use os.tmpdir() for runtime artifacts, fixtures in tests/fixtures/ Minor 1: Add --dry-run to help (no-op for script producer) Minor 2: Update extractor comment to document dynamic fence length per PR #314 All 54 tests pass: typecheck, lint, test, build all green. tests/temp files cleaned and gitignored. Co-Authored-By: Claude Haiku 4.5 (impl-review-loop) <[email protected]>
…producer (#404) * feat(#377): implement agent_session_manifest/v1 deterministic script producer Implement script-only producer (generate-session-manifest.mjs) that outputs JSON conforming to docs/schemas/agent-session-manifest.schema.json with actor.type + evidence[].source_kind provenance, strict null semantics for unavailable token_usage, and GitHub comment markdown fencing (4-backticks). - scripts/generate-session-manifest.mjs: CLI producer with --help, JSON/markdown output formats, secret pattern detection, validation support - scripts/validate-agent-session-manifest.mjs: Ajv 2020-12 schema validator wrapper (ajv@^8, ajv-formats@^3) - scripts/extract-agent-session-manifest-from-comment.mjs: fenced markdown extraction utility for roundtrip validation - tests/agent-session-manifest-producer.test.ts: vitest fixture tests: * AC3 (provenance via actor.type + evidence[].source_kind) * AC4 (token_usage null semantics, not 0 falsification) * AC5 (secret pattern rejection: raw_transcript, absolute paths, tokens) * AC6 (fenced markdown roundtrip with extract + revalidate) * AC7 (valid vs invalid fixture distinction) - package.json: ajv@^8 + ajv-formats@^3 devDependencies - eslint.config.mjs: Node.js script environment for .mjs files AC1-AC12 verified: all VC pass, pnpm typecheck/lint/test/build all PASS, schema unchanged (ref only), no Allowed Paths violations. Closes #377 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(#377): implement fix delta B1-B7 + M1-M2 for PR #404 Implements all required fixes from REQUEST_CHANGES review: B1: --validate implementation - generate-session-manifest.mjs now references validator from common module - validation + redaction scan mandatory for --format github-comment - explicit --validate flag runs schema + semantic validation before output B2: Ajv2020 correct configuration - validate-agent-session-manifest.mjs imports Ajv2020 from 'ajv/dist/2020.js' - strict: true, allErrors: true configuration - Keeps $schema field for Draft 2020-12 validation B3+B4: Common validation module - New: scripts/lib/agent-session-manifest-validation.mjs - Exports validateManifest(json) → {valid, errors[]} - Schema validation (Ajv2020) + semantic validation integrated - Semantic rules: token_usage unavailable semantics, visibility constraints B5: Redaction fail-closed for github-comment - detectSecretPatterns scan on manifest object - detectSecretsInMarkdown scan on final fenced output - --format github-comment fails if any secret patterns found (fail-closed) - --strict-redaction enforces redaction on all formats B6: Line-based extractor with fence length matching - extract-agent-session-manifest-from-comment.mjs rewritten - Line-by-line marker search (uniqueness validation) - Opening/closing fence length must match exactly - Producer calculates fence length from max consecutive backticks B7: Verification and human_intervention CLI flags - --verification-overall {pass|fail|partial|n_a} - --verification-ac-result AC=STATUS (repeatable) - --verification-evidence-ref REF (repeatable) - --human-intervention-required {true|false} - --human-intervention-reason TEXT M1: Issue/PR number validation - --issue / --pr must match ^[1-9][0-9]*$ pattern - Invalid input exits 1 with clear error message M2: Deterministic overrides - --manifest-id <fixed-uuid> overrides auto-generation - --recorded-at <iso8601> overrides timestamp - Help text documents non-deterministic fields Tests: Full CLI integration suite - Tests spawn actual CLI processes (execFileSync) - 43 test cases covering B1-B7 + M1-M2 - Validation, redaction, fence collision, roundtrip scenarios - All tests passing; pnpm lint/typecheck/build clean Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(#377): implement iter2 fix delta B1-B3 + M1-M3 + Minor B1 iter2: Producer actor type and evidence source kind subset enforcement - Add PRODUCER_ACTOR_TYPES = ['ai_agent', 'github_action'] - Add PRODUCER_EVIDENCE_SOURCE_KINDS = ['hook_jsonl', 'ci_check', 'artifact'] - Validate producer constraints before manifest generation, exit 1 on mismatch - Validator still accepts full schema enum (human, transcript, local_file, etc.) B2 iter2: --format json default fail-closed secret detection - Secret detection is now mandatory for all formats (was optional for json) - Add --allow-local-path flag to downgrade to warning (escape hatch) - Apply redaction scan to markdown output as well B3 iter2: Validator and producer contract responsibility separation - Split validation module into 3 functions: * validateManifestAgainstSchema() - Ajv 2020-12 schema only * validateManifestSemantics() - token_usage null, visibility constraints * validateProducerContractForIssue377() - producer subset + verification rules - generate-session-manifest.mjs calls all 3 - validate-agent-session-manifest.mjs calls first 2 only (no producer constraint) M1 iter2: Default validation for all formats - Schema + semantic validation runs by default (was only with --validate flag) - Add --no-validate flag as escape hatch to skip validation - format=github-comment still mandatory validates M2 iter2: Verification semantic rules + input structure - Add CLI flags: --verification-skipped-count, --verification-fallback-detected - Semantic rules: skipped_count > 0 with overall=pass → exit 1 (incoherent) - Semantic rules: fallback_detected=true with overall=pass → exit 1 (PR #314) M3 iter2: tests/temp cleanup and .gitignore - Remove committed temp files from git (git rm --cached) - Add tests/.gitignore to exclude temp/ directory - Tests use os.tmpdir() for runtime artifacts, fixtures in tests/fixtures/ Minor 1: Add --dry-run to help (no-op for script producer) Minor 2: Update extractor comment to document dynamic fence length per PR #314 All 54 tests pass: typecheck, lint, test, build all green. tests/temp files cleaned and gitignored. Co-Authored-By: Claude Haiku 4.5 (impl-review-loop) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
docs/schemas/agent-session-manifest.mdを修正(iteration 1 REQUEST_CHANGES 全 Blocker 対応)docs/schemas/agent-session-manifest.schema.jsonを新規追加(JSON Schema Draft 2020-12 SSOT)docs/schemas/examples/に valid(3) + invalid(5) fixtures を追加tests/agent-session-manifest.test.tsを新規追加(vitest 25 テスト)docs/dev/schema-governance.mdに schema_json / fixtures / test_file パスを追記Closes #243
iteration 1 対応内容(REQUEST_CHANGES 解消)
docs/schemas/agent-session-manifest.schema.json新規作成(JSON Schema Draft 2020-12)受け入れ条件の達成状況(AC1〜AC17)
rg "^schema_version: v1$"→ マッチ<!-- agent_session_manifest:v1 start -->+ 外側 4 backticksagent_session_manifest/v1エントリ存在unavailable を 0 と偽装しない明記検証コマンド結果
Allowed Paths 遵守
変更ファイル(Allowed Paths 内のみ):
docs/schemas/agent-session-manifest.md(修正)docs/schemas/agent-session-manifest.schema.json(新規)docs/schemas/examples/*.yaml(新規 8 files)tests/agent-session-manifest.test.ts(新規)docs/dev/schema-governance.md(追記)Allowed Paths 外の変更: なし
Checks
pnpm typecheck— PASSpnpm lint— PASSpnpm test— PASS (25/25 tests, 5 files)pnpm build— PASSSchema Change Applicability
schema_changeagent_session_manifest/v1が新規 JSON Schema(.schema.json)として追加されるSchema Consumer Inventory
変更対象 schema:
agent_session_manifest/v1(新規追加)before/after 差分:
docs/schemas/agent-session-manifest.schema.json(JSON Schema Draft 2020-12)Consumer 列挙:
Consumer 更新状況:
docs/schemas/agent-session-manifest.mddocs/dev/schema-governance.mddocs/dev/agent-skill-boundaries.mdtests/agent-session-manifest.test.tsCompatibility Decision
additivebackward_compatiblenoSafety Claim Matrix
N/A — docs のみの変更。runtime artifact なし。安全境界・権限・サンドボックス・auth に関わる変更なし。
SubAgent Execution Ledger
Notes