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 loginorOPENAI_API_KEYset)
Configuration
Set adapterType: codex_local on the agent and provide the config below.
Config fields
| Field | Type | Default | Description |
|---|---|---|---|
cwd | string | — | Absolute working directory; created if missing |
instructionsFilePath | string | — | Absolute path to a markdown file prepended to the stdin prompt at runtime |
model | string | gpt-5.3-codex | Codex model ID (see Models) |
modelReasoningEffort | string | — | Reasoning effort: minimal, low, medium, high, or xhigh; passed as -c model_reasoning_effort=… |
promptTemplate | string | — | Template for the run prompt |
search | boolean | false | Run Codex with --search |
fastMode | boolean | false | Enable Codex Fast mode; supported on gpt-5.4 and manual model IDs |
dangerouslyBypassApprovalsAndSandbox | boolean | true | Run with the bypass flag for unattended runs |
command | string | codex | Override the Codex binary path |
extraArgs | string[] | — | Additional CLI arguments |
env | object | — | Environment variables injected into the agent process |
workspaceStrategy | object | — | Execution workspace strategy; supports git_worktree |
workspaceRuntime | object | — | Reserved for workspace runtime metadata |
timeoutSec | number | 0 | Run timeout in seconds |
graceSec | number | 15 | SIGTERM grace period |
Models
| Model ID | Label |
|---|---|
gpt-5.4 | gpt-5.4 |
gpt-5.3-codex | gpt-5.3-codex (default) |
gpt-5.3-codex-spark | gpt-5.3-codex-spark |
gpt-5 | gpt-5 |
o3 | o3 |
o4-mini | o4-mini |
gpt-5-mini | gpt-5-mini |
gpt-5-nano | gpt-5-nano |
o3-mini | o3-mini |
codex-mini-latest | Codex 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
instructionsFilePathis set, SLAW prepends that file's contents to the stdin prompt on every run. - SLAW uses a per-squad managed
CODEX_HOMEdirectory by default (~/.slaw/instances/<id>/squads/<squadId>/codex-home/). WhenCODEX_HOMEis explicitly overridden in the adapter config, that path is used instead. - SLAW injects skills into
CODEX_HOME/skills/so Codex can discover$slawand related skills without polluting the project working directory. - Codex exec automatically applies repo-scoped
AGENTS.mdfrom the active workspace; SLAW cannot suppress that discovery. fastModeis supported ongpt-5.4and manual model IDs. When enabled, SLAW appliesservice_tier="fast"andfeatures.fast_mode=true.- Some model/tool combinations reject certain effort levels — for example
minimalwith web search enabled. - When SLAW provisions a workspace or runtime, it injects
SLAW_WORKSPACE_*andSLAW_RUNTIME_*environment variables.