@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,122 +1,40 @@
1
- # Sessions
1
+ # Sessions and Context
2
2
 
3
- KnightCode saves conversations as sessions so you can continue work, branch from earlier turns, and revisit previous paths.
3
+ KnightCode saves a conversation as a session. The active branch of that session supplies conversation history for the next model request. Use session commands to continue work, explore another branch, or reduce the amount of history sent to the model.
4
4
 
5
- ## Session Storage
5
+ ## Continue or switch sessions
6
6
 
7
- Sessions auto-save to `~/.knightcode/agent/sessions/`, organized by working directory. Each session is a JSONL file with a tree structure.
7
+ KnightCode saves sessions automatically unless you start it with `--no-session`.
8
8
 
9
9
  ```bash
10
- knightcode -c # Continue most recent session
11
- knightcode -r # Browse and select from past sessions
12
- knightcode --no-session # Ephemeral mode; do not save
13
- knightcode --name "my task" # Set session display name at startup
14
- knightcode --session <path|id> # Use a specific session file or partial session ID
15
- knightcode --fork <path|id> # Fork a session file or partial session ID into a new session
10
+ knightcode --continue
11
+ knightcode --resume
16
12
  ```
17
13
 
18
- Use `/session` in interactive mode to see the current session file, session ID, message count, tokens, and cost.
14
+ `--continue` opens the most recent session for the current working directory. `--resume` opens the session picker. In interactive mode, `/resume` opens the same picker and `/new` starts a new session.
19
15
 
20
- For the JSONL file format and SessionManager API, see [Session Format](session-format.md).
16
+ Use `/name` or `--name` to assign a recognizable session name. Run `/session` to verify the current session file, ID, message count, token usage, and cost.
21
17
 
