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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a84b87d1fd620a0008222c1f7cf6efd3fb7d019818e6674f75e3160ad738d2b3
|
|
4
|
+
data.tar.gz: 297fc5bd96d88356731b659cd6d43da8349e5711e50f1419a11afdab82192d57
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f7614a284acdd69deeeb8ae509ca42b093e7e9e55eac47d4c23d63d30ca0ccb4079c5fc21f747863097d1c938084627d6576b32b12cdecc7754c5cecff558db
|
|
7
|
+
data.tar.gz: ccc2a3e15276ef03d50b4d52ccdc1b1977c1555b3f367d152b8d889ee518d315645a910a6d1940a94e7fb5e378bf5a614bfe87189b8e723505e7eba3aaf13c0d
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Deploy documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pages: write
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: pages
|
|
16
|
+
cancel-in-progress: false
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout
|
|
23
|
+
uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Set up Ruby
|
|
26
|
+
uses: ruby/setup-ruby@v1
|
|
27
|
+
with:
|
|
28
|
+
ruby-version: '3.2'
|
|
29
|
+
bundler-cache: true
|
|
30
|
+
|
|
31
|
+
- name: Build documentation
|
|
32
|
+
run: bundle exec rake docs:build
|
|
33
|
+
|
|
34
|
+
- name: Upload Pages artifact
|
|
35
|
+
uses: actions/upload-pages-artifact@v3
|
|
36
|
+
with:
|
|
37
|
+
path: _yardoc
|
|
38
|
+
|
|
39
|
+
deploy:
|
|
40
|
+
environment:
|
|
41
|
+
name: github-pages
|
|
42
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
needs: build
|
|
45
|
+
steps:
|
|
46
|
+
- name: Deploy to GitHub Pages
|
|
47
|
+
id: deployment
|
|
48
|
+
uses: actions/deploy-pages@v4
|
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,40 @@ All notable changes to Kward will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.69.0] - 2026-06-17
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Added a `docs:build` Rake task for building the YARD documentation site.
|
|
12
|
+
- Reworked core guide documentation around developer workflows, setup, authentication, memory, personas, extensibility, plugins, web search, and code search.
|
|
13
|
+
- Added `fetch_content` and `fetch_raw` web tools for reading specific URLs after search discovery.
|
|
14
|
+
- Added `enforce_workspace_agents_file` config support for forcing full workspace `AGENTS.md` injection.
|
|
15
|
+
- Added config-directory `PRINCIPLES.md` as the preferred global principles file, with `AGENTS.md` kept as a legacy alias.
|
|
16
|
+
- Added `kward sysprompt` for inspecting the effective system prompt, with `--raw` for unannotated prompt content.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Changed workspace `AGENTS.md` handling to inject a compact read-when-relevant instruction by default instead of the full file.
|
|
21
|
+
- Changed interactive runtime command/status messages to use a `Runtime>` transcript label instead of the assistant label.
|
|
22
|
+
- Changed terminal tool transcript rendering to show a single `Tool>` block containing the tool invocation summary and result summary.
|
|
23
|
+
- Changed transcript label colors to a quieter palette, with failed tool calls rendered in red.
|
|
24
|
+
- Separated conversation system prompt state from durable transcript messages; provider request context still includes the current system prompt on every model request.
|
|
25
|
+
- Persisted system prompt snapshots as session audit metadata when the prompt changes, without adding them to transcript messages.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Fixed custom `ask_user_question` answers so trailing spaces remain visible while typing.
|
|
30
|
+
- Fixed inferred soft memory learning to canonicalize user preferences and avoid storing near-duplicate memories with slightly different wording.
|
|
31
|
+
- Fixed in-flight steering messages so they appear in the interactive transcript as `You>` entries.
|
|
32
|
+
- Fixed interactive plugin slash commands and OAuth login so they show the running spinner while executing.
|
|
33
|
+
- Fixed `/reload` so terminal plugin footers use the newly loaded plugin renderer without restarting Kward.
|
|
34
|
+
- Fixed Codex GPT-5.5 RPC model metadata to report a 400k context window instead of the upstream OpenAI API context window.
|
|
35
|
+
- Fixed a bug that prevented proper context window calculation whenever an image is attached to a session
|
|
36
|
+
- Fixed persona selection so workspace and model personas override the default base persona instead of appending duplicate base personas.
|
|
37
|
+
- Fixed Codex Responses streaming to preserve ordered response items, replay assistant phase metadata, and keep commentary/tool-planning text out of visible assistant output.
|
|
38
|
+
- Fixed Codex multi-turn requests with `store: false` by not replaying server-assigned response item ids.
|
|
39
|
+
- Fixed RPC session listing to include each session's persisted provider, model, and reasoning effort so pickers can show session-specific runtime state.
|
|
40
|
+
|
|
7
41
|
## [0.68.0] - 2026-06-14
|
|
8
42
|
|
|
9
43
|
In this release, most changes are under the hood, as it included massive refactors to have an even more robust way forward.
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
kward (0.
|
|
4
|
+
kward (0.69.0)
|
|
5
5
|
base64
|
|
6
6
|
nokogiri
|
|
7
7
|
tiktoken_ruby
|
|
@@ -22,6 +22,8 @@ GEM
|
|
|
22
22
|
prism (~> 1.5)
|
|
23
23
|
nokogiri (1.19.3-arm64-darwin)
|
|
24
24
|
racc (~> 1.4)
|
|
25
|
+
nokogiri (1.19.3-x86_64-linux-gnu)
|
|
26
|
+
racc (~> 1.4)
|
|
25
27
|
pastel (0.8.0)
|
|
26
28
|
tty-color (~> 0.5)
|
|
27
29
|
prism (1.9.0)
|
|
@@ -36,6 +38,7 @@ GEM
|
|
|
36
38
|
tsort
|
|
37
39
|
stringio (3.2.0)
|
|
38
40
|
tiktoken_ruby (0.0.16-arm64-darwin)
|
|
41
|
+
tiktoken_ruby (0.0.16-x86_64-linux)
|
|
39
42
|
tsort (0.2.0)
|
|
40
43
|
tty-color (0.6.0)
|
|
41
44
|
tty-cursor (0.7.1)
|
|
@@ -53,6 +56,7 @@ GEM
|
|
|
53
56
|
PLATFORMS
|
|
54
57
|
arm64-darwin
|
|
55
58
|
arm64-darwin-25
|
|
59
|
+
x86_64-linux
|
|
56
60
|
|
|
57
61
|
DEPENDENCIES
|
|
58
62
|
kward!
|
|
@@ -66,9 +70,10 @@ CHECKSUMS
|
|
|
66
70
|
date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0
|
|
67
71
|
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
|
|
68
72
|
erb (6.0.4) sha256=38e3803694be357fe2bfe312487c74beaf9fb4e5beb3e22498952fe1645b95d9
|
|
69
|
-
kward (0.
|
|
73
|
+
kward (0.69.0)
|
|
70
74
|
minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
|
|
71
75
|
nokogiri (1.19.3-arm64-darwin) sha256=71b9bd424b1b7abc18b05052a1a3cfd3627abdca62be280854cc411791357e42
|
|
76
|
+
nokogiri (1.19.3-x86_64-linux-gnu) sha256=2f5078620fe12e83669b5b17311b32532a8153d02eee7ad06948b926d6080976
|
|
72
77
|
pastel (0.8.0) sha256=481da9fb7d2f6e6b1a08faf11fa10363172dc40fd47848f096ae21209f805a75
|
|
73
78
|
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
74
79
|
psych (5.4.0) sha256=14f72d69a611af663d7d70e4a7b67d9eb1f3ae9f8d916b478961d5a0075ba5b7
|
|
@@ -77,6 +82,7 @@ CHECKSUMS
|
|
|
77
82
|
rdoc (7.2.0) sha256=8650f76cd4009c3b54955eb5d7e3a075c60a57276766ebf36f9085e8c9f23192
|
|
78
83
|
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
|
|
79
84
|
tiktoken_ruby (0.0.16-arm64-darwin) sha256=3da6fe850bf920d08c7eb736673f50bc9d08e8f2e17d34904ad3185a73fc9da7
|
|
85
|
+
tiktoken_ruby (0.0.16-x86_64-linux) sha256=4d970b8e68a86972ec81799306116480b33a558c06bb4fe0092852280a4b76b2
|
|
80
86
|
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
|
|
81
87
|
tty-color (0.6.0) sha256=6f9c37ca3a4e2367fb2e6d09722762647d6f455c111f05b59f35730eeb24332a
|
|
82
88
|
tty-cursor (0.7.1) sha256=79534185e6a777888d88628b14b6a1fdf5154a603f285f80b1753e1908e0bf48
|
data/README.md
CHANGED
|
@@ -4,6 +4,27 @@ Kward is an extendable Ruby CLI coding agent. It can chat with you about a proje
|
|
|
4
4
|
|
|
5
5
|
It currently supports the OpenAI/ChatGPT Codex backend, Anthropic Claude Pro/Max subscription, OpenRouter, and experimental Copilot provider support.
|
|
6
6
|
|
|
7
|
+
## Why use Kward?
|
|
8
|
+
|
|
9
|
+
Kward is designed for working with real projects, not isolated prompts.
|
|
10
|
+
|
|
11
|
+
Typical workflows include:
|
|
12
|
+
|
|
13
|
+
- Understanding an unfamiliar codebase
|
|
14
|
+
- Investigating bugs
|
|
15
|
+
- Reviewing changes
|
|
16
|
+
- Refactoring code
|
|
17
|
+
- Automating repetitive development tasks
|
|
18
|
+
- Building custom agent workflows through plugins
|
|
19
|
+
|
|
20
|
+
Examples:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
kward "Explain this project"
|
|
24
|
+
kward "Review this diff"
|
|
25
|
+
kward "Find performance problems in this codebase"
|
|
26
|
+
```
|
|
27
|
+
|
|
7
28
|
## Install
|
|
8
29
|
|
|
9
30
|
Install Kward from RubyGems:
|
|
@@ -18,7 +39,7 @@ Optionally install the starter pack after installation:
|
|
|
18
39
|
kward init
|
|
19
40
|
```
|
|
20
41
|
|
|
21
|
-
This downloads Kward's default prompts and base `
|
|
42
|
+
This downloads Kward's default prompts and base `PRINCIPLES.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.
|
|
22
43
|
|
|
23
44
|
Then start Kward and sign in when needed:
|
|
24
45
|
|
|
@@ -33,24 +54,6 @@ kward --working-directory ~/code/project "Explain this project"
|
|
|
33
54
|
|
|
34
55
|
See [Authentication](doc/authentication.md) for more details about sign-in options and provider credentials.
|
|
35
56
|
|
|
36
|
-
## Run from source
|
|
37
|
-
|
|
38
|
-
If you are working from a checkout:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
bundle install
|
|
42
|
-
ruby lib/main.rb login # sign in or save provider credentials
|
|
43
|
-
ruby lib/main.rb # start an interactive chat
|
|
44
|
-
ruby lib/main.rb help # show available commands and examples
|
|
45
|
-
ruby lib/main.rb "Explain this project" # run one prompt and exit
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
You can also use the executable directly after installing dependencies:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
exe/kward
|
|
52
|
-
```
|
|
53
|
-
|
|
54
57
|
## What Kward can do
|
|
55
58
|
|
|
56
59
|
- Keep a multi-turn coding conversation in your terminal.
|
|
@@ -75,7 +78,8 @@ Start here:
|
|
|
75
78
|
Feature guides:
|
|
76
79
|
|
|
77
80
|
- [Memory](doc/memory.md): opt-in core, soft, and session memory.
|
|
78
|
-
- [
|
|
81
|
+
- [Personas](doc/personas.md): configure Kward's tone and role by default, workspace, model, reasoning effort, time, and weekday.
|
|
82
|
+
- [Extensibility](doc/extensibility.md): `PRINCIPLES.md`, workspace `AGENTS.md`, skills, prompt templates, and extension choices.
|
|
79
83
|
- [Plugins](doc/plugins.md): trusted Ruby plugins for commands, footer UI, prompt context, transcript events, and RPC clients.
|
|
80
84
|
- [Web search](doc/web-search.md): live search providers and network behavior.
|
|
81
85
|
- [Code search](doc/code-search.md): package lookup, GitHub repository cache, and external source reading.
|
|
@@ -85,21 +89,24 @@ Advanced/reference:
|
|
|
85
89
|
- [RPC protocol](doc/rpc.md): experimental JSON-RPC backend mode for UI clients.
|
|
86
90
|
- [Releasing](doc/releasing.md): release checklist for RubyGems publishing.
|
|
87
91
|
|
|
88
|
-
##
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
Run tests:
|
|
89
95
|
|
|
90
96
|
```bash
|
|
91
97
|
bundle exec rake test
|
|
92
98
|
```
|
|
93
99
|
|
|
94
|
-
|
|
100
|
+
Build the YARD documentation site:
|
|
95
101
|
|
|
96
102
|
```bash
|
|
97
|
-
|
|
103
|
+
bundle exec rake docs:build
|
|
98
104
|
```
|
|
99
105
|
|
|
100
|
-
|
|
106
|
+
The generated site is written to `_yardoc/`. Pushes to `main` deploy that directory to GitHub Pages.
|
|
107
|
+
|
|
108
|
+
Generate the RDoc API documentation:
|
|
101
109
|
|
|
102
110
|
```bash
|
|
103
111
|
bundle exec rake rdoc
|
|
104
|
-
bundle exec yard doc
|
|
105
112
|
```
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "fileutils"
|
|
1
2
|
require "rdoc/task"
|
|
2
3
|
require "yard"
|
|
3
4
|
require "yard/rake/yardoc_task"
|
|
@@ -16,5 +17,17 @@ end
|
|
|
16
17
|
|
|
17
18
|
YARD::Rake::YardocTask.new do |yard|
|
|
18
19
|
yard.files = ["lib/**/*.rb", "-", "README.md", "CHANGELOG.md", "LICENSE", "doc/**/*.md"]
|
|
19
|
-
yard.options = [
|
|
20
|
+
yard.options = [
|
|
21
|
+
"--readme", "README.md",
|
|
22
|
+
"--output-dir", "_yardoc",
|
|
23
|
+
"--markup", "markdown",
|
|
24
|
+
"--template-path", "templates"
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
namespace :docs do
|
|
29
|
+
desc "Build the YARD documentation site"
|
|
30
|
+
task build: :yard do
|
|
31
|
+
FileUtils.touch("_yardoc/.nojekyll")
|
|
32
|
+
end
|
|
20
33
|
end
|
data/doc/authentication.md
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
# Authentication
|
|
2
2
|
|
|
3
|
-
Kward needs
|
|
3
|
+
Kward needs access to a model provider before it can answer prompts. The fastest path is:
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- Anthropic OAuth for Claude Pro/Max subscription support.
|
|
9
|
-
- OpenRouter API keys.
|
|
10
|
-
- GitHub OAuth or `COPILOT_GITHUB_TOKEN` for experimental Copilot provider support.
|
|
11
|
-
|
|
12
|
-
If you installed the gem, use `kward` in the examples below. When running from source, use `ruby lib/main.rb` instead.
|
|
13
|
-
|
|
14
|
-
## Quick login
|
|
5
|
+
```bash
|
|
6
|
+
kward login
|
|
7
|
+
```
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
Or inside interactive Kward:
|
|
17
10
|
|
|
18
11
|
```text
|
|
19
12
|
/login
|
|
20
13
|
```
|
|
21
14
|
|
|
22
|
-
|
|
15
|
+
Use the provider you already have access to. You can change providers later.
|
|
16
|
+
|
|
17
|
+
## Choose a provider
|
|
18
|
+
|
|
19
|
+
| Provider | Use it when... |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| OpenAI/ChatGPT | You want the default Codex backend with a ChatGPT account. |
|
|
22
|
+
| Anthropic | You have Claude Pro/Max and want to use Claude through Kward. |
|
|
23
|
+
| OpenRouter | You want to use an OpenRouter API key and choose from its model catalog. |
|
|
24
|
+
| Copilot | You want to try experimental Copilot provider support. |
|
|
25
|
+
|
|
26
|
+
If you are unsure, start with `kward login` and choose OpenAI.
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
## Login commands
|
|
25
29
|
|
|
26
30
|
```bash
|
|
27
31
|
kward login # OpenAI/ChatGPT OAuth
|
|
28
32
|
kward login anthropic # Anthropic Claude Pro/Max OAuth
|
|
29
|
-
kward login openrouter #
|
|
33
|
+
kward login openrouter # OpenRouter API key
|
|
30
34
|
kward login github # GitHub OAuth for experimental Copilot support
|
|
31
35
|
```
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
From source, replace `kward` with `ruby lib/main.rb`.
|
|
34
38
|
|
|
35
|
-
OpenAI
|
|
36
|
-
|
|
37
|
-
To start the browser login from your shell:
|
|
39
|
+
## OpenAI / ChatGPT
|
|
38
40
|
|
|
39
41
|
```bash
|
|
40
42
|
kward login
|
|
41
43
|
```
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Complete the browser redirect flow. Tokens are saved to:
|
|
45
|
+
This opens a browser login and saves credentials to:
|
|
46
46
|
|
|
47
47
|
```text
|
|
48
48
|
~/.kward/auth.json
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Kward uses the ChatGPT/Codex backend, not the OpenAI Platform API key flow.
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
If Kward asks for an OAuth client ID, add it to `~/.kward/config.json`:
|
|
54
54
|
|
|
55
55
|
```json
|
|
56
56
|
{
|
|
@@ -58,71 +58,89 @@ OpenAI OAuth requires an OAuth client ID in `~/.kward/config.json`:
|
|
|
58
58
|
}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
## Anthropic OAuth
|
|
64
|
-
|
|
65
|
-
Anthropic OAuth uses your Claude Pro/Max subscription and sends requests to the Anthropic Messages API with Claude Code-compatible subscription headers. To start the browser login from your shell:
|
|
61
|
+
## Anthropic Claude Pro/Max
|
|
66
62
|
|
|
67
63
|
```bash
|
|
68
64
|
kward login anthropic
|
|
69
65
|
```
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Tokens are saved to:
|
|
67
|
+
This saves credentials to:
|
|
74
68
|
|
|
75
69
|
```text
|
|
76
70
|
~/.kward/anthropic_auth.json
|
|
77
71
|
```
|
|
78
72
|
|
|
79
|
-
|
|
73
|
+
Use this when you want Kward to use your Claude Pro/Max subscription. Kward refreshes the access token when a refresh token is available.
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
## OpenRouter API key
|
|
84
|
-
|
|
85
|
-
OpenRouter uses an API key rather than OAuth. To save it from your shell:
|
|
75
|
+
## OpenRouter
|
|
86
76
|
|
|
87
77
|
```bash
|
|
88
78
|
kward login openrouter
|
|
89
79
|
```
|
|
90
80
|
|
|
91
|
-
|
|
81
|
+
This stores your API key in `~/.kward/config.json`.
|
|
92
82
|
|
|
93
|
-
|
|
83
|
+
For a single shell session, you can avoid saving the key:
|
|
94
84
|
|
|
95
|
-
|
|
85
|
+
```bash
|
|
86
|
+
OPENROUTER_API_KEY=sk-or-v1-... kward
|
|
87
|
+
```
|
|
96
88
|
|
|
97
|
-
|
|
89
|
+
Choose OpenRouter when you want access to its model catalog or want provider/model selection through an API key.
|
|
98
90
|
|
|
99
|
-
|
|
91
|
+
## Experimental Copilot support
|
|
100
92
|
|
|
101
93
|
```bash
|
|
102
94
|
kward login github
|
|
103
95
|
```
|
|
104
96
|
|
|
105
|
-
|
|
97
|
+
This saves GitHub OAuth credentials to:
|
|
106
98
|
|
|
107
99
|
```text
|
|
108
100
|
~/.kward/github_auth.json
|
|
109
101
|
```
|
|
110
102
|
|
|
111
|
-
|
|
103
|
+
You can also use a token for one run:
|
|
112
104
|
|
|
113
|
-
|
|
105
|
+
```bash
|
|
106
|
+
COPILOT_GITHUB_TOKEN=... kward
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Copilot support is experimental and uses direct HTTPS calls to the Copilot proxy API. It does not use the official Copilot CLI or SDK runtime.
|
|
110
|
+
|
|
111
|
+
## Which credential wins?
|
|
112
|
+
|
|
113
|
+
If multiple credentials are available, Kward uses the configured provider.
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
Set it in `~/.kward/config.json`:
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"provider": "anthropic"
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Or for one command:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
KWARD_PROVIDER=openrouter kward
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Supported provider values:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
codex
|
|
133
|
+
anthropic
|
|
134
|
+
openrouter
|
|
135
|
+
copilot
|
|
136
|
+
```
|
|
118
137
|
|
|
119
|
-
|
|
138
|
+
Without an explicit provider, OpenAI/ChatGPT credentials are preferred when present.
|
|
120
139
|
|
|
121
|
-
|
|
122
|
-
- Anthropic OAuth is used when `provider` or `KWARD_PROVIDER` selects `anthropic` or `claude`.
|
|
123
|
-
- `OPENAI_ACCESS_TOKEN` can be used as an OpenAI environment fallback.
|
|
124
|
-
- `OPENROUTER_API_KEY` is a fallback only when no OpenAI OAuth/access token exists.
|
|
125
|
-
- `COPILOT_GITHUB_TOKEN` can be used as a Copilot environment fallback.
|
|
126
|
-
- If `provider` in config or `KWARD_PROVIDER` in the environment is set to `codex`, `anthropic`, `openrouter`, or `copilot`, Kward uses that provider and does not fall through to another provider.
|
|
140
|
+
## Security notes
|
|
127
141
|
|
|
128
|
-
|
|
142
|
+
- Auth files are written with file mode `0600` when possible.
|
|
143
|
+
- Do not commit `~/.kward/config.json` or auth files.
|
|
144
|
+
- Prefer environment variables for temporary credentials.
|
|
145
|
+
- `kward auth status` shows credential status without printing secrets.
|
|
146
|
+
- `kward auth logout` removes saved credentials.
|
data/doc/code-search.md
CHANGED
|
@@ -1,56 +1,83 @@
|
|
|
1
1
|
# Code search
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Code search lets Kward inspect public open-source repositories while working on your project.
|
|
4
4
|
|
|
5
|
-
Use
|
|
5
|
+
Use it when examples from real packages would make an answer better:
|
|
6
|
+
|
|
7
|
+
- checking how a library API is actually used,
|
|
8
|
+
- finding test patterns before adding tests,
|
|
9
|
+
- comparing implementation approaches,
|
|
10
|
+
- reading source for a dependency,
|
|
11
|
+
- investigating a public bug fix or release.
|
|
6
12
|
|
|
7
13
|
Example prompts:
|
|
8
14
|
|
|
9
15
|
```text
|
|
10
16
|
Look up how tty-prompt handles key bindings before changing our composer.
|
|
11
17
|
Find examples of Faraday retry middleware usage.
|
|
12
|
-
Inspect how Rails structures
|
|
18
|
+
Inspect how Rails structures generator tests.
|
|
19
|
+
Check the source for this gem before recommending an API call.
|
|
13
20
|
```
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
## How it works
|
|
23
|
+
|
|
24
|
+
The `code_search` tool can:
|
|
25
|
+
|
|
26
|
+
1. find package metadata from registries,
|
|
27
|
+
2. discover likely GitHub repositories,
|
|
28
|
+
3. clone public repositories into a local cache,
|
|
29
|
+
4. search cached files,
|
|
30
|
+
5. read bounded line ranges from cached files.
|
|
16
31
|
|
|
17
|
-
|
|
18
|
-
- find public GitHub source repositories from package metadata
|
|
19
|
-
- fall back to GitHub repository search when registry metadata has no source URL
|
|
20
|
-
- clone public GitHub repositories into Kward's cache
|
|
21
|
-
- search cached repository files and return bounded snippets with paths and line numbers
|
|
22
|
-
- read bounded line ranges from cached repository files
|
|
23
|
-
- list, refresh, and clear cached repositories
|
|
32
|
+
Kward should use this when the best answer depends on how another project actually implemented something.
|
|
24
33
|
|
|
25
|
-
## Cache
|
|
34
|
+
## Cache location
|
|
26
35
|
|
|
27
|
-
Repositories are
|
|
36
|
+
Repositories are cached outside your workspace:
|
|
28
37
|
|
|
29
38
|
```text
|
|
30
39
|
~/.kward/cache/code_search
|
|
31
40
|
```
|
|
32
41
|
|
|
33
|
-
If `KWARD_CONFIG_PATH` points
|
|
42
|
+
If `KWARD_CONFIG_PATH` points elsewhere, the cache lives beside that config directory under:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
cache/code_search
|
|
46
|
+
```
|
|
34
47
|
|
|
35
|
-
The
|
|
48
|
+
The cache is intentionally separate from your project. Kward uses GitHub `owner/name` cache keys and rejects absolute paths or path traversal when reading cached files.
|
|
36
49
|
|
|
37
50
|
## GitHub access
|
|
38
51
|
|
|
39
|
-
|
|
52
|
+
Code search uses live network access and the local `git` executable.
|
|
53
|
+
|
|
54
|
+
GitHub authentication is optional. To raise rate limits, set either:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
GITHUB_TOKEN=...
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
or:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
GH_TOKEN=...
|
|
64
|
+
```
|
|
40
65
|
|
|
41
|
-
Tokens are not included in tool output.
|
|
66
|
+
Tokens are used for GitHub API requests and are not included in tool output.
|
|
42
67
|
|
|
43
|
-
##
|
|
68
|
+
## Tool actions
|
|
44
69
|
|
|
45
|
-
The tool
|
|
70
|
+
The tool uses an `action` parameter:
|
|
46
71
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
72
|
+
| Action | Use it to... |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `package_search` | find package metadata and likely source repositories. |
|
|
75
|
+
| `github_search` | search public GitHub repositories. |
|
|
76
|
+
| `repo_clone` | clone a GitHub repository into cache. |
|
|
77
|
+
| `repo_search` | search files in a cached repository. |
|
|
78
|
+
| `repo_read` | read a bounded line range from a cached file. |
|
|
79
|
+
| `list_cache` | show cached repositories. |
|
|
80
|
+
| `refresh_cache` | fetch updates for a cached repository. |
|
|
81
|
+
| `clear_cache` | remove a cached repository. |
|
|
55
82
|
|
|
56
|
-
Search and read
|
|
83
|
+
Search and read results are bounded so Kward does not load large external repositories into context by accident. Oversized and binary files are skipped.
|
data/doc/configuration.md
CHANGED
|
@@ -281,6 +281,24 @@ For higher limits or alternate providers, add user-specific keys. Model-backed a
|
|
|
281
281
|
|
|
282
282
|
Do not put shared or published API keys in this file.
|
|
283
283
|
|
|
284
|
+
## Global principles
|
|
285
|
+
|
|
286
|
+
Put global engineering principles in `PRINCIPLES.md` beside your config file, usually `~/.kward/PRINCIPLES.md`. Kward appends this file to its built-in system instructions when present. Existing config-directory `AGENTS.md` files are still read as a legacy alias when `PRINCIPLES.md` is absent.
|
|
287
|
+
|
|
288
|
+
## Workspace AGENTS.md
|
|
289
|
+
|
|
290
|
+
By default, Kward does not inject the full workspace `AGENTS.md` into every request. When a workspace `AGENTS.md` exists, Kward injects a compact instruction telling the model to read it for repository-related tasks before analyzing or modifying project files.
|
|
291
|
+
|
|
292
|
+
For smaller models that need the workspace instructions in the initial system prompt, enforce direct injection:
|
|
293
|
+
|
|
294
|
+
```json
|
|
295
|
+
{
|
|
296
|
+
"enforce_workspace_agents_file": true
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
The default is `false`.
|
|
301
|
+
|
|
284
302
|
## Tool workspace guardrails
|
|
285
303
|
|
|
286
304
|
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:
|