Chapter 08
How each agent is written
Where each agent's prompt goes, which files its adapter touches, and what turning off and cleaning up put back.
Deploys and turn-offs are written by each agent’s open-source adapter; scoped cleanup snapshots, emptying instruction files and the one setting input rewrite changes are handled by Switch itself, see How it works. This is how the current versions behave (all six adapter versions are pinned to the app). Switch deploys user-level settings only and never writes into a project folder.
Claude Code · claude-keysmith 7.2
-
Prompt: written to
~/.claude/keysmith/and imported by a marked block in~/.claude/CLAUDE.md:<!-- claude-keysmith:start name=claude-project-rules --> @keysmith/claude-project-rules.md <!-- claude-keysmith:end name=claude-project-rules -->Everything outside the markers (your own rules) is left alone.
-
Turn off: removes only that block and Keysmith’s prompt file.
-
Clean up: defaults to turning off Keysmith’s deployment only. Optionally empties
CLAUDE.md(with an extra confirmation box), movesrules/agents/commands/hooks/skills/output-stylesor session history (.claude/projects,.claude/sessions,history.jsonl) into a recoverable local version; only deletes plugins, caches, keychain logins and sanitizessettings.json/.claude.jsonwhen you explicitly tick the irreversible logins & caches section. -
The adapter never touches: the Claude Code program, network settings, credentials, MCP configuration or running processes.
-
Input rewrite: changes only
env.ANTHROPIC_BASE_URLinsettings.json; Bedrock and Vertex aren’t supported.
Codex · codex-keysmith 0.6.0
- Prompt: placed in
~/.codex/, withmodel_instructions_filewritten toconfig.toml.config.tomlis backed up first. - Hooks: a
hooks.jsonthat could interfere with loading the instructions is set aside, with a timestamped backup. - Turn off: removes the managed line and the prompt file, and restores the hooks.
- Clean up: defaults to turning off Keysmith’s deployment only. Optionally empties
~/.codex/AGENTS.md(with confirmation), moves thememoriesfolder, custom setup (including harness-pack skills in shared~/.agents/skills), or session folders andstate_5.sqlitedatabases (with-wal/-shmsidecars as complete groups) into a local version.config.tomlalways stays. - Input rewrite: adds
[model_providers.keysmith-relay], a copy of your provider with onlybase_urlchanged; needs a custom provider (wire_api = "responses").
Grok Build · grok-keysmith 0.8.0
- Prompt: written to
~/.grok/rules/99-keysmith.md. These home rules are read by every Grok session, independent ofAGENTS.mdand any persona card. - Compat layers & user area: a block marked
# === grok-keysmith compat isolation begin/end ===inconfig.tomlturns off the Claude / Cursor compatibility layers and sets~/.grok/hooks/*.jsonaside. Settings you add after deploying (such as fallback models with API keys) can live in the user area without triggering drift and stay when turning off. - Turn off: removes only the file and block it wrote; if the pre-deploy config backup is gone, choose “Keep current config and turn off”.
- Clean up: defaults to turning off Keysmith’s deployment only. Optionally moves
rules/agents/skills/commands, memory folders or sessions &worktrees.db(with sidecars) into a local version. Grok’s own program binaries and your projects are never touched. - Input rewrite’s region: the part between
# === keysmith-switch input rewrite ===markers belongs to Switch. The adapter never writes inside it and keeps it through deploys, turn-offs, tidying and recovery. Grok must have run once and fetched its model list.
ZCode · zcode-keysmith 0.3.5
- Prompt: written to
~/.zcode-keysmith/system-role.mdand applied as a true system role, ahead of ZCode’s own system prompt. - Newer ZCode (3.12–4.0+): on both macOS and Windows, backs up ZCode’s
zcode.cjsfirst, then patches the runtime anchor for your build so it reads the managed file first, and restores the original on turn-off without overridingZCODE_AGENT_SERVER_COMMAND. - Older ZCode: still uses a wrapper and environment variables (LaunchAgent on macOS, user env vars on Windows); previous values are recorded and put back on turn-off.
- Clean up: defaults to turning off Keysmith’s deployment only. If the ZCode runtime still carries the patch marker or cannot be verified restored,
~/.zcode-keysmith/backupsis protected from deletion. Projects in~/.zcode/workspaceare never touched. - No recovery: the ZCode adapter has no interrupted-run recovery.
- Input rewrite: changes
baseUrlof each personal provider in~/.zcode/v2/provider_config.json; Coding Plan sign-in isn’t supported.
pi · pi-keysmith 0.2.0
- Prompt: written to global
~/.pi/agent/SYSTEM.md, backed up first and restored on turn-off. - Boundaries & clean up:
~/.pi/agentis never created if absent;APPEND_SYSTEM.md,AGENTS.md, settings and sessions stay untouched. Clean up only turns off Keysmith’s deployment. - Input rewrite: not supported yet.
DSH · dsh-keysmith 0.4.1
- Prompt: installs a managed Cordis plugin into DSH’s profile directory—targeting
profiles/desktoponce DSH Desktop exists, otherwiseprofiles/web. If an earlier deploy lives inprofiles/web, the hero prompts you to redeploy intoprofiles/desktopin one click. - Boundaries & clean up:
~/.dshis never created if absent;AGENTS.md,settings.yaml,.credentials.yaml, sessions and storage stay untouched. Clean up only turns off Keysmith’s deployment. - Input rewrite: not supported yet.
Adapter source
All six adapters are MIT-licensed and also work on their own from the command line: