Skip to content

実装: issue-refinement-loop の deterministic planner/checker script を抽出する #392

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#391"
goal_ref: "issue-refinement-loop の prose 判定を script-first planner/checker に移し、LOOP_STATE と JSON evidence を SSOT にする"
change_kind: workflow

Parent Issue

#391

Parent Goal Ref

  • Goal: issue-refinement-loop の prose 判定を script-first planner/checker に集約し、LOOP_STATE と JSON evidence を SSOT にして SKILL.md を thin entrypoint 化する準備を整える。
  • Desired Destination: plan_refinement_loop.py + REFINEMENT_LOOP_PLAN_V1 JSON Schema + fixture matrix が揃い、SKILL.md は planner 出力を consume するだけになる。

Depends On

Current Validated Scope

  • .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py を新規追加し、Issue body / comments / known_context から REFINEMENT_LOOP_PLAN_V1 JSON を stdout 出力する。
  • .claude/skills/issue-refinement-loop/schemas/refinement_loop_plan_v1.json を新規追加し、output を JSON Schema (Draft 2020-12) で validation できるようにする。
  • .claude/skills/issue-refinement-loop/fixtures/ 配下に fixture matrix を配置し、.claude/skills/issue-refinement-loop/tests/ に golden JSON 一致テストを追加する。
  • .claude/skills/issue-refinement-loop/SKILL.md には planner 実行・schema validation・fail_closed handling・SubAgent routing の最小 wiring のみ追記する。

Remaining Parent Gaps

Required Skills

  • Python 3 / jsonschema (Draft 2020-12, iter_errors)
  • pytest fixture-driven test 設計
  • markdown parsing(fenced code / markdown table / Japanese body を含むエッジケース処理)
  • gh CLI(read-only な Issue / comment 取得)
  • 既存 plan_issue_scope_rollup.py の script-first 規約への準拠

Background

Outcome

  • .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py が存在し、Issue body / comments / known context から REFINEMENT_LOOP_PLAN_V1 JSON を stdout に決定論的に出力する。
  • output は同梱 JSON Schema で validation でき、すべての decision に reason_code / evidence_spans / confidence / fail_closed が付与される。
  • SKILL.md はこの JSON を consume し、investigation_policy / web_research_policy / scope signal / follow-up candidate を prose で再判定しない。

REFINEMENT_LOOP_PLAN_V1 Contract

planner の入出力 schema を本 Issue の SSOT として固定する。実装はこの contract に厳密に従い、揺らぎがある場合は fail_closed.required = true とする。

Input

REFINEMENT_LOOP_PLANNER_INPUT_V1:
  schema_version: refinement_loop_planner_input/v1
  issue:
    number: int
    title: string
    body: string                # raw markdown
    labels: string[]
  comments:                     # nullable
    - id: string
      author_login: string
      author_association: enum  # OWNER|MEMBER|COLLABORATOR|CONTRIBUTOR|NONE
      body: string
      created_at: iso8601
      updated_at: iso8601
  known_context:                # nullable — orchestrator が把握済みの LOOP_STATE 抜粋
    anchor_comment_url: string|null
    parent_mode: enum|null      # delivery-rollup|single|null
    closure_mode: enum|null     # child-complete|self|null

Output

REFINEMENT_LOOP_PLAN_V1:
  $schema: "https://json-schema.org/draft/2020-12/schema"
  schema_version: refinement_loop_plan/v1
  source:
    issue_number: int
    issue_body_sha256: string         # sha256(issue.body, utf-8)
    comments_sha256: string|null      # sha256(canonical_json(comments))
    known_context_sha256: string|null
    generated_at: iso8601
  decisions:
    investigation_policy:
      required: boolean
      reason_code: InvestigationReason
      target_paths: string[]          # stable-sorted, deduped
      repo_claims: string[]
      evidence_spans: EvidenceSpan[]
      confidence: enum                # deterministic|unknown
    web_research_policy:
      required: boolean
      reason_code: WebResearchReason
      critical_external_claims: ExternalClaim[]
      evidence_spans: EvidenceSpan[]
      confidence: enum                # deterministic|unknown
    scope_signal_guard:
      triggered: boolean
      reason_code: ScopeSignalReason
      excluded_by_anchor_reframe: boolean
      evidence_spans: EvidenceSpan[]
    delivery_rollup:
      applicable: boolean
      unmaterialized_slots: UnmaterializedSlot[]
      evidence_spans: EvidenceSpan[]
    follow_up_materialization:
      candidates: FollowUpCandidate[]
  fail_closed:
    required: boolean
    reason_codes: FailClosedReason[]
    human_message: string             # 単一行・stdout JSON 外には書かない

