kward 0.67.1 → 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.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/pages.yml +48 -0
  3. data/.yardopts +1 -0
  4. data/CHANGELOG.md +54 -0
  5. data/Gemfile.lock +8 -2
  6. data/README.md +37 -30
  7. data/Rakefile +14 -1
  8. data/doc/authentication.md +84 -43
  9. data/doc/code-search.md +55 -28
  10. data/doc/configuration.md +27 -2
  11. data/doc/extensibility.md +90 -129
  12. data/doc/getting-started.md +53 -57
  13. data/doc/memory.md +51 -118
  14. data/doc/personas.md +417 -0
  15. data/doc/plugins.md +55 -99
  16. data/doc/releasing.md +10 -9
  17. data/doc/rpc.md +7 -7
  18. data/doc/usage.md +125 -141
  19. data/doc/web-search.md +80 -14
  20. data/exe/kward +2 -0
  21. data/kward.gemspec +4 -0
  22. data/lib/kward/agent.rb +30 -3
  23. data/lib/kward/ansi.rb +3 -0
  24. data/lib/kward/auth/anthropic_oauth.rb +291 -0
  25. data/lib/kward/auth/file.rb +2 -0
  26. data/lib/kward/auth/github_oauth.rb +3 -0
  27. data/lib/kward/auth/openai_oauth.rb +4 -0
  28. data/lib/kward/auth/openrouter_api_key.rb +2 -0
  29. data/lib/kward/cancellation.rb +3 -0
  30. data/lib/kward/cli/auth_commands.rb +82 -0
  31. data/lib/kward/cli/commands.rb +229 -0
  32. data/lib/kward/cli/compaction.rb +25 -0
  33. data/lib/kward/cli/doctor.rb +121 -0
  34. data/lib/kward/cli/interactive_turn.rb +227 -0
  35. data/lib/kward/cli/memory_commands.rb +133 -0
  36. data/lib/kward/cli/plugins.rb +112 -0
  37. data/lib/kward/cli/prompt_interface.rb +134 -0
  38. data/lib/kward/cli/rendering.rb +378 -0
  39. data/lib/kward/cli/runtime_helpers.rb +170 -0
  40. data/lib/kward/cli/sessions.rb +376 -0
  41. data/lib/kward/cli/settings.rb +669 -0
  42. data/lib/kward/cli/slash_commands.rb +114 -0
  43. data/lib/kward/cli/stats.rb +64 -0
  44. data/lib/kward/cli/sysprompt.rb +57 -0
  45. data/lib/kward/cli/tool_summaries.rb +157 -0
  46. data/lib/kward/cli.rb +52 -2792
  47. data/lib/kward/cli_transcript_formatter.rb +40 -12
  48. data/lib/kward/clipboard.rb +1 -0
  49. data/lib/kward/compaction/file_operation_tracker.rb +3 -0
  50. data/lib/kward/compactor.rb +31 -9
  51. data/lib/kward/config_files.rb +78 -34
  52. data/lib/kward/conversation.rb +110 -13
  53. data/lib/kward/events.rb +2 -0
  54. data/lib/kward/export_path.rb +2 -0
  55. data/lib/kward/image_attachments.rb +2 -0
  56. data/lib/kward/markdown_transcript.rb +2 -0
  57. data/lib/kward/memory/manager.rb +144 -14
  58. data/lib/kward/message_access.rb +29 -2
  59. data/lib/kward/message_text.rb +45 -0
  60. data/lib/kward/model/chat_invocation.rb +2 -0
  61. data/lib/kward/model/client.rb +295 -77
  62. data/lib/kward/model/context_overflow.rb +2 -0
  63. data/lib/kward/model/context_usage.rb +14 -10
  64. data/lib/kward/model/model_info.rb +160 -4
  65. data/lib/kward/model/payloads.rb +254 -22
  66. data/lib/kward/model/retry_message.rb +2 -0
  67. data/lib/kward/model/stream_parser.rb +387 -25
  68. data/lib/kward/pan/server.rb +3 -1
  69. data/lib/kward/plugin_registry.rb +12 -0
  70. data/lib/kward/private_file.rb +2 -0
  71. data/lib/kward/prompt_interface/banner.rb +3 -0
  72. data/lib/kward/prompt_interface/composer_controller.rb +262 -0
  73. data/lib/kward/prompt_interface/composer_renderer.rb +172 -0
  74. data/lib/kward/prompt_interface/composer_state.rb +221 -0
  75. data/lib/kward/prompt_interface/key_handler.rb +365 -0
  76. data/lib/kward/prompt_interface/layout.rb +31 -0
  77. data/lib/kward/prompt_interface/overlay_renderer.rb +111 -0
  78. data/lib/kward/prompt_interface/prompt_renderer.rb +91 -0
  79. data/lib/kward/prompt_interface/question_prompt.rb +328 -0
  80. data/lib/kward/prompt_interface/runtime_state.rb +59 -0
  81. data/lib/kward/prompt_interface/screen.rb +186 -0
  82. data/lib/kward/prompt_interface/selection_prompt.rb +242 -0
  83. data/lib/kward/prompt_interface/slash_overlay.rb +102 -0
  84. data/lib/kward/prompt_interface/stream_state.rb +65 -0
  85. data/lib/kward/prompt_interface/transcript_buffer.rb +85 -0
  86. data/lib/kward/prompt_interface/transcript_renderer.rb +151 -0
  87. data/lib/kward/prompt_interface.rb +69 -1832
  88. data/lib/kward/prompts/commands.rb +2 -0
  89. data/lib/kward/prompts/templates.rb +3 -0
  90. data/lib/kward/prompts.rb +63 -7
  91. data/lib/kward/question_contract.rb +66 -0
  92. data/lib/kward/resources/avatar_kward_logo.rb +2 -0
  93. data/lib/kward/resources/pixel_logo.rb +2 -0
  94. data/lib/kward/rpc/attachment_normalizer.rb +60 -0
  95. data/lib/kward/rpc/auth_manager.rb +65 -11
  96. data/lib/kward/rpc/config_manager.rb +11 -0
  97. data/lib/kward/rpc/prompt_bridge.rb +5 -26
  98. data/lib/kward/rpc/redactor.rb +3 -0
  99. data/lib/kward/rpc/runtime_payloads.rb +4 -1
  100. data/lib/kward/rpc/server.rb +43 -11
  101. data/lib/kward/rpc/session_manager.rb +139 -347
  102. data/lib/kward/rpc/session_metrics.rb +68 -0
  103. data/lib/kward/rpc/session_tree.rb +48 -0
  104. data/lib/kward/rpc/session_tree_rows.rb +208 -0
  105. data/lib/kward/rpc/tool_event_normalizer.rb +3 -0
  106. data/lib/kward/rpc/tool_metadata.rb +3 -0
  107. data/lib/kward/rpc/transcript_normalizer.rb +50 -0
  108. data/lib/kward/rpc/transport.rb +3 -0
  109. data/lib/kward/session_diff.rb +2 -0
  110. data/lib/kward/session_store.rb +154 -25
  111. data/lib/kward/session_trash.rb +1 -0
  112. data/lib/kward/session_tree_renderer.rb +8 -41
  113. data/lib/kward/session_tree_tool_display.rb +56 -0
  114. data/lib/kward/skills/registry.rb +3 -0
  115. data/lib/kward/starter_pack_installer.rb +3 -2
  116. data/lib/kward/steering.rb +2 -0
  117. data/lib/kward/telemetry/logger.rb +3 -0
  118. data/lib/kward/telemetry/stats.rb +3 -0
  119. data/lib/kward/tools/ask_user_question.rb +20 -32
  120. data/lib/kward/tools/base.rb +8 -0
  121. data/lib/kward/tools/code_search.rb +5 -0
  122. data/lib/kward/tools/edit_file.rb +5 -0
  123. data/lib/kward/tools/fetch_content.rb +41 -0
  124. data/lib/kward/tools/fetch_raw.rb +40 -0
  125. data/lib/kward/tools/list_directory.rb +5 -0
  126. data/lib/kward/tools/read_file.rb +5 -0
  127. data/lib/kward/tools/read_skill.rb +5 -0
  128. data/lib/kward/tools/registry.rb +42 -4
  129. data/lib/kward/tools/run_shell_command.rb +5 -0
  130. data/lib/kward/tools/search/code.rb +7 -0
  131. data/lib/kward/tools/search/web.rb +20 -17
  132. data/lib/kward/tools/search/web_fetch.rb +202 -0
  133. data/lib/kward/tools/tool_call.rb +27 -5
  134. data/lib/kward/tools/web_search.rb +7 -1
  135. data/lib/kward/tools/write_file.rb +5 -0
  136. data/lib/kward/transcript_export.rb +2 -0
  137. data/lib/kward/version.rb +2 -1
  138. data/lib/kward/workspace.rb +45 -5
  139. data/templates/default/fulldoc/html/css/kward.css +1501 -0
  140. data/templates/default/fulldoc/html/images/kward_logo.png +0 -0
  141. data/templates/default/fulldoc/html/js/kward.js +296 -0
  142. data/templates/default/fulldoc/html/setup.rb +8 -0
  143. data/templates/default/layout/html/breadcrumb.erb +11 -0
  144. data/templates/default/layout/html/layout.erb +141 -0
  145. data/templates/default/layout/html/setup.rb +139 -0
  146. metadata +56 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d03a2b137c3ef3a1bc27e44b2629de49a41c70c3044088f9bd0c162cf50e3387
4
- data.tar.gz: 241753e7eca9acb6ff94cae50afa7ea43ea2e4c13a8d22eb5031d399ae7fad5a
3
+ metadata.gz: a84b87d1fd620a0008222c1f7cf6efd3fb7d019818e6674f75e3160ad738d2b3
4
+ data.tar.gz: 297fc5bd96d88356731b659cd6d43da8349e5711e50f1419a11afdab82192d57
5
5
  SHA512:
6
- metadata.gz: ac0d8465faa573ac9878c4bf5b83327145a7810cbe375b64ce8019531ba00ea3be779a82ed912825de2372ba18917dc56137f67f60161d3234e396b6ec82f3a2
7
- data.tar.gz: 3e50a23badb84faf825a75cec5f9d0f4b62cc2bb0c76d643ac8bfb41d99a97c0cbc95268508e4b8a0c2e172249d105f3246b8b0e6a44c81725eae52db71235e6
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
@@ -1,6 +1,7 @@
1
1
  --readme README.md
2
2
  --output-dir _yardoc
3
3
  --markup markdown
4
+ --template-path templates
4
5
  lib/**/*.rb
5
6
  -
6
7
  README.md
data/CHANGELOG.md CHANGED
@@ -4,6 +4,60 @@ 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
+
41
+ ## [0.68.0] - 2026-06-14
42
+
43
+ In this release, most changes are under the hood, as it included massive refactors to have an even more robust way forward.
44
+
45
+ ### Added
46
+
47
+ - Added Anthropic Claude Pro/Max subscription provider support with OAuth login, static Claude model choices, and Anthropic Messages streaming.
48
+
49
+ ### Changed
50
+
51
+ - Changed known context windows and reasoning effort choices to use provider/model-specific metadata for Codex, OpenRouter, Copilot, and Anthropic models.
52
+ - Changed the default Anthropic model to Claude Sonnet 4.6 and expanded direct Anthropic model choices to include newer Claude Opus/Sonnet releases.
53
+ - Changed resumed sessions to restore the session's last-used provider, model, and reasoning effort without rewriting default config.
54
+ - Documented the tool contract: schemas define strict generated/returned payloads, while runtime accepts tolerant incoming tool-call input for compatibility.
55
+ - Expanded RDoc coverage past 50% across message compatibility, tool-call normalization, session persistence, session tree helpers, model/client boundaries, config paths, workspace operations, telemetry, RPC, plugins, memory, auth, compaction, search internals, CLI mixins, and prompt interface components.
56
+
57
+ ### Fixed
58
+
59
+ - Fixed session tree editing and RPC fork text so prompt-template turns use the original visible slash command instead of expanded model content.
60
+
7
61
  ## [0.67.1] - 2026-06-14
8
62
 
9
63
  ### Fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kward (0.67.1)
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.67.1)
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
@@ -2,11 +2,32 @@
2
2
 
3
3
  Kward is an extendable Ruby CLI coding agent. It can chat with you about a project, inspect and edit files, run confirmed shell commands, search the web, look up public source code, save local sessions, and load trusted Ruby plugins for custom workflows.
4
4
 
5
- It currently supports the OpenAI/ChatGPT Codex backend, OpenRouter, and experimental Copilot provider support.
5
+ It currently supports the OpenAI/ChatGPT Codex backend, Anthropic Claude Pro/Max subscription, OpenRouter, and experimental Copilot provider support.
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
+ ```
6
27
 
7
28
  ## Install
8
29
 
9
- Kward is being prepared for a RubyGems release. Once published, install it with:
30
+ Install Kward from RubyGems:
10
31
 
11
32
  ```bash
12
33
  gem install kward
@@ -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 `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.
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,29 +54,11 @@ 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.
57
- - Read, write, and edit workspace files with confirmation before changes.
58
- - Run shell commands after confirmation.
60
+ - Read, write, and edit workspace files with read-before-write guardrails.
61
+ - Run local shell commands from the workspace.
59
62
  - Search the live web and inspect cached public GitHub repositories.
60
63
  - Save, resume, clone, compact, and export sessions.
61
64
  - Extend the Agent with trusted Ruby plugins for custom commands, footer UI, prompt context, and transcript-event observers.
@@ -69,13 +72,14 @@ Start here:
69
72
  - [Getting started](doc/getting-started.md): first run, authentication choices, and basic commands.
70
73
  - [Usage](doc/usage.md): interactive chat, slash commands, sessions, tools, images, and Pan mode.
71
74
  - [Configuration](doc/configuration.md): config files, providers, models, web search, logging, and color output.
72
- - [Authentication](doc/authentication.md): OpenAI OAuth, OpenRouter API keys, and Copilot/GitHub setup.
75
+ - [Authentication](doc/authentication.md): OpenAI OAuth, Anthropic OAuth, OpenRouter API keys, and Copilot/GitHub setup.
73
76
  - [Troubleshooting](doc/troubleshooting.md): environment-specific install and runtime issues.
74
77
 
75
78
  Feature guides:
76
79
 
77
80
  - [Memory](doc/memory.md): opt-in core, soft, and session memory.
78
- - [Extensibility](doc/extensibility.md): `AGENTS.md`, personas, skills, and prompt templates.
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
- ## Run tests
92
+ ## Development
93
+
94
+ Run tests:
89
95
 
90
96
  ```bash
91
97
  bundle exec rake test
92
98
  ```
93
99
 
94
- Equivalent direct command:
100
+ Build the YARD documentation site:
95
101
 
96
102
  ```bash
97
- ruby -Itest -e 'Dir["test/**/test_*.rb"].sort.each { |file| require_relative file }'
103
+ bundle exec rake docs:build
98
104
  ```
99
105
 
100
- ## Generate API documentation
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 = ["--readme", "README.md", "--output-dir", "_yardoc", "--markup", "markdown"]
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
@@ -1,54 +1,56 @@
1
1
  # Authentication
2
2
 
3
- Kward needs credentials for a model provider before it can answer prompts. The easiest path is to start Kward and run `/login`.
3
+ Kward needs access to a model provider before it can answer prompts. The fastest path is:
4
4
 
5
- Kward supports:
6
-
7
- - OpenAI/ChatGPT OAuth for the Codex backend.
8
- - OpenRouter API keys.
9
- - GitHub OAuth or `COPILOT_GITHUB_TOKEN` for experimental Copilot provider support.
10
-
11
- If you installed the gem, use `kward` in the examples below. When running from source, use `ruby lib/main.rb` instead.
12
-
13
- ## Quick login
5
+ ```bash
6
+ kward login
7
+ ```
14
8
 
15
- Inside an interactive session:
9
+ Or inside interactive Kward:
16
10
 
17
11
  ```text
18
12
  /login
19
13
  ```
20
14
 
21
- Kward opens a provider picker and saves the selected credentials.
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. |
22
25
 
23
- From your shell, you can also run:
26
+ If you are unsure, start with `kward login` and choose OpenAI.
27
+
28
+ ## Login commands
24
29
 
25
30
  ```bash
26
31
  kward login # OpenAI/ChatGPT OAuth
27
- kward login openrouter # save an OpenRouter API key
32
+ kward login anthropic # Anthropic Claude Pro/Max OAuth
33
+ kward login openrouter # OpenRouter API key
28
34
  kward login github # GitHub OAuth for experimental Copilot support
29
35
  ```
30
36
 
31
- ## OpenAI OAuth
32
-
33
- OpenAI OAuth is the default provider path when credentials are available. It uses your ChatGPT account and sends requests to the ChatGPT/Codex backend (`chatgpt.com/backend-api/codex/responses`), not the OpenAI Platform API.
37
+ From source, replace `kward` with `ruby lib/main.rb`.
34
38
 
35
- To start the browser login from your shell:
39
+ ## OpenAI / ChatGPT
36
40
 
37
41
  ```bash
38
42
  kward login
39
43
  ```
40
44
 
41
- In an interactive session, run `/login` and choose OpenAI.
42
-
43
- Complete the browser redirect flow. Tokens are saved to:
45
+ This opens a browser login and saves credentials to:
44
46
 
45
47
  ```text
46
48
  ~/.kward/auth.json
47
49
  ```
48
50
 
49
- The auth file is written with file mode `0600`.
51
+ Kward uses the ChatGPT/Codex backend, not the OpenAI Platform API key flow.
50
52
 
51
- OpenAI OAuth requires an OAuth client ID in `~/.kward/config.json`:
53
+ If Kward asks for an OAuth client ID, add it to `~/.kward/config.json`:
52
54
 
53
55
  ```json
54
56
  {
@@ -56,50 +58,89 @@ OpenAI OAuth requires an OAuth client ID in `~/.kward/config.json`:
56
58
  }
57
59
  ```
58
60
 
59
- If it is missing, Kward tells you which config file to update.
61
+ ## Anthropic Claude Pro/Max
60
62
 
61
- ## OpenRouter API key
63
+ ```bash
64
+ kward login anthropic
65
+ ```
62
66
 
63
- OpenRouter uses an API key rather than OAuth. To save it from your shell:
67
+ This saves credentials to:
68
+
69
+ ```text
70
+ ~/.kward/anthropic_auth.json
71
+ ```
72
+
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.
74
+
75
+ ## OpenRouter
64
76
 
65
77
  ```bash
66
78
  kward login openrouter
67
79
  ```
68
80
 
69
- In an interactive session, run `/login` and choose OpenRouter.
81
+ This stores your API key in `~/.kward/config.json`.
70
82
 
71
- Kward saves the key as `openrouter_api_key` in `~/.kward/config.json`. You can also set `OPENROUTER_API_KEY` for a single run without saving it.
83
+ For a single shell session, you can avoid saving the key:
72
84
 
73
- ## GitHub OAuth for Copilot provider support
85
+ ```bash
86
+ OPENROUTER_API_KEY=sk-or-v1-... kward
87
+ ```
74
88
 
75
- Kward can use a GitHub token for experimental Copilot provider support.
89
+ Choose OpenRouter when you want access to its model catalog or want provider/model selection through an API key.
76
90
 
77
- The GitHub device flow uses a built-in default client ID unless you set `GITHUB_OAUTH_CLIENT_ID` or add `github_oauth_client_id` to `~/.kward/config.json`. To log in:
91
+ ## Experimental Copilot support
78
92
 
79
93
  ```bash
80
94
  kward login github
