Skip to content

Quickstart for Codex Users ​

If you use OpenAI Codex or a ChatGPT subscription, Kompile gives you three ways to work — from running OpenAI's Codex Responses API directly inside Kompile's own agentic loop, to wrapping the codex CLI in Kompile's managed harness, to plugging Kompile's MCP tools into a standalone codex session.

You don't need to type or memorize long --provider / --auth / --model commands. Run the interactive wizard once to sign in, pick a live Codex model, and save your defaults — after that, just run kompile chat:

bash
cd /path/to/your/repo
kompile chat             # Launches SetupWizard on first run (or `kompile chat --setup` anytime)

In SetupWizard, choose Standard Chat (or Passthrough → codex) → OpenAI / Codex, complete sign-in on the spot (or run bare kompile auth login / /auth inside chat), select from live-discovered models, and save as your project or global default.

Choose your path ​

PathBest when you want…Wizard choiceDirect CLI command (scripts / overrides)
1. Standard Chat on ChatGPT OAuth (recommended)Full Kompile harness (Enforcer, Judge, Subagents, /cost, /usage, LSP, code index) using your ChatGPT subscriptionkompile chat --setup → Standard → OpenAI (OAuth)kompile chat --provider openai --auth oauth
2. Managed or Direct Codex PassthroughThe codex CLI binary itself, augmented with Kompile MCP tools, skills, and optional real-time enforcer/judgekompile chat --setup → Passthrough → codexkompile chat --mode passthrough --agent codex
3. Standalone Codex + Kompile MCPPlain codex outside Kompile, calling Kompile's memory, code search, and graph tools over stdio—Configure kompile mcp-stdio in ~/.codex/config.toml

Kompile talks directly to the OpenAI Codex Responses API using your ChatGPT subscription login (openai provider with --auth oauth; the older openai-codex name still works as an alias).

1. Sign in once ​

Run kompile auth login (interactive Auth Wizard — pick OpenAI → OAuth) or type /auth inside chat. For direct CLI / multi-account commands:

bash
# Interactive browser/device OAuth login (stored under Kompile's managed credential store)
kompile auth login openai --oauth

# Optional: save a second named account (e.g. work vs personal)
kompile auth login openai --oauth --name work --no-switch
kompile auth list

Prefer an OpenAI API key instead of ChatGPT OAuth? Choose API key in kompile auth login (or run kompile auth login openai / export OPENAI_API_KEY).

2. Start chatting ​

bash
cd /path/to/your/repo

# Recommended: interactive setup wizard (discovers models live via codex app-server and saves defaults)
kompile chat --setup

# Direct CLI overrides (for scripts or one-off launches)
kompile chat --provider openai --auth oauth --model gpt-5.2-codex --effort high

Pin a specific named credential to one terminal without changing your global default:

bash
kompile chat --provider openai --auth oauth --credential work --auth-scope session

3. Headless / CI one-shot turns ​

bash
kompile chat --provider openai --auth oauth --model gpt-5.2-codex \
  --prompt "Audit src/auth for race conditions" \
  --output-format stream-json

Path 2: Managed or Direct Passthrough (codex CLI) ​

Want the codex CLI itself to drive the turn loop while still receiving Kompile's tools, skills, instructions, and transcripts?

bash
# Managed passthrough: Kompile owns the TUI, injects MCP tools + skills + AGENTS.md,
# and can attach real-time enforcer rules
kompile chat --mode passthrough --agent codex --model gpt-5.2-codex --effort medium

# With inline real-time judge/enforcer rules
kompile chat --mode passthrough --agent codex \
  --rules "Run unit tests after every edit; never use git reset"

# Direct passthrough: codex owns the terminal natively, Kompile injects MCP + parses metrics on exit
kompile passthrough --agent codex

How Kompile keeps ~/.codex/config.toml clean: For managed Codex launches, Kompile passes per-launch -c command-line overrides (McpToolInjection.codexCommandLineOverrides) rather than rewriting your global ~/.codex/config.toml. Separate Codex sessions in different repos never clobber each other's config.


Path 3: Standalone Codex + Kompile MCP ​

If you launch codex directly outside Kompile, register kompile mcp-stdio in ~/.codex/config.toml:

toml
[mcp_servers.kompile]
command = "kompile"
args = ["mcp-stdio"]

When you also run a Kompile server (kompile project open .), pass --url http://localhost:8080 (or rely on project auto-discovery) so Codex can query your indexed documents and knowledge graph alongside local code tools.


How resolve_model works with OpenAI / Codex ​

