## 背景 Issue #107 impl-review-loop 実行では、Issue、comments、skills、hooks、scripts を main context で逐次読みに行き、hook block と重複調査が発生した。既に agent_ops_inventory.py は存在するが、impl-review-loop / agent-ops audit の入口で必須化されていない。 関連: #1093 ## Outcome AGENTS/CLAUDE/skills/hooks/subagents/rules/scripts を読む前に metadata-only inventory と context budget summary を生成し、raw full read の前に CONTEXT_BUDGET_DECISION_V1 を通す。大きい file fragment は warning、巨大 context は fail-closed にする。 ## Acceptance Criteria - [ ] AC1: agent_ops_inventory.py または新規 agent_context_budget.py が impl-review-loop-audit task-kind を持つ - [ ] AC2: inventory に path, kind, owner, purpose, mutation_risk, token_estimate, related_tests を含める - [ ] AC3: stdout は compact JSON のみ。full inventory は artifact に逃がす - [ ] AC4: 1 fragment が 1000 token 超は warning、total が 10000 token 超は fail-closed - [ ] AC5: impl-review-loop と agent-ops-review の手順に inventory-first を明記する - [ ] AC6: SubAgent 出力は CLAIM / EVIDENCE / ARTIFACT / NEXT_ACTION 形式に圧縮する - [ ] AC7: stale /tmp artifact / copied script の source_sha mismatch を検出する - [ ] AC8: session manifest に context budget metrics を記録する ## Allowed Paths - scripts/agent_ops_inventory.py - scripts/agent_context_budget.py - AGENTS.md - CLAUDE.md - .claude/skills/impl-review-loop/SKILL.md - .claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md - docs/dev/agent-run-report.md - docs/dev/agent-retro-index.md - docs/schemas/agent-session-manifest.md - tests/test_agent_ops_inventory.py - tests/test_agent_context_budget.py ## Verification Commands uv run python3 scripts/agent_ops_inventory.py --task-kind agent-ops-review --artifact-out /tmp/agent_ops_inventory.json uv run python3 scripts/agent_context_budget.py --inventory /tmp/agent_ops_inventory.json --max-fragment-tokens 1000 --max-total-tokens 10000 uv run pytest tests/test_agent_ops_inventory.py tests/test_agent_context_budget.py -q ## Source Audit trigger: Issue #107 impl-review-loop 実行ログ観測。関連 #1093
Activity