22
- ## Session Commands
18
+ The session picker lets you search, rename, and delete sessions. It can also show paths, change sorting, and limit results to named sessions. See [Keybindings](keybindings.md#sessions) for its shortcuts.
23
19
 
24
- | Command | Description |
25
- |---------|-------------|
26
- | `/resume` | Browse and select previous sessions |
27
- | `/new` | Start a new session |
28
- | `/name <name>` | Set the current session display name |
29
- | `/session` | Show session info |
30
- | `/tree` | Navigate the current session tree |
31
- | `/undo` | Go back to an earlier user message, optionally restoring files |
32
- | `/fork` | Create a new session from a previous user message |
33
- | `/clone` | Duplicate the current active branch into a new session |
34
- | `/compact [prompt]` | Summarize older context; see [Compaction](compaction.md) |
35
- | `/export [file]` | Export session to HTML |
36
- | `/share` | Upload as private GitHub gist with shareable HTML link |
20
+ ## Choose how to branch
37
21
 
38
- ## Resuming and Deleting Sessions
22
+ KnightCode stores entries as a tree, so returning to an earlier point does not erase the branch you leave.
39
23
 
40
- `/resume` opens an interactive session picker for the current project. `knightcode -r` opens the same picker at startup.
24
+ | Action | Result | Use it when |
25
+ |---|---|---|
26
+ | `/tree` | Moves within the current session file | Related alternatives should stay together |
27
+ | `/fork` | Creates a new session from an earlier user message | The alternative should become separate work |
28
+ | `/clone` | Copies the active branch into a new session | You want a separate copy of the current state |
29
+ | `/undo` | Returns to an earlier user message on the current branch, optionally restoring files | You want to take back the last turns |
41
30
 
42
- In the picker you can:
43
-
44
- - search by typing
45
- - toggle path display with Ctrl+P
46
- - toggle sort mode with Ctrl+S
47
- - filter to named sessions with Ctrl+N
48
- - rename with Ctrl+R
49
- - delete with Ctrl+D, then confirm
50
-
51
- When available, knightcode uses the `trash` CLI for deletion instead of permanently removing files.
52
-
53
- ## Naming Sessions
54
-
55
- Use `/name <name>` to set a human-readable session name:
56
-
57
- ```text
58
- /name Refactor auth module
59
- ```
60
-
61
- Set the name at startup with `--name` or `-n`:
62
-
63
- ```bash
64
- knightcode --name "Refactor auth module"
65
- knightcode --name "CI audit" -p "Review this build failure"
66
- ```
67
-
68
- Named sessions are easier to find in `/resume` and `knightcode -r`.
69
-
70
- ## Branching with `/tree`
71
-
72
- Sessions are stored as trees. Every entry has an `id` and `parentId`, and the current position is the active leaf. `/tree` lets you jump to any previous point and continue from there without creating a new file.
31
+ In `/tree`, select a user message to put its text back in the editor. Edit and submit it to create another branch. Selecting an assistant response or another entry continues after that entry with an empty editor.
73
32
 
74
33
  Selecting a point while the model is responding cancels that response. Navigation cannot proceed while compaction or another tree navigation is still running; wait for it to finish and retry.
75
34
 
76
- <p align="center"><img src="images/tree-view.png" alt="Tree View" width="600"></p>
77
-
78
- Example shape:
35
+ When you leave a branch, KnightCode can summarize it and attach that summary to the branch you enter. This preserves relevant work from the abandoned path without including every message from it.
79
36
 
80
- ```text
81
- ├─ user: "Hello, can you help..."
82
- │ └─ assistant: "Of course! I can..."
83
- │ ├─ user: "Let's try approach A..."
84
- │ │ └─ assistant: "For approach A..."
85
- │ │ └─ user: "That worked..." ← active
86
- │ └─ user: "Actually, approach B..."
87
- │ └─ assistant: "For approach B..."
88
- ```
89
-
90
- ### Tree Controls
91
-
92
- | Key | Action |
93
- |-----|--------|
94
- | ↑/↓ | Navigate visible entries |
95
- | ←/→ | Page up/down |
96
- | Ctrl+←/Ctrl+→ or Alt+←/Alt+→ | Fold/unfold or jump between branch segments |
97
- | Shift+L | Set or clear a label on the selected entry |
98
- | Shift+T | Toggle label timestamps |
99
- | Enter | Select entry |
100
- | Escape/Ctrl+C | Cancel |
101
- | Ctrl+O | Cycle filter mode |
102
-
103
- Filter modes are: default, no-tools, user-only, labeled-only, and all. Configure the default with `treeFilterMode` in [Settings](settings.md).
104
-
105
- ### Selection Behavior
106
-
107
- Selecting a user or custom message:
108
-
109
- 1. Moves the leaf to the selected message's parent.
110
- 2. Places the selected message text in the editor.
111
- 3. Lets you edit and resubmit, creating a new branch.
112
-
113
- Selecting an assistant, tool, compaction, or other non-user entry:
114
-
115
- 1. Moves the leaf to that entry.
116
- 2. Leaves the editor empty.
117
- 3. Lets you continue from that point.
118
-
119
- Selecting the root user message resets the leaf to an empty conversation and places the original prompt in the editor.
37
+ For the persisted tree and entry types, see [Session Format](session-format.md).
120
38
 
121
39
  ## Undoing with `/undo`
122
40
 
@@ -124,7 +42,8 @@ Selecting the root user message resets the leaf to an empty conversation and pla
124
42
  branch and go back to it. It lists only user messages, newest at the bottom, with the time
125
43
  and how many files an undo to that point would restore. Enter goes back; the turns after the
126
44
  chosen message are left as an abandoned branch (still reachable through `/tree`) and the
127
- message text returns to the editor for editing and resubmitting.
45
+ message text returns to the editor for editing and resubmitting. `/undo` never summarizes the
46
+ branch it leaves.
128
47
 
129
48
  ### File Restore
130
49
 
@@ -152,31 +71,34 @@ Limits:
152
71
  Backups older than 30 days are removed at startup. Set `KNIGHTCODE_DISABLE_FILE_CHECKPOINTS=1`
153
72
  to turn file tracking off; `/undo` then rewinds the conversation only.
154
73
 
155
- ## `/tree`, `/fork`, and `/clone`
74
+ ## Manage conversation context
75
+
76
+ The model receives the active branch, not every branch in the session file. KnightCode combines that history with the system prompt, discovered context files, available tools, and loaded skill descriptions. [How KnightCode Works](how-knightcode-works.md#context) describes how those inputs are assembled.
77
+
78
+ The footer shows current context usage. When the active context approaches the model's limit, KnightCode normally compacts older history automatically. Compaction adds a summary and keeps recent messages. It does not delete the original session entries.
79
+
80
+ Run `/compact` to compact manually. You can add instructions when the summary should preserve a particular topic or decision. Configure automatic compaction and retained history through [Settings](settings.md#compaction).
81
+
82
+ Compaction can fail if the provider is unavailable or cannot accept the summarization request. Correct the provider problem and run `/compact` again. Disabling automatic compaction does not disable the manual command.
83
+
84
+ See [Compaction Reference](compaction.md) for thresholds, retained boundaries, branch-summary behavior, and extension hooks.
156
85
 
157
- | Feature | `/tree` | `/fork` | `/clone` |
158
- |---------|---------|---------|----------|
159
- | Output | Same session file | New session file | New session file |
160
- | View | Full tree | User-message selector | Current active branch |
161
- | Typical use | Explore alternatives in place | Start a new session from an earlier prompt | Duplicate current work before continuing |
162
- | Summary | Optional branch summary | None | None |
86
+ ## Control session storage
163
87
 
164
- Use `/tree` when you want to keep alternatives together. Use `/fork` or `/clone` when you want a separate session file.
88
+ By default, KnightCode stores sessions under `~/.knightcode/agent/sessions/`, grouped by working directory. Use `--session-dir`, `KNIGHTCODE_CODING_AGENT_SESSION_DIR`, or the `sessionDir` setting to choose another location. The CLI option has highest precedence.
165
89
 
166
- ## Branch Summaries
90
+ Use `--no-session` for an ephemeral run. An ephemeral session cannot be resumed after KnightCode exits.
167
91
 
168
- When `/tree` switches away from one branch to another, knightcode can summarize the abandoned branch and attach that summary at the new position. This preserves important context from the path you left without replaying the whole branch.
92
+ Use `--session` when you already know the session path or ID. Use `--fork` to create a new session from an existing session before interactive mode starts.
169
93
 
170
- When prompted, choose one of:
94
+ ## Export or share a session
171
95
 
172
- 1. no summary
173
- 2. summarize with the default prompt
174
- 3. summarize with custom focus instructions
96
+ Use `/export` to write the current session as HTML or JSONL. Use `/share` to upload it and get a viewer link. KnightCode uses a Radius artifact when Radius authentication is configured; otherwise, it uses a private GitHub gist.
175
97
 
176
- See [Compaction](compaction.md) for branch summarization internals and extension hooks.
98
+ Review exported or shared sessions first. They can contain prompts, model responses, tool arguments, command output, file contents, and extension messages.
177
99
 
178
- ## Session Format
100
+ ## Report a bug
179
101
 
180
- Session files are JSONL and contain message entries, model changes, thinking-level changes, labels, compactions, branch summaries, and extension entries.
102
+ Run `/bug [description]` to prepare a private report for the KnightCode maintainers. You can include the session transcript, omit it, or ask the current model to summarize the problem. Review any transcript or generated summary because it can contain sensitive conversation data.
181
103
 
182
- For parsers, extensions, SDK usage, and the full SessionManager API, see [Session Format](session-format.md).
104
+ The report includes environment and provider configuration without credential values, plus recorded error diagnostics. Upload it to the maintainers through `remote.knightcode.dev` or export the same report as a zip to inspect and share yourself. Uploads do not require a login and are always anonymous. If an upload fails, KnightCode offers to export the zip.