# mode Session-local Pi modes from Markdown files. ## Install / load Loaded through the root pi-ext package. See [../../README.md](../../README.md). ## Commands / tools / settings Commands: - `/mode` — show active mode and available modes. - `/mode status` — same as `/mode`. - `/mode list` — list available modes. - `/mode ` — switch to a mode. - `/mode off` — turn mode off (notifies `no mode active` if no mode is active). - `/mode normal` — alias for `/mode off`. - `/mode none` — alias for `/mode off`. - `/mode reload-config` — reload mode files and report count/warnings. Tools: none. Settings: none. ## Mode files Modes load from: ```text ~/.pi/agent/modes/*.md ``` Mode id is the file stem. Valid ids match `^[a-zA-Z0-9_-]+$`. Example: ```md --- description: Read-only planning accent: warning model: openai/gpt-5.2-codex thinking: high tools: [read, grep, find, ls] reminder: You are planning only. Do not implement. --- # Planning mode Plan only. Do not implement. ``` Frontmatter fields: | Field | Type | Effect | | ------------- | --------------------------------------------- | ------------------------------------------------------------ | | `description` | string | Shown by `/mode`, no runtime effect | | `accent` | theme color | Banner color when mode is active | | `model` | `provider/model-id` | Switched via `pi.setModel` on enter | | `thinking` | `off`/`minimal`/`low`/`medium`/`high`/`xhigh` | Switched via `pi.setThinkingLevel` | | `tools` | string array | Applied via `pi.setActiveTools` (unknown names warned) | | `reminder` | string | Wrapped in `` and injected into system prompt | `accent` must be one of: `accent`, `borderAccent`, `success`, `warning`, `error`, `muted`, `dim`. ## Behavior Active mode: - Replaces the built-in header with a themed banner above the chat. - Appends its Markdown body and a generated `` to the system prompt for each agent turn. - May switch tools, model, and thinking level on enter. `/mode off`: - Clears the custom header (built-in returns). - Removes mode body from the system prompt. - A `` with `active_mode: normal` stays injected while `neutralize = true`. - Tools, model, and thinking are **not** restored. Mode state is **in-memory only**. Each session starts clean — re-run `/mode ` after `session_start`. ## SDK limitation `pi.setModel` and `pi.setThinkingLevel` write to the user's global default settings. Declaring `model:` or `thinking:` in a mode mutates user defaults for the duration the mode is applied. Use `/model` and `/thinking` to revert after `/mode off`. ## V1 limits - Project-local `.pi/modes/*.md` deferred until Pi exposes a public project-trust API. - Cross-session mode persistence not implemented. - Tools/model/thinking not restored on `/mode off`. - Shortcuts, extension scoping, permission policy, tool globs not in V1.