kward 0.79.0 → 0.80.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 (117) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +6 -0
  3. data/CHANGELOG.md +58 -1
  4. data/Gemfile.lock +2 -2
  5. data/README.md +31 -38
  6. data/doc/agent-tools.md +9 -10
  7. data/doc/api.md +3 -3
  8. data/doc/authentication.md +79 -110
  9. data/doc/code-search.md +1 -1
  10. data/doc/composer.md +1 -1
  11. data/doc/configuration.md +69 -26
  12. data/doc/context-budgeting.md +6 -6
  13. data/doc/context-tools.md +2 -2
  14. data/doc/editor.md +7 -7
  15. data/doc/extensibility.md +7 -29
  16. data/doc/files.md +6 -6
  17. data/doc/getting-started.md +2 -2
  18. data/doc/git.md +8 -2
  19. data/doc/lifecycle-hooks.md +5 -4
  20. data/doc/local-models.md +2 -2
  21. data/doc/mcp.md +5 -5
  22. data/doc/permissions.md +13 -4
  23. data/doc/plugins.md +39 -4
  24. data/doc/prompt-templates.md +105 -0
  25. data/doc/providers.md +140 -0
  26. data/doc/releasing.md +10 -2
  27. data/doc/rpc.md +54 -31
  28. data/doc/sandboxing.md +22 -0
  29. data/doc/security.md +22 -7
  30. data/doc/session-management.md +2 -4
  31. data/doc/tabs.md +37 -0
  32. data/doc/telegram.md +138 -0
  33. data/doc/transports.md +209 -0
  34. data/doc/usage.md +11 -3
  35. data/doc/web-search.md +3 -3
  36. data/doc/workspace-tools.md +2 -2
  37. data/examples/plugins/stardate_footer.rb +10 -0
  38. data/examples/plugins/telegram/plugin.rb +39 -0
  39. data/examples/plugins/telegram/telegram_api.rb +136 -0
  40. data/examples/plugins/telegram/telegram_transport.rb +304 -0
  41. data/lib/kward/ansi.rb +1 -0
  42. data/lib/kward/auth/api_key_store.rb +99 -0
  43. data/lib/kward/cli/auth_commands.rb +72 -13
  44. data/lib/kward/cli/commands.rb +7 -0
  45. data/lib/kward/cli/git.rb +31 -8
  46. data/lib/kward/cli/plugins.rb +1 -0
  47. data/lib/kward/cli/prompt_interface.rb +7 -0
  48. data/lib/kward/cli/rendering.rb +6 -2
  49. data/lib/kward/cli/runtime_helpers.rb +4 -2
  50. data/lib/kward/cli/sessions.rb +1 -1
  51. data/lib/kward/cli/settings.rb +97 -33
  52. data/lib/kward/cli/tabs.rb +102 -37
  53. data/lib/kward/cli/transports.rb +67 -0
  54. data/lib/kward/cli/worktrees.rb +360 -0
  55. data/lib/kward/cli.rb +20 -0
  56. data/lib/kward/config_files.rb +26 -3
  57. data/lib/kward/conversation.rb +13 -7
  58. data/lib/kward/git_worktree_manager.rb +291 -0
  59. data/lib/kward/model/azure_openai_config.rb +54 -0
  60. data/lib/kward/model/catalog.rb +113 -0
  61. data/lib/kward/model/client.rb +225 -20
  62. data/lib/kward/model/model_info.rb +49 -0
  63. data/lib/kward/model/payloads.rb +63 -4
  64. data/lib/kward/model/provider_catalog.rb +114 -0
  65. data/lib/kward/model/sources.rb +70 -0
  66. data/lib/kward/model/stream_parser.rb +83 -13
  67. data/lib/kward/permissions/policy.rb +18 -4
  68. data/lib/kward/plugin_chat_runtime.rb +374 -0
  69. data/lib/kward/plugin_registry.rb +80 -7
  70. data/lib/kward/private_file.rb +9 -3
  71. data/lib/kward/prompt_interface/approval_prompt.rb +2 -0
  72. data/lib/kward/prompt_interface/composer_renderer.rb +1 -5
  73. data/lib/kward/prompt_interface/editor/auto_indent.rb +46 -0
  74. data/lib/kward/prompt_interface/editor/buffer.rb +18 -4
  75. data/lib/kward/prompt_interface/editor/controller.rb +7 -7
  76. data/lib/kward/prompt_interface/editor/modes/vibe.rb +2 -2
  77. data/lib/kward/prompt_interface/editor/renderer.rb +8 -8
  78. data/lib/kward/prompt_interface/editor/state.rb +3 -9
  79. data/lib/kward/prompt_interface/editor/syntax_highlighter.rb +184 -9
  80. data/lib/kward/prompt_interface/file_overlay.rb +2 -2
  81. data/lib/kward/prompt_interface/git_prompt.rb +7 -3
  82. data/lib/kward/prompt_interface/interactive/controller.rb +4 -4
  83. data/lib/kward/prompt_interface/interactive/renderer.rb +4 -1
  84. data/lib/kward/prompt_interface/interactive/state.rb +2 -2
  85. data/lib/kward/prompt_interface/project_browser.rb +25 -6
  86. data/lib/kward/prompt_interface/runtime_state.rb +22 -6
  87. data/lib/kward/prompt_interface/screen.rb +3 -0
  88. data/lib/kward/prompt_interface/selection_prompt.rb +7 -1
  89. data/lib/kward/prompt_interface/transcript_buffer.rb +24 -2
  90. data/lib/kward/prompt_interface.rb +53 -12
  91. data/lib/kward/prompts/commands.rb +1 -1
  92. data/lib/kward/prompts.rb +6 -5
  93. data/lib/kward/rpc/auth_manager.rb +112 -152
  94. data/lib/kward/rpc/config_manager.rb +46 -6
  95. data/lib/kward/rpc/plugin_chat_manager.rb +55 -196
  96. data/lib/kward/rpc/prompt_bridge.rb +8 -4
  97. data/lib/kward/rpc/redactor.rb +1 -1
  98. data/lib/kward/rpc/server.rb +60 -10
  99. data/lib/kward/rpc/session_manager.rb +109 -30
  100. data/lib/kward/session_store.rb +84 -24
  101. data/lib/kward/tab_driver.rb +6 -3
  102. data/lib/kward/tools/git_commit.rb +39 -0
  103. data/lib/kward/tools/registry.rb +7 -2
  104. data/lib/kward/tools/tool_call.rb +1 -0
  105. data/lib/kward/transport/gateway.rb +253 -0
  106. data/lib/kward/transport/host.rb +343 -0
  107. data/lib/kward/transport/manager.rb +179 -0
  108. data/lib/kward/transport/plugin_chat_gateway.rb +186 -0
  109. data/lib/kward/transport/runtime.rb +41 -0
  110. data/lib/kward/transport/store.rb +101 -0
  111. data/lib/kward/transport.rb +204 -0
  112. data/lib/kward/version.rb +1 -1
  113. data/lib/kward/workspace_factory.rb +19 -2
  114. data/templates/default/fulldoc/html/js/kward.js +2 -0
  115. data/templates/default/kward_navigation.rb +7 -2
  116. data/templates/default/layout/html/setup.rb +4 -0
  117. metadata +26 -1
