返回 CodeWhale
MODES.md
根目录 / docs / MODES.md
1 # Modes and Permission Postures
2
3 > 阅读简体中文版:[zh_hans/MODES.md](zh_hans/MODES.md)
4
5 Codewhale has three related concepts:
6
7 - **TUI mode**: what kind of visible interaction you're in (Plan/Work).
8 - **Permission posture**: how aggressively the UI asks before executing tools.
9 - **Workflow**: named steps that coordinate sub-agents, with dependencies and
10 results, available in any TUI mode.
11
12 Model selection is separate. `--model auto` and `/model auto` route each turn to
13 a concrete model and thinking level; they are not TUI modes and are not on the
14 permission dial.
15
16 Workflow runs named steps through the same sub-agent runtime; Fleet manages
17 their saved roles and model assignments. A workflow adds ordering, result
18 handoffs, gates and a progress view. The active mode and permission posture
19 still control what each step may execute.
20
21 Before assigning steps, query `agent(action="roster")` for the saved Fleet
22 models and roles. A plan child can select a listed model with `model`, or use
23 the saved `role`/`profile` assignment. An Exact Fleet fixes each member's route.
24
25 Plan omits command execution tools from interactive request definitions, available tool-search results and `execute_tools` discovery. Calls carried in history remain subject to the execution permission check.
26
27 ## TUI Modes
28
29 One dial says how much Codewhale may do without asking. Press `Shift+Tab` to
30 step it: **Ask → Accept Edits → Plan → Auto-Review → Full Access → Ask**. Plan
31 is the Plan mode; every other stop is Work with that permission posture. The
32 footer shows the current stop and `Shift+Tab to change`; after you have pressed
33 it twice the hint stands down, except on Auto-Review and Full Access, where it
34 stays while the footer has room. New installs start on
35 Accept Edits when no permission posture is saved. An explicit saved choice,
36 including Ask from an earlier version, stays in control.
37 `Tab` only completes composer menus, commands, file mentions and suggestions;
38 it never changes the mode, and never sends or queues composer text (use
39 `Enter`).
40 Every change of effective permission writes a `Permissions changed to …` line
41 in the transcript.
42 Press `Ctrl+T` to cycle reasoning effort.
43 Run `/mode` to open the mode picker, or switch directly with `/mode work` or
44 `/mode plan`. `operate` and its spellings still parse, as Work, and say that
45 Operate was retired, so an older setting or script never errors.
46
47 ### Conversation modes
48
49 The `/mode` picker has two groups. **Permissions** holds Work and Plan, on `1`
50 and `2`. **Conversation mode** lists the modes the Engine offers, Standard and
51 Creator mode, each with a one-line description; a mode that cannot be used yet
52 is listed, disabled, with its reason. Conversation modes have no number keys.
53
54 A conversation's mode is chosen before its first message and is fixed after
55 it. A mode never changes a permission: Creator mode in Plan is still Plan.
56 How to start a Creator mode conversation, what it loads and how its plugin
57 changes are approved are in [Creator mode](CREATOR_MODE.md).
58
59 ### Plan and Work
60
61 - **Plan**: design-first prompting. The stable primitive names remain familiar, but the runtime centrally refuses file mutation and shell execution. Read-only inspection and policy-allowed research, including deferred Web search/fetch, remain available. When a Plan turn successfully finishes a nonempty response, including a prose-only plan, the TUI asks how to continue: Work (Ask), Work (Accept Edits), Work (Auto-Review), or keep planning. Work sends the exact approved response as a normal follow-up and preserves that turn's existing To-dos, or adds one pending plan item without replacing unrelated work.
62 - **Work** (internally `agent`): ordinary multi-step execution. The first-turn toolbox includes `read`, `write`, `edit`, `file_search`, `grep_files`, `bash`, `agent`, `todo_write`, `present`, and `load_skill`, plus `create_goal`, `get_goal`, `update_goal`, and `task_shell_wait` so goal and background-shell controls are available without discovery. Permission rules in `permissions.toml` must use the canonical tool names `read_file`, `write_file`, and `edit_file`; a rule written with `write` or `edit` matches nothing today. The agent calls `create_goal` when a request is a durable objective; the host never infers a goal from wording, and the contract must not tell the model otherwise. Approval, sandbox, repository law, and managed policy decide what may execute.
63 - **Operate is retired.** It was Work with an orchestration contract, and that contract now lives in every session's constitution: make a goal of a durable request, keep the plan visible, fan independent work out to parallel sub-agents, and have an independent reviewer try to refute a non-trivial change. A saved `default_mode = "operate"` loads as Work and says so once; a Runtime API request with `mode: "operate"` runs as `agent` with the default posture (Accept Edits) and logs one notice per process, never an error. Agents forked from an older Operate conversation do not inherit its contract. Multi-agent work stays on `agent`, `workflow` and `/fleet` in every mode.
64
65 `Act` and `/mode act` remain compatibility aliases for Work. Saved settings
66 still normalize to the internal value `agent`.
67
68 ### Tool availability by mode
69
70 | Tool family | Plan | Work |
71 |:---|:---:|:---:|
72 | `read` and policy-allowed deferred research tools | yes | yes |
73 | `write` and `edit` | visible names; execution denied | approval- and policy-gated |
74 | `bash` | hidden from the tool definitions. Execution denied. | approval- and policy-gated; delegation is preferred when parallelism or isolation helps |
75 | `agent` | yes, subject to child-depth authority | yes, subject to child-depth authority |
76 | Deferred native, MCP, and plugin tools | discoverable inside `execute_tools` (or through `tool_search` with `code_mode = false`) when policy permits | same |
77 | Paid or external-service tools | follows permission posture | follows permission posture |
78 | Access outside the workspace root | file tools: explicit trusted paths only (shell is denied in Plan) | file tools: only through trusted paths or trust mode (fleet profiles never widen it); an allowed shell command can read outside the workspace because the shell sandbox mounts the filesystem read-only |
79
80 Mode changes scheduling emphasis, not authority. No mode adds a specific tool
81 denial or bypasses the active approval, sandbox, shell, ask-rule,
82 repository-law, or managed-policy boundary. Plan remains the mode-specific
83 execution boundary for shell and write-capable tools; that authority difference
84 does not require a different primitive vocabulary.
85
86 ### Orchestration loop (one screen)
87
88 ```text
89 User message
90 → small / chat / one-file? → parent does it (Work-equivalent tools)
91 → multi-step work? → goal → named steps + dependencies + completion checks
92 → Workflow phases → independent sub-agents in parallel
93 → collect results → check evidence → hand off to the next phase
94 → missing required result? → stop dependent work and repair the step
95 → one independent task? → one direct sub-agent
96 → parent integrates results and reports completed, blocked and next steps
97 ```
98
99 Lifecycle claims stay exact: dispatched ≠ settled ≠ verified.
100
101 `allow_shell` controls whether `bash` can execute; it does not rename the tool
102 or make mode the approval authority. Durable tasks and automation keep
103 conservative omitted-field defaults and receive shell authority only when their
104 settings explicitly grant it. Stateful terminal/background controls are
105 specialized deferred tools rather than fields on the small foreground `bash`
106 schema. Full Access changes the permission posture: the deterministic
107 Auto-Review floor applies in the reviewing postures and is skipped under Full
108 Access, while repository-law holds remain authoritative for the covered file
109 write tools (`write_file`, `edit_file`, `apply_patch`, and `fim_edit`). Repo
110 law does not apply to shell commands or MCP tools.
111
112 Action-capable modes reach the deferred `rlm` family by calling it, through
113 `tools.load`, or through `tool_search` where it is offered; its `open`, `eval`,
114 `configure`, and `close` actions own persistent
115 RLM sessions. The legacy split `rlm_*` spellings remain replay-only aliases.
116 Inside an RLM Python REPL, `sub_query_batch` fans out 1-16 cheap parallel child
117 calls pinned to `deepseek-v4-flash`.
118
119 The fast `deepseek-v4-flash` / thinking-off path is called Fin in the product
120 language. Fin is a seam for routing, summaries, cheap child calls, and
121 coordination work; it does not change approval behavior.
122
123 The orchestration controls remain available without taking over the starting
124 screen: `/auto` turns on Auto-Review so the agent just works, `/goal` keeps one
125 objective across turns, and `/workflow` prepares a repeatable ordered or
126 fan-out workflow. They are directly callable and searchable through the full
127 command palette, but are not pinned to the starter slash menu, idle welcome,
128 footer, or default Hotbar. A bare `/` instead opens the small task-oriented
129 starter set; use `/help` or the command palette for the complete inventory.
130
131 `/goal <objective>` sets a session objective with an optional token budget and
132 keeps active objectives visible as Work context. The agent may also create the
133 goal itself when a direct request describes a verifiable end state that will
134 take more than one turn ("until the tests pass", "make X work end to end"); it
135 then shows one receipt line and you can `/goal pause` or `/goal clear` it. Bare
136 `/goal` shows progress (state, elapsed, continuations, and how to continue when
137 no turn is running); with no goal and no conversation yet it prints usage.
138 `/goal pause` stops goal continuation without changing the objective, `/goal
139 resume` resumes and sends the objective back into the turn, `/goal complete`
140 marks it done, `/goal blocked` marks it blocked, and `/goal clear` removes it. Goal state does not change the active TUI mode,
141 permission posture, or model route. This remains distinct from `--model auto`, which
142 only controls model and thinking selection.
143
144 Workflow builds on the same separation: a goal can ask the agent to keep
145 working, while Workflow supplies the repeatable workflow/progress surface for
146 large fanout. In the UI, a Workflow run should be shown as an overlay on the
147 main screen, not as another mode beside Plan and Work.
148
149 App-server clients can read an existing thread-scoped goal with `thread/goal/get`
150 and clear it with `thread/goal/clear`. Clients should not call `thread/goal/set`:
151 it is omitted from capability discovery while `goal_execution` is `false` and is
152 refused with a typed `interactive_execution_unsupported` error before changing
153 the goal; starting goals uses the full Runtime HTTP API (`docs/RUNTIME_API.md`).
154 That persisted record carries `active`, `paused`, `blocked`, `usage_limited`,
155 `budget_limited`, or `complete` status plus token/time accounting fields for
156 clients that need thread resume semantics.
157
158 ## Mode Persistence
159
160 Choosing a mode interactively also sets the mode a fresh session starts in.
161 The `Shift+Tab` dial, the `Alt+A` / `Alt+P` shortcuts, the hotbar's
162 Plan/Work actions, and `/mode` all write `default_mode` to
163 `~/.codewhale/settings.toml`, so switching to Plan survives a restart. The
164 write happens off the event loop; if it fails, the TUI says so in a warning
165 toast rather than reverting silently on the next launch.
166
167 Mode, thinking level, and the model picker share one serialized writer, so the
168 selection you made last is the one on disk — a burst of Shift+Tab presses cannot end
169 up persisting whichever write happened to finish last — and a mode write never
170 rolls back an unrelated key such as `default_model`.
171
172 Restoring a saved session deliberately does **not** rewrite the startup
173 default: it re-installs the mode that session was in. The legacy `yolo` entry point installs Work
174 plus Full Access, and `agent` is what it persists — `yolo` is a permission
175 alias, never a startup mode.
176
177 Re-selecting the mode you are already in is not a no-op. After a restored
178 session the live mode and `default_mode` routinely disagree, so choosing the
179 live mode again is how you make it durable; Codewhale confirms with a
180 "saved as startup default" receipt rather than reporting "already in that mode".
181
182 Mode and permissions can change while a turn is running, from any surface
183 (Shift+Tab, `/mode`, the hotbar, `/config mode …`), including stepping the dial
184 into or out of Plan. The change does not
185 restart a response that is already streaming. The engine applies it at its next
186 step in the same turn: before the next tool batch, at every approval gate, and
187 before the next model request, which carries a new mode notice. A call that was
188 still waiting for approval, or that no approval covers, goes back to the model
189 to retry under the new posture; a call you already approved runs only if the
190 new posture is equal or broader. The status line says the change is pending
191 until that step, and the engine reports `Permissions: … · <mode>` once it
192 applies.
193
194 Model, thinking level, and provider are still refused while a turn runs, on
195 every surface (`/model`, `/provider`, `/config <key> <value>`,
196 `/config preset`): they change the route the running request is on. Press Esc
197 to interrupt first.
198
199 Codewhale writes `settings.toml` under a lock that spans processes, and replaces
200 the file atomically, so a second Codewhale instance on the same home directory
201 cannot lose your selection or read a half-written file. At exit, queued writes
202 are flushed before the terminal is restored; anything that failed is printed on
203 the way out instead of disappearing with the alternate screen.
204
205 ## Compatibility Notes
206
207 - Older settings files with `default_mode = "normal"` still load as `agent`; saving rewrites the normalized value.
208
209 ## Escape Key Behavior
210
211 `Esc` is a cancel stack, not a mode switch.
212
213 - Close slash menus or transient UI first.
214 - Cancel the active request if a turn is running.
215 - Discard a queued draft if the composer is empty.
216 - Clear the current input if text is present.
217 - Otherwise it is a no-op.
218
219 ## Permission Posture
220
221 Permission posture controls tool approval and whether a turn may pause for a
222 missing user decision. It is one layer of the full
223 [authorization order](AUTHORIZATION_ORDER.md), not a bypass for tool admission,
224 repository law, or [sandbox](SANDBOX.md) enforcement. Step it with the
225 `Shift+Tab` dial, or edit it at runtime:
226
227 ```text
228 /config
229 # edit the permission_posture row to: ask | accept-edits | auto-review | full-access
230 ```
231
232 Legacy note: `/set approval_mode ...` was retired in favor of `/config`.
233
234 - `ask` (**Ask**; internally `suggest`): tool approvals may interrupt,
235 and Codewhale asks when an unresolved user choice materially changes
236 authority, cost, scope, or outcome. Every file edit and every command asks,
237 including edits inside the workspace.
238 - `accept-edits` (**Accept Edits**, default; wire `accept_edits`): Ask, except that a
239 file edit whose every target stays inside the workspace's git work tree runs
240 without a card. Edits to `.git` internals, `.codewhale`, `.env*`, credential
241 and key files always ask, and so does every edit in a folder without git
242 (the card says the folder has no repository). Commands, network, MCP actions
243 and anything outside the folder ask exactly as in Ask; ask rules, hooks
244 (which gate the root agent's calls only), repository law (only for
245 `write_file`, `edit_file`, `apply_patch` and `fim_edit`) and the safety floor
246 still force a card. This is Claude
247 Code's `acceptEdits`. ACP sessions run it as Ask, because ACP turns never
248 apply the in-folder edit rule.
249 - `auto` (**Auto-Review**): Codewhale reviews each tool call instead of
250 asking. A deterministic floor allows proven-safe calls and blocks publishing
251 and destructive unattended work; anything it cannot prove safe goes to a
252 one-shot model reviewer that fails closed. Every block names its rule and
253 reason, and repeated blocks switch an attended session to Ask. The rules,
254 what the reviewer sees, retries, unattended runs and the design references
255 are in [Auto-Review](AUTO_REVIEW.md).
256 - `bypass` (**Full Access**): ordinary tool calls do not show approval prompts,
257 while deliberate user questions remain available. The deterministic
258 Auto-Review floor is skipped — publish-like commands, destructive
259 background/headless work, and the Windows npm-launcher platform hold do not
260 strand a call the person already granted. Non-bypassable registered holds
261 auto-approve instead of opening a contradictory modal. Repository-law holds
262 (which cover `write_file`, `edit_file`, `apply_patch`, and `fim_edit`, not
263 shell commands or MCP tools) and managed-policy holds fail closed as hard
264 blocks instead of contradicting Full Access with an approval modal.
265 - `never`: blocks any tool that is not considered safe/read-only unless a
266 matching typed `allow` rule in `permissions.toml` clears ordinary approval
267 (including allow rules saved from the approval card's "Always allow this exact
268 rule"). A matching `deny` rule and a `tool_call_before` hook `ask` still
269 block; deliberate user questions remain available.
270
271 The effective posture and its question discipline are projected into every
272 turn from the same runtime authority that gates tools. A mode/posture change is
273 therefore visible to the next turn. Untrusted runtime-generated input is
274 narrowed before metadata is built and cannot invent approval authority. An
275 explicit Full Access sub-agent handoff preserves the parent's standing posture
276 so ordinary child work does not begin prompting again.
277
278 ### Answering an approval
279
280 When a call needs your say, the terminal shows a one-line approval bar: what
281 will run, then `Details [d]`, `Allow [Enter]`, `[▾ m]` and `Deny [n]`.
282
283 - `Enter` commits the highlighted control, which is the one tagged `[Enter]`.
284 A new bar highlights **Allow**, so `Enter` allows the one action shown,
285 once. `y` allows once wherever the highlight is.
286 - `n` denies the action and the turn carries on. `Esc` refuses it too and
287 stops the turn; on a sub-agent's card `Esc` only hides the card and the
288 request stays pending.
289 - The arrow keys move the highlight between Allow and Deny.
290 - `d` or `Tab` opens the details. `m` opens the scope menu, whose rows keep
291 their numbers: `[1] Allow once`, `[2] Allow in this conversation` and, where
292 it is offered, `[3] Always allow in this repo`.
293 - An `Enter` that would allow is ignored for the first three quarters of a
294 second the bar is the prompt in front of you (again each time it comes back
295 to the front after another prompt covered it), and straight after another
296 `Enter` or typed characters. An `Enter` already in flight, held or pasted
297 therefore does not approve, and a notice says the key was ignored and why;
298 press `Enter` again to allow. Denying is never delayed, and the letter keys
299 (`y`, `a`, `1`) answer at once.
300 - To make `Enter` deny instead, set `[approval] default_selection = "deny"`
301 (see [Configuration](CONFIGURATION.md)).
302
303 The sandbox elevation prompt is a separate card. It still starts on the
304 option that skips the call, and takes no letter shortcuts.
305
306 ### Children (sub-agents and fleet workers)
307
308 Children inherit the session posture faithfully rather than a bare
309 auto-approve bit:
310
311 - **Auto-Review**: a worker's held call goes through the same deterministic
312 floor and one-shot reviewer as the parent's. No prompt is ever opened for a
313 child, and its blocks are recorded in the parent's blocked-actions list. See
314 [Auto-Review](AUTO_REVIEW.md#sub-agents-and-fleet-workers).
315 - **Ask** and **Accept Edits**: a call the role may delegate runs. A held call is raised as an
316 approval prompt in the parent's UI (`agent:<id>:approval:<n>`) when the
317 host is an interactive TUI; the worker waits visibly (`waiting for user`)
318 and the person's answer is routed back to it, whether the parent turn is
319 idle or itself awaiting an approval. Hosts that cannot prompt deny with the
320 reason.
321 - **Full Access**: calls run, including destructive detached work — the
322 Auto-Review floor is skipped exactly as it is for the parent turn. The
323 execution envelope still applies and never widens.
324
325 Role posture and the execution envelope are checked before and after this
326 gate and never widen. Every decision a person did not make at a prompt is
327 written to the audit log and to the child's transcript as a one-line note
328 (`Auto-Review allowed 'bash' (low risk, model guardian) [reviewer: <model>]: …`), visible when
329 the worker is focused.
330
331 ## Small-Screen Status Behavior
332
333 When terminal height is constrained, the status area compacts first so header/chat/composer/footer remain visible:
334
335 - Loading and queued status rows are budgeted by available height.
336 - Queued previews collapse to compact summaries when full previews do not fit.
337 - `/queue` workflows remain available; compact status only affects rendering density.
338
339 ## Workspace Boundary and Trust Mode
340
341 By default, Codewhale's file tools (`read_file`, `write_file`, `edit_file`, `apply_patch`, and
342 file-search tools) are restricted to the `--workspace` directory. This boundary
343 does not confine shell reads or MCP servers: the OS shell sandbox mounts the
344 filesystem read-only (minus the read deny-list), so a shell command that is
345 allowed to run can read outside the workspace. In Auto-Review, the first shell
346 read whose path is named in the command and resolves outside the workspace asks
347 once per session (see `docs/AUTO_REVIEW.md`); a read that a script opens itself
348 is not detected. Shell writes follow the sandbox policy instead:
349 `read-only` blocks them, `workspace-write` allows the workspace, extra roots and
350 `/tmp`, and Full Access with no narrower `sandbox_mode`, `external-sandbox` or
351 a missing wrapper impose no limit. Enable trust mode to allow file
352 tools to access paths outside the workspace:
353
354 ```text
355 /trust on
356 ```
357
358 Bare `/trust` (like `/trust status`) only *reports* the current setting — it
359 does not enable anything. Use `/trust off` to restrict access again.
360
361 Full Access enables trust mode automatically.
362
363 ## MCP Behavior
364
365 MCP tools are exposed as `mcp_<server>_<tool>` and go through approval (skipped
366 in Full Access, except Computer Use consent, registration and script cards), exact-name rules in `permissions.toml` (with no `path`), and
367 `enabled_tools` / `disabled_tools` on the server. Read-only MCP helpers may
368 auto-run in Ask and Auto-Review when policy permits; MCP tools with possible
369 side effects require approval. Local stdio MCP servers run as ordinary child
370 processes with a scrubbed environment and no OS sandbox wrapper, and Codewhale
371 does not check MCP tool arguments against the workspace boundary, the read
372 deny-list, or repository law. In Full Access, explicit `deny` rules and
373 `disabled_tools` still block an MCP tool, while repository law does not apply
374 to MCP tools.
375
376 A tool's own MCP annotations count only as far as their source is trusted. A
377 tool from a reviewed, enabled plugin that declares `readOnlyHint: true` runs
378 like the built-in read helpers, with no prompt; the same claim from any other
379 server is ignored. A tool that declares `destructiveHint: true` never gets
380 that relaxation, even from a reviewed plugin, and its approval card says the
381 server marked it destructive. Full Access still runs it without a prompt, like
382 any other tool that would ask.
383
384 See `MCP.md`.
385
386 ## Related CLI Flags
387
388 Run `codewhale --help` for the canonical list. Common flags:
389
390 - `-p, --prompt <TEXT>`: open the interactive session and submit this prompt as its first message; use `codewhale exec` for a non-interactive run
391 - `codewhale exec --auto --output-format stream-json <PROMPT>`: run the tool-backed non-interactive agent and emit one JSON object per line for harnesses and backend wrappers. Pass `--json-schema <JSON|@file>` (not with `--agent`) to validate the final reply fail-closed: text mode prints the validated JSON only, `--json` and `stream-json` `metadata` carry `structured_output`, and invalid JSON or schema violations exit `1` with `termination_reason: "unresolved"`. `--auto` enables Full Access by default (no Codewhale shell sandbox, trust mode on); add `--sandbox workspace-write` to keep the shell sandbox and file-tool workspace restrictions, with trust mode off. Any `--sandbox` other than `danger-full-access` (or the equivalent `sandbox_mode` in config) keeps trust mode off; `external-sandbox` relies on your own isolation. Exec runs that offer tools are saved in every output format. Exit codes: `0` on success and `1` on failure. With `--json`, every run prints one summary object, including a run that fails before the model is called: `success`, `status`, `termination_reason`, `stop_reason` (the engine's stop, `null` when none was observed), `usage` (`null` when the provider reported none), `usage_status` (`complete`, `partial` or `unreported`; `partial` when a request, a dropped settlement or a sub-agent has no usage receipt) and `agents` (each sub-agent's `id`, `model` and `usage`). The terminal stream `metadata` event carries `usage_status`, carries `stop_reason` when one was observed, and omits token counts the provider did not report; a run that fails before its turn starts emits an `error` event instead. Network and timeout errors do not authorize a supervisor to repeat the command: its request may already have run or its user message may already be saved. The terminal stream `metadata` event retains `error_category` for diagnosis; it is not an idempotency receipt.
392 - Put exec flags before the prompt. A prompt starting with `-` needs `--` first, for example `codewhale exec -- "- explain this option"`. A lone `-` is literal text. Known exec long flags (including `--flag=value`) after the prompt are rejected unless they follow an explicit `--`, which marks them as literal prompt text.
393 - `codewhale exec --prompt-file <PATH>` / `cat prompt.txt | codewhale exec --prompt-file -`: read the prompt from a file or stdin instead of argv, for prompts past the OS per-argument limit (~128 KiB on Linux). Conflicts with a positional prompt, and a positional `-` is literal prompt text; `--prompt-file -` is refused with `--parent-death-watch`, which owns stdin
394 - `codewhale exec --resume <ID|PREFIX> <PROMPT>` / `--session-id <ID|PREFIX>`: continue a saved session non-interactively
395 - `codewhale exec --continue <PROMPT>`: continue the most recent saved session for this workspace non-interactively
396 - `codewhale fork <ID|PREFIX>` / `codewhale fork --last`: copy a saved session into a new sibling session; forked sessions retain additive parent-session metadata and show that lineage in session listings
397 - `--model <MODEL>`: when using the `codewhale` facade, forward a DeepSeek model override to the TUI
398 - `--workspace <DIR>`: workspace root for file tools
399 - `-r, --resume <ID|PREFIX|latest>`: resume a saved session
400 - `-c, --continue`: resume the most recent session in this workspace
401 - `--max-subagents <N>`: clamp to `1..=128`
402 - `--permission-mode <ask|accept-edits|plan|auto-review|full-access>`: start in the named permission mode (works on `codewhale` and `codewhale exec`). `codewhale exec --auto` keeps meaning Full Access. When managed config sets `auto_review.disabled = true`, `Shift+Tab` skips Auto-Review, and `--permission-mode auto-review`, `/auto`, and `approval_policy = "auto"` are refused.
403 - `--full-access`: start with Full Access, no approval prompts and no Codewhale sandbox; the same as `yolo = true`. `serve --acp --full-access` and `--full-access serve --acp` are equivalent.
404 - `--mouse-capture` / `--no-mouse-capture`: opt in or out of internal mouse scrolling, transcript selection, right-click context actions, and transcript scrollbar dragging. Mouse capture is enabled by default on non-Windows terminals and on Windows Terminal/ConEmu/Cmder so drag selection copies only transcript text, removes visual wrap-column line breaks from paragraphs, and stays scoped to the transcript pane; hold Shift while dragging or use `--no-mouse-capture` for raw terminal selection. It defaults off on legacy Windows console (CMD without `WT_SESSION` / `ConEmuPID`) and inside JetBrains JediTerm — PyCharm/IDEA/CLion/etc. — where the terminal advertises mouse support but forwards SGR mouse events as raw text (#878, #898). Use `--mouse-capture` to opt in anywhere it's defaulted off. Raw terminal selection may cross the right workbar and include visual wraps because the terminal, not the TUI, owns the selection.
405 - `--profile <NAME>`: select config profile
406 - `--config <PATH>`: config file path
407 - `-v, --verbose`: verbose logging
408
409 ## Branching and Rollback
410
411 Codewhale has three related but intentionally separate recovery paths:
412
413 - `codewhale fork <ID>` creates a new saved session from an existing saved
414 conversation and records the source session id. This is the safe way to
415 explore a different answer path without overwriting the original session.
416 - Esc-Esc backtrack rewinds the live transcript to a previous user prompt and
417 restores that prompt into the composer for editing. It does not change
418 files; `/restore` rolls the folder back to a chosen restore point and needs
419 `/trust on` or Full Access.
420 - `/restore` and the `revert_turn` tool restore workspace files from side-git
421 snapshots. `/restore list [N]` lists more snapshot options before choosing a
422 rollback point. They do not rewrite conversation history.
423
424 A Pi-style in-file tree browser is a larger UI/data-model project. Codewhale
425 ships the bounded fork/backtrack primitives and explicit lineage metadata.
426
426 lines MARKDOWN