Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
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: mixedParent Issue
none(単独改善)
Parent Goal Ref
- Goal: preflight / planner / loop state がコンテキスト項目ごとに「誰が・どこで・何として渡したか」を保持し、human-requested scope は作業要求・agent-inferred scope は guard 対象として routing できる状態にする
- Desired Destination:
run_refinement_preflight.pyartifact に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_V1schema 正本を記載
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_V1YAML 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_V1schema に通ること - 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.mddocs/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
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Jul 4, 2026
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 に統合された。
feat: Refinement Loop の scope guard を人間レビュー由来の契約更新として自動反映できるようにする (#1323