CodexWrapper.IEx (CodexWrapper v0.4.0)

Copy Markdown View Source

Interactive helpers for conversational use in IEx.

Provides a minimal, REPL-friendly interface that manages session state implicitly so you can just talk to Codex.

Usage

iex> import CodexWrapper.IEx

iex> chat("explain this codebase", working_dir: ".")
# => prints response

iex> say("now add tests for the retry module")
# => continues the conversation

iex> cost()
# => $0.00 across 2 turns

iex> history()
# => prints conversation

iex> reset()
# => starts fresh

Configuration

Pass options to chat/2 to configure the session. These persist for subsequent say/2 calls:

chat("hello", model: "o3", working_dir: "/my/project")

Override per-turn with say/2:

say("do something different", model: "o4-mini")

Summary

Functions

Start a new conversation. Prints the response.

Show total cost and turn count for the current session.

Print the conversation history.

Get the last result struct (for programmatic access).

Reset the session (start fresh on next chat/2).

Resume a previous session by ID.

Continue the current conversation. Prints the response.

Get the session ID (for resuming later).

Functions

chat(prompt, opts \\ [])

Start a new conversation. Prints the response.

Accepts all options from CodexWrapper.exec/2 -- config options (:working_dir, :binary, :env, :timeout, :verbose) and exec options (:model, :sandbox, :approval_policy, etc.).

cost()

Show total cost and turn count for the current session.

history()

Print the conversation history.

last()

Get the last result struct (for programmatic access).

reset()

Reset the session (start fresh on next chat/2).

resume(sid, opts \\ [])

Resume a previous session by ID.

Uses the same config as the last chat/2 call, or pass new options.

say(prompt, opts \\ [])

Continue the current conversation. Prints the response.

Accepts per-turn exec option overrides.

session_id()

Get the session ID (for resuming later).