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.
Fastest setup (interactive wizard — recommended)
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:
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
| Path | Best when you want… | Wizard choice | Direct CLI command (scripts / overrides) |
|---|---|---|---|
| 1. Anthropic Native / Claude Code route | Your Claude subscription (claude setup-token or ambient claude /login) with Kompile UI, hooks, MCP tools, skills, and transcripts | kompile chat --setup → Standard → Anthropic (Native) | kompile chat --provider anthropic --auth native |
| 2. Anthropic Direct API | Direct API billing with Kompile's own tool loop, explicit Anthropic prompt caching, subagents, enforcer, and exact /cost | kompile chat --setup → Standard → Anthropic (API key) | kompile chat --provider anthropic --auth api-key |
| 3. Passthrough or Standalone Claude Code | Claude Code's native terminal or standalone claude calling Kompile's MCP tools | kompile chat --setup → Passthrough → claude | kompile passthrough --agent claude or .mcp.json |
Path 1: Claude Subscription (Native Claude Code Route)
Kompile supports two subscription credential styles:
- Managed setup tokens (recommended for multiple accounts): Choose Anthropic → OAuth / setup-token in
kompile auth login(or runkompile auth login anthropic --oauth), which runsclaude setup-tokenand stores the token under Kompile'sclaude-codecredential store. Kompile injects it asCLAUDE_CODE_OAUTH_TOKENwhenever it launchesclaude— never overwriting your ambientclaude /loginstate. - 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:
# 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-codeManage 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:
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 sessionWhat 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'sPreToolUse(ShellMandateHook) andStop(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
# 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
kompile chat --provider anthropic --auth api-key --model claude-sonnet-4-5 \
--prompt-cache-retention longUse --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
# 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 claudeStandalone Claude Code (.mcp.json)
Claude Code 2.x reads project-root .mcp.json directly. Add Kompile as a stdio server:
{
"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):
resolve_model action=providers: Listsanthropicwith its three explicit authentication methods —oauth(managedclaude-codesetup token),native(Claude Code's own CLI login), andapi-key(Anthropic HTTP API). These are never treated as interchangeable.resolve_model action=families: Showsclaude-*owned by first-partyanthropic(withgithub-copilotandopenrouteras secondary hosts).resolve_model action=models provider=anthropic authentication_method=api-key [query=sonnet](orauthentication_method=native/oauth): Returns the live catalog for that exact route, omits any model banned by/subagent-config, and supplies copy-readytaskArguments.
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.
Recommended subagent configuration (/subagent-config)
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.
| Role | Recommended Model | Why |
|---|---|---|
| Main agent (lead) | Opus or Fable (or Sonnet for everyday work) | High-leverage architecture, complex debugging, and final synthesis |
| Subagent workers | Sonnet (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):
/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-codesetup tokens or Anthropic API keys side by side withkompile 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
memorytool 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:
/costand/usageinside chat, pluskompile usage costacross 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):
# 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 windowsIf 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 intoclaudeasCLAUDE_CODE_OAUTH_TOKEN— it cannot be used asANTHROPIC_API_KEYfor--auth api-key. - Keep
.mcp.jsonclean: If you already maintain custom servers in.mcp.json, Kompile preserves them; never manually overwrite.claude/settings.local.jsonwhile a managed session is actively running.