data/doc/configuration.md CHANGED
@@ -6,7 +6,9 @@ On first start, Kward creates the file when it does not exist. The starter confi
6
6
 
7
7
  If `KWARD_CONFIG_PATH` is set, Kward uses that file and treats its directory as the config directory for prompts, skills, memory, logs, and caches.
8
8
 
9
- ## Common changes
9
+ ## Choose a configuration path
10
+
11
+ Use the interactive controls for ordinary changes. Edit `config.json` when you need a setting that is not exposed there or when you want to share a reproducible setup.
10
12
 
11
13
  | Goal | Recommended path |
12
14
  | --- | --- |
@@ -20,6 +22,8 @@ If `KWARD_CONFIG_PATH` is set, Kward uses that file and treats its directory as
20
22
  | Configure personas | `/settings` → Personalization; see [Personas](personas.md) |
21
23
  | Add MCP servers, lifecycle hooks, or environment-specific paths | Edit `config.json` directly |
22
24
 
25
+ For the complete reference, jump to [provider and model settings](#Provider_and_model_settings), [terminal interface settings](#Overlay_settings), [sessions and memory](#Session_settings), [web search](#Web_search), [workspace safety](#Tool_workspace_guardrails), or [logging](#Logging_and_stats). See [Model providers](providers.md) to compare providers and find their configuration names.
26
+
23
27
  Here is a minimal direct provider configuration:
24
28
 
25
29
  ```json
@@ -46,6 +50,35 @@ Add trusted local Model Context Protocol servers under `mcpServers`:
46
50
 
47
51
  See [MCP servers](mcp.md) for setup, supported fields, and security notes.
48
52
 
53
+ ### Transport plugins
54
+
55
+ Transport plugin settings live under `transports` and are scoped by the
56
+ transport's stable ID:
57
+
58
+ ```json
59
+ {
60
+ "transports": {
61
+ "com.kward.telegram": {
62
+ "workspace": "/Users/me/src/project",
63
+ "allowed_user_ids": [123456789],
64
+ "allowed_chat_ids": [123456789],
65
+ "poll_timeout_seconds": 25
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ Transport plugins are trusted local Ruby code. Keep credentials in environment
72
+ variables or another private secret mechanism provided by the plugin rather
73
+ than committing them to `config.json`. Transport state, including external
74
+ conversation bindings and idempotency keys, is stored privately under the
75
+ transport's namespace in `~/.kward/transports/`.
76
+
77
+ Run `kward transport list` to inspect registrations, `kward transport status`
78
+ to inspect runtime state, and `kward transport run NAME` to run a transport in
79
+ the foreground. See [Telegram transport](telegram.md) for the first-party
80
+ long-polling adapter and setup instructions.
81
+
49
82
  ### Project skills
50
83
 
51
84
  Kward loads user-level skills but skips project-level skills by default. Enable them only for repositories you trust, either through `/settings` → Tools & Search → Trust project skills or with:
@@ -80,6 +113,7 @@ By default, Kward stores user data under `~/.kward`. Common files and directorie
80
113
 
81
114
  ```text
82
115
  ~/.kward/config.json
116
+ ~/.kward/api_keys.json
83
117
  ~/.kward/auth.json
84
118
  ~/.kward/anthropic_auth.json
85
119
  ~/.kward/github_auth.json
@@ -146,6 +180,8 @@ aliases:
146
180
 
147
181
  ## Provider and model settings
148
182
 
183
+ The [Model providers](providers.md) guide lists every provider ID, model key, credential variable, catalog source, and request API. This section explains the underlying config pattern.
184
+
149
185
  Set `provider` to choose the active backend:
150
186
 
151
187
  ```json
@@ -156,12 +192,14 @@ Set `provider` to choose the active backend:
156
192
 
157
193
  When `provider` is unset, Kward infers the backend from available credentials, defaulting to OpenAI/Codex when OAuth credentials are present. Set `provider` or `KWARD_PROVIDER` to select another backend explicitly.
158
194
 
159
- Supported values are:
195
+ Common values are:
160
196
 
161
- - `codex` for the OpenAI/ChatGPT Codex backend.
162
- - `anthropic` for Anthropic Claude Pro/Max subscription support.
163
- - `openrouter` for OpenRouter.
164
- - `copilot` for experimental Copilot provider support.
197
+ - `codex` for the ChatGPT/Codex OAuth backend;
198
+ - `openai_api` for direct OpenAI API access;
199
+ - `anthropic`, `openrouter`, and `copilot` for those providers;
200
+ - `gemini` for Google Gemini;
201
+ - `azure_openai` for a configured Azure deployment;
202
+ - `cerebras`, `deepseek`, `fireworks`, `groq`, `mistral`, `nvidia`, `together`, or `xai` for API-key providers;
165
203
  - `local` for an OpenAI-compatible Ollama, LM Studio, or llama.cpp server. See [Local models](local-models.md).
166
204
 
167
205
  Model settings:
@@ -170,7 +208,10 @@ Model settings:
170
208
  {
171
209
  "model": "gpt-5.6-sol",
172
210
  "openai_model": "gpt-5.6-sol",
211
+ "openai_api_model": "gpt-5.4-mini",
173
212
  "openrouter_model": "openai/gpt-5.6-sol",
213
+ "gemini_model": "gemini-2.5-flash",
214
+ "groq_model": "provider-model-id",
174
215
  "anthropic_model": "claude-sonnet-5",
175
216
  "copilot_model": "gpt-5-mini",
176
217
  "local_model": "qwen2.5-coder:7b",
@@ -183,7 +224,7 @@ Model settings:
183
224
  }
184
225
  ```
185
226
 
186
- `model` is a generic setting for the active provider. Provider-specific values such as `openai_model`, `anthropic_model`, `openrouter_model`, and `copilot_model` take precedence for their provider. `reasoning_effort` and `thinking_level` are generic reasoning settings. `thinking_level` is an alias for `reasoning_effort` honored by all providers. For each provider, Kward resolves reasoning in this order: the provider-specific key (for example `openai_reasoning_effort`), then the generic `reasoning_effort`, then `thinking_level`, then the default `medium`. `openai_reasoning_effort`, `anthropic_reasoning_effort`, `openrouter_reasoning_effort`, and `copilot_reasoning_effort` are provider-specific forms.
227
+ `model` is a legacy generic fallback. Provider-specific values take precedence. Catalog providers use `<runtime-id>_model`; for example, direct OpenAI uses `openai_api_model`, Gemini uses `gemini_model`, and Groq uses `groq_model`. Codex keeps `openai_model`. `reasoning_effort` and `thinking_level` are generic reasoning settings. `thinking_level` is an alias for `reasoning_effort` honored by all providers. For each provider, Kward resolves reasoning in this order: the provider-specific key (for example `openai_reasoning_effort`), then the generic `reasoning_effort`, then `thinking_level`, then the default `medium`. `openai_reasoning_effort`, `anthropic_reasoning_effort`, `openrouter_reasoning_effort`, and `copilot_reasoning_effort` are provider-specific forms.
187
228
 
188
229
  Set `codex_show_raw_reasoning` to `true` to display raw Codex `reasoning_text` when the API does not provide reasoning summary text. It defaults to `false`; raw reasoning can include internal or unstable model output, so enable it only when you explicitly want to inspect that stream.
189
230
 
@@ -226,8 +267,9 @@ Use environment variables for one-off runs or local secrets that you do not want
226
267
  Provider and model:
227
268
 
228
269
  - `KWARD_PROVIDER`
229
- - `OPENAI_MODEL`
230
- - `OPENAI_REASONING_EFFORT`
270
+ - `OPENAI_MODEL` and `OPENAI_REASONING_EFFORT` for Codex
271
+ - `OPENAI_API_MODEL` and `OPENAI_API_REASONING_EFFORT` for direct OpenAI
272
+ - `<PROVIDER>_MODEL` for catalog providers such as `GEMINI_MODEL`, `GROQ_MODEL`, and `XAI_MODEL`
231
273
  - `OPENROUTER_MODEL`
232
274
  - `OPENROUTER_REASONING_EFFORT`
233
275
  - `KWARD_LOCAL_BACKEND`
@@ -242,7 +284,11 @@ Provider and model:
242
284
 
243
285
  Credentials:
244
286
 
245
- - `OPENAI_ACCESS_TOKEN`
287
+ - `OPENAI_ACCESS_TOKEN` for ChatGPT/Codex OAuth
288
+ - `OPENAI_API_KEY` for direct OpenAI
289
+ - `ANTHROPIC_API_KEY`
290
+ - `AZURE_OPENAI_API_KEY`
291
+ - `CEREBRAS_API_KEY`, `DEEPSEEK_API_KEY`, `FIREWORKS_API_KEY`, `GEMINI_API_KEY`, `GROQ_API_KEY`, `MISTRAL_API_KEY`, `NVIDIA_API_KEY` (or `NGC_API_KEY`), `TOGETHER_API_KEY`, and `XAI_API_KEY`
246
292
  - `OPENROUTER_API_KEY`
247
293
  - `COPILOT_GITHUB_TOKEN`
248
294
  - `GITHUB_TOKEN` or `GH_TOKEN` for authenticated GitHub API requests in `code_search`
@@ -259,16 +305,9 @@ Color and logging environment variables are covered below.
259
305
 
260
306
  The friendliest way to configure credentials is `/login` inside Kward, or `kward login` from your shell. See [Authentication](authentication.md) for the full provider flow.
261
307
 
262
- Credential settings can also live in config:
263
-
264
- ```json
265
- {
266
- "openai_oauth_client_id": "your-client-id",
267
- "openrouter_api_key": "sk-or-v1-..."
268
- }
269
- ```
308
+ API keys are not stored in `config.json`. `/login` writes them to the private `<config-dir>/api_keys.json` file; environment variables take precedence for one-off runs. `openrouter_api_key` is a legacy setting that Kward migrates to the private store.
270
309
 
271
- Use environment variables for temporary or local-only secrets when possible. If multiple credentials are available, OpenAI OAuth is used by default unless `provider` or `KWARD_PROVIDER` selects another backend such as `anthropic`, `openrouter`, or `copilot`.
310
+ Non-secret authentication setup, such as `openai_oauth_client_id` and Azure endpoint/deployment/API-version values, remains in config. If multiple credentials are available, set `provider`, use `/model`, or use `KWARD_PROVIDER` to choose explicitly.
272
311
 
273
312
  ## Overlay settings
274
313
 
@@ -356,9 +395,9 @@ The integrated Git and session diff viewers support unified and side-by-side lay
356
395
 
357
396
  `diff_view` can be `auto`, `unified`, or `side_by_side`. In `auto` mode, Kward uses side-by-side output when the terminal is at least 120 columns wide and unified output in narrower terminals. Change it with `/settings` → Interface → Diff view.
358
397
 
359
- The editor automatically highlights Ruby, Crystal, Elixir, Julia, JavaScript, TypeScript, JSON, Markdown, YAML, Shell, Makefile, HTML, CSS, SCSS, Python, Go, Rust, Java, C#, C, C++, Swift, Kotlin, Lua, and SQL files when terminal color is enabled. Unknown file types and color-disabled terminals render plain text.
398
+ The editor includes syntax highlighting, automatic indentation, and matching-pair insertion for common languages. Unknown file types and color-disabled terminals use plain text. See [Integrated editor](editor.md#What_the_editor_supports) for the supported languages and detailed editing behavior.
360
399
 
361
- Auto-indent is enabled by default. Pressing Enter copies the current line indentation, detects the file's indentation unit when possible, and applies lightweight syntax-based indentation for recognized file types. For Ruby, Crystal, Elixir, Julia, Lua, Makefiles, and shell scripts, Enter after a block opener inserts the matching closing keyword, and Ctrl+Enter can force that behavior from the middle of the line in terminals that report modified Enter keys. When auto-indent is enabled, typing obvious closing tokens such as `}`, Ruby/Lua `end`, and shell `fi`/`done`/`esac` re-indents the current line, and Backspace in leading indentation removes one detected indentation unit. To disable it:
400
+ Auto-indent and matching-pair insertion are enabled by default. To disable either feature:
362
401
 
363
402
  ```json
364
403
  {
@@ -401,11 +440,15 @@ Editable editor buffers request a vertical bar cursor by default. Terminals that
401
440
  }
402
441
  ```
403
442
 
404
- Modern mode uses composer-style keys: `Ctrl+S` saves, `Ctrl+Q` quits, `Ctrl+F` searches, Shift+Arrow selects text, `Ctrl+C` copies, `Ctrl+X` cuts, `Ctrl+V` pastes the editor kill buffer, `Ctrl+A`/`Ctrl+E` move to the start/end of the line, `Ctrl+B` moves left, `Ctrl+K` kills to end of line, `Ctrl+U` kills to start of line, and `Alt+B`/`Alt+F` move by word.
443
+ Choose the mode that matches how you already edit:
405
444
 
406
- Emacs mode uses Emacs-style non-modal keys: `Ctrl+X Ctrl+S` saves, `Ctrl+X Ctrl+C` quits, `Ctrl+S` searches forward, `Ctrl+R` searches backward, `Ctrl+Space` sets the mark, `Ctrl+W` kills the region or previous word, `Alt+W` copies the region, `Ctrl+K` kills to end of line, `Ctrl+Y` yanks, and `Alt+Y` cycles the per-buffer kill ring after a yank.
445
+ | Mode | Best fit |
446
+ | --- | --- |
447
+ | `modern` | Familiar shortcuts such as `Ctrl+S` to save and `Ctrl+Q` to quit. |
448
+ | `emacs` | Non-modal Emacs-style movement, selection, kill, and yank keys. |
449
+ | `vibe` | A focused Vim-style experience with normal, insert, command, and visual modes. |
407
450
 
408
- Vibe mode opens files in normal mode and supports a compact Vim-style subset: normal/insert/command modes, character, line, and block visual modes, `h/j/k/l`, word and WORD movement, counts, `d`/`y`/`c` operators, line yanks and indentation, case operators, marks, macros, jump-list navigation, linewise paste, search, undo/redo, and common `:w`, `:q`, `:q!`, `:wq`, `:x`, `:e`, substitution, and `:number` commands. Yanks also copy to the terminal clipboard when OSC 52 is supported.
451
+ See [Integrated editor](editor.md#Choosing_an_editor_mode) for complete keymaps and mode-specific behavior.
409
452
 
410
453
  ## Session settings
411
454
 
@@ -579,7 +622,7 @@ Workspace guardrails are enabled by default. File tools such as `read_file`, `wr
579
622
  }
580
623
  ```
581
624
 
582
- This is not a sandbox setting. File guardrails constrain Kward file tools, not arbitrary shell commands. See [Command sandboxing](sandboxing.md) to apply an opt-in operating-system boundary to model-requested `run_shell_command` workers.
625
+ Workspace guardrails limit Kward file tools; they are not an operating-system sandbox and do not constrain arbitrary shell commands. See [Command sandboxing](sandboxing.md) to apply an opt-in operating-system boundary to model-requested `run_shell_command` workers.
583
626
 
584
627
  ## Command sandboxing
585
628
 
@@ -598,7 +641,7 @@ When Kward cannot enforce a requested non-off mode, it denies the command rather
598
641
 
599
642
  ## Permissions
600
643
 
601
- Permissions are off by default. When enabled, Kward evaluates model-requested tools before execution. This is a permission policy, not an operating-system sandbox: permitted shell commands still run with your user account's access.
644
+ Permissions are off by default. When enabled, the permission policy decides whether a model-requested tool can start. It is not an operating-system sandbox: permitted shell commands still run with your user account's access.
602
645
 
603
646
  ```json
604
647
  {
@@ -1,8 +1,8 @@
1
1
  # Context budgeting and token savings
2
2
 
3
- Kward tries to keep the model's context focused. Instead of reading whole files and pasting every byte of command output back into the conversation, it gathers evidence in small steps, compacts noisy output, and keeps the original data available when needed.
3
+ Kward handles context budgeting automatically. Instead of reading whole files and pasting every byte of command output into the conversation, it gathers evidence in small steps, compacts noisy output, and keeps the original data available when needed.
4
4
 
5
- This page summarizes the token-saving work in Kward: what existed before, what the newer focused-context tools add, and how those pieces fit together during normal agent work.
5
+ This guide explains why Kward sometimes reads an outline or a small section before opening a whole file, how it handles large tool output, and how you can inspect the resulting token savings.
6
6
 
7
7
  ## Why this matters
8
8
 
@@ -14,9 +14,9 @@ Kward's goal is not to build a heavyweight semantic index. It is to stay lightwe
14
14
  find likely files -> inspect outlines/previews -> read exact ranges -> read full files only when needed
15
15
  ```
16
16
 
17
- ## The current workflow
17
+ ## How Kward gathers context
18
18
 
19
- When Kward needs code context, it should usually start with one of these tools:
19
+ When Kward needs code context, it usually starts with one of these tools:
20
20
 
21
21
  - `context_for_task` for a compact task-shaped bundle.
22
22
  - `summarize_file_structure` for a source outline of one file.
@@ -27,11 +27,11 @@ Then it can escalate only as needed:
27
27
  - `read_file` with `mode: "range"`, `offset`, and `limit` for exact sections.
28
28
  - `read_file` with `mode: "full"` only when focused context is not enough.
29
29
 
30
- The built-in system prompt tells Kward to follow that escalation path, so these tools are part of normal agent behavior rather than hidden manual features.
30
+ This happens automatically during normal work; you do not need to choose the tools or modes yourself.
31
31
 
32
32
  ## Focused task context
33
33
 
34
- `context_for_task` is the highest-level context-budgeting tool. Give it a task and, optionally, focused paths and a byte budget. It returns a compact text bundle with:
34
+ `context_for_task` gives Kward a focused starting point. It accepts a task and, optionally, a set of paths and a byte budget, then returns a compact bundle with:
35
35
 
36
36
  - ranked candidate files (by term-matching score),
37
37
  - source outlines for each file,
data/doc/context-tools.md CHANGED
@@ -64,7 +64,7 @@ Constraints:
64
64
  - Each option requires both `label` and `description`.
65
65
  - In terminal use, the picker also accepts custom typed answers beyond the provided options, so the user is not limited to the listed choices.
66
66
 
67
- This tool is advertised only when the active frontend supports structured questions. In terminal use, it lets Kward ask concise multiple-choice questions instead of guessing requirements. In RPC clients, the same question flow is bridged through UI events see the [RPC question bridge](rpc.md) for notification and response details.
67
+ The question picker is available only in frontends that support structured questions. In the terminal, it lets Kward ask a concise multiple-choice question instead of guessing. RPC clients receive the same flow through UI events; see the [RPC question bridge](rpc.md) for notification and response details.
68
68
 
69
69
  Good uses:
70
70
 
@@ -72,7 +72,7 @@ Good uses:
72
72
  - confirming an ambiguous scope,
73
73
  - selecting a provider, model, or behavior when no default is obvious.
74
74
 
75
- Kward should not use this tool for every small uncertainty. It is best when an answer materially changes the implementation or avoids a risky assumption.
75
+ Structured questions are most useful when the answer would materially change the implementation or avoid a risky assumption—not for every small uncertainty.
76
76
 
77
77
  ## Availability
78
78
 
data/doc/editor.md CHANGED
@@ -1,4 +1,8 @@
1
- # Integrated Editor
1
+ # Integrated editor
2
+
3
+ Kward includes a terminal editor with three modes: Modern, Emacs, and Vibe. It opens inside the chat composer, so you can jump into a file, make a change, save it, and return to the conversation without switching tools.
4
+
5
+ The editor opens only files inside the current workspace, which keeps edits tied to the project where you started Kward.
2
6
 
3
7
  <quote>
4
8
  Three Modes for the Elven-kings under the sky,<br>
@@ -10,10 +14,6 @@ One Kward to bring them all and in the transcript bind them<br>
10
14
  In the Land of Ruby where the agents lie.<br>
11
15
  </quote>
12
16
 
13
- Kward includes a terminal editor with 3 editing modes to choose from: Modern, Emacs and Vibe. It opens inside the chat composer, so you can jump into a file, make a change, save it, and return to the conversation without switching tools.
14
-
15
- The editor is scoped to the current workspace. It only opens files inside that directory, which helps keep edits tied to the project you started Kward in.
16
-
17
17
  ## Quick start
18
18
 
19
19
  Open a file directly from your shell:
@@ -93,8 +93,8 @@ $doc/editor.md
93
93
 
94
94
  The editor is intentionally compact, but it covers the basics you need for quick changes:
95
95
 
96
- - Syntax highlighting for common languages, including Ruby, Crystal, Elixir, Julia, JavaScript, TypeScript, JSON, Markdown, YAML, Shell, Makefile, HTML, CSS, SCSS, Python, Go, Rust, Java, C#, C, C++, Swift, Kotlin, Lua, and SQL. Unknown file types render as plain text.
97
- - Auto-indent, enabled by default. New lines inherit indentation, Tab jumps to the expected indentation or the next indentation stop, Shift+Tab moves indentation back, obvious closing tokens are re-indented, and Backspace in leading whitespace removes one indentation unit when possible. For Ruby, Crystal, Elixir, Julia, Lua, Makefiles, and shell scripts, Enter after a block opener inserts the matching closing keyword; Ctrl+Enter also works from the middle of the line in terminals that report modified Enter keys.
96
+ - Syntax highlighting for common languages, including Ruby, ERB templates, Crystal, Elixir, Julia, JavaScript, TypeScript, JSON, Markdown, YAML, Shell, Makefile, HTML, CSS, SCSS, Python, Go, Rust, Java, C#, C, C++, Swift, Kotlin, Lua, and SQL. ERB highlights template HTML outside ERB tags and Ruby inside `<% ... %>` tags. Unknown file types render as plain text.
97
+ - Auto-indent, enabled by default. New lines inherit indentation, Tab jumps to the expected indentation or the next indentation stop, Shift+Tab moves indentation back, obvious closing tokens are re-indented, and Backspace in leading whitespace removes one indentation unit when possible. ERB recognizes common inline Ruby control tags and HTML opening tags when calculating the next indentation. For Ruby, Crystal, Elixir, Julia, Lua, Makefiles, and shell scripts, Enter after a block opener inserts the matching closing keyword; Ctrl+Enter also works from the middle of the line in terminals that report modified Enter keys.
98
98
  - Undo and redo, with up to 100 history entries per buffer.
99
99
  - Incremental search forward and backward.
100
100
  - Selection, copy, cut, and paste. Copy and cut also write to the terminal clipboard through OSC 52 when the terminal supports it.
data/doc/extensibility.md CHANGED
@@ -14,6 +14,7 @@ Start simple. Most users only need `PRINCIPLES.md`, workspace `AGENTS.md`, and m
14
14
  | Task-specific reusable instructions | skills |
15
15
  | Different tone or role | [personas](personas.md) |
16
16
  | Local Ruby behavior or integrations | plugins |
17
+ | External messaging or event integration | transport plugins |
17
18
  | Deterministic runtime policy or automation | lifecycle hooks |
18
19
 
19
20
  Install the starter pack for a useful starting point:
@@ -68,35 +69,9 @@ By default, Kward adds a compact instruction telling the model that `AGENTS.md`
68
69
 
69
70
  ## Prompt templates
70
71
 
71
- Use prompt templates when you repeatedly type the same kind of request.
72
+ Use prompt templates when you repeatedly type the same kind of request. Each Markdown file in `~/.kward/prompts/` becomes a slash command; its filename is the command name and `$ARGUMENTS` expands the text after the command.
72
73
 
73
- Create:
74
-
75
- ```text
76
- ~/.kward/prompts/review.md
77
- ```
78
-
79
- Example:
80
-
81
- ```markdown
82
- ---
83
- description: Review a change for correctness.
84
- argument-hint: <focus>
85
- ---
86
-
87
- Review the current diff for correctness, tests, and maintainability.
88
- Focus on: $ARGUMENTS
89
- ```
90
-
91
- Then run inside Kward:
92
-
93
- ```text
94
- /review auth edge cases
95
- ```
96
-
97
- The `description` frontmatter field appears in the slash command list and completion overlay so you can find the template by purpose. `argument-hint` is shown as a usage hint. The `$ARGUMENTS` placeholder in the body is replaced with whatever you type after the command.
98
-
99
- Prompt templates are best for reusable text. They do not run local code.
74
+ See [Prompt templates](prompt-templates.md) to create one, understand naming and reload behavior, and learn about the `/plan`, `/investigate`, `/research`, and `/codebase-review` templates installed by `kward init`.
100
75
 
101
76
  ## Skills
102
77
 
@@ -114,12 +89,15 @@ Hooks are deterministic automation and policy. They are not model instructions.
114
89
 
115
90
  Use plugins when text instructions are not enough and you need Ruby code to run locally.
116
91
 
117
- Plugins can add slash commands, prompt context, footer UI, transcript observers, and RPC-visible commands.
92
+ Plugins can add slash commands, prompt context, footer UI, transcript observers, RPC-visible commands, and external transports. Transport plugins can connect external conversations to normal Kward sessions or explicitly transport-capable plugin chats; they remain distinct from plugin-owned tabs.
93
+
94
+ Use `kward transport list` and `kward transport status` to inspect registered transports. Run a foreground transport with `kward transport run NAME`.
118
95
 
119
96
  Plugin files live in:
120
97
 
121
98
  ```text
122
99
  ~/.kward/plugins/*.rb
100
+ ~/.kward/plugins/*/plugin.rb
123
101
  ```
124
102
 
125
103
  Plugins are trusted local Ruby code. Install only plugins you trust. See [Plugins](plugins.md).
data/doc/files.md CHANGED
@@ -12,7 +12,7 @@ From an interactive Kward session, run:
12
12
  /files
13
13
  ```
14
14
 
15
- Kward opens the project file browser. Use the arrow keys to move through the tree, then press `Enter` on a file to open it in the integrated editor.
15
+ Kward opens the project file browser. Use the arrow keys or `j`/`k` to move through the tree, then press `Enter` on a file to open it in the integrated editor.
16
16
 
17
17
  When you quit the editor, Kward returns to the file browser at the same position so you can keep browsing nearby files.
18
18
 
@@ -32,10 +32,10 @@ Outside Git, Kward scans the workspace directory and skips common noisy director
32
32
 
33
33
  | Key | Action |
34
34
  | --- | ------ |
35
- | `↑` / `↓` | Move the selection |
35
+ | `↑` / `↓` or `j` / `k` | Move the selection down / up |
36
36
  | `Enter` | Open a file, or toggle a directory |
37
- | `←` | Collapse the selected directory, or jump to its parent |
38
- | `→` | Expand the selected directory |
37
+ | `←` or `h` | Collapse the selected directory, or jump to its parent |
38
+ | `→` or `l` | Expand the selected directory |
39
39
  | `Tab` | Start or stop search |
40
40
  | `/` | Start search |
41
41
  | `Backspace` | Delete the last search character |
@@ -55,7 +55,7 @@ For example:
55
55
  /agent
56
56
  ```
57
57
 
58
- Use `↑` and `↓` to choose a result, then press `Enter` to open it. Press `Esc` to return to the tree view.
58
+ Use `↑` / `↓` or `j` / `k` to choose a result, then press `Enter` to open it. Press `Esc` to return to the tree view.
59
59
 
60
60
  ## Mention a file in chat
61
61
 
@@ -84,7 +84,7 @@ A typical workflow:
84
84
  5. Save and quit.
85
85
  6. Continue browsing files, or press `Esc` to return to chat.
86
86
 
87
- See [Integrated Editor](editor.md) for editor modes, save/quit keys, search, selection, and configuration.
87
+ See [Integrated editor](editor.md) for editor modes, save/quit keys, search, selection, and configuration.
88
88
 
89
89
  ## Remembered state
90
90
 
@@ -57,7 +57,7 @@ Or from inside an interactive session:
57
57
  /login
58
58
  ```
59
59
 
60
- Kward supports OpenAI/ChatGPT, Anthropic Claude Pro/Max, OpenRouter, and experimental Copilot credentials. See [Authentication](authentication.md) when you need a specific provider.
60
+ Kward supports subscription login, direct native APIs, OpenAI-compatible API-key providers, Copilot, OpenRouter, and local model servers. See [Model providers](providers.md) to choose one, then [Authentication](authentication.md) for its login flow.
61
61
 
62
62
  Confirm your credentials are saved:
63
63
 
@@ -65,7 +65,7 @@ Confirm your credentials are saved:
65
65
  kward auth status
66
66
  ```
67
67
 
68
- If your provider offers multiple models, choose one inside Kward with `/model`.
68
+ Choose a model inside Kward with `/model`. The picker can refresh provider catalogs, switch providers, show all returned entries, or accept a manual model/deployment ID.
69
69
 
70
70
  ## Start an interactive chat
71
71
 
data/doc/git.md CHANGED
@@ -30,7 +30,7 @@ Use the overlay to review and shape the commit:
30
30
 
31
31
  | Key | Action |
32
32
  | --- | --- |
33
- | `↑` / `↓` | Move between changed files. |
33
+ | `↑` / `↓` or `j` / `k` | Move between changed files. |
34
34
  | `Enter` | Open the selected file in the diff viewer. |
35
35
  | `s` | Stage or unstage the selected file. |
36
36
  | `Tab` | Switch to commit-message entry. |
@@ -61,7 +61,7 @@ Useful keys in the diff viewer:
61
61
 
62
62
  After you close the viewer, Kward returns to the Git overlay with the file list refreshed.
63
63
 
64
- The diff viewer is read-only. It is meant for checking what changed, not editing. If you spot something you want to fix, close the viewer, return to chat, and ask Kward to make the change or open the file with the built-in editor using `$path/to/file`. See [Integrated Editor](editor.md) for editor workflows and keybindings.
64
+ The diff viewer is read-only. It is meant for checking what changed, not editing. If you spot something you want to fix, close the viewer, return to chat, and ask Kward to make the change or open the file with the built-in editor using `$path/to/file`. See [Integrated editor](editor.md) for editor workflows and keybindings.
65
65
 
66
66
  ## Example workflow
67
67
 
@@ -107,6 +107,12 @@ This is just a lightweight status hint. Use `/git` when you want to review or co
107
107
 
108
108
  If the working tree is clean when you run `/git`, the overlay shows `No uncommitted changes.` and there is nothing to stage or commit.
109
109
 
110
+ ## Agent commits in worktree tabs
111
+
112
+ When an active worktree tab receives an explicit request to commit, the agent can use the model-facing `git_commit` tool. It runs Git in the trusted host process so linked-worktree metadata can be updated without granting arbitrary shell commands write access to shared `.git` metadata.
113
+
114
+ The tool requires a commit message and can receive an optional list of workspace-relative paths. If paths are omitted, all current changes in the active worktree are included. Generic `run_shell_command` Git commands remain sandboxed and cannot replace this operation. It is exposed only for active interactive worktree tabs; RPC sessions do not currently support worktree bindings.
115
+
110
116
  ## Notes and limitations
111
117
 
112
118
  - `/git` is available in the interactive terminal UI, not in one-shot prompts or the RPC backend.
@@ -1,8 +1,8 @@
1
1
  # Lifecycle hooks
2
2
 
3
- Lifecycle hooks are deterministic runtime callbacks around Kward's agent workflow. Use them when something must happen because of an event, not because the model remembered an instruction.
3
+ Lifecycle hooks let you run a rule or action whenever something happens in Kward—for example, before a command runs, after a turn finishes, or when a tool needs approval. Use a hook when the action must happen reliably rather than depending on the model to remember an instruction.
4
4
 
5
- Hooks can observe events and return structured decisions to allow, deny, ask for approval, modify supported payloads, warn, retry, or defer. They are currently exposed through trusted Ruby plugins and through command hooks configured in `config.json`.
5
+ A hook can observe an event, allow or deny an operation, ask for approval, adjust supported data, or trigger follow-up work. You can add hooks through trusted Ruby plugins or configure command hooks in `config.json`.
6
6
 
7
7
  Hooks run as local code with your user permissions. Do not install hooks you do not trust, and do not put secrets in hook output.
8
8
 
@@ -34,7 +34,8 @@ When multiple hooks match one event, they run by ascending `order`. A `deny` sto
34
34
 
35
35
  ## Ruby plugin hooks
36
36
 
37
- Register hooks from trusted plugin files in `~/.kward/plugins/*.rb`:
37
+ Register hooks from trusted plugin files in `~/.kward/plugins/*.rb` or a
38
+ package entrypoint at `~/.kward/plugins/*/plugin.rb`:
38
39
 
39
40
  ```ruby
40
41
  Kward.plugin do |plugin|
@@ -363,7 +364,7 @@ Unknown selector keys match same-named payload fields.
363
364
 
364
365
  ## Security notes
365
366
 
366
- - Plugin hooks are trusted Ruby code loaded only from `~/.kward/plugins/*.rb`.
367
+ - Plugin hooks are trusted Ruby code loaded only from `~/.kward/plugins/*.rb` or package entrypoints at `~/.kward/plugins/*/plugin.rb`.
367
368
  - Command hooks run local commands with your user permissions.
368
369
  - Workspace hook files are loaded only after `/hooks trust`, and trust is invalidated when `.kward/hooks.json` changes.
369
370
  - Hook payloads are intentionally bounded and metadata-oriented; avoid logging raw event JSON if your hook receives prompt or command data.
data/doc/local-models.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Local models
2
2
 
3
- Kward can connect to a local model server that provides OpenAI-compatible Chat Completions. This is useful when you want offline development, control over model selection, or a smaller prompt for a local coding model.
3
+ If you already run Ollama, LM Studio, or llama.cpp, Kward can use it as a local model provider. This can be useful for offline work, tighter control over model selection, or a smaller prompt tuned for a local coding model. The server must provide OpenAI-compatible Chat Completions.
4
4
 
5
- Kward connects to an already-running server. It does not install runtimes, download models, choose GPU settings, or load models for you.
5
+ Kward connects to an already-running server; it does not install a runtime, download or load models, or choose GPU settings. For a comparison with hosted providers, see [Model providers](providers.md#Choosing_between_similar_providers).
6
6
 
7
7
  ## Choose and start a runtime
8
8
 
data/doc/mcp.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # MCP servers
2
2
 
3
- Kward can connect to local [Model Context Protocol](https://modelcontextprotocol.io/) servers and expose their tools to the model alongside Kward's built-in workspace tools.
3
+ Kward can connect to local [Model Context Protocol](https://modelcontextprotocol.io/) servers and use their tools alongside its built-in workspace tools.
4
4
 
5
- This is useful when another app ships an MCP server for something Kward should be able to inspect or control. For example, Safari Technology Preview includes a Safari MCP server that lets agents inspect pages, console output, network activity, screenshots, and other browser state.
5
+ Use MCP when another app exposes something you want Kward to inspect or control. For example, Safari Technology Preview includes an MCP server for inspecting pages, console output, network activity, screenshots, and other browser state.
6
6
 
7
7
  ## Configure a local MCP server
8
8
 
@@ -66,7 +66,7 @@ Example with an environment variable and custom timeout:
66
66
 
67
67
  ## Notes and limitations
68
68
 
69
- - Kward currently supports local stdio MCP servers.
70
- - Kward currently exposes MCP tools. MCP resources, prompts, sampling, and Streamable HTTP are not implemented yet.
71
- - MCP tool results are returned to the model as text. Structured content is included as JSON. Image, audio, and resource results are summarized as placeholders for now.
69
+ - Kward supports local stdio MCP servers and exposes their tools to the model.
70
+ - It does not support MCP resources, prompts, sampling, or Streamable HTTP.
71
+ - MCP tool results are returned to the model as text. Structured content is included as JSON. Image, audio, and resource results are summarized as placeholders.
72
72
  - MCP servers can expose sensitive local application state. Only configure servers you trust, especially browser automation servers that can read page content or screenshots.
data/doc/permissions.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Permissions
2
2
 
3
- Kward's permission policy lets you put a human decision between a model-requested tool call and its side effect. It is useful when you want the agent to inspect a project freely, but want to confirm edits, commands, web requests, or MCP calls as they arise.
3
+ Turn on permissions when you want Kward to ask before it edits files, runs commands, accesses the web, or calls an MCP tool. In the usual `ask` mode, read-only work continues normally while you decide which side effects to allow.
4
4
 
5
- Permissions are **off by default**. Enabling them does not sandbox Kward or its subprocesses: an allowed shell command still runs with your operating-system user permissions unless you separately enable [command sandboxing](sandboxing.md) for model-requested shell commands.
5
+ Permissions are **off by default**. They are not an operating-system sandbox: an allowed shell command still runs with your operating-system user permissions unless you separately enable [command sandboxing](sandboxing.md) for model-requested shell commands.
6
6
 
7
7
  ## Start with approval mode
8
8
 
@@ -24,7 +24,16 @@ In `ask` mode, Kward allows ordinary read-only tools and asks before the agent:
24
24
  - searches or fetches content on the web,
25
25
  - calls an MCP tool.
26
26
 
27
- When approval is required in the interactive CLI, Kward opens a modal overlay. It shows the complete tool arguments, so an approval for `read_skill` includes the requested skill name and relative path, and an approval for a write includes its path and content. Choose **Allow once** to run that one call, **Allow this tool for this session** to allow later calls to the same tool in the current Kward session, or **Deny** to stop it. Pressing `Esc`, cancelling the overlay, or losing the approval bridge denies the call.
27
+ When Kward needs approval in the interactive CLI, it shows the complete tool arguments in an overlay. For example, a write request includes the file path and content.
28
+
29
+ Choose:
30
+
31
+ - **Allow once** to run this call.
32
+ - **Allow this tool for this session** to allow later calls to the same tool in the current session.
33
+ - **Deny** to stop the call.
34
+ - **Type something** to stop the call and tell Kward what to do instead.
35
+
36
+ Pressing `Esc`, closing the overlay, or losing the frontend connection denies the call.
28
37
 
29
38
  ### Steer the agent with `Type something`
30
39
 
@@ -91,7 +100,7 @@ With this configuration, the agent may edit `lib/` and `test/` without asking. A
91
100
 
92
101
  `write_scopes` narrows the policy's default workspace-write behavior; it does not broaden Kward's built-in workspace boundary. File tools still stay inside the active workspace by default, and existing files must still be read before Kward can edit them. See [Workspace tools](workspace-tools.md) for those guardrails.
93
102
 
94
- An empty `write_scopes` array permits no default workspace writes. Omit `write_scopes` if you want the `workspace-write` mode to cover the normal workspace file-tool boundary.
103
+ An empty `write_scopes` array permits no default workspace writes. Omit `write_scopes` if you want the `workspace-write` mode to cover the normal workspace file-tool boundary. The active worktree `git_commit` tool is treated as a mutating tool: it asks for approval in the default `ask` mode and is denied by read-only or deny-by-default modes unless explicitly allowed.
95
104
 
96
105
  ## Rules and precedence
97
106