Skip to main content

Codex Adapter

The codex_local adapter runs OpenAI Codex CLI on the host machine as a SLAW agent, resuming the previous session across Heartbeats.

Type key: codex_local

Prerequisites

  • Codex CLI installed: npm install -g @openai/codex
  • OpenAI credentials configured (codex login or OPENAI_API_KEY set)

Configuration

Set adapterType: codex_local on the agent and provide the config below.

Config fields

FieldTypeDefaultDescription
cwdstringAbsolute working directory; created if missing
instructionsFilePathstringAbsolute path to a markdown file prepended to the stdin prompt at runtime
modelstringgpt-5.3-codexCodex model ID (see Models)
modelReasoningEffortstringReasoning effort: minimal, low, medium, high, or xhigh; passed as -c model_reasoning_effort=…
promptTemplatestringTemplate for the run prompt
searchbooleanfalseRun Codex with --search
fastModebooleanfalseEnable Codex Fast mode; supported on gpt-5.4 and manual model IDs
dangerouslyBypassApprovalsAndSandboxbooleantrueRun with the bypass flag for unattended runs
commandstringcodexOverride the Codex binary path
extraArgsstring[]Additional CLI arguments
envobjectEnvironment variables injected into the agent process
workspaceStrategyobjectExecution workspace strategy; supports git_worktree
workspaceRuntimeobjectReserved for workspace runtime metadata
timeoutSecnumber0Run timeout in seconds
graceSecnumber15SIGTERM grace period

Models

Model IDLabel
gpt-5.4gpt-5.4
gpt-5.3-codexgpt-5.3-codex (default)
gpt-5.3-codex-sparkgpt-5.3-codex-spark
gpt-5gpt-5
o3o3
o4-minio4-mini
gpt-5-minigpt-5-mini
gpt-5-nanogpt-5-nano
o3-minio3-mini
codex-mini-latestCodex Mini

Minimal example

{
"adapterType": "codex_local",
"adapterConfig": {
"cwd": "/home/agent/workspace",
"model": "gpt-5.3-codex",
"dangerouslyBypassApprovalsAndSandbox": true,
"timeoutSec": 0,
"graceSec": 15
}
}

Session behaviour

SLAW stores the session ID and cwd after each run. On the next Heartbeat, Codex resumes the prior session when the stored cwd matches the current working directory.

Notes

  • Prompts are piped to Codex via stdin; Codex receives "-" as the prompt argument.
  • If instructionsFilePath is set, SLAW prepends that file's contents to the stdin prompt on every run.
  • SLAW uses a per-squad managed CODEX_HOME directory by default (~/.slaw/instances/<id>/squads/<squadId>/codex-home/). When CODEX_HOME is explicitly overridden in the adapter config, that path is used instead.
  • SLAW injects skills into CODEX_HOME/skills/ so Codex can discover $slaw and related skills without polluting the project working directory.
  • Codex exec automatically applies repo-scoped AGENTS.md from the active workspace; SLAW cannot suppress that discovery.
  • fastMode is supported on gpt-5.4 and manual model IDs. When enabled, SLAW applies service_tier="fast" and features.fast_mode=true.
  • Some model/tool combinations reject certain effort levels — for example minimal with web search enabled.
  • When SLAW provisions a workspace or runtime, it injects SLAW_WORKSPACE_* and SLAW_RUNTIME_* environment variables.

Next steps