kward 0.68.0 → 0.69.0
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 +4 -4
- data/.github/workflows/pages.yml +48 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +34 -0
- data/Gemfile.lock +8 -2
- data/README.md +32 -25
- data/Rakefile +14 -1
- data/doc/authentication.md +74 -56
- data/doc/code-search.md +55 -28
- data/doc/configuration.md +18 -0
- data/doc/extensibility.md +89 -128
- data/doc/getting-started.md +52 -54
- data/doc/memory.md +51 -118
- data/doc/personas.md +417 -0
- data/doc/plugins.md +55 -97
- data/doc/releasing.md +3 -1
- data/doc/rpc.md +1 -1
- data/doc/usage.md +125 -144
- data/doc/web-search.md +80 -14
- data/exe/kward +2 -0
- data/lib/kward/agent.rb +1 -1
- data/lib/kward/cli/commands.rb +10 -3
- data/lib/kward/cli/compaction.rb +3 -3
- data/lib/kward/cli/interactive_turn.rb +3 -1
- data/lib/kward/cli/memory_commands.rb +16 -16
- data/lib/kward/cli/plugins.rb +3 -3
- data/lib/kward/cli/prompt_interface.rb +15 -13
- data/lib/kward/cli/rendering.rb +35 -46
- data/lib/kward/cli/runtime_helpers.rb +13 -2
- data/lib/kward/cli/sessions.rb +21 -21
- data/lib/kward/cli/settings.rb +49 -43
- data/lib/kward/cli/slash_commands.rb +6 -4
- data/lib/kward/cli/stats.rb +2 -2
- data/lib/kward/cli/sysprompt.rb +57 -0
- data/lib/kward/cli/tool_summaries.rb +5 -1
- data/lib/kward/cli.rb +14 -2
- data/lib/kward/cli_transcript_formatter.rb +36 -5
- data/lib/kward/compactor.rb +2 -2
- data/lib/kward/config_files.rb +45 -10
- data/lib/kward/conversation.rb +41 -9
- data/lib/kward/memory/manager.rb +131 -14
- data/lib/kward/message_access.rb +6 -0
- data/lib/kward/model/context_usage.rb +11 -10
- data/lib/kward/model/model_info.rb +18 -1
- data/lib/kward/model/payloads.rb +89 -10
- data/lib/kward/model/stream_parser.rb +258 -25
- data/lib/kward/prompt_interface/question_prompt.rb +1 -1
- data/lib/kward/prompt_interface/transcript_renderer.rb +20 -11
- data/lib/kward/prompts.rb +61 -7
- data/lib/kward/rpc/server.rb +7 -2
- data/lib/kward/rpc/session_manager.rb +18 -2
- data/lib/kward/rpc/session_metrics.rb +2 -2
- data/lib/kward/rpc/transcript_normalizer.rb +47 -0
- data/lib/kward/session_store.rb +40 -1
- data/lib/kward/starter_pack_installer.rb +2 -2
- data/lib/kward/tools/fetch_content.rb +41 -0
- data/lib/kward/tools/fetch_raw.rb +40 -0
- data/lib/kward/tools/registry.rb +9 -2
- data/lib/kward/tools/search/web.rb +3 -3
- data/lib/kward/tools/search/web_fetch.rb +202 -0
- data/lib/kward/tools/tool_call.rb +2 -0
- data/lib/kward/version.rb +1 -1
- data/templates/default/fulldoc/html/css/kward.css +1501 -0
- data/templates/default/fulldoc/html/images/kward_logo.png +0 -0
- data/templates/default/fulldoc/html/js/kward.js +296 -0
- data/templates/default/fulldoc/html/setup.rb +8 -0
- data/templates/default/layout/html/breadcrumb.erb +11 -0
- data/templates/default/layout/html/layout.erb +141 -0
- data/templates/default/layout/html/setup.rb +139 -0
- metadata +14 -1
data/doc/plugins.md
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
# Plugins
|
|
2
2
|
|
|
3
|
-
Plugins are
|
|
3
|
+
Plugins are trusted local Ruby extensions for Kward. Use them when you need behavior that prompts, skills, or instructions cannot provide.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Good plugin use cases:
|
|
6
6
|
|
|
7
|
-
- add
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- add a slash command for a personal workflow,
|
|
8
|
+
- show project/session status in the terminal footer,
|
|
9
|
+
- add concise local context to prompts,
|
|
10
|
+
- log or observe transcript events,
|
|
11
|
+
- expose local commands to an RPC client.
|
|
12
12
|
|
|
13
|
-
Plugins
|
|
13
|
+
Plugins run inside the Kward process with your user permissions. Install only plugins you trust.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## When to use a plugin
|
|
16
|
+
|
|
17
|
+
| Need | Better choice |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Reusable prompt text | prompt template |
|
|
20
|
+
| Reusable model instructions | skill |
|
|
21
|
+
| Repository rules | `AGENTS.md` |
|
|
22
|
+
| Local Ruby code or integration | plugin |
|
|
16
23
|
|
|
17
24
|
## Where plugins live
|
|
18
25
|
|
|
@@ -22,7 +29,7 @@ Kward loads top-level Ruby files from:
|
|
|
22
29
|
~/.kward/plugins/*.rb
|
|
23
30
|
```
|
|
24
31
|
|
|
25
|
-
Plugins are
|
|
32
|
+
Plugins are not loaded from the current workspace or a custom `KWARD_CONFIG_PATH` directory. This prevents a project checkout from silently adding executable Ruby code to Kward.
|
|
26
33
|
|
|
27
34
|
## A first plugin
|
|
28
35
|
|
|
@@ -32,12 +39,12 @@ Create the plugin directory:
|
|
|
32
39
|
mkdir -p ~/.kward/plugins
|
|
33
40
|
```
|
|
34
41
|
|
|
35
|
-
|
|
42
|
+
Create `~/.kward/plugins/hello.rb`:
|
|
36
43
|
|
|
37
44
|
```ruby
|
|
38
45
|
Kward.plugin do |plugin|
|
|
39
46
|
plugin.command "hello", description: "Say hello", argument_hint: "[name]" do |args, ctx|
|
|
40
|
-
name = args.strip.empty? ? "
|
|
47
|
+
name = args.strip.empty? ? "there" : args.strip
|
|
41
48
|
ctx.say("Hello, #{name}.")
|
|
42
49
|
end
|
|
43
50
|
end
|
|
@@ -49,41 +56,28 @@ Start Kward and run:
|
|
|
49
56
|
/hello Kai
|
|
50
57
|
```
|
|
51
58
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## Slash commands
|
|
59
|
+
## Add a slash command
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
Use plugin commands for local actions that should not call the model.
|
|
57
62
|
|
|
58
63
|
```ruby
|
|
59
64
|
Kward.plugin do |plugin|
|
|
60
65
|
plugin.command "session-info", description: "Show session details" do |_args, ctx|
|
|
61
66
|
ctx.say("Session: #{ctx.session_name || ctx.session_id || 'unnamed'}")
|
|
62
|
-
ctx.say("Path: #{ctx.session_path || 'not saved'}")
|
|
63
67
|
ctx.say("Workspace: #{ctx.workspace_root}")
|
|
64
68
|
end
|
|
65
69
|
end
|
|
66
70
|
```
|
|
67
71
|
|
|
68
|
-
Command names
|
|
69
|
-
|
|
70
|
-
- do not include the leading `/`,
|
|
71
|
-
- must start with a letter or number,
|
|
72
|
-
- may contain letters, numbers, `_`, and `-`,
|
|
73
|
-
- cannot replace built-in commands or prompt-template commands.
|
|
74
|
-
|
|
75
|
-
If a plugin command conflicts with a reserved or duplicate command, Kward skips it and prints a warning.
|
|
76
|
-
|
|
77
|
-
Command handlers receive:
|
|
72
|
+
Command names do not include `/`. They must start with a letter or number and may contain letters, numbers, `_`, and `-`.
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
- `ctx`: a plugin context object.
|
|
74
|
+
A plugin command cannot replace a built-in command or prompt-template command.
|
|
81
75
|
|
|
82
|
-
|
|
76
|
+
## Add prompt context
|
|
83
77
|
|
|
84
|
-
|
|
78
|
+
Prompt context is short text injected into future model requests.
|
|
85
79
|
|
|
86
|
-
|
|
80
|
+
Use it for stable facts the model should know, not for large files or secrets.
|
|
87
81
|
|
|
88
82
|
```ruby
|
|
89
83
|
Kward.plugin do |plugin|
|
|
@@ -95,37 +89,29 @@ Kward.plugin do |plugin|
|
|
|
95
89
|
end
|
|
96
90
|
```
|
|
97
91
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
If plugin state changes and the active conversation should rebuild its system message, call:
|
|
92
|
+
If plugin state changes and Kward should rebuild the active system message, call:
|
|
101
93
|
|
|
102
94
|
```ruby
|
|
103
95
|
ctx.refresh_system_message!
|
|
104
96
|
```
|
|
105
97
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
## Custom footer
|
|
98
|
+
## Add a footer
|
|
109
99
|
|
|
110
|
-
A
|
|
100
|
+
A footer can show compact local status in the terminal UI:
|
|
111
101
|
|
|
112
102
|
```ruby
|
|
113
103
|
Kward.plugin do |plugin|
|
|
114
104
|
plugin.footer do |ctx|
|
|
115
|
-
|
|
116
|
-
messages = ctx.transcript.messages.length
|
|
117
|
-
"#{name} • #{messages} messages"
|
|
105
|
+
"#{ctx.session_name || 'unnamed'} • #{ctx.transcript.messages.length} messages"
|
|
118
106
|
end
|
|
119
107
|
end
|
|
120
108
|
```
|
|
121
109
|
|
|
122
|
-
Only one footer
|
|
123
|
-
|
|
124
|
-
Footer errors are caught and printed as warnings so they do not break the session.
|
|
110
|
+
Only one footer is active. If multiple plugins register footers, the later one replaces the earlier one and Kward prints a warning.
|
|
125
111
|
|
|
126
|
-
##
|
|
112
|
+
## Observe transcript events
|
|
127
113
|
|
|
128
|
-
|
|
114
|
+
Use transcript events when you need to log or react to live activity:
|
|
129
115
|
|
|
130
116
|
```ruby
|
|
131
117
|
Kward.plugin do |plugin|
|
|
@@ -139,7 +125,9 @@ Kward.plugin do |plugin|
|
|
|
139
125
|
end
|
|
140
126
|
```
|
|
141
127
|
|
|
142
|
-
|
|
128
|
+
Event payloads are read-only copies. Handler errors are caught and printed as warnings.
|
|
129
|
+
|
|
130
|
+
Common event types include:
|
|
143
131
|
|
|
144
132
|
- `reasoning_delta`
|
|
145
133
|
- `assistant_delta`
|
|
@@ -150,28 +138,24 @@ Supported event types include:
|
|
|
150
138
|
- `tool_result`
|
|
151
139
|
- `answer`
|
|
152
140
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
Transcript-event handler errors are caught and printed as warnings.
|
|
141
|
+
## Plugin context
|
|
156
142
|
|
|
157
|
-
|
|
143
|
+
Handlers receive a `ctx` object. Common methods:
|
|
158
144
|
|
|
159
|
-
|
|
145
|
+
- `ctx.workspace_root`
|
|
146
|
+
- `ctx.args`
|
|
147
|
+
- `ctx.say(message)`
|
|
148
|
+
- `ctx.transcript.messages`
|
|
149
|
+
- `ctx.session_id`
|
|
150
|
+
- `ctx.session_name`
|
|
151
|
+
- `ctx.session_path`
|
|
152
|
+
- `ctx.refresh_system_message!`
|
|
160
153
|
|
|
161
|
-
|
|
162
|
-
- `ctx.workspace_root` - active workspace path.
|
|
163
|
-
- `ctx.transcript.messages` - deep-frozen copy of active conversation messages.
|
|
164
|
-
- `ctx.say(message)` - emit output to the active frontend when available.
|
|
165
|
-
- `ctx.session_id` - current persisted session ID when available.
|
|
166
|
-
- `ctx.session_name` - current session name when available.
|
|
167
|
-
- `ctx.session_path` - current session file path when available.
|
|
168
|
-
- `ctx.refresh_system_message!` - rebuild the active conversation system message.
|
|
169
|
-
|
|
170
|
-
The transcript is read-only by design. Plugins should use Kward APIs exposed through the context rather than mutating conversation internals.
|
|
154
|
+
The transcript is read-only. Use context methods instead of mutating Kward internals.
|
|
171
155
|
|
|
172
156
|
## RPC support
|
|
173
157
|
|
|
174
|
-
Plugins are available
|
|
158
|
+
Plugins are available in the CLI and experimental RPC backend.
|
|
175
159
|
|
|
176
160
|
RPC clients can:
|
|
177
161
|
|
|
@@ -179,43 +163,17 @@ RPC clients can:
|
|
|
179
163
|
- run plugin commands through `commands/run`,
|
|
180
164
|
- run plugin slash commands through `turns/start` input such as `/hello Kai`.
|
|
181
165
|
|
|
182
|
-
|
|
166
|
+
Plugin command output is emitted through normal turn events without calling the model.
|
|
183
167
|
|
|
184
|
-
## Security
|
|
168
|
+
## Security
|
|
185
169
|
|
|
186
|
-
Plugins are
|
|
170
|
+
Plugins are local Ruby code. They can read files, write files, run commands, make network requests, and read environment variables as your user.
|
|
187
171
|
|
|
188
172
|
Recommended practices:
|
|
189
173
|
|
|
190
174
|
- Install plugins only from sources you trust.
|
|
191
175
|
- Keep plugins in your personal `~/.kward/plugins` directory.
|
|
192
|
-
- Do not
|
|
193
|
-
- Prefer
|
|
194
|
-
- Keep prompt context
|
|
195
|
-
- Be careful
|
|
196
|
-
|
|
197
|
-
## Complete example
|
|
198
|
-
|
|
199
|
-
```ruby
|
|
200
|
-
Kward.plugin do |plugin|
|
|
201
|
-
plugin.command "last-message", description: "Show transcript size" do |_args, ctx|
|
|
202
|
-
ctx.say("Messages: #{ctx.transcript.messages.length}")
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
plugin.footer do |ctx|
|
|
206
|
-
"#{ctx.session_name || 'unnamed'} • #{ctx.transcript.messages.length} messages"
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
plugin.prompt_context do |_ctx|
|
|
210
|
-
"Project background: prefer small, focused changes."
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
plugin.on_transcript_event do |event, ctx|
|
|
214
|
-
next unless event.type == "assistant_delta"
|
|
215
|
-
|
|
216
|
-
File.open(File.join(ctx.workspace_root, ".assistant-stream.log"), "a") do |file|
|
|
217
|
-
file.write(event.payload[:delta])
|
|
218
|
-
end
|
|
219
|
-
end
|
|
220
|
-
end
|
|
221
|
-
```
|
|
176
|
+
- Do not put secrets in shared plugin files.
|
|
177
|
+
- Prefer environment variables or private config for credentials.
|
|
178
|
+
- Keep prompt context short and never inject secrets into model prompts.
|
|
179
|
+
- Be careful with transcript observers that persist conversation content.
|
data/doc/releasing.md
CHANGED
|
@@ -14,9 +14,11 @@ Release steps before publishing:
|
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
bundle exec rake rdoc
|
|
17
|
-
bundle exec
|
|
17
|
+
bundle exec rake docs:build
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Pushes to `main` deploy the generated YARD site to GitHub Pages.
|
|
21
|
+
|
|
20
22
|
5. Build the gem locally:
|
|
21
23
|
|
|
22
24
|
```bash
|
data/doc/rpc.md
CHANGED
|
@@ -554,7 +554,7 @@ Params:
|
|
|
554
554
|
|
|
555
555
|
- `sessionId`: active RPC session ID.
|
|
556
556
|
|
|
557
|
-
Returns stable startup sections for configured context (`AGENTS.md`), skills, prompt templates, and plugin slash commands.
|
|
557
|
+
Returns stable startup sections for configured context (`PRINCIPLES.md`, or legacy `AGENTS.md`), skills, prompt templates, and plugin slash commands.
|
|
558
558
|
|
|
559
559
|
### `prompts/list`
|
|
560
560
|
|
data/doc/usage.md
CHANGED
|
@@ -1,217 +1,198 @@
|
|
|
1
1
|
# Usage
|
|
2
2
|
|
|
3
|
-
Kward
|
|
3
|
+
Kward has two main modes:
|
|
4
|
+
|
|
5
|
+
- **Interactive chat** for ongoing work in a project.
|
|
6
|
+
- **One-shot prompts** for quick questions, reviews, and summaries.
|
|
7
|
+
|
|
8
|
+
Run Kward from the workspace you want it to inspect:
|
|
4
9
|
|
|
5
10
|
```bash
|
|
6
|
-
|
|
7
|
-
kward
|
|
8
|
-
kward "Explain this project" # one-shot prompt
|
|
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
|
|
13
|
-
kward rpc # experimental JSON-RPC backend
|
|
11
|
+
cd ~/code/project
|
|
12
|
+
kward
|
|
14
13
|
```
|
|
15
14
|
|
|
16
15
|
When running from source, replace `kward` with `ruby lib/main.rb`.
|
|
17
16
|
|
|
18
|
-
##
|
|
17
|
+
## Common workflows
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
### Understand a new project
|
|
21
20
|
|
|
22
|
-
```
|
|
23
|
-
|
|
21
|
+
```text
|
|
22
|
+
Explain the project structure and point out the main entry points.
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
Useful follow-ups:
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
```text
|
|
28
|
+
Where is configuration loaded?
|
|
29
|
+
Which files would I read first to understand authentication?
|
|
30
|
+
Summarize the test strategy.
|
|
31
|
+
```
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
### Review changes before committing
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
```bash
|
|
36
|
+
git diff | kward "Review this diff for bugs, missing tests, and confusing naming"
|
|
37
|
+
```
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
For larger reviews, use interactive mode so Kward can inspect related files:
|
|
35
40
|
|
|
36
41
|
```text
|
|
37
|
-
|
|
42
|
+
Review the current git diff. If something looks risky, inspect the relevant files before recommending changes.
|
|
38
43
|
```
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
### Make a small code change
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
```text
|
|
48
|
+
Add a --json option to the status command. Keep the text output unchanged and add focused tests.
|
|
49
|
+
```
|
|
43
50
|
|
|
44
|
-
|
|
51
|
+
Kward must read an existing file in the current conversation before editing it. This guardrail helps prevent accidental overwrites.
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
### Run local checks
|
|
47
54
|
|
|
48
|
-
|
|
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
|
-
```
|
|
55
|
+
Inside interactive mode, ask Kward to run a command:
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
```text
|
|
58
|
+
Run the focused test for the CLI status command.
|
|
59
|
+
```
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
Or run a shell command yourself from the composer by prefixing it with `!`:
|
|
58
62
|
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
kward Summarize the changes in this repository
|
|
63
|
+
```text
|
|
64
|
+
!git status --short
|
|
62
65
|
```
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
## Shell commands
|
|
68
|
+
|
|
69
|
+
Useful shell commands:
|
|
65
70
|
|
|
66
71
|
```bash
|
|
67
|
-
kward
|
|
68
|
-
kward
|
|
72
|
+
kward # start interactive chat
|
|
73
|
+
kward "Explain this project" # ask one question and exit
|
|
74
|
+
kward help # show commands and examples
|
|
75
|
+
kward doctor # check local setup
|
|
76
|
+
kward login # sign in or save credentials
|
|
77
|
+
kward auth status # show credential status without secrets
|
|
78
|
+
kward sysprompt # inspect assembled instructions
|
|
79
|
+
kward rpc # start the experimental RPC backend
|
|
69
80
|
```
|
|
70
81
|
|
|
71
|
-
|
|
82
|
+
Use another workspace without changing directories:
|
|
72
83
|
|
|
73
84
|
```bash
|
|
74
|
-
|
|
85
|
+
kward --working-directory ~/code/project
|
|
86
|
+
kward --working-directory ~/code/project "Summarize this repository"
|
|
75
87
|
```
|
|
76
88
|
|
|
77
|
-
|
|
89
|
+
## Interactive slash commands
|
|
78
90
|
|
|
79
|
-
|
|
91
|
+
Use slash commands for local actions that should not go to the model:
|
|
80
92
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- `list_directory` and `read_file` to inspect the workspace.
|
|
84
|
-
- `write_file` and `edit_file` to create or change files.
|
|
85
|
-
- `run_shell_command` to run local commands from the workspace.
|
|
86
|
-
- `web_search` to search the live web.
|
|
87
|
-
- `code_search` to find packages, clone public GitHub repositories into cache, and read bounded source snippets.
|
|
88
|
-
- `ask_user_question` to ask structured clarification questions.
|
|
89
|
-
|
|
90
|
-
Safety rules:
|
|
91
|
-
|
|
92
|
-
- Existing files must be read in the current conversation before Kward can write or edit them.
|
|
93
|
-
- Text file reads and edits are capped at 256 KiB per file.
|
|
94
|
-
- Tool schemas are the official contract for generated tool calls and returned tool payloads.
|
|
95
|
-
- At runtime, Kward accepts tolerant incoming tool-call input for compatibility: extra fields are ignored, and existing legacy-compatible input shapes remain supported.
|
|
96
|
-
- Required fields and invalid required values still return explicit tool errors.
|
|
97
|
-
- Tool output payloads are kept schema-clean so future model calls and restored transcripts do not depend on accidental extra fields.
|
|
98
|
-
- When successful tool results include unified diffs, the composer status shows live session totals such as `+700|-572`.
|
|
99
|
-
|
|
100
|
-
## Slash commands
|
|
101
|
-
|
|
102
|
-
Use slash commands in interactive mode for local Kward actions:
|
|
103
|
-
|
|
104
|
-
| Command | Purpose |
|
|
93
|
+
| Command | Use it when you want to... |
|
|
105
94
|
| --- | --- |
|
|
106
|
-
| `/
|
|
107
|
-
| `/
|
|
108
|
-
| `/
|
|
109
|
-
| `/
|
|
110
|
-
| `/
|
|
111
|
-
| `/
|
|
112
|
-
| `/
|
|
113
|
-
| `/
|
|
114
|
-
| `/
|
|
115
|
-
| `/
|
|
116
|
-
| `/
|
|
117
|
-
| `/
|
|
118
|
-
| `/
|
|
119
|
-
| `/
|
|
120
|
-
| `/
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
Prompt templates can add more slash commands. Plugin commands can also appear when trusted local plugins are installed.
|
|
95
|
+
| `/login` | sign in or save provider credentials. |
|
|
96
|
+
| `/model` | choose the active model. |
|
|
97
|
+
| `/reasoning` | choose reasoning effort. |
|
|
98
|
+
| `/status` | see session, model, and context status. |
|
|
99
|
+
| `/new` | start a fresh session. |
|
|
100
|
+
| `/resume` | continue a previous session. |
|
|
101
|
+
| `/name <name>` | name the current session. |
|
|
102
|
+
| `/clone` | copy the current session into a new branch. |
|
|
103
|
+
| `/copy last` | copy the latest assistant answer. |
|
|
104
|
+
| `/copy transcript` | copy the transcript as Markdown. |
|
|
105
|
+
| `/export notes.md` | write the transcript to a Markdown file. |
|
|
106
|
+
| `/compact [focus]` | summarize older context so a long chat can continue. |
|
|
107
|
+
| `/memory ...` | manage opt-in memory. |
|
|
108
|
+
| `/redraw` | fix terminal drawing after resize or glitches. |
|
|
109
|
+
| `/exit` | leave Kward. |
|
|
110
|
+
|
|
111
|
+
Prompt templates and plugins can add more slash commands.
|
|
125
112
|
|
|
126
113
|
## Sessions
|
|
127
114
|
|
|
128
|
-
Interactive chats are
|
|
115
|
+
Interactive chats are saved under:
|
|
129
116
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
- `/name <name>` gives the current session a human-readable name.
|
|
134
|
-
- `/clone` creates a new independent copy. Cloned sessions remember their parent and appear in the recent session picker by modification time.
|
|
135
|
-
- `/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.
|
|
136
|
-
- `/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.
|
|
137
|
-
- `/compact [instructions]` summarizes older conversation into a structured Ruby-aware checkpoint. Text after `/compact ` is freeform focus text, not parsed as flags.
|
|
117
|
+
```text
|
|
118
|
+
~/.kward/sessions/
|
|
119
|
+
```
|
|
138
120
|
|
|
139
|
-
|
|
121
|
+
Sessions are scoped to the workspace. Use them when work spans more than one terminal sitting.
|
|
140
122
|
|
|
141
|
-
|
|
123
|
+
Typical flow:
|
|
142
124
|
|
|
143
|
-
|
|
125
|
+
```text
|
|
126
|
+
/name oauth cleanup
|
|
127
|
+
# work with Kward
|
|
128
|
+
/export oauth-notes.md
|
|
129
|
+
/exit
|
|
130
|
+
```
|
|
144
131
|
|
|
145
|
-
|
|
132
|
+
Later:
|
|
146
133
|
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
"compaction": {
|
|
150
|
-
"enabled": true,
|
|
151
|
-
"reserve_tokens": 16384,
|
|
152
|
-
"keep_recent_tokens": 20000
|
|
153
|
-
}
|
|
154
|
-
}
|
|
134
|
+
```text
|
|
135
|
+
/resume
|
|
155
136
|
```
|
|
156
137
|
|
|
157
|
-
|
|
138
|
+
Use `/compact` when a conversation gets long. Kward summarizes older context and keeps recent context active. After compaction, it may need to re-read files before editing them again.
|
|
158
139
|
|
|
159
|
-
##
|
|
160
|
-
|
|
161
|
-
Memory is disabled by default and only applies to interactive sessions.
|
|
140
|
+
## One-shot prompts
|
|
162
141
|
|
|
163
|
-
|
|
142
|
+
One-shot prompts are best for short tasks that do not need session history:
|
|
164
143
|
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
/memory list
|
|
170
|
-
/memory why
|
|
171
|
-
/memory promote <id>
|
|
172
|
-
/memory relax <id>
|
|
173
|
-
/memory forget <id>
|
|
174
|
-
/memory disable
|
|
144
|
+
```bash
|
|
145
|
+
kward "What does this repository do?"
|
|
146
|
+
git diff | kward "Review this diff"
|
|
147
|
+
cat error.log | kward "Explain the likely cause"
|
|
175
148
|
```
|
|
176
149
|
|
|
177
|
-
|
|
150
|
+
Use `--` when your prompt starts with something that could be parsed as a command or option:
|
|
178
151
|
|
|
179
|
-
|
|
152
|
+
```bash
|
|
153
|
+
kward -- explain --working-directory
|
|
154
|
+
```
|
|
180
155
|
|
|
181
|
-
-
|
|
182
|
-
- Shift+Enter inserts a newline.
|
|
183
|
-
- Up/Down browse prompt history.
|
|
184
|
-
- Ctrl+D exits from an empty prompt.
|
|
185
|
-
- Ctrl+C stops the current response while assistant or tool output is running.
|
|
186
|
-
- Backspace at the beginning of the prompt removes the most recent image attachment.
|
|
156
|
+
One-shot prompts do not use Kward memory.
|
|
187
157
|
|
|
188
|
-
|
|
158
|
+
## Workspace tools
|
|
189
159
|
|
|
190
|
-
|
|
160
|
+
During a turn, Kward can inspect and change the workspace with tools for:
|
|
191
161
|
|
|
192
|
-
|
|
162
|
+
- listing and reading files,
|
|
163
|
+
- creating and editing files,
|
|
164
|
+
- running shell commands,
|
|
165
|
+
- searching the web,
|
|
166
|
+
- fetching specific URLs,
|
|
167
|
+
- inspecting public source repositories,
|
|
168
|
+
- asking structured clarification questions.
|
|
193
169
|
|
|
194
|
-
|
|
195
|
-
- Markdown image links,
|
|
196
|
-
- `file://` image URLs,
|
|
197
|
-
- image data URLs.
|
|
170
|
+
Important guardrails:
|
|
198
171
|
|
|
199
|
-
|
|
172
|
+
- Existing files must be read before Kward can edit or overwrite them.
|
|
173
|
+
- File reads and edits are bounded to avoid loading very large files by accident.
|
|
174
|
+
- Shell commands run from the workspace and should be treated like commands you run yourself.
|
|
200
175
|
|
|
201
|
-
##
|
|
176
|
+
## Images
|
|
202
177
|
|
|
203
|
-
|
|
178
|
+
If the active model supports images, Kward can attach image paths, Markdown image links, `file://` URLs, or image data URLs pasted into the composer.
|
|
204
179
|
|
|
205
|
-
|
|
206
|
-
|
|
180
|
+
Use this for tasks such as:
|
|
181
|
+
|
|
182
|
+
```text
|
|
183
|
+
This screenshot shows the broken layout. Find the likely CSS issue.
|
|
207
184
|
```
|
|
208
185
|
|
|
209
|
-
|
|
186
|
+
## Pan mode
|
|
187
|
+
|
|
188
|
+
Pan mode starts a simple LAN web UI:
|
|
210
189
|
|
|
211
190
|
```bash
|
|
212
|
-
|
|
191
|
+
kward --working-directory ~/code/project pan
|
|
213
192
|
```
|
|
214
193
|
|
|
215
|
-
|
|
194
|
+
Use it only on trusted networks. It exposes the same file, shell, and web tools through a browser UI and requires credentials configured in `config.json`. See [Configuration](configuration.md).
|
|
195
|
+
|
|
196
|
+
## RPC backend
|
|
216
197
|
|
|
217
|
-
|
|
198
|
+
`kward rpc` starts the experimental JSON-RPC backend for UI clients and editor integrations. Terminal users can ignore it. Integration authors should read [RPC protocol](rpc.md).
|