Skip to main content
Glama
kitepon
by kitepon

codex_agent

Launch a persistent Codex CLI agent in a terminal to handle implementation, review, and research through interactive dialogue.

Instructions

【旧互換alias。新規連携は agent_launch(harness=codex-cli)】Codexの対話エージェント TUI を永続端末に起動する。実装・レビュー・調査を対話で回す。通常CLIと同じHOME・cwd・project/user/local設定・MCP・plugin・skill・permission/trustを共有する。aitermは完了相関stateだけをlaunch単位で所有する。起動されたagentにはsub-agent自己認識、親session、delegation depth/lineage、delegation_allowed=trueを注入し、必要な追加委譲は許可する。委譲契約を使う完全な呼び出し例: codex_agent({"prompt":"<依頼>","model":"gpt-5.6-sol","reasoning_effort":"high","cwd":"/absolute/path/to/repo","write_scope":"read-only"})。turn は pty_send で送る(自動で非ブロック dispatch になる)。dispatch した子は投げっぱなしでよい=親はここで待たない。Codex親とClaude Code親にはAitermが回答本文を自動配送する。parent_deliveryがある場合はwait起動も通常の回答回収も不要。親は作業を続けるかターンを終える。Cursor親にはparent_deliveryとwait_processが付く。作業を続ければ次のツール返りに回答が差し込まれ、ターンを終える前にwait_processを背景で起動するとidle中の完了でも起きられる。ポーリングとpty_read(agent_transcript:true)は不要。その他の親では、完了通知をreceiptの wait_process.executablewait_process.args をそのまま親のターンを塞がない別プロセスAPIへ渡して受け、PowerShell 7のStart-Processだけは windows_start_process_argument_list を単一文字列として渡す。exit を完了通知として扱う(exit 0=done / 3=timeout(既定600秒・未完了) / 4=closed / 7=error(harnessの記録でturnがAPIエラー等で打ち切られた。結果は無い)。receiptのoutcomeが正で、done以外は未完了。ポーリング不要)。wait_command は人間向け互換表示でありprocess境界へ使わない。foreground実行で親のターンを塞がない。自動配送以外の結果回収は pty_read(agent_transcript:true)。model / reasoning_effort を引数で指定可(省略時は端末 config/CLI 既定を継承。実効値は起動応答に明示)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNo作業ディレクトリ(対象リポのルート等・任意)
modelNo起動モデル(例: gpt-5.6-sol / gpt-5.6-terra / gpt-5.6-luna)。省略時は端末 config/CLI 既定を継承(端末側のピンがそのまま効く。実効値は起動応答に明示される)
promptNo起動時に渡す初手プロンプト(任意)。送信後は待たずに即返る
env_varsNo起動したagentへ現在のMCP processから継承する環境変数名。値はtool引数へ渡さない
write_scopeNo能力宣言。read-only、または書込みを許可するパスの説明文字列。対応harnessのread-onlyはCLI標準のread-only面で実効禁止する
session_nameNoセッション名(省略で自動採番)
trust_projectNo対象projectを信頼し、既知のworkspace・project hooks・MCP初期同意を起動中に進める
reasoning_effortNoreasoning effort(思考レベル)。low/medium/high/xhigh/max/ultra(CLI/model 版依存)。ultra は max 推論+proactive 自動委譲 ON=使用量急増注意(明示要求時のみ)。省略時は端末 config/CLI 既定。
throughline_source_sessionNo同一端末のThroughline sessionから所有権を変えずに記憶を読み、promptのmissionより前へ注入する
throughline_supplement_fileNoThroughline 0.10.8以降へそのまま渡すproject束縛済み長期記憶・知識の補足JSON path

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaYes
harnessYes
startupYes
providerYes
session_idYes
write_scopeNo
event_cursorYes
wait_commandYes
wait_processYes
initial_promptYes
submit_residueYes
parent_deliveryNo
managed_completionYes後方互換field。trueはaiterm完了相関が有効という意味で、project/user環境の隔離を意味しない
write_scope_enforcementNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.35.0
    • addedInput schema / properties / trust_project
      Added value: +{
      +  "description": "対象projectを信頼し、既知のworkspace・project hooks・MCP初期同意を起動中に進める",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / initial_prompt
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "reason": {
      +      "type": "string"
      +    },
      +    "status": {
      +      "enum": [
      +        "not_requested",
      +        "not_sent",
      +        "submitted_unconfirmed",
      +        "started"
      +      ],
      +      "type": "string"
      +    },
      +    "turn_started": {
      +      "anyOf": [
      +        {
      +          "type": "boolean"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    }
      +  },
      +  "required": [
      +    "status",
      +    "reason",
      +    "turn_started"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / parent_delivery
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "child_outcome": {
      +      "anyOf": [
      +        {
      +          "enum": [
      +            "done",
      +            "closed",
      +            "rate_limited",
      +            "error"
      +          ],
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "child_turn_id": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "delivery_id": {
      +      "type": "string"
      +    },
      +    "error_code": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "queued_submission_id": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "state": {
      +      "enum": [
      +        "waiting",
      +        "ready",
      +        "sending",
      +        "submitted",
      +        "failed",
      +        "unknown"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "delivery_id",
      +    "state",
      +    "child_outcome",
      +    "child_turn_id",
      +    "queued_submission_id",
      +    "error_code"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / startup
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "reason": {
      +      "type": "string"
      +    },
      +    "status": {
      +      "enum": [
      +        "ready",
      +        "not_checked",
      +        "blocked"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "status",
      +    "reason"
      +  ],
      +  "type": "object"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "schema",
      -  "provider",
      -  "harness",
      -  "session_id",
      -  "managed_completion",
      -  "event_cursor",
      -  "wait_process",
      -  "wait_command",
      -  "submit_residue"
      -]New value: +[
      +  "schema",
      +  "initial_prompt",
      +  "startup",
      +  "provider",
      +  "harness",
      +  "session_id",
      +  "managed_completion",
      +  "event_cursor",
      +  "wait_process",
      +  "wait_command",
      +  "submit_residue"
      +]
  2. Changed1 schema field changedv0.29.21
    • addedInput schema / properties / throughline_supplement_file
      Added value: +{
      +  "description": "Throughline 0.10.8以降へそのまま渡すproject束縛済み長期記憶・知識の補足JSON path",
      +  "minLength": 1,
      +  "type": "string"
      +}
  3. Changed2 schema fields changedv0.29.8
    • addedOutput schema / properties / wait_process
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "args": {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        },
      +        "executable": {
      +          "type": "string"
      +        },
      +        "windows_start_process_argument_list": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ]
      +        }
      +      },
      +      "required": [
      +        "executable",
      +        "args",
      +        "windows_start_process_argument_list"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "schema",
      -  "provider",
      -  "harness",
      -  "session_id",
      -  "managed_completion",
      -  "event_cursor",
      -  "wait_command",
      -  "submit_residue"
      -]New value: +[
      +  "schema",
      +  "provider",
      +  "harness",
      +  "session_id",
      +  "managed_completion",
      +  "event_cursor",
      +  "wait_process",
      +  "wait_command",
      +  "submit_residue"
      +]
  4. Changed3 schema fields changedv0.28.0
    • changedInput schema / properties / write_scope / description
      Previous value: -"能力宣言。read-only、または書込みを許可するパスの説明文字列。Codex/Grok/Composerのread-onlyはCLI sandboxで実効禁止する"New value: +"能力宣言。read-only、または書込みを許可するパスの説明文字列。対応harnessのread-onlyはCLI標準のread-only面で実効禁止する"
    • addedOutput schema / properties / harness
      Added value: +{
      +  "const": "codex-cli",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "schema",
      -  "provider",
      -  "session_id",
      -  "managed_completion",
      -  "event_cursor",
      -  "wait_command",
      -  "submit_residue"
      -]New value: +[
      +  "schema",
      +  "provider",
      +  "harness",
      +  "session_id",
      +  "managed_completion",
      +  "event_cursor",
      +  "wait_command",
      +  "submit_residue"
      +]
  5. Changed3 schema fields changedv0.27.0
    • addedInput schema / properties / env_vars
      Added value: +{
      +  "description": "起動したagentへ現在のMCP processから継承する環境変数名。値はtool引数へ渡さない",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedInput schema / properties / reasoning_effort / description
      Previous value: -"reasoning effort(思考レベル)。low/medium/high/xhigh/max/ultra(CLI 版依存)。ultra は max 推論+proactive 自動委譲 ON=使用量急増注意(明示要求時のみ)。省略時は端末 config/CLI 既定。"New value: +"reasoning effort(思考レベル)。low/medium/high/xhigh/max/ultra(CLI/model 版依存)。ultra は max 推論+proactive 自動委譲 ON=使用量急増注意(明示要求時のみ)。省略時は端末 config/CLI 既定。"
    • changedInput schema / properties / write_scope / description
      Previous value: -"能力宣言。read-only、または書込みを許可するパスの説明文字列。Codexのread-onlyだけはCLI sandboxで実効禁止する"New value: +"能力宣言。read-only、または書込みを許可するパスの説明文字列。Codex/Grok/Composerのread-onlyはCLI sandboxで実効禁止する"
  6. Changed1 schema field changedv0.23.0
    • addedInput schema / properties / throughline_source_session
      Added value: +{
      +  "description": "同一端末のThroughline sessionから所有権を変えずに記憶を読み、promptのmissionより前へ注入する",
      +  "minLength": 1,
      +  "type": "string"
      +}
  7. Changed4 schema fields changedv0.22.0
    • addedInput schema / properties / write_scope
      Added value: +{
      +  "description": "能力宣言。read-only、または書込みを許可するパスの説明文字列。Codexのread-onlyだけはCLI sandboxで実効禁止する",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedOutput schema / properties / managed_completion / description
      Added value: +"後方互換field。trueはaiterm完了相関が有効という意味で、project/user環境の隔離を意味しない"
    • addedOutput schema / properties / write_scope
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / write_scope_enforcement
      Added value: +{
      +  "enum": [
      +    "enforced_read_only",
      +    "declaration_only_unsupported"
      +  ],
      +  "type": "string"
      +}
  8. First observedv0.20.2

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It extensively covers sharing of HOME, cwd, and settings, injection of delegation context, fire-and-forget dispatch semantics, handling of various parent types (Aiterm, Cursor, others), and detailed exit codes (0=done, 3=timeout, 4=closed, 7=error). It also clarifies that model and reasoning_effort defaults are inherited, and that ultra reasoning increases usage. This is exceptional transparency beyond typical descriptions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long and information-dense but well-structured, starting with purpose and alias note, then sharing settings, then call example, then turn/delivery mechanics, and exit codes. It front-loads the most critical usage information (alias and new integration pointer). While verbose, each sentence carries substantive detail for a complex tool with 10 parameters and varied behaviors, so it earns a 4 rather than a 3.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (10 parameters, multiple parent types, delivery mechanisms, exit codes), the description is remarkably complete. It explains how to handle every scenario: waiting vs fire-and-forget, delivery via parent_delivery, wait_process, and pty_read, and the meaning of exit codes. Since an output schema exists, return values are covered elsewhere, and the description fills all other gaps. Nothing an agent needs to call it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema covers all 10 parameters with descriptions (100% coverage), so the baseline is 3. The description adds value by providing a concrete call example highlighting prompt, model, reasoning_effort, cwd, and write_scope, and clarifies semantics like write_scope being a capability declaration and prompt returning immediately after send. This enriches understanding beyond the schema, hence a 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the tool's function: 'Codexの対話エージェント TUI を永続端末に起動する' (launches Codex's conversational agent TUI in a persistent terminal). It identifies itself as a backwards-compatibility alias and clearly distinguishes from siblings like claude_agent, grok_agent, and composer_agent by specifying Codex. It also clarifies its role in implementation, review, and investigation, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance: '旧互換alias。新規連携は agent_launch(harness=codex-cli)' instructs that new integrations should use agent_launch instead. It details when to use this alias for legacy purposes and gives a concrete call example. It also explains turn delivery via pty_send, result retrieval via parent_delivery or pty_read, and explicitly states that polling and wait_command are not appropriate, preventing misuse.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.