Repository navigation
Closed
Labels
area/ai-opsAI operations and agent tooling areaarea/securitySecurity areakind/implementationImplementation issue
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#242"
goal_ref: "agent_session_manifest/v1 schema・producer・validator・schema docs に explicit producer provenance object を追加し、#377 の actor/evidence workaround を optional producer field へ正規化できる状態にする"
change_kind: mixed
depends_on:
- "#377"
related_issues:
- "#378"
- "#402"
- "#245"
- "#314"
dedupe_key: "377-followup-schema-producer-field"
origin: "#377 refinement loop followup"Parent Issue
Parent Goal Ref
- Goal: agent_session_manifest/v1 の authoritative producer provenance を schema SSOT に昇格し、manual review note や actor/evidence の読み替えに依存しない形で保持する
- Desired Destination: 実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378 の validation gate と 実装: agent_session_manifest/v1 producer を .claude/settings.json hooks と .github/workflows で自動 invoke する #402 の hook/CI wiring が同一 producer field を前提に接続できる状態へ揃える
Current Validated Scope
docs/schemas/agent-session-manifest.schema.jsonに top-level optionalproducerobject を追加する- root
requiredにproducerを入れず、optional は JSON Schema 標準形で表現する producerobject にadditionalProperties: falseを付与し、kind必須・version|command|source_refnullable をoneOfで定義するproducer.kindは schema 層では deterministic producer class の self-claim として扱い、hook / CI / artifact 側の真正性担保は 実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378 / 実装: agent_session_manifest/v1 producer を .claude/settings.json hooks と .github/workflows で自動 invoke する #402 に委譲するdocs/schemas/agent-session-manifest.mdの field table / provenance 説明を schema に合わせて更新するscripts/generate-session-manifest.mjsとscripts/lib/agent-session-manifest-validation.mjsをproducer.kind|version|command|source_refに合わせて更新するtests/agent-session-manifest.test.tsの hand-written validator / stale Ajv 未導入コメントを、Ajv 2020-12 compile + validate 前提へ置き換えるtests/agent-session-manifest.test.tsとtests/agent-session-manifest-producer.test.tsに producer field の valid / omitted / invalid / unknown nested key case を追加するdocs/dev/onboarding/session-recording-tool.mdの producer authoritative note を schema enum と一致させる
Remaining Parent Gaps
- 実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378 は
pnpm manifest:check/ CI validation gate の issue として残る。本 Issue では validation gate wiring や.github/workflows/**を触らない - 実装: agent_session_manifest/v1 producer を .claude/settings.json hooks と .github/workflows で自動 invoke する #402 は
.claude/settings.jsonhooks と GitHub Actions 自動 invoke の issue として残る。本 Issue では hook/CI wiring を触らない -
human_attested_from_deterministic_evidenceはproducer.kindには入れず、authoritative-source guidance 側の human attestation として扱う。schema field へ昇格が必要なら別 follow-up Issue で扱う
Outcome
agent_session_manifest/v1 schema、manifest producer、共有 validator、schema docs が同じ optional producer object を扱い、生成 manifest は producer.kind に script_generated | hook_generated | github_action_generated を記録でき、producer を欠く既存 manifest も引き続き valid のまま、producer.kind 欠落・unknown enum・unknown nested key・unsanitized command/source_ref の失敗条件まで Ajv 2020-12 ベースのテストで固定されている状態。
In Scope
docs/schemas/agent-session-manifest.schema.jsondocs/schemas/agent-session-manifest.mdscripts/generate-session-manifest.mjsscripts/validate-agent-session-manifest.mjsscripts/lib/agent-session-manifest-validation.mjstests/agent-session-manifest.test.tstests/agent-session-manifest-producer.test.tsdocs/dev/onboarding/session-recording-tool.md
Out of Scope
.claude/settings.json/.claude/hooks/**/.github/workflows/**の hook / CI wiring(実装: agent_session_manifest/v1 producer を .claude/settings.json hooks と .github/workflows で自動 invoke する #402)pnpm manifest:checkや CI validation gate の追加・更新(実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378)script_generated | hook_generated | github_action_generated以外の producer kind を schema enum に追加すること- public/private artifact policy 自体の再設計
- Secret / token 発行や外部サービス設定
- Ajv の OS / system-wide 導入作業や管理者権限を要する環境セットアップ
Acceptance Criteria
- AC1:
docs/schemas/agent-session-manifest.schema.jsonの rootproperties.producerが存在し、rootrequired配列にはproducerが含まれていない - AC2:
producerschema はtype: objectかつadditionalProperties: falseを持ち、requiredは["kind"]のみである - AC3:
producer.kind.enumはscript_generated | hook_generated | github_action_generatedと完全一致し、human_attested_from_deterministic_evidenceは本 Issue では schema enum に含めない判断が docs と整合している - AC4:
producer.version/producer.command/producer.source_refは JSON Schema のoneOf: [{type:"string"},{type:"null"}]で定義され、疑似型文字列(例:string | null)を使わない - AC5:
producerを欠く既存 manifest は Ajv 2020-12 validation で valid のまま維持される - AC6:
producer.kind: "script_generated" | "hook_generated" | "github_action_generated"を持つ manifest は valid で、producer.kind: "unknown_source"は invalid になる - AC7:
producerに未知 nested property を入れた manifest、およびproducer.kindを欠く manifest は invalid になる - AC8:
scripts/generate-session-manifest.mjsの生成 output は producer provenance をproducerobject で出力し、scripts/lib/agent-session-manifest-validation.mjs/scripts/validate-agent-session-manifest.mjsの validation と整合している - AC9:
producer.command/producer.source_refの説明と validation は、secret・展開済み env 値・unsafe な absolute local path を public surface 向け producer metadata に含めない境界を明示している - AC10:
producer.kindは schema 追加だけで真正性を証明するものではなく、self-claim であることと evidence linkage / hook / CI wiring は 実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378 / 実装: agent_session_manifest/v1 producer を .claude/settings.json hooks と .github/workflows で自動 invoke する #402 側の責務であることが本文または docs に明記されている - AC11:
tests/agent-session-manifest.test.tsは hand-written validator 前提ではなく Ajv 2020-12 compile + validate を使う形に更新され、冒頭コメントも現行 devDependencies と整合している - AC12:
tests/agent-session-manifest.test.tsとtests/agent-session-manifest-producer.test.tsが valid producer / omitted producer / invalid producer.kind / unknown nested key / missing kind をカバーし、両 test suite が pass する - AC13:
docs/schemas/agent-session-manifest.mdとdocs/dev/onboarding/session-recording-tool.mdにproducerfield の説明が追加され、producer.kindの 3 enum とhuman_attested_from_deterministic_evidenceを schema enum 外に置く判断が明記されている - AC14: implementation 完了後の
pnpm typecheck、pnpm lint、pnpm test、pnpm build実行は test-runner phase で実施し、本 Issue の差分はその quality-gate 再実行対象として維持されている
Verification Commands
# AC1: root required に producer が含まれない
$ jq -e '(.required | index("producer")) == null and .properties.producer.type == "object"' docs/schemas/agent-session-manifest.schema.json
# AC2: producer object shape と additionalProperties: false / required:["kind"] を確認
$ jq -e '.properties.producer.type == "object" and .properties.producer.additionalProperties == false and .properties.producer.required == ["kind"]' docs/schemas/agent-session-manifest.schema.json
# AC3: producer.kind enum が 3 値と完全一致する
$ jq -e '.properties.producer.properties.kind.enum == ["script_generated","hook_generated","github_action_generated"]' docs/schemas/agent-session-manifest.schema.json
# AC4: nullable fields が oneOf[string,null] で定義されている
$ jq -e '.properties.producer.properties.version.oneOf == [{"type":"string"},{"type":"null"}] and .properties.producer.properties.command.oneOf == [{"type":"string"},{"type":"null"}] and .properties.producer.properties.source_ref.oneOf == [{"type":"string"},{"type":"null"}]' docs/schemas/agent-session-manifest.schema.json
# AC5: omitted producer を Ajv 2020-12 validation で許可する test case が追加されている
$ rg -n "omitted producer remains valid|without producer field remains valid" tests/agent-session-manifest.test.ts tests/agent-session-manifest-producer.test.ts
# AC6: valid / invalid producer.kind を固定する test case が追加されている
$ rg -n "valid producer kind|invalid producer kind|unknown_source" tests/agent-session-manifest.test.ts tests/agent-session-manifest-producer.test.ts
# AC7: unknown nested key と missing kind を固定する test case が追加されている
$ rg -n "unknown nested producer property|missing producer\\.kind" tests/agent-session-manifest.test.ts tests/agent-session-manifest-producer.test.ts
# AC8: generator / validator が producer object を扱う実装になっている
$ rg -n "producer:\\s*\\{|manifest\\.producer|producer\\.kind" scripts/generate-session-manifest.mjs scripts/validate-agent-session-manifest.mjs scripts/lib/agent-session-manifest-validation.mjs
# AC9: validator / producer 実装に producer command/source_ref 境界が反映されている
$ rg -n "Sanitized invocation command or null\\. MUST NOT contain secrets|unsafe local paths intended for public surfaces|expanded env values" docs/schemas/agent-session-manifest.schema.json docs/schemas/agent-session-manifest.md
# AC10: producer.kind が self-claim であり真正性担保は #378 / #402 に委譲されることを確認する
$ rg -n "self-claim|真正性|#378|#402|evidence linkage|hook / CI" docs/schemas/agent-session-manifest.md docs/dev/onboarding/session-recording-tool.md
# AC11: schema test が Ajv 2020-12 compile + validate 前提へ更新されている
$ rg -n "Ajv2020|ajv-formats|validateManifestAgainstSchema|compile\\(" tests/agent-session-manifest.test.ts
# AC12: schema / producer tests が producer cases をカバーする
$ rg -n "omitted producer remains valid|valid producer kind manifest is accepted|invalid producer kind manifest is rejected|unknown nested producer property is rejected|missing producer\\.kind is rejected" tests/agent-session-manifest.test.ts tests/agent-session-manifest-producer.test.ts
# AC13: docs enum と human attestation の境界が schema と整合している
$ rg -n "## Producer Provenance|producer.kind is a self-claim|human_attested_from_deterministic_evidence remains outside the schema enum" docs/schemas/agent-session-manifest.md docs/dev/onboarding/session-recording-tool.md
# AC14: quality-gate rerun note が追加され、test-runner phase で pnpm gate を再実行する前提が明記されている
$ rg -n "quality-gate rerun is executed in test-runner phase" docs/schemas/agent-session-manifest.mdAllowed Paths
docs/schemas/agent-session-manifest.schema.jsondocs/schemas/agent-session-manifest.mdscripts/generate-session-manifest.mjsscripts/validate-agent-session-manifest.mjsscripts/lib/agent-session-manifest-validation.mjstests/agent-session-manifest.test.tstests/agent-session-manifest-producer.test.tsdocs/dev/onboarding/session-recording-tool.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
agent_session_manifest/v1の既存必須 field や unrelated enum を変更しないと進められないと判明した場合- 新規 follow-up Issue の起票が必要と判明した場合
- 実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378 または 実装: agent_session_manifest/v1 producer を .claude/settings.json hooks と .github/workflows で自動 invoke する #402 の scope を同一 PR に取り込まないと完了できないと判明した場合
human_attested_from_deterministic_evidenceをproducer.kindenum に含めないと docs: AI agent session 記録ツールの人間導入手順サジェスト (tool-onboarding/session-recording.md) #245 / onboarding docs と整合しないと判明した場合- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・Secret 設定・既存テストの大規模改変が必要になった場合
Runtime Verification Applicability
decision: not_applicable
rationale: schema / docs / producer / validator / test の整合は静的検証と決定論的 test 実行で完結し、Main Loop 実行環境や GitHub runtime に依存する動作検証を含まない
Related
- Parent: docs: session 記録 Kill Switch policy と検証コマンド整備 (session-recording-policy.md) #242
- Predecessor: 実装: agent_session_manifest/v1 deterministic script producer を schema conform で実装する #377
- Sibling: 実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378
- Sibling: 実装: agent_session_manifest/v1 producer を .claude/settings.json hooks と .github/workflows で自動 invoke する #402
- Context: docs: AI agent session 記録ツールの人間導入手順サジェスト (tool-onboarding/session-recording.md) #245
- Schema baseline: docs(#243): agent_session_manifest/v1 schema SSOT 定義と Main Loop phase 別記録運用確定 #314
Source
source: refinement_loop_followup
origin_issue: "#377"
anchor_comment_url: "https://github.com/squne121/loop-protocol/issues/377#issuecomment-4534484681"
dedupe_key: "377-followup-schema-producer-field"
refinement_revision:
revised_at: "2026-05-26"
revised_by: "issue-refinement-loop"
summary: "issue_kind v1 contract を補完し、schema 追加に伴う producer/validator/docs/test 同期範囲を明示。#378 と #402 の wiring/gate scope を Out of Scope に切り分け、docs の producer authoritative note まで Allowed Paths に含めた"
latest_comment_reflected_at: "2026-05-26"
latest_comment_summary: "JSON Schema optionality/additionalProperties/nullability/Ajv drift/secret boundary 指摘を反映し、Ajv 導入済み前提の schema-test 修正 issue として tighten"
anchor_comment_urls:
- "https://github.com/squne121/loop-protocol/issues/401#issuecomment-4537830677"
- "https://github.com/squne121/loop-protocol/issues/401#issuecomment-4537855126"
anchor_comment_summary: "required:false 回避、nested additionalProperties:false、Ajv 実検証化、Ajv は既存 devDependency であり OS 管理者権限トピックではない点、producer.kind self-claim と真正性委譲を反映"Required Skills
なし
Metadata
Metadata
Assignees
Labels
area/ai-opsAI operations and agent tooling areaarea/securitySecurity areakind/implementationImplementation issue
Activity
squne121 commentedon May 25, 2026
issue-refinement-loop により本文を更新しました。
contract_schema_version/issue_kind/goal_ref/change_kindを補完し、implementation issue として checker が読める contract に正規化producerfield の同期範囲をschema + producer + shared validator + tests + docsまで明示docs/dev/onboarding/session-recording-tool.mdの producer authoritative note まで Allowed Paths に含め、schema enum と docs の不整合を残さない構成へ修正check_issue_contract.py --file tmp/issue_401_refined.md --jsonはverdict: approve、guard-issue-body.pyもall_passed: true補足:
squne121 commentedon May 25, 2026
判定: REQUEST_CHANGES
#401 は必要な Issue です。#377/PR #404 で deterministic script producer は merge 済みで、schema 側に producer provenance を追加する依存条件は解消されています。#377 は schema 本体を変更せず actor.type + evidence[].source_kind で producer provenance を間接表現する設計に縮小され、PR #404 でも schema producer field は follow-up に deferred されています。
ただし #401 はこのまま実装すると、JSON Schema の表現、Ajv 検証、既存 policy との enum 整合、secret exposure 境界のいずれかで穴が残ります。特に「optional」「required:false」「string|null」「Ajv compile」の扱いが曖昧です。
Blocker
B1. required: false は JSON Schema の書き方として危険
#401 の AC1 は「top-level producer property with type object and required: false」と書いていますが、JSON Schema では通常、optional は root の required 配列に含めないことで表現します。required: false という property-level keyword を置く実装に誘導すると、Ajv strict mode では schema compilation error か、意図しない無効 keyword になります。JSON Schema の properties は定義された property を検証するだけで、未列挙 property は additionalProperties 側で扱われます。
修正案:
{
"required": ["schema", "manifest_id", "recorded_at", "repository", "actor", "phase", "redaction"],
"properties": {
"producer": {
"type": "object",
"required": ["kind"],
"additionalProperties": false
}
}
}
B2. producer object に additionalProperties: false が必須
現行 schema は root で additionalProperties: false を採用しています。これは PR #314 の SSOT 設計で、未定義 top-level property を拒否するためです。 現在の main schema でも root は additionalProperties: false です。
同じ思想を producer object に適用しないと、以下が通ります。
"producer": {
"kind": "script_generated",
"secret_dump": "...",
"raw_command_env": "OPENAI_API_KEY=..."
}
#401 の AC には「producer.additionalProperties: false」がありません。これは blocker です。
B3. string | null を schema にそのまま書かせる余地がある
#401 は version: string | null, command: string | null, source_ref: string | null と書いています。既存 schema は nullable を oneOf: [{type:"string"}, {type:"null"}] で表現しています。
実装契約として、以下のように明示すべきです。
"version": {
"oneOf": [{ "type": "string" }, { "type": "null" }]
}
type: "string | null" のような疑似型表現を schema に混入させないこと。
B4. #245 の authoritative producer 定義と enum がズレている
#245 は authoritative producers として hook_generated, script_generated, github_action_generated, human_attested_from_deterministic_evidence を定義し、ai_suggested_manifest を non-authoritative としています。
一方 #401 は enum を script_generated, hook_generated, github_action_generated の 3 値に限定しています。これは設計判断としてはあり得ますが、その場合は #401 に次のどちらかを明記すべきです。
producer.kind は「機械的 producer のみ」を表し、human_attested_from_deterministic_evidence は別フィールドまたは human_intervention 側で表す。
docs: AI agent session 記録ツールの人間導入手順サジェスト (tool-onboarding/session-recording.md) #245 に合わせて enum に human_attested_from_deterministic_evidence を追加する。
現状のままだと、#245 と #401 の SSOT が分岐します。
B5. tests/agent-session-manifest.test.ts は Ajv test ではない
#401 は tests/agent-session-manifest.test.ts を拡張して Ajv validation を確認するとしています。しかし現在の同テストは「ajv / zod は未インストールのため、主要制約を TypeScript で直接検証する」と明記し、hand-written validator を使っています。
PR #404 で Ajv 2020-12 validator wrapper と producer integration tests は追加済みです。 したがって #401 は、agent-session-manifest.test.ts を 本物の Ajv 2020-12 compile + validate test に置き換えるか、少なくとも schema test 部分だけ Ajv を使う必要があります。Ajv 公式 docs でも Draft 2020-12 は専用 Ajv class が必要で、旧 draft と同一 instance で混在できないとされています。
B6. 既存 test は schema drift を既に見逃している
現在の valid fixture には sanitization_status: 'clean' が含まれています。 しかし schema 側の sanitization_status enum は not_sanitized, sanitized, sanitization_failed で、clean は redaction.secret_scan_status の値です。
これは hand-written validator が schema と一致していない実例です。#401 は「producer を足す」だけでなく、schema test を Ajv に寄せる修正を必須化すべきです。そうしないと producer でも同じ drift が起きます。
Major Risk
M1. producer.command / producer.source_ref が secret leak surface になる
#401 は command と source_ref を optional にしていますが、ここは secret / local path / workflow artifact URL / CI run URL が入りやすいフィールドです。GitHub secret scanning は git history だけでなく、issues、pull requests、discussions、wikis などもスキャン対象にします。
したがって #401 の AC に以下を足すべきです。
producer.command は sanitized command のみ。
env var 展開値、token、absolute local path を入れない。
public GitHub comment に出す manifest では producer.command / producer.source_ref も redaction scan 対象。
secret-like pattern が検出されたら validation error または producer output fail。
M2. npx ajv compile -s ... は repo 再現性が低い
#401 の VC は npx ajv compile -s docs/schemas/... ですが、PR #404 で追加されたのは ajv / ajv-formats ライブラリであり、ajv-cli ではありません。
ネットワークに依存した npx は CI / local / sandbox で挙動がぶれます。既に scripts/validate-agent-session-manifest.mjs が存在するため、VC はこれを使うべきです。
node scripts/validate-agent-session-manifest.mjs /tmp/valid-producer.json
Ajv strict mode は未知 keyword や曖昧 schema を早期に落とすため、schema test 側でも strict: true を維持すべきです。
M3. hook / CI producer の意味が schema だけでは保証されない
Claude Code hooks は .claude/settings.json などに設定され、PostToolUse, Stop, SubagentStop などの lifecycle point で shell command 等を実行します。 GitHub Actions artifacts は workflow 後のデータ保存や job 間共有に使えます。
つまり producer.kind: hook_generated や github_action_generated は、schema に enum を足しただけでは真正性を保証しません。#401 は schema-only issue でよいですが、説明には「kind は self-claim であり、真正性は後続の hook/CI wiring と evidence linkage で担保する」と明記すべきです。
推奨 schema 形
最小修正はこれです。
"producer": {
"type": "object",
"required": ["kind"],
"additionalProperties": false,
"description": "Manifest producer provenance. This field is optional for backward compatibility. If present, kind is required.",
"properties": {
"kind": {
"type": "string",
"enum": [
"script_generated",
"hook_generated",
"github_action_generated"
],
"description": "Deterministic producer class. AI self-report is not authoritative."
},
"version": {
"oneOf": [{ "type": "string" }, { "type": "null" }],
"description": "Producer implementation version, if known."
},
"command": {
"oneOf": [{ "type": "string" }, { "type": "null" }],
"description": "Sanitized invocation command or null. MUST NOT contain secrets, expanded env values, or unsafe local paths intended for public surfaces."
},
"source_ref": {
"oneOf": [{ "type": "string" }, { "type": "null" }],
"description": "Git ref, PR, workflow run, artifact reference, hook id, or null."
}
}
}
human_attested_from_deterministic_evidence を含めるかは、#401 内で明示判断してください。含めるなら current validator の actor.type === human rejection と衝突し得ます。現行 validation module は producer actor を ai_agent / github_action に制限しています。
AC 修正案
#401 の AC は以下に差し替えるのが安全です。
AC1: root properties.producer が存在し、root required には producer が含まれない。
AC2: producer.additionalProperties === false。
AC3: producer.required === ["kind"]。
AC4: producer.kind.enum は SSOT で決めた producer kind set と完全一致する。
AC5: producer なしの既存 manifest が Ajv 2020-12 で valid。
AC6: producer.kind = script_generated|hook_generated|github_action_generated の manifest が valid。
AC7: producer.kind = unknown_source が invalid。
AC8: producer に未知 nested property を入れると invalid。
AC9: producer はあるが kind がない場合 invalid。
AC10: version, command, source_ref は string/null の両方を valid とする。
AC11: tests/agent-session-manifest.test.ts は hand-written validator ではなく Ajv 2020-12 による compile/validate を含む。
AC12: docs/dev/session-recording-policy.md と #245 の authoritative producer 定義との差分を明示的に解消する。
結論
#401 は実施すべきですが、現状の Issue 本文では 「producer enum を schema に足す」作業としては不十分です。特に additionalProperties:false、Ajv 化、#245 との enum 整合、command/source_ref の secret 境界を入れないと、後続の hook/CI wiring 時に再度 schema drift が発生します。
推奨は REQUEST_CHANGES。先に #401 の契約を上記 AC に直してから実装に回すべきです。
squne121 commentedon May 25, 2026
結論:開発環境への Ajv 導入に OS 管理者権限は通常不要です。
必要なのは、原則として リポジトリに package.json / lockfile を変更して push できる権限 と、開発環境で pnpm install / pnpm add -D ... を実行できる通常ユーザー権限です。
ただし、いま main の package.json を見る限り、すでに devDependencies に ajv と ajv-formats が入っています。したがって #401 で問題にすべきなのは「Ajv の新規導入権限」ではなく、tests/agent-session-manifest.test.ts のコメントと実装が古い hand-written validator 前提のまま残っていることです。package.json では ajv: ^8 / ajv-formats: ^3 が devDependencies に存在します。 一方、当該テストファイル冒頭には「ajv / zod は未インストールのため、スキーマの主要制約を TypeScript で直接検証する」と明記されています。
必要な権限
通常は管理者権限不要です。
必要なのは以下です。
リポジトリ作業ツリーへの書き込み権限
pnpm install / pnpm test を実行できる通常ユーザー権限
依存を追加・更新する場合は package.json と pnpm-lock.yaml を変更できる権限
npm registry へアクセスできるネットワーク環境
pnpm add -D は devDependencies に保存する公式の操作です。pnpm 公式ドキュメントでも pnpm add -D sax は devDependencies に保存すると説明されています。
必要になるのは Ajv 自体ではなく、周辺ツールの未整備時です。
Node.js / pnpm が未導入で、システム領域にインストールする場合
/usr/local/bin など root 所有ディレクトリにグローバルバイナリを置く場合
社内端末・WSL・プロキシ環境でパッケージ取得が制限されている場合
ただし、既にこのリポジトリは pnpm 前提の scripts を持っており、test / typecheck / lint / build が package.json に定義されています。 そのため通常は、管理者に「Ajv を入れてください」と依頼する話ではなく、実装担当にテストを Ajv 実検証へ寄せるよう指示する話です。
#401 での扱い
#401 のスコープには tests/agent-session-manifest.test.ts と tests/agent-session-manifest-producer.test.ts の producer valid / omitted / invalid case 追加が含まれています。 また、AC4 でも両 test suite が producer の valid / omitted / invalid をカバーして pass することが要求されています。
したがって、#401 の実装指示はこうするのが妥当です。
package.json 上は ajv / ajv-formats が devDependencies に存在するため、
tests/agent-session-manifest.test.ts の「ajv / zod は未インストール」コメントは現状と不整合。
#401 では hand-written validator の producer.kind 追加だけで済ませず、
docs/schemas/agent-session-manifest.schema.json を Ajv で実際に compile / validate するテストへ寄せること。
ただし、依存追加が必要かは実装前に package.json / pnpm-lock.yaml を確認する。
未導入の場合のみ pnpm add -D ajv ajv-formats を行い、package.json と lockfile を同一 PR に含める。
OS 管理者権限、Secret 発行、外部サービス設定、GitHub Actions 権限昇格は不要。
開発運用設計書への横展開
限定的に必要です。全面的な運用設計書改訂までは不要です。
#401 自体の In Scope には docs/schemas/agent-session-manifest.md と docs/dev/onboarding/session-recording-tool.md が含まれています。 AC5 でも schema docs / onboarding docs の producer field 名・enum 値・説明を schema と一致させることが要求されています。 つまり、少なくともこの 2 文書には横展開が必要です。
一方で、#401 は .github/workflows/**、hook / CI wiring、pnpm manifest:check、Secret / token 発行、外部サービス設定を明示的に Out of Scope にしています。 そのため、開発運用設計書全体に「Ajv 導入手順」を大きく追加するより、次の粒度が適切です。
docs/schemas/agent-session-manifest.md
producer.kind の enum を schema と一致させる
schema validation は Ajv ベースで固定する、と明記する
docs/dev/onboarding/session-recording-tool.md
producer provenance の authoritative source が producer object であることを明記する
script_generated | hook_generated | github_action_generated を運用上の正式値として記載する
追加で必要なら follow-up Issue
pnpm manifest:check や CI validation gate は #378 側
hook / GitHub Actions 自動 invoke は #402 側
#401 に混ぜない
判断
#401 へのコメント案としては、以下がよいです。
本件は OS 管理者権限や Secret 設定を要する「ツール導入」ではなく、リポジトリ内 devDependency / test 実装の整合問題として扱うべきです。
現状 package.json には ajv / ajv-formats が devDependencies として存在するため、tests/agent-session-manifest.test.ts 冒頭の「ajv / zod は未インストール」は stale comment です。#401 では hand-written validator に producer.kind enum を足すだけでなく、docs/schemas/agent-session-manifest.schema.json を Ajv で compile / validate するテストへ寄せ、コメントも更新してください。
必要な権限は通常のリポジトリ write 権限のみです。OS 管理者権限、外部サービス設定、Secret 発行、GitHub Actions 権限昇格は不要です。未導入環境では
pnpm install、依存が本当に不足している場合のみpnpm add -D ajv ajv-formatsで足してください。横展開は #401 In Scope の docs/schemas/agent-session-manifest.md と docs/dev/onboarding/session-recording-tool.md に限定し、pnpm manifest:check / CI gate は #378、hook / workflow wiring は #402 に分離してください。
squne121 commentedon May 25, 2026
issue-refinement-loop で最新 comments の blocker を本文へ反映しました。
producerはrequired: falseではなく「root required に入れない optional」で表現するよう明記producerobject にadditionalProperties: falseとrequired: ["kind"]を要求version/command/source_refはoneOf[string,null]を要求し、string | nullの疑似型表現を禁止tests/agent-session-manifest.test.tsの stale な「Ajv 未導入」前提を解消し、Ajv 2020-12 compile + validate ベースへ寄せる AC を追加human_attested_from_deterministic_evidenceは本 Issue ではproducer.kindenum に入れず、guidance/docs 側の human attestation として扱う境界を明記producer.command/producer.source_refの secret / expanded env / unsafe local path 境界を AC に追加ローカル検証:
uv run python3 .claude/skills/review-issue/scripts/check_issue_contract.py --file tmp/issue_401_refined.md --json→verdict: approveuv run python3 .claude/skills/edit-issue/scripts/guard-issue-body.py tmp/issue_401_refined.md --orig-file tmp/issue_401_backup_1779746484.md --issue-kind implementation --format yaml→all_passed: truesqune121 commentedon May 25, 2026
issue-refinement-loop で、指定された anchor comments
#issuecomment-4537830677#issuecomment-4537855126を基準に本文を追補しました。
反映内容:
producer.kindは schema 層では deterministic producer class の self-claim であり、真正性は 実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378 / 実装: agent_session_manifest/v1 producer を .claude/settings.json hooks と .github/workflows で自動 invoke する #402 の evidence linkage / hook / CI wiring 側で担保することを明記anchor_comment_urlsと要約を Source metadata に追加し、今回の refinement の根拠 comment を固定package.json/pnpm-lock.yaml上で既に devDependency として存在する前提で、Issue を「Ajv 新規導入」ではなく「schema/test/docs drift 修正」の契約として維持ローカル検証:
uv run python3 .claude/skills/review-issue/scripts/check_issue_contract.py --file tmp/issue_401_refined.md --json→verdict: approveuv run python3 .claude/skills/edit-issue/scripts/guard-issue-body.py tmp/issue_401_refined.md --orig-file tmp/issue_401_backup_1779750942.md --issue-kind implementation --format yaml→all_passed: truefix(#401): enforce producer provenance validation
fix(#401): require linked producer evidence
feat(#401): add producer provenance object to manifest schema (#409)