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/extensibility.md
CHANGED
|
@@ -1,181 +1,125 @@
|
|
|
1
1
|
# Extensibility
|
|
2
2
|
|
|
3
|
-
Kward can be customized
|
|
3
|
+
Kward can be customized without changing its source code. Use extensibility when you want Kward to follow your conventions, repeat common prompts, or add local behavior.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- Prompt templates for reusable slash-command prompts.
|
|
7
|
-
- Skills for reusable agent instructions the model can load on demand.
|
|
8
|
-
- Personas for assistant personality and communication style.
|
|
9
|
-
- Plugins for trusted Ruby extensions that add commands, footer UI, prompt context, transcript-event observers, and RPC-visible behavior.
|
|
5
|
+
Start simple. Most users only need `PRINCIPLES.md`, workspace `AGENTS.md`, and maybe a prompt template.
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
## Choose the right extension point
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
| Need | Use |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Global coding preferences | `~/.kward/PRINCIPLES.md` |
|
|
12
|
+
| Repository-specific rules | `<workspace>/AGENTS.md` |
|
|
13
|
+
| Reusable slash prompts | prompt templates |
|
|
14
|
+
| Task-specific reusable instructions | skills |
|
|
15
|
+
| Different tone or role | [personas](personas.md) |
|
|
16
|
+
| Local Ruby behavior or integrations | plugins |
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- Use `AGENTS.md` when you want Kward to follow coding rules, project conventions, or review expectations.
|
|
18
|
-
- Use prompt templates when you want reusable slash commands such as `/plan <task>` or `/review <diff>`.
|
|
19
|
-
- Use skills when you want reusable instructions that Kward can load only when a task needs them.
|
|
20
|
-
- Use personas when you want to change tone, role, or communication style.
|
|
21
|
-
- Use plugins when you need Ruby code to run locally, add commands, observe transcript events, or integrate with another tool.
|
|
22
|
-
|
|
23
|
-
The optional starter pack installs a useful base `AGENTS.md` and prompt templates. You can install it with:
|
|
18
|
+
Install the starter pack for a useful starting point:
|
|
24
19
|
|
|
25
20
|
```bash
|
|
26
21
|
kward init
|
|
27
22
|
```
|
|
28
23
|
|
|
29
|
-
##
|
|
24
|
+
## Global instructions: `PRINCIPLES.md`
|
|
30
25
|
|
|
31
|
-
|
|
26
|
+
Use this for preferences you want in most projects:
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
```markdown
|
|
29
|
+
Prefer small, focused changes.
|
|
30
|
+
Add tests for new behavior.
|
|
31
|
+
Do not refactor unrelated code.
|
|
32
|
+
Explain risky assumptions before editing.
|
|
33
|
+
```
|
|
35
34
|
|
|
36
|
-
|
|
35
|
+
Default location:
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
```text
|
|
38
|
+
~/.kward/PRINCIPLES.md
|
|
39
|
+
```
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
If `KWARD_CONFIG_PATH` is set, `PRINCIPLES.md` lives beside that config file.
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
## Project instructions: `AGENTS.md`
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
Put repository-specific rules in the workspace root:
|
|
45
46
|
|
|
46
47
|
```text
|
|
47
|
-
|
|
48
|
+
my-project/AGENTS.md
|
|
48
49
|
```
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Built-in commands such as `/exit`, `/new`, `/resume`, `/name`, `/clone`, `/export`, `/redraw`, and `/status` are reserved.
|
|
53
|
-
|
|
54
|
-
Example prompt template:
|
|
51
|
+
Good examples:
|
|
55
52
|
|
|
56
53
|
```markdown
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
Run tests with `bundle exec rake test`.
|
|
55
|
+
Use Minitest, not RSpec.
|
|
56
|
+
Do not change generated files under `schema/`.
|
|
57
|
+
Update CHANGELOG.md for user-visible changes.
|
|
58
|
+
```
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
Use `AGENTS.md` for project facts and engineering rules. Do not put personality or roleplay instructions there; use [personas](personas.md) for tone.
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
```
|
|
62
|
+
By default, Kward adds a compact instruction telling the model that `AGENTS.md` exists and should be read when relevant. Set `enforce_workspace_agents_file: true` only if you want the full file injected every time.
|
|
66
63
|
|
|
67
|
-
##
|
|
64
|
+
## Prompt templates
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
Use prompt templates when you repeatedly type the same kind of request.
|
|
70
67
|
|
|
71
|
-
Create
|
|
68
|
+
Create:
|
|
72
69
|
|
|
73
70
|
```text
|
|
74
|
-
|
|
71
|
+
~/.kward/prompts/review.md
|
|
75
72
|
```
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
Example skill:
|
|
74
|
+
Example:
|
|
80
75
|
|
|
81
76
|
```markdown
|
|
82
77
|
---
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
description: Review a change for correctness.
|
|
79
|
+
argument-hint: <focus>
|
|
85
80
|
---
|
|
86
81
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Use this when planning a code change.
|
|
82
|
+
Review the current diff for correctness, tests, and maintainability.
|
|
83
|
+
Focus on: $ARGUMENTS
|
|
90
84
|
```
|
|
91
85
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Personas configure personality, role, and communication style without modifying repository files. New configs include a single active `kward` character by default; edit or remove `personas.default` to change the first-run experience. `personas.crew` is still accepted as an alias for `personas.characters`.
|
|
95
|
-
|
|
96
|
-
A small persona config looks like this:
|
|
97
|
-
|
|
98
|
-
```json
|
|
99
|
-
{
|
|
100
|
-
"personas": {
|
|
101
|
-
"characters": [
|
|
102
|
-
{
|
|
103
|
-
"key": "kward",
|
|
104
|
-
"label": "Kward",
|
|
105
|
-
"instruction": "Be concise, practical, and friendly. Prefer small, safe changes."
|
|
106
|
-
}
|
|
107
|
-
],
|
|
108
|
-
"default": "kward"
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
```
|
|
86
|
+
Then run inside Kward:
|
|
112
87
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
```json
|
|
116
|
-
{
|
|
117
|
-
"personas": {
|
|
118
|
-
"characters": [
|
|
119
|
-
{
|
|
120
|
-
"key": "reviewer",
|
|
121
|
-
"label": "Reviewer",
|
|
122
|
-
"instruction": "Be skeptical and focus on correctness, tests, and maintainability."
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"key": "coach",
|
|
126
|
-
"label": "Coach",
|
|
127
|
-
"instruction": "Explain tradeoffs and teach as you go."
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
"default": "reviewer",
|
|
131
|
-
"workspaces": {
|
|
132
|
-
"/Users/kwood/Repositories/github.com/kaiwood/tauren": "coach"
|
|
133
|
-
},
|
|
134
|
-
"models": {
|
|
135
|
-
"gpt-5.5": "reviewer"
|
|
136
|
-
},
|
|
137
|
-
"persona_modifiers": {
|
|
138
|
-
"reasoning": {
|
|
139
|
-
"high": "Think strategically before answering."
|
|
140
|
-
},
|
|
141
|
-
"suffix": "Act like it."
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
88
|
+
```text
|
|
89
|
+
/review auth edge cases
|
|
145
90
|
```
|
|
146
91
|
|
|
147
|
-
|
|
92
|
+
Prompt templates are best for reusable text. They do not run local code.
|
|
148
93
|
|
|
149
|
-
|
|
150
|
-
2. Matching `personas.workspaces` entry, using normalized workspace paths
|
|
151
|
-
3. Matching `personas.models` entry for the current model
|
|
152
|
-
4. Matching `persona_modifiers.reasoning` entry for the current reasoning effort
|
|
153
|
-
5. Matching `persona_modifiers.time_of_day` entry for local time: `morning` 05:00-10:59, `before_lunch` 11:00-11:59, `late_evening` 21:00-04:59
|
|
154
|
-
6. Matching `persona_modifiers.weekday` entry for the local weekday
|
|
155
|
-
7. `persona_modifiers.suffix`
|
|
94
|
+
## Skills
|
|
156
95
|
|
|
157
|
-
|
|
96
|
+
Use skills for reusable instructions that should only be loaded for certain tasks.
|
|
158
97
|
|
|
159
|
-
|
|
160
|
-
2. Config-directory `AGENTS.md`
|
|
161
|
-
3. Evaluated persona text
|
|
162
|
-
4. Plugin prompt context
|
|
163
|
-
5. Skills listing
|
|
164
|
-
6. Workspace `AGENTS.md`
|
|
98
|
+
Create:
|
|
165
99
|
|
|
166
|
-
|
|
100
|
+
```text
|
|
101
|
+
~/.kward/skills/testing/SKILL.md
|
|
102
|
+
```
|
|
167
103
|
|
|
168
|
-
|
|
104
|
+
Example:
|
|
105
|
+
|
|
106
|
+
```markdown
|
|
107
|
+
---
|
|
108
|
+
name: testing
|
|
109
|
+
or description: Use when adding or changing tests.
|
|
110
|
+
---
|
|
169
111
|
|
|
170
|
-
|
|
112
|
+
Prefer focused tests near the changed behavior.
|
|
113
|
+
Do not weaken assertions to make tests pass.
|
|
114
|
+
```
|
|
171
115
|
|
|
172
|
-
|
|
116
|
+
Skills are listed to the model by name and description. Kward can load the full skill only when it is relevant.
|
|
173
117
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
118
|
+
## Plugins
|
|
119
|
+
|
|
120
|
+
Use plugins when text instructions are not enough and you need Ruby code to run locally.
|
|
121
|
+
|
|
122
|
+
Plugins can add slash commands, prompt context, footer UI, transcript observers, and RPC-visible commands.
|
|
179
123
|
|
|
180
124
|
Plugin files live in:
|
|
181
125
|
|
|
@@ -183,4 +127,21 @@ Plugin files live in:
|
|
|
183
127
|
~/.kward/plugins/*.rb
|
|
184
128
|
```
|
|
185
129
|
|
|
186
|
-
|
|
130
|
+
Plugins are trusted local Ruby code. Install only plugins you trust. See [Plugins](plugins.md).
|
|
131
|
+
|
|
132
|
+
## Prompt assembly order
|
|
133
|
+
|
|
134
|
+
When Kward builds instructions for a turn, it combines roughly:
|
|
135
|
+
|
|
136
|
+
1. Kward's built-in operating instructions.
|
|
137
|
+
2. `PRINCIPLES.md`.
|
|
138
|
+
3. selected persona.
|
|
139
|
+
4. plugin prompt context.
|
|
140
|
+
5. available skills list.
|
|
141
|
+
6. workspace `AGENTS.md` hint or full content.
|
|
142
|
+
|
|
143
|
+
If behavior seems surprising, inspect the assembled instructions:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
kward sysprompt
|
|
147
|
+
```
|
data/doc/getting-started.md
CHANGED
|
@@ -1,125 +1,123 @@
|
|
|
1
1
|
# Getting started
|
|
2
2
|
|
|
3
|
-
Kward
|
|
3
|
+
Use Kward when you want an agent in your terminal that can inspect the current project, explain code, edit files, run local commands, and keep an interactive session history.
|
|
4
4
|
|
|
5
|
-
This page gets you to a first
|
|
5
|
+
This page gets you from install to a first useful chat.
|
|
6
6
|
|
|
7
7
|
## Requirements
|
|
8
8
|
|
|
9
9
|
- Ruby 3.2 or newer.
|
|
10
|
-
-
|
|
11
|
-
-
|
|
10
|
+
- Credentials for one model provider. The easiest setup is `kward login` or `/login` inside Kward.
|
|
11
|
+
- Bundler only if you run Kward from a source checkout.
|
|
12
12
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
|
-
Install
|
|
15
|
+
Install the gem:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
gem install kward
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Install the starter pack:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
24
|
kward init
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
The starter pack adds
|
|
27
|
+
The starter pack adds default prompts and a base `PRINCIPLES.md` under `~/.kward`. It does not overwrite existing files.
|
|
28
28
|
|
|
29
|
-
If you are working from a
|
|
29
|
+
If you are working from a checkout instead:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
bundle install
|
|
33
|
-
ruby lib/main.rb init
|
|
33
|
+
ruby lib/main.rb init
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Sign in
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
From your shell:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
kward
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
From source:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
ruby lib/main.rb
|
|
41
|
+
kward login
|
|
48
42
|
```
|
|
49
43
|
|
|
50
|
-
|
|
44
|
+
Or from inside an interactive session:
|
|
51
45
|
|
|
52
46
|
```text
|
|
53
47
|
/login
|
|
54
48
|
```
|
|
55
49
|
|
|
56
|
-
|
|
50
|
+
Kward supports OpenAI/ChatGPT, Anthropic Claude Pro/Max, OpenRouter, and experimental Copilot credentials. See [Authentication](authentication.md) when you need a specific provider.
|
|
57
51
|
|
|
58
|
-
|
|
59
|
-
kward login
|
|
60
|
-
```
|
|
52
|
+
## Start an interactive chat
|
|
61
53
|
|
|
62
|
-
|
|
54
|
+
Run Kward from the project you want it to work on:
|
|
63
55
|
|
|
64
56
|
```bash
|
|
65
|
-
|
|
57
|
+
cd ~/code/my-project
|
|
58
|
+
kward
|
|
66
59
|
```
|
|
67
60
|
|
|
68
|
-
|
|
61
|
+
Ask something concrete:
|
|
69
62
|
|
|
70
|
-
|
|
63
|
+
```text
|
|
64
|
+
Explain the structure of this project.
|
|
65
|
+
```
|
|
71
66
|
|
|
72
|
-
|
|
67
|
+
Then try a task that uses the workspace:
|
|
73
68
|
|
|
74
|
-
```
|
|
75
|
-
|
|
69
|
+
```text
|
|
70
|
+
Find where user authentication is implemented and summarize the flow.
|
|
76
71
|
```
|
|
77
72
|
|
|
78
|
-
|
|
73
|
+
Kward can read files, suggest edits, apply changes, and run commands from the workspace. Existing files must be read in the current conversation before Kward can edit them.
|
|
74
|
+
|
|
75
|
+
## Ask one question and exit
|
|
76
|
+
|
|
77
|
+
For quick tasks, pass the prompt directly:
|
|
79
78
|
|
|
80
79
|
```bash
|
|
81
|
-
|
|
80
|
+
kward "Explain this project"
|
|
82
81
|
```
|
|
83
82
|
|
|
84
|
-
|
|
83
|
+
Review a diff:
|
|
85
84
|
|
|
86
85
|
```bash
|
|
87
|
-
git diff | kward "Review this diff"
|
|
86
|
+
git diff | kward "Review this diff for bugs"
|
|
88
87
|
```
|
|
89
88
|
|
|
90
89
|
One-shot prompts do not use Kward memory.
|
|
91
90
|
|
|
92
91
|
## Useful first commands
|
|
93
92
|
|
|
94
|
-
Inside
|
|
93
|
+
Inside interactive Kward:
|
|
95
94
|
|
|
96
95
|
```text
|
|
97
96
|
/login sign in or save provider credentials
|
|
98
|
-
/
|
|
99
|
-
/
|
|
100
|
-
/
|
|
101
|
-
/
|
|
102
|
-
/
|
|
103
|
-
/exit leave
|
|
97
|
+
/model choose a model
|
|
98
|
+
/status show session and context status
|
|
99
|
+
/resume resume a previous session
|
|
100
|
+
/export notes.md export the transcript
|
|
101
|
+
/compact summarize older context when a chat gets long
|
|
102
|
+
/exit leave Kward
|
|
104
103
|
```
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
## Safety basics
|
|
109
|
-
|
|
110
|
-
- Kward must read an existing file in the current conversation before it can edit or overwrite it.
|
|
111
|
-
- Tool reads are bounded so large files are not accidentally loaded into context.
|
|
112
|
-
|
|
113
|
-
## Run tests
|
|
114
|
-
|
|
115
|
-
If you are developing Kward itself:
|
|
105
|
+
## Run from source
|
|
116
106
|
|
|
117
107
|
```bash
|
|
118
|
-
|
|
108
|
+
ruby lib/main.rb login
|
|
109
|
+
ruby lib/main.rb
|
|
110
|
+
ruby lib/main.rb "Explain this project"
|
|
119
111
|
```
|
|
120
112
|
|
|
121
|
-
|
|
113
|
+
You can also run:
|
|
122
114
|
|
|
123
115
|
```bash
|
|
124
|
-
|
|
116
|
+
exe/kward
|
|
125
117
|
```
|
|
118
|
+
|
|
119
|
+
## Next steps
|
|
120
|
+
|
|
121
|
+
- Read [Usage](usage.md) for day-to-day workflows.
|
|
122
|
+
- Read [Configuration](configuration.md) when you want to change providers, models, memory, or web search.
|
|
123
|
+
- Read [Extensibility](extensibility.md) when you want reusable prompts, skills, or project rules.
|