Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "agent-retrospective evaluator を canonical candidate builder ではなく judgment producer に再設計し、identity/evaluation history/evidence の deterministic 部分を Python 側が 100% 決定論的に組み立てることで、非空 finding が candidate_schema_invalid で失敗しない状態にする"
change_kind: codeParent Issue
なし(単独改善。関連 Issue として #2192・#2240・#2288・#2289・#2301・#2358 を参照)
Parent Goal Ref
- Goal: agent-retrospective evaluator が生成する finding を canonical candidate schema(
agent_improvement_candidate_v1.schema.json)に適合させ、observer 側 identity binding(fix: run_retrospective.py に identity-binding helper を追加し caller-supplied prompt の observer_run_id_mismatch を解消 #2358)と対になる evaluator 側 identity 決定論化を完成させる - Desired Destination:
retrospective-evaluatoragent を「judgment のみを返す producer」に再設計し、run_retrospective.pyのrun_evaluation()が deterministic な identity/evaluation-history/evidence assembly を 100% 担う
Scope Reframe(本 Issue の改訂理由・#2367 review 経由の human decision に基づく)
本 Issue は当初、.claude/agents/retrospective-evaluator.md(evaluator prompt)を Out of Scope とし、「evaluator が完成 canonical candidate 相当の出力を要求され続けても enrichment 側の無条件上書きで無害化する」という前提で設計された。
PR #2367 の実装・OWNER レビュー・fix_delta を通じて、この前提が成立しないことが実証された:
- OWNER レビュー(https://github.com/squne121/loop-protocol/pull/2367#issuecomment-5451104673)が、旧実装の
_fallback_evaluation_entry()等が「bookkeeping の補完」ではなく「finding の判定・履歴・証拠の捏造」になっていることを specific code citation で指摘(P0: validindeterminateevaluation がclassified/newに意味論的に反転される、P0: 実在しない runtime receipt を参照する evidence の捏造、P1:subject_ref/rule_idがcandidate_idに退化)。 - fix_delta で該当する捏造コードを完全削除し fail-closed(
candidate_schema_invalid)にしたところ、AC3 の live CLI 検証が決定論的に失敗することが実測で判明した(3 回連続再現)。原因は、frozenretrospective-evaluator.mdprompt が実行のたびに canonical shape とは全く異なる vocabulary(subject_path/defect_pattern、verdict/severity_assessed等)を生成するためであり、かつ evaluator 呼び出しに渡される wire schema(evaluation_result_v1.schema.json)のcandidate_records[].itemsが{"type": "object"}のみで実質無拘束であることが根本原因と確認された。 - 「捏造しない」(OWNER 必須要件)と「frozen evaluator prompt に対して AC3 が PASS する」は、evaluator prompt/wire schema を変更しない限り両立不可能であることが、独立した 4 系統の調査(Issue/PR/関連Issue 監査、evaluator wire-contract 監査、実装 diff 監査、architecture 比較の 4 SubAgent、うち architecture 比較では Claude Code Agent SDK の
--json-schemaが「渡された schema に対する validate + re-prompt + retry-limit fail-closed」であり、渡す schema が緩ければこの機構が効かないことを公式ドキュメント一次資料で確認)で確認された。
Repository owner はこれを踏まえ、retrospective-evaluator.md の Out of Scope 制約を撤回し、本 Issue / PR #2367 内で end-to-end contract を完成させることを承認した。ADR は不要と判断(既存 Issue の contract reframe として処理)。
Current Validated Scope
.claude/skills/agent-retrospective/scripts/run_retrospective.pyのrun_evaluation()・EvaluatorRequest・Evaluation.from_wire()/Evaluation._post_validate()/_validate_candidate_records()(canonical candidate validation)・_enrich_candidate_record()(deterministic enrichment)周辺.claude/skills/agent-retrospective/scripts/schemas/evaluation_result_v1.schema.json(evaluator 呼び出し時に--json-schemaとして渡される wire schema。draft-07。現状candidate_records[].itemsは{"type": "object"}のみで無拘束).claude/agents/retrospective-evaluator.md(evaluator の system prompt / frontmatter。tools: []を維持したまま、出力 shape の instruction のみを改訂する)run_retrospective.pyの_validate_retrospective_schema_module()(sibling module loader)経由でのcompute_finding_identity()呼び出し(--state-backend fixtureを使った実 CLI 実行を含む)- 上記に対応する
.claude/skills/agent-retrospective/scripts/tests/配下のテスト
Remaining Parent Gaps
- なし(本 Issue で evaluator 側 identity 決定論化・judgment/deterministic 分離を完結させる)
Outcome
retrospective-evaluator agent を「canonical candidate builder」から「judgment producer」に再設計する。責務分離は以下の通り:
observer projections
↓
retrospective-evaluator(schema-constrained judgment-only output)
↓
deterministic enrichment / canonical assembly(100% Python)
↓
canonical validate_candidate()
↓
PublishRequest
evaluator が authority を持つフィールド(judgment-only wire contract)
evaluator の構造化出力(--json-schema で拘束)は、各 candidate record について以下のみを要求する:
candidate_id(lifecycle 識別子。evaluator が生成してよいが Python が形式検証する)title,descriptionclaim_classsubject_ref(kind/value。canonical schema の discriminated union・pattern 制約と同一の制約を wire schema 側にも実装する。draft-07 で自前 author する。$ref で canonical schema を跨いで参照しない — canonical schema は draft 2020-12 であり Agent SDK の--json-schemaは draft-07 のみ受理する)rule_id(namespaced dot-separated token。pattern^[a-z0-9_]+(\.[a-z0-9_]+)*$を wire schema 側にも実装する)evidence_refs[]のうち、evaluator が実際に observer 出力から参照できる部分(ref_type・source_id等、実在する observer evidence を指す情報)。projection_digestは evaluator に要求しない(下記参照)- 意味判断として真に evaluator-authoritative な最小限の evaluation judgment フィールド(後述の Authority Matrix 参照。
evaluation_status/presence_delta/delta_status/indeterminate_reason/previous_evaluation_refは要求しない — Python がcompute_delta()/PreviousStateProviderから 100% 決定論的に構築する)
evaluator には identity.key/identity.value/repository_id/source_run_ref/created_at/updated_at/evaluations[](history 全体)を一切要求しない。プロンプトの placeholder({"...": "..."} 等)を撤去し、要求するフィールドのみを具体例付きで明示する。
Python が 100% 決定論的に構築するフィールド
identity.key(repository_id・evaluator judgment のclaim_class/subject_ref/rule_idから構築。不正なsubject_ref/rule_idは合成せずcandidate_schema_invalidとして fail-closed のまま維持する — PR feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 fix_delta items 1-6 の fail-closed 方針をそのまま維持する)identity.value(compute_finding_identity()を sibling module loader 経由で呼び出す。既存実装のまま変更しない)source_run_ref・created_at・updated_at(既存実装のまま変更しない)evaluations[](evaluator の wire payload から一切パースしない。compute_delta()/PreviousStateProviderの出力から Python が直接構築する。validindeterminateentry(delta_status不在)・validclassifiedentry・複数 entry の history chain のいずれも、evaluator 出力に依存せず正しく構築・保存される)evidence_refs[].projection_digest(evaluator が参照した実在する evidence(observer 出力に含まれる実データ)から Python が再計算する。実データが利用不能な場合は digest を捏造せず、該当 evidence entry を含めない、または candidate 全体をcandidate_schema_invalidとして fail させる。壊れた文字列のrepr()をハッシュ化するような偽装は禁止のまま維持する)
evaluator が誤って identity/evaluations/repository_id 等を出力に含めても、wire schema の additionalProperties: false(または同等の拒否)で構造的に弾かれるか、Python enrichment 側で無視される(無条件上書きではなく、そもそも wire contract に存在しないフィールドとして扱う)。
Identity/Deterministic Field Authority Matrix(改訂版)
| Field | Authority |
|---|---|
candidate_id |
evaluator が生成(lifecycle 識別子。Python は形式検証のみ) |
title, description |
evaluator judgment |
claim_class |
evaluator judgment |
subject_ref, rule_id |
evaluator judgment(不正値は fail-closed。Python は合成しない) |
repository_id |
run_cli() / execute_run() caller context(EvaluatorRequest には追加しない) |
source_run_ref.base_sha |
RunContext.base_sha |
source_run_ref.source_set_digest |
authoritative evaluator request / plan |
identity.algorithm |
canonical validator 定数(sha256-jcs-v1) |
identity.value |
compute_finding_identity()(canonical SSOT)の算出結果 |
created_at, updated_at |
injected run timestamp |
evaluations[].evaluation_id, classified_at, classifier_version |
Python 決定論的生成(evaluator 出力から取得しない) |
evaluations[].evaluated_run_ref |
source_run_ref と同一の Python-authoritative context |
evaluations[].previous_evaluation_ref |
Python が history chain から決定論的に構築(compute_delta() の出力) |
evaluations[].observed, source_coverage, evaluation_status, presence_delta, signal_delta, delta_status, indeterminate_reason, baseline_signal/current_signal/expected_signal |
Python が compute_delta()/PreviousStateProvider の実データから決定論的に構築する(evaluator wire payload から一切パースしない。Python が model judgment を別の意味へ変換すること — 例: indeterminate を classified/new に書き換えること — は禁止) |
evidence_refs[].ref_type, source_id |
evaluator judgment(observer 出力に実在する evidence を参照する場合のみ) |
evidence_refs[].resource_identity |
evaluator が参照した実在するリソースの記述(捏造禁止。実在しない runtime_receipt を作らない) |
evidence_refs[].projection_digest |
Python が実データから再計算(evaluator 供給値は信用しない。再計算不能なら fail-closed) |
evaluator が誤って出力した identity/evaluations/repository_id/source_run_ref/created_at/updated_at |
wire schema レベルで構造的に拒否されるか無視される(無条件上書きではなく「そもそも wire contract に存在しないフィールド」として扱う) |
Runtime Verification Applicability
runtime_verification_applicability:
decision: immediate
reason: "judgment-only wire contract への変更が実際に evaluator の実出力の vocabulary drift を解消し、evaluator 経由の non-empty finding が実 CLI 実行で candidate_schema_invalid を出さないことは、静的検証(型検査・lint・fixture-only unit test)だけでは保証できないため。"
applicable_acs: [AC5]
execution_environment: "claude binary が PATH 上にあり claude auth status が成功する Linux/WSL repository checkout(run_retrospective.py --state-backend fixture 実行可能な環境)"
skip_conditions: "claude binary が PATH に見つからない、または claude auth status が非0で終了する(#2301 の verify_run_retrospective_live_cli.sh と同じ2条件)"
fallback_policy: "SKIP は PASS に変換しない。fallback / synthetic canonical record 経由の成功は FAIL として扱う。"
artifact_requirements: "verify_run_evaluation_enrichment_live_cli.sh の実行ログ(3 observers → evaluator → canonical candidate → PublishRequest 到達を示す stdout/stderr 抜粋、artifacts/2362/ 配下)"In Scope
.claude/skills/agent-retrospective/scripts/schemas/evaluation_result_v1.schema.jsonのcandidate_records[].itemsを、evaluator-authoritative フィールドのみを要求する judgment-only shape に絞り込む(draft-07 で自前 author。canonical schema への$ref越境はしない。identity/evaluations/repository_id/source_run_ref/created_at/updated_atは wire schema に含めない).claude/agents/retrospective-evaluator.mdの system prompt を、新しい judgment-only wire contract に一致させて改訂する(tools: []は維持。placeholder JSON を撤去し、要求するフィールドの具体例を提示する)run_retrospective.pyの_enrich_candidate_record()を、evaluations[]を evaluator wire payload から一切パースせずcompute_delta()/PreviousStateProviderの出力から Python が直接構築するように変更する(PR feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 fix_delta items 1-6 で確立した fail-closed 方針は維持: 不正なsubject_ref/rule_idの合成は行わずcandidate_schema_invalidを維持する)evidence_refs[].projection_digestを実データ(observer 出力に含まれる実際の evidence projection)から Python が再計算するロジックを実装する。再計算不能な場合は捏造せず fail-closed にするevaluation_result_v1schema の互換性方針を確定する: 既存 consumer(run_retrospective.py・test_run_retrospective.py・test_run_retrospective_identity_binding.py・test_security_boundary.py・references/wire-contract.md)の inventory を取り、additive tightening(v1 のまま)で対応可能かを実装前に確認する。対応不能と判明した場合は Stop Conditions に従い報告する(version bump/field rename を独断で行わない)- AC3(旧 AC3 相当。番号は AC5 に振り直し)の live test を、nonce-tagged candidate の
finding_contract/identity/semantic judgment フィールドを厳密に assert する形に維持・強化する(既存 PR feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 fix_delta item 5 の assertion を土台にする) - 上記変更に対応する
.claude/skills/agent-retrospective/scripts/tests/配下のユニットテスト追加・更新(PR feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 の worktree に既にある items 1-6 の回帰テストは維持し、拡張する) - PR feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 の未commit変更(items 1-6)を破棄せず、そのまま維持・拡張する
Out of Scope
- 実装: agent-retrospective を optional plugin distribution として配布可能にする #2240(agent-retrospective の plugin 配布化)自体のスコープ
- canonical schema(
agent_improvement_candidate_v1.schema.json)自体の変更(本 Issue は wire schema と prompt のみを変更し、canonical schema は不変のまま維持する) validate_retrospective_schema.pyのcompute_finding_identity()ロジック自体の変更(同一計算を enrichment 側で再利用するのみ)- evaluator の wire schema へ canonical candidate schema 全体を埋め込む設計(architecture option B。4 SubAgent 調査で「evaluator に構造的に知り得ない判断(
presence_delta/delta_status等)を要求し、shape-valid だが内容捏造という現状より悪い結果を招く」と判定され却下) - fallback / synthetic canonical record の再導入(
_fallback_evaluation_entry()等、PR feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 fix_delta で削除された捏造コードパスの復活は禁止) EvaluatorRequestへのrepository_id等 deterministic field の追加- observer 側 identity binding(fix: run_retrospective.py に identity-binding helper を追加し caller-supplied prompt の observer_run_id_mismatch を解消 #2358 で解消済み・対象外)
- 新規 security/permission harness の追加
- 恒久的な runtime CI harness の新設(実 CLI 確認は merge 前の 1 回で足りる)
candidate_recordsフィールド名の rename(candidate_judgments等への変更)。additive tightening で対応可能である限り既存フィールド名を維持する。rename が真に必要と判明した場合は Stop Conditions に従い報告する
Acceptance Criteria
- AC1:
.claude/skills/agent-retrospective/scripts/schemas/evaluation_result_v1.schema.jsonのcandidate_records[].itemsが、evaluator-authoritative フィールド(candidate_id/title/description/claim_class/subject_ref/rule_id/evidence_refsのうち evaluator 参照可能な部分)のみを要求する judgment-only shape に改訂されており、draft-07 として valid であり、identity/evaluations/repository_id/source_run_ref/created_at/updated_atを要求・許容しない - AC2:
retrospective-evaluator.mdの system prompt が新しい judgment-only wire contract と一致しており、identity/evaluationsの placeholder({"...": "..."}等)を含まない - AC3:
run_evaluation()の_enrich_candidate_record()(または後継関数)がevaluations[]を evaluator wire payload から一切パースせず、compute_delta()/PreviousStateProviderの出力から直接構築する。validclassifiedentry・validindeterminateentry(delta_status不在)・複数 entry の history chain のいずれも、evaluator 出力とは独立して正しく構築・保存されることをユニットテストで固定する - AC4: 不正な
subject_ref/rule_idは合成されずcandidate_schema_invalidとして fail-closed になる(PR feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 fix_delta items 1/3 の既存契約を維持)。evidence_refs[].projection_digestは実データから再計算され、再計算不能な場合は捏造せず fail-closed になる - AC5: evaluator 経由の non-empty finding を含む実 CLI 実行(
run_retrospective.py --state-backend fixture)でcandidate_schema_invalidエラーが発生せず、3 observers → evaluator(judgment-only output)→ deterministic enrichment → canonical candidate →PublishRequestまで1回で到達する。verify_run_evaluation_enrichment_live_cli.shは nonce-tagged candidate を特定し、finding_contract/identity.key.repository_id/identity.value(compute_finding_identity()の再計算結果と一致)/claim_class/subject_ref/rule_idが evaluator judgment と一致することを必須 assert する。SKIP は PASS に変換しない。fallback/synthetic canonical record 経由の成功は FAIL として扱う - AC6: 既存
evaluation_result_v1schema の consumer(test_run_retrospective.py・test_run_retrospective_identity_binding.py・test_security_boundary.py・references/wire-contract.mdを含む)が、additive tightening 後も matched fixture で正しく動作する(互換性が破れる場合は fixture を新契約に更新し、その旨を PR 本文で明示する) - AC7: 追加・更新したユニットテストが PASS する(PR feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 fix_delta で追加された items 1-6 の回帰テストを含め、新規 AC1-AC4 の回帰テストを追加する)
Verification Commands
# AC1
$ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/test_deterministic_enrichment.py -k "wire_schema or judgment_only"# AC2
$ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/test_deterministic_enrichment.py -k "evaluator_prompt or prompt_contract"# AC3
$ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/test_deterministic_enrichment.py -k "evaluation_history or compute_delta"# AC4
$ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/test_deterministic_enrichment.py -k "fail_closed or projection_digest"# AC5
# preflight-scope: runtime_only
$ .claude/skills/agent-retrospective/scripts/tests/verify_run_evaluation_enrichment_live_cli.sh# AC6
$ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective.py .claude/skills/agent-retrospective/scripts/tests/test_run_retrospective_identity_binding.py .claude/skills/agent-retrospective/scripts/tests/test_security_boundary.py# AC7
$ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/(注: 上記 -k selector は実装時に実テスト関数名へ更新すること。selector 名自体は本 Issue の意図を示すガイドであり、実装が対応する具体的なテスト関数名で AC を満たしていれば selector 文字列の完全一致は必須としない。ただし各 AC に対応する具体的テストが存在し実行可能であることは必須。)
Allowed Paths
- .claude/skills/agent-retrospective/scripts/run_retrospective.py
- .claude/skills/agent-retrospective/scripts/schemas/evaluation_result_v1.schema.json
- .claude/agents/retrospective-evaluator.md
- .claude/skills/agent-retrospective/scripts/tests/
- .claude/skills/agent-retrospective/references/wire-contract.md(記述更新のみ。契約自体の正本は schema/prompt/code)
Stop Conditions
- 上記 Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合。ただし
evaluation_result_v1の additive tightening(candidate_records[].itemsの絞り込み)自体は本 Issue の In Scope であり、本条項の対象外とする。v2bump またはフィールド rename(candidate_records→ 別名)が真に必要と判明した場合は本条項に該当し停止する agent_improvement_candidate_v1.schema.json(canonical schema)自体の変更が必要と判明した場合は 実装: agent-retrospective を optional plugin distribution として配布可能にする #2240 の Stop Condition と整合させ、この Issue 単独では変更しない- fallback / synthetic canonical record の再導入が必要に見える状況になった場合(そのように見える場合は実装を止めて報告する。捏造で回避しない)
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- identity/evaluation-history/evidence 以外の canonical candidate 制約で新たな schema 違反が露出し、対応範囲が本 Issue の Allowed Paths を超えると判明した場合
Required Skills
なし
Required Design References
- .claude/skills/agent-retrospective/schemas/agent_improvement_candidate_v1.schema.json
- .claude/skills/agent-retrospective/scripts/schemas/evaluation_result_v1.schema.json
- .claude/agents/retrospective-evaluator.md
- .claude/skills/agent-retrospective/references/wire-contract.md
- docs/dev/agent-skill-boundaries.md
- docs/dev/runtime-verification-policy.md
Scope Delta(任意)
承認済み scope reframe(2026-08-28、repository owner 承認):
- 変更前 Out of Scope:
.claude/agents/retrospective-evaluator.mdの prompt/frontmatter の変更、evaluation_result_v1.schema.jsonの変更 - 変更後: 上記2ファイルを Allowed Paths に追加し、In Scope とする
- 根拠: PR feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367(https://github.com/squne121/loop-protocol/pull/2367)の OWNER レビュー(https://github.com/squne121/loop-protocol/pull/2367#issuecomment-5451104673)と fix_delta blocked report(https://github.com/squne121/loop-protocol/pull/2367#issuecomment-5451346613)により、旧前提(「evaluator prompt Out of Scope のまま AC3 が PASS する」)が実測で成立しないことが確認されたため
- 承認: repository owner による impl-review-loop 再開指示コメント(本 Issue 更新の直接的契機)
- 影響を受けない既存契約:
identity.valueの算出方法(compute_finding_identity())・PR feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 fix_delta items 1-6 の fail-closed 方針・canonical schema 自体は変更しない
Source
- follow_up_of: 実装: agent-retrospective を optional plugin distribution として配布可能にする #2240 (comment)
- dedupe_key: follow-up:squne121/loop-protocol:issuecomment-5440967843:evaluator-deterministic-enrichment
- reframed_by: 実装: agent-retrospective evaluator の identity.value 決定論的算出を分離する deterministic enrichment phase を追加する #2362 (comment)
- scope_reframed_by (2026-08-28): feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 (comment) (OWNER review) および feat: agent-retrospective evaluator に identity.value 決定論的算出の deterministic enrichment phase を追加する #2367 (comment) (fix_delta blocked report) を契機とする owner 承認済み scope reframe
Activity
squne121 commentedon Aug 27, 2026
判定
REQUEST_CHANGES/implementation_readiness: blocked/recommended_disposition: reframe_in_placeです。Issue #2362 の着眼点自体は正しいです。むしろ #2240 より先に直すべき production blocker です。PR #2358 の実 Claude Code smoke では3 observer の substantive finding 生成までは成功した一方、
run_cli()を evaluator まで通した2回の試行はいずれも、evaluator がfinding_contract.identity.keyにobserver_id/run_id/claim等を混入させてcandidate_schema_invalidになっています。#2240 の OWNER review でも「repository_id を知らず SHA-256 を計算する道具もない LLM に canonical identity を完成させている」ことが根因として切り分けられています。ただし、現在の #2362 契約は解決方針は正しいものの、実装境界と検証契約がまだ曖昧です。このまま
impl-review-loopに入れると、「grep/pytest は通ったが full run はまだ evaluator で落ちる」という false-green がかなりあり得ます。Issue 自身は runtime verification をimmediateと宣言しているのに、その AC3 Verification Command が実 CLI ではなく unit pytest なのも明確な矛盾です。敵対的 findings
Priority | Finding | 判定 -- | -- | -- P0 | AC3 が実 CLI 契約なのに Verification Command は pytest | blocker P0 | deterministic enrichment を挿入する正確な call-graph 境界が未定義 | blocker P1 | repository_id 等の authority/source が関数境界に存在しない | contract fix P1 | 「model judgment のみ」と現行 evaluator prompt が矛盾 | contract fix P1 | AC2 が canonical helper の「再利用」ではなく再実装でも通る | contract fix P1 | identity 以外の run-bound deterministic fields が AC で未検証 | contract fix P2 | AC1 の git grep compute_finding_identity は実装の正しさを証明しない | VC replacement P2 | live smoke は新ハーネスではなく既存経路の1回実行で十分 | simplifyこれを Issue に入れるだけで実装の迷いがかなり減ります。
P1 —
retrospective-evaluator.mdを Out of Scope にするなら「無視する値」を明記する現在の evaluator system prompt は実際には LLM に、
source_run_ref、created_at、updated_at、identity.key、identity.valueを含む完成 canonical candidateを出すよう要求しています。しかも identity の例はkey: {"...": "..."}です。したがって #2362 の「LLM output は model judgment 値のみ」という記述とは厳密には一致しません。
ここは scope を広げて agent prompt を作り直す必要まではありません。個人開発として最小にするなら、
と契約化すれば十分です。
将来的には evaluator の prompt 自体も judgment draft 専用に縮めた方がトークン効率・成功率は上がりますが、#2362 の blocker にしなくてよいと思います。
P1 —
compute_finding_identity()は「同一実装」ではなく直接再利用すべき既存
validate_retrospective_schema.pyには canonical helper がすでに存在します。sha256-jcs-v1、非ASCII UTF-8、object property ordering、非有限数拒否まで既に規定され、PR #2289 では JCS 周辺の不整合を実際に修正した履歴があります。RFC 8785 自体も hashing/signing の再現性を得るため canonical representation を使うことを目的としており、ここで二つ目の「ほぼ同じ JCS」を書く利点はありません。(RFCエディタ)
したがって AC2 は、
まで強くしてよいです。
現在
run_retrospective.pyは既に sibling validator を lazy-load していますから、新しい依存関係すら増えません。P1 — identity を直せば本当に full candidate が通るかはまだ未証明
canonical candidate の
finding_contract.evaluations[]にはevaluation_id、evaluated_run_ref、classified_at、signal群、coverage、evaluation status など多数の必須・相互整合条件があります。現在 evaluator は
tools: []で、CLI の外側 schema も nested candidate schema を渡していません。したがって identity を修正したら次に別の canonical constraint が露出する可能性はあります。これは今の段階で新 Issue を作る理由ではありません。実 CLI AC3 を本物に直せば、そのリスクを安価に検出できます。
もし identity enrichment 後に別 field で落ちるなら、その時点で #2362 内で「run-bound field の deterministic enrichment」に含めるかを判断すればよいです。先回りして巨大な candidate builder を作る必要はありません。
P2 — grep VC は削除してよい
AC1 の
はコメントに名前を書くだけでも PASS します。#2288 自身も過去の refinement で「grep ベース VC は semantic AC を証明しない」と判断し、専用 pytest へ置き換えた履歴があります。
#2362 も同じでよく、grep は不要です。
推奨する #2362 の最小修正
新しいセキュリティ層や CI harness を増やさず、次の5点だけ本文に反映すれば implementation-ready にできます。
enrichment の順序を固定する: outer evaluator envelope parse → judgment allowlist extraction → deterministic overwrite →
Evaluationconstruction/canonical validation。authority matrix を追加し、model が返した
repository_id/identity.value/source_run_ref/ timestamp は信用せず上書きすると明記する。AC2 を canonical helper の直接再利用にする。JCS/SHA-256 の再実装は禁止。
AC3 を本当の live VC にする。既存 production path +
--state-backend fixtureで substantive non-empty finding → evaluator → canonical candidate →PublishRequestを1回確認。恒久 CI は不要。grep VC を削除し、unit test では「LLM が壊れた
identity.key/ fakeidentity.valueを返しても authoritative 4-key identity に上書きされる」「同じ judgment + context なら identity が同一」「repository/rule/subject が変われば identity が変わる」を固定する。#2362 には現在コメントがなく、実装 PR もまだ前提化されていない段階なので、今ここで reframe するコストは非常に低いです。コメント欄も現時点では空です。
総じて、Issue の存在と基本設計は採用でよいが、現状の AC/VC のまま実装開始は反対です。修正は小さく、特に security/permission machinery を増築する必要はありません。狙うべきは「LLM に deterministic bookkeeping をさせない」「一度だけ本物の production run で価値経路を通す」の2点です。
## 判定REQUEST_CHANGES/implementation_readiness: blocked/recommended_disposition: reframe_in_placeです。Issue #2362 の着眼点自体は正しいです。むしろ #2240 より先に直すべき production blocker です。PR #2358 の実 Claude Code smoke では3 observer の substantive finding 生成までは成功した一方、
run_cli()を evaluator まで通した2回の試行はいずれも、evaluator がfinding_contract.identity.keyにobserver_id/run_id/claim等を混入させてcandidate_schema_invalidになっています。#2240 の OWNER review でも「repository_id を知らず SHA-256 を計算する道具もない LLM に canonical identity を完成させている」ことが根因として切り分けられています。ただし、現在の #2362 契約は解決方針は正しいものの、実装境界と検証契約がまだ曖昧です。このまま
impl-review-loopに入れると、「grep/pytest は通ったが full run はまだ evaluator で落ちる」という false-green がかなりあり得ます。Issue 自身は runtime verification をimmediateと宣言しているのに、その AC3 Verification Command が実 CLI ではなく unit pytest なのも明確な矛盾です。敵対的 findings
repository_id等の authority/source が関数境界に存在しないgit grep compute_finding_identityは実装の正しさを証明しないP0 — enrichment は現在の
run_evaluation()に単純挿入できない現行コードは evaluator の
structured_outputを受け取った直後、という順に進みます。つまり
Evaluationを構築した時点ですでに candidate validation が走るので、「validation に失敗した後で identity を補完する」ことはできません。現在のrun_evaluation()が実際にこの順序であることも確認できます。一方、Claude CLI に渡している
evaluation_result_v1.schema.jsonは、意図的にcandidate_records[]を単なるobjectとしか規定せず、canonical candidate validation は Python 側に委譲しています。したがって schema 変更なしで、と分離する余地はあります。
AC1 はこの順序まで固定すべきです。 「validator の前に enrichment」とだけ書くより、
Evaluationconstruction 自体が canonical validation boundary であることを明記した方が実装者が誤りません。P0 — AC3 は実 CLI に直すべき
Issue は Outcome、Runtime Verification Applicability、AC3 の全部で「evaluator 経由 non-empty finding の実 CLI 成功」を要求しています。それなのに VC は、
です。これは fake evaluator が canonical draft を返せば簡単に緑になります。
ここは新しい Claude-live CI や恒久ハーネスを作る必要はありません。PR #2358 と同じ考え方で、merge 前に一度だけ
run_retrospective.py --state-backend fixtureの production call graph を実 Claude Code で通し、3 observers → evaluator → non-empty canonical candidate → PublishRequestまで到達したログを PR 本文に残せば十分です。Claude Code 公式も
claude -p --output-format json --json-schema ...のstructured_outputを programmatic surface として定義しています。(Claude)しかも最近の Claude Code では、headless
--json-schemaで schema-valid な placeholder に退化する報告や、特に toolless structured-output 呼び出しで placeholder key が出る報告があります。retrospective-evaluatorはまさにtools: []なので、unit test だけで終わらせない理由として十分です。ただしこれは upstream issue の観測であり、#2362 に新たな防御ハーネスを持ち込む理由にはしなくてよいです。([GitHub]2)P1 — authority matrix を Issue に入れた方がよい
現在の
EvaluatorRequestが持つのはrun_id/base_sha/source_set_digest/finding_setsだけで、repository_idは持ちません。repository_idはrun_cli()/execute_run()の一段外側には既に存在していますが、現在run_evaluation()には渡されていません。私は
EvaluatorRequestにrepository_idを足すのには反対です。LLM が知る必要がない deterministic context を model input に増やすだけです。代わりに Python の enrichment context として明確に分けるのがよいです。title,descriptionclaim_classsubject_ref,rule_idrepository_idrun_cli()caller contextsource_run_ref.base_shaRunContext.base_shasource_run_ref.source_set_digestidentity.algorithmidentity.valuecompute_finding_identity()created_at,updated_atrepository_id/value/source_run_ref/timestampこれを Issue に入れるだけで実装の迷いがかなり減ります。
P1 —
retrospective-evaluator.mdを Out of Scope にするなら「無視する値」を明記する現在の evaluator system prompt は実際には LLM に、
source_run_ref、created_at、updated_at、identity.key、identity.valueを含む完成 canonical candidateを出すよう要求しています。しかも identity の例はkey: {"...": "..."}です。したがって #2362 の「LLM output は model judgment 値のみ」という記述とは厳密には一致しません。
ここは scope を広げて agent prompt を作り直す必要まではありません。個人開発として最小にするなら、
と契約化すれば十分です。
将来的には evaluator の prompt 自体も judgment draft 専用に縮めた方がトークン効率・成功率は上がりますが、#2362 の blocker にしなくてよいと思います。
P1 —
compute_finding_identity()は「同一実装」ではなく直接再利用すべき既存
validate_retrospective_schema.pyには canonical helper がすでに存在します。sha256-jcs-v1、非ASCII UTF-8、object property ordering、非有限数拒否まで既に規定され、PR #2289 では JCS 周辺の不整合を実際に修正した履歴があります。RFC 8785 自体も hashing/signing の再現性を得るため canonical representation を使うことを目的としており、ここで二つ目の「ほぼ同じ JCS」を書く利点はありません。([RFCエディタ]3)
したがって AC2 は、
まで強くしてよいです。
現在
run_retrospective.pyは既に sibling validator を lazy-load していますから、新しい依存関係すら増えません。P1 — identity を直せば本当に full candidate が通るかはまだ未証明
canonical candidate の
finding_contract.evaluations[]にはevaluation_id、evaluated_run_ref、classified_at、signal群、coverage、evaluation status など多数の必須・相互整合条件があります。現在 evaluator は
tools: []で、CLI の外側 schema も nested candidate schema を渡していません。したがって identity を修正したら次に別の canonical constraint が露出する可能性はあります。これは今の段階で新 Issue を作る理由ではありません。実 CLI AC3 を本物に直せば、そのリスクを安価に検出できます。
もし identity enrichment 後に別 field で落ちるなら、その時点で #2362 内で「run-bound field の deterministic enrichment」に含めるかを判断すればよいです。先回りして巨大な candidate builder を作る必要はありません。
P2 — grep VC は削除してよい
AC1 の
git grep -n "compute_finding_identity" ...はコメントに名前を書くだけでも PASS します。#2288 自身も過去の refinement で「grep ベース VC は semantic AC を証明しない」と判断し、専用 pytest へ置き換えた履歴があります。
#2362 も同じでよく、grep は不要です。
推奨する #2362 の最小修正
新しいセキュリティ層や CI harness を増やさず、次の5点だけ本文に反映すれば implementation-ready にできます。
Evaluationconstruction/canonical validation。repository_id/identity.value/source_run_ref/ timestamp は信用せず上書きすると明記する。--state-backend fixtureで substantive non-empty finding → evaluator → canonical candidate →PublishRequestを1回確認。恒久 CI は不要。identity.key/ fakeidentity.valueを返しても authoritative 4-key identity に上書きされる」「同じ judgment + context なら identity が同一」「repository/rule/subject が変われば identity が変わる」を固定する。#2362 には現在コメントがなく、実装 PR もまだ前提化されていない段階なので、今ここで reframe するコストは非常に低いです。コメント欄も現時点では空です。
総じて、Issue の存在と基本設計は採用でよいが、現状の AC/VC のまま実装開始は反対です。修正は小さく、特に security/permission machinery を増築する必要はありません。狙うべきは「LLM に deterministic bookkeeping をさせない」「一度だけ本物の production run で価値経路を通す」の2点です。
squne121 commentedon Aug 27, 2026
issue-refinement-loop: approved
anchor comment(OWNER, #2362 (comment) 、
REQUEST_CHANGES/implementation_readiness: blocked/recommended_disposition: reframe_in_place)を受け、本文を全面改訂しました。実施内容
check_issue_contract.py): 初回needs-fix(10 blockers: Runtime Verification Applicability 必須フィールド欠落、decision-tag 不整合、git grep allowlist 違反、pytest exit5 等)→ rewrite →VERDICT: approve。run_evaluation()へのrepository_id/clock注入という signature 変更が未記載/low: 複数 candidate_records の独立性契約欠落)を検出 → rewrite → 2周目でassessment: clear(findings: 0)。最終状態
REVIEWED_BODY_SHA256:sha256:266a2db343b179579e6c29e0de26911824e4f833928e721cd78deed2f0eb67c8VERDICT: approve/BLOCKERS: 0assessment: clear/findings: 0baseline_vc_preflight: AC1/AC2/AC4 =expected_baseline_fail/go、AC3 =preflight_scope_runtime_only/go、errors: []Next Action
Issue は実装着手可能な状態です。実装ループ(
impl-review-loop)の起動は本 refinement loop のスコープ外のため、必要であれば別途起動してください。squne121 commentedon Aug 27, 2026
implement-issue: 実装完了 (2026-08-28)
.claude/worktrees/issue-2362-deterministic-enrichmentworktree-issue-2362-deterministic-enrichmentverify_run_evaluation_enrichment_live_cli.sh) PASS(2 回連続)feat: agent-retrospective evaluator を judgment-only producer へ再設計し id…
fix: wire-contract.md の PR Body Japanese Check 不合格を解消する
feat: agent-retrospective evaluator に identity.value 決定論的算出の determin…