AI NewsClaude Code

Claude Code 2.1.142 + Codex remote-control: orchestrating multi-agent workflows with --agents

Claude Code 2.1.142 introduces --agents and a remote-control API that lets you delegate sub-tasks to other agents (including Codex) from inside a Claude session. We map the architecture, the safety model, and the practical patterns.

中澤 圭志

中澤 圭志

@keishi_nakazawa

Sales Claw maintainer

·16 min
Claude Code 2.1.142 + Codex remote-control: orchestrating multi-agent workflows with --agents
This English article is a concise version of the original. For the full Japanese deep-dive, see the Japanese original.

Key Facts

Release

Claude Code 2.1.142 (2026-05-15)

Capability

--agents flag + remote control API for cross-agent orchestration

"Claude Code's claude agents and Codex CLI's codex remote-control dropped the same week. Both expose headless programmatic control — but how far does AI sales automation actually accelerate when you combine them?" This article walks through a Sales Claw-maintainer-eye design guide for that combination, using Claude Code 2.1.142 (2026-05-14) and Codex CLI 0.130.0 (2026-05-11) official Changelogs / GitHub Releases / App Server Docs as primary sources.

On 2026-05-11, Codex CLI 0.130.0 added codex remote-control as "a simpler entrypoint for starting a headless, remotely controllable app-server." Three days later, on 2026-05-14, Claude Code 2.1.142 added eight new flags to claude agents so dispatched background sessions can be fully isolated per session. In a single week, both CLIs evolved in the same direction: "don't use the TUI — control them programmatically from an external process."

This article covers how to combine these two CLIs as a single parallel headless agent platform. The summary:

  1. Claude Code = strong at MCP, local file edits, Plan mode, and --permission-mode isolation. Use claude agents --add-dir ... --mcp-config ... --permission-mode ... --model ... to launch fully isolated per-session workers.
  2. Codex CLI = strong at JSON-RPC 2.0 app-server. codex remote-control exposes 100+ methods like thread/start, turn/start, command/exec, fs/readFile for external processes.
  3. Combined: Claude Code owns "local edit / MCP / permission control," Codex owns "JSON-RPC programmatic execution / image generation (gpt-image-2 etc.)." A two-LLM cross-check (Claude Opus 4.7 + GPT-5.x) becomes practical.

Primary sources: Claude Code official Changelog, GitHub Releases (v2.1.142), Codex CLI Changelog (developers.openai.com/codex/changelog), Codex App Server Docs (developers.openai.com/codex/app-server), Codex Non-interactive Mode Docs. For the Claude Code 2.1.142 standalone deep-dive, see the 2.1.142 8-flag + Fast Mode Opus 4.7 article.

1. Why combine claude agents and codex remote-control now?

May 2026 in AI coding CLIs: Claude Code shipped 2.1.139 → 2.1.140 → 2.1.141 → 2.1.142 in 72 hours, and Codex CLI went from 0.129.0 (Vim mode etc.) → 0.130.0 (remote-control etc.). Both products are layering "automation / pipeline / parallel jobs" capabilities on top of their original interactive TUIs.

Same-week release timeline for Claude Code and Codex CLI from May 1 to May 15, 2026. Top half: Claude Code 2.1.x (2.1.137 → 2.1.139 [5/12 major: /goal + Agent View] → 2.1.140 [5/12] → 2.1.141 [5/13] → 2.1.142 [5/14 8 flags + Fast Mode Opus 4.7]). Bottom half: Codex CLI (0.128 → 0.129.0 [5/7 Vim mode + extended Chrome] → 0.130.0 [5/8-11 remote-control + plugin sharing] → 0.131.0-alpha [5/12-15 pre-release]). The major releases cluster in the same 8-day window of May 7–14.
Figure: Figure 1: Same-week release density. Both lines released headless / programmatic-control features back-to-back

"Two major CLIs evolved in the same direction in the same week" is more than coincidence. Anthropic and OpenAI each independently are moving their product position from "a CLI a single developer types at" to "a platform that schedules many parallel jobs." For AI sales automation that takes long-running, multi-pipeline, multi-model setups as table stakes, combining them got a step more practical.

