メインコンテンツへスキップ
モジュール 4:マスタリー 1 / 6
上級 S19 Director Mode Lite Claude Code Codex CLI Grok Build Session Relay

Director Mode Lite:Claude Code、Codex CLI、Grok Build

Native adapters、default zero hooks、explicit full-access launcher、inspectable session relay で Claude Code、Codex CLI、Grok Build を運用。

2026年3月20日 24 分で読む

この Session で作るもの

この session では、Claude Code、Codex CLI、Grok Build の間を移動できる一つの operating method を作ります。ただし、3 tools の runtime が同じだとは扱いません。

Portable な要素:

  • goal、context、constraints、done-when evidence、open questions を持つ Director Brief
  • 短い inspect → change → check → decide loop;
  • director-modesession-relay の two core Skills;
  • .director-mode/bin/director-relay の inspectable helper;
  • .director-mode/bin/director-doctor の read-only diagnostic helper;
  • .director-mode/bin/director-open の explicit full-access helper;
  • receiving session が evidence を再確認するルール。

Authentication と organization policy は vendor-native のままです。trusted workspace では director-open が各 CLI の documented unrestricted permission profile を選択し、hook や hidden rule は導入しません。

Runtime contract: default install は Director Mode hooks を一つも登録せず、deny rule、forced loop、test gate、commit gate、implicit permission change を追加しません。Skills、relay、status、doctor は director-open を呼びません。Full access は separate explicit launch choice。managed policy と既存 global hooks は引き続き適用され得ます。

Three-CLI Method が有効な理由

重要なのは「どの CLI が勝つか」ではなく、「次の bounded step が別 context や capability から利益を得るか」です。

Handoff が役立つ場合:

  • 長い session に irrelevant context が蓄積した;
  • 別 CLI に claim や diff を独立検査させたい;
  • 一つの tool に current tool が持たない project integration がある;
  • 次 task が分離でき、明示 acceptance evidence がある。

Handoff が害になる場合:

  • task が小さく current session の context が正確;
  • 2 CLI が同じ files を同時編集する;
  • Brief が「done」を定義できない;
  • Relay に secrets、speculation、unreviewed transcript dump が入る。

Default は一つの CLI と一つの bounded task。coordination cost が節約できる context より小さい場合だけ別 CLI を追加します。

Three Adapters を Install

repository を先に review し、v2.1.0 all-CLI path を使います:

git clone https://github.com/claude-world/director-mode-lite.git
cd director-mode-lite
./install.sh --cli all --hooks none /path/to/project

導入後は両 portable helpers を確認し、interface を推測せず current help を読みます:

.director-mode/bin/director-relay --help
.director-mode/bin/director-doctor --json --no-probe
.director-mode/bin/director-open --help

Two core Skills は director-modesession-relay。guide、relay、read-only doctor fallback を bundle するため plugin-only install でも機能します。Shell installer は complete project-local guidance、generated agents、launchers を追加します。

Installation は 35 shared skills、14 native agent adapters、relay、open launcher の存在を意味し、default では zero hooks です。trusted repository では native full-capability runtime を明示選択します:

.director-mode/bin/director-open claude  # bypassPermissions
.director-mode/bin/director-open codex   # never + danger-full-access
.director-mode/bin/director-open grok    # always-approve + sandbox off

Grok の前に grok inspect --json で effective hooks を audit してください。.grok/hooks が空でも compatible Claude hooks を継承する場合があります。

旧 install の upgrade では ./install.sh --update --cli all --hooks none /path/to/project で Director-owned hook registrations を retire。Cleanup は unrelated、custom、modified hooks を保持するので、実行後に diff を review します。

Session continuity には provider boundary があります。同 provider は native resume flow:Claude Code は --continue / --resume、Codex は resume / exec resume、Grok は --continue / --resume。Cross-provider は portable packet から new receiver-native session を開始し、source session ID は metadata であって portable resume token ではありません。

Director Brief

Full transcript は coordination format として弱いものです。observations、guesses、abandoned plans、tool output、private details が混ざります。Director Brief は次 worker が必要な contract だけを運びます。

GOAL
観測可能な behavior を一つ追加。

CONTEXT
- Relevant files と documentation
- Current behavior または exact error
- 既決 decisions と理由

