Skip to main content

Codex Local

The codex_local adapter runs OpenAI's Codex CLI locally. It supports session persistence via previous_response_id chaining and skills injection through the global Codex skills directory.

Prerequisites

  • Codex CLI installed (codex command available)
  • OPENAI_API_KEY set in the environment or agent config

Configuration Fields

FieldTypeRequiredDescription
cwdstringYesWorking directory for the agent process (absolute path; created automatically if missing when permissions allow)
modelstringNoModel to use
instructionsFilePathstringNoAbsolute path to the bundle entry file Baton prepends to the prompt
promptTemplatestringNoPrompt used for all runs
envobjectNoEnvironment variables (supports secret refs)
timeoutSecnumberNoProcess timeout (0 = no timeout)
graceSecnumberNoGrace period before force-kill
dangerouslyBypassApprovalsAndSandboxbooleanNoSkip safety checks (dev only)

Session Persistence

Codex uses previous_response_id for session continuity. The adapter serializes and restores this across heartbeats, allowing the agent to maintain conversation context.

Skills Injection

The adapter symlinks Baton skills into the global Codex skills directory (~/.codex/skills). Existing user skills are not overwritten.

Instructions And Project Context

Codex local receives:

  • the agent bundle entry file from instructionsFilePath
  • any composed project instructions Baton generates from project conventions

This keeps long-lived role behavior and project-specific context separate while still presenting one effective runtime prompt.

Environment Test

The environment test checks:

  • Codex CLI is installed and accessible
  • Working directory is absolute and available (auto-created if missing and permitted)
  • Authentication signal (OPENAI_API_KEY presence)
  • A live hello probe (codex exec --json - with prompt Respond with hello.) to verify the CLI can actually run