Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "2154"
goal_ref: "通常の claude-gpt 対話セッション中、user が current turn で明示的に canonical @agent-spark-codex mention を書いた場合だけ、main session model を変えずに GPT-5.3-Codex-Spark を SubAgent として起動し、causal evidence で実際の Spark 使用を証明する"
change_kind: mixed
runtime_verification_applicability: immediate
child_id: spark-explicit-subagent
dedupe_key: "claude-gpt-gpt-5.3-codex-spark-explicit-subagent-v1"Parent Issue
Parent Goal Ref
- Goal: Claude Code を共通 development harness とし、Anthropic subscription と ChatGPT Pro Codex subscription を独立 runtime として並列運用できる状態へ移行し、Codex CLI 実行系を段階的に廃止する。
- Desired Destination: Native Claude と通常 claude-gpt(main Terra / opus Sol / sonnet Terra / haiku Luna)が config・credential・session・working tree を分離して並列稼働し、Spark は通常 destination を置換しない明示的 guarded opt-in の SubAgent としてだけ扱われる。
Current Validated Scope
- この child の dedupe key は
claude-gpt-gpt-5.3-codex-spark-explicit-subagent-v1。旧 dedupe keyclaude-gpt-gpt-5.3-codex-spark-selective-profile-v1(--profile spark前提の旧設計)とは execution_unit(session-wide profile vs. current-turn subagent)が異なるため、意図的に新しい key へ更新した。 - 実装: worktree-agent-runtime-smoke に claude-gpt launcher 選択入力を追加し Lane A/B 実機検証する #2174 / PR 実装: worktree-agent-runtime-smoke に claude-gpt launcher 選択入力を追加する (#2174) #2176(launcher-selected worktree runtime-smoke infrastructure)、実装: worktree-agent-runtime-smoke に hook ID ベースの SubAgent causal evidence 判定と runtime verification policy 更新を導入する #2183 / PR feat: worktree-agent-runtime-smoke に hook ID ベースの SubAgent causal evidence 判定を追加する #2220(hook ID ベースの SubAgent causal evidence 判定)、実装: worktree-agent-runtime-smoke で claude-gpt の同一 Herdr session multi-turn / 複数 SubAgent lifecycle を fail-closed に証明する #2219 / PR feat: worktree-agent-runtime-smoke に claude-gpt 同一 session multi-turn / 複数 SubAgent lifecycle 判定を追加する #2222(claude-gpt 同一 session multi-turn / 複数 SubAgent lifecycle 判定)は current main で全て MERGED 済みである。これらはもはや本 child の blocker でも open coordination target でもなく、reuse すべき merged baseline として扱う。
scripts/agent-ops/run_worktree_agent_runtime_smoke.pyのsubagent_causal_evidence_verdict()(PR feat: worktree-agent-runtime-smoke に hook ID ベースの SubAgent causal evidence 判定を追加する #2220)とextract_claude_hook_lifecycle_events()は、SubagentStart/SubagentStopのagent_idとAgenttool_use のtool_use_idを相関し、agent_transcript_path検証・expected_markersの child-only recoverability まで含めて fail-closed に判定する既存機構であり、本 child はこれを再設計せず reuse する。scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_causal_evidence.py(feat: worktree-agent-runtime-smoke に hook ID ベースの SubAgent causal evidence 判定を追加する #2220)・test_run_worktree_agent_runtime_smoke_claude_gpt_hermetic_matrix.py(feat: worktree-agent-runtime-smoke に claude-gpt 同一 session multi-turn / 複数 SubAgent lifecycle 判定を追加する #2222)が回帰対象である。- current main の proxy catalog/allowlist には
gpt-5.3-codex-sparkがあるが、account entitlement、request、tool、context/continuation compatibility の証明ではない。 claude-gptの proxy 起動はenv -iを使うため caller の任意 CCP 環境変数を子 process へ継承しない。Spark に必要な設定は Spark child にだけ scoped injection する。- 現在
.claude/agents/*.mdの12 定義は全てmodel: haikuまたはmodel: sonnet。session-local custom SubAgent 定義に非 Anthropic の full model ID(gpt-5.3-codex-spark等)を指定した場合に、その SubAgent 単体の推論だけが proxy 経由で GPT backend へ route され、parent session は Claude のままであることは、現時点で repository にも公式ドキュメントにも確証がなく未検証の技術的前提である。 - 現在
.claude/settings.jsonのPreToolUsehook matcher はBash|Read|Write|Edit|Grep|Glob|MultiEditとBashのみであり、Agenttool に一致する matcher は存在しない。UserPromptSubmit/SubagentStart/StopFailurehook も project.claude/settings.jsonには登録されていない(scripts/claude-gpt/launch.shが生成する launcher 専用 ephemeralsettings.local.jsonの smoke-harness 断片にのみ audit 目的で存在する)。explicit-only gate の実装にはこれらの新規 hook 配線が必要である。 scripts/claude-gpt/test_launch_strict_mcp_config_normalization.pyの canonical prefix 契約は、固定トークン数ではなく「launcher-owned flagはexactly once・正しいflag/value pairing、caller argvはbyte-for-byte順序・空文字・改行・whitespace・glob metacharacters・downstream--semanticsを一切変更せず保存される」という意味論的invariantが本質である(PR 実装: claude-gpt auto mode に canonical AGY/GitHub trust policy と live canary を追加する (#2203) #2214/Issue #2203での5→7トークン拡張の前例、及びPR 実装: claude-gpt session内でexplicit @agent-spark-codex明示時だけGPT-5.3-Codex-Spark SubAgentを起動する #2244 OWNERコメントでの確認に基づく)。--agents <json>のような新規launcher-owned flag追加時は、この意味論を維持したまま該当テストを構造的検証(exactly once・JSON parse可能・期待model id一致等)へ拡張してよい。
Remaining Parent Gaps
- Spark の entitlement、request parameter、tool、reasoning effort/summary、encrypted continuation、server compaction の live compatibility は未証明である。
- 「
UserPromptSubmitで観測した mention」を「直後のPreToolUse(Agent)の authorization」へ束縛する hook-native な一級 API は現時点で存在しない。nonce/session_id/prompt_idkeyed sidecar による自前実装が必要であり、これはscripts/claude-gpt/launch.shの既存 hook-sink パターンと整合する形で構築する。 @agent-spark-codexmention が code block・quoted text・別ソースからの injected text 内に現れた場合に Claude Code 自身の mention parser がそれを invocation syntax として扱わないことは公式ドキュメントで明言されていない。authorization detection はUserPromptSubmitの raw prompt 文字列への単純 substring match ではなく、SubagentStartpayload のagent_type等 Claude Code 自身が resolve した結果で裏付ける設計にする。- 非 Anthropic full model ID を持つ session-local SubAgent が実際に per-subagent 単位で proxy 経由 GPT backend へ route されるかは live 検証が必要な未確認の前提である。
- 実装: migrate agent/runtime parity contracts(Phase 2, Child 2 of #2154) #2160 の provider-neutral parity と 実装: retire Codex CLI assets and documentation(Phase 3, Child 3 of #2154) #2161 の Codex CLI retirement は本 child の scope 外である。
scripts/claude-gpt/launch.sh --profile spark(session-wide pre-start profile として Spark を選択する UX)は本 child の Outcome / closure condition に含めない。独立した機能として将来必要になった場合でも、本 Issue の中では新規 Issue を起票しない。
Background
前回の Issue 設計(--profile spark による fresh session/process 起動)は、OWNER の direct human intent(通常 claude-gpt 対話セッションを維持し、user が current turn で明示した場合だけ Spark を SubAgent として使う。main session model を Spark に切り替えない)を4軸すべてで反転させていたため、reframe_in_place の対象となった。
human_intent:
interaction_mode: interactive
trigger: explicit_current_turn
execution_unit: subagent
main_session_model_change: falseSpark は text-only research preview として扱い、source document context ceiling は 128K である。通常 profile の [1m] 又は 272K 設定・閾値を継承してはならない。ordinary model と Spark の hot switch、stale session resume、Spark からの automatic fallback、quota exhaustion を契機とする切替はいずれも禁止する。
proxy は Spark を full Responses lane として扱い、Lite lane を採用しない。catalog/allowlist の存在だけで entitlement や request/tool/context compatibility を主張しない。reasoning effort、reasoning summary、encrypted continuation は別々の互換性項目として扱う。reasoning summary suppression は upstream-supported な scoped mechanism を runtime canary で確認できた場合に限り、Spark child にだけ確認済み値を inject する。確認できない場合は停止する。
Outcome
通常 claude-gpt 対話セッションの main session model・ordinary SubAgent model mapping・Native runtime を一切変更せず、claude-gpt session 内にだけ Spark custom SubAgent(spark-codex)を登録し、user が current turn で canonical @agent-spark-codex を明示した場合だけ起動する。authorization は current turn かつ exactly-one-invocation に限定され、次 turn/resume へ持ち越されない。automatic fallback は一切禁止し、Spark delegated task の失敗は親へ明示的に返され、main claude-gpt session は以降も ordinary turn を継続できる。実際の Spark model 使用は PR #2220/#2222 の causal evidence 機構を reuse した hook ID 相関で証明し、自己申告や prompt 出力の model 名は証拠にしない。
In Scope
- claude-gpt session にだけ
spark-codexcustom SubAgent(.claude/agents/相当の session-local 定義、modelに Spark の full model ID を指定)を登録する。Native session・通常 claude-gpt の main model・ordinary SubAgent mapping は不変。 UserPromptSubmit→ current-turn の canonical@agent-spark-codexmention 検出・nonce/session_id/prompt_idkeyed authorization 記録 →PreToolUse(Agent)(新規 matcher 追加)→subagent_type == spark-codexかつ authorization 存在時のみ許可・authorization consume →SubagentStart(agent_id)→SubagentStop(agent_id)→ parent 受信、の deterministic fail-closed gate を実装する。authorization が存在しない spark-codex 起動は deny する。- authorization は現在 turn かつ 1 回限りの invocation に限定し、次 turn・resume・duplicate invocation には持ち越さない。
- quoted text、code block 内 mention、過去 turn の mention、typo、別 agent mention は authorization として扱わない。detection は
UserPromptSubmitの raw prompt 文字列への単純 substring match だけに依存せず、SubagentStartpayload の Claude Code 自身が resolve したagent_typeで裏付ける。 - 他 SubAgent や main model からの自律的 spark-codex 起動(top-level 自律呼び出し、nested SubAgent からの delegation の双方)を拒否する。
- Spark delegated task が失敗しても main claude-gpt session が死なないよう failure を task スコープに閉じ込め、失敗後も同一 session で ordinary turn を継続できることを確認する。
- PR feat: worktree-agent-runtime-smoke に hook ID ベースの SubAgent causal evidence 判定を追加する #2220 の
subagent_causal_evidence_verdict()/extract_claude_hook_lifecycle_events()と PR feat: worktree-agent-runtime-smoke に claude-gpt 同一 session multi-turn / 複数 SubAgent lifecycle 判定を追加する #2222 の multi-turn/lifecycle 判定機構を reuse し、requested_model/agent_resolved_model/proxy_observed_modelの3フィールドがすべてgpt-5.3-codex-sparkで一致することを causal evidence として証明する。model 名の自己申告や prompt 出力は証拠にしない。 - unsupported entitlement、catalog unavailable、request parameter incompatibility、quota、tool incompatibility、context/continuation error を sanitized structured classification として出力する。credential、token、raw auth、raw request/response、raw transcript は capture、persist、report しない。unsupported entitlement は exit 77 の SKIP/blocked として記録し、PASS や ordinary model への automatic fallback に昇格させない。
- focused deterministic tests と default normal runtime regression を allowed paths 内で更新する。
Out of Scope
scripts/claude-gpt/launch.sh --profile spark(session-wide pre-start profile モデル)。独立した機能として将来必要になった場合でも、本 Issue のスコープにも closure condition にも含めない。本 Issue 内で新規 Issue も起票しない。- Native profile、通常 claude-gpt mapping(main Terra / opus Sol / sonnet Terra / haiku Luna)、provider-neutral project agent definitions(既存
.claude/agents/**の12定義)、CLAUDE_CODE_SUBAGENT_MODELの変更。 - main session model の Spark への切り替え、
/modelを Spark 選択経路にすること、session 全体の resume/hot switch。 - image/web-search capability の Spark への付与、意図的 quota exhaustion、credential/auth/raw transcript の保存又は投稿。
- 非 Anthropic full model ID を持つ session-local SubAgent が per-subagent 単位で実際に proxy 経由 GPT backend へ route されることの一般的な保証(本 child は Spark 固有の live canary でのみ検証し、一般化された仕組みとしては主張しない)。
- 実装: migrate agent/runtime parity contracts(Phase 2, Child 2 of #2154) #2160 の provider-neutral parity、実装: runtime guard が peer pytest nodeids を child write と誤帰属しないようにする #1526(
.pytest_cache/v/cache/nodeidsの unauthorized_write_path 誤検知修正)の実装。
Acceptance Criteria
- AC1: Spark directive のない通常 turn では main claude-gpt session の model(main Terra / opus Sol / sonnet Terra / haiku Luna)・ordinary SubAgent mapping・Native profile は一切変更されない。
- AC2: user が current turn で canonical
@agent-spark-codexを明示した場合にのみ、UserPromptSubmit→PreToolUse(Agent)→subagent_type == spark-codex→ authorization consume →SubagentStart/SubagentStopの fail-closed gate を通って spark-codex SubAgent が起動する。quoted mention、code block 内 mention、typo、別 agent mention では起動しない。 - AC3: authorization は current turn かつ exactly-one-invocation に限定される。過去 turn にのみ存在した directive、同一 authorization からの duplicate invocation、次 turn・resume への持ち越しはいずれも拒否される。
- AC4: Spark 起動時、
requested_model/agent_resolved_model/proxy_observed_modelの3フィールドがすべてgpt-5.3-codex-sparkで一致する causal evidence(PR feat: worktree-agent-runtime-smoke に hook ID ベースの SubAgent causal evidence 判定を追加する #2220 の hook ID 相関機構 reuse)が得られる。parent の自己出力 marker や prompt 内の model 名の自己申告だけでは証拠にならない。 - AC5: 他 SubAgent からの nested delegation、main model からの自律的呼び出しはいずれも spark-codex を起動しない。
- AC6: Spark delegated task を強制失敗させても、同一 main claude-gpt session は直後の ordinary turn を正常に継続できる(failure isolation の positive control)。
- AC7: entitlement unavailable、catalog unavailable、quota、tool/context incompatibility はいずれも自動 fallback せず SKIP/blocked(exit 77)として記録され、PASS や ordinary model fallback に昇格しない。
- AC8: 同一 main claude-gpt session 内で ordinary → explicit Spark → ordinary(未起動であること) → explicit Spark(fresh child identity であること) の4-turn live sequence を確認する。
- AC9: baseline regression(
pnpm typecheck、pnpm lint、pnpm test、pnpm build、model-routing test)が PASS する。
Runtime Verification Applicability
decision: immediate
reason: "Spark entitlement、explicit-only gate の実 hook chain 動作、causal evidence 相関、failure isolation は static test だけでは証明できない"
applicable_acs: [AC2, AC4, AC6, AC7, AC8]
execution_environment: "ChatGPT Pro Codex authentication と proxy が利用できる clean worktree。#2174/PR #2176・#2183/PR #2220・#2219/PR #2222 の merged infrastructure が前提。"
skip_conditions: "proxy/auth unavailable、unsupported entitlement、又は安全に redacted evidence を作れない場合。VC は SKIP: を先頭に出し exit 77 とし、stop_condition_triggered: true を記録する。"
fallback_policy: "Spark、ordinary model、Lite lane、cached/catalog-only result のいずれへの fallback も PASS にしない。unsupported entitlement は SKIP/blocked、実行可能環境での incompatibility は classified FAIL/blocked とする。"
artifact_requirements: "worktree-local の sanitized evidence のみを保存し、PR には expected_evidence_fields と verdict の compact summary のみを引用する。raw log/transcript は commit 又は GitHub 本文へ貼らない。"- expected_evidence_fields:
schema,status,verdict,exit_code,timestamp,sut.git_head,sut.launcher_sha256,proxy.versionrequested_model,agent_resolved_model,proxy_observed_model,models_used,fallback_observed:falseauthorization_turn_id,authorization_consumed:true,authorization_carryover:falseagent_id,session_id,prompt_id,causal_evidence_source:hook_id_correlatedclassification(unsupported_entitlement|unavailable_catalog|request_parameter_incompatibility|quota|tool_incompatibility|context_continuation_error|other_safe_failure)failure_isolation_confirmed,main_session_survived:trueredaction_confirmed:true(credential/token/raw auth/raw request/response/raw transcript を含めない)
Verification Commands
# AC1
$ uv run pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_operator_journey.py# AC2
$ uv run pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_spark_explicit_gate.py -k mention_authorization# AC3
$ uv run pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_spark_explicit_gate.py -k authorization_single_use# AC4
$ uv run pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_causal_evidence.py# AC5
$ uv run pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_spark_explicit_gate.py -k nested_delegation_forbidden# AC6
$ uv run pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_spark_explicit_gate.py -k failure_isolation# AC7
$ uv run pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_spark_explicit_gate.py -k no_fallback_skip_blocked# AC8
$ uv run pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_claude_gpt_hermetic_matrix.py# AC9
$ pnpm typecheck# Baseline requirement for AC9
$ pnpm lint# Baseline requirement for AC9
$ pnpm test# Baseline requirement for AC9
$ pnpm build# Baseline requirement for AC9
$ uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.pyAllowed Paths
.claude/settings.json.claude/agents/spark-codex.mdscripts/claude-gpt/launch.shscripts/claude-gpt/lib.shscripts/claude-gpt/preflight.sh.claude/skills/worktree-agent-runtime-smoke/SKILL.md.claude/skills/worktree-agent-runtime-smoke/references/claude-code.mddocs/dev/runtime-verification-policy.mdscripts/agent-ops/run_worktree_agent_runtime_smoke.pyscripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke.pyscripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_claude_bin.pyscripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_claude_bin_settings_channel.pyscripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_operator_journey.pyscripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_causal_evidence.pyscripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_claude_gpt_hermetic_matrix.pyscripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_spark_explicit_gate.pyscripts/claude-gpt/test_launch_strict_mcp_config_normalization.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合。
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合。
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)。
- 後続 Phase / 別スコープへの波及が判明した場合。
- nested SubAgent delegation が必要になった場合。
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合。
- explicit-only gate(
UserPromptSubmit→ authorization →PreToolUse(Agent)→ consume →SubagentStart/SubagentStop)が現行 Claude Code hook semantics で deterministic に構築できないと判明した場合。description prose だけへの格下げは禁止し、この場合は実装を停止する。 - 非 Anthropic full model ID を持つ SubAgent の per-subagent model routing が live 検証で確認できない場合。
- upstream-supported な scoped reasoning summary suppression を確認できない場合。
- credentials/evidence safety 又は sanitized failure classification を保証できない場合。
- Native / 通常 claude-gpt の main model・ordinary SubAgent mapping に影響する場合。
- automatic fallback、deliberate quota exhaustion、secret export、又は allowed paths 外の変更が必要になる場合。
- runtime VC が SKIP(exit 77)を返した場合、又は fallback 経由でのみ成功する場合。SKIP は PASS に昇格しない。
Required Skills
- Claude Code custom SubAgent 登録 / model resolution / hook lifecycle(
UserPromptSubmit/PreToolUse/SubagentStart/SubagentStop) - claude-gpt launcher architecture(
scripts/claude-gpt/launch.sh/lib.sh、env -iscoped injection パターン) - claude-code-proxy の request-level model routing(Codex provider、
ALLOWED_MODELSallowlist) - GPT-5.3-Codex-Spark の runtime constraints(text-only、128K 保守的 context ceiling、entitlement gating、独立 rate-limit pool)
- worktree-agent-runtime-smoke
Required Design References
docs/dev/runtime-verification-policy.mdscripts/claude-gpt/lib.sh、scripts/claude-gpt/launch.sh、scripts/claude-gpt/runtime_smoke_test.shscripts/agent-ops/run_worktree_agent_runtime_smoke.py(subagent_causal_evidence_verdict()、extract_claude_hook_lifecycle_events())scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_causal_evidence.py(PR feat: worktree-agent-runtime-smoke に hook ID ベースの SubAgent causal evidence 判定を追加する #2220 merged baseline)scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_claude_gpt_hermetic_matrix.py(PR feat: worktree-agent-runtime-smoke に claude-gpt 同一 session multi-turn / 複数 SubAgent lifecycle 判定を追加する #2222 merged baseline)- Claude Code subagents: https://code.claude.com/docs/en/sub-agents
- Claude Code hooks: https://code.claude.com/docs/en/hooks
- Claude Code model configuration: https://code.claude.com/docs/en/model-config
- OpenAI Spark launch: https://openai.com/index/introducing-gpt-5-3-codex-spark/
- OpenAI model docs: https://learn.chatgpt.com/docs/models
- proxy Codex provider docs: https://claude-code-proxy.raine.dev/providers/codex/
- proxy raw Codex allowlist: https://raw.githubusercontent.com/raine/claude-code-proxy/main/src/providers/codex/translate/model_allowlist.rs
Notes for Reviewer
Merged baseline reconciliation: #2174/PR #2176、#2183/PR #2220、#2219/PR #2222 は全て MERGED 済みであり、blocker でも open coordination target でもない。旧本文の「draft PR #2176」表記は stale であったため削除した。
未確認の技術的前提として reviewer に特に検証してほしい点: (1) .claude/agents/*.md の model: に非 Anthropic full model ID(gpt-5.3-codex-spark)を指定した場合に、その SubAgent 単体だけが proxy 経由で GPT backend へ route され、parent session が Claude のままであることは repository にも公式ドキュメントにも先例・確証がなく live 検証が必要である。(2) UserPromptSubmit の mention 検出を PreToolUse(Agent) の authorization consume へ束縛する hook-native な一級 API は存在しないため、nonce/session_id/prompt_id keyed sidecar の自前実装が必要であり、この実装自体が spoofing に対して安全であることを reviewer は確認すること。
Operational risk reports(normative specification ではない): openai/codex#32537, openai/codex#19868, openai/codex#31969, openai/codex#22324, openai/codex#32132, https://github.com/openai/codex/issues/23243(context window の実効値に関する未解決の不一致)。
用語ルール
人間向けの報告・本文・コメントでは、モデルを必ず GPT-5.3-Codex-Spark または GPT-5.3-Codex-Spark SubAgent と呼ぶこと。spark-codex は Claude Code 内部の custom-agent identifier(agent_type)としてのみ使用し、モデル名・製品名の別称として文章中で用いないこと。
Delivery Rule
1 Issue = 1 PR。#2174/PR #2176、#2183/PR #2220、#2219/PR #2222 は merged 済みのため blocked-by 依存としない。dedicated worktree と Draft PR を既定にする。runtime evidence は sanitized compact result だけを PR に引用し、既存 Issue/PR の本文・comment mutation は本 Issue の delivery に含めない。
Activity
squne121 commentedon Aug 15, 2026
「scripts/claude-gpt/launch.sh --profile spark」その機能を追加することは別に妨げないが、おそらく私が想定しているユースケースと異なる実装になっています。ClaudeCodeを対話的に利用する際に、私が明示的にgpt-5.3-codex-sparkの利用をプロンプトに加えた際にのみgpt-5.3-codex-sparkサブエージェントを使って作業をしてほしいという意図です。非対話的なスクリプトの機能実装や、特定の引数を指定してclaude-gpt起動したときのみ、gpt-5.3-codex-sparkモデルを使用したいという意図ではありません。
Required Skills なしとなっていますが、ClaudeCodeの運用に関する知識、Claude-GPTの実装に関する知識、動作検証として.claude/skills/worktree-agent-runtime-smokeスキルの利用が必要ではないですか?なぜなしを記載してしまったのか、ワークフローの見直しが必要だと思います。起票時、レビュー時、それぞれでGitHub Issueを作業の計画として見たときに、ClaudeCodeが作業に必要な知識をGitHub Issueにどのように記載できるか検討してほしいです。
squne121 commentedon Aug 17, 2026
判定
REQUEST_CHANGES — 推奨 disposition は
reframe_in_placeです。#2186 は Spark の制約や証跡設計をかなり慎重に扱っていますが、実装しようとしている利用形態が、OWNER の要求と逆になっています。現状のまま実装すると、「通常の claude-gpt 対話中に、明示したときだけ Spark SubAgent を使う」という目的を達成せず、別機能である「Spark を main model にした専用セッション起動」を完成させることになります。
P0 — マージ阻害事項
P0-1. authoritative human intent を反転している
親 Issue の OWNER コメントは最初から、「人間がプロンプトで指示したときに Spark を利用する」と明記しています。今回の指定コメントも、「通常の Claude Code 対話中」「明示的にプロンプトへ加えたときだけ」「Spark サブエージェントを使う」と再確認しています。
しかし #2186 は、以下を正本にしています。
launch.sh --profile sparkで fresh Spark process を起動するつまり、要求された経路を明示的に禁止し、要求されていない経路を Outcome にしています。
親 #2154 側でも、OWNER の「プロンプトで指示」を「prompt submission 前に別プロファイルを起動する意味」と読み替えています。この再定義を OWNER が承認した証拠はなく、refinement による意味変更です。
これは仕様の曖昧さではありません。以下の四軸すべてが反転しています。
必須修正: #2186 の Outcome、In Scope、Out of Scope、AC、VC、Stop Conditions を全面的に書き換える必要があります。既存 body への部分追記では不十分です。
P0-2.
--profile sparkは技術的にも必須ではないClaude Code は、セッション限定の custom subagent を
--agentsで登録でき、各 agent に full model ID を指定できます。また、自然言語による委譲は Claude の判断になりますが、@で agent を明示すると、その agent の実行を保証できます。(Claude)claude-code-proxy も、単一のローカル endpoint のまま、各 request の model ID によって provider/model を振り分ける設計です。したがって、main session を Terra のまま維持し、Spark SubAgent の request だけ
gpt-5.3-codex-sparkにすることが可能な構造です。([claude-code-proxy]2)現行 launcher も、
CLAUDE_CODE_SUBAGENT_MODELは unsetとしているため、特定 custom agent の
model:指定を尊重できる方向の構成です。したがって、正しい基本構成は次です。
--profile spark自体を別機能として追加することは妨げません。ただし、それを #2186 の完了条件にしてはいけません。必要なら別 Issue に分離すべきです。P0-3. 「明示時だけ」を agent description では保証できない
custom agent を登録して description に「明示時だけ使用」と書くだけでは不十分です。Claude Code は description を見て自律的に委譲できるため、未指定時の起動を決定論的には防げません。
正本 UX は次のようにすべきです。
または
@picker からspark-codex (agent)を選択する形式です。公式仕様上、これなら対象 agent の invocation を保証できます。自由文の「Sparkを使って」まで受理すると、自然言語 intent classifier の精度に依存し、「明示したときだけ」という安全契約を保証しにくくなります。([Claude]1)さらに未指定時の自律起動を防ぐには、hook による gate が必要です。
UserPromptSubmitで現在 turn に正規の Spark agent mention があるか記録する。PreToolUseのAgent呼び出しを検査する。subagent_type == spark-codexかつ current-turn authorization がない場合は拒否する。Stop/StopFailureで残存状態を破棄する。Claude Code の hook 入力には session、tool input、tool-use ID、subagent type、resolved model、SubagentStart/Stop の agent ID など、必要な相関面があります。([Claude]3)
P0-4. 現行 AC/VC は、要求された性質を一切証明できない
現在の AC7 は text、Bash、fresh multi-turn、cleanup の canary を要求していますが、Task/SubAgent は明示的に未検証です。したがって、現在の VC がすべて PASS しても分かるのは次だけです。
要求されているのは次の因果チェーンです。
さらに、以下の negative control が必要です。
PR #2220 は既に、Agent tool-use ID、SubagentStart/Stop の agent ID、child transcript、marker provenance を相関し、marker-only の偽陽性を拒否する実装を main に取り込んでいます。#2186 はこの証跡基盤を再利用すべきです。
また #2219 / PR #2222 は、同一 Herdr session の multi-turn、複数 SubAgent lifecycle、hook sink、stale evidence、cleanup を扱っています。PR #2222 は現時点ではまだ open なので、#2186 はその current head と fresh collision review を行う必要があります。
P0-5.
Required Skills: なしは個別ミスではなく authoring/review contract の欠陥現行 authoring guidance は
Required Skillsを「ドメイン知識のみ」とし、workflow skill を書かないよう指示しています。一方、guard は canonical skill 名や repo-local skill の存在を検証する経路を持っています。つまり、同じ欄で次の異なる概念が混在しています。この分類では、
worktree-agent-runtime-smokeを「workflow skill なので書かない」と処理しつつ、Claude Code / claude-gpt の知識も canonical skill 名ではないため、結果として「なし」に正規化されやすくなります。レビュー側も、現在は決定論的な構造 checker の結果を LLM が relay する設計で、LLM が独自に意味評価を補完できません。
さらに refinement loop は旧 adversarial review / spec review を採用せず、reviewer verdict を再評価せず直接信頼します。一方、issue-reviewer は anchor comment の domain judgment を orchestrator 責務としています。結果として、authoritative human intent と Outcome の意味同値性を最終的に所有する component がありません。
これが、形式上 approve された Issue が OWNER 要求を反転できた根本原因です。
P1 — 重大な改善事項
P1-1. dependency 情報が stale
#2186 は #2174 / 「draft PR #2176」を blocker としていますが、PR #2176 は既に merged です。
現在の dependency は少なくとも次のように更新すべきです。
古い blocker を解除するだけでなく、#2220/#2222 後の evidence schema に合わせて AC と expected evidence fields を再設計する必要があります。
P1-2. Spark failure が session 全体を殺す設計になっている
whole-session profile では、entitlement、quota、context、tool compatibility のどれかが失敗すると、ユーザーが通常作業していた claude-gpt session 全体が利用不能になります。
SubAgent 方式なら、
という failure containment が可能です。
Spark は公式には ChatGPT Pro 向け research preview、128K、text-only、独立 rate limit と説明されています。registry に model ID があることと、当該アカウントで利用可能であることは別なので、account-specific catalog と actual request の両方を検証する必要があります。([OpenAI]4)
P1-3. requested model ではなく effective model を証明する必要がある
証跡には最低限、次を別フィールドで残すべきです。
Claude Code の Agent tool lifecycle では
resolvedModel/modelsUsedを取得でき、proxy 側も request model に基づいて routing します。片方だけではなく、両面を相関してください。([Claude]3)model self-report や prompt 出力に model 名が含まれたことは証拠にしてはいけません。
P1-4.
text-onlyとtool-lessを混同しないSpark が text-only であることは、image input/output を扱わないという modality 制約です。Bash や file tools まで使用不能であることを意味しません。proxy は Claude tool calls を Responses API の function calls に変換します。したがって Bash canary 自体は妥当です。([OpenAI]4)
ただし Issue では、以下を別々に規定すべきです。
P1-5. continuation と authorization の漏洩試験が不足
proxy は設定によって Agent ID 単位の continuation を扱えるため、Spark child 間、通常 child 間、次 turn 間で state が混ざらないことを検証する必要があります。([claude-code-proxy]5)
初版では continuation を無効化するのが安全です。その場合でも次のシーケンスを live test してください。
P1-6. reasoning summary の値自体は blocker ではない
現行 proxy は
CCP_CODEX_REASONING_SUMMARY=offとnoneの双方を summary suppression 値として明示的にサポートしています。ここは現在の Issue の理解どおりで、欠陥ではありません。([claude-code-proxy]6)ただし AC で二つの値を許す必要はありません。tested proxy version と canonical 値を一つ固定し、通常 profile へ波及しないことを回帰確認する方が決定論的です。
推奨する #2186 のリフレーム
タイトル
Outcome
推奨実装形
runtime agent definition は launcher が所有し、generic caller が任意 JSON を注入するだけの
--agentspassthrough にしない方が安全です。現行 launcher は--後の Claude 引数を透過できますが、専用 agent contract としては以下のいずれかを採用すべきです。--agentsJSON を追加し、caller の重複--agentsを拒否するCLAUDE_CONFIG_DIR配下へ launcher-owned agent definition を生成するprovider-specific model ID を共有
.claude/agents/**にコミットしない点は、親 #2154 の provider-neutral 方針を維持できます。推奨 Acceptance Criteria
通常経路不変
Spark 指示なしでは main Terra、既存 Sol/Terra/Luna mapping、Native runtime が一切変わらない。
session-local registration
claude-gpt 起動時だけ
spark-codexagent が登録され、共有.claude/agents/**に Spark ID を追加しない。明示 invocation
current turn の正規
@agent-spark-codex指定により、Spark SubAgent が exactly one 回起動する。未指定時禁止
未指定、quoted mention、過去 turn の指定、typo、別 agent 指定では Spark Agent tool call が拒否される。
actual model binding
Agent tool-use、SubagentStart/Stop、Claude resolved model、proxy-observed model が exact Spark ID で相関する。
no fallback
entitlement、quota、request、tool、context failure 時に他モデルへ代替されず、Spark delegated task の classified failure になる。
main session survival
Spark delegated task が失敗しても、同じ claude-gpt main session で次の ordinary turn を継続できる。
context/tool policy
128K-safe input、text-only、固定 tool allowlist、Agent nesting禁止、continuation policy が tests と runtime evidence で一致する。
same-session sequence
ordinary → Spark → ordinary → Sparkを同一 Herdr session で実行し、authorization・child identity・continuation が混ざらない。causal evidence
feat: worktree-agent-runtime-smoke に hook ID ベースの SubAgent causal evidence 判定を追加する #2220 の tool-use/agent-ID/transcript provenance と、feat: worktree-agent-runtime-smoke に claude-gpt 同一 session multi-turn / 複数 SubAgent lifecycle 判定を追加する #2222 の hook sink/multi-turn evidence を current main へ統合した形で利用する。
Issue 起票・レビュー workflow の修正
1.
Required Skillsを分割する一つの欄で全概念を扱わず、最低でも次に分けるべきです。
なしは、変更対象 subsystem から capability inventory を生成し、要求 capability が本当にゼロの場合だけ許可すべきです。2. Human Intent Traceability を必須化する
次の semantic delta は自動修復せず、必ず
human_judgment_requiredにしてください。3. review checker に追加すべき判定
C14_authoritative_intent_traceabilityC15_required_capability_closureC16_dependency_freshnessC17_verification_property_alignment特に C17 は、「VC が通ったとき、Outcome の性質が本当に証明されるか」を検査する必要があります。今回なら
runtime_smoke_test.sh --profile sparkが PASS しても「prompt-triggered SubAgent」は証明されないため、hard fail です。4. semantic review の責務を一箇所に置く
現在は、
という循環になっています。
OWNER anchor を持つ refinement では、専用の semantic reviewer を復活させ、以下を最終 authority にする必要があります。
どこか一箇所でも非同値なら approve を禁止してください。
最終結論
#2186 は、Spark の技術制約については有用な調査を含んでいます。特に以下は維持すべきです。
[1m]profile と分離するただし、中心となる execution model は破棄して組み直す必要があります。
推奨 action は、#2186 を close/recreate するのではなく
reframe_in_placeし、通常 claude-gpt 内の explicit-only Spark SubAgent 実装へ置換することです。--profile sparkは #2186 の closure condition から外し、必要なら独立 follow-up に分離するのが妥当です。squne121 commentedon Aug 17, 2026
並列作業できないのであれば、それは設計ミスですし、実装ミスです。なぜGitHub Issueの起表示にその実装を許容してしまう作業計画のままにしてしまったのか、また実装時にそれをそのまま実装してしまったのか、検証で防げなかったのか検討してください。
並列作業を妨げる実装は緊急性の高いバグです。急ぎ、優先的に実装イシューと改善実装を行ってください。
あるいは、リバートによる実装の取り下げでもいいです。
squne121 commentedon Aug 17, 2026
推奨は、#2186 を今すぐ同条件で再試行するのではなく、control-plane blocker を先に切り分けたうえで
reframe_in_placeを再開です。指定コメントは #2186 の仕様上の blocker ではなく、
unauthorized_write_pathが並行 mutation と.pytest_cacheを検知して fail-closed したという運用停止記録です。本文 mutation は行われていません。特に
.pytest_cache/v/cache/nodeidsの誤帰属には既存 Issue #1526 があり、そこが依存していた #1502 はすでに completed です。したがって同じ内容の follow-up を新規起票するより、まず #1526 を canonical remediation として再評価すべきです。 一方、#2231 の refinement 自体はその後 approve まで到達していますが、privileged executor には.guard_shadow_log.jsonlの別問題も報告されています。#2186 では human-intent の意味反転そのものが問題なので、privileged preflight が失敗した際に弱い fallback lane で続行するのは避けるべきです。仕様面では前回レビューの方向が現在の公式仕様とも整合します。Claude Code は
--agentsでセッション限定 SubAgent を登録でき、@mention は指定 SubAgent の実行を保証します。またPreToolUseはAgenttool を対象に deny 可能で、SubAgent lifecycle にはagent_id等の相関情報があります。 ([Claude]1) claude-code-proxy も model ID ごとの request routing を行うため、main session を通常モデルのままにして特定 SubAgent request だけ別モデルへ送る構成と整合します。 ([claude-code-proxy]2) Spark は現在も ChatGPT Pro 向け research preview、128K、text-only、独立 rate limit とされています。 ([OpenAI]3)また、#2186 の旧 dependency 記述は stale です。PR #2176、#2220、#2222 は現在すべて merged なので、これらを blocker ではなく current-main baseline として fresh collision review し直すべきです。
Claude Code には次を渡すのがよいです。
Issue #2186 の refinement を、安全側に fail-close したまま再開してください。
対象:
今回の目的は Issue #2186 の実装ではなく、Issue contract の正常な
reframe_in_placeと implementation-ready 判定までです。repository implementation / PR 作成にはまだ進まないでください。
最重要の authority
以下を混同しないこと。
issuecomment-5302663494OWNER の direct human intent。
normative authority として最優先する。
要求の中心は以下。
issuecomment-5315233662REQUEST_CHANGES / reframe_in_placeの入力として使う。issuecomment-5315476801Phase 0 — control-plane safety preflight
最初に repository / local process / GitHub の current state を fresh に取得する。
以下を確認すること。
issue_content.update/ privileged executor transaction.pytest_cache/v/cache/nodeidsの mutation 状況.guard_shadow_log.jsonlの current state / size と guard failure の有無他セッションを kill したり、他 Issue の artifact を削除したり、guard を無効化したりして通過させてはならない。
.pytest_cacheを directory-wide allowlist に追加してはならない。単に cache を削除して一時的に preflight を通すことを恒久解決扱いしてはならない。
#1526 の扱い
.pytest_cache/v/cache/nodeidsのunauthorized_write_pathfalse positive については、既存 Issue #1526 を必ず確認する。#1526 がこの障害と semantic duplicate なら、新規 follow-up Issue を作らない。
#1526 の旧 dependency #1502 が既に completed している場合、その dependency は現在 blocker ではないことを確認する。
ただし #1526 の repository implementation をこの #2186 refinement session に混在させないこと。
canonical privileged preflight が #1526 相当の既知障害によって再現性高く停止するなら、
privileged lane の必須性
今回 #2186 は、過去 refinement が direct human intent を
interactive/current-turn/SubAgentから
pre-start/profile/main-processへ意味反転させたこと自体が問題である。
そのため human anchor classification を弱める fallback は使用しない。
特に privileged
preflight.run.with_human_context相当が失敗した場合、run_refinement_preflight.pyを直接実行して mutation へ進むambiguousのまま代用することは禁止する。
環境が安全に canonical lane を実行できなければ fail-closed で終了する。
Phase 1 — SubAgent による独立調査
最低4体の read-only specialist SubAgent を並列で起動する。
全 SubAgent の完了を必ず待ってから親 Agent が判断すること。
途中結果だけで Issue mutation を開始しない。
SubAgent A — human-intent / contract analyst
調査対象:
成果物:
最低限、次を明示すること。
SubAgent B — Claude Code / claude-gpt architecture investigator
current main の実装を読む。
最低限:
scripts/claude-gpt/**.claude/agents/**と provider-neutral policyAgenttool handlingcurrent official Claude Code documentationも確認する。
確認事項:
@agent-...explicit invocation semanticsUserPromptSubmitPreToolUseonAgentSubagentStartSubagentStopStop/StopFailure推測で API / field 名を固定しないこと。
SubAgent C — Spark / proxy compatibility investigator
current official OpenAI informationと current claude-code-proxy implementation/docs を調査する。
最低限:
catalog に model ID が存在することと、
当該 ChatGPT Pro account で actual inference が成功することを別物として扱う。
SubAgent D — adversarial verifier
A〜Cとは独立に current #2186 と予定 reframe を敵対的に評価する。
特に以下を攻撃する。
全SubAgentの完了を待つこと。
Phase 2 — current baseline の再計算
PR #2176 / #2220 / #2222 の current state を fresh readback する。
merged 済みなら、#2186 body の
をそのまま残さない。
current main を baseline として、
を再計算する。
historical head の evidence を current-main evidence として流用しない。
Phase 3 — #2186 reframe_in_place
canonical preflight が正常に通り、SubAgent 調査も完了した場合だけ Issue body を in-place rewrite する。
close/recreate はしない。
タイトルの方向:
実装: 通常 claude-gpt 対話中、明示 @ 指示時だけ GPT-5.3-Codex-Spark SubAgent を起動する中心 Outcome:
@agent-spark-codexを明示した場合だけ起動launch.sh --profile sparkは #2186 の Outcome / closure condition から外す。独立した機能として必要なら別 scope だが、今回勝手に新 Issue を作成しない。
explicit-only gate
agent description の
「明示時だけ使う」
だけを enforcement として認めない。
current Claude Code implementation を確認した上で、可能なら以下の fail-closed model を採用する。
authorization が存在しない Spark Agent call は deny する。
quoted text、code block、過去 turn、typo、別 agent mention を authorization として扱わない。
current Claude Code hook semantics でこの deterministic gate が構築できない場合は、
「description-only explicitness」に格下げせず Stop Condition とする。
causal runtime verification
current main の #2220 / #2222 evidence infrastructure を最大限 reuse する。
少なくとも以下を相関する設計にする。
model の自己申告や prompt output の model 名は証拠にしない。
positive control:
negative controls:
Required knowledge / skills の修正
Required Skills: なしをそのまま残さない。Issue を作業計画として見た際に必要な capability を明示的に分類する。
少なくとも以下のように分離することを検討する。
既存 Issue schema / checker がこの分割を現在許容しない場合は、
勝手に schema を変更せず、その制約を明示して Stop Condition / follow-up candidate とする。
Phase 4 — terminal review
Issue body mutation 後は必ず live GitHub readback を取得する。
を一致させる。
stale pre-mutation artifact の approve を使わない。
issue-refinement-loop の canonical terminal review を完了させ、
その後
issue-contract-reviewを fresh に実行する。目標 terminal state:
status: goが得られなければ実装へ進まない。禁止事項
.pytest_cachedirectory-wide allowlist--profile sparkを OWNER 要求の代替として復活させる終了報告
最後に以下だけを簡潔に報告する。
環境 blocker が残る場合は無理に進めず、何が canonical lane を止めているかを再現可能な証拠付きで報告して終了すること。
このプロンプトのポイントは、前回と同じ retry を命じず、#1526 を重複起票せずに既存 blocker として認識させることと、#2186 では human-intent classification を弱める fallback を明示的に禁止することです。成功した場合も今回は Issue contract の
goまでで止め、実装は別のimpl-review-loopセッションに分離する方が境界が明確です。[-]実装: claude-gpt から GPT-5.3-Codex-Spark を明示 opt-in で選択利用できるようにする[/-][+]実装: 通常 claude-gpt 対話中、明示 @ 指示時だけ GPT-5.3-Codex-Spark SubAgent を起動する[/+]squne121 commentedon Aug 17, 2026
Issue Refinement Loop 終了報告
Iteration: 1(Step 2 review needs-fix → Step 4 rewrite → Step 2 final review approve)
旧 body の needs-fix blockers(10件):
applicable_acs/execution_environment/skip_conditions/fallback_policy/artifact_requirementsが markdown bullet prefix (-) 付きで書かれており checker の^\s*field\s*:正規表現に一致しなかった(5件)scripts/claude-gpt/launch.sh --check-only/scripts/claude-gpt/runtime_smoke_test.sh --profile sparkを直接呼んでおり VC preflight allowlist(rg/test/grep/uv run pytest/pnpm typecheck|lint|test|build等のみ許可)に違反していた(4件)reframe_in_place の内容:
launch.sh --profile sparkによる session-wide pre-start profile 切替)から、通常 claude-gpt session 内で明示@agent-spark-codexmention 時だけ Spark を SubAgent として起動する explicit-only hook gate 設計へ全面 reframe した。## Required Skills/## Required Design Referencesへ正規化して適用、内容は保持)。launch.sh --profile sparkは Outcome/closure condition から明示的に除外し、独立 follow-up Issue も起票しなかった(OWNER 指示通り)。最終状態: VERDICT: approve、BLOCKERS: 0、REVIEWED_BODY_SHA256: sha256:72109e55bf02dba1837aa700959a08cf4daaf451ad133c08611fe1c28ae2f18f。
Final Gate:
issue_kind: implementationのため、本 Issue は通常のimpl-review-loophandoff 対象である。ただし本セッションのスコープは reframe と implementation-ready 判定までであり、handoff の実行(impl-review-loop起動・実装着手・PR作成)は行わない。squne121 commentedon Aug 17, 2026
推奨は、追加 refinement には戻らず、#2186 を専用 Claude Code セッションへ渡して
impl-review-loopを開始することです。#2176・#2220・#2222 は現在すべて merged で、#2186 の現行 contract もこれらを再実装せず baseline として reuse する前提になっています。実装順序は risk-first が適切です。現在の Claude Code 公式仕様では、
@agent-<name>は対象 SubAgent の実行を保証し、--agentsは current session 限定なのに対し.claude/agents/は project scope です。また hooks にはprompt_idがあり、PreToolUse(Agent)ではsubagent_type/model/tool_use_id、完了側ではresolvedModelを観測できます。したがって、Native Claude に Spark 定義を露出させる project-level agent より、claude-gpt launcher が--agentsで session-local Spark agent を注入し、UserPromptSubmit(session_id,prompt_id)→PreToolUse(Agent)で gate する構成を第一候補にすべきです。なおSubagentStart自体は生成を block できないので、authorization enforcement は必ずPreToolUseより前/そこで完結させる必要があります。 ([Claude]1)特に先に実証すべきなのは model routing です。Claude Code は
availableModels等で指定モデルが許可されない場合、条件によって inherited model へ解決する仕様があるため、Spark を要求したのに ordinary model が動く silent fallback を絶対に PASS にしてはいけません。requested model → resolvedModel → proxy observed modelの三点一致を live canary で最初に確認するのが重要です。OpenAI 側でも Spark は research preview、text-only、128K context、独立 rate limit とされています。 ([Claude]1)以下をそのまま Claude Code に渡せます。
Claude Code 作業プロンプト — Issue #2186 impl-review-loop
squne121/loop-protocolの Issue #2186 を実装してください。対象:
Issue #2186 の current live body を SSOT とし、過去の
launch.sh --profile spark前提の旧設計へ戻さないでください。最終目標
通常の claude-gpt 対話セッションについて、
@agent-spark-codexを明示した場合だけgpt-5.3-codex-sparkSubAgent を exactly once 起動する状態へ持っていってください。
実行モード
impl-review-loopを使用してください。Stop Conditions に該当しない限り、人間への途中承認を求めず、
を反復し、merge-ready / reviewer APPROVE / blockers 0 のマージ直前まで進めてください。
main への merge は実行しないでください。
既存 PR / branch / worktree が #2186 用に存在する場合は重複作成せず再利用してください。
必須: SubAgent を並列利用する
実装を始める前に、最低4体の read-only 調査 SubAgent を並列起動してください。
SubAgent A — contract / scope analyst
調査対象:
成果:
を簡潔に整理する。
SubAgent B — Claude Code runtime specialist
最新の公式 Claude Code documentation とローカル installed Claude Code の挙動を確認する。
特に確認:
--agentsの current-session scope.claude/agents/の project scope@agent-<name>explicit invocationUserPromptSubmitのsession_id/prompt_id/promptPreToolUse(Agent)のtool_use_id,tool_input.subagent_type,tool_input.modelSubagentStart/SubagentStopPostToolUse(Agent).tool_response.resolvedModelCLAUDE_CODE_SUBAGENT_MODELavailableModelsによる substitution / fallback可能な限り一次資料を使用すること。
SubAgent C — claude-gpt / proxy routing specialist
current main の以下を調査:
scripts/claude-gpt/launch.shscripts/claude-gpt/lib.shenv -i特に、
gpt-5.3-codex-sparkを特定 SubAgent の request だけに指定したとき、ことを証明するための 最小 live canary を設計する。
SubAgent D — adversarial evidence / test designer
AC1-AC9 を敵対的に検討し、最低でも以下の negative controls を設計する:
SubAgent completion barrier
4体すべてが terminal state になるまで待ってください。
一部の SubAgent の結果だけで実装を開始してはいけません。
SubAgent が異常終了した場合は、必要なら一度 replacement を起動し、その完了も待ってください。取得できなかった調査結果を「問題なし」と推定して先へ進めないでください。
全員の結果を親 session で統合してから実装方針を確定してください。
risk-first feasibility gate
大規模な実装を始める前に、次の2点を実証してください。
Gate 1 — session-local registration
第一候補は launcher-owned
--agentsregistration としてください。Claude Code 公式仕様上、
--agentsは current session scope です。一方.claude/agents/は project scope です。したがって、
という #2186 の contract を満たすため、原則として launcher から
--agentsでspark-codexを注入してください。.claude/agents/spark-codex.mdは Allowed Path であっても、project-level discovery により Native runtime に Spark agent を露出させるなら使用しないでください。Allowed Path は「変更必須」を意味しません。
Gate 2 — exact Spark model resolution
最小 live canary で、
の三点がすべて exact:
gpt-5.3-codex-sparkになることを確認してください。
Claude Code が unsupported / blocked model を inherited main model 等へ substitute する場合、その実行を PASS にしてはいけません。
post-hoc に「fallback だった」と記録するだけで AC を満たしたことにもしないでください。
exact Spark routing を安全に成立させられない場合は、Issue の Stop Conditions に従って停止し、再現可能な証拠を報告してください。contract を弱めて先へ進めてはいけません。
authorization gate
実装は fail-closed としてください。
基本 correlation key は current Claude Code が提供する:
session_idprompt_idを利用してください。
独自 turn identity を発明する前に live hook payload を確認してください。
想定フロー:
UserPromptSubmit→ current prompt に canonical Spark invocation が存在することを確認
→
(session_id, prompt_id)keyed single-use authorization 作成→
PreToolUse(Agent)→
tool_input.subagent_type == spark-codexを確認→ 同一
(session_id, prompt_id)authorization を確認→ nested subagent origin でないことを確認
→ authorization を atomic consume
→ allow
→
SubagentStart→
SubagentStop/PostToolUse(Agent)→ causal evidence 検証
authorization の保存物に raw prompt、credential、token、raw auth を残さないでください。
必要なのは最小限の digest / nonce / identifiers / boolean state のみです。
重要
SubagentStartは監査・相関に使ってよいですが、authorization enforcement をSubagentStartまで遅らせてはいけません。Spark creation の deny は
PreToolUse(Agent)で完了させてください。canonical @ mention の検証
UserPromptSubmit.promptの単純 substring match だけで実装を完成扱いしないでください。実機で少なくとも:
@agent-spark-codexを比較し、Claude Code 自身の actual mention resolution / Agent invocation と deterministic に相関できるか確認してください。
もし current hook/API surface だけでは「実 invocation mention」と「文字列として記述された mention」を pre-execution に区別できず、AC2 の quoted/code negative control を fail-closed に保証できないなら、曖昧な parser を実装して APPROVE に持っていかず、fixed contract を満たせない Stop Condition として終了してください。
model override / fallback safety
以下を明示的に確認してください。
CLAUDE_CODE_SUBAGENT_MODELが Spark agent frontmatter/model selection を横取りしないmodelが Spark 以外へ override されないPreToolUse(Agent).updatedInputを使って exact model を固定することの妥当性を検討するavailableModels等による inherited-model substitution を検出するmerged baseline の reuse
以下は current main の merged baseline として reuseし、再設計しないでください。
特に既存の:
subagent_causal_evidence_verdict()extract_claude_hook_lifecycle_events()を可能な限りそのまま利用してください。
#1526 の扱い
Issue #1526 の
.pytest_cache/v/cache/nodeidsunauthorized-write attribution 問題は #2186 の Out of Scope です。もし impl-review-loop / runtime guard がこの既知問題に遭遇しても、
.pytest_cache全体を allowlist しないでください。
#2186 の実装と独立した control-plane blocker であれば、証拠を残して Stop Condition として報告してください。
tests / runtime verification
Issue #2186 current body に記載された Verification Commands を canonical command として実行してください。
少なくとも:
を満たしてください。
さらに Runtime Verification Applicability が
immediateなので、pytest のみで closure してはいけません。worktree-agent-runtime-smokeを利用して live claude-gpt session を検証してください。最終 live sequence:
を同一 main session で確認すること。
証拠は sanitized structured evidence とし、credential / token / raw auth / raw request-response / raw transcript を GitHub に投稿しないでください。
external network
必要な範囲で外部ネットワーク利用を許可します。
使用してよい対象:
ただし:
review loop
implementation 完了後は必ず独立 reviewer SubAgent を使用してください。
reviewer には Issue #2186 current body、OWNER intent、PR diff、tests、live evidence を渡し、敵対的に:
を検査させてください。
REQUEST_CHANGES の場合は blocker ごとに fix_delta を実装し、該当 tests/live verification を再実行して reviewer を再起動してください。
reviewer が APPROVE / blockers: [] になるまで反復してください。
Stop Conditions
Issue #2186 current body の Stop Conditions を厳守してください。
特に以下では勝手に contract を変更せず停止してください。
最終報告
終了時に以下を報告してください。
merge は実行せず、merge-ready で停止してください。
この形なら、refinement で最も重要になった 「explicit current turn / SubAgent / main model unchanged」 を実装中に再び反転させる可能性をかなり抑えられます。特に
--agentsの session scope とprompt_id/resolvedModelが現行 Claude Code に存在することは、今回の reframe を実装へ落とす上で有利な更新です。 (Claude)fix: PR #2244 adversarial review 指摘の P0/P1 問題を修正する
実装: claude-gpt session内でexplicit @agent-spark-codex明示時だけGPT-5.3-Codex…
fix: PR #2334 human レビュー P0/P1 blocker を反映し mutation_class を宣言 ground…
feat: agent/runtime parity contracts を claude-native/claude-gpt 共通 au…