← Catalog

@howaboua/pi-codex-conversion

Codex-oriented tool and prompt adapter for pi coding agent

Extension

Install

Install with PiG

pig install npm:@howaboua/pi-codex-conversion

Install with Pi

pi install npm:@howaboua/pi-codex-conversion
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./dist/index.js"
  ]
}

README

Written by the package's publisher, shown as published in version 5.1.2 (README.md). PiG does not review it.

pi-codex-conversion

If you're expecting details about the code, you've come to the wrong place. Clone it and ask your Clanka.

Pi already runs GPT models. This extension gives them Codex-shaped tools and prompt handling, then adds voice, compaction and OpenAI controls without turning the provider request into a schema landfill.

For the argument and token numbers, read How I gave Pi 17 tools without loading 17 schemas. This README is for using the thing.

What you get

  • Codex-shaped shell, patch and image tools
  • tools exposed directly, composed in one-shot code, or used through a persistent TypeScript notebook
  • foreground, background and interactive shell sessions with resumable output
  • image descriptions for blind models
  • realtime voice, push-to-dictate and a remote voice interface for your phone or browser
  • OpenAI reasoning, verbosity, fast mode, cache controls, usage and compaction
  • compact Pi-native rendering, status and background-shell controls

Pi keeps its sessions, project context, skills and UI. The model gets the dialect it already knows.

Install Web Run or Imagegen for web search or image generation.

Install

pi install npm:@howaboua/pi-codex-conversion

Requires the latest Pi release and Node.js 22.19 or newer. Native helpers for macOS, Linux and Windows are bundled for x64 and arm64. TS Notebook has narrower platform support.

Open /codex after installation. Codex-like GPT models use Structured mode by default.

My recommended setup: select TS Notebook under General, enable Heavy system prompt overwrite, and choose Codex V2 compaction under Context. These are opt-in, but they're what I'm daily-driving and fine-tuning towards.

Reference

Modes

Choose an execution mode under /codex → General:

ModeHow the model uses tools
StructuredCalls tools directly through top-level JSON schemas.
CodeComposes tools in one-shot JavaScript cells through exec, with wait for longer work.
TS NotebookUses a persistent TypeScript notebook with strict checking before execution and Node APIs.
VM CodeComposes tools in one JavaScript context kept for the conversation.

Code starts fresh for each cell. VM Code keeps let, const, function and class bindings for the conversation, without notebook controls or a saved heap. TS Notebook retains state between cells and provides notebook management controls. See execution modes below.

Execution mode is separate from provider scope. Apply the adapter to Codex and configured providers or all providers. For voice and dictation without the Codex adapter, install GipPity Control instead.

The Codex toolset reads files through the shell and edits with apply_patch, rather than Pi's separate text read, edit and write tools.

Background shells survive context compaction and Notes rollover. The agent receives a fresh shell inventory without changing the standing prompt. If a command finishes with an uncollected result, PCC wakes the agent only when idle. Normal monitoring remains primary; these notices are a safety net.

Settings

/codex saves changes immediately. Changes made during a run apply after it settles. Voice stop, mute and server controls remain immediate.

TabCovers
GeneralSettings scope, execution mode, providers, prompt overwrite, time reminders
ContextCompaction method and retained user messages
ToolsAuto reasoning, image descriptions, Code and Notebook shell output
OpenAIFast and Ultrafast modes, Daybreak, verbosity, transport, diagnostics, Responses Lite
DisplayStatusline, tool naming and details, background shells
VoiceRealtime voice, remote access, summarisation, dictation, shortcuts, prompt paths
UsageSpend by model and reset window, Codex limits, reset credits
AboutGitHub, changelog, Discord, issues

Open a tab directly with commands such as /codex tools, /codex openai or /codex voice.

Global or project settings

The first setting chooses Global or This project. Global settings live in ~/.pi/agent/pi-codex-conversion.json. Project settings create a snapshot at .pi/pi-codex-conversion.json, read only in trusted folders.

Switching back to Global removes the project's overrides. Run /reload after editing configuration files by hand.

Pi Codex upgrades older settings files on session start, including project files in trusted folders. It leaves current files and unrelated fields alone.

Tool details

Minimal keeps nested tool results and patch summaries visible while hiding ordinary cell output behind an expand hint. Compact, the default, adds a short cell output preview. Preview also shows cell source and patch diff previews.

Press Ctrl+O to expand tool output and see the available source, output and diffs in any mode. This changes the display, not what the model receives.

Optional controls

  • Heavy system prompt overwrite: Off keeps Pi's default prompt and adds Codex guidance in plain prose. On replaces Pi's default instructions with shorter Codex guidance. Both preserve other extensions' contributions.
  • Current time reminders: adds periodic time updates for the model. Choose 30 or 60 minutes under General. Off by default.
  • Auto reasoning: asks supported GPT-6 models to adjust effort during work, never below your selected level. Your selection returns when the run settles. Off by default. The model can ignore the instruction, so this is not a guarantee of adaptive effort.
  • Fast Mode: choose off, priority processing or Ultrafast independently for Astra, Sol, Terra and Luna. Availability depends on the model and account.
  • Daybreak: requests the connected account's available Daybreak access program without changing the selected model. Requests stop if support cannot be confirmed. See OpenAI's Daybreak guide.

Usage and quota

/codex usage shows recorded tokens, API-equivalent spend, Codex limits and reset credits. These dollar values are estimates, not subscription charges. Quota shares are approximate because other apps and devices can use the same allowance. Renamed providers and custom endpoints carry an accuracy warning.

/codex usage analyse asks your agent to inspect longer-term trends and reasoning levels. Tracking is local and stores no conversation content. The first view imports available session costs, but cannot recover missing calls or exact historical reset times.

When ordinary quota runs out, eligible accounts may receive Luna Reserve. PCC switches only after backend authorisation and asks you to send continue. It does not redeem reset credits automatically. Your original model returns after ordinary quota recovers, unless you choose another model first.

Context management

Choose under /codex context:

MethodWhat survives compaction
Pi summaryA readable summary. Default.
Codex V2An encrypted OpenAI checkpoint and recent user messages.
BothThe checkpoint plus a readable summary, at extra summarisation cost.

V2 can preserve 16k, 32k or 64k of recent user messages verbatim. The default is 64k. This is not the total context limit.

V2 and Both require Codex or a configured compatible passthrough. Choose Both before creating a checkpoint you need across providers, or convert to Pi summary before switching. Other routes use Pi summary without erasing your saved method.

For notes, history, context-window rollover and shared agent context, install Agent Comms and configure it under /notes. These are not built into PCC. Existing Notes-enabled PCC configurations require Notes to be loaded or that old continuity setting to be explicitly disabled.

Cache and diagnostics

Pi's footer shows cache percentage. Enable Codex diagnostics under /codex openai for connection status:

StatusMeaning
HIT • WS deltaCached input reported and only continuation input sent
HIT • WS fullA full request was needed, but the prompt cache still hit
MISSNo cached input reported
WS retryRetrying the WebSocket connection
WS → SSESwitched to SSE after WebSocket recovery

Prompt caching and WebSocket continuation are separate. A full request can still hit the cache.

Status + log writes diagnostic files to ~/.pi/agent/pi-codex-logs/. They include usage, timings, retries and safe error metadata, but exclude prompts, tool arguments, images and credentials. These logs are useful when reporting a problem.

Keepalive uses quota while idle and does not guarantee cache retention. It is off by default. Astra, Sol and Terra offer per-project request intervals of 25 or 55 minutes. Luna has a global duration of 5, 10 or 15 minutes, with requests every 2.5 or 4.5 minutes until that duration expires.

Execution modes and custom tools

Code downloads its runtime on first use. TS Notebook reuses matching installed packages or downloads them with npm. VM Code needs no separate runtime download. Cached runtimes work offline, and unselected modes do not download anything.

In TS Notebook, ask your agent to inspect, save, load or clean up notebook state. The notebook tool provides its own action help. Restart and cancellation do not undo file changes or other external tool effects.

If you used Deno Notebook, follow the recovery and cleanup guide. The old mode setting now selects TS Notebook, but Deno notebooks and profiles are not imported or deleted.

TS Notebook

Select TS Notebook for strict TypeScript checking, retained type declarations, Node and Web APIs, and imports from local files or packages. Invalid code and tool arguments are rejected before execution. New npm dependencies require user approval.

Run Pi under Node on Linux or macOS with x64 or arm64, or Windows x64.

Variables, closures, class instances and module state survive between cells. Checkpoints save supported data and helpers, reporting anything that remains live-only. Custom snapshot and restore helpers can preserve additional objects. Restart restores the checkpoint, not arbitrary live-only state.

Concurrent isolated cells start from the last checkpoint and save separate candidates. Loading one replaces the live notebook rather than automatically merging changes. Releasing bindings also rebuilds the kernel and clears live-only values.

