kward 0.66.0 → 0.67.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6d8b5577dbec359eb683a0ce26cb87276b334b2d6346670df0338c9f10b123f
4
- data.tar.gz: abbd42bade9aed052e52b0e5c9ef6f9e560b56c35558346736d3963bdb34fc76
3
+ metadata.gz: d03a2b137c3ef3a1bc27e44b2629de49a41c70c3044088f9bd0c162cf50e3387
4
+ data.tar.gz: 241753e7eca9acb6ff94cae50afa7ea43ea2e4c13a8d22eb5031d399ae7fad5a
5
5
  SHA512:
6
- metadata.gz: 81c6bf970a1dd702e30ee6481feaa57fa11457fca292d17dd0f609c2e37981f9cf72d1e610d2f354a77f7093a3e21fd16b67fea03a54ad30e69c560f72081343
7
- data.tar.gz: daa54b6f0db9025b84ad14393654dbce127083f307ca67f0612100e0b015a499ab9f06a5cf413b80ea7e4d5f9f8386b11ae175a4d610f4e2fc90ab3817bd5390
6
+ metadata.gz: ac0d8465faa573ac9878c4bf5b83327145a7810cbe375b64ce8019531ba00ea3be779a82ed912825de2372ba18917dc56137f67f60161d3234e396b6ec82f3a2
7
+ data.tar.gz: 3e50a23badb84faf825a75cec5f9d0f4b62cc2bb0c76d643ac8bfb41d99a97c0cbc95268508e4b8a0c2e172249d105f3246b8b0e6a44c81725eae52db71235e6
data/CHANGELOG.md CHANGED
@@ -2,11 +2,58 @@
2
2
 
3
3
  All notable changes to Kward will be documented in this file.
4
4
 
5
- ## Unreleased
5
+ ## [Unreleased]
6
6
 
7
- - No changes yet.
7
+ ## [0.67.1] - 2026-06-14
8
8
 
9
- ## 0.66.0 - 2026-06-12 - Codename: Order
9
+ ### Fixed
10
+
11
+ - Fixed RPC session listing so it no longer deletes the active empty session file while UI clients are starting a first turn.
12
+
13
+ ## [0.67.0] - 2026-06-13
14
+
15
+ ### Added
16
+
17
+ - Added optional startup resume for the last active session in each workspace through `sessions.auto_resume: true`, including immediate restored transcript/persona data for RPC clients.
18
+ - Added `tools.workspace_guardrails: false` config support for allowing file tools to access paths outside the active workspace.
19
+ - Added `banner.enabled: false` config support for hiding the interactive terminal banner.
20
+ - Added colored CLI help/version commands, command-specific help, and stricter command precedence over one-shot prompts.
21
+ - Added `--working-directory PATH` as a global option for running any CLI mode from another workspace.
22
+ - Added `kward init` for installing the starter pack; `--install-starter-pack` remains as a compatibility alias.
23
+ - Added `kward doctor` to check local config, workspace, auth hints, Pan credentials, and writable directories.
24
+ - Added `--` as a prompt delimiter so option-like text can be sent as a one-shot prompt.
25
+ - Added `kward auth status` and `kward auth logout` for checking and clearing saved credentials without printing secrets.
26
+ - Added `/reload` and RPC runtime reload support for reloading installed plugins without restarting Kward.
27
+ - Added Session Tree support with a CLI `/tree` command plus RPC persisted entry IDs, labels, label timestamps, and branch navigation.
28
+ - Added RPC `ui/footer` notifications for Kward plugin footers.
29
+ - Added `!` shell commands in the interactive CLI composer.
30
+ - Added the active persona label to RPC `runtime/state` responses.
31
+
32
+ ### Changed
33
+
34
+ - Expanded the interactive `/settings` command into categorized settings for model, accounts, memory, interface, tools, compaction, personalization, logging, and advanced config info.
35
+ - Changed RPC session deletion to use the OS trash/recycle bin when available before falling back to permanent file deletion.
36
+ - Changed automatic session naming to persist the first visible user turn, keeping slash prompt names unexpanded while still saving expanded prompt content.
37
+ - Changed Pan mode to start with the `kward pan` command; `--pan-mode` remains as a compatibility alias.
38
+ - Changed memory retrieval and listing to use a global core, workspace core, workspace soft hierarchy, and added `/memory relax` for downgrading global core memories to the current workspace.
39
+ - Changed session tree rendering to match Pi's active-path-first branch display, markers, tool rows, and connector prefixes.
40
+ - Changed session tree navigation so all persisted entry points are selectable without automatically running anything.
41
+
42
+ ### Fixed
43
+
44
+ - Fixed RPC session deletion so empty unnamed sessions are explicitly deleted instead of being consumed by unused-session cleanup first.
45
+ - Fixed the TUI `/tree` selector to start on the current tree position, or the last item for a fresh tree.
46
+ - Fixed the normal session list/resume picker to stay in recent modification-time order, delete empty unnamed sessions, return the full list by default, and avoid test-created session pollution.
47
+ - Fixed RPC model selection to accept lowercase provider IDs from UI clients.
48
+ - Fixed cloned sessions to keep the current session name after renaming.
49
+
50
+ ### Removed
51
+
52
+ - Removed the obsolete `/crew` command reservation and unreleased RPC compatibility aliases.
53
+
54
+ ## [0.66.0] - 2026-06-12 - Codename: Order
55
+
56
+ ### Added
10
57
 
11
58
  - Initial public release.
12
59
  - Prepare RubyGems packaging for the initial public release.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kward (0.66.0)
4
+ kward (0.67.1)
5
5
  base64
6
6
  nokogiri
7
7
  tiktoken_ruby
@@ -66,7 +66,7 @@ CHECKSUMS
66
66
  date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0
67
67
  drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
68
68
  erb (6.0.4) sha256=38e3803694be357fe2bfe312487c74beaf9fb4e5beb3e22498952fe1645b95d9
69
- kward (0.66.0)
69
+ kward (0.67.1)
70
70
  minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
71
71
  nokogiri (1.19.3-arm64-darwin) sha256=71b9bd424b1b7abc18b05052a1a3cfd3627abdca62be280854cc411791357e42
72
72
  pastel (0.8.0) sha256=481da9fb7d2f6e6b1a08faf11fa10363172dc40fd47848f096ae21209f805a75
data/README.md CHANGED
@@ -15,7 +15,7 @@ gem install kward
15
15
  Optionally install the starter pack after installation:
16
16
 
17
17
  ```bash
18
- kward --install-starter-pack
18
+ kward init
19
19
  ```
20
20
 
21
21
  This downloads Kward's default prompts and base `AGENTS.md` into your config directory. It is useful for a first setup, but safe to skip if you prefer to create your own instructions. Existing files are left untouched.
@@ -24,9 +24,11 @@ Then start Kward and sign in when needed:
24
24
 
25
25
  ```bash
26
26
  kward # start an interactive chat
27
+ kward help # show available commands and examples
27
28
  /login # from inside Kward: sign in or save provider credentials
28
29
  kward login # from your shell: sign in or save provider credentials
29
30
  kward "Explain this project" # run one prompt and exit
31
+ kward --working-directory ~/code/project "Explain this project"
30
32
  ```
31
33
 
32
34
  See [Authentication](doc/authentication.md) for more details about sign-in options and provider credentials.
@@ -39,6 +41,7 @@ If you are working from a checkout:
39
41
  bundle install
40
42
  ruby lib/main.rb login # sign in or save provider credentials
41
43
  ruby lib/main.rb # start an interactive chat
44
+ ruby lib/main.rb help # show available commands and examples
42
45
  ruby lib/main.rb "Explain this project" # run one prompt and exit
43
46
  ```
44
47
 
@@ -67,6 +70,7 @@ Start here:
67
70
  - [Usage](doc/usage.md): interactive chat, slash commands, sessions, tools, images, and Pan mode.
68
71
  - [Configuration](doc/configuration.md): config files, providers, models, web search, logging, and color output.
69
72
  - [Authentication](doc/authentication.md): OpenAI OAuth, OpenRouter API keys, and Copilot/GitHub setup.
73
+ - [Troubleshooting](doc/troubleshooting.md): environment-specific install and runtime issues.
70
74
 
71
75
  Feature guides:
72
76
 
data/doc/configuration.md CHANGED
@@ -141,6 +141,20 @@ Overlay settings control terminal picker/card layout:
141
141
 
142
142
  You can change these interactively with `/settings`.
143
143
 
144
+ ## Banner settings
145
+
146
+ The interactive terminal banner shows the avatar Kward logo and the “State your business.” message by default. To hide the full banner:
147
+
148
+ ```json
149
+ {
150
+ "banner": {
151
+ "enabled": false
152
+ }
153
+ }
154
+ ```
155
+
156
+ This only affects the interactive terminal UI.
157
+
144
158
  ## Composer settings
145
159
 
146
160
  The busy composer shows a short Ctrl+C cancellation hint by default. To hide it:
@@ -155,6 +169,20 @@ The busy composer shows a short Ctrl+C cancellation hint by default. To hide it:
155
169
 
156
170
  This only hides the hint text; Ctrl+C still stops the current running response.
157
171
 
172
+ ## Session settings
173
+
174
+ Interactive CLI and RPC clients start fresh by default. To automatically resume the last active session for the current workspace:
175
+
176
+ ```json
177
+ {
178
+ "sessions": {
179
+ "auto_resume": true
180
+ }
181
+ }
182
+ ```
183
+
184
+ The `/resume` command and RPC `sessions/resume` work regardless of this automatic resume setting.
185
+
158
186
  ## Memory
159
187
 
160
188
  Memory is off by default. Enabling it writes:
@@ -198,7 +226,7 @@ Manual `/compact [instructions]` works even when auto-compaction is disabled.
198
226
 
199
227
  ## Pan mode
200
228
 
201
- `--pan-mode` starts a LAN-reachable web UI and requires HTTP Basic Auth. Configure credentials before starting it:
229
+ `kward pan` starts a LAN-reachable web UI and requires HTTP Basic Auth. Configure credentials before starting it:
202
230
 
203
231
  ```json