CONSTRAINTS
- Scope と architecture boundaries
- Compatibility requirements
- Permission profile は explicit:native launch または trusted workspace の director-open

DONE WHEN
- Named tests、lint、type checks、build commands が pass
- Focused diff が requested behavior と一致
- Human review に blocking concern がない

OPEN QUESTIONS
- 次 session が editing 前に確認する facts

Brief を信頼可能に保つ 5 rules:

  1. Observation と inference を分離。「Test X exited 0」は observation。「feature は正しい」は inference。
  2. Paths と commands を明示。「tests pass」より command、exit status、relevant output。
  3. **Constraints を継承。**compatibility / safety boundary を失った relay は broken。
  4. **Uncertainty を記録。**open question は invented certainty より安全。
  5. **Small に保つ。**source files に link し、repository / transcript 全体を貼らない。

Method を各 CLI に翻訳

Task contract は同じですが、durable guidance は各 tool native の project surface に置きます。

CLIDurable guidanceSession entryOpen profile
Claude CodeCLAUDE.md と installed Claude assetsdirector-open claude または native launchbypassPermissions
Codex CLIAGENTS.md と installed Codex assetsdirector-open codex または native launchnever + danger-full-access
Grok Build.grok/agents と compatible assetsdirector-open grok または native launchalways-approve + sandbox off

Codex の AGENTS.md は practical に保ちます:repository layout、supported commands、conventions、constraints、verification。task-only detail は current prompt に置きます。director-open codex が変更するのは launch profile で、instruction precedence ではありません。

Claude Code の durable repository context は CLAUDE.md。Grok は .grok/agents native agents と compatible Claude assets を利用できます。3 surfaces を byte-for-byte copy にせず、同じ contract を native format で表現します。

Guidance-First Loop

各 pass は 4 moves:

1. Inspect

Director Brief と次 decision に必要な files だけを読み、paths / command output で current behavior を報告。

2. Change

一つの acceptance outcome を満たせる smallest coherent edit。複数 CLI に同じ files を parallel write させません。

3. Check

repository の real checks を実行。command、exit status、important output、not-run items を記録します。

4. Decide

Pass の最後に一つの recommendation:

  • ACCEPT:done-when evidence が存在;
  • REVISE:evidence が bounded correction を示す;
  • RELAY:別 CLI / fresh session に明確な利点;
  • STOP:authority、context、evidence、user intent が不足。

session を存続させる必要はありません。unchecked item は information であり、forced iteration の permission ではありません。

Safe Claude → Codex → Grok Example

Claude Code が failing API test を調査して narrow fix を用意し、accept 前に independent review を求める例です。

Phase A — Claude Code が frame / change

Claude Code に渡す内容:

Director Brief を使用。
Goal: documented 409 response mismatch を修正。
Context: named handler、schema、failing test だけを inspect。
Constraints: public response shape と existing safety controls を維持。
Done when: focused test、type check、diff review が evidence を提供。
一つの bounded pass 後に停止し、ACCEPT、REVISE、RELAY、STOP を推奨。

Claude の diff と observed command output を自分でも review します。

Phase B — Relay を作成し、明示的に inspect

Claude Code に session-relay を使用させます。Artifact に必要な内容:

  • exact goal と constraints;
  • changed files;
  • 実際に実行した commands と observed results;
  • independent verification が必要な claims;
  • 次の bounded review request。

New packet default は review_status: unreviewed。artifact を inspect し、secrets、unsupported claims、stale plans、irrelevant conversation を削除。explicit review 後だけ --reviewed を追加します。Schema validation / drift inspection は reviewed にしません。

Verified v2.1.0 interface は director-handoff/v2 を作成し、v1 packet も read / validate し、別 CLI を launch せず receiving command を準備できます:

.director-mode/bin/director-relay create \
  --from claude \
  --to codex \
  --goal "Review the 409 response fix" \
  --summary "Focused implementation is ready for independent review" \
  --completed "Updated the handler and focused test" \
  --decision "Preserved the public response shape" \
  --next "Inspect the diff and rerun named checks" \
  --verification "pnpm test -- response.test.ts exited 0"
.director-mode/bin/director-relay validate
.director-mode/bin/director-relay status --json
.director-mode/bin/director-relay continue --to codex

Second / later hop は create--parent(または --parent <packet.json>)を追加。Protocol v2 は root、parent、hop、route を記録し、status --json は captured branch、HEAD、Git status、diff statistics と live worktree を non-blocking で比較します。

最後の command は receiving command を表示するだけです。user が別途 execution option を選ばない限り Codex を launch しません。receiver は packet path を信頼せず caller の live project root から開始します。

Phase C — Codex が Independent Review

reviewed relay を Codex に渡し、以下を依頼:

  1. applicable AGENTS.md を読む;
  2. referenced files と diff を inspect;
  3. relevant repository checks を run;
  4. disagreement / missing evidence を report;
  5. correction を明示依頼しない限り edit しない。

trusted repository では receiving session を director-open codex で起動し、それ以外は normal Codex launch を使用します。organization-managed policy はどちらも override できます。

Phase D — Grok には新しい Bounded Question だけ

別 perspective が有効な場合だけ Grok Build を使用します。例:documented project rules と implementation が一致するか。verified state と一つの question だけを relay し、full transcript は渡しません。

receiving Grok session は referenced files を再確認し、relay を trusted proof としません。

Relay Contract

Useful relay の 7 fields:

FieldRequired content
GoalOne observable desired outcome
ScopeIn / out の files または subsystems
ConstraintsArchitecture、compatibility、safety、user limits
ChangesChanged files と理由
EvidenceCommands、exit status、relevant output、diff observations
UnknownsUnverified claims と remaining risks
Next stepReceiving CLI への one bounded request

「done」だけ、command evidence なし、failures を隠す、scope を拡大、新 authority を示唆する relay は reject します。

Conflict / Concurrency Rules

3 CLI は自動的に safe team にはなりません:

  • one writer が一つの file set を所有;
  • reviewers は edit を依頼されるまで read-only inspection;
  • repository が対応する場合 branches / worktrees で concurrent work を分離;
  • relay に newer repository reality を上書きさせない;
  • integration 後に affected checks を再実行;
  • Git と human review を recovery boundary にする。

Sessions が disagree したら、confidence より current source、reproducible commands、explicit requirements を優先します。

Verification Checklist

  • Director Brief に goal、context、constraints、done-when、open questions。
  • native または director-open runtime profile の選択が explicit。
  • effective hook list を audit し、inherited hook が handoff を暗黙に interrupt しない。
  • Diff は focused で clear owner が一人。
  • test claim に observed command / result。
  • failures / skipped checks が visible。
  • 別 CLI が読む前に relay を inspect。
  • Explicit review の記録前は packet を unreviewed として扱う。
  • status --json に unexplained live-worktree drift がない。
  • receiving session が referenced files / evidence を再確認。
  • human が accept、revise、relay、stop を明示選択。

Common Failure Modes

Transcript dumping

Symptom: next CLI が decision boundary のない大量 text を受け取る。 Fix: handoff を seven-field relay contract に縮約。

Permission confusion

Symptom: session が native、fully open、managed policy / inherited hook 制約下のどれか判別できない。 Fix: native launch または director-open <cli> を明示選択し、effective configuration を確認。relay packet 自体を authority と扱いません。

Status as proof

Symptom: checkbox、checkpoint、model summary を completion と扱う。 Fix: repository-native checks と diff review を必須化。

Parallel file collisions

Symptom: 2 CLI が same surface を編集し、互いの intent を消す。 Fix: non-overlapping ownership または serial work。

Relay drift

Symptom: artifact 作成後に files が変化。 Fix: current tree と比較し regenerate / stale annotation。

Practice

1 時間以内の real issue を選びます:

  1. five-field Director Brief を書く。
  2. one CLI で inspect/change/check pass。
  3. session-relay artifact を依頼。
  4. inspect して短くする。
  5. second CLI に review-only task。
  6. second / first CLI の evidence を比較。
  7. accept、revise、relay、stop を明示。

Grok Build または third CLI に uniquely useful な bounded question が書けない限り、third tool は追加しません。

Continue Learning

Session 20 は error recovery:failure evidence を分類し task boundary を保ち、retry、fallback、stop を明示選択します。