2. The same-week changes (per official docs)

Claude Code 2.1.142 — 8 claude agents flags

Claude Code 2.1.142 (2026-05-14 22:55 UTC) added 8 new flags to claude agents for launching dispatched background sessions:

  • --add-dir <path> — additional working directories (repeatable)
  • --settings <path> — settings file for this session only
  • --mcp-config <path> — MCP config for this session only
  • --plugin-dir <path> — plugin directory for this session only
  • --permission-mode <mode> — default / ask / acceptEdits / bypassPermissions / plan
  • --model <model> — model for this session (haiku / sonnet / opus)
  • --effort <level> — reasoning effort (high / medium / low)
  • --dangerously-skip-permissions — fully bypass permissions (sandbox / trusted only)

Each had been available to claude in foreground mode; 2.1.142 carries them to dispatched background sessions. The same release promotes Fast Mode default from Opus 4.6 → Opus 4.7 and removes the 60-second timeout cap on remote HTTP / SSE MCP.

Codex CLI 0.130.0 — codex remote-control and the App Server

Codex CLI 0.130.0 (2026-05-08 ~ 11) introduced codex remote-control as the headless control entrypoint.

The backing codex app-server uses JSON-RPC 2.0: stdio newline-delimited JSON (JSONL) by default, with experimental WebSocket via --listen ws://127.0.0.1:4500. The Codex App Server Docs publish 100+ methods. Key categories:

  • Thread management: thread/start, thread/resume, thread/fork, thread/list, thread/archive
  • Turn control: turn/start, turn/steer, turn/interrupt
  • Models / features: model/list, experimentalFeature/list
  • Execution: command/exec, command/exec/write, command/exec/resize
  • Skills / apps: skills/list, app/list, plugin/list
  • Filesystem: fs/readFile, fs/writeFile, fs/watch
  • Auth: account/read, account/login/start, account/logout

Stateless codex exec "..." (pipeline-friendly) and stateful, programmable codex remote-control + JSON-RPC co-exist as two automation layers inside the same Codex CLI.

項目Claude Code 2.1.142 (claude agents)Codex CLI 0.130.0 (codex remote-control)
Automation entrypointclaude agents <flags> --bgcodex remote-control / codex exec
ProtocolCLI flags + file-based configJSON-RPC 2.0 (JSONL / WebSocket)
Config isolation--settings / --mcp-config / --plugin-dirthread/start parameters
Permission control--permission-mode + Hooks--sandbox + per-thread approval policy
ModelsClaude (Opus 4.7 / Sonnet 4.6 / Haiku 4.5)GPT-5.x / Codex family
Local file editsStrong (Edit / Write)OK (via fs/writeFile)
Image generationIndirect (separate CLI)Direct (codex exec with gpt-image-2)
MCP integrationPer-session via --mcp-configOK (plugin/list via App Server)

3. Three architectural patterns for headless parallel agents

Hand-drawn whiteboard diagram showing three combination patterns for Claude Code and Codex CLI. Top-center: 'Three patterns for parallel headless' headline. Left: 'Pattern A: Role split' (Claude = local edit + MCP, Codex = image gen + external API). Center: 'Pattern B: Cross-check' (same task to both, diff results). Right: 'Pattern C: Pipeline chain' (Claude → JSON output → Codex for post-processing, or reverse). Each pattern has arrows, marker annotations, and small Sales Claw application examples.
Figure: Figure 2: Three parallel headless patterns — role split, cross-check, pipeline chain

Pattern A: role split

The simplest and most practical. Claude Code is strong at local file edits and MCP integration; Codex CLI is strong at image generation (gpt-image-2) and external-API pipelines. Split by workload.

  • Claude Code handles: sales copy generation / editing, company info via MCP scrape, form-submit logic code generation, design in Plan mode
  • Codex CLI handles: header image generation (codex exec --full-auto -m gpt-image-2 ...), data via external APIs, JSON-RPC-driven image conversion as independent jobs

