Skip to content

実装: agent-retrospective candidate schema に stable finding identity と delta evaluation contract を追加する #2288

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2192"
goal_ref: "agent_improvement_candidate/v1 に stable finding identity と versioned delta-evaluation representation contract を追加し、#2237 が delta evaluation を生成し #2238 が永続化できる schema boundary を確定する(publication handoff 自体は本 Issue の Out of Scope であり、#2237 -> human authorization -> #2238 の既存 ownership を変更しない)"
change_kind: code

Parent Issue

#2192

Parent Goal Ref

Current Validated Scope

  • .claude/skills/agent-retrospective/schemas/agent_improvement_candidate_v1.schema.json を additive に拡張し、versioned finding_contract envelope(存在する場合のみ内部を all-or-none required とする)として stable finding identity・claim_class・public-safe evidence reference・baseline/expected/current signal・evaluation event history・5軸の delta representation(evaluation_status / presence_delta / signal_delta / delta_status / indeterminate_reason)を追加する。
  • .claude/skills/agent-retrospective/scripts/validate_retrospective_schema.py を compute_finding_identity() / validate_finding_identity()(格納済み identity の再計算照合)・finding_contract envelope の all-or-none 構造検証・delta 判定表の相互排他性検証に対応させる。
  • .claude/skills/agent-retrospective/schemas/fixtures/ 配下に新規/更新 fixture を追加し、5-state summary(new/resolved/recurrent/regressed/unchanged)に加えて indeterminate と recurrent + signal_delta regressed の同時表現を証明する。
  • .claude/skills/agent-retrospective/scripts/tests/ 配下に新規テストを追加する(CI 収録済みディレクトリ、.github/ci/python-test-plan.json に既存登録)。
  • 既存 candidate データ(finding_contract を持たない legacy record)は、finding_contract を追加しなくても schema validation に通り続ける(syntactic backward compatibility)ことを保証しつつ、そのような record は delta_capability: legacy_unavailable として明示的に識別可能にする(identity を自動生成・backfill しない)。

Remaining Parent Gaps

  • 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237(Orchestrator Skill / retrospective-runtime-observer・retrospective-evaluator SubAgent 実装。delta 算出の producer)は本 Issue のスキーマ契約確定を prerequisite とする。本 Issue 完了後に着手する。
  • publication handoff(RETROSPECTIVE_PUBLISH_REQUEST_V1 相当、#2237(prepare-only)→ Human 承認 → #2238(controlled publisher が Issue comment 投稿・readback・idempotency/optimistic concurrency を担う)という既存 ownership)の実装自体は本 Issue の Out of Scope。本 Issue はこの ownership を変更しない。
  • agent_retrospective_run/v1 側に evidence metadata(fetch_started_at/fetch_completed_at/resource_updated_at_min/resource_updated_at_max)を追加する追随修正は ADR 0007 Remaining Parent Gaps 記載の既存 gap であり、本 Issue の Out of Scope。
  • value-level safety(secret / PII / absolute path / private GitHub content / prompt injection の検出・redaction)は #2239(agent-retrospective のセキュリティ境界・evaluation・live smoke)の責務であり、本 Issue の Out of Scope。本 Issue は typed public-safe evidence reference の schema 形状のみを定義する。

Outcome

.claude/skills/agent-retrospective/schemas/agent_improvement_candidate_v1.schema.json が、既存 legacy record を壊さないまま、finding_contract versioned envelope(存在時 all-or-none required)として stable finding identity(compute_finding_identity()/validate_finding_identity() による決定論的算出・再計算照合込み)・ADR 0007 準拠 9値 claim_class・typed public-safe evidence_ref・型付き signal(baseline/expected/current)・evaluation event history・相互排他的な delta 判定軸(evaluation_status/presence_delta/signal_delta/delta_status/indeterminate_reason)を machine-readable に表現できる状態になり、既存 fixture が新 schema でも valid のまま、かつ新規 fixture/pytest が「finding identity の決定論性・改ざん耐性」「5軸 delta 判定表の全パス(indeterminate と recurrent + regressed 同時表現を含む)」「candidate lifecycle 8状態と ALLOWED_TRANSITIONS の exact transition graph が不変であること」「legacy record が delta_capability: legacy_unavailable として識別されること」を証明して pytest が全件 PASS している状態。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本 Issue は JSON Schema 定義・validator・fixture・pytest によるスキーマ構造検証が中心であり、docs/dev/runtime-verification-policy.md の適用判定スキーマ上、実行時挙動(runtime behavior)を伴う変更ではない。schema 拡張の意味的妥当性は静的検証(schema validation + fixture-based pytest)で完結する。判断が変わる場合は同 policy の判定スキーマに従い再評価する。

Background

OWNER レビュー指摘(2026-08-22, blocking findings)と対応方針

anchor comment(https://github.com/squne121/loop-protocol/issues/2288#issuecomment-5376621173)の指摘に対する本改訂での対応方針:

  1. stable_finding_identity_contract_is_not_defined → 「採用する設計」節・In Scope に finding_contract.identity(FINDING_IDENTITY_V1: algorithm: sha256-jcs-v1、typed key = repository_id/claim_class/subject_ref/rule_id、value: sha256:<64hex>)を明示し、candidate_id(既存 lifecycle record identity)と finding_identity(cross-run semantic identity)の役割・cardinality を分離した。
  2. candidate_and_finding_cardinality_is_ambiguous → candidate : finding = 1 : 1 を MVP scope として明示的に固定した(複数 finding 集約は別設計として Stop Conditions に記載)。
  3. delta_five_state_model_is_not_mutually_exclusive → evaluation_status(classified/indeterminate)・presence_delta(new/active/resolved/recurrent/still_absent)・signal_delta(improved/unchanged/regressed/unknown)を分離軸として追加し、delta_status(5値)は互換用 summary として残しつつ判定表と precedence を固定した。
  4. indeterminate_and_partial_evidence_handling_is_missing → source_coverage(complete/partial/unavailable/blocked)と indeterminate_reason を追加し、「source coverage が不完全な場合は resolved と判定しない」ことを判定表に明記した。
  5. backward_compatibility_is_mislabeled_as_migration → migration policy を「legacy record はそのまま読み取るが delta 評価対象外(delta_capability: legacy_unavailable)、identity の自動 backfill は禁止」に固定し、AC8 を syntactic backward compatibility ではなく legacy record の識別可能性の証明に置き換えた。
  6. public_safety_scope_conflicts_with_child_6 → value-level safety(secret/PII/absolute path/private content/prompt injection の検出・redaction)を #2239 の責務として明記し、本 Issue の scope を「evidence_ref を typed object にする」「raw evidence field を schema に定義しない」「決定論的に拒否可能な値(field allowlist 違反等)のみ validator で拒否する」に限定した。
  7. machine_contract_claims_publication_handoff_outside_scope → Machine-Readable Contract の goal_ref から publication handoff 解消の過大主張を除去し、schema boundary 確定のみに縮小した。publication ownership(#2237 prepare-only → human authorization → #2238 controlled publisher)は本 Issue が変更しないことを明記した。
  8. verification_commands_do_not_prove_the_acceptance_criteria → grep ベース VC(rg -c/rg -n の存在確認)をすべて廃止し、専用 pytest(negative test・判定表全パス・exact transition graph assertion 込み)に置換した。

採用する設計(OWNER decision、2026-08-22 改訂)

  • 新しい第三の persistent finding schema や agent_retro_index/v1 を finding/delta state の正本にはしない。

  • 既存の agent_improvement_candidate/v1(.claude/skills/agent-retrospective/schemas/agent_improvement_candidate_v1.schema.json に実在、Child 2 成果物)を additive に拡張する。

  • 既存 candidate との後方互換性は、個別フィールドをすべて optional にする方式ではなく、finding_contract という versioned envelope 全体を optional にし、envelope が存在する場合は内部を all-or-none required にすることで実現する。

    finding_contract absent
      -> legacy lifecycle-only candidate
      -> delta_capability: legacy_unavailable
      -> delta 評価対象外(identity の自動生成・backfill を禁止)
    
    finding_contract present
      -> identity / claim_class / evaluations をすべて必須
      -> 部分的 record は拒否
    
  • candidate_id(既存 lifecycle record の identity)と finding_contract.identity(複数 run 間で同一 finding を照合する cross-run semantic identity)の役割を分離し、candidate : finding = 1 : 1 に固定する(1 candidate に複数 finding を集約する設計は別スコープとする)。

  • finding_contract.identity は次の typed key に限定する(自由記述の title/description、source_run_ref/base_sha/source_set_digest/timestamp/evidence fingerprint は identity 計算に含めない。これらは run/occurrence ごとに変化するため、含めると同一 finding が毎回別 ID になる)。

    FINDING_IDENTITY_V1:
      algorithm: sha256-jcs-v1
      key:
        repository_id: "<stable repository identity>"
        claim_class: "<ADR 0007 の 9 値 enum>"
        subject_ref:
          kind: "repository_path | issue | pull_request | workflow | runtime | external_resource"
          value: "<normalized stable reference>"
        rule_id: "<controlled failure-mode identifier>"
      value: "sha256:<64hex>"
    # value = "sha256:" + SHA256(JCS(FINDING_IDENTITY_V1.key))
    # hash preimage は `FINDING_IDENTITY_V1.key` のみであり、`algorithm` フィールドは preimage に含めない
    # (`algorithm` は envelope 側の namespace 識別子として別途 `finding_contract.identity.algorithm` に保持する)。
    # JCS は RFC 8785 に厳密準拠する: object property は再帰的に sort するが、array element の順序は変更しない
    # (`key` には配列フィールドが存在しないため実質的に影響しないが、将来 array を追加する場合も set 扱いは禁止)。
    # 非制御 Unicode はそのまま serialize し(`ensure_ascii=False` 相当)、NaN/Infinity は禁止する。
  • validator は compute_finding_identity(identity_key) -> str と validate_finding_identity(candidate) -> None を実装し、格納済み finding_contract.identity.value を再計算値と照合して不一致(stale/copied/fabricated ID)を reject する。

  • delta 判定は 5 状態 summary(互換用)と、相互排他的な分離軸を併存させる。

    evaluations:
      - evaluation_id: "sha256:..."
        evaluated_run_ref:
          base_sha: "<40hex>"
          source_set_digest: "<64hex>"
        previous_evaluation_ref: "sha256:... | null"
        observed: true | false
        source_coverage: complete | partial | unavailable | blocked
        evaluation_status: classified | indeterminate
        presence_delta: new | active | resolved | recurrent | still_absent
        signal_delta: improved | unchanged | regressed | unknown
        delta_status: new | resolved | recurrent | regressed | unchanged
        indeterminate_reason: source_partial | source_unavailable | source_blocked | baseline_missing | comparator_missing | null
        baseline_signal: {}
        current_signal: {}
        expected_signal: {}
        evidence_refs: []
        classified_at: "<date-time>"
        classifier_version: "delta-evaluator/v1"

    判定表(正規化):

    prior なし + current observed
      -> presence_delta = new, delta_status = new
    
    prior active + current not observed + source_coverage = complete
      -> presence_delta = resolved, delta_status = resolved
    
    prior resolved + current observed
      -> presence_delta = recurrent, delta_status = recurrent
      -> signal_delta は improved/unchanged/regressed を別途保持(recurrent と regressed の同時表現を許容)
    
    prior active + current observed + signal_delta = regressed
      -> delta_status = regressed
    
    prior active + current observed + signal_delta = improved または unchanged
      -> delta_status = unchanged(summary)
    
    source_coverage が partial/unavailable/blocked
      -> evaluation_status = indeterminate
      -> delta_status を設定しない(indeterminate を resolved と判定してはいけない)
    

    recurrent と regressed が同時に成立する場合、delta_status(互換用 summary 単一 enum)は recurrent を優先する precedence を固定し、詳細情報は signal_delta 側で保持する。

  • baseline_signal / current_signal / expected_signal は型なし object ではなく、typed union を用いる。

    signal:
      signal_type: boolean | integer | number | enum | digest
      value: <typed value>
      unit: "<optional controlled unit>"
      comparator: eq | ne | lt | lte | gt | gte | present | absent
      worse_direction: higher | lower | different | not_applicable
      tolerance: "<optional number>"
  • evidence_ref は raw evidence を含まない typed object に限定する(value-level safety 検証は #2239 の責務であり、本 Issue は field allowlist と決定論的に拒否可能な値のみを扱う)。

    evidence_ref:
      ref_type: public_github_resource | repository_blob | runtime_receipt | external_primary_source
      source_id: github | repository | runtime | web
      resource_identity: "<typed, normalized public-safe identifier>"
      projection_digest: "sha256:<64hex>"

    projection_digest は raw secret/raw private content の hash ではなく、redaction 済み public-safe projection から算出する値として扱う(redaction 実装自体は #2239 の責務)。evidence fingerprint は finding identity には含めない(「今回何を根拠に観測したか」と「何の問題か」を分離するため)。

  • delta_status と candidate_status を混同しない。 candidate_status は既存 lifecycle proposed / accepted / implementation_issue_created / implemented / validating / validated / rejected / superseded のまま維持し、validate_transition()(validate_retrospective_schema.py)の状態遷移契約(ALLOWED_TRANSITIONS の exact mapping)を一切変更しない。delta_status を含む finding_contract.evaluations[] は retrospective run ごとに算出される観測結果であり、candidate_status とは独立した別軸として扱う。

In Scope

  • agent_improvement_candidate_v1.schema.json への additive フィールド拡張(新規 top-level required 昇格は行わず、既存必須 key セットを変更しない)
    • finding_contract(versioned envelope。absent の場合は既存 legacy record として扱う。present の場合、内部の schema_version/identity/claim_class/evaluations を dependentRequired/if-then で all-or-none required にする)
      • finding_contract.identity(FINDING_IDENTITY_V1 形状。algorithm/key/value を持つ)
      • finding_contract.claim_class(ADR 0007 Decision 2 の 9 値 exact enum)
      • finding_contract.evaluations[](evaluation event history。各要素は evaluation_id/evaluated_run_ref/previous_evaluation_ref/observed/source_coverage/evaluation_status/presence_delta/signal_delta/delta_status/indeterminate_reason/baseline_signal/current_signal/expected_signal/evidence_refs/classified_at/classifier_version を持つ typed union signal・typed evidence_ref を使用する)
  • validate_retrospective_schema.py の validator 更新
    • compute_finding_identity(identity_key) -> str / validate_finding_identity(candidate) -> None(格納済み identity の再計算照合。stale/copied/fabricated ID を reject)
    • finding_contract envelope の all-or-none 構造検証
    • 5軸 delta 判定表の相互排他性検証(indeterminate は delta_status 未設定を強制、recurrent+regressed 同時表現を許容しつつ summary precedence を検証)
    • evidence_ref の field allowlist 検証(additionalProperties: false に加えて raw evidence field が存在しないことを明示確認)
    • candidate_status の既存 ALLOWED_TRANSITIONS/validate_transition() の exact mapping が変更されていないことを assert する専用テストの追加
  • schemas/fixtures/ 配下の fixture 追加・更新
    • 既存 agent_improvement_candidate_v1.valid.json / .invalid.json の後方互換確認(legacy record が finding_contract なしで valid のまま)
    • finding_contract present の正常系 fixture(判定表の各分岐: new/resolved(source complete 前提)/recurrent+regressed 同時/unchanged/indeterminate(partial source で resolved にならないケース含む))
    • finding_contract の invalid fixture(partial envelope、malformed identity、copied/stale identity、invalid claim class、incomplete source coverage での resolved 判定、evidence/baseline なしでの classified、raw/free-text evidence、evaluation と history の不整合)
  • scripts/tests/ 配下への新規 pytest 追加(下記 Acceptance Criteria / Verification Commands 参照)
  • 既存 candidate データの非破壊 migration path の明示(finding_contract absent の legacy record は schema validation を通り続けるが delta_capability: legacy_unavailable として識別可能にする。identity の自動 backfill は行わない)

Out of Scope

  • agent_retrospective_run/v1 schema への evidence metadata 追加(ADR 0007 Remaining Parent Gaps の既存追随修正であり本 Issue の対象外)
  • publication handoff(RETROSPECTIVE_PUBLISH_REQUEST_V1 相当の型・controlled publisher 実装)自体。ownership は #2237(prepare-only)→ human authorization → #2238(controlled publisher)のまま変更しない。
  • 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237 の Orchestrator Skill / SubAgent 実装そのもの(delta 算出ロジックの producer)
  • 実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238 の永続化・optimistic concurrency 実装そのもの(evaluation event history の consumer)
  • value-level safety(secret scanning、PII 判定、absolute path 検出、private GitHub content 判定、prompt injection 検出・redaction、malicious payload の end-to-end 隔離確認)は #2239 の責務であり本 Issue の対象外。本 Issue は typed public-safe evidence_ref の schema 形状(field allowlist と決定論的に拒否可能な値の検証)のみを扱う。
  • agent_retro_index/v1(docs/dev/agent-retro-index.md)への責務追加(ADR 0007 Decision 7 により derived index の位置づけを維持する)
  • delta 算出ロジック(実際に前回 run と比較して delta_status/presence_delta/signal_delta を計算する実行可能コードの実装)。本 Issue は schema/validator/fixture レベルで判定表の意味を machine-readable に表現・検証できることを保証するに留まり、算出ロジックそのものは #2237 以降の実装 Issue の責務とする。
  • 1 candidate に複数 finding を集約する cardinality 設計(本 Issue は candidate : finding = 1 : 1 に固定する)

Acceptance Criteria

  • AC1: schema が additive に拡張され backward compatible であること(既存 fixture agent_improvement_candidate_v1.valid.json が新 schema でも valid のまま、かつ finding_contract を持たない legacy record として扱われる)
  • AC2: compute_finding_identity() が deterministic であり、かつ validate_finding_identity() が改ざん耐性を持つこと。FINDING_IDENTITY_V1.key は配列フィールドを持たないため、配列順序の正規化・set 扱いは本 AC の対象外とする(sha256-jcs-v1 は RFC 8785 JCS に厳密準拠し、object property のみ再帰的に sort し、array element 順序は変更しない)。少なくとも次の negative test を含む: (a) identity 入力を変えて古い ID をコピーした record を reject する、(b) object key 順の違いで同一 ID になる(RFC 8785 JCS 準拠の object property 再帰的 sort)、(c) 非 ASCII 文字を含む key 値でも RFC 8785 準拠の digest(ensure_ascii=False 相当の UTF-8 serialize)になる、(d) algorithm version 違いで別 namespace になり、未対応 algorithm は helper 側で fail-closed に reject される、(e) source_run_ref/base_sha/source_set_digest/timestamp が変わっても同一 finding ID が維持される、(f) claim_class/subject_ref/rule_id が変われば別 ID になる
  • AC3: delta 判定表の全パスを fixture 化し pytest が検証すること。少なくとも new/resolved(source coverage complete 前提)/recurrent(+ signal_delta: regressed の同時表現)/unchanged(signal_delta の値ごとに区別されたケースを含む)/indeterminate(partial source coverage で resolved に確定しないケースを含む)を含む
  • AC4: delta_status を含む finding_contract と candidate_status が独立フィールドとして共存し、candidate_status の既存 8 状態 lifecycle と ALLOWED_TRANSITIONS の exact transition graph(mapping 全体)が一切変更されていないことを専用テストが assert すること
  • AC5: evidence_ref が raw evidence(transcript 全文・secret・absolute local path 等)を含む property を一切持たない typed object であることを、schema の additionalProperties: false と専用 pytest の両方で検証すること
  • AC6: finding_contract.claim_class が ADR 0007 Decision 2 の 9 値 exact enum(code_content/code_authorship_timing/internal_loop_review_verdict/github_native_review_state/review_comment/mergeability/issue_intent/external_fact/runtime_behavior)に制約されており、それ以外の値が reject されることを専用 pytest が検証すること
  • AC7: 既存 invalid fixture(agent_improvement_candidate_v1.invalid.json)が引き続き schema validation に失敗すること(regression なし)に加え、finding_contract の不変条件違反を示す新規 invalid fixture(partial envelope、malformed identity、copied/stale identity、invalid claim class、incomplete source coverage での resolved 判定、evidence/baseline なしでの classified、raw/free-text evidence、evaluation と history の不整合)が全て validation に失敗すること
  • AC8: migration policy が「finding_contract absent の legacy record は schema validation を通るが delta_capability: legacy_unavailable として識別可能であり、identity が自動生成・backfill されないこと」を専用 pytest が証明すること

Verification Commands

# AC1
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_validate_retrospective_schema.py -k test_candidate_valid_fixture_passes_schema_validation -v
# AC2
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_finding_identity.py -v
# AC3
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_delta_evaluation_contract.py -v
# AC4
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_candidate_status_transitions.py::test_candidate_status_allowed_transitions_exact_mapping_unchanged -v
# AC5
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_public_safe_evidence_refs.py -v
# AC6
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_claim_class_enum_contract.py::test_claim_class_exact_enum_matches_adr_0007 -v
# AC7
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_validate_retrospective_schema.py -k "test_candidate_invalid_fixture_fails_schema_validation or test_finding_contract_invalid_fixtures_fail_schema_validation" -v
# AC8
$ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_candidate_migration.py -v

AC1 は既存 valid fixture が拡張後 schema でも valid のままであり、finding_contract を持たない legacy record として扱われることを確認する(exit 0)。AC2 は compute_finding_identity()/validate_finding_identity() の決定論性と、6 種の negative test(stale ID コピー・key 順違い・配列順序違い・algorithm version 違い・run 参照変化への非依存・controlled subject/rule 変化での ID 変化)が全て PASS することを確認する。AC3 は判定表の全分岐(indeterminate、recurrent+regressed 同時表現、source coverage partial 時の resolved 非確定を含む)を証明する新規テストが PASS することを確認する。AC4 は candidate_status の ALLOWED_TRANSITIONS exact mapping を assert する専用テストが PASS することを確認する。AC5 は evidence_ref が raw evidence field を持たないことを schema 構造と専用 pytest の両方で確認する(exit 0)。AC6 は claim_class が ADR 0007 の 9 値 exact enum に制約され、それ以外の値が reject されることを確認する。AC7 は既存 invalid fixture と finding_contract 不変条件違反を示す新規 invalid fixture が全て validation に失敗する(exit 非0 相当を pytest 内で assert)ことを確認する。AC8 は legacy record の delta_capability: legacy_unavailable 識別と identity 自動生成禁止を証明する新規テストが PASS することを確認する。

Allowed Paths

  • .claude/skills/agent-retrospective/schemas/agent_improvement_candidate_v1.schema.json
  • .claude/skills/agent-retrospective/schemas/fixtures/agent_improvement_candidate_v1.valid.json
  • .claude/skills/agent-retrospective/schemas/fixtures/agent_improvement_candidate_v1.invalid.json
  • .claude/skills/agent-retrospective/schemas/fixtures/(新規追加する finding_contract/delta 判定表 fixture ファイル)
  • .claude/skills/agent-retrospective/scripts/validate_retrospective_schema.py
  • .claude/skills/agent-retrospective/scripts/tests/test_validate_retrospective_schema.py
  • .claude/skills/agent-retrospective/scripts/tests/test_finding_identity.py(新規)
  • .claude/skills/agent-retrospective/scripts/tests/test_delta_evaluation_contract.py(新規)
  • .claude/skills/agent-retrospective/scripts/tests/test_candidate_migration.py(新規)
  • .claude/skills/agent-retrospective/scripts/tests/test_public_safe_evidence_refs.py(新規)
  • .claude/skills/agent-retrospective/scripts/tests/test_candidate_status_transitions.py(新規)
  • .claude/skills/agent-retrospective/scripts/tests/test_claim_class_enum_contract.py(新規)
  • docs/adr/0007-agent-retrospective-boundaries.md(本 Issue の実装内容が ADR の Remaining Parent Gaps や既存記述と矛盾する場合の追記のみ。既存 Decision 本文の意味変更は行わない)

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • 補足(Allowed Paths 外の変更の具体例): .claude/skills/agent-retrospective/scripts/collect_snapshot.py 等の既存 producer コードの出力形式が新 required フィールドと非互換になり修正が必要になった場合
  • 補足(In Scope 固定契約変更の具体例): candidate_status の既存 ALLOWED_TRANSITIONS/validate_transition() 契約自体を変更しないと AC4 を満たせないことが判明した場合
  • 補足(新規 Issue 起票の具体例): evidence_ref の value-level safety 検証(secret/PII/absolute path/private content/prompt injection)が本 Issue の Allowed Paths や #2239 の既存責務範囲を超える共通 validator の新設を要すると判明した場合
  • 補足(後続 Phase 波及の具体例): 新しい第三の永続 finding schema や agent_retro_index/v1 への state 追加が必要になり ADR 0007 Decision 7 との整合を要する場合、または candidate : finding = 1 : 1 の cardinality 前提を崩し複数 finding 集約が必要になる場合
  • finding_contract.identity の typed key(repository_id/claim_class/subject_ref/rule_id)だけでは cross-run で finding を一意に同定できないことが判明した場合は、追加の identity 入力の要否を人間に確認する
  • 既存 candidate データの migration が非破壊で行えないことが判明した場合、または delta_capability: legacy_unavailable の識別だけでは 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237/実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238 の consumer 要件を満たせないことが判明した場合は、破壊的変更や追加設計の許容可否を人間に確認する

Dependencies / Related Issues

Required Skills

なし

Required Design References

  • docs/adr/0007-agent-retrospective-boundaries.md
  • .claude/skills/agent-retrospective/schemas/agent_improvement_candidate_v1.schema.json
  • .claude/skills/agent-retrospective/scripts/validate_retrospective_schema.py

Delivery Rule

1 Issue = 1 PR。worktree で作業し、Draft PR を既定とする。

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Aug 21, 2026
  2. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    Scope Overlap Preflight(issue_overlap_preflight/v1)

    {
      "schema_version": "issue_overlap_preflight/v1",
      "decision": "overlap_requires_comment",
      "reason_code": "allowed_paths_overlap",
      "policy_class": "C1",
      "matched_issues": [2101, 435],
      "overlapping_paths": ["docs/adr/0007-agent-retrospective-boundaries.md"]
    }
  3. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告

    • termination_reason: approved
    • iteration: 1 (needs-fix 1 → 修正 → approve)
    • 最終 VERDICT: approve(BLOCKERS: 0)
    • reviewed_body_sha256: sha256:f2a28825354d98184b6c6d99e680d969e320280b2efeadcf1891cc910949c6d3

    実施内容

    1. Step 0f(run_refinement_preflight.py): STATUS: pass / NEXT_ACTION: proceed(structural repair 不要、disposition_summary: no_missing_fields_detected)。
    2. Step 2(run_root_review_pipeline.py produce、review 1回目): VERDICT: needs-fix、blocker 6件。すべて ## Verification Commands の VC preflight allowlist 違反(baseline_vc_preflight.py の allowlist は uv run pytest / uv run python3 -m pytest の bare form のみ許可し、--locked フラグ併用の -m pytest 形式、および pytest 以外の直接スクリプト呼び出しは command_not_allowed)。
    3. Step 4(issue-editor へ委譲、rewrite): AC1/AC2/AC3/AC4/AC7/AC8 の VC コマンド 6行を以下のように修正。
      • AC1・AC7: 直接スクリプト呼び出し(uv run --locked python3 validate_retrospective_schema.py ...)を、既存テスト test_validate_retrospective_schema.py 内の該当 pytest(test_candidate_valid_fixture_passes_schema_validation / test_candidate_invalid_fixture_fails_schema_validation)を -k 指定する bare uv run pytest 形式に置換。
      • AC2・AC3・AC4・AC8: uv run --locked python3 -m pytest ... を bare uv run pytest ... 形式に置換(--locked を除去)。
      • AC5・AC6(rg コマンド)は allowlist 違反なしのため変更なし。
      • Allowed Paths / Acceptance Criteria / 説明文など他セクションは無変更(body 差分は VC コードブロック内 6行のみ)。
    4. Step 2(review 2回目、修正後 body_sha256 sha256:f2a28825...): VERDICT: approve、BLOCKERS: 0、STATUS: contract ready。
    5. gate-final-review: final_review_allowed: true(reason なし)。

    Step 4.5 Follow-up Materialization

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations: []

    新規 follow-up Issue の起票候補は検出されなかった(Out of Scope 項目は既に #2237 / ADR 0007 Remaining Parent Gaps で追跡済み)。

    Final Gate

    issue-contract-review(実装着手直前の preflight)は本ループのスコープ外であり未実行のため、LOOP_HANDOFF_RESULT_V1.contract_review.gate_result は missing_go として報告する。実装着手前に issue-contract-review の実行が必要。

    LOOP_HANDOFF_RESULT_V1:
      status: blocked
      routing_action: blocked
      contract_review:
        status: blocked
        gate_result: missing_go
        latest_comment_url: null
        generated_at: null
        body_sha256: "sha256:f2a28825354d98184b6c6d99e680d969e320280b2efeadcf1891cc910949c6d3"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "issue-refinement-loop はラベル操作を行っていない"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers:
        - kind: contract_review_not_run
          description: "issue-contract-review が未実行のため gate_result が missing_go。impl-review-loop への handoff 前に issue-contract-review を実行すること。"
      permissions:
        unavailable: []
      generated_at: "2026-08-22T00:00:00Z"
      checked_body_sha256: "sha256:f2a28825354d98184b6c6d99e680d969e320280b2efeadcf1891cc910949c6d3"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []

    残課題

  4. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    結論

    verdict: REQUEST_CHANGES
    implementation_readiness: blocked
    recommended_disposition: reframe_in_place
    
    review_snapshot:
      date: "2026-08-22"
      main_sha: "908b48f7ba5347b75e61e1d931971a6a043eb88d"
    
    blocking_findings:
      - stable_finding_identity_contract_is_not_defined
      - candidate_and_finding_cardinality_is_ambiguous
      - delta_five_state_model_is_not_mutually_exclusive
      - indeterminate_and_partial_evidence_handling_is_missing
      - backward_compatibility_is_mislabeled_as_migration
      - public_safety_scope_conflicts_with_child_6
      - machine_contract_claims_publication_handoff_outside_scope
      - verification_commands_do_not_prove_the_acceptance_criteria

    「第3の finding schema や derived index を新設せず、既存 agent_improvement_candidate/v1 を additive に拡張する」という大方針は妥当です。ADR 0007 は run/candidate の一次状態を2 schemaに限定しており、OWNER判断でも candidate schema 拡張案が選ばれています。

    ただし、現在の #2288 は「フィールドを追加できること」と「複数run間で同一findingを安定して照合し、5状態を正しく判定できること」を混同しています。現状のまま実装すると、JSON Schemaとpytestは通るものの、#2237のevaluatorと#2238の永続化層が相互運用できない可能性が高いです。

    また、直前の issue-refinement-loop の approve は意味論的レビューではありません。報告上、修正されたのはVerification Commandsのallowlist違反6件だけで、それ以外の契約は変更されていません。さらに最終 handoff は issue-contract-review 未実行のため missing_go / blocked のままです。


    P0-1 — stable finding identity のアルゴリズムが定義されていない

    現行 schema には、すでに candidate_id が「Stable identifier for this improvement candidate」として存在します。#2288 はさらに finding_identity を追加しますが、両者の関係が定義されていません。

    少なくとも次が未確定です。

    • 1 candidate がちょうど1 findingを表すのか、複数findingを集約できるのか
    • candidate_id と finding_identity は同値なのか、別のidentity domainなのか
    • identity入力に何を含めるのか
    • canonicalization、hash algorithm、encoding、namespace、algorithm version
    • 格納されたidentityをvalidatorが再計算して照合するのか
    • repository rename、path rename、表現揺れをどう扱うのか

    特に source_run_ref、base_sha、source_set_digest、timestamp、evidence fingerprintをfinding identityに含めてはいけません。これらはrunやoccurrenceごとに変化するため、同一findingが毎回別IDになります。現行validator自身も source_set_digest をsemantic finding identityではなく、runのidempotency用途に限定しています。

    Schemaのdescriptionに「決定論的」と書くだけでは強制になりません。JSON Schemaのdescriptionやdefaultはannotationであり、validation時に値を計算・補完しません。(JSON Schema)

    必要な修正

    MVPでは、次のようにidentity入力を明示的なtyped keyへ限定するのが安全です。

    FINDING_IDENTITY_V1:
      algorithm: sha256-jcs-v1
      key:
        repository_id: "<stable repository identity>"
        claim_class: "<ADR 0007 enum>"
        subject_ref:
          kind: "repository_path | issue | pull_request | workflow | runtime | external_resource"
          value: "<normalized stable reference>"
        rule_id: "<controlled failure-mode identifier>"
      value: "sha256:<64hex>"

    計算規約は次のとおりに固定します。

    finding_identity.value =
      "sha256:" + SHA256(JCS(FINDING_IDENTITY_V1.key))
    

    JCSはhash用の不変JSON表現を提供しますが、配列順序は変更せず、Unicode normalizationも行いません。そのためidentity keyには自由記述のtitle・descriptionを使わず、controlled tokenとtyped referenceだけを使うべきです。どうしても自然言語を含める場合は、JCSの前段でNFC・case・空白などの正規化規則を別途固定する必要があります。([RFCエディタ]2)

    validatorには以下が必要です。

    compute_finding_identity(identity_key) -> str
    validate_finding_identity(candidate) -> None

    格納済みIDと再計算値が異なる場合はrejectしなければなりません。「同じ入力を2回計算して同じIDになる」だけでは、改ざん済みIDや誤った入力集合を検出できません。


    P0-2 — additive optional fields ではdelta contractが成立しない

    #2288 は後方互換性のため、新フィールドをすべてoptionalまたはdefault-fill可能にする方針です。

    この設計では、次のような不完全なrecordがすべてvalidになり得ます。

    {"delta_status": "resolved"}
    {"finding_identity": "abc"}
    {"evidence_refs": [], "occurrence_history": []}

    つまり、個別フィールドのenumや型は検査できても、「finding identity・claim class・evaluation run・evidence・delta resultが一つの整合した評価単位を構成する」という不変条件がありません。

    必要な修正

    既存recordとの互換性は、全フィールドを個別optionalにするのではなく、versioned envelope全体をoptionalにし、envelopeが存在する場合は内部をrequiredにすることで実現すべきです。

    {
      "candidate_id": "cand-0001",
      "candidate_status": "proposed",
      "...existing fields...": "...",
    
      "finding_contract": {
        "schema_version": "finding-delta/v1",
        "identity": {
          "algorithm": "sha256-jcs-v1",
          "key": {},
          "value": "sha256:..."
        },
        "claim_class": "code_content",
        "evaluations": []
      }
    }

    規則は次の二択にします。

    finding_contract absent
      -> legacy lifecycle-only candidate
      -> delta evaluation unavailable
    
    finding_contract present
      -> identity / claim_class / evaluations をすべて必須
      -> 部分的recordを拒否
    

    JSON Schema 2020-12では、あるpropertyが存在するとき他のpropertyを要求するdependentRequiredや、if / thenでこのall-or-none制約を表現できます。(JSON Schema)

    MVPでは candidate_id を既存lifecycle recordのidentity、finding_contract.identity を複数run間で照合するsemantic finding identityとし、candidate : finding = 1 : 1 に固定するのが最小です。1 candidateに複数findingを集約する設計は、candidate lifecycleの意味まで変えるため別設計になります。


    P0-3 — 5状態が相互排他的ではない

    new / resolved / recurrent / regressed / unchanged は同じ軸の状態ではありません。

    • new / resolved / recurrent はpresenceと履歴の状態
    • regressed はseverityやsignalの比較結果
    • unchanged はpresenceまたはsignalのいずれを指すのか不明

    例えば、解消後に再発し、以前より悪化したfindingは同時にrecurrentかつregressedです。単一enumではどちらかの情報を捨てる必要があります。

    さらに、GitHub/Web/runtime sourceがpartial、unavailable、blockedの場合、「見つからなかった」ことをresolvedと判断してはいけません。ADR 0007はsourceごとの観測範囲とcomplete/partial等の区別を要求していますが、#2288のdelta enumにはindeterminateがありません。

    必要な修正

    5状態を親契約との互換用summaryとして残しつつ、内部では軸を分離します。

    evaluation:
      evaluation_status: classified | indeterminate
    
      presence_delta:
        new | active | resolved | recurrent | still_absent
    
      signal_delta:
        improved | unchanged | regressed | unknown
    
      delta_status:
        new | resolved | recurrent | regressed | unchanged
    
      indeterminate_reason:
        source_partial | source_unavailable | source_blocked
        | baseline_missing | comparator_missing

    最低限の判定表は明文化が必要です。

    priorなし + current observed
      -> new
    
    prior active + current not observed + required source coverage complete
      -> resolved
    
    prior resolved + current observed
      -> recurrent
      -> signal_deltaは別途 improved/unchanged/regressed を保持
    
    prior active + current observed + signal worse
      -> regressed
    
    prior active + current observed + signal equivalent or improved
      -> unchanged summary
      -> signal_deltaでequivalent/improvedを区別
    
    required source coverageが不完全
      -> evaluation_status = indeterminate
      -> delta_statusを設定しない
    

    単一enumを維持する場合でも、少なくともrecurrentとregressedが競合した場合のprecedenceを固定しなければ、Claude Code側とClaude-GPT側で異なる分類になり得ます。


    P0-4 — occurrence_history ではなく evaluation event history が必要

    occurrence_history を「run referenceとobserved timestampの配列」とするだけでは、以下を再現できません。

    • どのrunでresolvedと判断したか
    • その判断時にsource coverageがcompleteだったか
    • recurrent時の直前resolved event
    • regression比較に使用したbaseline
    • evaluator versionやclassifier version
    • evidence fingerprintの変化
    • 同時更新時にどのhistoryを読んでいたか

    また現行の source_run_ref は「このcandidateを生成したrun」への参照です。継続的に同じcandidateを評価する場合、origin runとcurrent evaluation runを同じfieldで表せません。

    必要な修正

    source_run_ref はoriginとしてimmutableに保ち、各評価eventに別のrun referenceを持たせます。

    evaluations:
      - evaluation_id: "sha256:..."
        evaluated_run_ref:
          base_sha: "<40hex>"
          source_set_digest: "<64hex>"
    
        previous_evaluation_ref: "sha256:... | null"
        observed: true | false
        source_coverage: complete | partial | unavailable | blocked
        evaluation_status: classified | indeterminate
    
        presence_delta: new | active | resolved | recurrent | still_absent
        signal_delta: improved | unchanged | regressed | unknown
        delta_status: new | resolved | recurrent | regressed | unchanged
    
        baseline_signal: {}
        current_signal: {}
        expected_signal: {}
        evidence_refs: []
        classified_at: "<date-time>"
        classifier_version: "delta-evaluator/v1"

    #2238のoptimistic concurrencyとround-trip persistenceは、このevent historyを正本として扱う必要があります。#2238はすでにcandidate state永続化を責務に含め、#2288をprerequisiteとしています。


    P0-5 — 後方互換性をmigrationと呼んでいる

    現行valid fixtureは、任意文字列のcandidate_id、proseのtitle/description、source_run_refなどしか持っていません。claim class、affected subject、failure mode、signal、evidence fingerprintがないため、stable finding identityを事後的に正しく算出する材料がありません。

    既存fixtureが引き続きschema validationを通ることは、syntactic backward compatibilityです。delta-enabled recordへのmigrationではありません。

    さらにJSON Schemaのdefaultは欠落値を埋めません。(JSON Schema)

    必要な修正

    migration policyは次のいずれかに固定する必要があります。

    1. 推奨: legacy recordはそのまま読み取るがdelta評価対象外

      • finding_contract absent
      • delta_capability: legacy_unavailable相当
      • 初回post-upgrade runから新identityを生成
    2. 人間レビュー付き一回限りbackfill

      • 自然言語descriptionからの自動推測はauthorityにしない
      • OWNER承認済みmappingを別artifactとして保存
    3. heuristic migration

      • authoritative identityには使わない
      • confidenceとprovenanceを必須化

    AC8は「既存fixtureが通る」ではなく、次を検証すべきです。

    legacy fixture:
      validation = pass
      delta capability = unavailable
      fabricated/default identity = not generated
    

    P0-6 — public safety の責務が #2239 と衝突している

    現行candidate schemaは明確に、schemaが強制するのはfield allowlistまでで、secret、PII、absolute path等のvalue-level safetyはChild 6の責務だと記載しています。ADR 0007も、field allowlistとvalue-level validator/redactionを二層に分けています。

    一方、#2288は validate_retrospective_schema.py に以下の検出を追加しようとしています。

    • secret
    • absolute local path
    • PII
    • private GitHub content
    • prompt injection payload

    しかし、#2239はまさにinjection resistance、redaction、negative matrixを所有し、schema/Skill/永続化実装の変更をOut of Scopeにしています。

    さらに、任意のfree-textからprompt injectionを完全検出することはできません。OWASPもfree-text内の注入命令の完全検出は未解決であり、fixed schemaは明白なケースを捕捉する防御層にすぎないとしています。推奨される本質的な対策は、structured output、隔離、least privilege、backend enforcement、人間承認です。([OWASP Foundation]4)

    必要な修正

    #2288の責務は次までに限定すべきです。

    • evidence_refs をfree-textではなくtyped objectにする
    • raw evidence fieldをschemaに定義しない
    • public-safe projectionから算出したdigestのみを許可
    • URIやrepository referenceは明示的なkind/pattern/host allowlistを持つ
    • absolute path等の決定論的に拒否可能な値のみvalidatorで拒否
    evidence_ref:
      ref_type: public_github_resource | repository_blob | runtime_receipt | external_primary_source
      source_id: github | repository | runtime | web
      resource_identity: "<typed, normalized public-safe identifier>"
      projection_digest: "sha256:<64hex>"

    次は#2239に残します。

    • PII判定
    • secret scanning
    • private GitHub visibility確認
    • prompt injection/redaction
    • malicious payloadのend-to-end隔離確認

    projection_digest はraw secretやraw private contentのhashではなく、redaction済みpublic-safe projectionから算出すべきです。


    P0-7 — Machine-Readable Contract がpublication handoffを過大主張している

    #2288のgoal_refは「delta evaluation・publication handoffの所有者不在を解消する」としていますが、本文ではpublication handoffをOut of Scopeにしています。

    publicationの実際の責務分離はすでに次の形です。

    #2237:
      prepare-only
      public-safe proposal / PublishRequestを生成
      mutationしない
    
    Human:
      明示承認
    
    #2238:
      controlled publisher
      authorization検証
      Issue comment投稿
      readback
      idempotency / optimistic concurrency
    

    この分離は#2237のOWNERレビューでも提示されています。

    したがって#2288のgoalは次へ縮小すべきです。

    goal_ref: >-
      agent_improvement_candidate/v1 に stable finding identity と
      versioned delta-evaluation representation contract を追加し、
      #2237 がdelta evaluationを生成し #2238が永続化できる
      schema boundaryを確定する

    publication handoffについては「本Issueが解消する」のではなく、#2237 -> human authorization -> #2238 の既存ownershipを変更しない、と明記します。


    P1 — baseline_signal / expected_signal が型なしではregressedを判定できない

    単なるstringや任意objectでは、次を決定できません。

    • 比較演算子
    • 単位
    • tolerance
    • 値が大きいほど良いか悪いか
    • qualitative / quantitativeの区別
    • baseline unavailable時の処理

    最低限、次のtyped unionが必要です。

    signal:
      signal_type: boolean | integer | number | enum | digest
      value: <typed value>
      unit: "<optional controlled unit>"
      comparator: eq | ne | lt | lte | gt | gte | present | absent
      worse_direction: higher | lower | different | not_applicable
      tolerance: "<optional number>"

    qualitative findingでは severity: info | low | medium | high | critical のようなclosed enumを使い、順位規則を固定する方が安全です。


    P1 — evidence fingerprint の対象が未定義

    evidence fingerprintについて、次が定義されていません。

    • raw bytesのhashか
    • parsed API objectのhashか
    • public projectionのhashか
    • URLを含めるか
    • timestampを含めるか
    • pagination順を含めるか
    • algorithm/version
    • arrayをsetとして扱うかsequenceとして扱うか

    JCSはobject propertyをsortしますが、array element orderは維持します。複数evidenceをsetとして扱うなら、JCSの前にstable keyでsortする規約が必要です。([RFCエディタ]2)

    また、evidence fingerprintはfinding identityに含めない方がよいです。新しい証跡が追加されただけで別findingになってしまうためです。identityは「何の問題か」、evidence fingerprintは「今回何を根拠に観測したか」と分離します。


    P1 — 現在のAC/VCは新契約を証明しない

    AC2

    「同一入力から同一IDになる」だけでは不十分です。

    必要なnegative test:

    • identity入力を変え、古いIDをコピーしたrecordを拒否
    • object key順の違いで同一ID
    • set扱いする配列の順序違いで同一ID
    • algorithm version違いで別namespace
    • run referenceやtimestampが変わっても同一finding ID
    • controlled subject/ruleが変われば別ID

    AC3

    5つのfixtureがschemaを通ることは「enumの5値を表現できる」証明であり、分類の正しさを証明しません。

    最低でも前述の判定表をfixture化し、indeterminate、recurrent + signal regressed、partial sourceでresolved拒否を含める必要があります。

    AC4

    既存テストファイル全体のPASSだけでは、candidate lifecycle graphが完全に不変とは限りません。ALLOWED_TRANSITIONS のexact mappingをassertする専用テストが必要です。

    AC5

    現在のVC:

    rg -c "raw_transcript" <schema>

    は不適切です。

    • matchなしの場合、ripgrepは通常exit 1を返すため、期待する「0件」がVC成功になりません。これはripgrepの仕様上の挙動です。([GitHub]5)
    • raw_transcriptという1語だけのblacklistであり、ADR 0007のallowlistモデルを証明しません
    • secret、PII、absolute path、private content、prompt injectionを検証しません
    • 現行schemaにもこのliteralはないため、変更前後の差を証明しません

    専用pytestへ置換すべきです。

    AC6

    rg -n "claim_class" <schema>

    ではproperty名の存在しか確認できません。ADR 0007の9値exact enumをassertする必要があります。ADRが定義するclaim class表には、code content、GitHub review系、issue intent、external fact、runtime behavior等の明示的なauthority modelがあります。

    AC7

    現行invalid fixtureは candidate_status: in_review がenum外だから失敗するだけです。新しいfinding contractの不変条件が壊れていても、このfixtureは失敗し続けます。

    新規invalid fixtureとして少なくとも以下が必要です。

    • partial finding envelope
    • malformed identity
    • copied/stale identity
    • invalid claim class
    • resolved with incomplete source coverage
    • classified without evidence or baseline
    • raw/free-text evidence
    • current evaluationとhistory不整合

    AC8

    「旧fixtureがvalid」はmigrationではなくbackward compatibilityです。legacy recordをdelta evaluatorがどう扱うかまで検証してください。

    なお、既存refinementで許可されたbare command形式を維持し、grepではなく次のようなpytestへ集約するのが妥当です。

    uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_finding_identity.py -v
    uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_delta_evaluation_contract.py -v
    uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_candidate_migration.py -v
    uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_public_safe_evidence_refs.py -v

    推奨する修正後契約

    scope_decisions:
      candidate_finding_cardinality: one_to_one
      candidate_id_role: lifecycle_record_identity
      finding_identity_role: cross_run_semantic_identity
    
      legacy_behavior:
        existing_record_remains_valid: true
        automatic_backfill: forbidden
        delta_capability_without_finding_contract: unavailable
    
      finding_identity:
        version: finding-identity/v1
        algorithm: sha256-jcs-v1
        excludes:
          - title
          - description
          - source_run_ref
          - base_sha
          - source_set_digest
          - timestamps
          - evidence_refs
          - evidence_fingerprints
    
      delta_evaluation:
        calculation_owner: "#2237"
        persistence_owner: "#2238"
        security_and_redaction_owner: "#2239"
        indeterminate_is_not_resolved: true
        source_coverage_required_for_resolution: complete
    
      publication:
        schema_issue_owner: false
        prepare_owner: "#2237"
        authorization_owner: human
        controlled_publisher_owner: "#2238"

    修正後に最低限必要なAcceptance Criteria

    1. 既存candidate fixtureはvalidのままだが、finding_contractなしのrecordはdelta評価不可として識別される。

    2. finding_contractが存在する場合、identity、claim class、evaluation historyがall-or-noneで必須になる。

    3. finding identityの入力集合、canonicalization、algorithm、namespace/versionがnormativeに固定される。

    4. validatorがfinding identityを再計算し、stale・copied・fabricated IDを拒否する。

    5. candidate_id と finding_identity の役割、1:1 cardinality、origin/current run referenceの区別が固定される。

    6. claim class enumがADR 0007のexact 9値と一致する。

    7. 5状態の判定表、状態のprecedence、partial/unavailable時のindeterminate処理が固定される。

    8. recurrentとregressedを同時に表現できるよう、presenceとsignalの軸が分離される。

    9. evidence referenceはtyped public-safe projectionに限定され、raw textやraw transcriptを受け付けない。

    10. candidate lifecycleの既存8状態とexact transition graphが一切変更されていないことを専用テストで証明する。

    11. legacy recordにidentityを自動生成しないmigration policyがテストされる。

    12. 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237、実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238、#2239のconsumer contractと責務が同期される。


    推奨アクション

    #2288は実装へ進めず、まず本文を reframe_in_place してください。修正順序は次です。

    1. Machine-Readable Contractからpublication handoff完了の過大主張を除去する。
    2. finding_contract versioned envelope、identity algorithm、1:1 cardinality、legacy modeを固定する。
    3. delta判定表、indeterminate、presence/signal分離、event historyを固定する。
    4. value-level safetyの所有者を#2239へ戻し、#2288はtyped public-safe referenceまでに限定する。
    5. AC/VCを専用pytestへ全面置換する。
    6. #2237をdelta計算producer、#2238をevent persistence、#2239をsecurity/e2e consumerとして同期する。
    7. その後、freshな issue-contract-review を実行し、現在の missing_go を解消する。

    現在の契約は「schema field追加Issue」としては実装可能に見えますが、親ゴールである継続的delta evaluationの正本としては不十分です。REQUEST_CHANGES / blocked / reframe_in_place が妥当です。

  5. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告

    termination_reason: approved

    OWNER anchor comment(issuecomment-5376621173、REQUEST_CHANGES、recommended_disposition: reframe_in_place)で指摘された8件の blocking findings を反映して Issue 本文を全面 reframe し、issue-refinement-loop の Step 2 review(root_review_pipeline)で VERDICT: approve(BLOCKERS: 0)を取得した。

    Iteration 経緯

    1. investigation: codebase-investigator により anchor comment の技術的主張(finding_identity 未定義、source_set_digest の idempotency 限定用途、ADR 0007、直前 approve が VC 修正のみだった点、issue-contract-review 未実行、VC が意味論を証明していない点、child 実装: agent-retrospective の Orchestrator Skill と retrospective-runtime-observer・retrospective-evaluator SubAgent を実装する #2237/実装: agent-retrospective の run 永続化と agent_retro_index/v1 統合を実装する #2238 の前提関係)を fact-check し、7件 SUPPORTED / 1件 INCONCLUSIVE と判定。
    2. iteration 1 (rewrite): issue-editor が本文を全面 reframe(FINDING_IDENTITY_V1 typed key契約、candidate:finding=1:1 cardinality、5軸 delta 判定表、indeterminate扱い、legacy migration方針、public safety scope 切り分け、publication handoff scope 縮小、VCのpytest全面置換)。→ review: needs-fix(3 blockers: 主観表現 \bimproved?\b、pytest exit5×2)。
    3. iteration 2 (rewrite): 主観表現を除去し、pytest VC を -k フィルタから :: node-id 形式に修正。→ review: needs-fix(2 blockers: VCP_EXISTING_FILE_MISSIN — 既存ファイルへの新規テスト関数参照が非正規形状)。
    4. iteration 3 (rewrite): 該当2 VC を未作成の新規テストファイル参照に修正(test_candidate_status_transitions.py::...、test_claim_class_enum_contract.py::...、対応する Allowed Paths 追加)。→ review: approve(BLOCKERS: 0)。

    Final Gate

    ## Verification Commands セクションを実際に検証し status: go を得た通常経路(Final Gate 成功)。

    • REVIEWED_BODY_SHA256: sha256:cadf58b82adaf61ae4be1c35615fa4c752347fb1ae330fabda1fee1688960ae8
    • deterministic_checks: C1–C13 すべて pass または n/a

    Non-blocking Improvement(未反映・情報提供のみ)

    • scope_cvs_in_scope_mismatch(jaccard 0.292 < 0.3、severity: warning)— Current Validated Scope と ## In Scope のトークン一致率が低い。non-blocking のため本 loop では未反映。必要であれば別途 ## Background / Scope Delta への追記を検討。

    LOOP_HANDOFF_RESULT_V1:
      status: blocked
      routing_action: blocked
      contract_review:
        status: blocked
        gate_result: missing_go
        latest_comment_url: null
        generated_at: null
        body_sha256: null
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "本 loop はラベル同期を実行していない"
      auto_fixes:
        result: human_judgment_required
        required: []
        skipped: []
      blockers:
        - kind: contract_review_not_run
          description: >-
            issue-contract-review が未実行のため gate_result は missing_go。
            review-issue(本loop)のcontract品質ゲートはapproveだが、
            impl-review-loopへのhandoff前にissue-contract-reviewを実行して
            fresh go を取得すること。
      permissions:
        unavailable: []
      generated_at: "2026-08-22T00:17:52Z"
  6. self-assigned this
    on Aug 22, 2026
  7. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-22)

    Verification Commands 結果(Issue 本文記載どおり実行、全 PASS)

    # AC1
    $ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_validate_retrospective_schema.py -k test_candidate_valid_fixture_passes_schema_validation -v
    1 passed
    
    # AC2
    $ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_finding_identity.py -v
    14 passed
    
    # AC3
    $ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_delta_evaluation_contract.py -v
    23 passed
    
    # AC4
    $ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_candidate_status_transitions.py::test_candidate_status_allowed_transitions_exact_mapping_unchanged -v
    1 passed
    
    # AC5
    $ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_public_safe_evidence_refs.py -v
    15 passed
    
    # AC6
    $ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_claim_class_enum_contract.py::test_claim_class_exact_enum_matches_adr_0007 -v
    1 passed
    
    # AC7
    $ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_validate_retrospective_schema.py -k "test_candidate_invalid_fixture_fails_schema_validation or test_finding_contract_invalid_fixtures_fail_schema_validation" -v
    9 passed
    
    # AC8
    $ uv run pytest .claude/skills/agent-retrospective/scripts/tests/test_candidate_migration.py -v
    6 passed
    

    追加検証

    $ uv run pytest .claude/skills/agent-retrospective/scripts/tests/ -q
    187 passed  (既存 47 + 新規 140)
    
    $ uv run --locked ruff check .claude/skills/agent-retrospective/scripts
    All checks passed!
    
    • 既存 legacy fixture(agent_improvement_candidate_v1.valid.json)は finding_contract なしで引き続き valid(AC1)
    • 既存 invalid fixture(agent_improvement_candidate_v1.invalid.json)は引き続き invalid(AC7 回帰なし)
    • candidate_status の ALLOWED_TRANSITIONS exact mapping は変更なし(AC4)

    Runtime Verification Applicability

    decision: not_applicable(Issue 本文記載どおり)。schema/validator/fixture/pytest によるスキーマ構造検証のみで完結しており、runtime AC/VC/証跡は対象外です。

    後続

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent/implementerenhancementphase/implementation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions