command-code 0.52.5 → 1.0.0
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.
- package/CHANGELOG.md +2541 -0
- package/dist/bundled/command-code-knowledge/SKILL.md +52 -0
- package/dist/bundled/command-code-knowledge/reference/checkpoints.md +366 -0
- package/dist/bundled/command-code-knowledge/reference/custom-agents.md +91 -0
- package/dist/bundled/command-code-knowledge/reference/custom-slash-commands.md +345 -0
- package/dist/bundled/command-code-knowledge/reference/headless.md +234 -0
- package/dist/bundled/command-code-knowledge/reference/hooks.md +1097 -0
- package/dist/bundled/command-code-knowledge/reference/mcp.md +626 -0
- package/dist/bundled/command-code-knowledge/reference/memory.md +98 -0
- package/dist/bundled/command-code-knowledge/reference/models.md +81 -0
- package/dist/bundled/command-code-knowledge/reference/permissions.md +412 -0
- package/dist/bundled/command-code-knowledge/reference/plan-mode.md +101 -0
- package/dist/bundled/command-code-knowledge/reference/product-help.md +421 -0
- package/dist/bundled/command-code-knowledge/reference/skills.md +993 -0
- package/dist/bundled/mod-builder/SKILL.md +128 -0
- package/dist/bundled/mod-builder/examples/block-dangerous-commands.ts +41 -0
- package/dist/bundled/mod-builder/examples/custom-entry-renderer.ts +32 -0
- package/dist/bundled/mod-builder/examples/custom-tool.ts +53 -0
- package/dist/bundled/mod-builder/examples/flags-and-options.ts +29 -0
- package/dist/bundled/mod-builder/examples/input-shortcuts.ts +41 -0
- package/dist/bundled/mod-builder/examples/kitchen-sink.ts +110 -0
- package/dist/bundled/mod-builder/examples/lifecycle-hooks.ts +64 -0
- package/dist/bundled/mod-builder/examples/observe-events.ts +30 -0
- package/dist/bundled/mod-builder/examples/slash-command.ts +33 -0
- package/dist/bundled/mod-builder/reference/api.md +81 -0
- package/dist/bundled/mod-builder/reference/hooks-and-events.md +308 -0
- package/dist/bundled/mod-builder/reference/overview.md +161 -0
- package/dist/bundled/mod-builder/reference/packaging.md +63 -0
- package/dist/bundled/mod-builder/reference/ui.md +63 -0
- package/dist/bundled/mod-builder/reference/verify.md +58 -0
- package/dist/bundled/skill-builder/SKILL.md +104 -0
- package/dist/cli.mjs +5 -5
- package/package.json +35 -26
- package/vsix/commandcode-vscode.vsix +0 -0
- /package/{skills → dist/bundled}/agent-browser/SKILL.md +0 -0
- /package/{skills → dist/bundled}/design/SKILL.md +0 -0
- /package/{skills → dist/bundled}/design/references/border.md +0 -0
- /package/{skills → dist/bundled}/design/references/button.md +0 -0
- /package/{skills → dist/bundled}/design/references/checkup.md +0 -0
- /package/{skills → dist/bundled}/design/references/color.md +0 -0
- /package/{skills → dist/bundled}/design/references/create.md +0 -0
- /package/{skills → dist/bundled}/design/references/design-html.md +0 -0
- /package/{skills → dist/bundled}/design/references/deslop.md +0 -0
- /package/{skills → dist/bundled}/design/references/finish.md +0 -0
- /package/{skills → dist/bundled}/design/references/interaction.md +0 -0
- /package/{skills → dist/bundled}/design/references/layout.md +0 -0
- /package/{skills → dist/bundled}/design/references/motion.md +0 -0
- /package/{skills → dist/bundled}/design/references/redesign.md +0 -0
- /package/{skills → dist/bundled}/design/references/refine.md +0 -0
- /package/{skills → dist/bundled}/design/references/relayout.md +0 -0
- /package/{skills → dist/bundled}/design/references/report-html.md +0 -0
- /package/{skills → dist/bundled}/design/references/responsive.md +0 -0
- /package/{skills → dist/bundled}/design/references/review.md +0 -0
- /package/{skills → dist/bundled}/design/references/setup.md +0 -0
- /package/{skills → dist/bundled}/design/references/shadow.md +0 -0
- /package/{skills → dist/bundled}/design/references/smell.md +0 -0
- /package/{skills → dist/bundled}/design/references/surface.md +0 -0
- /package/{skills → dist/bundled}/design/references/tokenize.md +0 -0
- /package/{skills → dist/bundled}/design/references/typeset.md +0 -0
- /package/{skills → dist/bundled}/design/references/voice.md +0 -0
- /package/{skills → dist/bundled}/design/references/writing.md +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: command-code-knowledge
|
|
3
|
+
description: Authoritative Command Code product knowledge — slash commands, CLI options, permissions, skills, custom agents, MCP servers, hooks, memory, headless mode, plan mode, checkpoints, sessions, the model catalog, taste, pricing, and troubleshooting. Use when the user asks how Command Code works, how to configure or extend it, which models exist, or when you need product facts to answer a "can Command Code do X" question. Do NOT search the codebase for product behavior — read the reference files here instead.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Command Code Knowledge
|
|
7
|
+
|
|
8
|
+
You are answering a question about Command Code itself (or configuring/extending it). The
|
|
9
|
+
`reference/` directory next to this file IS the authoritative product documentation — it is
|
|
10
|
+
generated from the public docs (commandcode.ai/docs) and from the same registries that drive
|
|
11
|
+
the product (`/model` catalog, billing tables, slash-command menu), so it can never be more
|
|
12
|
+
wrong than the product. Never guess and never grep the codebase for product behavior: open
|
|
13
|
+
the matching reference file.
|
|
14
|
+
|
|
15
|
+
## How to use this skill
|
|
16
|
+
|
|
17
|
+
1. Pick the reference file(s) below that cover the question and read them.
|
|
18
|
+
2. Answer from what they say; quote exact ids, flags, paths, and settings keys verbatim.
|
|
19
|
+
3. Model questions (which model, exact ids, context windows, efforts, prices): read
|
|
20
|
+
`reference/models.md` — ids there are EXACT; never invent a model id.
|
|
21
|
+
4. Anything about the help surface (slash commands, keyboard shortcuts, CLI flags, taste,
|
|
22
|
+
FAQ, pricing links): `reference/product-help.md` — the same document the
|
|
23
|
+
`get_command_code_knowledge` tool serves.
|
|
24
|
+
5. Building a mod (a loadable ModApi plugin)? Switch to the `mod-builder` skill — it has
|
|
25
|
+
the mods reference and runnable examples.
|
|
26
|
+
|
|
27
|
+
## Reference index
|
|
28
|
+
|
|
29
|
+
<!-- generated:reference-index:start -->
|
|
30
|
+
- `reference/permissions.md` — Permissions
|
|
31
|
+
- `reference/skills.md` — Agent Skills
|
|
32
|
+
- `reference/mcp.md` — MCP Servers
|
|
33
|
+
- `reference/hooks.md` — Hooks
|
|
34
|
+
- `reference/custom-slash-commands.md` — Slash Commands
|
|
35
|
+
- `reference/custom-agents.md` — Custom Agents
|
|
36
|
+
- `reference/memory.md` — Memory
|
|
37
|
+
- `reference/headless.md` — Headless Mode
|
|
38
|
+
- `reference/plan-mode.md` — Plan Mode and Auto-Accept Mode
|
|
39
|
+
- `reference/checkpoints.md` — Checkpoints
|
|
40
|
+
- `reference/models.md` — Command Code Models
|
|
41
|
+
- `reference/product-help.md` — Product help (slash commands, CLI, taste, FAQ, pricing)
|
|
42
|
+
<!-- generated:reference-index:end -->
|
|
43
|
+
|
|
44
|
+
## Verify your answer
|
|
45
|
+
|
|
46
|
+
- Ids and flags must appear verbatim in a reference file — if you cannot find it, say so
|
|
47
|
+
rather than inventing it.
|
|
48
|
+
- When the user should run something, prefer the exact command a reference file shows
|
|
49
|
+
(e.g. `cmd mcp add --transport http …`, `cmd --mod ./file.ts`).
|
|
50
|
+
- These files regenerate from the docs via `pnpm generate:knowledge`; if the user reports a
|
|
51
|
+
mismatch with the live product, the public docs at https://commandcode.ai/docs are the
|
|
52
|
+
place to check.
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
<!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/core-concepts/checkpoints/page.mdx. Regenerate: pnpm generate:knowledge -->
|
|
2
|
+
|
|
3
|
+
# Sessions & Checkpoints
|
|
4
|
+
|
|
5
|
+
Every conversation you have with Command Code is a **session**: a durable transcript on disk that you can resume, rename, fork, clone, rewind, share, and export. Close your terminal mid-task, come back tomorrow, and pick up exactly where you left off.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What is a session?
|
|
10
|
+
|
|
11
|
+
A session is a single append-only **JSONL file** — one JSON record per line. The first line is a header (session id, creation time, working directory); every line after it is an entry: your messages, the model's replies (with token usage and cost), model and effort changes, compaction summaries, and more.
|
|
12
|
+
|
|
13
|
+
Entries form a **tree**, not just a list. Each entry points at its parent, so a session can hold multiple branches of the same conversation — this is what powers `/rewind`, `/tree`, and forking. The file itself is never rewritten in place: navigating history just moves a pointer, and new entries are appended.
|
|
14
|
+
|
|
15
|
+
### Where session files live
|
|
16
|
+
|
|
17
|
+
Sessions are stored per project, keyed by a slug of the working directory:
|
|
18
|
+
|
|
19
|
+
```text theme={null}
|
|
20
|
+
~/.commandcode/projects/<project-slug>/<session-id>.jsonl
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Because the catalog is project-scoped, `/resume` and `--continue` only ever see sessions from the directory you launched Command Code in.
|
|
24
|
+
|
|
25
|
+
Alongside the transcript, a session can have sidecar files:
|
|
26
|
+
|
|
27
|
+
| **File** | **Contents** |
|
|
28
|
+
| -------- | ------------ |
|
|
29
|
+
| `<id>.jsonl` | The transcript itself (header + entries) |
|
|
30
|
+
| `<id>.meta.json` | Title, model, lineage, trace ids, compaction stats |
|
|
31
|
+
| `<id>.share.json` | Share link state, if the session was shared |
|
|
32
|
+
| `<id>.checkpoints.jsonl` | Checkpoint snapshots for `/rewind` |
|
|
33
|
+
| `<id>.prompts.jsonl` | Prompt history |
|
|
34
|
+
|
|
35
|
+
### Finding the current session file
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# In Command Code session
|
|
39
|
+
/session-file
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`/session-file` prints the current session id and the absolute path of its transcript. In terminals that support hyperlinks the path is clickable. If you haven't sent a message yet you'll see a `(not created yet)` note — the transcript is created on the first save.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Durability and crash safety
|
|
47
|
+
|
|
48
|
+
Sessions are designed so you never lose committed work:
|
|
49
|
+
|
|
50
|
+
- **Per-turn commit:** Every completed turn is appended to the transcript as it commits — not on exit. Kill the process mid-run and everything up to the last committed turn is on disk.
|
|
51
|
+
- **A turn either commits or is lost:** There is no torn state: an interrupted turn simply doesn't make it into the file, and the session resumes cleanly from the previous commit.
|
|
52
|
+
- **User messages survive failed turns:** If a turn dies on a model/API error, your message that opened it is still written to disk — so a session that errored on its very first turn still shows up in `/resume`.
|
|
53
|
+
- **Empty sessions leave no file:** A brand-new session buffers in memory until the first assistant reply, so opening Command Code and quitting without a real exchange doesn't litter your session catalog.
|
|
54
|
+
- **Torn files never block startup:** If a transcript is damaged, corrupted lines are skipped and the session still loads.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Starting fresh
|
|
59
|
+
|
|
60
|
+
### In a session: `/clear`
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# In Command Code session
|
|
64
|
+
/clear
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`/clear` starts a new session with empty context. The previous session stays on disk, fully resumable with `/resume`. `/new` is an alias — same command, same menu row.
|
|
68
|
+
|
|
69
|
+
### At launch
|
|
70
|
+
|
|
71
|
+
| **Flag** | **What it does** |
|
|
72
|
+
| -------- | ---------------- |
|
|
73
|
+
| `-n, --name <name>` | Set the new session's display name at startup |
|
|
74
|
+
| `--no-session` | Don't persist the session to disk at all (in-memory only) |
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cmd -n "auth refactor" # named session
|
|
78
|
+
cmd --no-session # throwaway session, nothing written to disk
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`--no-session` sessions never appear in `/resume` and leave no transcript. Use them for experiments you explicitly don't want in your history.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Resuming
|
|
86
|
+
|
|
87
|
+
### The resume picker
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# In Command Code session
|
|
91
|
+
/resume
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`/resume` (alias `/sessions`) opens the session picker — the same picker you get from `cmd -r` with no argument. It supports search, renaming (without leaving the picker), deleting sessions, and filtering by the git branch a session was started on. Forked sessions show their provenance (`fork of <parent>`), and the session you're currently in is highlighted and can't be deleted.
|
|
95
|
+
|
|
96
|
+
Two kinds of sessions are hidden from the picker:
|
|
97
|
+
|
|
98
|
+
- **Headless (`cmd -p`) sessions** — they carry no title and stay out of the picker and `--continue`, but an exact session id still resumes them.
|
|
99
|
+
- **In-memory (`--no-session`) sessions** — they were never written to disk.
|
|
100
|
+
|
|
101
|
+
### At launch
|
|
102
|
+
|
|
103
|
+
| **Flag** | **What it does** |
|
|
104
|
+
| -------- | ---------------- |
|
|
105
|
+
| `-r, --resume [name]` | Resume a session by id or name; with no argument, open the picker |
|
|
106
|
+
| `--sessions [name]` | Alias of `--resume` |
|
|
107
|
+
| `-c, --continue` | Continue the most recent session in the current directory |
|
|
108
|
+
| `--session <path\|id>` | Resume by transcript path (`.jsonl`) or a unique session-id prefix |
|
|
109
|
+
| `--fork-session` | With `--resume`/`--continue`/`--session`: fork the resolved session into a new one, leaving the original untouched |
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
cmd -r # open the resume picker
|
|
113
|
+
cmd -r "auth refactor" # resume by name (or id) — id is tried first, then a case-insensitive title match
|
|
114
|
+
cmd -c # continue the most recent session here
|
|
115
|
+
cmd --session 3f9a # unique id prefix
|
|
116
|
+
cmd --session ~/exported/session.jsonl # a transcript file directly
|
|
117
|
+
cmd -c --fork-session # branch off the latest session without touching it
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
A `--session` path inside the current project resumes like `-r`; a path outside it keeps appending to that file where it is.
|
|
121
|
+
|
|
122
|
+
### Model restored on resume
|
|
123
|
+
|
|
124
|
+
The model a session was using is stored in its meta and **adopted when you resume**. An in-session `/resume` always adopts the resumed session's model (clearing any `--model` launch override so the resumed model wins); a cold `cmd -r` adopts it unless you explicitly passed `--model` for that launch.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Branching
|
|
129
|
+
|
|
130
|
+
Three commands let one conversation become many.
|
|
131
|
+
|
|
132
|
+
### `/fork [name]` — copy everything
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# In Command Code session
|
|
136
|
+
/fork
|
|
137
|
+
/fork payments-experiment
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
`/fork` copies the **entire session** — the full tree with every branch, plus checkpoints and file backup history, so `/rewind` keeps working in the fork — into a new session and switches to it. The original is left untouched and resumable.
|
|
141
|
+
|
|
142
|
+
Lineage is recorded on the fork's meta: `parentSessionId` (the source session) and `branchPoint` (the stable message id of the last source message at the fork point), so the picker can render `fork of <parent>` provenance. Names are optional (up to 200 characters) and must be unique.
|
|
143
|
+
|
|
144
|
+
### `/clone` — copy the current branch only
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# In Command Code session
|
|
148
|
+
/clone
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`/clone` duplicates just the **active branch** of the conversation (from the current point back to the root) into a brand-new session file and switches into it. Unlike `/fork`, checkpoints and file history are deliberately not copied — a clone is "duplicate the conversation", and `/rewind` in the clone legitimately starts empty. The new file's header records the source transcript as its `parentSession`.
|
|
152
|
+
|
|
153
|
+
### `/tree` — browse the whole tree
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# In Command Code session
|
|
157
|
+
/tree
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`/tree` opens the session-tree navigator: every branch of the session, not just the active one. From there you can jump to **any point** in the tree, fold segments, search, attach labels to entries, and cycle display filters (`default`, `no-tools`, `user-only`, `labeled-only`). When you navigate away from a branch, Command Code can generate a **branch summary** so the work you're leaving behind stays findable — you can confirm, customize, or skip the summary (and set a default in `/config`).
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Naming and session info
|
|
165
|
+
|
|
166
|
+
| **Command** | **What it does** |
|
|
167
|
+
| ----------- | ---------------- |
|
|
168
|
+
| `/rename <name>` | Rename the current session; bare `/rename` auto-generates a title with the model |
|
|
169
|
+
| `/name` | Alias of `/rename`; bare `/name` shows the current name |
|
|
170
|
+
| `/session` | Show session info: id, name, model, message counts, tree entries, tokens, cost, context usage, transcript path |
|
|
171
|
+
| `/session-file` | Show the current session id and transcript path |
|
|
172
|
+
| `/status` | Show comprehensive environment status |
|
|
173
|
+
| `/trace` | Copy the current OpenTelemetry trace id (for support); works mid-turn, and persisted trace ids survive resume |
|
|
174
|
+
|
|
175
|
+
Names must be unique within a project — renaming to a taken name is rejected. The name also becomes your terminal tab title, and it's what `-r <name>` resolves.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Checkpoints and rewind
|
|
180
|
+
|
|
181
|
+
Every prompt you send opens a **checkpoint**: a snapshot of the conversation plus a backup of every file Command Code goes on to edit. If something goes off track, rewind to any earlier checkpoint and continue from there.
|
|
182
|
+
|
|
183
|
+
### Opening the rewind UI
|
|
184
|
+
|
|
185
|
+
Press **`Esc`** twice within 500ms, or run:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
/rewind
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Each row in the selector shows when the checkpoint was taken, a preview of the message that opened it, and how many files that checkpoint changed (or `No code changes`).
|
|
192
|
+
|
|
193
|
+
### Restore modes
|
|
194
|
+
|
|
195
|
+
| Mode | What it restores |
|
|
196
|
+
| ---- | ----------------- |
|
|
197
|
+
| **Both** | Restores conversation and code together (recommended). |
|
|
198
|
+
| **Conversation only** | Removes messages after the checkpoint. Files are untouched. |
|
|
199
|
+
| **Code only** | Restores files to their state at the checkpoint. Conversation is untouched. |
|
|
200
|
+
|
|
201
|
+
Checkpoints with no file changes only offer **Conversation only**.
|
|
202
|
+
|
|
203
|
+
Rewinding removes the messages after the checkpoint **and the checkpoint itself** — you land *before* the message that opened it. The context token count updates to reflect the shorter conversation.
|
|
204
|
+
|
|
205
|
+
Rewinds persist. If you rewind and then quit, the rewound state is what you'll see when you resume the session later — it isn't a preview.
|
|
206
|
+
|
|
207
|
+
### What a file rewind does to your working tree
|
|
208
|
+
|
|
209
|
+
A **Code only** or **Both** rewind doesn't just undo edits — it puts the tree back the way it was:
|
|
210
|
+
|
|
211
|
+
| If a file was… | After the rewind |
|
|
212
|
+
| -------------- | ---------------- |
|
|
213
|
+
| **Modified** after the checkpoint | Restored to its contents at the checkpoint |
|
|
214
|
+
| **Created** after the checkpoint | **Deleted** — it didn't exist at the checkpoint |
|
|
215
|
+
| **Deleted** after the checkpoint | Restored |
|
|
216
|
+
|
|
217
|
+
Backups are taken before each `write_file` or `edit_file` call and replayed newest-first, so a run of edits to the same file lands back on its oldest state. Backups are byte-faithful, so binary files (images, compiled artifacts) survive a backup–restore round-trip unchanged — no special handling needed.
|
|
218
|
+
|
|
219
|
+
### Restores are verified before they run
|
|
220
|
+
|
|
221
|
+
Command Code checks every backup in the set can actually be restored *before* writing anything, so a rewind either applies in full or not at all — it won't leave you half-restored. If a file can't be restored, you're told which one and why.
|
|
222
|
+
|
|
223
|
+
### Limits and pausing
|
|
224
|
+
|
|
225
|
+
Checkpoints are kept for **30 days**, capped at **200 backups per session**. Backups live in `~/.commandcode/file-history/<session-id>/`, and identical content is stored once no matter how many checkpoints reference it.
|
|
226
|
+
|
|
227
|
+
File backups are capped at **10MB per file**. An oversized file is never read or backed up — and because it was never captured, a rewind **leaves it exactly as it is** rather than deleting it. Once a session hits the 200-backup cap, or 30 days pass, older checkpoints age out.
|
|
228
|
+
|
|
229
|
+
If the disk runs low, checkpointing **pauses for the whole session** rather than silently degrading file by file, and you'll see a notice. Checkpoints already taken stay usable, and checkpointing resumes on its own — with a second notice — once enough space is free.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Session scratchpad
|
|
234
|
+
|
|
235
|
+
Each session gets a **scratchpad**: a per-session temporary workspace for intermediate files — analysis notes, throwaway scripts, generated data — that don't belong in your project.
|
|
236
|
+
|
|
237
|
+
```text theme={null}
|
|
238
|
+
/tmp/commandcode-<uid>/<sanitized-cwd>/<session-id>/scratchpad
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
- **Silent access:** Reads and writes inside the scratchpad need no permission prompts (explicit deny/ask rules still take precedence). The path is advertised in the system prompt and exported to shell commands as `$COMMANDCODE_SCRATCHPAD`.
|
|
242
|
+
- **Shared with sub-agents:** Every sub-agent in the session sees the same directory, so agents can hand intermediate results to each other by file name.
|
|
243
|
+
- **Survives compaction:** After history compaction, a bounded metadata-only **manifest** of the scratchpad is re-injected, so the model remembers which working files still exist on disk without re-reading them.
|
|
244
|
+
- **Follows launch-time forks:** Forking at launch with `--fork-session` copies the source session's scratchpad into the fork, so the branched conversation keeps its working files.
|
|
245
|
+
- **Cleaned up with retention:** Scratchpads older than 30 days are swept, and deleting a session deletes its scratchpad. It's temp space — keep durable deliverables in the project itself.
|
|
246
|
+
|
|
247
|
+
The whole tree can be relocated with the `COMMANDCODE_SCRATCHPAD_BASE` environment variable. Provisioning is fail-open: if the scratchpad can't be created safely, the feature silently disables and the session runs normally without it.
|
|
248
|
+
|
|
249
|
+
Disable it entirely in `settings.json`:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"disableScratchpad": true
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Sharing and exporting
|
|
260
|
+
|
|
261
|
+
### `/share` — live share link
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# In Command Code session
|
|
265
|
+
/share
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
`/share` uploads the conversation, copies a share URL to your clipboard, and — this is the key part — keeps the shared page **live**: every turn committed after sharing is streamed to the link automatically. Resuming a previously shared session re-arms the live updates. Run `/share` again to re-copy the existing link.
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# In Command Code session
|
|
272
|
+
/unshare
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
`/unshare` deletes the share and stops the live updates.
|
|
276
|
+
|
|
277
|
+
### `/share gist` — GitHub gist
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# In Command Code session
|
|
281
|
+
/share gist # secret gist, default format (html unless configured)
|
|
282
|
+
/share gist md # markdown
|
|
283
|
+
/share gist jsonl # raw transcript
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
`/share gist [html|jsonl|md]` renders the session and posts it as a **secret GitHub gist** via the `gh` CLI, then copies the gist URL. The default format comes from `/config`'s "Default share gist format" setting.
|
|
287
|
+
|
|
288
|
+
### `/export` — write a file
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
# In Command Code session
|
|
292
|
+
/export # default format to a generated filename
|
|
293
|
+
/export md # pick a format: html | jsonl | md
|
|
294
|
+
/export ~/notes/session.html # or a path; the extension picks the format
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
With no path, the file is written as `command-code-session-<first 8 chars of id>.<format>` using `/config`'s "Default export format" (`html` when unset). `jsonl` exports the raw transcript.
|
|
298
|
+
|
|
299
|
+
### `/copy` — clipboard
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# In Command Code session
|
|
303
|
+
/copy
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
`/copy` copies the last assistant reply to the clipboard. Best-effort: in headless/SSH terminals without clipboard access, the feed line tells you it couldn't.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Compaction and the session log
|
|
311
|
+
|
|
312
|
+
When the conversation approaches the context limit, Command Code compacts history (automatically, or on `/compact`). Two guarantees matter for sessions:
|
|
313
|
+
|
|
314
|
+
- **The on-disk log is never rewritten:** Compaction appends a compaction entry (the summary plus a pointer to the first entry kept verbatim) to the transcript tree. Your full history stays in the file — context building just reads through the compaction entry, and `/tree` can still reach everything.
|
|
315
|
+
- **Savings persist across resumes:** Cumulative compaction stats (event count, total tokens saved, last event) are written to the session's meta on every compaction, so the "total this session" figure `/compact` reports survives `--resume`.
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## Design decisions
|
|
320
|
+
|
|
321
|
+
- **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."
|
|
322
|
+
- **Rewind is destructive on purpose, but reversible.** Restoring is instant and irreversible in the moment, but because it's just moving between checkpoints, you can rewind forward again if you change your mind.
|
|
323
|
+
- **Print sessions are real sessions.** They're saved and resumable, just hidden from the picker by default — automation output doesn't have to mean throwaway state.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Troubleshooting
|
|
328
|
+
|
|
329
|
+
### Checkpoints not appearing
|
|
330
|
+
|
|
331
|
+
1. Ensure you've sent at least one message in the session
|
|
332
|
+
2. Check if checkpointing is paused (you'll have seen a disk-space notice)
|
|
333
|
+
3. Verify the session has file modifications — a checkpoint with no file changes only offers a conversation restore
|
|
334
|
+
|
|
335
|
+
### Restore failed
|
|
336
|
+
|
|
337
|
+
1. Check the error message for which file failed
|
|
338
|
+
2. Ensure backup files haven't been manually deleted from `~/.commandcode/file-history/`
|
|
339
|
+
3. Verify you have write permissions to the target files
|
|
340
|
+
|
|
341
|
+
### Double-Esc not working
|
|
342
|
+
|
|
343
|
+
1. Press Esc twice within 500ms
|
|
344
|
+
2. Ensure focus is on the Command Code input
|
|
345
|
+
3. Use `/rewind` instead
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Tips
|
|
350
|
+
|
|
351
|
+
- **Name sessions you'll come back to:** `/rename auth-refactor` (or launch with `-n`) makes `cmd -r auth-refactor` a one-liner later — and a bare `/rename` will generate a decent title for you.
|
|
352
|
+
- **Fork before risky experiments:** `cmd -c --fork-session` or `/fork` gives you a full copy — checkpoints included — while the original stays pristine.
|
|
353
|
+
- **Use `/clone` to tidy up:** After heavy rewinding, `/clone` extracts just the branch you kept into a clean new session.
|
|
354
|
+
- **Label important points in `/tree`:** Labels survive forks and make long trees navigable.
|
|
355
|
+
- **Let the scratchpad absorb clutter:** Ask for throwaway scripts and intermediate outputs in the scratchpad — no permission prompts, no files polluting your repo, and it's cleaned up automatically.
|
|
356
|
+
- **`/share` before pairing:** The link updates live as the session continues, so a teammate can follow along in real time.
|
|
357
|
+
- **Grab `/trace` when something breaks:** The trace id is what support needs, it's copyable mid-turn, and past ids survive a resume.
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## See also
|
|
362
|
+
|
|
363
|
+
- [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.
|
|
366
|
+
- [Permissions](./permissions.md) — how permission decisions apply as you resume or fork a session.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/core-concepts/custom-agents/page.mdx. Regenerate: pnpm generate:knowledge -->
|
|
2
|
+
|
|
3
|
+
# Custom Agents
|
|
4
|
+
|
|
5
|
+
Custom agents are specialized **subagents** Command Code can delegate to. Each one gets its own context window, **system prompt**, and **tool** set, so you can keep exploration, planning, or niche workflows separate from the main session.
|
|
6
|
+
|
|
7
|
+
Built-in defaults (**Explore** and **Plan**) are always available. Your definitions live alongside them as Markdown files in **project** `.commandcode/agents/` or **personal** `~/.commandcode/agents/`.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Open the agents manager
|
|
12
|
+
|
|
13
|
+
In [interactive mode](https://commandcode.ai/docs/core-concepts/interactive-mode), run:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
/agents
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This opens the agents screen: your custom agents (if any), **Create new agent**, and the default agents list.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Create a new agent
|
|
24
|
+
|
|
25
|
+
Choose **Create new agent**, then walk through the wizard.
|
|
26
|
+
|
|
27
|
+
### 1. Choose where it lives
|
|
28
|
+
|
|
29
|
+
| **Scope** | **Path** | **When to use** |
|
|
30
|
+
| --------- | -------- | --------------- |
|
|
31
|
+
| **Project** | `.commandcode/agents/` in the current repo | Shared with the team; commit in Git. |
|
|
32
|
+
| **Personal** | `~/.commandcode/agents/` | Available in every project on your machine. |
|
|
33
|
+
|
|
34
|
+
### 2. Choose how to build it
|
|
35
|
+
|
|
36
|
+
| **Option** | **Description** |
|
|
37
|
+
| ---------- | --------------- |
|
|
38
|
+
| **Generate with Command Code (recommended)** | Describe the agent’s role and when to use it; Command Code drafts configuration for you. |
|
|
39
|
+
| **Manual configuration** | Set the identifier, system prompt, “when to use” description, and tools yourself. |
|
|
40
|
+
|
|
41
|
+
### 3. Generate: write a thorough description
|
|
42
|
+
|
|
43
|
+
If you chose **Generate with Command Code**, you’ll see a prompt like the one below. The more specific you are about responsibilities, boundaries, and when delegation should happen, the better the result.
|
|
44
|
+
|
|
45
|
+
Command Code will automatically generate:
|
|
46
|
+
|
|
47
|
+
- **Agent name**
|
|
48
|
+
- **Description** (when to use it)
|
|
49
|
+
- **System prompt**
|
|
50
|
+
|
|
51
|
+
You only need to review them, choose which **tools** the agent should have access to, and pick which **model** it runs on (or keep the default of inheriting the session model).
|
|
52
|
+
|
|
53
|
+
After generation, you’ll confirm tools and save. Manual creation follows the same tool-selection and confirmation steps, but you’ll enter the **name**, **description**, and **system prompt** yourself.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Agent files (manual editing)
|
|
58
|
+
|
|
59
|
+
Each agent is a **Markdown file** with YAML front matter and a body that becomes the **system prompt**.
|
|
60
|
+
|
|
61
|
+
- **`name`** — Identifier and filename (e.g. `security-review.md` → agent `security-review`).
|
|
62
|
+
- **`description`** — Tells Command Code **when** to use this agent.
|
|
63
|
+
- **`tools`** — Comma-separated tool list, **`"*"`** for all tools, or a restriction such as read-only style lists.
|
|
64
|
+
- **`model`** — Optional model this agent always runs on (any `/model` id, e.g. `deepseek/deepseek-v4-pro` or `claude-sonnet-5`). Omit it or set `model: inherit` to follow the session's current model. Per-agent models let you pin deep-reasoning models to architect/planner agents while implementation or docs agents ride faster, cheaper ones — each keeps its own prompt cache.
|
|
65
|
+
|
|
66
|
+
Do not use reserved names for custom agents: `explore`, `plan`, `review`, and `general`. Those names are reserved for built-in or internal behavior; custom files with those names are ignored.
|
|
67
|
+
|
|
68
|
+
Example shape:
|
|
69
|
+
|
|
70
|
+
**Example agent file**
|
|
71
|
+
```markdown
|
|
72
|
+
---
|
|
73
|
+
name: "security-review"
|
|
74
|
+
description: "Use for dependency and secret-scanning review before release."
|
|
75
|
+
tools: "glob, grep, read_file, think"
|
|
76
|
+
model: "claude-sonnet-5"
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
You are a security-focused reviewer. Prioritize dependency risks, secrets in code,
|
|
80
|
+
and unsafe patterns. Be concise; cite file paths and lines.
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
You can edit files directly in `.commandcode/agents/` or `~/.commandcode/agents/`, or recreate them through `/agents`.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Next steps
|
|
88
|
+
|
|
89
|
+
- [Interactive mode](https://commandcode.ai/docs/core-concepts/interactive-mode) — slash commands and session controls
|
|
90
|
+
- [Memory](./memory.md) — project and user instructions in `AGENTS.md`
|
|
91
|
+
- [Skills](./skills.md) — reusable skill packages vs. full subagents
|