81
95
  ```
82
96
 
83
- Tokens are saved to:
97
+ This saves GitHub OAuth credentials to:
84
98
 
85
99
  ```text
86
100
  ~/.kward/github_auth.json
87
101
  ```
88
102
 
89
- The auth file is written with file mode `0600`.
103
+ You can also use a token for one run:
104
+
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
+
115
+ Set it in `~/.kward/config.json`:
116
+
117
+ ```json
118
+ {
119
+ "provider": "anthropic"
120
+ }
121
+ ```
122
+
123
+ Or for one command:
90
124
 
91
- You can also run `/login` in an interactive session and choose GitHub, or provide `COPILOT_GITHUB_TOKEN` for a single run.
125
+ ```bash
126
+ KWARD_PROVIDER=openrouter kward
127
+ ```
92
128
 
93
- Important: Kward's Copilot provider follows Pi Agent's direct HTTPS approach. It exchanges the GitHub OAuth token for a Copilot internal token and sends chat requests to the Copilot proxy API. It does not use the official Copilot CLI or SDK runtime.
129
+ Supported provider values:
94
130
 
95
- ## Fallback and provider selection
131
+ ```text
132
+ codex
133
+ anthropic
134
+ openrouter
135
+ copilot
136
+ ```
96
137
 
97
- Credential priority is provider-aware:
138
+ Without an explicit provider, OpenAI/ChatGPT credentials are preferred when present.
98
139
 
99
- - OpenAI OAuth is used by default after login, even when `OPENROUTER_API_KEY` or `openrouter_api_key` is also present.
100
- - `OPENAI_ACCESS_TOKEN` can be used as an OpenAI environment fallback.
101
- - `OPENROUTER_API_KEY` is a fallback only when no OpenAI OAuth/access token exists.
102
- - `COPILOT_GITHUB_TOKEN` can be used as a Copilot environment fallback.
103
- - If `provider` in config or `KWARD_PROVIDER` in the environment is set to `codex`, `openrouter`, or `copilot`, Kward uses that provider and does not fall through to another provider.
140
+ ## Security notes
104
141
 
105
- See [Configuration](configuration.md) for model and provider settings.
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
- Kward exposes a `code_search` tool so the agent can inspect public open-source code for implementation guidance.
3
+ Code search lets Kward inspect public open-source repositories while working on your project.
4
4
 
5
- Use code search when you want Kward to learn from real packages before changing your project. It is useful for checking library APIs, finding examples, comparing implementation patterns, or understanding how another project solved a similar problem.
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 this kind of generator test.
18
+ Inspect how Rails structures generator tests.
19
+ Check the source for this gem before recommending an API call.
13
20
  ```
14
21
 
15
- The tool can:
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
- - look up packages from RubyGems, npm, PyPI, crates.io, and Go package documentation
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 cloned under:
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 at another config location, the cache is stored next to that config directory under `cache/code_search`.
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 tool keeps cloned repositories outside the current workspace. It uses safe cache keys derived from GitHub `owner/name` identifiers and rejects absolute paths or path traversal when reading files.
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
- `code_search` uses live network access and the local `git` executable. GitHub authentication is optional. If either `GITHUB_TOKEN` or `GH_TOKEN` is set, the token is sent to GitHub API requests. Without a token, GitHub requests are unauthenticated and may hit lower rate limits.
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
- ## Actions
68
+ ## Tool actions
44
69
 
45
- The tool has one schema with an `action` parameter:
70
+ The tool uses an `action` parameter:
46
71
 
47
- - `package_search` - find package metadata and likely source repository
48
- - `github_search` - search public GitHub repositories
49
- - `repo_clone` - clone a GitHub repository into cache if needed
50
- - `repo_search` - search cached repository files for text
51
- - `repo_read` - read a bounded line range from a cached repository file
52
- - `list_cache` - list cached repositories
53
- - `refresh_cache` - fetch updates for a cached repository
54
- - `clear_cache` - remove one cached repository
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 output is bounded to avoid loading excessive external source into context. Oversized and binary files are skipped.
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.