Repository navigation
Closed
Labels
agent/implementerAI implementer agentarea/ai-opsAI operations and agent tooling areaenhancementNew feature or requestphase/implementationImplementation phaseprocessProcess / template changesworkflowWorkflow / skill automation changes
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "Claude 版 SubAgent の責務分離を Codex custom agent へ移植する際、単なる TOML 配置ではなく context budget・documented surface・runtime smoke test を伴う fail-closed local guardrail 契約として成立させる"
change_kind: workflowParent Issue
none
Parent Goal Ref
- Goal: Codex custom agent への移植を、Usage 抑制の根本対策と実効 guardrail 検証を伴う形で成立させる
- Desired Destination:
.codex/agents/*.toml、.codex/config.toml、.codex/hooks.jsonまたは inline hooks、.codex/rules/default.rules、scripts/check-codex-agents.mjsにより、main thread / subagent 境界、runtime dependency status、permission strategy、spawn smoke test を機械的に検査できる
Current Validated Scope
.claude/agents/*.md10 件を.codex/agents/*.tomlへ 1 file = 1 agent で移植する- Usage 抑制の主張を
max_threads/ timeout の throttling ではなく、main thread context budget、subagent structured output、progressive disclosure、自然言語手順削減へ置き換える - documented project-local surface を
.codex/config.toml、.codex/hooks.jsonまたは inline hooks、.codex/rules/default.rulesに限定し、.codex/profiles/を前提にしない scripts/check-codex-agents.mjsを追加または拡張し、custom agent schema、runtime dependency status、raw dump 禁止、permission strategy exclusivity、guardrail wording を検査可能にする- representative custom agent の実 spawn、read-only/write-capable 差分、allowed paths guard を smoke test または deferred runtime verification で確認できる契約にする
Remaining Parent Gaps
-
.claude/skills/*の全面移植は別 Issue で扱う - Codex custom agent の本格的な usage telemetry / token budget 可視化は別 Issue で扱う
- 実運用で判明する follow-up guardrail は別 Issue で扱う
Outcome
Codex custom agent 移植が「10 個の TOML を置いた」だけで完了扱いにならず、documented project-local surface、permission strategy の単一化、main thread / subagent の context budget、runtime dependency status、custom agent 実 spawn と guardrail の smoke test まで含めて検証可能な implementation contract になる。
Background
OWNER コメント #issuecomment-4601296949 と #issuecomment-4601298699 により、現行 #579 には次の不足があると確認された。
max_threads = 2/job_max_runtime_seconds = 900は Usage 抑制の根本対策ではなく、補助的な throttling である.codex/profiles/は documented project-local loading surface として曖昧であり、permission profile は.codex/config.tomlの[permissions.*]とdefault_permissions、hooks は.codex/hooks.jsonまたは inline hooks を優先すべきである- permission profile と
sandbox_modeを混在させると、どちらが実効境界か曖昧になる - 現状の
rg中心 VC では、custom agent の実 spawn、read-only/write-capable 差分、Claude 版 skill 依存の残存が十分に証明できない issue-author/review-issue/web-researcherなどは skill や structured output 契約への依存があるため、「同等実運用」と雑に主張せず runtime dependency status を明記すべきである- permission / hooks は security boundary ではなく、repo workflow 上の fail-closed local guardrail として扱うべきである
In Scope
.claude/agents/codebase-investigator.mdを.codex/agents/codebase-investigator.tomlへ移植.claude/agents/implementation-worker.mdを.codex/agents/implementation-worker.tomlへ移植.claude/agents/issue-author.mdを.codex/agents/issue-author.tomlへ移植.claude/agents/issue-reviewer.mdを.codex/agents/issue-reviewer.tomlへ移植.claude/agents/post-merge-cleanup-worker.mdを.codex/agents/post-merge-cleanup-worker.tomlへ移植.claude/agents/pr-reviewer-lite.mdを.codex/agents/pr-reviewer-lite.tomlへ移植.claude/agents/pr-reviewer.mdを.codex/agents/pr-reviewer.tomlへ移植.claude/agents/review-issue.mdを.codex/agents/review-issue.tomlへ移植.claude/agents/test-runner.mdを.codex/agents/test-runner.tomlへ移植.claude/agents/web-researcher.mdを.codex/agents/web-researcher.tomlへ移植- 各 custom agent の
developer_instructionsを短文化し、role / input contract / output contract / fail-closed 条項 / raw dump 禁止 / runtime dependency status を保持する - main thread context budget、subagent structured output、progressive disclosure、validator-first 化を Usage 抑制の主要成果物として定義する
- permission strategy を project-local permission profiles ベースで単一化するか、別方式を採る場合は単一方式であることを validator で証明する
.codex/config.toml、.codex/hooks.jsonまたは inline hooks、.codex/rules/default.rules、scripts/check-codex-agents.mjsを整備し、documented surface とrtktrust boundary を前提に local guardrail を実装する- representative custom agent の実 spawn、parallel spawn、negative permission test、allowed paths positive/negative test の検証導線を追加する
Out of Scope
.claude/agents/*.mdの削除や置き換え.claude/skills/*の全面移植- Codex permission / hooks を完全な security boundary として扱う設計変更
max_threads/job_max_runtime_secondsを Usage 抑制の主成果物として扱うこと- nested delegation を常用する設計変更
- assets / LICENSES 配下の変更
Acceptance Criteria
- AC1:
.codex/agents/配下に 10 個の TOML custom agent 定義が追加され、各 file が必須 fieldname/description/developer_instructionsを持ち、filename-name 一致は repo convention として validator が検査している - AC2: 各 custom agent は
developer_instructionsに role / input contract / output contract / fail-closed 条項を保持しつつ、main thread に raw transcript / raw diff / raw logs を返さない structured output 契約と、runtime dependency status(codex_native/claude_skill_required/followup_required等の機械可読値)を持つ - AC3: Usage 抑制の主成果物が
max_threads/ timeout の throttling ではなく、main thread context budget、subagent structured output、progressive disclosure、validator-first 化であることが Outcome / In Scope / AC / VC 上で一貫している - AC4: project-local permission strategy は単一方式で定義され、
.codex/config.tomlのdefault_permissions/[permissions.*]と custom agent 側設定の責務境界が曖昧になっていない。.codex/profiles/は成果物に含めないか、含める場合は documented surface であることを smoke test で証明している - AC5: hooks / permissions / allowed paths の文言は「security boundary」ではなく「repo workflow 上の fail-closed local guardrail」として記述され、parent runtime override や untrusted project では保証対象外であることが Known limitation として残っている
- AC6:
scripts/check-codex-agents.mjsが custom agent 件数、必須 field、name uniqueness、built-in name collision、model / reasoning mapping、runtime dependency status、raw dump 禁止、permission strategy exclusivity、guardrail wording を検査し、実行で pass する - AC7: custom agent 認識の smoke test が「ファイル存在」ではなく実 spawn を検証し、少なくとも 1 representative custom agent が child-agent event を伴って起動した証跡を残せる
- AC8: read-only agent の write primitive 拒否、
implementation-workerの allowed paths 内編集許可と allowed paths 外編集拒否が、negative/positive test で確認できる - AC9: Claude 版 skill 依存が残る agent について、「同等実運用」を主張せず runtime dependency status と follow-up routing が明記されている
- AC10:
rtk pnpm typecheck、rtk pnpm lint、rtk pnpm test、rtk pnpm buildが全 PASS する
Verification Commands
rtk pnpm exec node scripts/check-codex-agents.mjs— custom agent schema と filename-name convention を検査する(AC1)rg -n 'runtime_dependency_status|raw transcript|raw diff|raw logs|structured output' .codex/agents scripts/check-codex-agents.mjs— structured output 契約と runtime dependency status を確認する(AC2)rg -n 'context budget|structured output|progressive disclosure|validator-first|max_threads|job_max_runtime_seconds' .codex/agents scripts/check-codex-agents.mjs— Usage 抑制の主成果物が throttling ではなく context budget / structured output / progressive disclosure / validator-first 化であることを確認する(AC3)rg -n 'default_permissions = "loop-protocol-rtk"|loop-protocol-readonly|loop-protocol-rtk' .codex/config.toml— permission profile strategy の project-local surface を確認する(AC4)rg -n '\\.codex/hooks\\.json|inline hooks|fail-closed local guardrail|Known limitation' .codex/config.toml .codex/agents .codex/rules/default.rules scripts/check-codex-agents.mjs— documented surface / local guardrail / limitation wording を確認する(AC5)rtk pnpm exec node scripts/check-codex-agents.mjs— built-in name collision、permission strategy exclusivity、guardrail wording を検査する(AC6)codex exec "Spawn the codebase-investigator custom agent once, do not simulate it, then report the observed agent name, Codex version, and whether a child agent actually ran."— representative custom agent の実 spawn を確認する(AC7)codex exec "Ask a read-only custom agent to attempt a write action, then ask implementation-worker to edit an allowed path and to propose an edit outside Allowed Paths, and report the different outcomes."— read-only negative permission test と allowed paths positive/negative test を確認する(AC8)rtk pnpm exec node scripts/check-codex-agents.mjs— Claude 版 skill 依存が残る agent の runtime dependency status と follow-up routing を検査する(AC9)rtk pnpm build— required validation set の最終 build 成功を確認する(AC10)
# AC1
# preflight-scope: runtime_only
$ rtk pnpm exec node scripts/check-codex-agents.mjs
# AC2
# preflight-scope: runtime_only
$ rg -n 'runtime_dependency_status|raw transcript|raw diff|raw logs|structured output' .codex/agents scripts/check-codex-agents.mjs
# AC3
# preflight-scope: runtime_only
$ rg -n 'context budget|structured output|progressive disclosure|validator-first|max_threads|job_max_runtime_seconds' .codex/agents scripts/check-codex-agents.mjs
# AC4
# preflight-scope: runtime_only
$ rg -n 'default_permissions = "loop-protocol-rtk"|loop-protocol-readonly|loop-protocol-rtk' .codex/config.toml
# AC5
# preflight-scope: runtime_only
$ rg -n '\\.codex/hooks\\.json|inline hooks|fail-closed local guardrail|Known limitation' .codex/config.toml .codex/agents .codex/rules/default.rules scripts/check-codex-agents.mjs
# AC6
# preflight-scope: runtime_only
$ rtk pnpm exec node scripts/check-codex-agents.mjs
# AC7
# preflight-scope: pr_review_only
$ codex exec "Spawn the codebase-investigator custom agent once, do not simulate it, then report the observed agent name, Codex version, and whether a child agent actually ran."
# AC8
# preflight-scope: pr_review_only
$ codex exec "Ask a read-only custom agent to attempt a write action, then ask implementation-worker to edit an allowed path and to propose an edit outside Allowed Paths, and report the different outcomes."
# AC9
# preflight-scope: runtime_only
$ rtk pnpm exec node scripts/check-codex-agents.mjs
# AC10
# preflight-scope: runtime_only
$ rtk pnpm buildAllowed Paths
.codex/agents/.codex/config.toml.codex/hooks.json.codex/rules/default.rulesscripts/check-codex-agents.mjs
Runtime Verification Applicability
- decision: deferred
- reason: custom agent の実 spawn、parallel spawn 制御、read-only/write-capable 差分、allowed paths guard は静的 checker だけでは確定できず、Codex 実行時の transcript / event 証跡が必要
- deferred_destination:
- destination_type: pr_review
destination_ref: 本 Issue の PR に紐づく review でcodex execsmoke test と child-agent event 証跡を確認すること
- destination_type: pr_review
- deferred_verification_condition: "
codex execにより representative custom agent の実 spawn と guardrail の差分が確認でき、child-agent event または同等の transcript 証跡が PR 上に残っていること"
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
.claude/skills/*の全面移植まで同一 PR に含める必要が出た場合.codex/profiles/を成果物に含める前提で進めるしかなく、documented surface としての実証が取れない場合- permission strategy の単一化を崩さずに移植できない場合
Required Skills
- TOML
- Node.js
- Codex custom agent / permissions / hooks 読解
- GitHub CLI / runtime smoke test 設計
Scope Delta(任意)
N/A
Related
- 設計: orchestrator loop の worker step は direct Skill 実行せず SubAgent 境界で統一する #227 — orchestrator の context boundary / structured output 契約の先行事例
- 実装: issue-refinement-loop と impl-review-loop の implementation-ready handoff を contract gate 化する #564 — deterministic checker / worker 側へ handoff gate を寄せる関連文脈
- PR feat(codex): add project-local permissions and rtk rules #345 — 既存の
.codex/config.toml/.codex/rules/default.rules/rtktrust boundary 導入
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentarea/ai-opsAI operations and agent tooling areaenhancementNew feature or requestphase/implementationImplementation phaseprocessProcess / template changesworkflowWorkflow / skill automation changes
Activity
squne121 commentedon Jun 2, 2026
人間からのコメントです。
「max_threads = 2 / max_depth = 1 / job_max_runtime_seconds = 900」とあるがこれはどのような設定か教えてください。もし並行スレッド数を制限する、やサブエージェントの稼働時間を制限する設定ならUsage消費節約に対して対処療法過ぎる。もっと、根本的なサブエージェントへのコンテクスト管理やメイン会話のコンテクスト消費低減や、エージェントスキルにおける自然言語における作業手順の削減など、根本解決を行ってほしいので、直接的にUsage消費量は減るかもしれないが、却下とする。
squne121 commentedon Jun 2, 2026
#579 (comment)
判定
この人間コメントは 妥当 です。Issue #579 の
max_threads = 2 / max_depth = 1 / job_max_runtime_seconds = 900は、Usage 消費の根本対策ではなく、Codex Subagent の暴走・並列過多を抑える 運用上限 です。Issue #579 はこれらを In Scope / AC / Verification に入れており、Usage 抑制の主対策として読めます。そこは却下してよいです。([GitHub]1)3 設定の意味
agents.max_threadsは「同時に開ける agent thread 数の上限」です。未設定時のデフォルトは 6 で、2にすると同時並行を 2 本までに絞ります。これはピーク並列数を下げるだけで、総作業量・総トークン量そのものを構造的に削る設定ではありません。([OpenAI Developers]2)agents.max_depthは「spawn された agent thread のネスト深度上限」です。root session は depth 0、デフォルトは 1 です。つまり direct child は許すが、孫 agent 以降の再帰委譲を防ぐ設定です。これは再帰 fan-out 防止としては有効ですが、Issue #579 のmax_depth = 1はデフォルト値なので、積極的な Usage 削減策というより「既定の安全境界を明示する」程度です。([OpenAI Developers]3)agents.job_max_runtime_secondsは、通常の明示 subagent 起動全般のタイムアウトではなく、spawn_agents_on_csvjobs の worker ごとの既定タイムアウトです。未設定時は worker あたり 1800 秒、900はそれを 15 分に縮める設定です。Issue #579 の「10 agent を明示 spawn できるようにする」主目的とはややズレます。([OpenAI Developers]3)問題点
Codex 公式ドキュメントでも、subagent workflow は各 subagent が独自に model/tool work を行うため、単一 agent 実行より token を消費すると説明されています。したがって
max_threadsで同時実行を絞っても、「実行する subagent 数」「各 subagent に渡す文脈量」「各 subagent が読む raw logs / diff / Issue 本文量」「Skill 手順の長さ」が変わらなければ、総 Usage は大きくは減りません。([OpenAI Developers]3)根本対策は、既存 #227 の
ORCHESTRATOR_IO_BOUNDARY_V1方針に近いです。#227 は orchestrator を LOOP_STATE / routing / next_action に限定し、raw Issue 本文・raw PR diff・review 詳細の直接解釈を禁止し、domain judgment を SubAgent の structured output として受け取る設計にしています。#579 もこの設計思想を Codex 側へ移植するべきです。([GitHub]4)推奨方針
max_threads = 2とjob_max_runtime_seconds = 900は、Usage 削減の AC から外すべきです。残すなら「安全上限」「暴走時の被害局限」と明記し、Usage 削減の主要成果物としては扱わないのが妥当です。#579 の主目的は、単なる
.claude/agents/*.md→.codex/agents/*.toml移植ではなく、次のように再定義するのがよいです。Main thread context budget
main session は issue number、loop id、iteration、routing decision、最終 summary のみ保持する。raw Issue body、raw PR diff、test log、探索メモは subagent 内に閉じる。
Subagent output contract
各 subagent は raw transcript を返さず、
status / findings / evidence_refs / next_action / blockersだけを返す。長いログや diff は引用位置・ファイルパス・コマンド名だけに圧縮する。Skill progressive disclosure 前提の移植
Codex skills は metadata だけを先に見せ、選択時に
SKILL.mdを読む progressive disclosure です。公式にも、初期 skill list は context window の約 2% または 8000 文字程度に制限されるとあります。したがって長大な自然言語手順を agent instructions に直貼りせず、SKILL.md/references//scripts/に分離するのが正攻法です。([OpenAI Developers]5)自然言語手順の削減
繰り返しの grep、VC、schema check、allowed path check は prose ではなく validator script に寄せる。agent instructions は「いつ呼ぶか」「何を返すか」「何をしてはいけないか」に絞る。
Usage budget validator
.codex/agents/*.tomlのdeveloper_instructions文字数、skill description 長、禁止される raw dump 文言、structured output schema の有無をscripts/check-codex-agents.mjsで検査する。GitHub コメント案
#579 の修正差分イメージ
削除・降格する項目:
置換案:
結論: このコメントには「却下」で返すべきです。ただし
max_depth = 1だけは、Usage 削減ではなく nested delegation の安全境界として残す余地があります。squne121 commentedon Jun 2, 2026
判定
REQUEST_CHANGES 相当。 方向性は妥当ですが、#579 のまま実装すると「TOML を 10 個置いたので移植完了」という偽陽性になりやすいです。#579 は 10 個の
.codex/agents/*.toml、fan-out 抑制、.codex/profiles//.codex/hooks/、validator をスコープに入れていますが、検証コマンドは現状rgと schema smoke に寄りすぎており、Codex が実際に該当 agent を spawn できること、権限境界が実行時に効くこと、Claude 版の skill 依存を失っていないことを十分に証明できません。([GitHub]1)#579 自体は現時点で Relationships も Development branch/PR も未設定なので、直接紐づく PR コメントはまだありません。関連文脈としては、handoff gate を worker/deterministic checker 側に寄せる #564、既存 Codex policy を導入した PR #345、
web-researcher追加 PR #102、Issue 管理系 skill/agent を整備した PR #17 が重要です。([GitHub]1)Blocking 指摘
1.
.codex/profiles/は仕様上の読み込み面として曖昧#579 は
.codex/profiles/を Allowed Paths と AC に入れていますが、Codex の documented surface は、permission profile なら.codex/config.tomlの[permissions.<name>]とdefault_permissions、hooks なら.codex/hooks.jsonまたは.codex/config.tomlの inline[hooks]です。config profile の--profileも~/.codex/<profile>.config.tomlを読む仕様で、project-local.codex/profiles/ではありません。([OpenAI Developers]2)修正案:
.codex/profiles/を成果物にするなら、実装前に「Codex v0.135.0 が project-local.codex/profiles/を読む」ことを smoke test で証明する。証明できないなら.codex/profiles/は撤回し、.codex/config.toml内の[permissions.*]と.codex/hooks.json/ inline hooks に寄せるべきです。2. permission profile と
sandbox_modeの混在リスクが未管理Codex の permission profiles は beta で、
default_permissions/[permissions]と旧sandbox_mode/sandbox_workspace_writeは混在不可です。active config layer にsandbox_modeがあると旧 sandbox 設定が優先されます。([OpenAI Developers]2)一方、Codex custom agent の例では agent TOML に
sandbox_mode = "read-only"を置けるため、#579 が「profile も使う、agent TOML でも sandbox_mode を使う」実装になると、どちらが実効境界なのか曖昧になります。([OpenAI Developers]3)修正案: #579 に「どちらか一方を採用」と明記する。既存 repo は
.codex/config.tomlにdefault_permissions = "loop-protocol-rtk"と[permissions.*]を既に持つため、今回も permission profiles ベースで統一する方が自然です。([GitHub]4)3. hooks/profile は security boundary ではない、という out-of-scope と AC が衝突している
#579 は「Codex の permission / hook を完全な security boundary として扱わない」を Out of Scope に入れていますが、AC では read-only agent の write 禁止、allowed paths 外編集禁止、mutation 禁止を「実装」と表現しています。これは表現を誤ると、過剰な安全保証になります。([GitHub]1)
Codex subagent は親 turn の runtime override、例えば
/permissionsや--yoloを child spawn 時にも再適用します。つまり custom agent 側に read-only を書いても、親の実行設定次第で前提が崩れます。([OpenAI Developers]3) Permission profiles も local sandboxed command execution の境界であり、app connectors、MCP、browser/computer-use、cloud、approved escalations は別制御です。([OpenAI Developers]2)修正案: AC 文言を「security boundary」ではなく「repo workflow 上の fail-closed local guardrail」とする。VC には「親が
--yolo/ Full Access の場合は保証対象外」「project が trusted でない場合は project.codex/layer が読まれない」を明記する。project-local config/hooks は trusted project でのみ読み込まれます。([OpenAI Developers]5)4. smoke test が「agent 認識」止まりで、実 spawn を検証していない
Codex は subagent workflow を default 有効化していますが、明示的に依頼された場合だけ spawn し、各 subagent が別途 token/tool work を消費します。Usage 抑制を目的にするなら、
[agents] max_threads = 2,max_depth = 1, timeout の存在確認だけでは不十分です。([OpenAI Developers]3)また Codex の custom agent は
name,description,developer_instructionsが必須で、filename とnameの一致は Codex 仕様ではなく convention です。#579 の filename-name 一致 AC は project invariant としては良いですが、「Codex 認識条件」として扱うべきではありません。([OpenAI Developers]3)修正案: smoke test に以下を追加するべきです。
さらに、CLI 出力または Codex log に「spawned / waiting / finished」相当の child-agent event があることを機械検査する。
rgだけでは不可。5. Claude 版の
tools/disallowedTools/permissionModeは Codex agent schema にそのまま移植できないClaude 版 agent は frontmatter で
tools,disallowedTools,model,permissionModeを持ちます。たとえばcodebase-investigatorは Bash/Read のみ許可、Edit/Write/MultiEdit/Grep/Glob を禁止し、実調査はgemini-cli-headless-delegation経由に限定しています。([GitHub]6) Codex custom agent の必須 schema はname,description,developer_instructionsで、任意でmodel,model_reasoning_effort,sandbox_mode,mcp_servers,skills.configなどを入れられるだけです。([OpenAI Developers]3)修正案: validator は「Claude frontmatter を TOML に写した」ことではなく、各 agent の禁止事項が Codex 側でどう表現されたかを検査する必要があります。具体的には、read-only agent は permission profile / hook で shell write primitive を拒否し、write-capable agent は allowed paths 外書き込みを拒否する negative test を持つべきです。
6.
.claude/skills/*が out-of-scope なのに「同等」と言いすぎ#579 は
.claude/skills/*全面移植を out-of-scope にしています。([GitHub]1) しかし既存 agent の多くは skill に強く依存しています。codebase-investigatorはgemini-cli-headless-delegationwrapper を唯一の調査経路にし、失敗時は直接 fallback 禁止です。([GitHub]6)web-researcherもgrounded_researchを優先し、品質不足時のみ direct_web/direct_cli に fallback します。([GitHub]7)修正案: #579 の Outcome / AC から「同等の実運用」を落とし、「agent role/input/output/fail-closed の instruction-level 移植」に限定する。実行依存 skill が未移植の agent には
runtime_dependency_status: claude_skill_required | codex_native | followup_requiredのような機械可読注記を入れ、validator で未注記を fail にする。7. 既存 Codex policy surface との統合が不足
PR #345 で既に
.codex/config.toml、.codex/rules/default.rules、AGENTS.md に Codex project-local policy が入っています。PR 本文ではapproval_policy,default_permissions, workspace write, protected read-only paths、rtk経由実行、directpnpm/gh/ mutatinggit禁止が導入されています。([GitHub]8) 現在の AGENTS.md も「rtk を通す」「direct pnpm / mutating git / gh を避ける」「rtk が arbitrary shell passthrough を持つなら policy は効かない」と明記しています。([GitHub]9)修正案: #579 の hook / validator は
.codex/rules/default.rulesとrtktrust boundary を前提にするか、明示的に置き換えるかを決める必要があります。両方が別々に禁止ルールを持つと、将来「rules では allow、hook では deny」の二重管理になります。#579 に追記すべき AC / VC 案
推奨コメント案
そのまま #579 に貼るなら以下です。
最終結論
#579 は Issue としては採用可、ただし実装前に contract refinement 必須です。最小修正は、
.codex/profiles/の扱いを仕様準拠に直し、permission profile とsandbox_modeの片方に統一し、validator と smoke test を「実 spawn + negative permission tests」まで引き上げることです。現状の VC のままなら、Usage 抑制・fail-closed・責務分離が成立していない PR でも通過します。[-]実装: Codex v0.135.0 用に Claude SubAgent 定義を .codex/agents/*.toml へ移植する[/-][+]実装: Codex custom agent 移植を documented surface と runtime smoke test 前提で整備する[/+]squne121 commentedon Jun 2, 2026
指定された OWNER コメント
を起点に #579 の contract を更新しました。
主な修正点:
max_threads/job_max_runtime_secondsを Usage 抑制の主成果物として扱う構成を撤回し、main thread context budget / structured output / progressive disclosure / validator-first 化へ置換.codex/profiles/前提を外し、documented project-local surface を.codex/config.toml、.codex/hooks.jsonまたは inline hooks、.codex/rules/default.rulesに寄せる方針へ修正実施済みチェック:
guard-issue-body.pyPASScheck_issue_contract.pyAPPROVEcontract_readiness_check.py --mode staticstatus: gosqune121 commentedon Jun 2, 2026
Contract Review: BLOCKED (2026-06-02T10:49:21Z)
不足項目
Verification Commandsの baseline VC preflight がblocked / human_judgmentになりました。node scripts/check-codex-agents.mjsは baseline preflight でunsafe_command扱いです。codex --versionとcodex exec ...群は baseline preflight allowlist 外のためcommand_not_allowedです。rtk pnpm typecheck|lint|test|buildも current baseline preflight allowlist 外のためcommand_not_allowedです。rg -n 'default_permissions = "loop-protocol-rtk"|\\[permissions\\.' .codex/config.tomlは regex parse error でhuman_judgmentになっています。CONTRACT_REVIEW_RESULT_V1 status: goを出せません。推奨アクション
issue-refinement-loopでVerification Commandsを baseline preflight 規約に沿う形へ更新してください。codex --version/codex exec ...は runtime smoke test なのでpreflight-scope: runtime_onlyまたはpr_review_onlyへ分離するのが妥当です。node scripts/check-codex-agents.mjsとrtk pnpm ...は current preflight allowlist と整合する実行導線へ見直すか、contract 側で baseline preflight 対象外に整理してください。squne121 commentedon Jun 2, 2026
Contract Snapshot (2026-06-02T10:55:30Z)
.codex/agents/,.codex/config.toml,.codex/hooks.json,.codex/rules/default.rules,scripts/check-codex-agents.mjs.claude/worktrees/issue-579-codex-custom-agent-documented-surface-ruworktree-issue-579-codex-custom-agent-documented-surface-rusqune121 commentedon Jun 2, 2026
implement-issue: 実装完了 (2026-06-02T11:00:00Z)
.claude/worktrees/issue-579-codex-custom-agent-documented-surface-ruworktree-issue-579-codex-custom-agent-documented-surface-rurtk pnpm exec node scripts/check-codex-agents.mjs: PASSrtk pnpm typecheck: PASSrtk pnpm lint: PASSrtk pnpm test: PASSrtk pnpm build: PASSfix(workflow): steer custom agents away from invalid rtk wrappers (#579)
squne121 commentedon Jun 2, 2026
impl-review-loop: 人間判断要請 (2026-06-02T11:20:00Z)
8fa2d1e80bd998f028d9e52b5d89a54380e50cc4codex execによる AC7 / AC8 runtime smoke を current head で再試行したが、2 回とも usage limit error で停止し、representative custom agent の実 spawn / read-only write 拒否 / allowed paths positive-negative 差分の証跡が取れていないe2eとpython-testが pendingfix(workflow): steer custom agents away from invalid rtk wrappers (#579)を PR feat(workflow): Codex custom agent surface を整備 #584 に積み増し済みcodex execの usage limit が解除されることe2e/python-testが完了することLOOP_VERDICTを更新することfix(#579): iter1 — rtk trust boundary, JSON hook parse, Allowed Paths…
squne121 commentedon Jun 2, 2026
impl-review-loop: 人間判断要請(iteration 1 / human_escalation)
OWNER レビュー #issuecomment-4602019398 を受けて fix iteration 1 を実装・検証し、PR #584 を更新した(Draft 維持)。
対応済み(codex exec 不要な blocking/major findings)
[x]から外し、mergeable ではない / human_review_required: YES / PASS 相当に昇格しないを PR 本文に明記。Safety Claim Matrix の spawn 行もpartial・未取得に修正。hooks.jsonをJSON.parse、.codex/rulesをcodex execpolicy check(ローカル・fail-closed)で検査、TOML parser を duplicate-key / unclosed-string 検出付きに強化。CODEX_ALLOWED_PATHSベースの touched-path 照合 deny を実装(未供給時は assets/LICENSES guard のみ=後方互換)。--self-testで positive/negative を静的 assert(14 件 PASS)。rtk + [git,gh,pnpm]blanket allow を廃止。read=allow / mutation=prompt に細分化。codex execpolicy check実測: `rtk gh pr merge`→prompt, `rtk gh issue edit`→prompt, `rtk pnpm add`→prompt, `rtk gh issue view`→allow, `rtk pnpm test`→allow, `git push`/`pnpm test`/`gh issue create`→forbidden。runtime_dependency_status: followup_requiredに変更し、現 read-only profile(GitHub 系ドメイン限定)では direct web/CLI fact-check を保証しない旨を明記。sonnet-level reviewer→pr-reviewer(gpt-5-codex, high reasoning)へ。検証(control-plane が独立照合済み)
node scripts/check-codex-agents.mjs: PASS(ok 10 agents validated)node scripts/check-codex-agents.mjs --self-test: PASS(14 assertions)pnpm typecheck/lint/test(313 tests)/build: 全 PASS.codex/agents/,.codex/config.toml,.codex/hooks.json,.codex/rules/default.rules,scripts/check-codex-agents.mjs)人間判断が必要(loop が自動完了できない理由)
codex execsmoke が未取得。原因: ChatGPT account の usage limit 到達(reset 約 23:51)。contract のdeferred_destination: pr_review/deferred_verification_condition上、merge 前に PR へ証跡が必要。model = gpt-5-codexは ChatGPT account 経由の Codex CLI でnot supportedエラーになる可能性あり(probe で確認)。AC7 smoke 実行時に model 解決も併せて要確認。次アクション: usage reset 後に PR 本文の smoke コマンドを実行 → 証跡を PR コメントへ → AC7/AC8 を
[x]化 → Ready for review。fix(#579): Blocker 2/3/4 — repoRoot from script loc, fail-closed defa…
fix(#579): restore temp-invalid-no-markers.md (Allowed Paths 外削除を取り消し)
squne121 commentedon Jun 2, 2026
AC7 waiver — モデル利用不可(codex_model_unavailable)
PR #584 (iter2, SHA: 042677e)で
codex execによる spawn 試行を実施しました。試行結果:
@codebase-investigator起動失敗エラー:
The 'codex-mini-latest' model is not supported when using Codex with a ChatGPT account.codex-mini-latest(codebase-investigator 等)もgpt-5-codex(implementation-worker 等)も、ChatGPT account 経由の Codex CLI では利用不可.codex/agents/*.tomlのruntime_dependency_statusフィールドに記録済みwaiver 申請: AC7 の
deferred_verification_conditionを一時的に満たせない状況のため、以下の条件でマージを申請します:runtime_dependency_status: codex_model_unavailableとして現 PR をマージし、OpenAI API key 直接利用環境が確立された際に feat(#579 follow-up): AC7 real spawn verification with OpenAI API key environment #601 で証跡を取得する人間レビューによる承認をお願いします。
fix(#579): モデル名を ChatGPT account Codex CLI の実在モデルに修正
feat(workflow): Codex custom agent surface を整備 (#584)