|
| 1 | +# Migrate from Claude Code or Codex |
| 2 | + |
| 3 | +Kit does not have a migration slash command or a fixed importer. Source harness formats change, and a useful migration usually needs choices about global versus project scope. Start Kit in the project that you want to migrate and ask the agent to inspect, translate, and validate the relevant configuration. This guide is bundled into Kit so the agent can search it with `docs`. |
| 4 | + |
| 5 | +## Start an assisted migration |
| 6 | + |
| 7 | +Run: |
| 8 | + |
| 9 | +```sh |
| 10 | +kit init |
| 11 | +kit auth login openai |
| 12 | +kit tui --root /path/to/project |
| 13 | +``` |
| 14 | + |
| 15 | +This example uses Kit's default OpenAI subscription provider. If you selected OpenRouter or Speakeasy, authenticate that provider instead. |
| 16 | + |
| 17 | +Then use a prompt that states the sources and safety boundaries: |
| 18 | + |
| 19 | +> Read the bundled "Migrate from Claude Code or Codex" guide. Inspect my Claude Code and Codex project instructions, skills, and MCP configuration. Propose a mapping into Kit, preserve every source file, do not copy or print credentials, and ask before replacing or merging an existing Kit file. After I approve the plan, make the changes and validate the MCP status. |
| 20 | +
|
| 21 | +You can narrow the request: |
| 22 | + |
| 23 | +- “Bring only this project's Claude Code MCP servers into Kit's project `.mcp.json`.” |
| 24 | +- “Merge the useful instructions from `CLAUDE.md` into `AGENTS.md`; show conflicts first.” |
| 25 | +- “Find my Codex MCP servers and convert them to Kit's global MCP JSON. Do not copy tokens or environment values that contain secrets.” |
| 26 | +- “Configure the Claude ACP adapter as an `acp.claude` designer subagent, with `designer` mapped to Opus. Keep my Claude Code files as migration sources, and do not change the default Kit harness.” |
| 27 | + |
| 28 | +The agent can read files outside the selected project when the Kit process has operating-system access to them. Keep the request scoped, and review proposed changes to home-directory configuration before approval. |
| 29 | + |
| 30 | +## Destination files in Kit |
| 31 | + |
| 32 | +| Concern | Kit destination | Notes | |
| 33 | +| --- | --- | --- | |
| 34 | +| Runtime, provider, model, and external ACP harnesses | `~/.kit/config.toml` | Command-line flags override this file. Authenticate providers and external harnesses separately. | |
| 35 | +| MCP servers for every project | The JSON file named by `mcp_config` in `~/.kit/config.toml`; `kit init` defaults it to `~/.kit/mcp.json` | The file uses a top-level `mcpServers` object. | |
| 36 | +| MCP servers for one project | `<project>/.mcp.json` | Kit discovers this file from the canonical `--root`. Project entries override same-named global entries. | |
| 37 | +| Project instructions | `AGENTS.md` at the project root or an ancestor | Kit loads the chain of `AGENTS.md` files from the root and its ancestors. | |
| 38 | +| Agent Skills | `<project>/.agents/skills` or `~/.agents/skills` | Each compatible skill is a package containing `SKILL.md`. Inspect scripts and dependencies before copying it. | |
| 39 | + |
| 40 | +Do not migrate provider tokens, OAuth caches, `auth.json`, Keychain entries, or another harness's credential files. Use `kit auth login openai`, `kit auth login openrouter`, or `kit auth login speakeasy` for Kit providers. A remote MCP server that challenges with OAuth appears as `authentication_required`; ask the agent to authenticate it in `kit tui`, `kit serve`, or `kit acp`. |
| 41 | + |
| 42 | +## Claude Code mapping |
| 43 | + |
| 44 | +Claude Code configuration can be user-scoped, project-scoped, managed, or supplied by plugins. Its exact locations and fields depend on the installed version, so the agent should inventory the active setup instead of assuming that every possible file exists. Common sources to inspect include `~/.claude.json`, project `.mcp.json`, `.claude/settings.json`, `.claude/settings.local.json`, `CLAUDE.md`, `.claude/CLAUDE.md`, and user or project skill directories. |
| 45 | + |
| 46 | +Map compatible content as follows: |
| 47 | + |
| 48 | +- **MCP:** extract the active `mcpServers` entries and convert only fields supported by Kit's strict MCP schema. Claude Code can expand `${VAR}` and `${VAR:-default}` placeholders in MCP values; Kit's normal JSON MCP layer does not. Detect every placeholder and either translate it to supported configuration or reject the entry with an unresolved expression. A project `.mcp.json` can remain in place only when it validates and has no incompatible expansion behavior. Decide whether user-scoped servers belong in Kit's global MCP file or should become project-local. Add a specific `description` for each server. |
| 49 | +- **Instructions:** merge durable repository guidance from Claude instruction files into the `AGENTS.md` chain for the selected root. Do not concatenate blindly: remove Claude-only directions and reconcile conflicts with existing instructions. Kit loads only the selected root and its ancestors, not descendant `AGENTS.md` files. Consolidate nested guidance when Kit runs at the repository root, or select the corresponding subproject as `--root` when that guidance should apply only there. |
| 50 | +- **Skills:** place compatible Agent Skills under `.agents/skills` or `~/.agents/skills`. Review each package before copying executable scripts or dependencies. Claude-specific slash commands, hooks, plugin metadata, and UI settings do not automatically become Kit skills. |
| 51 | +- **Permissions and hooks:** do not translate allowlists, approval settings, or hooks into an implied Kit sandbox. Kit is not a security boundary. Convert only useful behavioral guidance into explicit instructions, and use an operating-system or container boundary for enforcement. |
| 52 | +- **Models and login:** choose and authenticate Kit's provider separately. Kit cannot use a Claude subscription as credentials for its built-in `acp.kit` harness. The `@agentclientprotocol/claude-agent-acp` adapter includes the Claude Agent SDK CLI and authenticates separately with a Claude subscription or Anthropic Console; that choice determines billing and usage limits. |
| 53 | + |
| 54 | +## Codex mapping |
| 55 | + |
| 56 | +Codex and Kit both use `AGENTS.md`, but their discovery rules differ. Inventory `~/.codex/AGENTS.md`, `AGENTS.override.md`, and the files that Codex loads from the repository root down to its working directory. Kit does not recognize `AGENTS.override.md`; it loads `AGENTS.md` only at the selected root and its ancestors. Merge global or override guidance into the appropriate Kit `AGENTS.md`. Consolidate descendant guidance when Kit runs from the repository root, or select that subproject as Kit's `--root`. |
| 57 | + |
| 58 | +For the remaining setup: |
| 59 | + |
| 60 | +- **MCP:** inspect active `mcp_servers` tables in Codex configuration, commonly `~/.codex/config.toml` and project `.codex/config.toml`, and translate them into Kit's JSON `mcpServers` entries. Preserve command arguments and non-secret environment settings, but review transport names and omit fields that Kit does not support. |
| 61 | +- **Skills:** compatible Agent Skills that already live in `.agents/skills` or `~/.agents/skills` are directly discoverable by Kit. For skills stored in a Codex-specific location, inspect and copy the complete skill package to the matching Kit scope. |
| 62 | +- **Provider and model settings:** treat these as intent, not portable authentication. Select a Kit provider and model in `~/.kit/config.toml` or with command-line flags, then authenticate through Kit. |
| 63 | +- **Approval and sandbox settings:** these have no one-to-one Kit mapping. Do not claim that a Codex sandbox or approval policy carries over. Run Kit inside a trusted security boundary. |
| 64 | +- **Codex as a subagent:** an installed and authenticated Codex ACP adapter can be configured under `[acp.codex]`. It remains a separate harness; Kit sends ACP session traffic but does not inject Kit credentials, plugins, or MCP configuration into it. |
| 65 | + |
| 66 | +## Validate the result |
| 67 | + |
| 68 | +After editing, ask the agent to perform the smallest relevant checks: |
| 69 | + |
| 70 | +1. Parse `~/.kit/config.toml` and every changed MCP JSON file without displaying secret values. |
| 71 | +2. Ask for the compact MCP status listing and confirm that each intended server is present. Kit reloads MCP files before `tool_search` and `auth`, so a restart is not required. |
| 72 | +3. Authenticate challenged remote servers through Kit. Recreate credentials rather than copying another harness's token cache. |
| 73 | +4. Search for one expected MCP capability and verify that the correct server is selected. |
| 74 | +5. Start a new Kit session when validating changed `AGENTS.md` files or skills, because startup establishes the project instruction context and skill catalog. |
| 75 | +6. If an external ACP harness was added, run its own installation or login check first, then ask Kit to start one narrow test subagent. |
| 76 | + |
| 77 | +See [Getting started and configuration](getting-started-and-configuration.md), [Configure and Use MCP Servers](mcp.md), [Reusable subagents and ACP harnesses](subagents-and-acp-harnesses.md), and [Security, limits, and troubleshooting](security-limits-and-troubleshooting.md) for the destination formats and runtime behavior. |
0 commit comments