Skip to content

Quickstart for Claude Users ​

Whether you use a Claude Code subscription or an Anthropic API key, Kompile integrates cleanly with Claude in three modes: Kompile's native Claude Code route, direct Anthropic API chat, or standalone Claude Code wired to Kompile's MCP server.

You don't need to remember provider or auth flags. Run the interactive wizard once to connect your Claude subscription or API key, pick a 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 → claude) → Anthropic / Claude, sign in on the spot (or run bare kompile auth login / /auth inside chat), pick your model & effort level, and save your project or global defaults.

Choose your path ​

PathBest when you want…Wizard choiceDirect CLI command (scripts / overrides)
1. Anthropic Native / Claude Code routeYour Claude subscription (claude setup-token or ambient claude /login) with Kompile UI, hooks, MCP tools, skills, and transcriptskompile chat --setup → Standard → Anthropic (Native)kompile chat --provider anthropic --auth native
2. Anthropic Direct APIDirect API billing with Kompile's own tool loop, explicit Anthropic prompt caching, subagents, enforcer, and exact /costkompile chat --setup → Standard → Anthropic (API key)kompile chat --provider anthropic --auth api-key
3. Passthrough or Standalone Claude CodeClaude Code's native terminal or standalone claude calling Kompile's MCP toolskompile chat --setup → Passthrough → claudekompile passthrough --agent claude or .mcp.json

Path 1: Claude Subscription (Native Claude Code Route) ​

Kompile supports two subscription credential styles:

  1. Managed setup tokens (recommended for multiple accounts): Choose Anthropic → OAuth / setup-token in kompile auth login (or run kompile auth login anthropic --oauth), which runs claude setup-token and stores the token under Kompile's claude-code credential store. Kompile injects it as CLAUDE_CODE_OAUTH_TOKEN whenever it launches claude — never overwriting your ambient claude /login state.
  2. Ambient Claude Code login: If you already ran claude /login, Kompile can use that login directly.

1. Authenticate ​

Run kompile auth login (or /auth inside chat) for the interactive Auth Wizard. Direct CLI commands for scripts or named accounts:

bash
# Capture a managed Claude Code setup token (opens browser approval)
kompile auth login anthropic --oauth

# Optional: store a separate work account without switching the global default
kompile auth login anthropic --oauth --name work --no-switch
kompile auth list claude-code

Manage or revoke active setup tokens at claude.ai → Settings → Claude Code.

2. Start chatting ​

Once saved via kompile chat --setup, just run kompile chat. Direct CLI flag overrides:

bash
cd /path/to/your/repo

# Native Claude Code route inside Kompile Standard Chat
kompile chat --provider anthropic --auth native

# Override model or effort (supports Claude aliases like sonnet, opus, haiku)
kompile chat --provider anthropic --auth native --model opus --effort high

# Pin a named work credential to this session only
kompile chat --provider anthropic --auth native --credential work --auth-scope session

What Kompile configures automatically for Claude Code ​

Before spawning claude, Kompile prepares two things so Claude Code's file watchers see a stable config from turn 1:

  • .claude/settings.local.json: Pre-configures Kompile's PreToolUse (ShellMandateHook) and Stop (MemoryResponseHook) hooks and allows project MCP servers before Claude starts watching the file.
  • .mcp.json: Wires Kompile's MCP server (preserving any custom MCP servers you already declared in .mcp.json).

Path 2: Anthropic Direct API (--auth api-key) ​

When you want Kompile's own agentic loop talking directly to https://api.anthropic.com (with full Enforcer, Judge, Subagents, and explicit prompt-cache control):

1. Store your API key ​

bash
# Interactive masked prompt
kompile auth login anthropic

# Or pipe / reference an existing env var
printf '%s\n' "$ANTHROPIC_API_KEY" | kompile auth login anthropic --stdin --name work
kompile auth login anthropic --from-env ANTHROPIC_API_KEY

(ANTHROPIC_API_KEY is also honored directly as an environment fallback.)

2. Start chatting with prompt-cache control ​

bash
kompile chat --provider anthropic --auth api-key --model claude-sonnet-4-5 \
  --prompt-cache-retention long

Use --prompt-cache-retention long (default extended tier), short, or none (or set KOMPILE_CACHE_RETENTION). Kompile activates explicit Anthropic cache breakpoints automatically via ProviderPromptCacheCapabilities.


Path 3: Passthrough or Standalone Claude Code + Kompile MCP ​

Managed or direct passthrough ​

bash
# Kompile-managed TUI wrapping Claude Code with skills, MCP tools, and optional --rules
kompile chat --mode passthrough --agent claude --model sonnet

# Native Claude Code terminal with Kompile MCP injection + post-exit transcript/cost capture
kompile passthrough --agent claude

Standalone Claude Code (.mcp.json) ​

Claude Code 2.x reads project-root .mcp.json directly. Add Kompile as a stdio server:

json
{
  "mcpServers": {
    "kompile": {
      "command": "kompile",
      "args": ["mcp-stdio"]
    }
  }
}

Or run kompile project open . in a Kompile project to have .mcp.json registered automatically.


How resolve_model works with Claude / Anthropic ​

Before dispatching a subagent (task, multi_task, or quorum_task), Kompile agents call resolve_model — a read-only discovery tool that never invokes a model, never triggers a login, and never silently switches between your subscription (oauth / native) and API key (api-key):

When a delegation names a claude-* model without an explicit provider, ModelRouting keeps your configured route if it hosts Claude (e.g., anthropic or github-copilot), otherwise routes deterministically to first-party anthropic.


WARNING

Never make top-tier models like Opus (*opus*) or Fable (*fable*) a subagent unless you are sure of the cost. Fable ($8–$10/M input, $40–$50/M output) and Opus ($4–$15/M input, $20–$75/M output) are built for the main lead thread — running them across parallel multi_task or quorum_task workers multiplies spend dramatically.

RoleRecommended ModelWhy
Main agent (lead)Opus or Fable (or Sonnet for everyday work)High-leverage architecture, complex debugging, and final synthesis
Subagent workersSonnet (coding/review) or Haiku (fast search/triage/docs)Fraction of the token cost with strong tool-calling reliability
Banned from subagents*opus*, *fable*, *mythos*, *astra*, *neon*Hard gate enforced in both resolve_model and SubagentAdmission

Keep Claude Code workers lean ​

Kompile launches Claude Code subagents with --tools ToolSearch --strict-mcp-config --disable-slash-commands, removing Claude Code's built-in tools so workers load only the Kompile tools you preload (preload-tools) plus progress. Subagents never silently borrow the parent chat's Kompile-managed credential, so name the credential (or use auth=native for Claude Code's own CLI login):

text
/subagent-config ban *opus*
/subagent-config ban *fable*
/subagent-config ban *mythos*
/subagent-config route anthropic/claude-sonnet-4-5 auth=api-key credential=default
/subagent-config role-route explorer anthropic/claude-haiku-4-5 auth=api-key credential=default
/subagent-config cost-budget 2.00
/subagent-config preload-tools read,grep,glob,edit,write,bash

(For subscription workers on Claude Code's own CLI login, use /subagent-config route anthropic/sonnet auth=native, or name a setup token with auth=oauth credential=<name>.)


What Kompile adds for Claude workflows ​

  • Multi-account switching: Keep personal and work claude-code setup tokens or Anthropic API keys side by side with kompile auth switch anthropic <name> or per-session --credential <name>.
  • Deterministic tool guardrails: Enforces Kompile's dedicated file/search/build tools over ad-hoc shell commands, plus read-before-edit and LSP checks.
  • Persistent cross-session memory: Shared memory tool and semantic recall that survives across Claude, Codex, Antigravity, and direct-API sessions.
  • Subagents & quorum review: Spawn parallel Claude or mixed-provider subagents (task, multi_task, quorum_task) with isolated logs and mandatory progress reports.
  • Live cost & quota visibility: /cost and /usage inside chat, plus kompile usage cost across all past sessions.

Importing & resuming Claude sessions ​

Kompile's claude-code adapter reads Claude Code transcripts directly from ~/.claude/projects/<project>/*.jsonl (plus sessions-index.json and history.jsonl, honoring CLAUDE_CONFIG_DIR):

bash
# Import existing Claude Code sessions into Kompile's portable store
kompile session import --source=claude-code
kompile agent chat-import sync --source=claude-code

# Browse and resume a Claude session — or hand it off to another agent
kompile resume --filter-source claude-code
kompile resume -t <session-uuid> --agent claude        # Resume natively in Claude Code
kompile resume -t <session-uuid> --agent codex         # Hand off to Codex (or agy / kompile)
kompile chat --continue                                # Resume last Kompile Standard Chat session
kompile resume-all --agent claude                      # Restore recent Claude terminal windows

If a Claude session is still intact on disk, NativeResumeCoordinator resumes it without modifying its files; if it was pruned or originated in another tool (e.g., Codex or Cursor), Kompile reconstructs a clean Claude session sized to the target model's context window via CrossAgentResumeCompactor.

See Import & Resume for all 11 adapters, MCP conversation_import, and subagent_resume.

Common gotchas ​

  • Setup tokens are not API keys: A token from kompile auth login anthropic --oauth (claude setup-token) is injected into claude as CLAUDE_CODE_OAUTH_TOKEN — it cannot be used as ANTHROPIC_API_KEY for --auth api-key.
  • Keep .mcp.json clean: If you already maintain custom servers in .mcp.json, Kompile preserves them; never manually overwrite .claude/settings.local.json while a managed session is actively running.

Next steps ​

Released under the Apache-2.0 License.