Pattern B: cross-check

Send the same task to both Claude and Codex; compare outputs. For sales copy where "subtle brand-voice drift" and "missed banned terms" affect quality, two-LLM cross-check is effective. Plug it in as an additional layerin Sales Claw's pre-send checks.

  • Use Claude Haiku 4.5 as the judge to keep cost low
  • Run the same judgment with GPT-5.x via Codex
  • Both PASS → continue; diff → drop into awaiting_approval with audit-log entry

Pattern C: pipeline chain

Claude's output feeds Codex's input (or vice versa). Pipe codex exec --json JSONL output into Claude Code, or pass Claude Code's --output-format json result to thread/start on the Codex App Server.

# Pattern C example: Claude drafts 5 copy candidates → Codex brand-checks them
claude agents \
  --add-dir ./lines/btob-saas \
  --settings ./lines/btob-saas/.claude/settings.json \
  --permission-mode acceptEdits \
  --model sonnet \
  --output-format json > drafts.json

# Brand-check job on Codex side
codex exec --json --ephemeral \
  --sandbox workspace-write \
  "Read drafts.json. Run each draft against the Sales Claw brand guidelines. Output PASS/FAIL JSON." \
  > brand-check.jsonl
項目Claude onlyClaude + Codex combined
Sales copy generationClaude Sonnet 4.6Same + Codex cross-check for banned terms
Image generationNeeds separate external API callcodex exec calls gpt-image-2 directly
Local code editingClaude is strong by defaultSame (Codex assists)
MCP server integrationPer-session via --mcp-configSame (plugin/list on Codex side)
Programmable controlCLI flags + stdioSame + JSON-RPC 2.0 (Codex)
CostAnthropic API onlyAnthropic + OpenAI both billed

4. Sales Claw integration sketch

Sales Claw is OSS that lowers misfire and policy-violation risk through policy control, pre-send checks, do-not-contact detection, CAPTCHA-on-detect stop, rate limits, audit logs, and automatic stop conditions. Adding Codex CLI as a secondary backend alongside the existing Claude Code path lets one dashboard expose image generation and copy cross-check in addition to the standard flow.

Setup

# 1. Install Claude Code 2.1.142
npm install -g @anthropic-ai/claude-code@latest
claude --version
# → 2.1.142 or newer

# 2. Install Codex CLI 0.130.0
npm install -g @openai/codex@latest
codex --version
# → 0.130.0 or newer

# 3. Sales Claw auth
#    Register both Anthropic and OpenAI API keys in ~/.sales-claw/credentials
#    (Configurable via the Sales Claw dashboard settings UI)

Launch script — 3 pipelines with two-LLM

Per-pipeline assignment: Claude Code as Worker, Codex as image-gen / cross-checker. See Workflow overview for the broader context.

# Pipeline A: B2B SaaS / Claude as Worker, Codex for image gen
claude agents \
  --add-dir ~/work/sales-claw/lines/btob-saas \
  --settings ~/work/sales-claw/lines/btob-saas/.claude/settings.json \
  --mcp-config ~/work/sales-claw/lines/btob-saas/.claude/mcp.json \
  --permission-mode acceptEdits \
  --model sonnet \
  --effort high \
  --bg

# Codex remote-control runs as a separate listening process
codex remote-control --listen ws://127.0.0.1:4500 &

# Pipeline A's copy cross-checker hits Codex App Server via JSON-RPC
#  → thread/start → turn/start → collect JSONL

Driving the Codex App Server via JSON-RPC

Minimal TypeScript JSON-RPC client driving Codex App Server from a Sales Claw copy cross-checker:

// Within sales-claw, spawn Codex App Server as a sub-process
// JSONL over stdio
import { spawn } from 'node:child_process';

const codex = spawn('codex', ['remote-control'], { stdio: ['pipe', 'pipe', 'inherit'] });

let id = 1;
function rpc(method: string, params: Record<string, unknown>) {
  const req = JSON.stringify({ jsonrpc: '2.0', id: id++, method, params }) + '\n';
  codex.stdin.write(req);
}

// 1. Start a thread (sandbox = workspace-write, ephemeral)
rpc('thread/start', {
  sandbox: 'workspace-write',
  ephemeral: true,
  workingDirectory: '/work/sales-claw/lines/btob-saas',
});

// 2. Submit a turn (run brand-check on 5 Claude-generated drafts)
rpc('turn/start', {
  threadId: 'thread_abc',
  input: 'Run brand-check on each of these 5 sales copy drafts and return PASS/FAIL JSON.\n\n' + JSON.stringify(drafts),
});

// 3. Receive JSONL events from stdout
codex.stdout.on('data', (chunk) => {
  for (const line of chunk.toString().split('\n').filter(Boolean)) {
    const msg = JSON.parse(line);
    handleCodexMessage(msg);
  }
});

Sales Claw itself is free at the download page. The 1.2.x line plans GUI Codex CLI detection and credential registration; today, set up manually.

Claude × Codex hybrid? Start with the Sales Claw image-gen pipeline.

無料・MIT ライセンス。インストールせずにライブデモも試せます。

5. Cost of two-LLM operation and assumptions

Assumptions

  • Targets: 1,000 companies/mo (Sales Claw Phase B)
  • Claude judge: Haiku 4.5, $1 / MTok in, $5 / MTok out
  • Claude worker: Sonnet 4.6, $3 / MTok in, $15 / MTok out
  • Codex model: GPT-5.x, $2.5 / MTok in, $10 / MTok out (assumed)
  • Codex image gen: gpt-image-2, $0.02–0.05 per image (medium-size)
  • FX: 1 USD = 150 JPY
  • Per-company tokens: ~12K in / ~1.5K out average
  • Image gen: 30/mo (articles + headers)
  • Variance: ±25%

Three-scenario comparison (estimate)

Bar chart comparing three monthly cost scenarios. Scenario A: Claude only ~¥58,000/mo. Scenario B: Claude + Codex for image gen only ~¥62,500/mo. Scenario C: Claude + Codex for image gen + full copy cross-check ~¥98,000/mo. C shows 50-80% upside. Assumptions: 1000 companies/mo, 30 images/mo, Haiku 4.5 judge + Sonnet 4.6 worker + GPT-5.x cross-check, 1 USD=150 JPY, ±25% variance.
Figure: Figure 3: Three-scenario monthly cost. Image-gen split alone is +¥4,500; full copy cross-check is +~¥40,000
Line chart of parallelism vs throughput (completions per hour). Claude only (blue): 30/h at parallelism 1, 95/h at 4, 110/h at 8 (saturation). Claude + Codex hybrid (orange): 28/h at 1 (Codex job wait makes it slightly slower), 120/h at 4, 165/h at 8 (image gen and checks run async). Annotation notes that parallelism >= 8 is not recommended in production due to rate-limit considerations.
Figure: Figure 4: Parallelism vs throughput. Hybrid scales past parallelism 4, but parallelism 8+ is not recommended due to rate-limit policy

Where to add the second LLM

  • Image generation → Codex — Claude Code has no built-in image gen. codex exec -m gpt-image-2 is simple and adds ~¥3,000–¥8,000/mo.
  • Copy cross-check → Codex only for banned-term detection — Running full copy quality through both LLMs costs 1.8×. A lightweight prompt that asks GPT-5.x to flag banned terms ("complete," "absolute," "revolution") adds ~¥5,000/mo.
  • Company-info extraction → Claude only — MCP integration plus Sonnet 4.6 instruction-following is enough. Adding a second LLM here doesn't pay back.

6. Risks of autonomous operation — the "permission split across two paths" trap

Running two CLIs in parallel gives big headless / programmable wins. It also introduces a new risk: permission policy splits across two paths. Don't claim "safe" — lower risk structurally.

The dual-path permission risk

Claude Code builds pre-send checks via --permission-mode + Hooks. Codex CLI builds a different system via --sandbox + per-thread approval policy. Running both on one machine, it's easy to relax one side's guard while the other holds — creating the illusion of safety while leaving an open path.

