@knightcodeai/cli-linux-arm64 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/bin/CHANGELOG.md +60 -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 -785
  9. package/bin/docs/docs.json +143 -103
  10. package/bin/docs/environment-variables.md +5 -4
  11. package/bin/docs/extensions.md +134 -2956
  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 +64 -547
  19. package/bin/docs/packages.md +66 -167
  20. package/bin/docs/prompt-templates.md +31 -68
  21. package/bin/docs/providers.md +103 -241
  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 +25 -216
  29. package/bin/docs/sessions.md +38 -143
  30. package/bin/docs/settings.md +111 -389
  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 -286
  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,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).
@@ -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 are self-contained capability packages that the agent loads on-demand. A skill provides specialized workflows, setup instructions, helper scripts, and reference documentation for specific tasks.
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
- Toggle skill commands via `/settings` in interactive mode or in `settings.json`:
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
- ```json
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
- ## Skill Structure
9
+ ## Create a skill
94
10
 
95
- A skill is a directory with a `SKILL.md` file. Everything else is freeform.
11
+ A skill is a directory containing `SKILL.md`:
96
12
 
97
- ```
98
- my-skill/
99
- ├── SKILL.md # Required: frontmatter + instructions
100
- ├── scripts/ # Helper scripts
101
- │ └── process.sh
102
- ├── references/ # Detailed docs loaded on-demand
103
- │ └── api-reference.md
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
- ### SKILL.md Format
24
+ Start `SKILL.md` with frontmatter followed by direct instructions:
109
25
 
110
- ````markdown
26
+ ```markdown
111
27
  ---
112
- name: my-skill
113
- description: What this skill does and when to use it. Be specific.
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
- # My Skill
32
+ # PDF tools
117
33
 
118
- ## Setup
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
- ## Usage
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
- | Field | Required | Description |
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
- ### Name Rules
41
+ ## Understand how skills load
153
42
 
154
- - 1-64 characters
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
- Valid: `pdf-processing`, `data-analysis`, `code-review`
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
- ### Description Best Practices
47
+ Arguments after `/skill:name` are appended to the loaded instructions as a user request:
164
48
 
165
- The description determines when the agent loads the skill. Be specific.
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
- ## Validation
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
- KnightCode validates skills against the Agent Skills standard. Most issues produce warnings but still load the skill:
55
+ <a id="choose-where-it-loads"></a>
180
56
 
181
- - Name exceeds 64 characters or contains invalid characters
182
- - Name starts/ends with hyphen or has consecutive hyphens
183
- - Description exceeds 1024 characters
57
+ ## Add it to KnightCode
184
58
 
185
- Unknown frontmatter fields are ignored.
59
+ Place the skill in your user or project skills directory. Directories containing `SKILL.md` are discovered recursively.
186
60
 
187
- Declared skills with missing descriptions are not loaded. Malformed `SKILL.md` files and `SKILL.md` files without a description produce warnings and are not loaded. Other Markdown files without valid skill frontmatter are ignored.
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
- Name collisions (same name from different locations) warn and keep the first skill found.
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
- ## Example
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
- **SKILL.md:**
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
- # Brave Search
69
+ The Agent Skills specification defines these fields:
208
70
 
209
- ## Setup
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
- ```bash
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
- ## Search
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
- ```bash
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
- ## Extract Page Content
87
+ ## Validate and share a skill
223
88
 
224
- ```bash
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
- ## Skill Repositories
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
- - [Anthropic Skills](https://github.com/anthropics/skills) - Document processing (docx, pdf, pptx, xlsx), web development
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.