command-code 1.4.1 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -146,8 +146,10 @@ Hooks are configured under the `hooks` key in `settings.json`. Each event array
146
146
  settings.json
147
147
  └── hooks
148
148
  └── <EventName>
149
- └── [ HookDefinition ] // matcher + list of handlers
150
- └── hooks: [ HookEntry ] // type + command + timeout
149
+ └── [ HookDefinition ]
150
+ │ matcher: which tools
151
+ └── hooks: [ HookEntry ]
152
+ type · command · timeout
151
153
  ```
152
154
 
153
155
  One `HookDefinition` can own multiple `HookEntry` handlers. They all run for the same matcher, in the order listed.
@@ -158,7 +158,7 @@ To target one source, name it. Each argument maps to that agent only, so pick th
158
158
  /import gemini # Gemini CLI
159
159
  ```
160
160
 
161
- It imports MCP servers alongside skills, agents, custom commands, and memory. See [Import](https://commandcode.ai/docs/core-concepts/import).
161
+ It imports MCP servers alongside skills, agents, custom commands, and memory. See [Import](https://commandcode.ai/docs/import).
162
162
 
163
163
  ---
164
164
 
@@ -631,6 +631,6 @@ cmd mcp add-json <name> '{"type":"http","url":"https://..."}'
631
631
  ## Next steps
632
632
 
633
633
  - [CLI Reference](https://commandcode.ai/docs/reference/cli) for all Command Code commands
634
- - [Slash Commands](https://commandcode.ai/docs/reference/slash-commands) for custom prompts
634
+ - [Slash Commands](./custom-slash-commands.md) for custom prompts
635
635
  - [MCP Protocol Specification](https://modelcontextprotocol.io/introduction) for building your own MCP server
636
636
  - Join our [Discord community](https://commandcode.ai/discord) for support
@@ -1,30 +1,21 @@
1
- <!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/core-concepts/memory/page.mdx. Regenerate: pnpm generate:knowledge -->
1
+ <!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/memory/page.mdx. Regenerate: pnpm generate:knowledge -->
2
2
 
3
3
  # Memory
4
4
 
5
- Set custom instructions for Command Code by creating an `AGENTS.md` file. It contains instructions that customize Command Code's behavior for your project.
5
+ Memory is the instructions Command Code carries into every turn without you repeating them conventions, architecture notes, the commands your project actually uses. It lives in plain markdown files named `AGENTS.md`.
6
6
 
7
7
  ---
8
8
 
9
- ## Initialize
9
+ ## Start here
10
10
 
11
- Create a new `AGENTS.md` in your project:
11
+ Create one for your project:
12
12
 
13
13
  ```bash
14
14
  /init
15
15
  ```
16
16
 
17
- This creates an `AGENTS.md` file in your project root with a starter template.
17
+ That writes `AGENTS.md` in your project root with a starter template. Edit it like any file, or run `/memory` to pick which memory file to open.
18
18
 
19
- Commit your project's `AGENTS.md` to git.
20
-
21
- ---
22
-
23
- ## Example
24
-
25
- The `/init` command creates a template like this:
26
-
27
- **AGENTS.md template**
28
19
  ```markdown
29
20
  # Memory
30
21
 
@@ -45,54 +36,102 @@ Add important architectural decisions and patterns here.
45
36
  ## Common Workflows
46
37
 
47
38
  Document frequently used workflows and commands here.
48
-
49
39
  ```
50
40
 
51
- Customize it for your project.
41
+ Commit your project's `AGENTS.md` to git. It's team-shared context, and changes
42
+ to it deserve review like any other project convention.
52
43
 
53
44
  ---
54
45
 
55
- ## File Locations
46
+ ## Where memory files live
56
47
 
57
- Command Code reads `AGENTS.md` from two locations:
48
+ Command Code reads **three tiers**, and every one that exists is loaded — they add up, they don't replace each other.
58
49
 
59
- ### Project-level
50
+ | Tier | Location | Use it for |
51
+ | ---- | -------- | ---------- |
52
+ | **User** | `~/.commandcode/AGENTS.md` | Your personal preferences, across every project |
53
+ | **Project** | `<project>/AGENTS.md` or `<project>/.commandcode/AGENTS.md` | Team-shared project instructions — commit this |
54
+ | **Subdirectory** | `<subdir>/AGENTS.md` or `<subdir>/.commandcode/AGENTS.md` | Rules for one package or area of a monorepo |
60
55
 
61
- **Location:** `./AGENTS.md` or `./.commandcode/AGENTS.md`
56
+ They're assembled in that order — user, project, then subdirectory — each block headed by its source path, so the model always knows which file a rule came from. Later blocks are more specific, so a package-level convention naturally reads as a refinement of the project-level one.
62
57
 
63
- Team-shared project instructions. Commit this to Git along with your code.
58
+ Command Code reads `AGENTS.md`, not `CLAUDE.md`. If you're coming from another
59
+ agent, [`/import`](https://commandcode.ai/docs/import) brings your memory files over and
60
+ rewrites references to point at the right filename.
64
61
 
65
- ### User-level
62
+ ### Project memory
66
63
 
67
- **Location:** `~/.commandcode/AGENTS.md`
64
+ Both `<project>/AGENTS.md` and `<project>/.commandcode/AGENTS.md` are checked, in that order — the **first one that exists** is used, not both. Put it at the repo root if you want it visible; put it in `.commandcode/` if you'd rather keep the root clean.
65
+
66
+ ### Subdirectory memory
67
+
68
+ Subdirectory memory loads on demand. When you `@`-mention a file (or the agent reads one you referenced), Command Code walks from that file's directory up to the project root and picks up any `AGENTS.md` it finds along the way, **outermost first**, so the nearest file has the last word.
69
+
70
+ ```
71
+ repo/
72
+ ├── AGENTS.md ← always loaded
73
+ └── packages/
74
+ └── api/
75
+ ├── AGENTS.md ← loaded when you mention
76
+ └── server.ts a file in this directory
77
+ ```
68
78
 
69
- Personal preferences for all your projects.
79
+ Only directories **inside** your project count — a sibling tree that happens to share a path prefix is never pulled in.
70
80
 
71
81
  ---
72
82
 
73
- ## Edit Memory Files
83
+ ## Importing other files with `@path`
74
84
 
75
- Edit `AGENTS.md` files:
85
+ Any `@path` reference inside a memory file is replaced with that file's contents, so a memory file can compose rather than duplicate:
76
86
 
77
- ```bash
78
- /memory
87
+ ```markdown
88
+ See @README.md for the project overview.
89
+ Our review rules live in @./docs/review-checklist.md.
90
+ Personal shell aliases: @~/.commandcode/shell-notes.md
79
91
  ```
80
92
 
81
- Opens a selector to choose which file to edit (project or user).
93
+ - Paths are relative to the file doing the importing; `~/` expands to your home directory; absolute paths work.
94
+ - Imports are **recursive**, up to **5 levels** deep.
95
+ - Each expansion is wrapped with an `# Imported from <path>` header so the source stays visible.
96
+ - References inside code fences or backticks are **left alone**, so documenting `@something` doesn't accidentally import it.
97
+ - A path that doesn't resolve to a readable file is left as plain text rather than failing the turn.
98
+
99
+ ---
100
+
101
+ ## How memory reaches the model
102
+
103
+ Memory is part of the **system prompt**, not the conversation. That has a few consequences worth knowing:
104
+
105
+ - **It's re-read every request.** Edit `AGENTS.md` mid-session and the next turn picks it up — no restart needed. `/context` flags the row as *(modified, refreshes next request)* until then.
106
+ - **It survives compaction.** Because it isn't conversation, it's never summarized away. See [Context & Compaction](https://commandcode.ai/docs/context).
107
+ - **It costs tokens on every turn.** `/context` shows exactly how many under the **Memory** row. A memory file that has grown into a wiki is a real, recurring cost — keep it to standing rules, and use `@path` imports for the long-form material so it's only there when it's relevant.
82
108
 
83
109
  ---
84
110
 
85
- ## Commands
111
+ ## Reference
112
+
113
+ ### Commands
114
+
115
+ | Command | Description |
116
+ | ------- | ----------- |
117
+ | `/init` | Create `AGENTS.md` in the project root from a starter template |
118
+ | `/memory` | Open a selector to edit your user or project memory file |
119
+ | `/context` | See what memory is costing in the context window |
120
+ | `/import` | Bring memory files over from another coding agent |
121
+
122
+ ### File paths
86
123
 
87
- | **Command** | **Description** |
88
- | ----------- | --------------- |
89
- | `/init` | Create `AGENTS.md` in project root |
90
- | `/memory` | Open file selector to edit `AGENTS.md` |
124
+ | Tier | Path |
125
+ | ---- | ---- |
126
+ | User | `~/.commandcode/AGENTS.md` |
127
+ | Project | `<project>/AGENTS.md`, else `<project>/.commandcode/AGENTS.md` |
128
+ | Subdirectory | `<subdir>/AGENTS.md`, else `<subdir>/.commandcode/AGENTS.md` |
91
129
 
92
130
  ---
93
131
 
94
- ## Next steps
132
+ ## See also
95
133
 
96
- * [Skills](./skills.md) for specialized agent capabilities
97
- * [Slash commands](https://commandcode.ai/docs/reference/slash-commands) for custom prompts
98
- * Join our [Discord community](https://commandcode.ai/discord) for support
134
+ - [Taste](https://commandcode.ai/docs/taste) learned style, as opposed to written rules.
135
+ - [Skills](./skills.md) — instructions that load only when a task calls for them.
136
+ - [Context & Compaction](https://commandcode.ai/docs/context) what memory costs per request.
137
+ - [Import](https://commandcode.ai/docs/import) — bring memory files from another agent.
@@ -313,7 +313,43 @@ Set `permissions.disableBypass` to `"disable"` (or `true`) to make bypass unente
313
313
 
314
314
  ## How a decision is made
315
315
 
316
- The whole machine. Every tool call runs a fixed order - the order **is** the spec, and tests pin it:
316
+ Every tool call falls through one fixed ladder. First rung that matches wins:
317
+
318
+ ```
319
+ tool call
320
+
321
+
322
+ 1 deny rules ───────────► DENY
323
+ │ (even bypass)
324
+ 2 ask rules ────────────► ASK
325
+ │ (even bypass)
326
+ 3 outside workspace? ───► ASK to admit
327
+
328
+ 4 plan mode + mutates? ─► DENY
329
+
330
+ 5 taste-dir write ──────► redirect
331
+
332
+ 6 malformed write ──────► DENY
333
+
334
+ 7 read-only? ───────────► ALLOW
335
+ │ (every mode)
336
+ 8 rm -rf / ~ $HOME ─────► ASK
337
+ │ (even bypass)
338
+ 9 bypass mode? ─────────► ALLOW
339
+
340
+ 10 sensitive write? ─────► ASK
341
+
342
+ 11 allow rules ──────────► ALLOW
343
+
344
+ 12 auto-accept + in ws? ─► ALLOW
345
+
346
+
347
+ ASK (DENY in dont-ask)
348
+ ```
349
+
350
+ Read that top to bottom and two things fall out. **Deny beats ask beats allow**, in every mode. And `bypass` sits at rung 9 — *after* your rules, the external-directory gate, and the circuit breaker — so `--yolo` skips ordinary prompts and the sensitive-write prompt, but never your explicit rules and never the root/home breaker.
351
+
352
+ The long form of each rung:
317
353
 
318
354
  1. **Deny rules** - blocked in every mode, including bypass.
319
355
  2. **Ask rules** - always prompt, even under bypass. In `dont-ask` the would-be prompt becomes a deny.
@@ -329,8 +365,6 @@ The whole machine. Every tool call runs a fixed order - the order **is** the spe
329
365
  12. **Accept-edits fast path** - in `auto-accept`, file edits and safe filesystem commands inside the workspace run without a prompt. Recursive deletes excluded - they still prompt.
330
366
  13. Otherwise, **ask** - and in `dont-ask`, **deny**.
331
367
 
332
- Two consequences. First, **deny beats ask beats allow**, every mode. Second, `bypass` sits *after* the deny/ask rules, the external-dir gate, and the breaker - so `--yolo` skips ordinary prompts and the sensitive-write prompt, but not your explicit rules and not the root/home breaker.
333
-
334
368
  Every policy denial (deny rule, mode gate, malformed input) carries guidance the model can act on, and the turn continues. Only a **human** "no" ends the turn.
335
369
 
336
370
  ---
@@ -1,105 +1,256 @@
1
- <!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/core-concepts/plan-mode/page.mdx. Regenerate: pnpm generate:knowledge -->
1
+ <!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/plan-mode/page.mdx. Regenerate: pnpm generate:knowledge -->
2
2
 
3
- # Plan Mode and Auto-Accept Mode
3
+ # Plan Mode
4
4
 
5
- Command Code separates reasoning from execution using permission modes:
5
+ Plan mode is where the agent thinks before it touches anything. It explores read-only, writes a plan, and hands it to you in a review surface. You comment, it revises, you approve — then implementation starts.
6
6
 
7
- - **Plan Mode**: Explore and plan without executing file changes
8
- - **Auto-Accept Mode**: Implement changes without confirmation prompts
7
+ ---
8
+
9
+ ## Start here
9
10
 
10
- `Shift + Tab` cycles permission modes rather than toggling between two: `default` to `auto-accept` to `plan` and back to `default`. Launched with `--yolo`, `bypass` joins as a fourth rung (`plan` to `bypass` to `default`).
11
+ ```bash
12
+ /plan # enter plan mode
13
+ /plan add rate limiting # enter plan mode and plan that task
14
+ ```
11
15
 
12
- Two modes sit off that cycle. `dont-ask` is selected from settings or `--permission-mode dont-ask`, and pressing `Shift + Tab` from it moves to `auto-accept` and rejoins the normal cycle. `bypass` is only reachable by launching with `--yolo`. To jump straight to a mode without cycling, use `/mode` or its shorthands (`/mode:default`, `/mode:auto-accept`, `/mode:plan`).
16
+ Or press `shift+tab` until the banner reads **plan**, or launch with `cmd --plan`.
13
17
 
14
- Once a plan is written, [Plan Review](./plan-review.md) is where you read, comment on, revise, and approve it.
18
+ In plan mode the agent can read files, search, and reason. It **cannot** edit files, run shell commands, or apply patches. When it's done it writes the plan to `~/.commandcode/plans/<name>.md` and opens **plan review** — a GitHub-style reader where one line is always selected, you leave inline comments, and you resolve with a verb:
19
+
20
+ | Key | Verb |
21
+ | --- | ---- |
22
+ | `ctrl+r` | **Submit review** — send your comments back; the agent revises the plan |
23
+ | `ctrl+a` | **Approve** — start implementing |
24
+ | `esc` | **Cancel** — the plan stays saved; reopen it with `/plans` |
15
25
 
16
26
  ---
17
27
 
18
- ## Plan Mode
28
+ ## The permission modes
29
+
30
+ Plan mode is one rung on the permission-mode cycle. `shift+tab` moves between them: `default` → `auto-accept` → `plan` → back to `default`.
31
+
32
+ | Mode | File edits | Shell commands | Use it when |
33
+ | ---- | ---------- | -------------- | ----------- |
34
+ | **plan** | Blocked | Blocked | Exploring, designing, reviewing sensitive flows |
35
+ | **default** | Prompt for approval | Prompt for approval | Controlled iteration — the everyday mode |
36
+ | **auto-accept** | Applied directly | Run directly | The approach is clear and you're iterating fast |
37
+
38
+ Two modes sit off the cycle. `dont-ask` is selected from settings or `--permission-mode dont-ask`, and `shift+tab` from it moves to `auto-accept` and rejoins the normal cycle. `bypass` is only reachable by launching with `--yolo`, which also adds it to the cycle as a fourth rung (`plan` → `bypass` → `default`).
39
+
40
+ To jump straight to a mode without cycling, use `/mode` or its shorthands: `/mode:default`, `/mode:auto-accept`, `/mode:plan`.
19
41
 
20
- Plan mode helps you with structured thinking. It can:
42
+ **Permissions**
43
+ Modes are only the baseline. The complete guide covers allow/ask/deny rule
44
+ syntax, the decision ladder every tool call runs, safety behaviors, and the
45
+ full mode-by-operation decision table.
21
46
 
22
- - Read your codebase
23
- - Search files
24
- - Analyze architecture
25
- - Discuss tradeoffs
26
- - Propose implementation plans
47
+ Bypass mode is deliberately **not** reachable through `/mode`. Slash commands
48
+ are agent-invokable, so a mid-session route into bypass would let the model
49
+ disable its own permission prompts.
27
50
 
28
- It **cannot**:
51
+ Command Code creates a [checkpoint](./sessions.md) before modifying files in any mode, so an auto-accept run is always rewindable.
29
52
 
30
- - Modify files
31
- - Run shell commands
32
- - Apply patches
53
+ ### Picking a mode
33
54
 
34
- We recommend Plan mode to:
55
+ | Situation | Mode |
56
+ | --------- | ---- |
57
+ | New feature with unclear scope | Plan |
58
+ | Debugging a complex issue | Plan |
59
+ | Multi-file refactor | Plan |
60
+ | Security review | Plan |
61
+ | Small bug fix | Auto-accept |
62
+ | Routine refactor | Auto-accept |
63
+ | Running tests and adjusting | Auto-accept |
64
+ | Quick typo fix | Auto-accept |
35
65
 
36
- - Explore unfamiliar codebases
37
- - Debug complex issues
38
- - Design multi-file features
39
- - Evaluate architecture decisions
40
- - Identify edge cases early
41
- - Review sensitive or critical flows
66
+ The usual loop: start in **plan**, explore and agree on the approach, approve the plan, let it run in **auto-accept**, rewind with checkpoints if something goes sideways.
42
67
 
43
68
  ---
44
69
 
45
- ## Auto-Accept Mode
70
+ ## Plan review
71
+
72
+ Plan review turns a plan into a first-class, persistent artifact you can read, comment on, revise, and approve — instead of a block of text that scrolls away.
73
+
74
+ - **One mode: REVIEW.** Read line by line, comment on any line, resolve with a verb. There is no separate "edit mode" — plan edits go through your `$EDITOR`.
75
+ - **Plans persist.** Every plan is saved to `~/.commandcode/plans/` as markdown and indexed, so canceling a review never throws the plan away.
76
+ - **Comments are review artifacts, not plan text.** They live in a sidecar overlay and only reach the agent inside a prompt — they are never written into the plan document.
77
+ - **Review rounds.** When the agent revises a plan, the next round diffs against the last one — changed lines render green so you re-review only what moved.
78
+ - **Deterministic.** A harness backstop guarantees the review is offered even when a weaker model writes a plan and simply stops.
79
+
80
+ ### How it works
81
+
82
+ ```
83
+ you: "plan a rate limiter"
84
+
85
+
86
+ ┌─────────────────────┐
87
+ │ PLAN MODE │ read-only
88
+ │ explore · design │ writes <name>.md
89
+ └──────────┬──────────┘
90
+ │ exit_plan_mode
91
+
92
+ ┌─────────────────────┐
93
+ │ PLAN REVIEW │ ◀───────┐
94
+ │ read · comment │ │
95
+ └──┬───────────────┬──┘ │
96
+ │ │ │
97
+ │ ctrl+r │ ctrl+a │
98
+ │ submit │ approve │
99
+ ▼ ▼ │
100
+ ┌────────────┐ ┌───────────┐ │
101
+ │ agent │ │ IMPLEMENT │ │
102
+ │ revises │ └───────────┘ │
103
+ └──────┬─────┘ │
104
+ └── another round ────────┘
46
105
 
47
- Auto-Accept mode is for fast implementation and execution.
106
+ esc → plan saved, not-implemented
107
+ reopen any time with /plans
108
+ ```
48
109
 
49
- - Modifies files directly
50
- - Applies patches without confirmation
51
- - Executes shell commands
52
- - Proceeds step-by-step automatically
110
+ Inside the reader one line is always selected, comments pin inline under their line, and the bottom bar holds the review verbs:
53
111
 
54
- We recommend Auto-Accept mode when:
112
+ ```
113
+ ┌ Plan review · rate-limiter.md · v2 ─┐
114
+ │ │
115
+ │ 5 ● 1. Add a token-bucket mw. │
116
+ │ ↳ why not a sliding window? │
117
+ │ 6 2. Store buckets in Redis. │
118
+ │ 7 3. Return 429 + Retry-After. │
119
+ │ │
120
+ │ ─────────────────────────────────── │
121
+ │ REVIEW 1 pending · round 2 │
122
+ │ Submit review (1) ctrl+r │
123
+ │ Approve ctrl+a │
124
+ │ Cancel esc │
125
+ └─────────────────────────────────────┘
126
+ ```
55
127
 
56
- - The approach is already clear
57
- - You are iterating quickly
58
- - You trust the implementation path
128
+ `●` marks a commented line and `↳` is your comment pinned beneath it. In a revised round, changed lines render green. The hint row at the very bottom carries the rest: type + enter to comment, `ctrl+n`/`ctrl+p` to jump changes, `?` `x` `!` for quick comments, `ctrl+g` to edit.
59
129
 
60
- Command Code creates **Checkpoints** before modifying files, so you can rewind at any time.
130
+ ### Four ways in
61
131
 
62
- Learn how to use [checkpoints](./checkpoints.md) in Command Code.
132
+ All of these open the same surface, scoped to a plan written during the **current session**.
63
133
 
64
- ---
134
+ 1. **Finishing plan mode.** The agent writes the plan and calls `exit_plan_mode`, which opens plan review as the approval surface — the plan *is* the approval prompt. Approving here can also switch you into auto-accept mode so implementation runs without further prompts.
135
+ 2. **Asking for it.** Outside plan mode, say *"review plan"* / *"open plan review"*. The agent calls the `plan_review` tool, which opens the panel for the most recent plan file, instead of pasting the plan back as a wall of text.
136
+ 3. **`/plan-review`.** Jumps straight into a review of this session's latest plan.
137
+ 4. **`/plans`.** Opens the full-screen plan browser — every plan from this session and past sessions, with status badges, comment counts, and search. `/plans <name>` jumps straight into a named plan.
138
+
139
+ **The automatic backstop.** Some models write a plan file and stop without ever presenting it. When a run ends naturally with a plan that was written but never reviewed (in **default** or **plan** mode), the harness presents the review panel itself. Approving continues the run with an instruction to implement; declining lets the run end so you can steer. Modes that mean "don't interrupt me" — auto-accept, bypass, and dont-ask — skip the backstop.
140
+
141
+ ### Reading and commenting
142
+
143
+ The reader renders the plan like a document — headings, code, quotes, and tables styled per line. Long lines **wrap** at a comfortable reading width (80 columns when there's room, otherwise 60) rather than truncating.
144
+
145
+ **Navigating:**
146
+
147
+ | Key | Action |
148
+ |-----|--------|
149
+ | `↑` / `↓` | Move one line; past the last line drops onto the review verbs |
150
+ | `PgUp` / `PgDn` (`Fn+↑/↓` on Mac) | Page up/down one viewport, like `less` |
151
+ | `Home` / `End` (`Fn+←/→` on Mac) | Jump to the first / last line |
152
+ | `ctrl+n` / `ctrl+p` | Jump between marked lines — your comments, plus changed lines in a revised plan |
65
153
 
66
- ## Default Mode
154
+ **Commenting** is Figma-style — start typing on a line and a draft box opens inline, directly under that line, exactly where it will sit once pinned.
67
155
 
68
- Default mode sits between the Plan and Auto-Accept modes.
156
+ | Key | Action |
157
+ |-----|--------|
158
+ | type + `Enter` | Open a draft on the selected line, then pin it |
159
+ | `Enter` on a commented line | Reopen the comment to edit it |
160
+ | empty + `Enter` | Remove the comment |
161
+ | `?` | Quick comment: "Why? Explain the reasoning behind this." |
162
+ | `x` | Quick comment: "Cut this — remove it from the plan." |
163
+ | `!` | Quick comment: "Risky — double-check this before implementing." |
164
+ | `esc` (while drafting) | Discard the draft |
69
165
 
70
- - File edits require confirmation
71
- - Commands require approval
166
+ Pinned comments show a `●` gutter marker and a `↳ comment` row beneath the line. They're saved to disk with the plan, so they survive closing the reader and even ending the session.
72
167
 
73
- Use the Default mode when you want controlled iteration without fully separating planning and execution.
168
+ **Editing the plan** happens in your editor: `ctrl+g` hands the plan file to `$EDITOR` (or `$VISUAL`) and the reader reloads when you close it.
169
+
170
+ ### Resolving a review
171
+
172
+ Trigger a verb by chord from anywhere, or arrow onto it and press `Enter`.
173
+
174
+ | Verb | Chord | What it does |
175
+ |------|-------|--------------|
176
+ | **Submit review** | `ctrl+r` | The agent takes your pending comments, revises the plan, and re-presents it for another round. Only shown when you have pending comments. |
177
+ | **Approve** *(approval surface)* | `ctrl+a` | Executes the plan and begins implementation. |
178
+ | **Execute plan** *(browser surface)* | `ctrl+e` | Executes the plan as written — from the `/plans` browser this is itself an approval. |
179
+ | **Cancel** / **Back** | `esc` | Ends the review. In plan mode the plan stays saved and you keep refining; from the browser it returns to the list. |
180
+
181
+ If you press Approve with comments still pending, Command Code asks rather than guessing:
182
+
183
+ ```
184
+ Approve (•) with N comments as notes ( ) original plan · discard comments
185
+ ```
186
+
187
+ **With comments as notes** sends them as a follow-up user turn — non-blocking notes the agent implements against. **Original plan** approves it clean and drops the comments. `←/→` switches, `Enter` confirms, `esc` backs out.
188
+
189
+ ### Review rounds and versioning
190
+
191
+ Each time you **Submit review**, Command Code:
192
+
193
+ 1. Snapshots the current plan to `~/.commandcode/plans/versions/<name>-v<N>.md`.
194
+ 2. Bumps the plan's version and clears your pending comments (they were all handed to the agent in one prompt).
195
+ 3. Lets the agent revise the plan, overwriting the live file.
196
+
197
+ When the revised plan comes back (version > 1), the reader **diffs it against the previous round's snapshot**. Changed lines render **green**, and the badge line reports `round N · M lines changed` — so a second review means re-reading only what actually moved. `ctrl+n`/`ctrl+p` jump between those changed lines.
74
198
 
75
199
  ---
76
200
 
77
- ## Suggested workflow with modes
201
+ ## Where plans live
202
+
203
+ ```
204
+ ~/.commandcode/plans/<descriptive-name>.md ← the plan markdown (written by the agent)
205
+ ~/.commandcode/plans/plans-index.json ← titles, status, comments, versions
206
+ ~/.commandcode/plans/versions/<name>-v<N>.md ← prior review-round snapshots
207
+ ```
208
+
209
+ Every plan carries a status:
78
210
 
79
- 1. Start in **Plan Mode**
80
- 2. Explore relevant files
81
- 3. Discuss approach and edge cases
82
- 4. Switch to **Auto-Accept Mode** if you're ready to implement
83
- 5. Rewind with Checkpoints if needed
211
+ - **pending** written but not yet taken through review.
212
+ - **approved** you approved it and moved to implementation.
213
+ - **not-implemented** you canceled the review; the plan is kept for later reading, commenting, and revision.
214
+
215
+ Because a canceled plan is recorded rather than discarded, planning never feels throwaway — reopen it any time with `/plans`. Writes to `~/.commandcode/plans/*.md` never prompt for permission in any mode, and only `.md` files there get that exemption, so the plans directory can't double as a scratchpad.
84
216
 
85
217
  ---
86
218
 
87
- ## Example use cases for choosing the right mode
219
+ ## Reference
220
+
221
+ ### Slash commands
222
+
223
+ | Command | Description |
224
+ |---------|-------------|
225
+ | `/plan [task]` | Enter plan mode; `/plan <task>` plans that task |
226
+ | `/plans [name]` | Browse, review, and annotate saved plans; bare `/plans` opens the browser |
227
+ | `/plan-review` | Review this session's latest plan |
228
+ | `/mode [default\|auto-accept\|plan]` | Show or switch the permission mode |
229
+ | `/mode:plan` | Switch to plan mode (read-only, no side effects) |
230
+ | `/mode:auto-accept` | Switch to auto-accept mode |
231
+ | `/mode:default` | Switch to default mode |
232
+
233
+ ### CLI flags
234
+
235
+ | Flag | Description |
236
+ |------|-------------|
237
+ | `--plan` | Start in plan mode |
238
+ | `--auto-accept` | Start in auto-accept mode |
239
+ | `--permission-mode <mode>` | `default`, `plan`, `auto-accept`, or `dont-ask` (legacy `standard` accepted) |
240
+ | `--yolo` | Bypass all permission prompts, and add `bypass` to the `shift+tab` cycle |
241
+
242
+ ### Tools
88
243
 
89
- | Use Case | Recommended Mode |
90
- | ------------------------------ | ---------------- |
91
- | New feature with unclear scope | Plan |
92
- | Debugging complex issue | Plan |
93
- | Multi-file refactor | Plan |
94
- | Security review | Plan |
95
- | Small bug fix | Auto-Accept |
96
- | Routine refactor | Auto-Accept |
97
- | Running tests and adjusting | Auto-Accept |
98
- | Quick typo fix | Auto-Accept |
244
+ | Tool | Description |
245
+ |------|-------------|
246
+ | `enter_plan_mode` | Switches into plan mode (with your confirmation) for read-only exploration |
247
+ | `exit_plan_mode` | Presents the plan for approval when leaving plan mode. Only valid *in* plan mode |
248
+ | `plan_review` | Opens the review panel on demand *outside* plan mode. Renders as `PLAN(review)` in the feed |
99
249
 
100
250
  ---
101
251
 
102
- ## Next Steps
252
+ ## See also
103
253
 
104
- - Use **Plan Mode** to outline a change, then switch to **Auto-Accept** to implement it
105
- - Join our [Discord community](https://commandcode.ai/discord) for support
254
+ - [Permissions](./permissions.md) the rule syntax and decision model behind every mode.
255
+ - [Checkpoints](./sessions.md) rewind after an approved plan is implemented.
256
+ - [Tools](https://commandcode.ai/docs/reference/tools) and [Slash Commands](./custom-slash-commands.md) — the full references.
@@ -1,4 +1,4 @@
1
- <!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/core-concepts/checkpoints/page.mdx. Regenerate: pnpm generate:knowledge -->
1
+ <!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/sessions/page.mdx. Regenerate: pnpm generate:knowledge -->
2
2
 
3
3
  # Sessions & Checkpoints
4
4
 
@@ -127,7 +127,27 @@ The model a session was using is stored in its meta and **adopted when you resum
127
127
 
128
128
  ## Branching
129
129
 
130
- Three commands let one conversation become many.
130
+ Three commands let one conversation become many. They differ in **what comes with you**:
131
+
132
+ ```
133
+ original session
134
+ A ── B ── C ── D ← you are here
135
+ └─ B' ── C' ← an older branch
136
+
137
+ /fork whole tree + checkpoints
138
+ ┌─────────────────────┐
139
+ │ A ─ B ─ C ─ D │
140
+ │ └ B' ─ C' │ /rewind works
141
+ └─────────────────────┘
142
+
143
+ /clone active branch only
144
+ ┌─────────────────────┐
145
+ │ A ─ B ─ C ─ D │ /rewind empty
146
+ └─────────────────────┘
147
+
148
+ /tree no copy — jump anywhere
149
+ in the tree you already have
150
+ ```
131
151
 
132
152
  ### `/fork [name]` — copy everything
133
153
 
@@ -316,6 +336,10 @@ When the conversation approaches the context limit, Command Code compacts histor
316
336
 
317
337
  ---
318
338
 
339
+ **Context & Compaction**
340
+ What compaction does to the transcript, the tiers and their thresholds,
341
+ `/compact` and `/compact-mode`, and how to keep context lean.
342
+
319
343
  ## Design decisions
320
344
 
321
345
  - **One picker, not two.** `/resume` and `/sessions` open the same unified picker rather than separate interactive/print views, so there's one mental model for "where are my sessions."
@@ -361,6 +385,6 @@ When the conversation approaches the context limit, Command Code compacts histor
361
385
  ## See also
362
386
 
363
387
  - [Headless Mode](./headless.md) — resuming and naming sessions from scripts and CI.
364
- - [Interactive Mode](https://commandcode.ai/docs/core-concepts/interactive-mode) — the full session experience.
365
- - [Context & Compaction](https://commandcode.ai/docs/core-concepts/context) — how history is summarized as it grows.
388
+ - [Interactive Mode](https://commandcode.ai/docs/interactive-mode) — the full session experience.
389
+ - [Context & Compaction](https://commandcode.ai/docs/context) — how history is summarized as it grows.
366
390
  - [Permissions](./permissions.md) — how permission decisions apply as you resume or fork a session.
@@ -451,7 +451,7 @@ After editing, the changes are immediately applied and ready to use. No restart
451
451
 
452
452
  ### Setting up your editor
453
453
 
454
- The `/skills` command uses your `$EDITOR` environment variable to open files. See [setting up your editor](https://commandcode.ai/docs/core-concepts/interactive-mode#setting-up-your-editor) for setup instructions.
454
+ The `/skills` command uses your `$EDITOR` environment variable to open files. See [setting up your editor](https://commandcode.ai/docs/interactive-mode#setting-up-your-editor) for setup instructions.
455
455
 
456
456
  ---
457
457