Chalkboard-style diagram explaining the dual-path permission risk. Center headline: 'Permission control splits across two paths.' Left half: Claude Code path (--permission-mode + Hooks + pre-send check). Right half: Codex CLI path (--sandbox + per-thread approval policy). Center bottom: red chalk warning 'Relaxing one side doesn't protect the whole.' Both paths show 'must pass audit log' and 'must pass compliance footer' as required checkpoints. Classroom-style postmortem feel.
Figure: Figure 5: Dual-path permission risk (chalkboard). Relaxing only one side undermines overall safety
  • Japan's Specified Electronic Mail Act: auto-append the 4 required sender-info fields
  • Terms compliance: skip pages marked "no sales / recruiting only / IR only"
  • No CAPTCHA bypass: stop into awaiting_approval, log on detect
  • Rate limiting: per-pipeline + global
  • Opt-out: auto-insert "reply to opt out" in copy
  • API terms: Anthropic and OpenAI both — image generation involving persons / logos / trademarks needs special care

Risks that remain

  • One side's API hitting rate limits or outages — design Sales Claw to poll API status and auto-stop if either side is down
  • Codex App Server's JSON-RPC endpoint (--listen ws://127.0.0.1:4500) accidentally exposed externally — always bind localhost; confirm firewall
  • Disagreement between Claude and Codex on cross-check — document explicitly which result wins
  • Image generation reproducing trademarks / persons / brand logos — always include "do not accurately reproduce logos" and "editorial illustration only" in the prompt
  • Anthropic and OpenAI terms updates — review quarterly

7. Pre-production checklist

Before launching a Claude Code × Codex combined operation

  • claude --version shows 2.1.142+, codex --version shows 0.130.0+
  • Both Anthropic and OpenAI API keys are valid; monthly budget alerts set on both
  • Documented which paths use two-LLM (image gen / banned-term detection / others)
  • claude agents launches explicitly set --settings / --mcp-config / --permission-mode
  • codex remote-control --listen binds to localhost (127.0.0.1)
  • Production machines forbid both --dangerously-skip-permissions and --sandbox danger-full-access
  • Compliance footer enabled (preferences.complianceFooter: true)
  • CAPTCHA-on-detect stop into awaiting_approval is on
  • action-log.json saves; audit log captures both Claude and Codex paths
  • Per-pipeline and global rate limits set
  • Auto-stop conditions defined for either-side API outages
  • Image-gen prompts include "do not accurately reproduce official logos" and "editorial illustration only"
  • Disagreement rule documented (e.g., Claude PASS + Codex FAIL → which wins?)
  • 100-company sample compares Claude-only vs combined for cost and throughput
  • Quarterly review process for Anthropic and OpenAI terms is in place

8. Bottom line — combine the two same-week-releases as one platform

Claude Code 2.1.142 (2026-05-14) and Codex CLI 0.130.0 (2026-05-11) added features in the same direction the same week: "from TUI to programmatic control." They are complementary. claude agents's 8 flags excel at "config isolation + permission split"; codex remote-control + JSON-RPC 2.0 excels at "programmable control + image-gen pipelines."

For workloads that take long-running, multi-pipeline, multi-model setups as table stakes — like AI sales automation — combining them is now practical. Choose role split (Pattern A), cross-check (B), or pipeline chain (C) based on your workload. Adding the second LLM only for image gen and banned-term detection is a balanced compromise between cost and quality.

Next action: npm install -g @anthropic-ai/claude-code@latest @openai/codex@latest and start with Pattern A — split image generation to Codex first. See Quick start and Workflow overview for setup, and the Claude Code 2.1.142 standalone deep-dive for the other side.

Read this, then start two-LLM on the image-gen pipeline.

無料・MIT ライセンス。インストールせずにライブデモも試せます。

この記事の著者

中澤 圭志

中澤 圭志

Sales Claw maintainer

Sales Claw の設計・開発を担当。BtoB 営業自動化と AI 活用の実践者として、現場目線で情報発信中。

Share this article