ClaudeWrapper.IEx (ClaudeWrapper v0.6.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 Claude.

Usage

iex> import ClaudeWrapper.IEx

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

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

iex> say("looks good, ship it")
# => keeps going

iex> cost()
# => $0.21 across 3 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: "sonnet", working_dir: "/my/project", max_turns: 5)

Override per-turn with say/2:

say("do something expensive", max_turns: 20)

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 ClaudeWrapper.query/2 -- config options (:working_dir, :binary, :env, :timeout, :verbose, :debug) and query options (:model, :max_turns, :permission_mode, 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 query option overrides.

session_id()

Get the session ID (for resuming later).