VM Code

Select VM Code to compose tools in JavaScript while keeping let, const, function and class bindings across exec calls in the conversation. exec and wait stay the same, and tools stay tools.name.

VM Code runs one cell at a time in a conversation-local context. store and load keep conversation-local JSON without writing to disk.

Under Node.js, the worker's JavaScript heap is capped at 256 MiB. Under Bun 1.4.4 or later, including standalone Pi, the evaluator runs in a separate process with a 320 MiB memory budget.

  • Linux: systemd and cgroup v2 enforce a hard process limit with no swap. A working systemd user session is required.
  • macOS and Windows: a watchdog stops the evaluator when its resident memory exceeds the budget. A fast allocation can exceed the budget before the watchdog reacts.

If the evaluator cannot start, use Pi under Node.js or select Code.

Top-level await works, and const, var and function hoisting stay the same as a cell without await. The environment has no Node APIs, imports, direct network access or timers. The agent uses tools for host operations.

VM Code is not an isolation boundary for untrusted code.

A script error keeps the bindings. A stall, cancellation, memory limit, terminate or conversation change drops them, and the next exec starts fresh.

Existing QuickJS Code settings (js) select VM Code automatically. Use Code if you need fresh JavaScript for every cell. Old JS Notebook files are neither loaded nor deleted.

Extension tools and MCP

Installed Pi tools and enabled MCP servers are available inside Code, VM Code and TS Notebook. Configure MCP servers through Pi. Existing permissions, tool restrictions and disabled servers still apply.

Use content(result.content) to emit mixed MCP text and images in their original order. The helper also accepts a single content block. Resource blocks remain JSON text; audio and encrypted text are not supported.

exec and wait wait for their active Pi tool calls to return before yielding, even when the cell's yield timeout has elapsed.

If a server is still connecting, the agent may need to retry its call. Use Ctrl+O to expand or collapse tool details, or click individual notices in fullscreen mode.

Custom commands

Command-backed tools use TOML definitions in either location:

~/.pi/agent/codex-conversion-custom-tools/
<project>/.pi/codex-conversion-custom-tools/

See the working examples and definition contract. For on-demand skill discovery, use Better Skills Tool.

Voice, dictation and remote access

Choose Voice model in /codex voice or the browser interface. Changing the Pi model does not interrupt a voice call.

Voice modelCredential
codex-live-1.1, the defaultPi's legacy openai-codex login
api-live-1.1An OpenAI API key configured in Pi
realtime-2.1An OpenAI API key configured in Pi
realtime-2.1-miniAn OpenAI API key configured in Pi

Codex Live and dictation use OAuth through /login openai-codex. Selecting an API voice model does not change dictation's login. For API voice models, enter the exact, case-sensitive Pi provider name in API provider in terminal or LAN voice settings. The default is openai. GipPity uses that provider's API key, headers and compatible endpoint without storing or displaying the key. Missing keys, OAuth credentials and invalid endpoints are rejected without falling back to another account. Changes apply on the next call. API voice calls are billed separately through the selected provider. Sign in with ChatGPT does not provide this API access or replace the legacy Codex login.

Codex Live rewrites the current voice conversation interval into a self-contained task before sending it to Pi. Task delegation model shows the configured model without a picker. Change voice.taskDelegationModel in the JSON configuration to use another provider/model value. The default is openai-codex/gpt-6-luna. Choose Task delegation reasoning separately in terminal or LAN settings. It defaults to low and is independent of voice context summarisation. These settings apply only to Codex Live; GPT-Realtime still sends tasks directly through send_task.

GPT Live 1.1 on the API uses the current Pi model to prepare voice requests before sending them to Pi. The Default context summarisation setting also uses the current Pi model for API Live.

Realtime models use send_task to send Pi a self-contained task with relevant voice-discussion decisions and constraints. Busy Pi sessions receive it as steering, with existing tools and confirmations preserved. Realtime models can also use developer-registered voice tools. For optional search, load @howaboua/pi-codex-web-run, configure its access and enable Realtime web search. Search uses Web Run's configured provider and credentials.

ShortcutAction
Ctrl+Alt+SpaceToggle realtime voice
Ctrl+Alt+MMute or unmute
Ctrl+Alt+DPush-to-dictate. Toggle behaviour is available in the Voice tab
Ctrl+Alt+GToggle the remote voice server

Audio follows system defaults. Select devices under Voice if needed. Dictation puts an editable transcript in Pi's input.

