@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.
- package/bin/CHANGELOG.md +88 -0
- package/bin/README.md +52 -19
- package/bin/docs/cli-integration.md +106 -0
- package/bin/docs/cli.md +270 -0
- package/bin/docs/compaction.md +56 -37
- package/bin/docs/configuration.md +46 -0
- package/bin/docs/containerization.md +86 -54
- package/bin/docs/custom-provider.md +132 -782
- package/bin/docs/docs.json +143 -103
- package/bin/docs/environment-variables.md +5 -3
- package/bin/docs/extensions.md +134 -2937
- package/bin/docs/how-knightcode-works.md +49 -0
- package/bin/docs/index.md +24 -69
- package/bin/docs/json.md +193 -65
- package/bin/docs/keybindings.md +56 -101
- package/bin/docs/llama-cpp.md +3 -3
- package/bin/docs/message-types.md +261 -0
- package/bin/docs/models.md +65 -517
- package/bin/docs/packages.md +66 -167
- package/bin/docs/prompt-templates.md +31 -68
- package/bin/docs/providers.md +103 -233
- package/bin/docs/quickstart.md +61 -106
- package/bin/docs/rpc-commands.md +854 -0
- package/bin/docs/rpc-extension-ui.md +200 -0
- package/bin/docs/rpc.md +129 -1556
- package/bin/docs/sdk.md +76 -1160
- package/bin/docs/security.md +70 -32
- package/bin/docs/session-format.md +39 -216
- package/bin/docs/sessions.md +43 -121
- package/bin/docs/settings.md +112 -367
- package/bin/docs/shell-aliases.md +85 -5
- package/bin/docs/skills.md +51 -189
- package/bin/docs/slash-commands.md +63 -0
- package/bin/docs/terminal-setup.md +107 -79
- package/bin/docs/termux.md +74 -83
- package/bin/docs/themes.md +68 -280
- package/bin/docs/tmux.md +31 -39
- package/bin/docs/tui.md +69 -923
- package/bin/docs/usage.md +79 -285
- package/bin/docs/windows.md +43 -17
- package/bin/export-html/template.js +6 -1
- package/bin/knightcode +2 -2
- package/bin/package.json +6 -6
- package/package.json +1 -1
- package/bin/docs/development.md +0 -71
package/bin/docs/skills.md
CHANGED
|
@@ -1,231 +1,93 @@
|
|
|
1
|
-
> knightcode can create skills. Ask it to build one for your use case.
|
|
2
|
-
|
|
3
1
|
# Skills
|
|
4
2
|
|
|
5
|
-
Skills
|
|
6
|
-
|
|
7
|
-
KnightCode implements the [Agent Skills standard](https://agentskills.io/specification), warning about most violations but remaining lenient. KnightCode allows skill names to differ from their parent directory even though the standard disallows it; that rule is suboptimal for shared skill directories used across multiple agent harnesses.
|
|
8
|
-
|
|
9
|
-
## Table of Contents
|
|
10
|
-
|
|
11
|
-
- [Locations](#locations)
|
|
12
|
-
- [How Skills Work](#how-skills-work)
|
|
13
|
-
- [Skill Commands](#skill-commands)
|
|
14
|
-
- [Skill Structure](#skill-structure)
|
|
15
|
-
- [Frontmatter](#frontmatter)
|
|
16
|
-
- [Validation](#validation)
|
|
17
|
-
- [Example](#example)
|
|
18
|
-
- [Skill Repositories](#skill-repositories)
|
|
19
|
-
|
|
20
|
-
## Locations
|
|
21
|
-
|
|
22
|
-
> **Security:** Skills can instruct the model to perform any action and may include executable code the model invokes. Review skill content before use.
|
|
23
|
-
|
|
24
|
-
KnightCode loads skills from:
|
|
25
|
-
|
|
26
|
-
- Global:
|
|
27
|
-
- `~/.knightcode/agent/skills/`
|
|
28
|
-
- `~/.agents/skills/`
|
|
29
|
-
- Project (only after the project is trusted):
|
|
30
|
-
- `.knightcode/skills/`
|
|
31
|
-
- `.agents/skills/` in `cwd` and ancestor directories (up to git repo root, or filesystem root when not in a repo)
|
|
32
|
-
- Packages: `skills/` directories or `knightcode.skills` entries in `package.json`
|
|
33
|
-
- Settings: `skills` array with files or directories
|
|
34
|
-
- CLI: `--skill <path>` (repeatable, additive even with `--no-skills`)
|
|
35
|
-
|
|
36
|
-
Discovery rules:
|
|
37
|
-
- In `~/.knightcode/agent/skills/` and `.knightcode/skills/`, direct root `.md` files are discovered as individual skills when they have valid skill frontmatter with a non-empty `description`
|
|
38
|
-
- In all skill locations, directories containing `SKILL.md` are discovered recursively
|
|
39
|
-
- In `~/.agents/skills/` and project `.agents/skills/`, root `.md` files are ignored, but nested `.md` files in grouping folders are discovered when they declare skill frontmatter
|
|
40
|
-
- Root Markdown files other than `SKILL.md` that do not look like skills are ignored silently
|
|
41
|
-
|
|
42
|
-
Disable discovery with `--no-skills` (explicit `--skill` paths still load).
|
|
43
|
-
|
|
44
|
-
### Using Skills from Other Harnesses
|
|
45
|
-
|
|
46
|
-
To use skills from Claude Code or OpenAI Codex, add their directories to settings:
|
|
47
|
-
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"skills": [
|
|
51
|
-
"~/.claude/skills",
|
|
52
|
-
"~/.codex/skills"
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
For project-level Claude Code skills, add to `.knightcode/settings.json`:
|
|
58
|
-
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"skills": ["../.claude/skills"]
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## How Skills Work
|
|
66
|
-
|
|
67
|
-
1. At startup, knightcode scans skill locations and extracts names and descriptions
|
|
68
|
-
2. The system prompt includes available skills in XML format per the [specification](https://agentskills.io/integrate-skills)
|
|
69
|
-
3. When a task matches, the agent uses `read`, or `bash` when `read` is unavailable, to load the full SKILL.md (models don't always do this; use prompting or `/skill:name` to force it)
|
|
70
|
-
4. The agent follows the instructions, using relative paths to reference scripts and assets
|
|
71
|
-
|
|
72
|
-
This is progressive disclosure: only descriptions are always in context, full instructions load on-demand.
|
|
73
|
-
|
|
74
|
-
## Skill Commands
|
|
75
|
-
|
|
76
|
-
Skills register as `/skill:name` commands:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
/skill:brave-search # Load and execute the skill
|
|
80
|
-
/skill:pdf-tools extract # Load skill with arguments
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Arguments after the command are appended to the skill content as `User: <args>`.
|
|
3
|
+
Skills give KnightCode specialized instructions and supporting files for a particular kind of work. KnightCode advertises each available skill by name and description, then loads its full instructions only when the task calls for them.
|
|
84
4
|
|
|
85
|
-
|
|
5
|
+
Use a skill when a workflow needs more context than a prompt template but does not need a new executable integration point. Skills can bundle scripts, references, and assets alongside their instructions.
|
|
86
6
|
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
"enableSkillCommands": true
|
|
90
|
-
}
|
|
91
|
-
```
|
|
7
|
+
KnightCode implements the [Agent Skills specification](https://agentskills.io/specification). Most invalid fields produce warnings rather than stopping startup.
|
|
92
8
|
|
|
93
|
-
##
|
|
9
|
+
## Create a skill
|
|
94
10
|
|
|
95
|
-
A skill is a directory
|
|
11
|
+
A skill is a directory containing `SKILL.md`:
|
|
96
12
|
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
├── SKILL.md
|
|
100
|
-
├── scripts/
|
|
101
|
-
│ └──
|
|
102
|
-
├── references/
|
|
103
|
-
│ └──
|
|
13
|
+
```text
|
|
14
|
+
pdf-tools/
|
|
15
|
+
├── SKILL.md
|
|
16
|
+
├── scripts/
|
|
17
|
+
│ └── extract.sh
|
|
18
|
+
├── references/
|
|
19
|
+
│ └── formats.md
|
|
104
20
|
└── assets/
|
|
105
21
|
└── template.json
|
|
106
22
|
```
|
|
107
23
|
|
|
108
|
-
|
|
24
|
+
Start `SKILL.md` with frontmatter followed by direct instructions:
|
|
109
25
|
|
|
110
|
-
|
|
26
|
+
```markdown
|
|
111
27
|
---
|
|
112
|
-
name:
|
|
113
|
-
description:
|
|
28
|
+
name: pdf-tools
|
|
29
|
+
description: Extract text and tables from PDF files. Use when reading, converting, or inspecting PDFs.
|
|
114
30
|
---
|
|
115
31
|
|
|
116
|
-
#
|
|
32
|
+
# PDF tools
|
|
117
33
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Run once before first use:
|
|
121
|
-
```bash
|
|
122
|
-
cd /path/to/skill && npm install
|
|
34
|
+
Read `references/formats.md` before converting a document. Run scripts relative to this skill directory.
|
|
123
35
|
```
|
|
124
36
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
./scripts/process.sh <input>
|
|
129
|
-
```
|
|
130
|
-
````
|
|
131
|
-
|
|
132
|
-
Use relative paths from the skill directory:
|
|
133
|
-
|
|
134
|
-
```markdown
|
|
135
|
-
See [the reference guide](references/REFERENCE.md) for details.
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## Frontmatter
|
|
139
|
-
|
|
140
|
-
Per the [Agent Skills specification](https://agentskills.io/specification#frontmatter-required):
|
|
37
|
+
The description determines when the model considers loading the skill. State both what the skill does and when it applies. Avoid descriptions such as “Helps with PDFs,” which do not provide enough routing information.
|
|
141
38
|
|
|
142
|
-
|
|
143
|
-
|-------|----------|-------------|
|
|
144
|
-
| `name` | Yes | Max 64 chars. Lowercase a-z, 0-9, hyphens. Unlike the standard, KnightCode does not require this to match the parent directory because that standard requirement is suboptimal for shared skill directories. |
|
|
145
|
-
| `description` | Yes | Max 1024 chars. What the skill does and when to use it. |
|
|
146
|
-
| `license` | No | License name or reference to bundled file. |
|
|
147
|
-
| `compatibility` | No | Max 500 chars. Environment requirements. |
|
|
148
|
-
| `metadata` | No | Arbitrary key-value mapping. |
|
|
149
|
-
| `allowed-tools` | No | Space-delimited list of pre-approved tools (experimental). |
|
|
150
|
-
| `disable-model-invocation` | No | When `true`, skill is hidden from system prompt. Users must use `/skill:name`. |
|
|
39
|
+
Use relative paths from the skill directory when referring to bundled files. KnightCode tells the model where the skill lives so it can resolve those paths.
|
|
151
40
|
|
|
152
|
-
|
|
41
|
+
## Understand how skills load
|
|
153
42
|
|
|
154
|
-
|
|
155
|
-
- Lowercase letters, numbers, hyphens only
|
|
156
|
-
- No leading/trailing hyphens
|
|
157
|
-
- No consecutive hyphens
|
|
158
|
-
KnightCode does not require the name to match the parent directory. The Agent Skills standard does, but that requirement is suboptimal for shared skill directories used by multiple tools.
|
|
43
|
+
At startup, KnightCode scans configured skill locations and adds each skill’s name, description, and path to the system prompt. It does not add the full instructions.
|
|
159
44
|
|
|
160
|
-
|
|
161
|
-
Invalid: `PDF-Processing`, `-pdf`, `pdf--processing`
|
|
45
|
+
When a task matches, the model reads `SKILL.md` and follows its instructions. This keeps detailed guidance out of context until it is needed. A model might fail to load a relevant skill, so use `/skill:name` when you need to force it.
|
|
162
46
|
|
|
163
|
-
|
|
47
|
+
Arguments after `/skill:name` are appended to the loaded instructions as a user request:
|
|
164
48
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
Good:
|
|
168
|
-
```yaml
|
|
169
|
-
description: Extracts text and tables from PDF files, fills PDF forms, and merges multiple PDFs. Use when working with PDF documents.
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
Poor:
|
|
173
|
-
```yaml
|
|
174
|
-
description: Helps with PDFs.
|
|
49
|
+
```text
|
|
50
|
+
/skill:pdf-tools extract report.pdf
|
|
175
51
|
```
|
|
176
52
|
|
|
177
|
-
|
|
53
|
+
Set `disable-model-invocation: true` in frontmatter when a skill should be available only through its explicit command. The `enableSkillCommands` [setting](settings.md) controls whether skill commands appear in interactive command discovery; manually entered `/skill:name` commands still work.
|
|
178
54
|
|
|
179
|
-
|
|
55
|
+
<a id="choose-where-it-loads"></a>
|
|
180
56
|
|
|
181
|
-
|
|
182
|
-
- Name starts/ends with hyphen or has consecutive hyphens
|
|
183
|
-
- Description exceeds 1024 characters
|
|
57
|
+
## Add it to KnightCode
|
|
184
58
|
|
|
185
|
-
|
|
59
|
+
Place the skill in your user or project skills directory. Directories containing `SKILL.md` are discovered recursively.
|
|
186
60
|
|
|
187
|
-
|
|
61
|
+
KnightCode also supports the Agent Skills locations `~/.agents/skills/` and `.agents/skills/`. Project `.agents/skills/` directories are discovered from the working directory through its ancestors, stopping at the repository root when one exists.
|
|
188
62
|
|
|
189
|
-
|
|
63
|
+
KnightCode accepts some standalone Markdown skills, but a directory containing `SKILL.md` is the portable form and should be preferred. See [Settings](settings.md#resources) and [KnightCode Packages](packages.md) for additional locations.
|
|
190
64
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
```
|
|
194
|
-
brave-search/
|
|
195
|
-
├── SKILL.md
|
|
196
|
-
├── search.js
|
|
197
|
-
└── content.js
|
|
198
|
-
```
|
|
65
|
+
Project skills can instruct the model to run scripts or modify files. Review unfamiliar skills and their supporting files before granting project trust.
|
|
199
66
|
|
|
200
|
-
|
|
201
|
-
````markdown
|
|
202
|
-
---
|
|
203
|
-
name: brave-search
|
|
204
|
-
description: Web search and content extraction via Brave Search API. Use for searching documentation, facts, or any web content.
|
|
205
|
-
---
|
|
67
|
+
## Write portable frontmatter
|
|
206
68
|
|
|
207
|
-
|
|
69
|
+
The Agent Skills specification defines these fields:
|
|
208
70
|
|
|
209
|
-
|
|
71
|
+
| Field | Purpose |
|
|
72
|
+
|---|---|
|
|
73
|
+
| `name` | Command and display name |
|
|
74
|
+
| `description` | Routing description shown to the model |
|
|
75
|
+
| `license` | License name or bundled license file |
|
|
76
|
+
| `compatibility` | Environment requirements |
|
|
77
|
+
| `metadata` | Additional key-value metadata |
|
|
78
|
+
| `allowed-tools` | Experimental pre-approved tool list |
|
|
79
|
+
| `disable-model-invocation` | Hide the skill from automatic model selection |
|
|
210
80
|
|
|
211
|
-
|
|
212
|
-
cd /path/to/brave-search && npm install
|
|
213
|
-
```
|
|
81
|
+
Names use lowercase letters, numbers, and hyphens, with no leading, trailing, or consecutive hyphens. They can contain at most 64 characters; descriptions can contain at most 1024.
|
|
214
82
|
|
|
215
|
-
|
|
83
|
+
KnightCode neither requires nor warns when the declared name differs from the parent directory. Other Agent Skills implementations may enforce that requirement, so matching names remain the portable choice.
|
|
216
84
|
|
|
217
|
-
|
|
218
|
-
./search.js "query" # Basic search
|
|
219
|
-
./search.js "query" --content # Include page content
|
|
220
|
-
```
|
|
85
|
+
Malformed `SKILL.md` files and declared skills without descriptions are not loaded. Name collisions keep the first discovered skill and produce a warning.
|
|
221
86
|
|
|
222
|
-
##
|
|
87
|
+
## Validate and share a skill
|
|
223
88
|
|
|
224
|
-
|
|
225
|
-
./content.js https://example.com
|
|
226
|
-
```
|
|
227
|
-
````
|
|
89
|
+
Run KnightCode from a location where the skill is discoverable, then inspect the startup diagnostics and `/skill:name` command. Run `/reload` after editing a skill during an active session.
|
|
228
90
|
|
|
229
|
-
|
|
91
|
+
Use a [KnightCode package](packages.md) to distribute one or more skills through npm or git. Keep environment setup inside the skill and declare any required runtime dependencies in the package.
|
|
230
92
|
|
|
231
|
-
|
|
93
|
+
For examples, see the [Anthropic skills collection](https://github.com/anthropics/skills).
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Slash commands
|
|
2
|
+
|
|
3
|
+
Type `/` in KnightCode's terminal editor to search the commands available in the current session. This page lists the built-in commands in the current KnightCode release.
|
|
4
|
+
|
|
5
|
+
Extensions, prompt templates, and skills can add commands. The command menu in KnightCode is therefore the exact reference for the resources loaded in your session.
|
|
6
|
+
|
|
7
|
+
## Models and settings
|
|
8
|
+
|
|
9
|
+
| Command | Description |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `/settings` | Open settings |
|
|
12
|
+
| `/model [provider/model]` | Select a model |
|
|
13
|
+
| `/thinking [level]` | Set the thinking level |
|
|
14
|
+
| `/scoped-models` | Configure the models used by interactive cycling |
|
|
15
|
+
| `/login [provider]` | Add provider authentication |
|
|
16
|
+
| `/logout` | Remove provider authentication |
|
|
17
|
+
| `/tools` | Turn `webfetch`, `websearch`, and the [scratchpad](usage.md#scratchpad) off, on for this session, or on by default; pick the search provider and store its key |
|
|
18
|
+
| `/llama` | Manage models on the configured llama.cpp router |
|
|
19
|
+
|
|
20
|
+
## Sessions and context
|
|
21
|
+
|
|
22
|
+
| Command | Description |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `/new` | Start a new session |
|
|
25
|
+
| `/resume` | Switch to another saved session |
|
|
26
|
+
| `/name [name]` | Set the session display name, or show the current name when omitted |
|
|
27
|
+
| `/session` | Show current session information and statistics |
|
|
28
|
+
| `/tree` | Navigate the session tree |
|
|
29
|
+
| `/fork` | Create a new session from an earlier user message |
|
|
30
|
+
| `/clone` | Duplicate the current session at its current position |
|
|
31
|
+
| `/undo` | Go back to an earlier user message; optionally restore the files edited after it |
|
|
32
|
+
| `/compact [instructions]` | Compact the current context, optionally with custom instructions |
|
|
33
|
+
| `/import <path>` | Import and resume a JSONL session |
|
|
34
|
+
|
|
35
|
+
## Export and share
|
|
36
|
+
|
|
37
|
+
| Command | Description |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `/copy` | Copy the last assistant message |
|
|
40
|
+
| `/export [path]` | Export the session as HTML or JSONL |
|
|
41
|
+
| `/share` | Upload the session and return a viewer link |
|
|
42
|
+
| `/remote` | Publish this session to a live web link; see [Remote sessions](remote.md) |
|
|
43
|
+
| `/bug [description]` | Prepare a private bug report for the KnightCode developers |
|
|
44
|
+
|
|
45
|
+
Review a session before exporting or sharing it. Sessions can contain prompts, tool arguments, command output, file contents, and credentials exposed during the conversation.
|
|
46
|
+
|
|
47
|
+
## Runtime and project
|
|
48
|
+
|
|
49
|
+
| Command | Description |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `/trust` | Save a project trust decision for future KnightCode processes |
|
|
52
|
+
| `/reload` | Reload keybindings, extensions, skills, templates, themes, and context files |
|
|
53
|
+
| `/hotkeys` | Show active keyboard shortcuts |
|
|
54
|
+
| `/changelog` | Show changelog entries |
|
|
55
|
+
| `/quit` | Quit KnightCode |
|
|
56
|
+
|
|
57
|
+
## Commands added by resources
|
|
58
|
+
|
|
59
|
+
- Extensions can register commands with their own arguments and completion behavior.
|
|
60
|
+
- Each prompt template is available under its template name.
|
|
61
|
+
- Skills are available as `/skill:name` when skill commands are enabled.
|
|
62
|
+
|
|
63
|
+
Use `/reload` after adding or changing a discovered command resource. See [Extensions](extensions.md), [Prompt Templates](prompt-templates.md), and [Skills](skills.md) for their loading and naming rules.
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Configure your terminal
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Most modern terminals work with KnightCode without additional setup. Use this page when modified keys, scrolling, links, images, colors, or input-method editor (IME) positioning do not behave as expected.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
KnightCode uses extended-key protocols so terminals can distinguish combinations such as `Shift+Enter` and `Alt+Enter` from plain `Enter`. Terminal proxies, multiplexers, and built-in IDE terminals can change or discard that information.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Troubleshooting
|
|
8
8
|
|
|
9
|
-
|
|
|
10
|
-
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
9
|
+
| Symptom | Start here |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `Shift+Enter` submits instead of inserting a line | Your terminal's section below; for tmux, see [Run KnightCode in tmux](tmux.md) |
|
|
12
|
+
| `Alt+Enter` does not queue a follow-up | [WezTerm](#wezterm), [Alacritty](#alacritty), or [Windows Terminal](#windows-terminal) |
|
|
13
|
+
| Fullscreen scrolling is unusually slow | [iTerm2](#iterm2) |
|
|
14
|
+
| Dragging does not copy text, or copies it unexpectedly | [Text Selection and Copy](#text-selection-and-copy) |
|
|
15
|
+
| Links work but show no hover preview | [Ghostty](#ghostty) |
|
|
16
|
+
| Inline images or colors are not detected | [Override detected capabilities](#override-detected-capabilities) |
|
|
17
|
+
| An IME candidate window appears in the wrong place | [WezTerm](#wezterm) or [IntelliJ IDEA](#intellij-idea-integrated-terminal) |
|
|
18
|
+
| Modified keys fail only inside tmux | [Run KnightCode in tmux](tmux.md) |
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
Use `/hotkeys` to inspect KnightCode's active shortcuts. See [Keybindings](keybindings.md) to change them.
|
|
16
21
|
|
|
17
22
|
## Text Selection and Copy
|
|
18
23
|
|
|
19
|
-
Which side owns a mouse drag depends on the [TUI mode](usage.md#
|
|
24
|
+
Which side owns a mouse drag depends on the [TUI mode](usage.md#adjust-the-terminal).
|
|
20
25
|
|
|
21
26
|
In `fullscreen` mode, knightcode enables mouse reporting and owns text selection itself. Dragging with the primary button selects, and the selection is copied to the clipboard on release. Set `fullscreenCopyOnSelect` to `false` to keep the selection highlighted and copy it with `Ctrl+X` instead. To reach the terminal's own selection while knightcode captures the mouse, hold the terminal's bypass modifier — usually `Shift`, `Option` in iTerm2, and `Shift+Command`/`Shift+Ctrl` in Ghostty.
|
|
22
27
|
|
|
@@ -24,58 +29,55 @@ In `regular` mode, knightcode never enables mouse reporting, so a drag is the te
|
|
|
24
29
|
|
|
25
30
|
## Kitty
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
Kitty supports the required keyboard protocol without additional configuration.
|
|
28
33
|
|
|
29
34
|
## iTerm2
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Works out of the box.
|
|
36
|
+
Regular terminal mode works without additional configuration.
|
|
34
37
|
|
|
35
|
-
###
|
|
38
|
+
### Fix slow fullscreen scrolling
|
|
36
39
|
|
|
37
|
-
KnightCode owns the viewport, so iTerm2 sends mouse-wheel reports instead of scrolling
|
|
40
|
+
In fullscreen mode, KnightCode owns the viewport, so iTerm2 sends mouse-wheel reports instead of scrolling native terminal history. Fast trackpad gestures can then move only about one line at a time.
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
To change this behavior:
|
|
40
43
|
|
|
41
|
-
1. Open **iTerm2
|
|
42
|
-
2. Search for **Trackpad scrolls fast
|
|
44
|
+
1. Open **iTerm2 > Settings > Advanced**.
|
|
45
|
+
2. Search for **Trackpad scrolls fast?**.
|
|
46
|
+
3. Set it to **No**.
|
|
43
47
|
|
|
44
|
-
This is an iTerm2-wide
|
|
48
|
+
This is an iTerm2-wide setting and can also change native trackpad scrolling. The underlying behavior is tracked in [iTerm2 issue 9619](https://gitlab.com/gnachman/iterm2/-/work_items/9619).
|
|
45
49
|
|
|
46
50
|
## Apple Terminal
|
|
47
51
|
|
|
48
|
-
KnightCode enables enhanced key reporting when available. If Terminal.app still sends plain Return for `Shift+Enter`,
|
|
52
|
+
KnightCode enables enhanced key reporting when available. If Terminal.app still sends plain Return for `Shift+Enter`, KnightCode uses a local macOS modifier fallback and treats it as `Shift+Enter`.
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
The fallback works only when KnightCode runs on the same Mac as Terminal.app. It cannot inspect the local modifier state when KnightCode runs on another machine over SSH.
|
|
51
55
|
|
|
52
56
|
## Ghostty
|
|
53
57
|
|
|
54
|
-
Add to
|
|
58
|
+
Add this mapping to Ghostty's configuration if `Alt+Backspace` does not work:
|
|
55
59
|
|
|
56
|
-
```
|
|
60
|
+
```text
|
|
57
61
|
keybind = alt+backspace=text:\x1b\x7f
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
The configuration file is `~/Library/Application Support/com.mitchellh.ghostty/config` on macOS and `~/.config/ghostty/config` on Linux.
|
|
61
65
|
|
|
62
|
-
|
|
66
|
+
Older Claude Code configurations may contain:
|
|
67
|
+
|
|
68
|
+
```text
|
|
63
69
|
keybind = shift+enter=text:\n
|
|
64
70
|
```
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
If Claude Code 2.x or newer is the only reason you added that mapping, you can remove it, unless you want to use Claude Code in tmux, where it still requires that Ghostty mapping.
|
|
69
|
-
|
|
70
|
-
KnightCode binds `Ctrl+J` as a default newline alias, so `Shift+Enter` keeps working in tmux via that remap without extra knightcode configuration.
|
|
72
|
+
This sends a raw linefeed, which KnightCode cannot distinguish from `Ctrl+J`. Remove the mapping if an older Claude Code installation is the only reason you added it. KnightCode already binds `Ctrl+J` as a newline alternative, so the mapping may appear to work while still preventing KnightCode and tmux from receiving a real `Shift+Enter` event.
|
|
71
73
|
|
|
72
|
-
###
|
|
74
|
+
### Open links in fullscreen mode
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
Links remain clickable in fullscreen mode, but Ghostty does not show its normal hover underline or URL preview while KnightCode captures mouse input. Hold `Shift+Command` on macOS or `Shift+Ctrl` on Linux to use Ghostty's native link handling.
|
|
75
77
|
|
|
76
78
|
## WezTerm
|
|
77
79
|
|
|
78
|
-
WezTerm
|
|
80
|
+
WezTerm normally reports `Shift+Enter` through xterm extended keys. To enable the Kitty keyboard protocol explicitly, create `~/.wezterm.lua`:
|
|
79
81
|
|
|
80
82
|
```lua
|
|
81
83
|
local wezterm = require 'wezterm'
|
|
@@ -84,7 +86,19 @@ config.enable_kitty_keyboard = true
|
|
|
84
86
|
return config
|
|
85
87
|
```
|
|
86
88
|
|
|
87
|
-
|
|
89
|
+
### Forward Alt+Enter on macOS
|
|
90
|
+
|
|
91
|
+
WezTerm binds `Option+Enter` to fullscreen by default on macOS. To use it for KnightCode's follow-up queue, add this entry to your `config.keys` table:
|
|
92
|
+
|
|
93
|
+
```lua
|
|
94
|
+
{
|
|
95
|
+
key = 'Enter',
|
|
96
|
+
mods = 'ALT',
|
|
97
|
+
action = wezterm.action.SendString('\x1b[13;3u'),
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
A complete minimal configuration is:
|
|
88
102
|
|
|
89
103
|
```lua
|
|
90
104
|
local wezterm = require 'wezterm'
|
|
@@ -99,13 +113,20 @@ config.keys = {
|
|
|
99
113
|
return config
|
|
100
114
|
```
|
|
101
115
|
|
|
102
|
-
|
|
116
|
+
### Position an IME candidate window in WSL
|
|
103
117
|
|
|
104
|
-
|
|
118
|
+
If CJK IME candidates do not follow KnightCode's text cursor in WSL, show the hardware cursor:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
export KNIGHTCODE_HARDWARE_CURSOR=1
|
|
122
|
+
knightcode
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
You can instead set `showHardwareCursor` to `true` in KnightCode settings.
|
|
105
126
|
|
|
106
127
|
## Alacritty
|
|
107
128
|
|
|
108
|
-
Alacritty
|
|
129
|
+
Alacritty normally reports `Shift+Enter`. On macOS, `Option+Enter` can arrive as plain `Enter`. Add this to `~/.config/alacritty/alacritty.toml` to forward it to KnightCode:
|
|
109
130
|
|
|
110
131
|
```toml
|
|
111
132
|
[[keyboard.bindings]]
|
|
@@ -114,20 +135,13 @@ mods = "Alt"
|
|
|
114
135
|
chars = "\u001b[13;3u"
|
|
115
136
|
```
|
|
116
137
|
|
|
117
|
-
Restart Alacritty after changing the
|
|
118
|
-
|
|
119
|
-
## VS Code (Integrated Terminal)
|
|
138
|
+
Restart Alacritty after changing the file.
|
|
120
139
|
|
|
121
|
-
VS Code
|
|
140
|
+
## VS Code integrated terminal
|
|
122
141
|
|
|
123
|
-
VS Code
|
|
142
|
+
VS Code 1.109.5 and newer enable the Kitty keyboard protocol in the integrated terminal by default.
|
|
124
143
|
|
|
125
|
-
`keybindings.json
|
|
126
|
-
- macOS: `~/Library/Application Support/Code/User/keybindings.json`
|
|
127
|
-
- Linux: `~/.config/Code/User/keybindings.json`
|
|
128
|
-
- Windows: `%APPDATA%\\Code\\User\\keybindings.json`
|
|
129
|
-
|
|
130
|
-
Add to `keybindings.json`:
|
|
144
|
+
For an older version, add a `Shift+Enter` terminal binding to `keybindings.json`:
|
|
131
145
|
|
|
132
146
|
```json
|
|
133
147
|
{
|
|
@@ -138,9 +152,15 @@ Add to `keybindings.json`:
|
|
|
138
152
|
}
|
|
139
153
|
```
|
|
140
154
|
|
|
141
|
-
|
|
155
|
+
The user `keybindings.json` file is normally located at:
|
|
156
|
+
|
|
157
|
+
- macOS: `~/Library/Application Support/Code/User/keybindings.json`
|
|
158
|
+
- Linux: `~/.config/Code/User/keybindings.json`
|
|
159
|
+
- Windows: `%APPDATA%\\Code\\User\\keybindings.json`
|
|
142
160
|
|
|
143
|
-
|
|
161
|
+
## Zed integrated terminal
|
|
162
|
+
|
|
163
|
+
Add these bindings to Zed's `keymap.json`:
|
|
144
164
|
|
|
145
165
|
```json
|
|
146
166
|
{
|
|
@@ -155,46 +175,54 @@ Add these key bindings to your Zed `keymap.json`:
|
|
|
155
175
|
|
|
156
176
|
## Windows Terminal
|
|
157
177
|
|
|
158
|
-
|
|
178
|
+
Windows Terminal uses KnightCode's Windows and WSL shortcut defaults. See [Keybindings](keybindings.md) for the complete list.
|
|
159
179
|
|
|
160
|
-
|
|
161
|
-
- `Ctrl+F` searches the transcript in fullscreen mode, and `Ctrl+Up`/`Ctrl+Down` jump between marked messages.
|
|
162
|
-
- `Alt+P` cycles to the previous model.
|
|
163
|
-
- `Ctrl+Z` undoes editing on native Windows; WSL uses `Alt+Z` so `Ctrl+Z` can suspend knightcode.
|
|
164
|
-
- `Ctrl+Q` queues a follow-up message and `Alt+Q` restores queued messages.
|
|
180
|
+
### Forward Shift+Enter
|
|
165
181
|
|
|
166
|
-
|
|
182
|
+
Open Windows Terminal's `settings.json` with `Ctrl+Shift+,` or **Settings > Open JSON file**. Add this object to its `actions` array:
|
|
167
183
|
|
|
168
184
|
```json
|
|
169
185
|
{
|
|
170
|
-
"
|
|
171
|
-
|
|
172
|
-
"command": { "action": "sendInput", "input": "\u001b[13;2u" },
|
|
173
|
-
"keys": "shift+enter"
|
|
174
|
-
}
|
|
175
|
-
]
|
|
186
|
+
"command": { "action": "sendInput", "input": "\u001b[13;2u" },
|
|
187
|
+
"keys": "shift+enter"
|
|
176
188
|
}
|
|
177
189
|
```
|
|
178
190
|
|
|
179
|
-
|
|
191
|
+
Fully close and reopen Windows Terminal, then verify that `Shift+Enter` inserts a new line in KnightCode.
|
|
192
|
+
|
|
193
|
+
### Use Alt+Enter for follow-ups
|
|
180
194
|
|
|
181
|
-
|
|
195
|
+
Windows Terminal binds `Alt+Enter` to fullscreen by default. KnightCode therefore uses `Ctrl+Q` for follow-ups on Windows and WSL.
|
|
182
196
|
|
|
183
|
-
|
|
197
|
+
To use `Alt+Enter` instead, configure Windows Terminal to forward the key and bind `app.message.followUp` to `alt+enter` in KnightCode's `keybindings.json`. See [Keybindings](keybindings.md#assign-keybindings).
|
|
184
198
|
|
|
185
|
-
|
|
199
|
+
## xfce4-terminal and Terminator
|
|
186
200
|
|
|
187
|
-
|
|
188
|
-
- [Kitty](https://sw.kovidgoyal.net/kitty/)
|
|
189
|
-
- [Ghostty](https://ghostty.org/)
|
|
190
|
-
- [WezTerm](https://wezfurlong.org/wezterm/)
|
|
191
|
-
- [iTerm2](https://iterm2.com/)
|
|
192
|
-
- [Alacritty](https://github.com/alacritty/alacritty) (requires compilation with Kitty protocol support)
|
|
201
|
+
These terminals cannot reliably distinguish modified Enter keys from plain `Enter`. Custom bindings such as `Ctrl+Enter` or `Shift+Enter` therefore may not work.
|
|
193
202
|
|
|
194
|
-
|
|
203
|
+
Use a terminal with modern extended-key support when you need those shortcuts, such as Kitty, Ghostty, WezTerm, iTerm2, Windows Terminal, or a compatible Alacritty build.
|
|
195
204
|
|
|
196
|
-
|
|
205
|
+
## IntelliJ IDEA integrated terminal
|
|
206
|
+
|
|
207
|
+
IntelliJ IDEA's built-in terminal cannot reliably distinguish `Shift+Enter` from plain `Enter`. Use `Ctrl+J` for a newline or run KnightCode in a terminal with modern extended-key support.
|
|
208
|
+
|
|
209
|
+
If an IME candidate window does not follow the text cursor, show the hardware cursor:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
export KNIGHTCODE_HARDWARE_CURSOR=1
|
|
213
|
+
knightcode
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Override detected capabilities
|
|
217
|
+
|
|
218
|
+
KnightCode automatically detects OSC 8 hyperlinks, inline image protocols, and truecolor support. A terminal proxy or multiplexer can make that detection inaccurate.
|
|
219
|
+
|
|
220
|
+
| Capability | Environment variable | Setting |
|
|
221
|
+
|---|---|---|
|
|
222
|
+
| Hyperlinks | `KNIGHTCODE_HYPERLINKS=1\|0\|auto` | `terminal.hyperlinks: true\|false\|"auto"` |
|
|
223
|
+
| Inline images | `KNIGHTCODE_IMAGE_PROTOCOL=kitty\|iterm2\|none\|auto` | `terminal.images: "kitty"\|"iterm2"\|false\|"auto"` |
|
|
224
|
+
| Truecolor | `KNIGHTCODE_TRUE_COLOR=1\|0\|auto` | `terminal.trueColor: true\|false\|"auto"` |
|
|
197
225
|
|
|
198
|
-
|
|
226
|
+
Settings take precedence over environment variables. An unset value or `auto` preserves automatic detection.
|
|
199
227
|
|
|
200
|
-
|
|
228
|
+
Only force a capability supported by the complete terminal path. Unsupported escape sequences can corrupt rendering. See [Environment Variables](environment-variables.md#knightcode-process-configuration) and [Settings](settings.md) for the canonical value definitions.
|