204
232
  {
@@ -246,6 +274,20 @@ For higher limits or alternate providers, add user-specific keys. Model-backed a
246
274
 
247
275
  Do not put shared or published API keys in this file.
248
276
 
277
+ ## Tool workspace guardrails
278
+
279
+ Workspace guardrails are enabled by default. File tools such as `read_file`, `write_file`, `edit_file`, and `list_directory` are limited to the active workspace. To allow those file tools to access paths outside the workspace:
280
+
281
+ ```json
282
+ {
283
+ "tools": {
284
+ "workspace_guardrails": false
285
+ }
286
+ }
287
+ ```
288
+
289
+ This is not a sandbox setting. Shell commands already run as your OS user from the workspace directory and can access anything that user can access.
290
+
249
291
  ## Logging and stats
250
292
 
251
293
  Local telemetry logs are off by default. Enable logging with the master flag and each category you want:
data/doc/memory.md CHANGED
@@ -53,7 +53,13 @@ Auto-summary does not run when memory is disabled and is not used for one-shot p
53
53
 
54
54
  ### Core memories
55
55
 
56
- Core memories are explicit user instructions. They are high-trust and persistent until removed. Add them only when you intentionally want Kward to remember something:
56
+ Memory is organized as a hierarchy for the active workspace:
57
+
58
+ 1. Global core memories
59
+ 2. Workspace core memories
60
+ 3. Workspace soft memories
61
+
62
+ Global core memories are explicit user instructions. They are high-trust, apply everywhere, and are ranked before workspace-specific memory. Add them only when you intentionally want Kward to remember something globally:
57
63
 
58
64
  ```text
59
65
  /memory core "Prefer small, focused patches with tests."
@@ -65,9 +71,11 @@ Core memories are stored as human-readable JSON in:
65
71
  ~/.kward/memory/core.json
66
72
  ```
67
73
 
74
+ Workspace core memories are core memories scoped to a specific workspace. They usually come from promoting workspace soft memories.
75
+
68
76
  ### Soft memories
69
77
 
70
- Soft memories are contextual hints, such as workflow preferences or recurring project facts. They are confidence-based and treated as non-authoritative. Add one manually with:
78
+ Soft memories are workspace-scoped contextual hints, such as workflow preferences or recurring project facts. They are confidence-based and treated as non-authoritative. Add one manually with:
71
79
 
72
80
  ```text
73
81
  /memory add "This workspace usually uses Minitest."
@@ -93,12 +101,14 @@ Session memories record memories learned during the current conversation so Kwar
93
101
 
94
102
  ## Inspect, explain, and remove memory
95
103
 
96
- List memories:
104
+ List memories for the active workspace hierarchy:
97
105
 
98
106
  ```text
99
107
  /memory list
100
108
  ```
101
109
 
110
+ The list is grouped as global core, workspace core, and workspace soft. Memories from other workspaces are not shown in this hierarchy view.
111
+
102
112
  Inspect memory state and file paths:
103
113
 
104
114
  ```text
@@ -120,21 +130,29 @@ Forget a memory:
120
130
 
121
131
  For core memories, forget removes the record. For soft memories, forget marks the record inactive and redacts its stored text, tags, confidence, and hit count so inactive audit metadata can remain without retaining the memory content.
122
132
 
123
- Promote a soft memory to a core memory:
133
+ Promote a memory:
124
134
 
125
135
  ```text
126
136
  /memory promote soft_001
137
+ /memory promote core_001
127
138
  ```
128
139
 
129
- Promotion creates a new core memory and marks the soft memory forgotten.
140
+ Promoting a soft memory creates a new workspace core memory and marks the soft memory forgotten. Promoting a workspace core memory upgrades it to global core.
141
+
142
+ Relax a global core memory back to the current workspace:
143
+
144
+ ```text
145
+ /memory relax core_001
146
+ ```
130
147
 
131
148
  ## Retrieval behavior
132
149
 
133
150
  For each interactive turn, Kward selectively retrieves memories using:
134
151
 
135
152
  - scope: `global` and `workspace:<canonical path>`
136
- - core memories first
137
- - soft-memory text or tag overlap with the current input; soft memories without overlap are not injected
153
+ - global core memories first
154
+ - workspace core memories second
155
+ - workspace soft-memory text or tag overlap with the current input; soft memories without overlap are not injected
138
156
  - soft-memory confidence
139
157
  - soft-memory recency/TTL, updated when a soft memory is retrieved
140
158
  - hard limits on injected memory count
@@ -143,10 +161,13 @@ Retrieved memories are injected into the system prompt as a bounded block simila
143
161
 
144
162
  ```text
145
163
  <kward_memory>
146
- Core Memories:
164
+ Global Core Memories:
147
165
  - [core_001] ...
148
166
 
149
- Relevant Soft Memories:
167
+ Workspace Core Memories:
168
+ - [core_002] ...
169
+
170
+ Workspace Soft Memories:
150
171
  - [soft_001] ...
151
172
 
152
173
  Rules:
@@ -185,6 +206,7 @@ The experimental RPC backend exposes dedicated memory methods:
185
206
  - `memory/addCore`
186
207
  - `memory/forget`
187
208
  - `memory/promote`
209
+ - `memory/relax`
188
210
  - `memory/inspect`
189
211
  - `memory/why`
190
212
  - `memory/summarize`
data/doc/rpc.md CHANGED
@@ -47,14 +47,14 @@ Result fields:
47
47
  - `protocolVersion`: currently `1`.
48
48
  - `serverName`: `"kward"`.
49
49
  - `experimental`: `true`.
50
- - `capabilities`: includes detailed Tauren-compatible capability groups. Some legacy simple fields remain for older clients, but `sessions` is now the detailed session capability object.
50
+ - `capabilities`: includes Tauren-compatible capability groups.
51
51
 
52
52
  Detailed capability fields include:
53
53
 
54
54
  - `transcript`: Tauren transcript format support, including normalized messages, image/tool support, compaction summaries, and restored assistant reasoning as Pi-compatible `thinking` content blocks.
55
- - `sessions`: explicit RPC session mode, JSONL persistence, supported session methods, RPC list support, supported linear-session fork methods, supported compaction, and explicit unsupported import/tree/update features.
55
+ - `sessions`: explicit RPC session mode, JSONL persistence, supported session methods, startup auto-resume capability/default, immediate transcript support for auto-resume, RPC list support, supported linear-session fork methods, supported compaction, and explicit unsupported import/tree/update features.
56
56
  - `turns`: async turn mode, per-session concurrency, provider-gated native busy-input steering, queued follow-up input, best-effort cancellation, and recent in-memory event replay behavior.
57
- - `events`: `turn/event` notification details, assistant/reasoning event names, normalized tool metadata, diff result support, and explicit unsupported shell changed-file detection/session update flags.
57
+ - `events`: `turn/event` notification details, assistant/reasoning event names, normalized tool metadata, diff result support, configured workspace guardrail status, and explicit unsupported shell changed-file detection/session update flags.
58
58
  - `attachments`: supported input attachment contract for `turns/start`, with accepted base64 image MIME types and a stable max byte value.
59
59
  - `models`: model/reasoning RPC methods, explicit OpenRouter catalog listing, exposed model fields, and no scoped model support.
60
60
  - `runtime`: supported state/stats methods with message-count stats and OpenAI/Codex context usage. Cumulative token and cost stats are not computed.
@@ -63,13 +63,11 @@ Detailed capability fields include:
63
63
  - `memory`: opt-in structured memory support, interactive prompt injection only, JSON/JSONL local storage, and dedicated `memory/*` methods.
64
64
  - `commands`: supported `commands/list` capability for prompt, skill, and plugin command sources, plus plugin execution through `commands/run` or plugin slash turns.
65
65
  - `startupResources`: supported startup resource listing for context, skills, prompts, and plugins.
66
- - `extensionUi`: question bridge support via `ui/question` and `ui/answerQuestion`; other UI primitives are explicitly unsupported.
66
+ - `extensionUi`: question bridge support via `ui/question` and `ui/answerQuestion`, plus plugin footer updates via `ui/footer`; other UI primitives are explicitly unsupported.
67
67
  - `composer`: composer-only UI features. Interactive session diff totals are explicitly unsupported over RPC (`composer.sessionDiff.supported: false`) because RPC clients already receive per-tool diff results and no live composer status payload is exposed. Clipboard copy is also unsupported over RPC (`composer.copy.supported: false`) because UI clients own clipboard access.
68
- - `security`: trusted-local behavior; no workspace mutation guard or tool approval, shell/file mutation can run.
68
+ - `security`: trusted-local behavior; no workspace mutation guard or tool approval, shell/file mutation can run. File-tool workspace guardrails are reported under `capabilities.events.tools.workspaceGuardrails` and `runtime/state.workspaceGuardrailsEnabled`.
69
69
  - `export`: supported transcript export formats. Currently `markdown` and `html`; default is `markdown`.
70
70
 
71
- Legacy compatibility fields still present include `asyncTurns`, `turnCancellation`, `turnEventReplay`, `uiQuestions`, `authLogin`, `configUpdate`, `session`, `cancellation`, `eventReplay`, `uiQuestion`, `prompts`, `skills`, `tools`, and `config`.
72
-
73
71
  ### `shutdown`
74
72
 
75
73
  Requests process shutdown after the response.
@@ -98,8 +96,9 @@ Params:
98
96
 
99
97
  - `workspaceRoot`: optional existing directory; defaults to launch cwd.
100
98
  - `name`: optional session name.
99
+ - `resumeLast`: optional boolean. Defaults to the configured `sessions.auto_resume` behavior when omitted by clients that use `sessions/create` for startup. `false` forces a fresh session.
101
100
 
102
- Creates a persisted Kward session and returns session metadata.
101
+ Creates a persisted Kward session and returns session metadata. The response includes `activePersonaLabel` so clients can render the correct avatar immediately. When `resumeLast` is enabled, no `name` is provided, and `sessions.auto_resume` is `true`, Kward resumes the remembered last session for the workspace instead of creating a fresh file; that auto-resume response also includes `resumed: true` and normalized `messages` so clients do not need to briefly render a fresh avatar while fetching transcript state.
103
102
 
104
103
  ### `sessions/resume`
105
104
 
@@ -115,9 +114,9 @@ Loads a persisted session and returns a new RPC session ID.
115
114
  Params:
116
115
 
117
116
  - `workspaceRoot`: optional.
118
- - `limit`: optional, default `20`.
117
+ - `limit`: optional; omitted or non-positive values return all sessions.
119
118
 
120
- Returns recent persisted sessions for that workspace. Existing sessions without ancestry are roots; cloned or forked sessions include parent metadata and tree display fields. Each item includes absolute `path`, `cwd`, `workspaceRoot`, `createdAt`, `modifiedAt`, optional `name`, compact `firstMessage`, `messageCount` excluding metadata records, optional `parentId`/`parentPath`, `depth`, `isLast`, and `ancestorContinues` for tree rendering.
119
+ Returns recent persisted sessions for that workspace in modification-time order. Empty unnamed sessions are deleted during listing. Cloned or forked sessions include parent metadata. Each item includes absolute `path`, `cwd`, `workspaceRoot`, `createdAt`, `modifiedAt`, optional `name`, compact `firstMessage`, `messageCount` excluding metadata records, optional `parentId`/`parentPath`, `depth`, `isLast`, and `ancestorContinues` fields.
121
120
 
122
121
  ### `sessions/rename`
123
122
 
@@ -302,8 +301,6 @@ Lifecycle payloads include `status` for `turnQueued`, `turnStarted`, and `turnFi
302
301
  - `toolCallId`: tool call ID.
303
302
  - `toolName`: normalized tool name, such as `read`, `edit`, `write`, or `bash`.
304
303
  - `args`: normalized arguments. Edit replacements use `oldText`/`newText`; shell timeout is `timeout`.
305
- - `rawToolCall` and `toolCall`: original model tool call for compatibility.
306
- - `tool`: legacy normalized metadata retained for older clients.
307
304
 
308
305
  `toolResult` additionally includes `result` with `content`, `isError`, optional unified `diff`, optional `changedFiles`, and `images`. Failed or declined tools set `isError: true`.
309
306
 
@@ -315,7 +312,7 @@ Examples:
315
312
 
316
313
  ## UI question bridge
317
314
 
318
- Kward's only supported extension-style UI surface is the structured question bridge. The `extensionUi` capability reports `question.supported: true` with `notification: "ui/question"`, `method: "ui/answerQuestion"`, `maxQuestions: 4`, `multiSelect: false`, and `preview: false`. Other Pi-style extension UI primitives (`select`, `confirm`, `input`, `editor`, `widgets`, `footer`, `custom`, and `terminalInput`) are explicitly reported as unsupported until Kward has a real plugin/extension consumer for them.
315
+ Kward supports the structured question bridge and plugin footer updates over RPC. The `extensionUi` capability reports `question.supported: true` with `notification: "ui/question"`, `method: "ui/answerQuestion"`, `maxQuestions: 4`, `multiSelect: false`, and `preview: false`. It also reports `footer.supported: true` with `notification: "ui/footer"`. Other Pi-style extension UI primitives (`select`, `confirm`, `input`, `editor`, `widgets`, `custom`, and `terminalInput`) are explicitly reported as unsupported until Kward has a real plugin/extension consumer for them.
319
316
 
320
317
  Question requests are validated before notification. Kward accepts 1-4 questions, each with 2-4 options, and rejects unsupported `multiSelect` or option `preview` requests.
321
318
 
@@ -329,6 +326,17 @@ When the model calls `ask_user_question`, RPC emits a `ui/question` notification
329
326
  }
330
327
  ```
331
328
 
329
+ When a loaded Kward plugin registers a footer, RPC emits `ui/footer` after session creation/resume/clone and after each completed turn:
330
+
331
+ ```json
332
+ {
333
+ "sessionId": "...",
334
+ "text": "custom footer text"
335
+ }
336
+ ```
337
+
338
+ An empty `text` value clears the client footer.
339
+
332
340
  The UI must respond with `ui/answerQuestion`:
333
341
 
334
342
  Params:
@@ -345,7 +353,7 @@ Params:
345
353
 
346
354
  - `sessionId`: active RPC session ID.
347
355
 
348
- Returns Tauren-compatible runtime state for the session, including session file, persisted session ID/name, active `rpcSessionId`, `persistentSessionId`, current model metadata, current thinking level, streaming/pending-message state, and stable Kward defaults. The legacy `sessionId` field remains the persisted session ID; clients must send the active RPC session `id`/`rpcSessionId` in RPC request params. Unsupported runtime settings are returned as false or omitted.
356
+ Returns Tauren-compatible runtime state for the session, including session file, persisted session ID/name, active `rpcSessionId`, `persistentSessionId`, current model metadata, current thinking level, streaming/pending-message state, and stable Kward defaults. Clients must send the active RPC session `id`/`rpcSessionId` in RPC request params. Unsupported runtime settings are returned as false or omitted.
349
357
 
350
358
  ### `runtime/stats`
351
359
 
@@ -353,7 +361,7 @@ Params:
353
361
 
354
362
  - `sessionId`: active RPC session ID.
355
363
 
356
- Returns session file/id/name, active `rpcSessionId`, `persistentSessionId`, message-count stats: user messages, assistant messages, tool calls, tool results, and total non-system messages. The legacy `sessionId` field remains the persisted session ID; clients must send the active RPC session `id`/`rpcSessionId` in RPC request params. For OpenAI/Codex sessions with a known model context window and text-only non-empty conversation context, also returns `contextUsage` with estimated current next-request context tokens, context window, percent used, and `estimated: true`. Fresh sessions with no non-system content omit `contextUsage` because only static prompt/tool overhead would be measurable. Cumulative token and cost fields are omitted until Kward tracks provider usage responses.
364
+ Returns session file/id/name, active `rpcSessionId`, `persistentSessionId`, message-count stats: user messages, assistant messages, tool calls, tool results, and total non-system messages. Clients must send the active RPC session `id`/`rpcSessionId` in RPC request params. For OpenAI/Codex sessions with a known model context window and text-only non-empty conversation context, also returns `contextUsage` with estimated current next-request context tokens, context window, percent used, and `estimated: true`. Fresh sessions with no non-system content omit `contextUsage` because only static prompt/tool overhead would be measurable. Cumulative token and cost fields are omitted until Kward tracks provider usage responses.
357
365
 
358
366
  ### `runtime/updateSetting`
359
367
 
@@ -416,8 +424,9 @@ Disables quiet memory summarization after completed interactive turns. Returns `
416
424
  Params:
417
425
 
418
426
  - `includeInactive`: optional boolean; includes forgotten soft memories when true.
427
+ - `workspaceRoot`: optional workspace root for hierarchy filtering; defaults to the server process workspace.
419
428
 
420
- Returns `{ "core": [], "soft": [] }`.
429
+ Returns `{ "global_core": [], "workspace_core": [], "workspace_soft": [] }`.
421
430
 
422
431
  ### `memory/add`
423
432
 
@@ -453,13 +462,24 @@ Returns `{ "forgotten": true }` when a memory was removed or marked forgotten. C
453
462
 
454
463
  ### `memory/promote`
455
464
 
456
- Promotes an active soft memory to a new core memory and marks the soft memory forgotten.
465
+ Promotes an active soft memory to a new workspace core memory and marks the soft memory forgotten, or promotes a workspace core memory to global core.
457
466
 
458
467
  Params:
459
468
 
460
- - `id`: soft memory ID.
469
+ - `id`: soft memory ID or workspace core memory ID.
461
470
 
462
- Returns `{ "memory": {} }` for the new core memory.
471
+ Returns `{ "memory": {} }`.
472
+
473
+ ### `memory/relax`
474
+
475
+ Downgrades a global core memory to the current workspace hierarchy.
476
+
477
+ Params:
478
+
479
+ - `id`: global core memory ID.
480
+ - `workspaceRoot`: optional workspace root for the relaxed scope; defaults to the server process workspace.
481
+
482
+ Returns `{ "memory": {} }`.
463
483
 
464
484
  ### `memory/inspect`
465
485
 
@@ -487,7 +507,7 @@ Returns `{ "memories": [] }`.
487
507
 
488
508
  ### `models/list`
489
509
 
490
- Returns known model entries from the current client/config backend. OpenRouter entries prefer models available to the configured OpenRouter API key when they can be fetched; otherwise Kward falls back to defaults/currently configured options. Entries use `{ "provider", "id", "name", "reasoning", "reasoningEffort", "contextWindow", "current" }`; legacy `model` is retained as an alias for older clients.
510
+ Returns known model entries from the current client/config backend. OpenRouter entries prefer models available to the configured OpenRouter API key when they can be fetched; otherwise Kward falls back to defaults/currently configured options. Entries use `{ "provider", "id", "name", "reasoning", "reasoningEffort", "contextWindow", "current" }`.
491
511
 
492
512
  ### `openrouter/catalog`
493
513
 
@@ -495,7 +515,7 @@ Returns the full OpenRouter model catalog as model entries. This is separate fro
495
515
 
496
516
  ### `models/current`
497
517
 
498
- Returns the current model entry with `id`, `name`, `reasoning`, `reasoningEffort`, and legacy `model` alias where available.
518
+ Returns the current model entry with `provider`, `id`, `name`, `reasoning`, `reasoningEffort`, `contextWindow`, and `current` where available.
499
519
 
500
520
  ### `models/set`
501
521
 
@@ -0,0 +1,55 @@
1
+ # Troubleshooting
2
+
3
+ This page collects environment-specific issues that can affect Kward but are not caused by Kward itself.
4
+
5
+ ## `gem install kward` succeeds, but `kward` is not found with rbenv
6
+
7
+ When using rbenv, RubyGems installs gem executables into the active Ruby version's `bin` directory. rbenv then exposes those executables through shims in `$RBENV_ROOT/shims`.
8
+
9
+ If `gem install kward` succeeds but `kward` is not available on your `PATH`, first check whether RubyGems installed the executable:
10
+
11
+ ```bash
12
+ rbenv which kward
13
+ ```
14
+
15
+ If that prints a path such as:
16
+
17
+ ```text
18
+ /Users/you/.rbenv/versions/4.0.3/bin/kward
19
+ ```
20
+
21
+ then the gem executable exists and the missing command is likely an rbenv shim issue.
22
+
23
+ Regenerate shims:
24
+
25
+ ```bash
26
+ rbenv rehash
27
+ ```
28
+
29
+ Then verify the shim exists:
30
+
31
+ ```bash
32
+ test -x "$RBENV_ROOT/shims/kward"
33
+ ```
34
+
35
+ If `rbenv rehash` fails with an error like:
36
+
37
+ ```text
38
+ rbenv: cannot rehash: /Users/you/.rbenv/shims/.rbenv-shim exists
39
+ ```
40
+
41
+ remove the stale rbenv prototype shim and rehash again:
42
+
43
+ ```bash
44
+ rm -f "$RBENV_ROOT/shims/.rbenv-shim"
45
+ rbenv rehash
46
+ ```
47
+
48
+ After that, `kward` should be available through the rbenv shim:
49
+
50
+ ```bash
51
+ which kward
52
+ kward --help
53
+ ```
54
+
55
+ This stale `.rbenv-shim` file can be left behind by an interrupted `rbenv rehash` or gem installation. It is local rbenv state, not a Kward packaging issue.
data/doc/usage.md CHANGED
@@ -4,8 +4,12 @@ Kward's most common commands are:
4
4
 
5
5
  ```bash
6
6
  kward # interactive chat
7
+ kward help # command overview and examples
7
8
  kward "Explain this project" # one-shot prompt
8
- kward --install-starter-pack # optional first-time setup
9
+ kward init # optional first-time setup
10
+ kward doctor # check local setup
11
+ kward auth status # show saved credential status
12
+ kward pan # Pan mode web UI
9
13
  kward rpc # experimental JSON-RPC backend
10
14
  ```
11
15
 
@@ -16,7 +20,7 @@ When running from source, replace `kward` with `ruby lib/main.rb`.
16
20
  Install Kward's starter prompts and base `AGENTS.md` into your config directory, usually `~/.kward`:
17
21
 
18
22
  ```bash
19
- kward --install-starter-pack
23
+ kward init
20
24
  ```
21
25
 
22
26
  The installer downloads the pinned `kaiwood/kward-starter-pack` `v1.0.0` release, creates the config directory and base `config.json` if needed, and copies only starter-pack instruction/prompt files. It preserves the starter-pack layout in your config directory and skips files that already exist.
@@ -27,12 +31,41 @@ Interactive mode opens a terminal composer and saves the conversation as a per-w
27
31
 
28
32
  The composer stays available while assistant and tool output streams. If you press Enter while a response is still running, Kward queues your next prompt and sends it after the current turn finishes. Press Ctrl+C while a response is running to stop the current turn and return to the composer.
29
33
 
34
+ Prefix input with `!` to run a local shell command from the workspace root without sending it to the model:
35
+
36
+ ```text
37
+ !git status --short
38
+ ```
39
+
40
+ ## Shell commands
41
+
42
+ Use `kward help` or `kward --help` to print a colored overview of available commands and examples. Use `kward help <command>` or `<command> --help` for command-specific help. Use `kward version` or `kward --version` to print the installed version.
43
+
44
+ Use `kward doctor` to check local config, workspace, auth hints, Pan credentials, and writable directories. Use `kward auth status` to show saved credential status without printing secrets, or `kward auth logout` to remove saved OpenAI, GitHub, and OpenRouter credentials.
45
+
46
+ Use `--working-directory PATH` with any mode to run Kward from a different workspace:
47
+
48
+ ```bash
49
+ kward --working-directory ~/code/project
50
+ kward --working-directory ~/code/project "Summarize this project"
51
+ kward --working-directory ~/code/project pan
52
+ kward --working-directory ~/code/project rpc
53
+ ```
54
+
30
55
  ## One-shot prompts
31
56
 
32
- Pass a prompt as command-line text to ask once and exit:
57
+ Command names take precedence. Invalid arguments for known commands show usage instead of becoming prompts. Anything else passed as command-line text is sent as a one-shot prompt:
33
58
 
34
59
  ```bash
35
60
  kward "Summarize the changes in this repository"
61
+ kward Summarize the changes in this repository
62
+ ```
63
+
64
+ Use `--` before the prompt when the prompt itself starts with a command name or contains option-like text:
65
+
66
+ ```bash
67
+ kward -- pan extra
68
+ kward -- explain --working-directory option
36
69
  ```
37
70
 
38
71
  Kward also accepts piped input:
@@ -95,7 +128,7 @@ Useful session commands:
95
128
 
96
129
  - `/resume` opens a picker for recent sessions.
97
130
  - `/name <name>` gives the current session a human-readable name.
98
- - `/clone` creates a new independent copy. Cloned sessions remember their parent and appear indented in the resume picker.
131
+ - `/clone` creates a new independent copy. Cloned sessions remember their parent and appear in the recent session picker by modification time.
99
132
  - `/copy` and `/copy last` copy the latest assistant response without terminal borders or ANSI styling. `/copy transcript` copies the clean Markdown transcript. Mouse selection may still include terminal UI chrome.
100
133
  - `/export [path]` writes a Markdown transcript. Explicit paths are resolved relative to the current workspace and must stay inside the workspace or Kward session directory.
101
134
  - `/compact [instructions]` summarizes older conversation into a structured Ruby-aware checkpoint. Text after `/compact ` is freeform focus text, not parsed as flags.
@@ -132,6 +165,8 @@ Common commands:
132
165
  /memory add <text>
133
166
  /memory list
134
167
  /memory why
168
+ /memory promote <id>
169
+ /memory relax <id>
135
170
  /memory forget <id>
136
171
  /memory disable
137
172
  ```
@@ -165,13 +200,13 @@ In the interactive composer, pasted image references appear as attachment badges
165
200
  Pan mode starts a minimal LAN web UI with a prompt textarea and transcript:
166
201
 
167
202
  ```bash
168
- kward --pan-mode --working-directory="/path/to/workspace"
203
+ kward --working-directory="/path/to/workspace" pan
169
204
  ```
170
205
 
171
206
  From source:
172
207
 
173
208
  ```bash
174
- ruby lib/main.rb --pan-mode --working-directory="/path/to/workspace"
209
+ ruby lib/main.rb --working-directory="/path/to/workspace" pan
175
210
  ```
176
211
 
177
212
  Pan mode streams assistant output and tool calls, queues prompts submitted while a turn is running, and saves the conversation as a normal per-workspace session.