Jido.Codex is the OpenAI Codex CLI adapter for Jido.Harness.
It provides:
Jido.Harness.Adapterimplementation (Jido.Codex.Adapter)- normalized streaming event mapping (
Jido.Codex.Mapper) - exec transport (default) and app-server transport (opt-in)
- session cancellation by
session_id - compatibility/install/smoke mix tasks
defp deps do
[
{:jido_harness, github: "agentjido/jido_harness", branch: "main", override: true},
{:jido_codex, github: "agentjido/jido_codex", branch: "main"}
]
end
This repo is currently aligned as part of the GitHub-based harness package set rather than a Hex release line.
Then:
mix deps.get
- Elixir
~> 1.18 - Codex CLI installed and authenticated
mix codex.install
mix codex.compat
mix codex.compat --transport app_server
{:ok, events} = Jido.Codex.run("Summarize this repository")
events
|> Enum.each(&IO.inspect/1)
:ok = Jido.Codex.cancel("session-id-from-stream")
Jido.Codex.run/2- build aJido.Harness.RunRequestfrom prompt + opts, then runJido.Codex.run_request/2- run a pre-built%Jido.Harness.RunRequest{}Jido.Codex.cancel/1- cancel active run by session idJido.Codex.cli_installed?/0Jido.Codex.compatible?/1Jido.Codex.assert_compatible!/1Jido.Codex.version/0
Jido.Codex.Adapter reads provider-specific runtime controls from:
request.metadata["codex"]
Supported keys:
"transport":"exec"|"app_server"(default"exec")"thread_id": string"resume_last": boolean"codex_opts": map (passed toCodex.Options.new/1)"thread_opts": map (passed toCodex.start_thread/2orCodex.resume_thread/3)"turn_opts": map (passed toCodex.Thread.run_streamed/3)"app_server": map (init_timeout_ms,client_name,client_title,client_version)"cancel_mode":"immediate"|"after_turn"(default"immediate")
Precedence:
- runtime adapter opts
- metadata (
metadata["codex"]) - defaults derived from
RunRequest
Default mapping from RunRequest:
prompt-> streamed turn inputcwd->thread_opts.working_directorymodel->codex_opts.modelandthread_opts.modelmax_turns->turn_opts.max_turnstimeout_ms->turn_opts.timeout_mssystem_prompt->thread_opts.developer_instructionsattachments->thread_opts.attachments
Codex stream events are normalized to Jido.Harness.Event with:
provider: :codex- ISO-8601
timestamp - raw event passthrough in
raw
Canonical event types include:
:session_started:output_text_delta:output_text_final:thinking_delta:tool_call:tool_result:file_change:usage:session_completed:session_failed:session_cancelled
Extended Codex-specific types use :codex_* naming (:codex_turn_started, :codex_turn_plan_updated, etc.).
mix codex.install- check Codex CLI discovery and print install helpmix codex.compat [--transport exec|app_server]- run compatibility diagnosticsmix codex.smoke "PROMPT" [--cwd ... --transport ... --timeout ...]- run minimal stream smoke test
mix test
mix quality
Integration tests are opt-in and excluded by default (@tag :integration).
The primary live adapter checks are:
mix test --include integration test/jido/codex/integration/compatibility_integration_test.exs
mix test --include integration test/jido/codex/integration/run_integration_test.exs
These tests auto-load .env.
Apache-2.0. See LICENSE.
jido_codex is the Codex CLI adapter for jido_harness, including Codex event mapping plus execution/session contract logic.
- Unit/contract tests:
mix test - Full quality gate:
mix quality - Optional live checks:
mix codex.install && mix codex.compat
OPENAI_API_KEYif you want Codex to use API-key auth instead of existing CLI login stateJIDO_CODEX_LIVE_PROMPTto override the default promptJIDO_CODEX_LIVE_CWDto override the working directoryJIDO_CODEX_LIVE_MODELto force a specific modelJIDO_CODEX_LIVE_TIMEOUT_MSto extend the per-run timeoutJIDO_CODEX_REQUIRE_SUCCESS=1to fail unless the terminal event is successfulJIDO_CODEX_CLI_PATHto target a non-default Codex CLI binary