Before delegating to a subagent (task, multi_task, or quorum_task), Kompile agents call resolve_model — a read-only discovery tool that never runs a model turn, never logs in, and never falls back to another account:

When a delegation names a gpt-* / codex-* model without an explicit provider, ModelRouting keeps your active OpenAI route (whether oauth or api-key), or routes deterministically to first-party openai if another provider is active and openai is configured. Note that gpt-6-astra and the gpt-6-sol family automatically use the OpenAI Responses protocol for function calling.


IMPORTANT

For OpenAI, always use Luna (gpt-5.6-luna) for subagent workers, with Astra (gpt-6-astra / gpt-6.2-astra) or Sol (gpt-6.2-sol / gpt-6.1-sol / gpt-5.6-sol) as the main agent. Never make top-tier frontier models like Astra, Opus, or Fable a subagent unless you are sure of the cost — gpt-6-astra ($8–$10/M input, $40–$50/M output) multiplies rapidly across parallel workers.

RoleRecommended ModelWhy
Main agent (lead)gpt-6-astra / gpt-6.2-astra or gpt-6.2-sol / gpt-5.6-solDeep planning, architectural reasoning, and synthesis on the primary thread
Subagent workersgpt-5.6-lunaFast, economical execution for exploration, diffs, tests, and parallel fan-out
Banned from subagents*astra*, *opus*, *fable*, *neon*Prevents accidental frontier spend in multi_task / quorum_task

Subagents never silently borrow the parent chat's Kompile-managed credential — pin the credential name from kompile auth list openai-codex (or openai) in /subagent-config route:

text
/subagent-config ban *astra*
/subagent-config ban *opus*
/subagent-config ban *fable*
/subagent-config route openai/gpt-5.6-luna auth=oauth credential=default
/subagent-config per-session 4
/subagent-config budget 500000
/subagent-config preload-tools read,grep,glob,edit,write,bash

Everything is saved in ~/.kompile/config/subagent-config.json. Once banned, resolve_model omits those models and SubagentAdmission refuses any dispatch requesting them.


What Kompile adds for Codex workflows ​

  • Prompt cache affinity: Automatically sets OpenAI prompt_cache_key (ProviderPromptCacheCapabilities) so multi-turn sessions maximize prefix cache hits.
  • Live model discovery: Queries codex app-server for the current Codex catalog and caches the last-known-good list in ~/.kompile/cache/model-catalogs.json.
  • Quota & cost visibility: Run /usage and /cost inside chat (or kompile usage cost) to inspect token spend, cache hit ratio, and subscription usage.
  • Subagent fan-out & cross-checking: Delegate parallel exploration or independent reviews via task, multi_task, and quorum_task — even mixing Codex with Claude or OpenRouter models.
  • Guardrails: Enforce read-before-edit, dedicated tool usage, build lanes, and LLM-as-a-judge verification via The Enforcer and The Judge.

Importing & resuming Codex sessions ​

Kompile's codex adapter reads Codex CLI rollouts directly from ~/.codex/sessions/rollout-*.jsonl[.zst] (along with ~/.codex/history.jsonl and ~/.codex/state_*.sqlite, honoring CODEX_HOME and CODEX_SQLITE_HOME):

bash
# Import existing Codex CLI sessions into Kompile's portable store
kompile session import --source=codex
kompile agent chat-import sync --source=codex

# Browse and resume a Codex session — or hand it off to another agent
kompile resume --filter-source codex
kompile resume -t <session-uuid> --agent codex         # Resume natively in Codex
kompile resume -t <session-uuid> --agent claude        # Hand off a Codex session to Claude
kompile chat --continue                                # Resume last Kompile Standard Chat session
kompile resume-all                                     # Restore all recently active windows

NOTE

New native ID on reconstruction: If a healthy Codex native session exists on disk, NativeResumeCoordinator resumes it untouched. When Kompile reconstructs a missing or cross-agent session into Codex, Codex always receives a new native session ID because its durable queue and thread state (state_*.sqlite) are keyed by session ID.

See Import & Resume for cross-agent compaction (CrossAgentResumeCompactor), batch recovery, and durable subagent resume.

Common gotchas ​

  • Don't mix --provider with --mode passthrough: Native passthrough uses --agent codex and Codex's own --model; --provider openai --auth oauth is for Kompile's Standard Chat mode.
  • Different login stores: kompile auth login openai --oauth stores Kompile's own OAuth credential for Standard Chat. Direct codex CLI passthrough uses whatever login the codex binary itself holds.

Next steps ​

Released under the Apache-2.0 License.