Choose primary and alternate voices in the Voice tab or browser interface. Codex Live and Realtime keep separate voice choices, defaulting to Cove and Ember for Codex Live, Marin and Cedar for Realtime. Model and voice changes apply to the next call without replacing the current call. With Shepherdr, transferring voice to another session alternates the voice and gives an arrival greeting. Refresh voice context summarises and restarts voice after rollover or compaction.

Customise the voice prompt at ~/.pi/agent/REALTIME-SYSTEM-PROMPT.md. Trusted projects can append .pi/REALTIME-SYSTEM-PROMPT.md. Your custom prompts are not rewritten automatically.

Use voice from another device

The remote server has no authentication. Keep it on a trusted network.

Run /codex voice server, open its HTTPS address on your phone or another computer, and accept the local certificate. The browser provides voice, mute, editable dictation, typed prompts and Pi activity. Moving between devices does not restart the host's voice call.

For automation, use /codex voice server ensure to start the listener only if needed, or /codex voice server status to inspect it without changing it. The bare /codex voice server command remains a toggle. Starting the listener does not start a voice call.

Append a UUID v4 to either explicit command to write a JSON receipt at <Pi agent directory>/runtime/voice-requests/<UUID>.json. Receipts are written atomically with private permissions. Each records version: 1, requestId, action, provider: "codex", sessionId, terminalId, status, running, urls and browserAttached, plus error on failure. terminalId is null outside Herdr. status is running, stopped or error. browserAttached means a browser audio socket is open, not that the voice provider is connected. Use a fresh UUID for each request, wait for its receipt and remove it after reading. Without a UUID, results appear in Pi.

Use /codex voice server connect <browser-route> <UUIDv4> [url] to ensure the listener and start voice in a new browser tab. Use local for this machine's browser or a host configured in Pi Browser, such as laptop. The selected browser needs an existing CDP connection, certificate trust and microphone permission. The command does not change those permissions. Remote browsers use this server's hostname URL by default. An optional URL must appear in the listener's reported urls and be reachable from the browser.

Connect receipts add browserRoute, browserStatus, browserUrl and, when available, browserRefId. browserStatus reports the page's acknowledged listening, error or timeout result. Failures include browserError and leave the listener's actual running state intact. Existing voice or browser audio blocks a new connection to avoid taking its microphone. Repeating a connect UUID does not open another tab or repeat a start click. A failed or timed-out attempt is not retried automatically. Check its tab before making another attempt.

Use /codex voice stop to stop voice. The remote server stops when its owning Pi session changes.

Models and providers

PCC supports GPT-6 Astra, Sol and Luna, GPT-6.1 Sol and Terra, and GPT-6.2 Sol and Astra, with Responses Lite and live reasoning adjustments on Codex transport. Available context sizes and reasoning levels depend on the selected model. Cost estimates use published API rates.

Default scope covers Codex-like GPT routes and Responses providers listed under Additional providers. Switching to an unrelated model restores Pi's ordinary tools.

Codex Live voice, dictation, usage and image descriptions can use the Codex login while another provider's model is active. Realtime voice models use the API provider selected in voice settings instead. The separate web and image-generation extensions also use their configured access independently.

Troubleshooting
  • No voice device: check the input and output devices under Voice, then restart the call.
  • Browser microphone blocked: use the HTTPS address and accept its certificate. Browsers block microphones on plain LAN HTTP.
  • Runtime download failed: check npm, registry or proxy access, then retry. Downloaded runtimes are cached.
  • TS cannot start: check its platform requirements above and that npm installs optional dependencies.
  • Bundled helper cannot run: report the platform and error. Custom builds can be selected with tools.customRustBinariesDir, followed by /reload. Do not replace system glibc.
  • Configured provider fails: the endpoint must support the selected API and features, including Responses Lite or native compaction when enabled.

See the changelog or report an issue.

Building an integration

Normal Pi tools work with PCC without additional registration. For custom tool behaviour, shared agent context, developer messages or voice announcements, use the extension API guide and Code Mode example.

To expose a tool directly to Realtime voice models, use registerGippityVoiceTool from @howaboua/pi-codex-conversion/realtime-voice during extension loading. Calls snapshot the registered tools at startup. Ordinary Pi tools are not automatically exposed to the voice model. Standalone GipPity exports the same API from @howaboua/pi-gippity-control.

License

MIT. Bundled and vendored third-party components retain their own licences and notices.