EvidenceSpan:
  source: enum                        # issue_body|comment|known_context
  source_ref: string|null             # comment_id 等。issue_body は null
  start_line: int                     # 1-indexed
  end_line: int
  text_sha256: string                 # sha256(該当 span の生文字列)

ExternalClaim:
  claim: string
  affects: enum                       # Outcome|InScope|AC|VC|StopCondition
  source_hint: string|null

UnmaterializedSlot:
  child_title_hint: string
  marker: enum                        # 未起票|unmaterialized|TBD
  body_line: int

FollowUpCandidate:
  dedupe_key: string                  # planner が決定論的に算出
  summary: string
  source_evidence: EvidenceSpan

Reason Code Enums

InvestigationReason:
  - target_paths_present
  - repo_fact_claim_in_outcome_or_ac_or_vc
  - same_file_scope_rollup_conflict
  - reviewer_requested_repo_fact_check
  - anchor_comment_requires_fact_check
  - no_repo_fact_claim                # required=false
  - unknown_input_schema              # fail_closed

WebResearchReason:
  - critical_external_spec_claim
  - human_requested_web_verification
  - current_cli_api_auth_or_migration_behavior
  - no_critical_external_claim        # required=false
  - unknown_input_schema              # fail_closed

ScopeSignalReason:
  - new_in_scope_area
  - new_allowed_path_layer
  - new_unverifiable_ac
  - anchor_reframe_exclusion          # triggered=false の正当化用
  - no_scope_signal

FailClosedReason:
  - malformed_machine_readable_contract
  - missing_required_section
  - ambiguous_scope_signal
  - unknown_input_schema
  - planner_internal_error

Determinism / Output Rules

  • stdout には JSON のみを出力し、prose / markdown / log を混ぜない。log は stderr。
  • target_paths / repo_claims / critical_external_claims / candidates は stable sort + dedupe。
  • 同一入力に対し issue_body_sha256 + output JSON が完全一致すること(再実行 idempotent)。
  • exit code: 0 = success, 2 = invalid input schema, 3 = planner internal error。fail_closed.required = true でも JSON は stdout に出した上で exit 0。

Responsibility Boundary(planner が扱わないもの)

planner はポリシー導出のみを所有する。以下は明示的に Out of Scope / Forbidden:

In Scope

  • plan_refinement_loop.py の新規追加(read-only CLI、plan_issue_scope_rollup.py と同等の品質水準)
  • 上記 REFINEMENT_LOOP_PLAN_V1 の JSON Schema 定義ファイル同梱(schemas/refinement_loop_plan_v1.json 相当)
  • 以下の判定を script-first 化する:
    • investigation_policy.codebase_required
    • web_research_policy.required
    • anchor_comment_url 明示 / 未指定時の扱い
    • delivery-rollup parent の未起票 child slot 検出
    • feedback_update_required / reframe_in_place 時の AC/VC 反映確認対象抽出
    • scope signal guard の対象 / 除外判定(anchor reframe 由来は除外)
    • follow-up materialization candidates の抽出
  • fixture matrix(下記)を網羅する pytest を追加
  • SKILL.md には planner 呼び出し・JSON schema validation・fail_closed handling・SubAgent routing のみを wiring(個別 prose 再判定を残さない)

Fixture Matrix(必須)

fixtures/ 配下に以下を全件配置し、各 fixture について golden JSON と完全一致する pytest を用意する:

positive:
  - repo_path_in_outcome.md            # target_paths 抽出
  - critical_external_claim_in_vc.md   # web_research_policy=true
  - delivery_rollup_unmaterialized.md  # (未起票) slot 検出
  - anchor_reframe_exclusion.md        # scope signal を anchor reframe で除外
negative:
  - no_repo_fact_claim.md
  - no_critical_external_claim.md
false_positive:
  - path_only_in_fenced_code.md        # コードブロック内 path を target_paths にしない
false_negative:
  - japanese_body.md                   # 日本語のみで repo_fact を主張
malformed:
  - broken_machine_readable_contract.md
  - missing_outcome_section.md
