# Commands and interfaces
[Feature docs index](README.md) ยท [Repository README](../../README.md)
## Purpose
Use Mission Control for terminal conversations or the application service for other frontends. The only shipped binary is `magi-code`; for a shorter command, define `alias mc='magi-code'`.
## Details
### Choose an interface
```sh
magi-code # open Mission Control
magi-code --no-session # Mission Control without session persistence
magi-code --continue # continue the most recent session, or create one if none exists
magi-code --resume <SESSION_ID> # resume a specific session
magi-code --provider local-provider # override provider
magi-code --model gpt-5.5 # override model
magi-code --api-key <KEY> # process-local API-key override where supported; ignored for openai-codex and anthropic
magi-code --version # print the installed magi-code version and exit
magi-code --update # update this Cargo installation without starting a session
magi-code --theme <THEME> # appearance theme for this run
magi-code --prompt "Prompt" # Mission Control with an initial prompt
magi-code --app service # app-service JSONL protocol over stdin/stdout
```
Mission Control requires TTY stdin/stdout. `--prompt` supplies its initial prompt and rejects whitespace-only text. For non-interactive clients, use the JSONL application service, not a plain-text prompt pipe. `--tui`, `--print`, positional prompts, and `--color` are no longer accepted.
`--app service` writes only versioned protocol JSONL to stdout; startup and I/O diagnostics go to stderr. It supports `initialize`, `status`, `capabilities`, `turn.start`, `turn.cancel`, `auth.status`, `auth.login.start`, `auth.login.callback`, `auth.login.cancel`, and `auth.logout`. Turns use the full agent runtime and can create or attach sessions; authentication uses the protected shared store without exposing credentials. See [Application service](application-service.md) for protocol details and limits.
`--resume` rejects invalid IDs as usage errors (exit 2). Missing, unreadable, unsafe, or bounded-read sessions fail before provider execution (exit 1), without exposing paths or persisted content. `--continue` resumes the latest eligible session or creates one if none exists. Neither attachment flag can be combined with `--no-session`.
### Mission Control startup queue
During startup, you can edit immediately and queue one prompt. The editor clears for a separate draft; a second submission is rejected. `Alt-C` cancels the queue without losing the draft. `/help` and `/quit` work immediately; other slash commands are blocked until readiness. An untouched `--prompt` uses the same queue and runs once after readiness and the input fence.
Execution waits for settings/policy, the selected primary agent, enabled subagent profiles, and every enabled MCP server. Display metadata does not block it. Critical startup failure restores the terminal, exits nonzero, and never runs the queue. See [startup and readiness](mission-control-tui.md#startup-and-readiness) and [cleanup limits](mission-control-tui.md#exit-and-cleanup-limits) for timing, strict MCP startup, and worker bounds.
### Add prompt context
```text
Review current changes. #git-status
Map repository layout first. #tree
```
Exact standalone `#tree` and `#git-status` expand after submission in Mission Control, before request construction and context-budget checks. They run bounded `tree` and `git status` commands in the active cwd through guarded bash. Missing commands and other failures become bounded context blocks rather than aborting the prompt. Unknown tags, `#40`, Markdown headings, and embedded forms such as `abc#tree` stay ordinary text.
### Color and exit codes
Color follows saved `interface.no_color`, then `NO_COLOR`, then terminal detection. Unicode and animation settings are separate from color. See [Runtime theming](runtime-theming.md).
Exit codes: `0` success/help, `1` runtime/provider/tool/general failure, `2` usage/config/launch-validation failure.
### Slash commands
| Command | Use |
| --- | --- |
| `/help` | Open Mission Control help, also available with `F1`. |
| `/update` | Update with Cargo while idle, then reopen this exact session; see [Installation and updates](installation-and-updates.md#update-with-cargo). |
| `/login` | Open Connect Provider. |
| `/login openai-codex` | Start Codex OAuth or select it in the TUI modal. |
| `/login custom-provider` | Configure a label, base URL, and optional API-key environment-variable name, never the key value. |
| `/logout` | Open the logout picker. |
| `/logout openai-codex` | Remove local Codex auth after confirmation. |
| `/logout anthropic` | Remove the local provider-keyed auth record after confirmation; cannot unset or override higher-priority `ANTHROPIC_API_KEY`. |
| `/logout <custom-provider-id>` | Remove local custom-provider metadata after confirmation. |
| `/new` | Create and switch to a new session. |
| `/compact [custom instructions]` | Summarize the active persisted session for future requests; retain raw history locally. |
| `/summarize-start`, `/summarize-stop` | Start or stop the active session's [Summary pane observer](session-summarizer.md); preserves existing entries. |
| `/fast [on|off|status]` | Toggle Fast with no argument, set it with `on`/`off`, or report without writing with `status`. |
| `/changes` | List sanitized file-tool snapshots by user turn, without file bytes or diffs. |
| `/rewind [--to <turn>] [--mode conversation\|files\|both] [--dry-run]` | Rewind before a selected prompt: conversation only (default), files only, or both. |
| `/export` | Write an unencrypted, private local session ZIP. It may contain sensitive data; do not assume it is safe to share. |
| `/prune-sessions [days]` | Delete sessions strictly older than 30 days by default, or the supplied positive integer. Active sessions stay. |
| `/setmodel <provider>/<model-name>` | Validate against a discovered/cached catalog, switch provider/model, and persist settings. |
| `/setmodel` | Open the model picker, also available with `Alt-M` while idle. |
| `/models` | Enable/disable models in Mission Control. |
| `/usage` | Show provider quota in Mission Control using `quota-axi --json`. |
| `/sessions` | Open the Mission Control session list and preview. |
| `/skills`, `/tools`, `/subagents` | Enable/disable discovered items in Mission Control. |
| `/mcp` | Toggle configured MCP servers; changes apply on the next launch, not `/new`. |
| `/system-prompt` | Inspect the computed system prompt in a read-only Mission Control modal. |
| `/theme` | Change appearance; see [Runtime theming](runtime-theming.md). |
| `/quit` | Exit. |
Slash commands belong to Mission Control; service clients use protocol requests. Unknown slash commands report an error and record a diagnostic when a session is active.
### Mission Control provider connection
`/login` opens the staged Connect Provider modal with current provider status. OAuth stays in the modal; API-key providers show environment setup guidance rather than collecting keys. See [Provider connection](mission-control-tui.md#provider-connection) for keys, cancellation, and replacement confirmation.
### Fast mode behavior
`/fast` writes the non-secret global `agent.fast.enabled` setting; invalid arguments print `usage: /fast [on|off|status]`. A run keeps its starting settings snapshot. In Mission Control, writes are idle-only and run off the UI loop; memory changes only after disk success. While a write is pending, another mutation, prompt, or compaction is blocked and input restored. Status, invalid usage, help, and quit remain available during active work.
Accepted writes settle during cleanup, with no fixed total wait if filesystem work stalls after lock acquisition. Later work uses the updated snapshot after a successful write. See [Configuration](configuration.md) for eligibility and [Fast mode](mission-control-tui.md#fast-mode) for display states and failure handling.
### Maintain sessions and restore files
`/compact`, `/export`, `/changes`, `/rewind`, and `/prune-sessions` are local maintenance commands, not chat prompts. Only compaction calls a provider; changes and rewind need no provider auth. Mission Control rejects compaction, export, rewind execution, and pruning during active work.
`/rewind` opens a prompt picker, including prompts with no file changes. `Up`/`Down` selects a prompt; `Tab` cycles **conversation only**, **files only**, and **both**. `Enter` confirms; `Esc` cancels. The picker shows the latest 100 retained prompts; `/rewind --to <turn>` can select an earlier retained prompt. Use `--mode conversation|files|both` to preselect a mode. `--dry-run` never mutates.
- **Conversation only** (default): creates and switches to a new session containing history strictly before the selected prompt. That prompt returns to the editor, unsent. The next provider request uses the new history; files stay unchanged.
- **Files only**: restores captured changes from the selected prompt onward; the current conversation and session remain active.
- **Both**: creates the conversation fork first, then restores files. File conflicts can make restoration partial; the result appears in the new transcript.
The original conversation remains available in the session picker until pruned. Selecting it restores its conversation, not its files. Rewind is not a whole-worktree backup: file restoration covers captured `write`/`hash_edit` changes, not bash or external edits. Prompts removed from active JSONL by compaction are not selectable; retained prompts keep their turn numbers and earlier compaction summaries.
Restore verifies hashes to avoid overwriting later user edits. Secret/denied paths, files over the 1 MiB snapshot limit, missing blobs, and hash conflicts are skipped and reported. Created files are removed directly using containment-safe filesystem operations, not OS trash. Their post-images remain recovery evidence while checkpoint references exist; pruning or storage failure can make snapshots unavailable. A final directory-sync failure after mutation reports a committed-but-undurable warning. Output never includes file bytes, diffs, blob hashes, denied paths, or secret-looking paths.
For retention, export contents, compaction, and permission repair, see [Sessions, context, and cache](sessions-context-cache.md). Deleted sessions cannot be resumed; pruning continues after individual failures and reports deleted, skipped, and failed counts with bounded error categories.
### Use Mission Control settings modals
`/skills`, `/tools`, `/subagents`, and `/models` use keyboard-only checkbox lists. `Tab` selects Global (`$MC_HOME/settings.json`, default `~/.magi-code/settings.json`) or Project (exact cwd `.magi-code/settings.json`, no parent search). `Enter` writes only that scope, creating project settings on first change; `Esc` closes. Project disabled lists replace global lists, so an empty project list can re-enable globally disabled items.
`/models` stores canonical `provider/model` IDs in `providers.catalog.disabled`. Disabled models stay visible as `[disabled]` but cannot be selected with `/setmodel`. Disabling the active model does not switch it. CLI `--model` is an explicit override.
`/mcp` lists each configured server's name, stdio/http type, and enabled checkbox. `Up`/`Down` selects, `Enter` saves `capabilities.mcp.<name>.enabled`, and `Esc` closes. It does not reconnect live managers.
`/usage` runs `quota-axi --json` off the UI thread and reads schema v2. It shows percentage-remaining gauges and omits providers without displayable windows. If missing, it shows `npm install -g quota-axi`. `Esc`/`q` closes; arrows, `PgUp`/`PgDn`, `Home`, and `End` scroll. Session-switcher controls are in the [TUI guide](mission-control-tui.md#switch-or-export-a-session).
### Available tools
Built-ins include `read`, `write`, `hash_edit`, `grep`, `find`, `list_files`, `bash`/`shell`, `view_image`, `subagents`, `web`, and `ast_grep`. `web` provides search/open/find for public research. `ffgrep` and `fffind` are dispatch aliases; `parallel_subagents` is only a legacy settings-key alias, not a callable tool.
Optional LSP diagnostics accompany successful edits. See [Tools and safety](tools-and-safety.md) and [LSP diagnostics](lsp-diagnostics.md).