Skip to content

実装: CONTEXT_PROVENANCE_V1 を導入し human-requested / agent-inferred / repo-evidence を分離する #1011

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "issue-refinement-loop で human-requested scope と agent-inferred scope を CONTEXT_PROVENANCE_V1 schema で分離し、scope_signal_guard の誤停止を解消する"
change_kind: mixed

Parent Issue

none(単独改善)

Parent Goal Ref

  • Goal: preflight / planner / loop state がコンテキスト項目ごとに「誰が・どこで・何として渡したか」を保持し、human-requested scope は作業要求・agent-inferred scope は guard 対象として routing できる状態にする
  • Desired Destination: run_refinement_preflight.py artifact に CONTEXT_PROVENANCE_V1 が含まれ、scope_signal_guard が agent_inferred / ambiguous の scope delta だけを hard stop 対象にする

Current Validated Scope

  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py に CONTEXT_PROVENANCE_V1 生成ロジックを追加
  • .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py の planner input に context_provenance を渡す口を追加
  • .claude/skills/issue-refinement-loop/schemas/ に context_provenance_v1.schema.json を追加
  • .claude/skills/issue-refinement-loop/references/ のドキュメント(anchor-comment-handling.md / scope-signal-guard.md 等)を schema と整合させる
  • .claude/skills/issue-refinement-loop/tests/ に AC 対応テストを追加
  • docs/dev/agent-skill-boundaries.md に CONTEXT_PROVENANCE_V1 schema 正本を記載

Remaining Parent Gaps

  • anchor comment の trusted author 判定を routing に使う修正(follow-up: fix(issue-refinement-loop): trusted human anchor scope amendment を AI scope creep と分離する)
  • loop state への autonomy_mode 追加(follow-up: fix(issue-refinement-loop): no-human-approval autonomy mode を loop state routing に明示する)
  • anchor comment schema と docs の整合(follow-up: fix(issue-refinement-loop): anchor_comment schema を docs の Required flow と一致させる)

Outcome

CONTEXT_PROVENANCE_V1 schema が run_refinement_preflight.py artifact に含まれ、anchor comment 由来の REQUEST_CHANGES は origin: trusted_anchor_comment / actionability: requirement、AI が自発的に追加した scope 拡張は origin: agent_inferred / actionability: hypothesis として分類されることを pytest が検証できる状態になる。

In Scope

  • CONTEXT_PROVENANCE_V1 YAML schema の定義(kind / origin / source_ref / source_author_trust / actionability / text_sha256 フィールド)
  • run_refinement_preflight.py の artifact に context_provenance セクションを追加
  • anchor comment 由来エントリの origin: trusted_anchor_comment / actionability: requirement への分類
  • agent inferred scope の origin: agent_inferred / actionability: hypothesis への分類
  • scope_signal_guard が agent_inferred / ambiguous の scope delta だけを hard stop 対象にするロジック更新
  • preflight stdout が raw body / raw comments を出さず artifact のみに保存する境界の維持・テスト化
  • docs/dev/agent-skill-boundaries.md への schema 正本記載

Out of Scope

  • anchor comment の trusted author 判定の実装(follow-up Issue 対応)
  • LOOP_STATE_V1 の autonomy_mode フィールド追加(follow-up Issue 対応)
  • anchor comment schema のフィールド拡張(follow-up Issue 対応)
  • decide_next_loop_action.py の routing 変更(follow-up Issue の依存先)
  • CONTEXT_PROVENANCE_V1 を live preflight 以外の runtime path に組み込む処理

Acceptance Criteria

  • AC1: run_refinement_preflight.py が生成する artifact に context_provenance キーが含まれ、CONTEXT_PROVENANCE_V1 schema に通ること
  • AC2: anchor comment 由来の REQUEST_CHANGES エントリが origin: trusted_anchor_comment かつ actionability: requirement に分類されること(fixture ベースのテスト)
  • AC3: codebase-investigator / issue-reviewer が提案した追加 scope エントリが origin: agent_inferred かつ actionability: hypothesis に分類されること(fixture ベースのテスト)
  • AC4: scope_signal_guard が agent_inferred / ambiguous の scope delta だけを hard stop 対象にし、trusted_anchor_comment 由来エントリはスルーすること(fixture ベースのテスト)
  • AC5: preflight stdout に raw anchor comment body / raw issue body が含まれないこと(artifact のみに保存されること)を検証するテストが通ること

Verification Commands

# AC1
# baseline-expect: fail
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_context_provenance_v1.py -v -k "test_artifact_contains_context_provenance_key"

# AC2
# baseline-expect: fail
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_context_provenance_v1.py -v -k "test_anchor_comment_classified_as_trusted"

# AC3
# baseline-expect: fail
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_context_provenance_v1.py -v -k "test_agent_inferred_scope_classified_as_hypothesis"

# AC4
# baseline-expect: fail
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_context_provenance_v1.py -v -k "test_scope_signal_guard_skips_trusted_anchor"

# AC5
# baseline-expect: fail
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_context_provenance_v1.py -v -k "test_preflight_stdout_excludes_raw_body"

Allowed Paths

  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
  • .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py
  • .claude/skills/issue-refinement-loop/schemas/
  • .claude/skills/issue-refinement-loop/references/
  • .claude/skills/issue-refinement-loop/tests/
  • docs/dev/workflows/issue-refinement-loop-design.md
  • docs/dev/agent-skill-boundaries.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Python(schema validation / pytest fixture 作成)
  • YAML schema 設計

Scope Delta(任意)

N/A

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Jun 19, 2026
  2. squne121 commented on Jul 4, 2026

    @squne121
    OwnerAuthor

    Closed as superseded by #1323。#1323 の本文改訂(OWNER 判断 2026-07-04, #1323 (comment) への回答)により、本 Issue が目的とした CONTEXT_PROVENANCE_V1(human-requested / agent-inferred の provenance 分離)は #1323 の scope_delta_authority.provenance に統合された。

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions