Skip to content

実装: .codex/agents/*.toml へ delegation metadata を追加し implementation-designer を新規追加する #1839

Closed as not planned

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1833"
goal_ref: "implementation-worker と implementation-designer の最小 agent 定義を追加し、任意の read-only 設計調査を明示する"
change_kind: code

Parent Issue

#1833

Parent Goal Ref

  • Goal: root/main ownership を維持した native Multi-Agent V2 minimal harness。
  • Desired Destination: worker/designer の最小 behavioral contract。

Current Validated Scope

Remaining Parent Gaps

Outcome

implementation-worker が任意で一件の read-only design investigation を implementation-designer に委譲でき、designer は結果を返すだけで編集・テスト・Git/PR操作・child起動を行わない agent definition になる。

In Scope

  • .codex/agents/implementation-worker.toml に、designer への任意・一件・read-only の design investigation を明記する。
  • .codex/agents/implementation-designer.toml を追加し、approved contract と関連コードを read-only で分析し、設計上の観測とリスクを返す責務を明記する。
  • designer が編集、テスト実行、Git操作、PR操作、Issue/GitHub mutation、child agent 起動を行わないことを明記する。
  • read-only は behavioral contract であり、強制 sandbox や security boundary の証明ではないことを明記する。

Out of Scope

  • 全 agent TOML への DELEGATION_POLICY block 一括追加。
  • structured output schema、graph policyとの parity checker、graph validator、ledger、digest。
  • .codex/hooks.json の変更、write-capable nested delegation。

Acceptance Criteria

  • AC1: 変更対象は原則として worker TOML と新規 designer TOML の二つだけである。
  • AC2: worker の任意委譲は designer 一件の read-only design investigation に限定される。
  • AC3: designer の禁止事項(編集、テスト、Git、PR、GitHub mutation、child起動)が明示される。
  • AC4: read-only instruction を sandbox/security proof と主張しない。
  • AC5: 新しい structured output schema、graph parity checker、.codex/hooks.json 変更を導入しない。

Verification Commands

# AC1
# baseline-expect: pass
$ git diff --name-only origin/main -- .codex/agents/implementation-worker.toml .codex/agents/implementation-designer.toml
# AC2
$ rg -n "implementation-designer" .codex/agents/implementation-worker.toml
# AC3
# baseline-expect: fail
$ rg -n "child" .codex/agents/implementation-designer.toml
# AC4
# baseline-expect: fail
$ rg -n "behavioral" .codex/agents/implementation-designer.toml
# AC5
# baseline-expect: pass
$ git diff --name-only origin/main -- .codex/hooks.json

Allowed Paths

  • .codex/agents/implementation-worker.toml
  • .codex/agents/implementation-designer.toml

Dependencies

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • 実 runtime が agent-local instruction を security enforcement として扱う必要がある場合。
  • Allowed Paths 外の変更、または .codex/hooks.json 変更が必要な場合。
  • worker/designer以外の agent TOML 変更が必要な場合。
  • graph policy、parity checker、structured output schema を追加する必要がある場合。
  • designer に編集、テスト、Git、PR、GitHub mutation、child起動のいずれかが必要な場合。
  • read-only behavioral contract を security proof としなければならない場合。

Required Skills

  • なし

Required Design References

  • docs/dev/agent-skill-boundaries.md
  • .codex/config.toml

Runtime Verification Applicability

decision: deferred
reason: "本 Issue は agent definition の behavioral contract。live nested canary は #1842 が所有する。"
deferred_destination: "#1842"
deferred_verification_condition: "native runtimeでworkerからdesignerのspawn/joinを観測できること"

Scope Delta(任意)

N/A

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Jul 28, 2026
  2. squne121 commented on Aug 1, 2026

    @squne121
    OwnerAuthor

    implementation-designer って必要?
    Issueそのものが作業計画として作成しているつもり、運用設計のつもりなんだけど。さらに作業計画を出させる?
    ClaudeCodeには同等のサブエージェントを作らない?

  3. squne121 commented on Aug 1, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES。現状の #1839 は、そのままでは実装不能です。
    指定コメントの懸念は妥当です。特に「implementation-designer は本当に必要か」という問いに対する根拠がなく、既存agentとの責務重複、Claude Codeとの非対称、validatorとの矛盾が残っています。

    推奨判断は、#1839 を現在の形では not planned とし、既存 codebase-investigator を再利用する設計へ戻すことです。

    Findings

    Blocker 1: Allowed Paths内ではCIを通せない

    #1839 は変更対象を次の2ファイルに限定しています。

    • .codex/agents/implementation-worker.toml
    • .codex/agents/implementation-designer.toml

    同時に、validator・fixture・テストの変更をスコープ外にしています。

    しかし現在の scripts/check-codex-agents.mjs は、agentファイルの一覧を固定し、runtime-contract fixtureのagent件数と実ファイル件数が一致することを検証しています。現在は14 agentを前提としており、新しいTOMLを追加すると、少なくとも以下の追従が必要です。

    • scripts/check-codex-agents.mjs
    • tests/fixtures/codex-agent-config/expected-runtime-contract.json
    • 関連pytest
    • read-only/write agent分類

    つまり、Allowed Pathsを守ればvalidatorが失敗し、validatorを直せばAllowed Paths違反になるため、現契約では完了可能なPRを作れません。

    また、「設定コメント以外のruntime consumerはない」という Current Validated Scope も事実と一致しません。実際にはagent inventory validatorとruntime-contract fixtureがconsumerです。

    P1: implementation-designer の固有責務がない

    リポジトリには既に以下が存在します。

    • Issue本文: Outcome、AC、Allowed Paths、Verification Commandsを含む承認済み作業契約
    • implementation-worker: live Issueを正本として実装するagent
    • codebase-investigator: 関連コード、影響範囲、依存関係、リスクをread-onlyで調査するagent

    implementation-worker.toml は、承認済みIssueを読み、implement-issue skillを正本として実装する責務を既に持っています。

    codebase-investigator.toml は、コードベース調査、evidence、影響範囲、blockerをread-onlyで返す役割を既に持っています。

    さらに責務境界文書では、semantic planningはIssue refinement側で一度だけ行い、consumerが再分類しない設計になっています。SubAgentは役割、Skillは手順という分離も正本化されています。

    したがって、新しいdesignerは次のいずれかになります。

    1. Issueで確定済みの設計を再検討する「shadow planner」
    2. codebase-investigator と同じ調査を行う重複agent
    3. 意思決定権のない一般的な助言を返すだけの追加モデル呼び出し

    現Issueには、designerだけが処理できる入力、固有の出力、呼出条件、既存agentでは不足する理由がありません。

    P1: canaryのためにproduction surfaceを作っている

    親 #1833 は implementation-worker → implementation-designer を固定判断として記載し、#1842 はそのedgeを実runtimeで試すcanaryになっています。

    しかし、productionで必要な処理が先に存在するのではなく、nested canaryを実施するために新しいagent役割を作っている構造です。これは順序が逆です。

    まず既存のread-only agentでnested delegationが有益かを実測し、効果が確認された後に専用roleへ分離すべきです。OpenAIの公式資料でも、custom agentは狭く明確な責務に限定し、subagent利用には追加トークンとcoordination overheadが発生すると説明されています。([OpenAI Developers]1)

    現状なら、次のどちらかで十分です。

    • root → codebase-investigator
    • worker → codebase-investigator の限定的な調査委譲

    後者が実際の運用で反復利用されることを確認してから、専用designerを検討するのが妥当です。

    P1: #1833・#1839・#1842 の依存関係が矛盾している

    親 #1833 のdependency orderは、概ね次の順序です。

    #1839
      ↓
    #1841
      ↓
    #1842
    

    一方、#1842 は次のように記載しています。

    designer定義が存在しない状態では、named custom agentとしてdesignerを起動できないため、この依存定義は成立しません。

    さらに #1842 には次の問題があります。

    • In Scopeがnested delegationなのに、Stop Conditionsに「nested SubAgent delegationが必要になった場合」がある
    • AC1〜AC4の検証コマンドが主に codex --version
    • codex --version ではspawn、join、worker継続、child non-mutationを検証できない
    • #1839未完了でも#1842へ進める記述になっている

    #1839だけを直しても、#1842の契約も同時に再整合しなければなりません。

    P1: Claude Codeとの非対称性は未解決。ただし両方に追加すればよいわけではない

    現在のClaude Code側には既に次があります。

    • .claude/agents/implementation-worker.md
    • .claude/agents/codebase-investigator.md

    Claude側のimplementation-workerは、nested delegationを最小限にし、現状ではtest-runnerのみを許可しています。また、tools一覧にAgent toolがなく、designerを直接spawnする構成ではありません。

    Claude Code自体は現在nested subagentをサポートしています。しかしAnthropicの公式ガイダンスでは、planning・implementation・testingのように文脈共有が大きい工程はmain conversationで扱い、同種の処理を同じ指示で繰り返しspawnする場合にcustom subagent化することを推奨しています。([code.claude.com]2)

    したがって、指定コメントへの回答は次です。

    • Claude Codeでも同等agentは技術的に作れる
    • ただしCodexに追加したからClaudeにも追加する、というparity目的だけでは不適切
    • まずdesignerという役割自体が必要かを判断すべき
    • 現状では両runtimeとも既存 codebase-investigator の利用で足りる

    Codexだけに残す場合も、Codex-only roleである理由とparity exceptionが必要です。現在のparity checkerではCodex-only例外が事実上Spark系列に限定されているため、ここでもvalidator・fixture変更が発生します。

    P2: read-only designerは独立したsecurity boundaryにならない

    #1839自身も、read-onlyはbehavioral contractでありsecurity proofではないと認めています。この点は正しいです。

    Codex公式仕様でも、subagentには親turnのruntime overrideやpermission selectionが再適用されます。したがって、designer TOMLに禁止事項を書いても、独立した権限分離境界にはなりません。([OpenAI Developers]1)

    PR #1879系の判断でも、agent-local permission profileを実効sandboxとして信用しない方針が採られています。

    つまりdesigner追加の価値はセキュリティではなく、純粋に「別contextでの分析品質向上」に限られます。その品質向上を示す指標がIssueにありません。

    指定コメントへの直接回答

    implementation-designer は必要か

    現在の定義では不要です。

    Issue契約と既存 codebase-investigator の間に、designerだけが所有する責務がありません。

    Issueが作業計画なのに、さらに作業計画を出させるのか

    出させるべきではありません。

    workerが追加調査を必要とする場合も、designerがIssueのOutcome・AC・Allowed Pathsを再設計してはいけません。許されるのは、承認済み契約の範囲内での次のようなread-only evidence収集です。

    • 関連シンボルと呼出関係
    • 変更候補の比較
    • 既知の回帰リスク
    • 検証漏れ候補
    • 根拠となるファイル位置

    これは既存 codebase-investigator の責務です。

    Claude Codeにも同等agentを作るべきか

    現時点では作るべきではありません。

    Codex側designerを採用しないのが第一選択です。将来、専用designerを反復利用する実績ができた場合に、Codex・Claude双方へ同じsemantic roleを追加するのが適切です。

    推奨処置

    推奨案: #1839 を not planned

    1. #1839を「既存 codebase-investigator で代替可能」としてcloseする。

    2. #1833から固定された implementation-worker → implementation-designer edgeを削除する。

    3. #1842を次のいずれかへ変更する。

      • implementation-worker → codebase-investigator の限定canary
      • root→既存read-only agentのsmokeで十分なら #1842もnot planned
    4. .codex/config.toml の「root + worker + designer」というconcurrency説明を、実在するagent構成へ修正する。

    5. #1833のdependency graphと各Issueのnative dependencyを再同期する。

    designerを残す場合の最低条件

    残すなら、#1839の全面改訂が必要です。

    • scripts/check-codex-agents.mjs、runtime-contract fixture、関連テストをAllowed Pathsへ追加

    • designerが既存 codebase-investigator では代替不能な理由を記載

    • 呼出条件を明示

      • Issue内に未確定のbounded design choiceがある
      • 一回のみ
      • workerが自力で判断すると変更範囲が拡大する場合
    • designerがIssue契約を変更・再解釈しないことを明記

    • 出力を最低限構造化

      • observations
      • alternatives
      • risks
      • evidence references
      • recommended option
      • unresolved blockers
    • workerが助言を採用しない場合も継続可能にする

    • #1839を#1842のhard predecessorにする

    • #1842のVCを実際のspawn/join traceへ置換

    • Claude parityを実装するか、Codex-only例外を正式に定義

    • モデル呼出し回数、推論量、token budgetを限定する

    最終結論

    このIssueは「最小Multi-Agent harness」を掲げながら、実際には次の表面積を増やします。

    • 新しいagent role
    • 新しいnested edge
    • 新しいruntime canary
    • agent inventoryとfixtureの更新
    • Claude/Codex parity判断
    • 出力・consumer契約
    • 継続的なモデル呼出しコスト

    その一方で、既存 codebase-investigator との差分は定義されていません。

    したがって、#1839は現状のまま実装せず、既存agent再利用へ縮退するのが妥当です。指定コメントは設計を止めるだけの十分なblocking feedbackです。

  4. squne121 commented on Aug 1, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: superseded_by_decision

    • Cause: anchor comment(OWNER, comment)が #1839 を not planned として close し、既存 codebase-investigator を再利用する設計へ縮退することを明示的に決定した。
    • Classification: superseded_by_decision
      • 人間(OWNER, squne121)が close / 前提不採用を明示している
      • Outcome を in-place で修正しても目的を維持できない(implementation-designer という新規 role 自体の固有責務が否定されている)
      • 代替先(既存 codebase-investigator)が決定論的に再利用可能
    • Mechanical fixes applied during this loop (iteration 1): Verification Commands の baseline-expect 注釈欠落(AC1/AC3/AC4/AC5)を修正済み。この修正は close 判断に影響しない。
    • Iteration: 2(needs-fix → 修正 → approve、構造チェックは pass。ただし anchor comment の domain judgment により not planned へ収束)

    Owner Decision(要約)

    • implementation-designer は既存 codebase-investigator と重複し、固有責務が定義されていない。
    • 現契約の Allowed Paths(worker/designer TOML のみ)では scripts/check-codex-agents.mjs の runtime-contract fixture 検証を通せず、Allowed Paths を守れば CI が失敗し、CI を直せば Allowed Paths 違反になる。
    • nested canary(実装: Claude Code / Codex CLI の bounded read-only nested delegation canary を実行する #1842)のために production surface(新 agent role)を先に作る順序が逆。
    • Claude Code 側にも同等 agent を追加すべきではない。

    Recommended follow-up(本 Issue のスコープ外・別 Issue 側の判断が必要)

    • #1833: implementation-worker → implementation-designer の固定 edge を dependency graph から削除する要否の再検討。
    • #1842: implementation-worker → codebase-investigator の限定 canary へ変更する、または #1842 自体も not planned とする要否の再検討。
    • .codex/config.toml の「root + worker + designer」concurrency 記述の実態整合。

    これらは #1839 の Allowed Paths / Outcome の範囲外であり、本 loop では編集しない。人間または別 issue-refinement-loop 実行での判断を推奨する。

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "follow-up:squne121/loop-protocol:issues/1839#issuecomment-5151007159:parent-1833-edge-removal"
          source_url: "https://github.com/squne121/loop-protocol/issues/1839#issuecomment-5151007159"
          source_note_id: "parent-1833-edge-removal"
          summary: "#1833 の implementation-worker→implementation-designer 固定 edge 削除要否の再検討が必要"
        - dedupe_key: "follow-up:squne121/loop-protocol:issues/1839#issuecomment-5151007159:1842-scope-change"
          source_url: "https://github.com/squne121/loop-protocol/issues/1839#issuecomment-5151007159"
          source_note_id: "1842-scope-change"
          summary: "#1842 を codebase-investigator ベースの限定 canary へ変更、または not planned とする要否の再検討が必要"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions