@knightcodeai/cli-linux-x64 0.9.0 → 0.9.2

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.
Files changed (45) hide show
  1. package/bin/CHANGELOG.md +88 -0
  2. package/bin/README.md +52 -19
  3. package/bin/docs/cli-integration.md +106 -0
  4. package/bin/docs/cli.md +270 -0
  5. package/bin/docs/compaction.md +56 -37
  6. package/bin/docs/configuration.md +46 -0
  7. package/bin/docs/containerization.md +86 -54
  8. package/bin/docs/custom-provider.md +132 -782
  9. package/bin/docs/docs.json +143 -103
  10. package/bin/docs/environment-variables.md +5 -3
  11. package/bin/docs/extensions.md +134 -2937
  12. package/bin/docs/how-knightcode-works.md +49 -0
  13. package/bin/docs/index.md +24 -69
  14. package/bin/docs/json.md +193 -65
  15. package/bin/docs/keybindings.md +56 -101
  16. package/bin/docs/llama-cpp.md +3 -3
  17. package/bin/docs/message-types.md +261 -0
  18. package/bin/docs/models.md +65 -517
  19. package/bin/docs/packages.md +66 -167
  20. package/bin/docs/prompt-templates.md +31 -68
  21. package/bin/docs/providers.md +103 -233
  22. package/bin/docs/quickstart.md +61 -106
  23. package/bin/docs/rpc-commands.md +854 -0
  24. package/bin/docs/rpc-extension-ui.md +200 -0
  25. package/bin/docs/rpc.md +129 -1556
  26. package/bin/docs/sdk.md +76 -1160
  27. package/bin/docs/security.md +70 -32
  28. package/bin/docs/session-format.md +39 -216
  29. package/bin/docs/sessions.md +43 -121
  30. package/bin/docs/settings.md +112 -367
  31. package/bin/docs/shell-aliases.md +85 -5
  32. package/bin/docs/skills.md +51 -189
  33. package/bin/docs/slash-commands.md +63 -0
  34. package/bin/docs/terminal-setup.md +107 -79
  35. package/bin/docs/termux.md +74 -83
  36. package/bin/docs/themes.md +68 -280
  37. package/bin/docs/tmux.md +31 -39
  38. package/bin/docs/tui.md +69 -923
  39. package/bin/docs/usage.md +79 -285
  40. package/bin/docs/windows.md +43 -17
  41. package/bin/export-html/template.js +6 -1
  42. package/bin/knightcode +2 -2
  43. package/bin/package.json +6 -6
  44. package/package.json +1 -1
  45. package/bin/docs/development.md +0 -71
@@ -1,409 +1,154 @@
1
- # Settings
1
+ # Settings Reference
2
2
 
3
- KnightCode uses JSON settings files with project settings overriding global settings.
3
+ This reference lists user-configurable settings, their types, defaults, and purposes. Project settings override agent-directory settings. Resource lists are combined. See [Configuration](configuration.md) for file locations and trust behavior.
4
4
 
5
- | Location | Scope |
6
- |----------|-------|
7
- | `~/.knightcode/agent/settings.json` | Global (all projects) |
8
- | `.knightcode/settings.json` | Project (current directory) |
5
+ ## Model and thinking
9
6
 
10
- Edit directly or use `/settings` for common options. To save startup model defaults interactively, use `/model` and press Ctrl+S on the desired model. To save the startup thinking level, use `/thinking` and press Ctrl+S.
11
-
12
- ## Project Trust
13
-
14
- On interactive startup, knightcode asks before trusting a project folder that contains project-local settings, resources, or project `.agents/skills` and has no saved decision for the folder or a parent folder in `~/.knightcode/agent/trust.json`. Trusting a project allows knightcode to load `.knightcode/settings.json` and `.knightcode` resources, install missing project packages, and execute project extensions.
15
-
16
- Non-interactive modes (`-p`, `--mode json`, and `--mode rpc`) do not show a trust prompt. Without an applicable saved trust decision, they use `defaultProjectTrust` from global settings: `ask` (default) and `never` ignore those project resources, while `always` trusts them. Pass `--approve`/`-a` or `--no-approve`/`-na` to override project trust for one run.
17
-
18
- If no extension or saved decision applies, `defaultProjectTrust` controls the fallback behavior. Set it to `"ask"`, `"always"`, or `"never"` in `~/.knightcode/agent/settings.json`, or change it with `/settings`.
19
-
20
- `knightcode config` and package commands use the same project trust flow, except `knightcode update` never prompts. Pass `--approve` to trust project-local settings for one command or `--no-approve` to ignore them.
21
-
22
- Use `/trust` in interactive mode to save a project trust decision for future sessions, including trust for the immediate parent folder. It writes `~/.knightcode/agent/trust.json` only; the current session is not reloaded, so restart knightcode for changes to take effect.
23
-
24
- ## All Settings
25
-
26
- ### Model & Thinking
7
+ <a id="model-cycling"></a>
27
8
 
28
9
  | Setting | Type | Default | Description |
29
- |---------|------|---------|-------------|
30
- | `defaultProvider` | string | - | Startup provider (e.g., `"anthropic"`, `"openai"`; saved with Ctrl+S in `/model`, by the IDE's model picker, or edited manually) |
31
- | `defaultModel` | string | - | Startup model ID (saved with Ctrl+S in `/model`, by the IDE's model picker, or edited manually) |
32
- | `defaultThinkingLevel` | string | - | Startup thinking level (saved with Ctrl+S in `/thinking`, or edited manually): `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"` |
33
- | `modelThinkingLevels` | object | - | Per-model startup thinking levels keyed by `"provider/modelId"`; configure from `/settings` → Default thinking level per model or edit manually |
34
- | `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in output |
35
- | `showCacheMissNotices` | boolean | `false` | Show transcript notices for significant prompt-cache misses, compaction or branch-summary usage, and provider recovery diagnostics such as dropped Anthropic thinking blocks |
36
- | `thinkingBudgets` | object | - | Custom token budgets per thinking level. Anthropic, Google, and Bedrock use these natively. OpenAI-compatible models use them when `compat.thinkingTokenBudgetField` (or `supportsThinkingTokenBudget`) is set. |
37
-
38
- #### thinkingBudgets
39
-
40
- ```json
41
- {
42
- "thinkingBudgets": {
43
- "minimal": 1024,
44
- "low": 4096,
45
- "medium": 10240,
46
- "high": 32768
47
- }
48
- }
49
- ```
50
-
51
- ### UI & Display
10
+ |---|---|---|---|
11
+ | `defaultProvider` | string | Automatic | Startup AI provider. Saved by `Ctrl+S` in `/model` and by the IDE's model picker. |
12
+ | `defaultModel` | string | Automatic | Startup model ID. Saved by `Ctrl+S` in `/model` and by the IDE's model picker. |
13
+ | `defaultThinkingLevel` | `"off" \| "minimal" \| "low" \| "medium" \| "high" \| "xhigh" \| "max"` | `"medium"` | Startup thinking level. |
14
+ | `modelThinkingLevels` | object | None | Per-model startup thinking levels keyed by exact `provider/modelId`. |
15
+ | `thinkingBudgets` | object | Built-in budgets | Token budgets for `minimal`, `low`, `medium`, and `high` thinking levels. |
16
+ | `enabledModels` | `string[]` | All available models | Model patterns used for startup selection and model cycling. Uses the same format as `--models`. |
17
+ | `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in the transcript. |
18
+ | `showCacheMissNotices` | boolean | `false` | Show notices for significant cache misses, successful cache warming, compaction usage, and provider recovery. |
19
+ | `cacheWarming` | `"off" \| "streaming" \| "idle"` | `"streaming"` | Keep eligible provider prompt caches warm during active runs or, with `"idle"`, between runs. Global setting only. |
52
20
 
53
- | Setting | Type | Default | Description |
54
- |---------|------|---------|-------------|
55
- | `theme` | string | `"dark"` | Theme name (`"dark"`, `"light"`, or custom) |
56
- | `externalEditor` | string | `$VISUAL`, then `$EDITOR`, then Notepad on Windows or `nano` elsewhere | Command for Ctrl+G external editor; takes precedence over environment variables |
57
- | `quietStartup` | boolean | `false` | Hide startup header |
58
- | `defaultProjectTrust` | string | `"ask"` | Fallback project trust behavior: `"ask"`, `"always"`, or `"never"`. Global setting only |
59
- | `collapseChangelog` | boolean | `false` | Show condensed changelog after updates |
60
- | `enableInstallTelemetry` | boolean | `true` | Send the anonymous install/update ping and selected provider attribution headers. This does not control update checks |
61
- | `enableAnalytics` | boolean | `false` | Opt-in analytics data sharing. Currently only asked for during the experimental first-time setup (`KNIGHTCODE_EXPERIMENTAL=1`) |
62
- | `trackingId` | string | - | Analytics tracking identifier, generated when `enableAnalytics` is turned on |
63
- | `doubleEscapeAction` | string | `"tree"` | Action for double-escape: `"tree"`, `"fork"`, or `"none"`. `/undo` is the quick way to a user message |
64
- | `treeFilterMode` | string | `"default"` | Default filter for `/tree`: `"default"`, `"no-tools"`, `"user-only"`, `"labeled-only"`, `"all"` |
65
- | `editorPaddingX` | number | `0` | Horizontal padding for input editor (0-3) |
66
- | `outputPad` | number | `1` | Horizontal padding for user messages, assistant messages, and thinking (0 or 1) |
67
- | `autocompleteMaxVisible` | number | `5` | Max visible items in autocomplete dropdown (3-20) |
68
- | `showHardwareCursor` | boolean | `false` | Show the terminal cursor while TUI positions it for IME support |
69
- | `tuiMode` | string | `"regular"` | Interactive TUI mode: `"regular"` or experimental `"fullscreen"`. Fullscreen captures the mouse and owns text selection, so dragging copies to the clipboard; regular leaves selection and copying to the terminal emulator (see [Text selection and copy](terminal-setup.md#text-selection-and-copy)). Changes from `/settings` apply immediately; `--tui-mode` overrides this setting at startup |
70
- | `fullscreenExitOutput` | string | `"transcript"` | Fullscreen exit output: `"transcript"` prints the final transcript and resume hint, while `"resume-hint"` restores the previous screen and prints only the resume hint. Has no effect in regular TUI mode |
71
- | `fullscreenScrollbar` | string | `"auto"` | Fullscreen transcript scrollbar: `"auto"` shows it temporarily while scrolling or while the pointer is over its rightmost-column track, `"always"` reserves that column and keeps it visible, and `"hidden"` hides it. Has no effect in regular TUI mode |
72
- | `fullscreenCopyOnSelect` | boolean | `true` | Automatically copy selected text in fullscreen mode. When disabled, selections stay highlighted and `Ctrl+X` copies the active selection. Has no effect in regular TUI mode |
73
-
74
- For VS Code, include `--wait` so knightcode resumes after the editor exits:
75
-
76
- ```json
77
- {
78
- "externalEditor": "code --wait"
79
- }
80
- ```
81
-
82
- ### Telemetry and update checks
83
-
84
- `enableInstallTelemetry` controls the anonymous install/update ping to `https://knightcode.dev/api/report-install` and KnightCode attribution headers for OpenRouter, NVIDIA NIM, and Cloudflare provider requests. Opting out disables both. It does not disable update checks; KnightCode can still fetch `https://knightcode.dev/api/latest-version` to look for the latest version.
85
-
86
- The KnightCode IDE shares this setting rather than keeping its own. Its first run and its settings write `enableInstallTelemetry` here, except while `KNIGHTCODE_TELEMETRY` is set, because the variable outranks the setting. The engine the IDE starts sends the same ping once per IDE version, with a `knightcode-ide` user agent, and records the version it was delivered for as `lastIdeVersion`. A ping that fails is retried on the next start.
87
-
88
- Set `KNIGHTCODE_SKIP_VERSION_CHECK=1` to disable the KnightCode version update check. Use `--offline` or `KNIGHTCODE_OFFLINE=1` to disable all startup network operations described here, including update checks, package update checks, and install/update telemetry.
89
-
90
- ### Network
91
-
92
- | Setting | Type | Default | Description |
93
- |---------|------|---------|-------------|
94
- | `httpProxy` | string | - | HTTP proxy URL applied as `HTTP_PROXY` and `HTTPS_PROXY`. Global setting only. |
21
+ Cache warming runs only when the model declares a cache lifetime and KnightCode estimates at least $0.05 in avoided cache-miss cost. Refresh usage counts toward session totals but does not enter model context. `/session` shows the next decision; extensions can override it with `cache_warming_decision`. See [Prompt Cache Lifetimes](models.md#prompt-cache-lifetimes).
95
22
 
96
- ```json
97
- {
98
- "httpProxy": "http://127.0.0.1:7890"
99
- }
100
- ```
23
+ See [Choose a Model](models.md) for model selection and thinking controls.
101
24
 
102
- ### Warnings
25
+ ## Interaction
103
26
 
104
27
  | Setting | Type | Default | Description |
105
- |---------|------|---------|-------------|
106
- | `warnings.anthropicExtraUsage` | boolean | `true` | Show a warning when Anthropic subscription auth may use paid extra usage |
107
-
108
- ```json
109
- {
110
- "warnings": {
111
- "anthropicExtraUsage": false
112
- }
113
- }
114
- ```
28
+ |---|---|---|---|
29
+ | `steeringMode` | `"all" \| "one-at-a-time"` | `"one-at-a-time"` | How queued steering messages are delivered. |
30
+ | `followUpMode` | `"all" \| "one-at-a-time"` | `"one-at-a-time"` | How queued follow-up messages are delivered. |
31
+ | `externalEditor` | string | `$VISUAL`, `$EDITOR`, then platform default | Command opened by the external-editor keybinding. |
32
+ | `doubleEscapeAction` | `"tree" \| "fork" \| "none"` | `"tree"` | Action for double Escape with an empty editor. `/undo` is the quick way to a user message. |
33
+ | `treeFilterMode` | `"default" \| "no-tools" \| "user-only" \| "labeled-only" \| "all"` | `"default"` | Initial filter used by `/tree`. |
34
+ | `defaultProjectTrust` | `"ask" \| "always" \| "never"` | `"ask"` | Fallback project-trust behavior. **Can only be set in agent-directory settings.** |
115
35
 
116
- ### Compaction
36
+ ## Tools
117
37
 
118
38
  | Setting | Type | Default | Description |
119
- |---------|------|---------|-------------|
120
- | `compaction.enabled` | boolean | `true` | Enable auto-compaction |
121
- | `compaction.reserveTokens` | number | `16384` | Tokens reserved for LLM response |
122
- | `compaction.keepRecentTokens` | number | `20000` | Recent tokens to keep (not summarized) |
123
- | `compaction.modelOverrides` | object | - | Per-model `reserveTokens` and `keepRecentTokens` overrides keyed by exact `"provider/modelId"` |
124
-
125
- ```json
126
- {
127
- "compaction": {
128
- "enabled": true,
129
- "reserveTokens": 16384,
130
- "keepRecentTokens": 20000
131
- }
132
- }
133
- ```
134
-
135
- #### Per-model compaction overrides
136
-
137
- ```json
138
- {
139
- "compaction": {
140
- "enabled": true,
141
- "reserveTokens": 16384,
142
- "keepRecentTokens": 20000,
143
- "modelOverrides": {
144
- "some-provider/big-model": {
145
- "reserveTokens": 400000
146
- },
147
- "local/small-model": {
148
- "reserveTokens": 2048,
149
- "keepRecentTokens": 4096
150
- }
151
- }
152
- }
153
- }
154
- ```
155
-
156
- Keys match exact, case-sensitive `provider/modelId` values, not names or glob patterns. Model IDs may contain slashes (for example, `openrouter/anthropic/claude-sonnet-4`).
157
-
158
- Each token setting resolves independently: matching model override → ordinary `compaction` setting → built-in default. In the example, `some-provider/big-model` keeps the ordinary 20000 recent tokens. Token values must be non-negative safe integers. Invalid values in the matching model override produce an error when read; only omitted fields fall back to the ordinary setting. Model override entries must be objects. Invalid ordinary token settings produce an error when read, even if the active model has a valid override. Only omitted ordinary values use built-in defaults. Zero is accepted, but `reserveTokens: 0` leaves no response margin and also sets the summarization output budget to zero.
159
-
160
- Global and project settings merge recursively **before** model lookup. A project can override one field for a model without replacing its other fields or other models. A global model-specific value takes precedence over a project-wide fallback; override the same model entry in the project to change it.
161
-
162
- `enabled` is not model-specific. The active model's token settings apply to manual compaction, automatic threshold checks (including between assistant turns), and overflow recovery. Switching models takes effect on the next check or compaction. Configure overrides in JSON; `/settings` retains the ordinary auto-compaction toggle.
163
-
164
- See [compaction.md](compaction.md) for trigger and summarization behavior.
165
-
166
- ### Branch Summary
39
+ |---|---|---|---|
40
+ | `defaultTools` | `string[]` | `read`, `bash`, `edit`, `write` | Built-in tools enabled at startup. An empty array disables all built-in tools but not extension or SDK tools. |
167
41
 
168
- | Setting | Type | Default | Description |
169
- |---------|------|---------|-------------|
170
- | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved when selecting branch history; output is capped at 4096 tokens |
171
- | `branchSummary.skipPrompt` | boolean | `false` | Skip "Summarize branch?" prompt on `/tree` navigation (defaults to no summary) |
42
+ Available built-in tools are `read`, `bash`, `powershell`, `edit`, `write`, `grep`, `find`, and `ls`. CLI tool options override this setting for one invocation. See [Command Line](cli.md#tools).
172
43
 
173
- ### Retry
44
+ The [web tools](usage.md#web-tools) `webfetch` and `websearch` are not part of `defaultTools`. `/tools` turns them on and stores their settings, including the search provider and Brave key, in `~/.knightcode/agent/tools.json`.
174
45
 
175
- | Setting | Type | Default | Description |
176
- |---------|------|---------|-------------|
177
- | `retry.enabled` | boolean | `true` | Enable automatic agent-level retry on transient errors |
178
- | `retry.maxRetries` | number | `3` | Maximum agent-level retry attempts |
179
- | `retry.baseDelayMs` | number | `2000` | Base delay for agent-level exponential backoff (2s, 4s, 8s) |
180
- | `retry.maxAgentDelayMs` | number | `60000` | Max agent-level retry delay (60s) |
181
- | `retry.provider.timeoutMs` | number | SDK default | Provider/SDK request timeout in milliseconds |
182
- | `retry.provider.maxRetries` | number | `0` | Provider/SDK retry attempts |
183
- | `retry.provider.maxRetryDelayMs` | number | `60000` | Max server-requested delay before failing (60s) |
184
-
185
- Agent-level retries use exponential backoff capped by `retry.maxAgentDelayMs`, so long retry runs stay responsive after prolonged outages.
186
-
187
- When a provider requests a retry delay longer than `retry.provider.maxRetryDelayMs`, the request fails immediately with an informative error instead of waiting silently. Set it to `0` to disable the limit.
188
-
189
- Keep `retry.provider.maxRetries` at `0` unless provider-level retries are explicitly needed. Setting it above `0` can make SDK/provider retries handle out-of-usage-limit errors before KnightCode sees them, which may block the agent until the provider quota resets in some circumstances.
190
-
191
- ```json
192
- {
193
- "retry": {
194
- "enabled": true,
195
- "maxRetries": 3,
196
- "baseDelayMs": 2000,
197
- "maxAgentDelayMs": 60000,
198
- "provider": {
199
- "timeoutMs": 3600000,
200
- "maxRetries": 0,
201
- "maxRetryDelayMs": 60000
202
- }
203
- }
204
- }
205
- ```
206
-
207
- ### Message Delivery
46
+ ## Sessions and context
208
47
 
209
48
  | Setting | Type | Default | Description |
210
- |---------|------|---------|-------------|
211
- | `steeringMode` | string | `"one-at-a-time"` | How steering messages are sent: `"all"` or `"one-at-a-time"` |
212
- | `followUpMode` | string | `"one-at-a-time"` | How follow-up messages are sent: `"all"` or `"one-at-a-time"` |
213
- | `transport` | string | `"auto"` | Preferred transport for providers that support multiple transports: `"sse"`, `"websocket"`, `"websocket-cached"`, or `"auto"` |
214
- | `httpIdleTimeoutMs` | number | `300000` | HTTP header/body idle timeout in milliseconds, also used by providers with explicit stream idle timeouts. Set to `0` to disable. |
215
- | `websocketConnectTimeoutMs` | number | `15000` | WebSocket connect/open handshake timeout in milliseconds for providers that support WebSocket transports. Set to `0` to disable. |
49
+ |---|---|---|---|
50
+ | `sessionDir` | string | Agent session directory | Session storage directory. Relative paths resolve from the working directory. `KNIGHTCODE_CODING_AGENT_SESSION_DIR` and `--session-dir` override this setting. |
216
51
 
217
- ### Terminal & Images
218
-
219
- | Setting | Type | Default | Description |
220
- |---------|------|---------|-------------|
221
- | `terminal.showImages` | boolean | `true` | Show images in terminal (if supported) |
222
- | `terminal.imageWidthCells` | number | `60` | Preferred inline image width in terminal cells |
223
- | `terminal.clearOnShrink` | boolean | `false` | Clear empty rows when content shrinks (can cause flicker) |
224
- | `terminal.hyperlinks` | boolean or `"auto"` | `"auto"` | Override OSC 8 hyperlink support (advanced, JSON-only) |
225
- | `terminal.images` | string or boolean | `"auto"` | Override image protocol support with `"kitty"`, `"iterm2"`, `false`, or `"auto"` (advanced, JSON-only) |
226
- | `terminal.trueColor` | boolean or `"auto"` | `"auto"` | Override truecolor support (advanced, JSON-only) |
227
- | `images.autoResize` | boolean | `true` | Resize images to 2000x2000 max. Applies to `@file` attachments, `read`, and images returned by tools |
228
- | `images.blockImages` | boolean | `false` | Block all images from being sent to LLM |
229
-
230
- ### Shell
52
+ ### Compaction
231
53
 
232
54
  | Setting | Type | Default | Description |
233
- |---------|------|---------|-------------|
234
- | `shellPath` | string | - | Custom shell path (e.g., for Cygwin on Windows); supports a leading `~` for the home directory |
235
- | `shellCommandPrefix` | string | - | Prefix for every bash command (e.g., `"shopt -s expand_aliases"`) |
236
- | `npmCommand` | string[] | - | Command argv used for npm package lookup/install operations (e.g., `["mise", "exec", "node@20", "--", "npm"]`) |
237
-
238
- Windows paths in JSON must use forward slashes or escaped backslashes:
55
+ |---|---|---|---|
56
+ | `compaction.enabled` | boolean | `true` | Enable automatic compaction. |
57
+ | `compaction.reserveTokens` | number | `16384` | Tokens reserved for the model response. |
58
+ | `compaction.keepRecentTokens` | number | `20000` | Recent tokens retained without summarization. |
59
+ | `compaction.modelOverrides` | object | None | Per-model token settings keyed by exact `provider/modelId`. |
239
60
 
240
- ```json
241
- {
242
- "shellPath": "C:/Program Files/Git/bin/bash.exe"
243
- }
244
- ```
61
+ <a id="per-model-compaction-overrides"></a>
245
62
 
246
- ```json
247
- {
248
- "shellPath": "C:\\Program Files\\Git\\bin\\bash.exe"
249
- }
250
- ```
63
+ Compaction token values must be non-negative safe integers. Each value resolves independently from the matching model override, then the ordinary compaction setting, then the built-in default. Project and user objects merge before model lookup.
251
64
 
252
- ```json
253
- {
254
- "npmCommand": ["mise", "exec", "node@20", "--", "npm"]
255
- }
256
- ```
65
+ See [Compaction Reference](compaction.md) for trigger, summarization, and validation behavior.
257
66
 
258
- `npmCommand` is used for all npm package-manager operations, including installs, uninstalls, and dependency installs inside git packages. User-scoped npm packages install under `~/.knightcode/agent/npm/`; project-scoped npm packages install under `.knightcode/npm/`. Use argv-style entries exactly as the process should be launched. When `npmCommand` is configured, git package dependency installs use plain `install` to avoid npm-specific flags in wrappers or alternate package managers.
259
-
260
- ### Tools
67
+ ### Branch summaries
261
68
 
262
69
  | Setting | Type | Default | Description |
263
- |---------|------|---------|-------------|
264
- | `defaultTools` | string[] | - | Built-in tools enabled initially. When omitted, KnightCode uses its standard defaults |
265
-
266
- `defaultTools` selects the built-in tools enabled at startup. Extension and SDK custom tools remain enabled. Available built-ins are `read`, `bash`, `powershell`, `edit`, `write`, `grep`, `find`, and `ls`:
267
-
268
- ```json
269
- {
270
- "defaultTools": ["bash", "edit", "write"]
271
- }
272
- ```
273
-
274
- On Windows, select `powershell` instead of `bash`, or include both:
70
+ |---|---|---|---|
71
+ | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved when summarizing branch history. |
72
+ | `branchSummary.skipPrompt` | boolean | `false` | Skip the branch-summary prompt and default to no summary. |
275
73
 
276
- ```json
277
- {
278
- "defaultTools": ["read", "powershell", "edit", "write"]
279
- }
280
- ```
74
+ ## Terminal and display
281
75
 
282
- An empty array starts with no built-in tools while preserving extension and SDK custom tools. `--tools` replaces this behavior with a strict allowlist for all tools, `--no-tools` disables all tools, and `--no-builtin-tools` disables the built-in defaults. `--exclude-tools` filters the resulting list. A project `defaultTools` array replaces the global array.
283
-
284
- The [web tools](usage.md#web-tools) `webfetch` and `websearch` are not part of `defaultTools`. `/tools` turns them on and stores their settings, including the search provider and Brave key, in `~/.knightcode/agent/tools.json`.
76
+ | Setting | Type | Default | Description |
77
+ |---|---|---|---|
78
+ | `theme` | string | Detected | Built-in or custom theme name. |
79
+ | `quietStartup` | boolean | `false` | Hide the startup header. |
80
+ | `tuiMode` | `"regular" \| "fullscreen"` | `"regular"` | Interactive terminal UI mode. Fullscreen captures the mouse and owns text selection, so dragging copies to the clipboard; regular leaves selection and copying to the terminal emulator (see [Text selection and copy](terminal-setup.md#text-selection-and-copy)). |
81
+ | `fullscreenExitOutput` | `"transcript" \| "resume-hint"` | `"transcript"` | Output printed when fullscreen mode exits. |
82
+ | `fullscreenScrollbar` | `"auto" \| "always" \| "hidden"` | `"auto"` | Fullscreen transcript scrollbar behavior. |
83
+ | `fullscreenCopyOnSelect` | boolean | `true` | Copy selected text automatically in fullscreen mode. When disabled, selections stay highlighted and `Ctrl+X` copies the active selection. Has no effect in regular mode. |
84
+ | `editorPaddingX` | number | `0` | Horizontal editor padding from 0 to 3 cells. |
85
+ | `outputPad` | `0 \| 1` | `1` | Horizontal transcript padding. |
86
+ | `autocompleteMaxVisible` | number | `5` | Visible autocomplete entries, from 3 to 20. |
87
+ | `showHardwareCursor` | boolean | `false` | Show the terminal cursor while KnightCode positions it for input methods. |
88
+ | `terminal.showImages` | boolean | `true` | Display inline images when supported. |
89
+ | `terminal.imageWidthCells` | number | `60` | Preferred inline image width in terminal cells. |
90
+ | `terminal.clearOnShrink` | boolean | `false` | Clear empty rows when rendered content shrinks. |
91
+ | `terminal.showTerminalProgress` | boolean | `false` | Show OSC 9;4 progress in the terminal tab. |
92
+ | `terminal.hyperlinks` | `boolean \| "auto"` | `"auto"` | Override OSC 8 hyperlink detection. |
93
+ | `terminal.images` | `"kitty" \| "iterm2" \| "auto" \| false` | `"auto"` | Override inline-image protocol detection. |
94
+ | `terminal.trueColor` | `boolean \| "auto"` | `"auto"` | Override true-color detection. |
95
+ | `images.autoResize` | boolean | `true` | Resize images to at most 2000 by 2000 pixels before sending them to a model. |
96
+ | `images.blockImages` | boolean | `false` | Prevent images from being sent to models. |
97
+ | `markdown.codeBlockIndent` | string | `" "` | Prefix used to indent rendered code blocks. |
98
+ | `markdown.mermaid` | `"off" \| "final" \| "streaming"` | `"streaming"` | Mermaid rendering mode. |
99
+
100
+ See [Themes](themes.md) and [Terminal Setup](terminal-setup.md) for format and platform details.
101
+
102
+ ## Network and retries
285
103
 
286
- ### Sessions
104
+ | Setting | Type | Default | Description |
105
+ |---|---|---|---|
106
+ | `transport` | `"auto" \| "sse" \| "websocket" \| "websocket-cached"` | `"auto"` | Preferred transport for AI providers that support multiple transports. |
107
+ | `httpProxy` | string | None | Proxy URL applied as `HTTP_PROXY` and `HTTPS_PROXY` for KnightCode-managed HTTP clients. **Can only be set in agent-directory settings.** |
108
+ | `httpIdleTimeoutMs` | number | `300000` | HTTP header and body idle timeout in milliseconds. Set to `0` to disable. |
109
+ | `websocketConnectTimeoutMs` | number | `15000` | WebSocket connection timeout in milliseconds. Set to `0` to disable. |
110
+ | `retry.enabled` | boolean | `true` | Enable automatic agent-level retry for transient failures. |
111
+ | `retry.maxRetries` | number | `3` | Maximum agent-level retry attempts. |
112
+ | `retry.baseDelayMs` | number | `2000` | Initial exponential-backoff delay in milliseconds. |
113
+ | `retry.maxAgentDelayMs` | number | `60000` | Maximum agent-level retry delay in milliseconds. |
114
+ | `retry.provider.timeoutMs` | number | `httpIdleTimeoutMs` | Provider request timeout in milliseconds. |
115
+ | `retry.provider.maxRetries` | number | `0` | Provider-level retry attempts. |
116
+ | `retry.provider.maxRetryDelayMs` | number | `60000` | Maximum server-requested delay in milliseconds. Set to `0` to disable the limit. |
117
+
118
+ Keep `retry.provider.maxRetries` at `0` unless provider-level retries are required. Provider retries can delay KnightCode from handling quota and usage-limit errors itself.
119
+
120
+ ## Shell
287
121
 
288
122
  | Setting | Type | Default | Description |
289
- |---------|------|---------|-------------|
290
- | `sessionDir` | string | - | Directory where session files are stored. Accepts absolute or relative paths, plus `~`. |
123
+ |---|---|---|---|
124
+ | `shellPath` | string | Platform default | Custom shell executable path. Supports a leading `~`. |
125
+ | `shellCommandPrefix` | string | None | Prefix prepended to every shell command. |
126
+ | `npmCommand` | `string[]` | `npm` | Command and arguments used for npm package lookup and installation. |
291
127
 
292
- ```json
293
- { "sessionDir": ".knightcode/sessions" }
294
- ```
128
+ See [Shell aliases](shell-aliases.md) for shell setup and [KnightCode Packages](packages.md) for package-manager behavior.
295
129
 
296
- When multiple sources specify a session directory, precedence is `--session-dir`, `KNIGHTCODE_CODING_AGENT_SESSION_DIR`, then `sessionDir` in settings.json.
130
+ ## Resources
297
131
 
298
- ### Model Cycling
132
+ Resource paths in user settings resolve from the agent directory. Paths in project settings resolve from the project `.knightcode` directory. Absolute paths and `~` are supported.
299
133
 
300
134
  | Setting | Type | Default | Description |
301
- |---------|------|---------|-------------|
302
- | `enabledModels` | string[] | - | Model patterns for Ctrl+P cycling (same format as `--models` CLI flag) |
135
+ |---|---|---|---|
136
+ | `packages` | array | `[]` | npm, git, or local KnightCode package sources. See [KnightCode Packages](packages.md). |
137
+ | `extensions` | `string[]` | `[]` | Extension files or directories. |
138
+ | `skills` | `string[]` | `[]` | Skill files or directories. |
139
+ | `prompts` | `string[]` | `[]` | Prompt-template files or directories. |
140
+ | `themes` | `string[]` | `[]` | Theme files or directories. |
141
+ | `enableSkillCommands` | boolean | `true` | Register skills as `/skill:name` commands. |
303
142
 
304
- ```json
305
- {
306
- "enabledModels": ["claude-*", "gpt-4o", "gemini-2*"]
307
- }
308
- ```
143
+ Resource arrays support glob exclusions with `!pattern`, exact inclusion with `+path`, and exact exclusion with `-path`. KnightCode loads resources listed in both user-level and project settings.
309
144
 
310
- ### Markdown
145
+ ## Updates, telemetry, and warnings
311
146
 
312
147
  | Setting | Type | Default | Description |
313
- |---------|------|---------|-------------|
314
- | `markdown.codeBlockIndent` | string | `" "` | Indentation for code blocks |
315
- | `markdown.mermaid` | string | `"streaming"` | Mermaid rendering mode: `"off"`, `"final"`, or `"streaming"` |
148
+ |---|---|---|---|
149
+ | `collapseChangelog` | boolean | `false` | Show a condensed changelog after an update. |
150
+ | `enableInstallTelemetry` | boolean | `true` | Enable anonymous install/update reporting and selected provider attribution headers. Does not control update checks. |
151
+ | `enableAnalytics` | boolean | `false` | Opt in to analytics data sharing. Currently used only by the experimental first-run setup. |
152
+ | `warnings.anthropicExtraUsage` | boolean | `true` | Warn when Anthropic subscription authentication may use paid extra usage. |
316
153
 
317
- ### Resources
318
-
319
- These settings define where to load extensions, skills, prompts, and themes from.
320
-
321
- Paths in `~/.knightcode/agent/settings.json` resolve relative to `~/.knightcode/agent`. Paths in `.knightcode/settings.json` resolve relative to `.knightcode`. Absolute paths and `~` are supported.
322
-
323
- | Setting | Type | Default | Description |
324
- |---------|------|---------|-------------|
325
- | `packages` | array | `[]` | npm/git packages to load resources from |
326
- | `extensions` | string[] | `[]` | Local extension file paths or directories |
327
- | `skills` | string[] | `[]` | Local skill file paths or directories |
328
- | `prompts` | string[] | `[]` | Local prompt template paths or directories |
329
- | `themes` | string[] | `[]` | Local theme file paths or directories |
330
- | `enableSkillCommands` | boolean | `true` | Register skills as `/skill:name` commands |
331
-
332
- Arrays support glob patterns and exclusions. Use `!pattern` to exclude. Use `+path` to force-include an exact path and `-path` to force-exclude an exact path.
333
-
334
- #### packages
335
-
336
- String form loads all resources from a package:
337
-
338
- ```json
339
- {
340
- "packages": ["knightcode-skills", "@org/my-extension"]
341
- }
342
- ```
343
-
344
- Object form filters which resources to load:
345
-
346
- ```json
347
- {
348
- "packages": [
349
- {
350
- "source": "knightcode-skills",
351
- "skills": ["brave-search", "transcribe"],
352
- "extensions": []
353
- }
354
- ]
355
- }
356
- ```
357
-
358
- See [packages.md](packages.md) for package management details.
359
-
360
- ## Example
361
-
362
- ```json
363
- {
364
- "defaultProvider": "anthropic",
365
- "defaultModel": "claude-sonnet-4-20250514",
366
- "defaultThinkingLevel": "medium",
367
- "modelThinkingLevels": {
368
- "anthropic/claude-sonnet-4-20250514": "high"
369
- },
370
- "theme": "dark",
371
- "compaction": {
372
- "enabled": true,
373
- "reserveTokens": 16384,
374
- "keepRecentTokens": 20000
375
- },
376
- "retry": {
377
- "enabled": true,
378
- "maxRetries": 3
379
- },
380
- "enabledModels": ["claude-*", "gpt-4o"],
381
- "warnings": {
382
- "anthropicExtraUsage": true
383
- },
384
- "packages": ["knightcode-skills"]
385
- }
386
- ```
387
-
388
- ## Project Overrides
389
-
390
- Project settings (`.knightcode/settings.json`) override global settings. Nested objects are merged:
391
-
392
- ```json
393
- // ~/.knightcode/agent/settings.json (global)
394
- {
395
- "theme": "dark",
396
- "compaction": { "enabled": true, "reserveTokens": 16384 }
397
- }
398
-
399
- // .knightcode/settings.json (project)
400
- {
401
- "compaction": { "reserveTokens": 8192 }
402
- }
403
-
404
- // Result
405
- {
406
- "theme": "dark",
407
- "compaction": { "enabled": true, "reserveTokens": 8192 }
408
- }
409
- ```
154
+ The KnightCode IDE shares `enableInstallTelemetry` rather than keeping its own. Its first run and its settings write `enableInstallTelemetry` here, except while `KNIGHTCODE_TELEMETRY` is set, because the variable outranks the setting. The engine the IDE starts sends the same ping once per IDE version, with a `knightcode-ide` user agent, and records the version it was delivered for as `lastIdeVersion`. A ping that fails is retried on the next start.
@@ -1,13 +1,93 @@
1
- # Shell Aliases
1
+ # Configure shell commands
2
2
 
3
- KnightCode runs bash in non-interactive mode (`bash -c`), which doesn't expand aliases by default.
3
+ KnightCode starts a separate non-interactive shell process for each Bash command. Non-interactive Bash does not expand aliases by default and usually does not load the same startup files as an interactive terminal.
4
4
 
5
- To enable your shell aliases, add to `~/.knightcode/agent/settings.json`:
5
+ Use `shellPath` to choose the Bash executable and `shellCommandPrefix` to run setup before each command.
6
+
7
+ ## Understand which shell KnightCode uses
8
+
9
+ | Command source | Shell |
10
+ |---|---|
11
+ | Model calls the built-in `bash` tool | KnightCode's resolved Bash executable |
12
+ | You enter `!command` or `!!command` | The same resolved Bash executable |
13
+ | Model calls the optional `powershell` tool | PowerShell 7 (`pwsh.exe`) or Windows PowerShell |
14
+ | An extension provides or replaces a shell tool | The operations implemented by that extension |
15
+
16
+ KnightCode normally invokes Bash with `bash -c`. On Unix systems, it uses `/bin/bash`, then `bash` on `PATH`, and finally `sh` when Bash is unavailable. Native Windows first checks the configured path, then Git Bash, then `bash.exe` on `PATH`.
17
+
18
+ ## Choose a Bash executable
19
+
20
+ Set `shellPath` in `~/.knightcode/agent/settings.json` when KnightCode should use a specific executable:
21
+
22
+ ```json
23
+ {
24
+ "shellPath": "~/.local/bin/bash"
25
+ }
26
+ ```
27
+
28
+ On Windows, use forward slashes or escape backslashes:
6
29
 
7
30
  ```json
8
31
  {
9
- "shellCommandPrefix": "shopt -s expand_aliases\neval \"$(grep '^alias ' ~/.zshrc)\""
32
+ "shellPath": "C:\\cygwin64\\bin\\bash.exe"
10
33
  }
11
34
  ```
12
35
 
13
- Adjust the path (`~/.zshrc`, `~/.bashrc`, etc.) to match your shell config.
36
+ Run `/reload` after changing the setting. See [Run KnightCode on Windows](windows.md) for the native Windows defaults.
37
+
38
+ ## Run setup before every Bash command
39
+
40
+ Set `shellCommandPrefix` to prepend shell setup to both the built-in `bash` tool and user-entered `!` or `!!` commands:
41
+
42
+ ```json
43
+ {
44
+ "shellCommandPrefix": "export CI=1"
45
+ }
46
+ ```
47
+
48
+ KnightCode joins the prefix and requested command with a newline. The prefix runs again for every command, so keep it fast and free of interactive prompts.
49
+
50
+ ## Enable Bash aliases
51
+
52
+ Store aliases needed by KnightCode in a Bash-compatible file instead of parsing an entire interactive shell configuration.
53
+
54
+ Create `~/.bash_aliases`:
55
+
56
+ ```bash
57
+ alias ll='ls -la'
58
+ alias gs='git status --short'
59
+ ```
60
+
61
+ Then configure KnightCode to enable alias expansion and load the file:
62
+
63
+ ```json
64
+ {
65
+ "shellCommandPrefix": "shopt -s expand_aliases\nsource ~/.bash_aliases"
66
+ }
67
+ ```
68
+
69
+ Run `/reload`, then verify the alias through KnightCode:
70
+
71
+ ```text
72
+ !ll
73
+ ```
74
+
75
+ The command should produce the same listing as `ls -la`.
76
+
77
+ Aliases must use Bash-compatible syntax. Do not source an arbitrary `.zshrc` into Bash because zsh options, functions, and plugins may not parse or behave correctly there.
78
+
79
+ ## Troubleshooting
80
+
81
+ ### The prefix works for `!` but not for an extension tool
82
+
83
+ `shellCommandPrefix` configures KnightCode's built-in Bash execution. An extension that replaces the `bash` tool or provides its own shell operations controls its own setup. Check that extension's documentation.
84
+
85
+ ### `shopt` is not found
86
+
87
+ KnightCode has fallen back to `sh` or `shellPath` points to a non-Bash shell. Install Bash or set `shellPath` to a Bash executable before using Bash-specific setup such as `shopt`.
88
+
89
+ ### A setup command waits for input
90
+
91
+ Remove interactive commands from `shellCommandPrefix`. The prefix runs in a non-interactive process before every Bash command.
92
+
93
+ For the complete setting definitions, see [Shell settings](settings.md#shell).