partial:
  - missing_comments.md                # comments_sha256: null
formatting:
  - markdown_table_body.md
  - fenced_code_in_outcome.md

Out of Scope

Acceptance Criteria

  • AC1: plan_refinement_loop.py が存在し REFINEMENT_LOOP_PLAN_V1 JSON を stdout に出力する。stdout には markdown / prose を混ぜない。
  • AC2: 同梱 JSON Schema(schemas/refinement_loop_plan_v1.json 相当)で output が validation に通り、jsonschema の iter_errors ベースで全 error を収集できるテストがある。
  • AC3: investigation_policy / web_research_policy の required / reason_code / confidence / evidence_spans が fixture matrix(positive / negative / false-positive / false-negative / malformed / partial / formatting)で決定論的に検証され、各 fixture で stdout JSON が golden output と完全一致する。
  • AC4: delivery-rollup parent の (未起票) / unmaterialized slot を decisions.delivery_rollup.unmaterialized_slots に出力できる。
  • AC5: feedback_update_required / reframe_in_place 時の AC/VC 反映確認対象を decisions.scope_signal_guard および follow_up_materialization に出力できる。anchor reframe 由来の scope 拡大は excluded_by_anchor_reframe: true で除外される。
  • AC6: follow-up materialization candidates を stable な dedupe_key 付きで decisions.follow_up_materialization.candidates に出力できる。
  • AC7: SKILL.md は planner 実行・JSON schema validation・fail_closed.required=true 時の human_escalation・SubAgent routing のみを記述する。investigation_policy / web_research_policy / scope signal / follow-up candidate の prose 再判定を残さない。planner failure / fail_closed.required=true の場合は human_escalation へ進み、SKILL.md 側で推測補完しない。
  • AC8: evidence_spans は source ∈ {issue_body, comment, known_context} のみを取り、repo file evidence(path / commit_sha / permalink 等)を表現しない(REPO_EVIDENCE_REF_V1 / 実装: gemini-cli-headless-delegation に REPO_EVIDENCE_REF_V1 を追加し file evidence の commit_sha 固定・excerpt_sha256 検証を SSOT 化する #248 への委譲を担保)。
  • AC9: planner output は同一入力に対し再実行で完全一致する(idempotent / stable ordering)。
  • AC10: malformed_machine_readable_contract / ambiguous_scope_signal / unknown_input_schema の fixture で fail_closed.required=true かつ対応する reason_codes が出る。
  • AC11: pytest / pnpm gate が PASS する。

Verification Commands

VC は baseline で deterministic に fail し、実装後に pass するように test -f / test -d をベースに構成する(token presence は pytest fixture で検証する)。

$ test -f .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py  # AC1
$ test -f .claude/skills/issue-refinement-loop/schemas/refinement_loop_plan_v1.json  # AC2
$ test -f .claude/skills/issue-refinement-loop/fixtures/golden/repo_path_in_outcome.json  # AC3
$ test -f .claude/skills/issue-refinement-loop/fixtures/positive/delivery_rollup_unmaterialized.md  # AC4
$ test -f .claude/skills/issue-refinement-loop/fixtures/positive/anchor_reframe_exclusion.md  # AC5
$ test -f .claude/skills/issue-refinement-loop/fixtures/positive/critical_external_claim_in_vc.md  # AC6
$ test -f .claude/skills/issue-refinement-loop/tests/test_skill_md_wiring.py  # AC7
$ test -f .claude/skills/issue-refinement-loop/tests/test_evidence_span_source.py  # AC8
$ test -f .claude/skills/issue-refinement-loop/tests/test_idempotent.py  # AC9
$ test -f .claude/skills/issue-refinement-loop/tests/test_fail_closed.py  # AC10
$ test -f .claude/skills/issue-refinement-loop/tests/test_plan_refinement_loop.py  # AC11

実装完了後の追加検証(VC ではなく impl-review-loop の test-runner が project gate として自動実行する):

  • uv run pytest .claude/skills/issue-refinement-loop/tests/ -v — 全 fixture / wiring / evidence_span / idempotent / fail_closed の合成テスト
  • pnpm typecheck && pnpm lint && pnpm test && pnpm build — 共通 project gate(本 Issue 由来の変更を含む repo 全体の non-regression 確認)

pytest 内では以下を assert する(VC ではなく test の内訳として明記):

  • test_skill_md_wiring.py: SKILL.md に planner 呼び出し / schema validation / fail_closed handling の wiring が存在し、investigation_policy.codebase_required = (true|false) 等の prose 再判定が残っていないこと(AC7)
  • test_evidence_span_source.py: planner 出力の evidence_spans[].source が issue_body|comment|known_context の enum に限定され、repo file evidence(commit_sha / permalink / excerpt_sha256)を扱わないこと(AC8)
  • test_idempotent.py: 同一入力に対し output JSON / issue_body_sha256 が完全一致(AC9)
  • test_fail_closed.py: malformed / missing_required_section / ambiguous_scope_signal / unknown_input_schema fixture で fail_closed.required=true と対応する reason_codes が出る(AC10)
  • 各 fixture について stdout JSON が fixtures/golden/<fixture>.json と完全一致(AC3)
  • 出力は schemas/refinement_loop_plan_v1.json の Draft 2020-12 validator で validate し、iter_errors で全 error を収集できる(AC2)

Allowed Paths

  • .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py
  • .claude/skills/issue-refinement-loop/schemas/refinement_loop_plan_v1.json
  • .claude/skills/issue-refinement-loop/tests/
  • .claude/skills/issue-refinement-loop/fixtures/
  • .claude/skills/issue-refinement-loop/references/refinement-loop-plan-output.md
  • .claude/skills/issue-refinement-loop/SKILL.md(最小 wiring のみ)

Stop Conditions

  • SKILL.md の大規模リライトが必要になった場合
  • SubAgent prompt の移動が必要になった場合
  • JSON schema を caller なしに複数案へ分岐させる必要が出た場合
  • WEB_RESEARCH_RESULT_V1 / REPO_EVIDENCE_REF_V1 schema を本 Issue で再定義する必要が出た場合
  • Gemini retry / fallback / grounding を planner 側で実装する必要が出た場合
  • Allowed Paths 外の変更が必要になった場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Runtime Verification Applicability

decision: not_applicable
reason: deterministic script と fixture test による workflow 判定。ゲーム runtime には影響しない。

Delivery Rule

Activity

  1. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES

    #392 の方向性は妥当です。#295 / PR #388 で investigation_policy / web_research_policy は LOOP_STATE 化されたものの、判定自体はまだ SKILL.md の prose / Step 0f に残っています。したがって plan_refinement_loop.py に deterministic planner を抽出する Phase 1 は必要です。

    ただし、現状の #392 は 親 #391 が Phase 1 前に要求している契約改訂を十分に吸収していません。#391 は #392 に対して、REFINEMENT_LOOP_PLAN_V1 の input/output schema、decision ごとの reason_code、evidence_spans、confidence、fail_closed、negative fixtures、malformed / Japanese / markdown table / fenced code fixture を明示要求しています。一方 #392 本文の AC/VC は rg marker と “script exists” に寄っており、deterministic planner の品質保証として不足しています。

    Blocker

    1. REFINEMENT_LOOP_PLAN_V1 が schema として固定されていない

    #392 は “schema の定義” を In Scope に入れていますが、本文に必須 field、enum、fail-closed 条件、hash 対象、line span の表現がありません。これでは実装者ごとに JSON 形状が揺れ、SKILL.md が “consume するだけ” になりません。

    最低限、#392 本文に以下を追加してください。

    REFINEMENT_LOOP_PLAN_V1:
      schema_version: refinement_loop_plan/v1
      source:
        issue_number: int
        issue_body_sha256: string
        comments_sha256: string|null
        known_context_sha256: string|null
        generated_at: iso8601
      decisions:
        investigation_policy:
          required: boolean
          reason_code: enum
          target_paths: string[]
          repo_claims: string[]
          evidence_spans: EvidenceSpan[]
          confidence: deterministic|unknown
        web_research_policy:
          required: boolean
          reason_code: enum
          critical_external_claims: ExternalClaim[]
          evidence_spans: EvidenceSpan[]
          confidence: deterministic|unknown
      fail_closed:
        required: boolean
        reason_codes: enum[]
        human_message: string

    JSON Schema を採用するなら $schema を明記し、テストでは schema 自体の検証と iter_errors による全 error 収集まで行うべきです。[jsonschema](https://python-jsonschema.readthedocs.io/en/stable/validate/) は Draft 2020-12 validator と schema check / iter_errors を提供しています。(jsonschema)

    2. 既存の deterministic script 品質に届いていない

    同ディレクトリには既に plan_issue_scope_rollup.py があり、read-only CLI、schema constants、exit code、input hash、confidence enum、signal enum を持つ script-first 実装になっています。さらに tests では false positive、Japanese annotation、security keyword 誤検知、current_issue missing などを fixture で潰しています。#392 もこの水準に合わせるべきです。

    #392 の AC は次のように強化してください。

    - AC: malformed issue body / missing comments / Japanese body / markdown table / fenced code / false-positive / false-negative fixtures がある
    - AC: 各 fixture で stdout JSON が golden output と完全一致する
    - AC: output は schema validation に通る
    - AC: ambiguous_scope_signal / unknown_input_schema は fail_closed.required=true になる
    - AC: stdout に markdown / prose を混ぜない
    - AC: output ordering が stable で、hash が deterministic

    3. evidence_spans が #248 と衝突する可能性がある

    #391 は #392 に evidence_spans を要求していますが、#248 は別途 REPO_EVIDENCE_REF_V1 を gemini-cli-headless-delegation 側の file evidence SSOT として定義する Issue です。#392 が独自に file evidence schema を作ると、Phase 3 / #394 の SubAgent-owned contract migration と衝突します。

    #392 の evidence_spans は、まず Issue body / comment / known_context の text span 限定にしてください。repo file evidence は REPO_EVIDENCE_REF_V1 が入るまで verification_status: inconclusive または external ref に留めるべきです。GitHub の branch URL は branch head 更新で内容が変わるため、file evidence を固定するなら commit ID を含む permalink が必要です。([GitHub Docs]2)

    4. web-researcher / Gemini retry の責務を planner に持ち込む余地がある

    #203 は「orchestrator に auth_error retry を持たせる」案でしたが、人間コメントにより責務配置が誤りと判断され、not planned で close されています。#247 では retry / fallback / grounding quality gate を gemini-cli-headless-delegation と web-researcher 側に集約し、issue-refinement-loop は WEB_RESEARCH_RESULT_V1 の consumer 境界に留める設計になっています。

    したがって #392 の planner は、次だけを出すべきです。

    web_research_policy:
      required: true|false
      reason_code: critical_external_spec_claim|human_requested_web_verification|current_cli_api_auth_behavior|no_critical_external_claim|unknown
      critical_external_claims: [...]

    以下は Out of Scope / forbidden と明記してください。

    - Gemini retry_count
    - fallback query
    - raw grounding state
    - direct_web / direct_cli の選択
    - WEB_RESEARCH_RESULT_V1 schema の再定義

    現行 SKILL.md も Step 1b で WEB_RESEARCH_RESULT_V1 を opaque に扱い、schema SSOT を web-researcher.md 側に置く境界を持っています。

    5. SKILL.md wiring の “再解釈禁止” が弱い

    #392 は「SKILL.md は JSON を consume し、個別 prose 条件を再解釈しない」と書いていますが、AC7 は plan_refinement_loop.py|REFINEMENT_LOOP_PLAN_V1 の rg だけです。これは弱いです。

    AC7 は次のように変えるべきです。

    AC7:
    SKILL.md は planner 実行、JSON schema validation、fail_closed handling、SubAgent routing のみを記述する。
    `investigation_policy` / `web_research_policy` / scope signal / follow-up candidate の prose 再判定を残さない。
    planner failure または fail_closed.required=true の場合は human_escalation へ進み、SKILL.md 側で推測補完しない。

    Claude Code の skills docs は、supporting files へ詳細を移し SKILL.md を簡潔に保つこと、SKILL.md は 500 行未満を推奨すること、読み込まれた skill content が context に残ることを明記しています。#392 の wiring は最小化しないと、Phase 2 #393 の thin entrypoint 化をさらに難しくします。([Claude Code]3) ([Claude Code]3)

    投稿用レビュー案

    REQUEST_CHANGES
    
    #392 の方向性は正しいです。#295 / PR #388 で `investigation_policy` / `web_research_policy` は `LOOP_STATE` 化されましたが、判定自体はまだ SKILL.md prose / Step 0f に残っているため、Phase 1 として deterministic planner を切り出す価値はあります。
    
    ただし、現 contract のままでは実装に入るべきではありません。
    
    Blocker:
    
    1. #391 が Phase 1 前に要求している #392 向け amendment が本文に反映されていません。
       `REFINEMENT_LOOP_PLAN_V1` の input/output schema、decision ごとの `reason_code`、`evidence_spans`、`confidence`、`fail_closed` を #392 本文に明記してください。
    
    2. AC/VC が `rg` marker 中心で、deterministic planner の品質を保証できません。
       malformed body / missing comments / Japanese body / markdown table / fenced code / false-positive / false-negative fixture を必須化し、golden JSON と完全一致する pytest を AC にしてください。
    
    3. `evidence_spans` の範囲が曖昧です。
       #248 の `REPO_EVIDENCE_REF_V1` と競合しないよう、#392 の evidence span は issue body / comments / known_context の text span に限定するか、repo file evidence は明示的に out of scope / inconclusive にしてください。
    
    4. web-researcher / Gemini retry / fallback の責務を planner に持ち込まないでください。
       #203 は責務配置ミスで not planned、#247 は retry / fallback を `web-researcher` / `gemini-cli-headless-delegation` 側へ集約しています。
       #392 は `web_research_policy.required` と `critical_external_claims` だけを出し、`retry_count` / fallback query / raw grounding state / WEB_RESEARCH_RESULT_V1 schema を扱わないことを明記してください。
    
    5. SKILL.md wiring の AC が弱いです。
       SKILL.md は planner 実行・schema validation・fail_closed handling・SubAgent routing のみを行い、planner JSON を prose で再解釈しないことを AC にしてください。
    
    この修正なしに実装すると、`plan_refinement_loop.py` は deterministic planner ではなく、SKILL.md prose を Python に移植した巨大 heuristic script になります。Phase 1 の目的は「判断の SSOT を JSON contract + fixture-tested script に移すこと」なので、まず contract を固定してから実装してください。

    最小修正セット

    #392 に最低限追加すべきものは以下です。

    ## REFINEMENT_LOOP_PLAN_V1 Contract
    
    - input schema
    - output schema
    - reason_code enum
    - evidence_spans definition
    - confidence enum
    - fail_closed reason enum
    - stable ordering rule
    - stdout JSON only rule
    
    ## Fixture Matrix
    
    - positive: repo pathあり
    - positive: critical external claimあり
    - positive: delivery-rollup `(未起票)` slotあり
    - positive: anchor comment reframe exclusion
    - negative: no repo fact claim
    - negative: no critical external claim
    - false-positive: code block内だけに path 文字列
    - false-negative: Japanese body
    - malformed: broken machine-readable contract
    - partial: missing comments
    - markdown table
    - fenced code
    
    ## Responsibility Boundary
    
    - planner owns policy derivation only
    - web-researcher owns retry / fallback / WEB_RESEARCH_RESULT_V1
    - gemini-cli-headless-delegation owns Gemini retry / grounding route
    - repo file evidence schema is delegated to REPO_EVIDENCE_REF_V1 / #248

    この修正後なら、#392 は Phase 1 として実装可能です。現状は contract-review で needs-fix が妥当です。

  2. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: 完了 (2026-05-25T14:12:45Z)

  3. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    Contract Snapshot (2026-05-25T14:17:51Z)

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: 2026-05-25T14:17:51Z
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/392
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: pass
        vc_preflight:
          passed: true
          vc_failed_as_expected: 11
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
        ac_verifiability: pass
        product_spec_check:
          applicability: not_applicable
          decision: pass
          triggers:
            docs_product_allowed_paths: false
            tasks_md_mentioned: false
            specify_artifact_mentioned: false
            generated_task_mentioned: false
            product_spec_context_present: false
        worktree_branch_collision: clear
      next_action: implement_issue
      blocked_reasons: []
      warnings: []
    • Outcome: issue-refinement-loop の prose 判定を deterministic planner (plan_refinement_loop.py) + REFINEMENT_LOOP_PLAN_V1 JSON に切り出し、SKILL.md は consume するだけにする
    • Acceptance Criteria: AC1–AC11(本文参照)
    • Verification Commands: test -f ベースの 11 件 + post-impl で uv run pytest / pnpm gate
    • Allowed Paths: .claude/skills/issue-refinement-loop/{scripts,schemas,tests,fixtures,references}/, SKILL.md
    • Worktree: .claude/worktrees/issue-392-extract-refinement-deterministic-planner
    • Branch: worktree-issue-392-extract-refinement-deterministic-planner
    • VC preflight: baseline fail = 11, 想定外 pass = 0, 実行不可 = 0
  4. added a commit that references this issue on May 25, 2026
  5. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-05-25T14:34:49Z)

    Verification 結果

    Gate Status
    typecheck pass
    lint pass
    test (vitest) pass (25)
    build pass
    python-test (CI) pass
    pytest (local) pass (68/68)
    AC1–AC11 11/11 PASS

    主な実装

    • .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py — REFINEMENT_LOOP_PLAN_V1 出力 deterministic CLI
    • .claude/skills/issue-refinement-loop/schemas/refinement_loop_plan_v1.json — Draft 2020-12 JSON Schema
    • .claude/skills/issue-refinement-loop/fixtures/ — 13 fixture + golden JSON
    • .claude/skills/issue-refinement-loop/tests/ — 5 test module(68 tests)
    • .claude/skills/issue-refinement-loop/SKILL.md — Step 0f に最小 wiring 追記(thin entrypoint 化は 実装: issue-refinement-loop SKILL.md を thin entrypoint + references 構成へ分割する #393)
    • .claude/skills/issue-refinement-loop/references/refinement-loop-plan-output.md — consumer guide
    • uv.lock — jsonschema 依存追加に伴う再生成(CI fix)

    Responsibility Boundary 遵守

    次アクション

  6. added 2 commits that reference this issue on May 25, 2026
  7. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了(2 周目)(2026-05-25T15:04:49Z)

    2 周目で対応した OWNER REQUEST_CHANGES の 9 blocker

    1. B1 golden 完全一致: 全 fixture parametrize で stdout JSON と golden JSON を完全比較
    2. B2 idempotency: input top-level に now: iso8601 を追加して generated_at を deterministic 化
    3. B3 fail_closed schema 整合: fail_closed 時にも全 decision object を unknown_input_schema / unknown で埋める形に変更、Draft202012Validator + FormatChecker で全 fixture 検証
    4. B4 comments/known_context 利用: _extract_critical_external_claims を comments まで走査するよう実装、comment_requests_web_verification.md / known_context_anchor_reframe.md fixture 追加
    5. B5 scope_signal_guard 実装: _detect_scope_signals で new_unverifiable_ac / new_allowed_path_layer / new_in_scope_area を precedence 付きで検出。anchor reframe コンテキストは excluded_by_anchor_reframe=true で抑制。known_context.classification ∈ {feedback_update_required, reframe_in_place} を尊重
    6. B6 fenced code 除外: repo_claims 抽出にも _remove_fenced_code を適用、Allowed Paths セクションも target_paths 抽出対象に追加
    7. B7 web_research keyword 絞り込み: CRITICAL_EXTERNAL_KEYWORDS を 5 個 (official / api / cli / auth / migration) に縮小、documentation / version 等を除外、claims を stable sort + dedupe
    8. B8 CI integration: .github/workflows/ci.yml の python-test job に uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ -q を追加
    9. B9 SKILL.md wiring 実効テスト: test_skill_md_does_not_repedge_investigation_logic が Step 0f を heading-based slice し true_if_any / false_only_if / policy_derivation: 等の forbidden fragments を negative assert。SKILL.md Step 0f から旧 prose 真理表を削除し planner 出力 consume の最小 wiring に置換

    Verification

    Gate Status
    typecheck pass
    lint pass
    test (vitest, 54) pass
    build pass
    python-test (CI) pass
    pytest (local, 81) pass

    関連 commit

    次アクション

  8. added a commit that references this issue on May 25, 2026
  9. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-05-25T21:45:15Z)

    POST_MERGE_CLEANUP_REPORT_V1:
      status: ok
      generated_at: 2026-05-25T21:45:15Z
      generated_by: post-merge-cleanup-worker
      human_review_required: false
      cleaned_branches:
        - worktree-issue-392-extract-refinement-deterministic-planner
      cleaned_worktrees:
        - .claude/worktrees/issue-392-extract-refinement-deterministic-planner
      unresolved_cleanup_items: []
      parent_issue_status:
        parent_issue_number: 391
        all_children_closed: false
        recommended_action: keep_open
      superseded_prs: []
      follow_up_issue_requests: []
      stash_restored: n/a
      stash_entry_ref: null
      warnings: []
      errors: []
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      follow_up_issues: []
      note_only_observations: []
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions