Skip to content

導入: agent ops の token/context 浪費を決定論的 preflight / compact contract / hook 規律で削減する #791

Closed
7 of 7 issues completed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: parent
goal_ref: "agent ops(issue refinement / subagent handoff / hooks)の token・context 浪費を決定論的 script と compact contract で削減する"
change_kind: workflow
parent_mode: delivery-rollup
closure_mode: child-complete

Summary

Issue #781 の refinement loop 実行ログ分析(2026-06-10 提供レポート)で、以下の token / context 浪費ホットスポットが特定された。

  1. planner(plan_refinement_loop.py)の入力契約を agent が推測し、--help・SKILL/script 再読・再実行が発生している
  2. issue-reviewer / issue-author の 7 回起動で表示上約 158k tokens の subagent 出力が main context に戻っている
  3. AC7 の broad search path 不備(Allowed Paths 外参照 VC)が最終 review まで検出されず、loop が 1 巡余分に回っている
  4. agent ops task でも CLAUDE.md の既定読込順により product docs まで過読しやすい
  5. hook stdout / compaction 時の state 復元に決定論的規律がなく、今後の hook 追加が context 汚染源になり得る

本 parent は、これらに対する決定論的対策(preflight wrapper / VC scope checker / compact result contract / read plan generator / hook stdout 規律 / transcript summarizer / agent parity linter)を child issue として bundle する delivery-rollup tracker である。

Goal

issue refinement loop の 1 実行あたりの失敗コマンド・再読・subagent raw output 還流を決定論的 script で排除し、agent ops 全体の token / context 消費を削減する。

Desired Destination

preflight wrapper・VC scope checker・compact subagent result contract・agent ops read plan generator・hook stdout / compaction 規律・transcript hotspot summarizer・Claude/Codex agent parity linter 拡張が repo に反映され、refinement loop が「失敗 preflight 0 回・subagent compact stdout ≤ 2KB + artifact・VC scope 不備の author 前検出」で完走できる状態。

Current Validated Scope

  • .claude/skills/issue-refinement-loop/ 配下の scripts / schemas / tests / SKILL.md
  • .claude/agents/issue-reviewer.md / .claude/agents/issue-author.md
  • .codex/agents/issue-reviewer.toml / .codex/agents/issue-author.toml
  • .claude/settings.json / .claude/hooks/** / .codex/hooks.json / .codex/hooks/**
  • scripts/agent_ops_inventory.py / scripts/summarize_agent_transcript.py / scripts/check_agent_friendly_stdout.py / scripts/check_claude_codex_agent_parity.py
  • AGENTS.md / CLAUDE.md(agent ops task の read plan 例外追記のみ)

Decisions Fixed

Quality Decision Record

  • Status: N/A
  • Decision Date: 未記録
  • Does this prove the parent goal complete?: N/A
  • Reason: delivery-rollup parent のため N/A
  • Evidence: N/A
  • Next Action: child issue 1〜3 / 5〜8 を順次実装する

Parent Closure Rule

Child Issues

レポート Issue 4 は #795 として #293 の child に起票済み(本 parent の close 条件外、参照のみ)。

Remaining Parent Gaps

Phase Handoff Contract

  • Desired Destination
  • Current Validated Scope
  • Remaining Parent Gaps
  • Current Objective
  • Bounded Current Context
  • Normative References
  • Allowed Paths
  • Required Skills
  • Validation Commands
  • Stop Conditions
  • Open Questions
  • Next Action
  • Artifact Refs
  • Handoff Prompt Draft
  • Linked PR (implementation のみ)

Acceptance Criteria

  • AC1: preflight wrapper run_refinement_preflight.py が .claude/skills/issue-refinement-loop/scripts/ に存在する(child issue 1 完了の証跡)
  • AC2: VC scope checker check_vc_scope.py が .claude/skills/issue-refinement-loop/scripts/ に存在する(child issue 2 完了の証跡)
  • AC3: compact result 変換 script compact_review_result.py が .claude/skills/issue-refinement-loop/scripts/ に存在する(child issue 3 完了の証跡)

child issue 全件の CLOSED 確認は Parent Closure Rule に従う(rollup 判定であり個別 AC にしない)。

Verification Commands

# AC1
test -f .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
# AC2
test -f .claude/skills/issue-refinement-loop/scripts/check_vc_scope.py
# AC3
test -f .claude/skills/issue-refinement-loop/scripts/compact_review_result.py

Allowed Paths

本 parent は tracker のため直接の実装変更を持たない。child issue の Allowed Paths は各 child 本文を正本とする。対象領域は以下。

  • .claude/skills/issue-refinement-loop/**
  • .claude/agents/issue-reviewer.md / .claude/agents/issue-author.md
  • .codex/agents/issue-reviewer.toml / .codex/agents/issue-author.toml
  • .claude/settings.json / .claude/hooks/** / .codex/hooks.json / .codex/hooks/**
  • scripts/agent_ops_inventory.py / scripts/summarize_agent_transcript.py / scripts/check_agent_friendly_stdout.py / scripts/check_claude_codex_agent_parity.py
  • AGENTS.md / CLAUDE.md

Notes

Sub-issues

Sub-issues

7 of 7 Issues completed
Loading 7 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    state/in-progresstracking

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions