Environment & paths
A reference for the environment and file paths Magic Coder uses. For the conceptual breakdown of where things live, see Configuration overview.
Environment variables
Section titled “Environment variables”Magic Coder is flag-driven for runtime arguments — there are no CODER_* or MAGIC_CODER_* variables you set to change CLI behavior. The few environment variables Magic Coder cares about are limited to install-time and a single internal cap.
Runtime
Section titled “Runtime”| Variable | Used by | Purpose |
|---|---|---|
MAGIC_CODER_OAUTH_TOKEN | the running coder binary | Opaque OAuth access-token override. Bypasses both the file and the OS keychain; not refreshed by the CLI. Useful for CI and other headless flows. |
CODER_MAX_CHAT_MESSAGES | the running coder binary | Hard cap on the number of transcript messages kept in memory (default 1000). Tune up or down for very long sessions. |
What’s not an env var
Section titled “What’s not an env var”These are configured by flags or files, not env vars:
- Working directory, workspace roots, server URL, OIDC client ID — all flags.
- Default model, reasoning effort, theme, long-context preference, sleep mode — all live in
~/.magic/config.toml. - Sign-in credentials — stored by Magic Coder in the OS keychain (or fallback file). See Sign in.
- Command permissions — managed through the approval prompt; see Command permissions.
Path map
Section titled “Path map”User-level (per machine, per user)
Section titled “User-level (per machine, per user)”~/.magic/config.toml User config (machine ID, generation defaults, UI prefs)~/.magic/known.toml Workspace registry (paths and trust state)~/.magic/known/<key>/history.jsonl Per-workspace input history~/.magic/skills/<name>/SKILL.md User-level skills (loaded on every session)~/.magic/rules/<category>/<name>.md User-level Markdown rules (loaded on every session)~/.magic/cache/ Internal cache (incl. background shells)~/.magic/locks/ Lock filesPer-project (in your repo)
Section titled “Per-project (in your repo)”<workspace>/.magic/skills/<name>/SKILL.md Project-local skills (loaded only when trusted)<workspace>/.magic/rules/<category>/<name>.md Project-local Markdown rules (loaded only when trusted)<workspace>/AGENTS.md Root project context<workspace>/<subdir>/AGENTS.md Per-package project context (loaded on demand)OS-managed
Section titled “OS-managed”| OS | Primary store | Fallback file |
|---|---|---|
| macOS | Keychain — service magic-coder-credentials, account = your macOS username | — |
| Linux | Secret Service / GNOME Keyring | ~/.config/magic-coder/credentials.json |
| Windows | — | %APPDATA%\magic-coder\credentials.json |
The lookup order at startup is MAGIC_CODER_OAUTH_TOKEN → fallback file → OS keychain. You don’t edit these directly; /logout clears the active store.
Derived URLs
Section titled “Derived URLs”When you pass --server-url <host> (default deployment otherwise), Magic Coder derives:
| URL | Pattern |
|---|---|
| WebSocket | wss://ws.coder.<host> |
| OIDC issuer | https://auth.<host> |
| API base | https://api.<host> |
You don’t usually need to know these — pass --server-url once and Magic Coder figures out the rest.
Reset checklist
Section titled “Reset checklist”To completely reset Magic Coder on a machine:
# 1. Sign out from inside the TUI (clears the saved credential)/logout/exit
# 2. Remove user staterm -rf ~/.magicPer-project .magic/ directories inside your repos are not touched.