Repository navigation
Open
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1889"
goal_ref: "SubAgent 起動直前に必要情報だけをローカルファイルへ出力し、Claude Code / Codex CLI の custom SubAgent へ同じ入力契約で渡す"
change_kind: workflowParent Issue
Parent Goal Ref
- Goal:
impl-review-loopとissue-refinement-loopの両方で、live authority(GitHub/repo/CI)・GitHub 人間向け履歴・ローカル context bundle の3面を混同せず運用する。 - Desired Destination: Claude Code と Codex CLI の両方が dispatch context bundle を consume し、既存 GitHub machine-readable 経路が維持されている状態。
Current Validated Scope
impl-review-loopの直接 SubAgent(implementation-worker / test-runner / pr-reviewer)の起動直前 context bundle 生成・読取・破棄。issue-refinement-loopの直接 SubAgent(codebase-investigator / web-researcher / issue-reviewer / issue-author)の起動直前 context bundle 生成・読取・破棄。- Claude Code の
.claude/agents/*.mdと Codex CLI の.codex/agents/*.tomlにおける同一 semantic input contract。
Remaining Parent Gaps
- Child B(人間向け GitHub 作業履歴の phase-aware 整理)は本 Issue のスコープ外。
- feat(impl-review-loop): startup を capsule-first に強制し raw 初期調査を禁止する #1114 の残存要件のうち、本 Issue の bounded local context bundle で扱わない部分があれば、親 Issue 導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889 の Remaining Parent Gaps へ差し戻す。
Outcome
impl-review-loop と issue-refinement-loop の orchestrator が、対象 SubAgent を起動する直前に bounded なローカル context bundle(.claude/tmp/subagent-context/<run-id>/<agent>.json)を生成し、そのパスを起動入力へ含める状態。SubAgent は bundle を読み、live Issue/PR/head と照合した上で作業し、完了後に bundle は削除され、cross-session 再開時は GitHub から再生成される。
Runtime Verification Applicability
decision: immediate
applicable_acs: [AC1, AC2, AC3, AC4, AC5, AC6, AC7, AC8, AC9, AC10, AC11, AC12, AC13, AC14]
execution_environment: "Claude Code CLI と Codex CLI の両方が custom SubAgent/custom Agent を dispatch できる実行環境"
skip_conditions: "認証・CLI 前提が満たせない実行環境では exit 77 で SKIP する"
fallback_policy: "fallback(inline_fallback)実行が成功しても PASS として扱わない(fallback_success_is_pass: false)"
artifact_requirements: ".claude/artifacts/agent-ops/context-bundle/<run-id>/ 配下に生成・読取・削除の証跡を保存する"
required_runtime:
- claude_code_custom_subagent_dispatch
- codex_cli_custom_agent_dispatch
success_condition:
- bundle_generated_before_spawn
- agent_echoes_matching_bundle_id
- context_source_is_local_bundle
fallback_success_is_pass: falseIn Scope
- SubAgent 起動直前の bounded context bundle generator(
.claude/tmp/subagent-context/<run-id>/<agent>.json)。 - atomic write(tmp へ書き込み後 rename)、permission
0600、cleanup(完了後削除/24時間超の stale bundle 削除)。 impl-review-loopの対象 SubAgent(implementation-worker / test-runner / pr-reviewer)の dispatch への接続。issue-refinement-loopの対象 SubAgent(codebase-investigator / web-researcher / issue-reviewer / issue-author)の dispatch への接続。- Claude Code (
.claude/agents/*.md) と Codex CLI (.codex/agents/*.toml) の入力契約へのcontext_bundle_path追加。 - bundle ID/digest の SubAgent result への echo。
- fixture test と Claude/Codex の live smoke。
Out of Scope
- GitHub コメントの投稿先変更(Child B の責務)。
- human report template(Child B の責務)。
- raw transcript の保存、永続
LOOP_STATE、event ledger、Agent memory への保存。 - 新規 SubAgent の追加。
- GitHub 上の既存 machine-readable 経路の撤去。
Acceptance Criteria
- AC1: orchestrator が各対象 SubAgent の起動直前に bundle を生成する。
- AC2: bundle 完成前に SubAgent を起動しない。
- AC3: bundle は有効な JSON で、必須 field と bounded size を満たす。
- AC4: bundle のファイル permission が
0600である。 - AC5: bundle に credential・token・cookie・raw transcript・full tool output・absolute repository path が含まれない。
- AC6: Claude/Codex の対象 Agent が
context_bundle_pathを入力として受理する。 - AC7: SubAgent result が
bundle_idとcontext_source: local_bundle | inline_fallbackを返す。 - AC8: missing/malformed bundle では stale file を再利用しない。
- AC9: SubAgent 完了後に bundle を削除する。
- AC10: 24時間超の stale bundle を cleanup する。
- AC11: resume 時は GitHub から bundle を再生成する(古いローカル bundle を再利用しない)。
- AC12: issue-refinement-loop の既存
planner_input/ARTIFACTを再利用し、同じ情報を別形式で重複生成しない。 - AC13: 既存 machine-readable GitHub comment consumer が回帰しない。
- AC14: Claude Code と Codex CLI の live smoke で bundle consumption を確認する。
Verification Commands
$ uv run --locked pytest scripts/agent-ops/tests/test_build_subagent_context_bundle.py -q
# AC1
# AC2
# AC3
# AC4
# AC5
# AC8
# AC9
# AC10
# AC11
# AC12
$ rg -n -e "context_bundle_path" -e "bundle_id" -e "context_source" .claude/agents .codex/agents .claude/skills/impl-review-loop .claude/skills/issue-refinement-loop
# AC6
# AC7
$ git diff --check
# AC13
# baseline-expect: pass
# AC14
# preflight-scope: pr_review_only
$ echo "live smoke evidence recorded in PR description per artifact_evidence"Allowed Paths
scripts/agent-ops/build_subagent_context_bundle.pyscripts/agent-ops/tests/test_build_subagent_context_bundle.pydocs/dev/agent-skill-boundaries.md.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md.claude/skills/issue-refinement-loop/SKILL.md.claude/agents/implementation-worker.md.claude/agents/test-runner.md.claude/agents/pr-reviewer.md.claude/agents/codebase-investigator.md.claude/agents/web-researcher.md.claude/agents/issue-reviewer.md.claude/agents/issue-author.md.codex/agents/implementation-worker.toml.codex/agents/test-runner.toml.codex/agents/pr-reviewer.toml.codex/agents/codebase-investigator.toml.codex/agents/web-researcher.toml.codex/agents/issue-reviewer.toml.codex/agents/issue-author.toml
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
docs/dev/agent-skill-boundaries.mddocs/dev/workflow.md.claude/skills/issue-refinement-loop/references/anchor-comment-handling.md
Scope Delta(任意)
N/A
Notes for Reviewer
- 本 Issue は 導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889(parent, delivery-rollup)の Child A。owner comment(https://github.com/squne121/loop-protocol/issues/1889#issuecomment-5149813241)の推奨アーキテクチャに基づき起票された。
- feat(impl-review-loop): startup を capsule-first に強制し raw 初期調査を禁止する #1114 の bounded startup capsule/compact fallback 要件を本 Issue へ統合する。本 Issue 起票後、feat(impl-review-loop): startup を capsule-first に強制し raw 初期調査を禁止する #1114 の disposition(
not plannedclose 等)は人間が判断する。 - 実装: export-chatgpt-context.mjs を追加し ChatGPT投入用 context bundle を生成する #939 の budget/redaction/injection-safe helper を参照するが、ChatGPT retrospective bundle と本 Issue の SubAgent dispatch bundle は別用途として維持する。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
fix(agents): issue-author に readiness_forwarding_payload の消費契約を復元する
fix(codebase-investigator): AC10 向けに #1909 context_bundle_path の予約ノートを追加
実装: codebase-investigator/web-researcher を AGY-only provider route へ固…