Skip to content
Powered by BridgeApp

Environment & paths

A reference for the environment and file paths Magic Coder uses. For the conceptual breakdown of where things live, see Configuration overview.

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.

VariableUsed byPurpose
MAGIC_CODER_OAUTH_TOKENthe running coder binaryOpaque 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_MESSAGESthe running coder binaryHard cap on the number of transcript messages kept in memory (default 1000). Tune up or down for very long sessions.

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.
~/.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 files
<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)
OSPrimary storeFallback file
macOSKeychain — service magic-coder-credentials, account = your macOS username
LinuxSecret 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.

When you pass --server-url <host> (default deployment otherwise), Magic Coder derives:

URLPattern
WebSocketwss://ws.coder.<host>
OIDC issuerhttps://auth.<host>
API basehttps://api.<host>

You don’t usually need to know these — pass --server-url once and Magic Coder figures out the rest.

To completely reset Magic Coder on a machine:

Terminal window
# 1. Sign out from inside the TUI (clears the saved credential)
/logout
/exit
# 2. Remove user state
rm -rf ~/.magic

Per-project .magic/ directories inside your repos are not touched.