kward 0.78.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 (137) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +13 -2
  3. data/.github/workflows/pages.yml +1 -1
  4. data/CHANGELOG.md +82 -1
  5. data/Gemfile.lock +2 -2
  6. data/README.md +33 -38
  7. data/doc/agent-tools.md +10 -11
  8. data/doc/api.md +3 -3
  9. data/doc/authentication.md +79 -110
  10. data/doc/code-search.md +1 -1
  11. data/doc/composer.md +1 -1
  12. data/doc/configuration.md +136 -27
  13. data/doc/context-budgeting.md +6 -6
  14. data/doc/context-tools.md +2 -2
  15. data/doc/editor.md +7 -7
  16. data/doc/extensibility.md +9 -29
  17. data/doc/files.md +6 -6
  18. data/doc/getting-started.md +3 -3
  19. data/doc/git.md +8 -2
  20. data/doc/lifecycle-hooks.md +5 -4
  21. data/doc/local-models.md +130 -0
  22. data/doc/mcp.md +5 -5
  23. data/doc/permissions.md +15 -5
  24. data/doc/plugins.md +39 -4
  25. data/doc/prompt-templates.md +105 -0
  26. data/doc/providers.md +140 -0
  27. data/doc/releasing.md +11 -3
  28. data/doc/rpc.md +65 -31
  29. data/doc/sandboxing.md +142 -0
  30. data/doc/security.md +31 -10
  31. data/doc/session-management.md +2 -4
  32. data/doc/skills.md +10 -0
  33. data/doc/tabs.md +37 -0
  34. data/doc/telegram.md +138 -0
  35. data/doc/transports.md +209 -0
  36. data/doc/usage.md +11 -3
  37. data/doc/web-search.md +3 -3
  38. data/doc/workspace-tools.md +4 -4
  39. data/examples/plugins/stardate_footer.rb +10 -0
  40. data/examples/plugins/telegram/plugin.rb +39 -0
  41. data/examples/plugins/telegram/telegram_api.rb +136 -0
  42. data/examples/plugins/telegram/telegram_transport.rb +304 -0
  43. data/kward.gemspec +1 -1
  44. data/lib/kward/ansi.rb +1 -0
  45. data/lib/kward/auth/api_key_store.rb +99 -0
  46. data/lib/kward/cli/auth_commands.rb +72 -13
  47. data/lib/kward/cli/commands.rb +7 -0
  48. data/lib/kward/cli/doctor.rb +21 -0
  49. data/lib/kward/cli/git.rb +31 -8
  50. data/lib/kward/cli/plugins.rb +1 -0
  51. data/lib/kward/cli/prompt_interface.rb +7 -0
  52. data/lib/kward/cli/rendering.rb +6 -2
  53. data/lib/kward/cli/runtime_helpers.rb +4 -2
  54. data/lib/kward/cli/sessions.rb +1 -1
  55. data/lib/kward/cli/settings.rb +162 -36
  56. data/lib/kward/cli/slash_commands.rb +109 -1
  57. data/lib/kward/cli/tabs.rb +102 -37
  58. data/lib/kward/cli/transports.rb +67 -0
  59. data/lib/kward/cli/worktrees.rb +360 -0
  60. data/lib/kward/cli.rb +22 -1
  61. data/lib/kward/config_files.rb +106 -4
  62. data/lib/kward/conversation.rb +27 -8
  63. data/lib/kward/git_worktree_manager.rb +291 -0
  64. data/lib/kward/local_command_runner.rb +2 -2
  65. data/lib/kward/model/azure_openai_config.rb +54 -0
  66. data/lib/kward/model/catalog.rb +113 -0
  67. data/lib/kward/model/client.rb +364 -23
  68. data/lib/kward/model/model_info.rb +60 -1
  69. data/lib/kward/model/payloads.rb +64 -4
  70. data/lib/kward/model/provider_catalog.rb +114 -0
  71. data/lib/kward/model/sources.rb +70 -0
  72. data/lib/kward/model/stream_parser.rb +141 -39
  73. data/lib/kward/pan/index.html.erb +50 -0
  74. data/lib/kward/pan/server.rb +49 -2
  75. data/lib/kward/permissions/policy.rb +18 -4
  76. data/lib/kward/plugin_chat_runtime.rb +374 -0
  77. data/lib/kward/plugin_registry.rb +81 -8
  78. data/lib/kward/private_file.rb +9 -3
  79. data/lib/kward/prompt_interface/approval_prompt.rb +2 -0
  80. data/lib/kward/prompt_interface/composer_renderer.rb +1 -5
  81. data/lib/kward/prompt_interface/editor/auto_indent.rb +46 -0
  82. data/lib/kward/prompt_interface/editor/buffer.rb +18 -4
  83. data/lib/kward/prompt_interface/editor/controller.rb +43 -10
  84. data/lib/kward/prompt_interface/editor/modes/vibe.rb +2 -2
  85. data/lib/kward/prompt_interface/editor/renderer.rb +8 -8
  86. data/lib/kward/prompt_interface/editor/state.rb +3 -9
  87. data/lib/kward/prompt_interface/editor/syntax_highlighter.rb +184 -9
  88. data/lib/kward/prompt_interface/file_overlay.rb +2 -2
  89. data/lib/kward/prompt_interface/git_prompt.rb +7 -3
  90. data/lib/kward/prompt_interface/interactive/controller.rb +4 -4
  91. data/lib/kward/prompt_interface/interactive/renderer.rb +4 -1
  92. data/lib/kward/prompt_interface/interactive/state.rb +2 -2
  93. data/lib/kward/prompt_interface/project_browser.rb +25 -6
  94. data/lib/kward/prompt_interface/runtime_state.rb +22 -6
  95. data/lib/kward/prompt_interface/screen.rb +3 -0
  96. data/lib/kward/prompt_interface/selection_prompt.rb +7 -1
  97. data/lib/kward/prompt_interface/transcript_buffer.rb +24 -2
  98. data/lib/kward/prompt_interface.rb +71 -12
  99. data/lib/kward/prompts/commands.rb +3 -1
  100. data/lib/kward/prompts.rb +22 -10
  101. data/lib/kward/rpc/auth_manager.rb +112 -152
  102. data/lib/kward/rpc/config_manager.rb +46 -6
  103. data/lib/kward/rpc/plugin_chat_manager.rb +56 -194
  104. data/lib/kward/rpc/prompt_bridge.rb +8 -4
  105. data/lib/kward/rpc/redactor.rb +1 -1
  106. data/lib/kward/rpc/server.rb +102 -14
  107. data/lib/kward/rpc/session_manager.rb +151 -38
  108. data/lib/kward/sandbox/capabilities.rb +39 -0
  109. data/lib/kward/sandbox/command_runner.rb +28 -0
  110. data/lib/kward/sandbox/environment.rb +24 -0
  111. data/lib/kward/sandbox/linux_bubblewrap_runner.rb +71 -0
  112. data/lib/kward/sandbox/macos_seatbelt_runner.rb +96 -0
  113. data/lib/kward/sandbox/passthrough_runner.rb +13 -0
  114. data/lib/kward/sandbox/policy.rb +74 -0
  115. data/lib/kward/sandbox/runner_factory.rb +55 -0
  116. data/lib/kward/sandbox/unavailable_runner.rb +21 -0
  117. data/lib/kward/sandbox.rb +9 -0
  118. data/lib/kward/session_store.rb +110 -24
  119. data/lib/kward/skills/capture.rb +144 -0
  120. data/lib/kward/tab_driver.rb +6 -3
  121. data/lib/kward/tools/git_commit.rb +39 -0
  122. data/lib/kward/tools/registry.rb +26 -6
  123. data/lib/kward/tools/tool_call.rb +1 -0
  124. data/lib/kward/transport/gateway.rb +253 -0
  125. data/lib/kward/transport/host.rb +343 -0
  126. data/lib/kward/transport/manager.rb +179 -0
  127. data/lib/kward/transport/plugin_chat_gateway.rb +186 -0
  128. data/lib/kward/transport/runtime.rb +41 -0
  129. data/lib/kward/transport/store.rb +101 -0
  130. data/lib/kward/transport.rb +204 -0
  131. data/lib/kward/version.rb +1 -1
  132. data/lib/kward/workspace.rb +18 -3
  133. data/lib/kward/workspace_factory.rb +34 -0
  134. data/templates/default/fulldoc/html/js/kward.js +3 -0
  135. data/templates/default/kward_navigation.rb +8 -1
  136. data/templates/default/layout/html/setup.rb +5 -0
  137. metadata +41 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e77436e5f94e314fcab35e347c16994eb8f92f990ad4c3ebdc6ab76a393cb1b4
4
- data.tar.gz: 50b73b48c76c737d5b7d2534380547d94e357cac6dec4528a80cfe36ea8f6bdf
3
+ metadata.gz: e9128f608c2a864ad996598d285d4042758ea1bc1b3a76a1224984ef23129544
4
+ data.tar.gz: c9d718290398f95e1420e5e12225e43aaba6bf6c64c868fb6d175d5725aaf19d
5
5
  SHA512:
6
- metadata.gz: bc17d7227fa1910ee107b840ec138ee19c8ed905d137d7aeed3fc552e2ec6d3aca1fb3d8df4febce7c7e84380a7e4f4378c3177415b3ab7a59fb22d344b92d2c
7
- data.tar.gz: 56521cdb264f5745f2023a010892b99ec91693f4444c17c0f1aa7b9375e9d0727ba7c9ce280d4e0af9141ae5466073393fbf9d112d53bf7ea12872aa68c7f617
6
+ metadata.gz: 6b0e53fddfa2de055b11b6bbe0965496e2abc860162ed0888642bb353ae64e0e0fdbfbe14ed7412198c8c60583c1d55fd6d9cd7fec7a43eb37db456a494f5a1a
7
+ data.tar.gz: 2396aceedf67453422924616d92031160d3eee67ae448347d2f367a05d48a97d9ae39789b2100c3c47bdbc5925c85e4922146a50c72ee662d863f8ad597dacbd
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby-version: ['3.2', 'ruby']
19
+ ruby-version: ['3.4', 'ruby']
20
20
  steps:
21
21
  - name: Checkout
22
22
  uses: actions/checkout@v4
@@ -27,11 +27,22 @@ jobs:
27
27
  ruby-version: ${{ matrix.ruby-version }}
28
28
  bundler-cache: true
29
29
 
30
+ - name: Install sandbox test dependency
31
+ run: sudo apt-get update && sudo apt-get install --yes bubblewrap
32
+
33
+ - name: Enable Bubblewrap namespaces
34
+ run: |
35
+ sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
36
+ sudo sysctl -w kernel.unprivileged_userns_clone=1
37
+ bwrap --ro-bind / / --unshare-net true
38
+
30
39
  - name: Check syntax
31
40
  run: find lib test -name '*.rb' -print0 | xargs -0 ruby -c
32
41
 
33
42
  - name: Check runtime warnings
34
- run: ruby -w -Ilib -e 'require "kward"'
43
+ run: bundle exec ruby -w -Ilib -e 'require "kward"'
35
44
 
36
45
  - name: Run tests
46
+ env:
47
+ KWARD_RUN_BUBBLEWRAP_TESTS: "1"
37
48
  run: bundle exec rake test
@@ -25,7 +25,7 @@ jobs:
25
25
  - name: Set up Ruby
26
26
  uses: ruby/setup-ruby@v1
27
27
  with:
28
- ruby-version: '3.3'
28
+ ruby-version: '3.4'
29
29
  bundler-cache: true
30
30
 
31
31
  - name: Build documentation
data/CHANGELOG.md CHANGED
@@ -2,7 +2,88 @@
2
2
 
3
3
  All notable changes to Kward will be documented in this file.
4
4
 
5
- ## [Unreleased]
5
+ ## [0.80.0] - 2026-07-27
6
+
7
+ ### Added
8
+
9
+ - Added HTML/Ruby syntax highlighting and common-block auto-indentation for `.erb` files in the integrated editor.
10
+ - Added catalog-based API-key login and model selection for OpenAI, Anthropic, Azure OpenAI, Gemini, Cerebras, DeepSeek, Fireworks AI, Groq, Mistral, NVIDIA NIM, OpenRouter, Together AI, and xAI, with private credential storage and live/cached/curated model catalogs.
11
+ - Added native streaming runtimes for the OpenAI Responses API, Google Gemini, and Azure OpenAI, including tool calls, usage metadata, retries, cancellation, and secret redaction.
12
+ - Added RPC parity for provider/auth-method discovery, sanitized credential status, API-key login/logout, model refresh, and provider/model selection.
13
+ - Added a dedicated model-provider guide with the canonical provider list, runtime IDs, authentication, model configuration, discovery behavior, and limitations.
14
+ - Added a prompt-template guide, including template creation, slash-command expansion, and the starter templates installed by `kward init`.
15
+ - Added a Stardate footer plugin example for the interactive CLI.
16
+ - Added a general transport plugin API with normalized messages and events, persistent transport state, policy checks, managed lifecycle, foreground CLI commands, and RPC capability/status reporting.
17
+ - Added a first-party Telegram long-polling transport example with fixed-workspace routing, numeric allowlists, idempotent updates, message chunking, and interactive approval/question buttons.
18
+ - Added packaged plugin entrypoints under `~/.kward/plugins/*/plugin.rb` for multi-file trusted plugins.
19
+ - Added generic transport execution profiles and an isolated Telegram chat transport with no tools, plugin commands, memory, attachments, or interactions.
20
+ - Added a shared scoped plugin-chat runtime and `Transport::Host#plugin_chats` for explicitly transport-capable plugin chats, including actor context, event replay, cancellation, and separate transport/RPC access.
21
+ - Added transport-only plugin chats with `local: false`, keeping externally targeted plugin chats out of local tab opening and restoration.
22
+ - Added Git worktree bindings for normal interactive session tabs. `/tab worktree` can move a tab into a strict linked-worktree workspace after research, preserve its transcript, warn about dirty origin changes, and keep the branch available when explicitly detached.
23
+ - Added the active worktree `git_commit` model tool, allowing explicitly requested agent commits through the trusted host-side Git workflow without widening the shell sandbox.
24
+ - Added `/tab worktree merge` for explicitly merging a clean worktree branch into the branch checked out in its original workspace, plus `/tab worktree merge abort` for conflicted merges.
25
+ - Added `j`/`k` keyboard navigation to the `/files` project browser.
26
+ - Added `h`/`l` keyboard navigation for collapsing and expanding `/files` directories.
27
+ - Added `j`/`k` keyboard navigation to the `/git` changed-file overlay.
28
+
29
+ ### Changed
30
+
31
+ - Avoided copying bounded transcript buffers into idle tab snapshots while preserving intentional full-conversation scrollback replay when those tabs are revisited.
32
+ - Kept the TUI transcript buffer under its existing limit while trimming to a safe low watermark instead of copying the full buffer after every appended character.
33
+ - Reduced integrated-editor layout work by caching line starts and calculating the cursor line once per rendered frame.
34
+ - Limited interactive plugin footer evaluation to its authoritative one-second refresh interval and reused the cached value between refreshes.
35
+ - Made interactive plugin canvases publish only complete frames submitted with `ui.render`, skip unpublished ticks, and follow terminal width changes.
36
+ - Avoided rebuilding and flushing the TUI composer when tab labels and selection have not changed.
37
+ - Reduced interactive streaming overhead by writing each labeled TUI delta in one synchronized prompt transaction.
38
+ - Highlighted the current editor line number in white while keeping the rest of the line-number gutter green.
39
+ - Made `/model` provider-aware with refresh, manual model IDs, capability-filtered defaults, Show all, and provider switching while preserving Codex, Copilot, OpenRouter, and local models.
40
+ - Kept direct OpenAI API credentials (`openai_api`) separate from ChatGPT/Codex OAuth so both can be configured at once.
41
+ - Azure OpenAI setup now validates HTTPS endpoints, deployment names, and API versions, and treats the configured deployment as the selectable model.
42
+ - Updated current documentation to describe Copilot and the JSON-RPC backend as supported features rather than experimental ones.
43
+ - Clarified the distinct roles of workspace guardrails, tool permissions, and command sandboxing.
44
+ - Reorganized the README documentation index and clarified generated Ruby API support boundaries.
45
+ - Added task-oriented navigation to the RPC and configuration references.
46
+ - Standardized MCP support and limitation wording across the user and RPC guides.
47
+ - Reframed the README introduction around Kward as an Agentic Development Environment (ADE) with opt-in safety controls.
48
+ - Moved the local-model setup guide to the generated documentation Integrate navigation.
49
+ - Added the Telegram transport deployment guide to the generated documentation navigation.
50
+ - Replaced implicit `/tab worktree` detachment with explicit `/tab worktree detach`; running `/tab worktree` again now leaves an active worktree enabled.
51
+ - Added workspace overrides for foreground transports via `kward transport run NAME WORKSPACE` and the global `--working-directory` option.
52
+ - The `/files` project-browser now uses full terminal height if there are enough files to fill that space
53
+
54
+ ### Fixed
55
+
56
+ - Prevented a stopped tab live-view thread from resuming against a newly active tab after a slow render.
57
+ - Kept `@`/`$` completion, `/files`, prompt history, and the integrated editor rooted in the active worktree tab instead of the original checkout.
58
+ - Fixed HTML and ERB editor highlighting so tag names, attributes, values, and tag fragments retain consistent colors across embedded Ruby expressions.
59
+ - Refreshed composer diff and context usage status immediately when switching session tabs.
60
+ - Prevented `/reload` from retaining stale prompt templates, so new and edited prompt files refresh slash-command completion and expansion.
61
+ - Prevented session-picker rename input from filtering the visible session list.
62
+ - Fixed session listing timestamps and ordering to ignore system-prompt and other metadata writes during session restoration.
63
+
64
+ ## [0.79.0] - 2026-07-19
65
+
66
+ ### Added
67
+
68
+ - Added a Local OpenAI-compatible model provider for Ollama, LM Studio, and llama.cpp, including model discovery, streamed tool calls, configurable context windows, CLI/RPC model selection, and a local-model setup guide.
69
+ - Added replacement system-prompt files and an option to omit global principles for smaller-model prompt budgets.
70
+ - Added skill capture from saved session branches. Review model-generated personal `SKILL.md` drafts in the CLI or Pan, or use the equivalent RPC workflow before explicitly saving them.
71
+ - Added opt-in OS-enforced sandboxing for model-requested shell commands. macOS uses Seatbelt and Linux uses Bubblewrap when available; requested sandboxing fails closed when no supported backend can enforce it. The interactive `/sandbox` command reports and updates the global policy.
72
+
73
+ ### Changed
74
+
75
+ - Clarified command-sandbox configuration, platform setup, and limits across the security, permissions, workspace-tools, RPC, and configuration guides.
76
+ - Sandboxed command workers now receive a sanitized environment with a private home and temporary directory; the macOS backend also blocks reads from common credential directories.
77
+ - Improved built-in tool guidance so agents use only tools advertised for the current turn and select code search, compacted-output retrieval, and structured clarification when appropriate.
78
+ - Raised the minimum supported Ruby version from 3.2 to 3.4.
79
+
80
+ ### Fixed
81
+
82
+ - Reject duplicate discovered tool names instead of silently replacing one MCP tool with another.
83
+ - Fixed an RPC race where follow-up input could queue instead of steering a turn immediately after it began.
84
+ - Prevented the RPC server from loading trusted Ruby plugins separately for plugin chats and workspace sessions, eliminating duplicate constant-definition warnings during startup.
85
+ - Prevented `/reload` and RPC runtime reloads from emitting duplicate constant-definition warnings for plugin-defined constants.
86
+ - Wrapped long side-by-side diff cells when editor soft wrap is enabled instead of clipping their contents.
6
87
 
7
88
  ## [0.78.0] - 2026-07-15
8
89
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kward (0.78.0)
4
+ kward (0.80.0)
5
5
  base64
6
6
  nokogiri
7
7
  tiktoken_ruby
@@ -146,7 +146,7 @@ CHECKSUMS
146
146
  html-proofer (5.2.1) sha256=fdd958a7cbf9c3255fb96fe7cfc4e611f64e2706e469488a3326309ad007d2fd
147
147
  io-event (1.16.2) sha256=9f9cb0a96ea5c3850a672606c65f27bc96d7621399ef6196acbfe2be0cd1279c
148
148
  json (2.19.9) sha256=9b9025b7cdddafa38d316eca0b2358488e42d417045c1b90d216a9fefe46b79a
149
- kward (0.78.0)
149
+ kward (0.80.0)
150
150
  logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
151
151
  metrics (0.15.0) sha256=61ded5bac95118e995b1bc9ed4a5f19bc9814928a312a85b200abbdac9039072
152
152
  minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
data/README.md CHANGED
@@ -1,29 +1,16 @@
1
1
  # Kward
2
2
 
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.
3
+ Kward is a coding agent for your terminal. It can inspect and edit a project, run commands, research problems, and save your work in sessions you can resume later.
4
4
 
5
- It currently supports the OpenAI/ChatGPT Codex backend, Anthropic Claude Pro/Max subscription, OpenRouter, and experimental Copilot provider support.
5
+ Use Kward from the terminal, its local browser interface, or a trusted JSON-RPC client. It works with ChatGPT/Codex and Claude subscriptions, hosted model APIs, GitHub Copilot, OpenRouter, and local servers such as Ollama, LM Studio, and llama.cpp.
6
6
 
7
- ## Why use Kward?
7
+ ## Why Kward?
8
8
 
9
- Kward is designed for working with real projects, not isolated prompts.
9
+ Software work rarely fits into one chat. A project can span days of research, implementation, debugging, review, and decisions worth keeping.
10
10
 
11
- Typical workflows include:
11
+ Kward treats that work as an ongoing workspace rather than a disposable conversation. You can resume earlier sessions, split work across tabs and Git worktrees, and keep project guidance close to the code. Optional permissions, command sandboxing, and workspace boundaries give you more control when a task needs it.
12
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
- ```
13
+ Start with a normal coding conversation. If your workflow grows, you can add memory, reusable prompts and skills, local plugins, lifecycle hooks, MCP servers, transports, or a custom RPC client.
27
14
 
28
15
  ## Install
29
16
 
@@ -52,55 +39,63 @@ kward "Explain this project" # run one prompt and exit
52
39
  kward --working-directory ~/code/project "Explain this project"
53
40
  ```
54
41
 
55
- From inside Kward, `/login` opens the same provider picker.
42
+ From inside Kward, `/login` lets you choose API-key or subscription authentication across supported providers. `/model` then switches providers, refreshes model catalogs, or accepts a manual model/deployment ID. Direct OpenAI API credentials and ChatGPT/Codex OAuth can coexist.
56
43
 
57
- See [Authentication](doc/authentication.md) for more details about sign-in options and provider credentials.
44
+ See [Model providers](doc/providers.md) to choose a backend and [Authentication](doc/authentication.md) for credential storage and login flows.
58
45
 
59
- ## What Kward can do
46
+ ## Common ways to use Kward
60
47
 
61
- - Keep a multi-turn coding conversation in your terminal.
62
- - Read, write, and edit workspace files with read-before-write guardrails.
63
- - Run local shell commands from the workspace.
64
- - Search the live web and inspect cached public GitHub repositories.
65
- - Save, resume, clone, compact, and export sessions.
66
- - Extend the Agent with trusted Ruby plugins for custom commands, footer UI, prompt context, and transcript-event observers.
67
- - Use optional memory, personas, prompt templates, and skills.
68
- - Serve a JSON-RPC backend for trusted local UI clients.
48
+ - Explore an unfamiliar codebase and keep useful discoveries for later sessions.
49
+ - Investigate a bug, make a focused change, and run the related tests.
50
+ - Review a diff, inspect the surrounding code, and commit from the terminal UI.
51
+ - Work on several tasks at once with tabs, branches, and linked Git worktrees.
52
+ - Teach Kward your project conventions with `AGENTS.md`, skills, prompt templates, and optional memory.
53
+ - Add trusted local behavior through plugins, lifecycle hooks, MCP servers, transports, or JSON-RPC integrations.
69
54
 
70
55
  ## Documentation
71
56
 
72
- Start here:
57
+ New to Kward:
73
58
 
74
59
  - [Getting started](doc/getting-started.md): first run, authentication choices, and basic commands.
75
60
  - [Usage](doc/usage.md): interactive chat, slash commands, sessions, tools, images, and Pan mode.
76
61
  - [Configuration](doc/configuration.md): config files, providers, models, web search, logging, and color output.
77
- - [Authentication](doc/authentication.md): OpenAI OAuth, Anthropic OAuth, OpenRouter API keys, and Copilot/GitHub setup.
62
+ - [Authentication](doc/authentication.md): multi-provider API keys, OpenAI/Anthropic subscription OAuth, Azure setup, and credential safety.
63
+ - [Model providers](doc/providers.md): compare providers and find their runtime IDs, model keys, environment variables, discovery behavior, and limitations.
64
+
65
+ Work safely:
66
+
78
67
  - [Security and trust](doc/security.md): local permissions, external data flow, trusted extensions, and safe work in unfamiliar repositories.
79
68
  - [Permissions](doc/permissions.md): opt-in tool approval, write scopes, policy rules, and current limits.
69
+ - [Command sandboxing](doc/sandboxing.md): opt-in OS-enforced boundaries for model-requested shell commands.
80
70
  - [Troubleshooting](doc/troubleshooting.md): environment-specific install and runtime issues.
81
71
 
82
- Feature guides:
72
+ Everyday workflows:
83
73
 
84
74
  - [Sessions](doc/session-management.md): resume, clone, fork, rewind, compact, and navigate saved work.
85
75
  - [Interactive composer](doc/composer.md): use multiline input, completion, history, files, reasoning shortcuts, busy input, and images.
86
76
  - [Tabs](doc/tabs.md): keep several conversations open and run work in another tab.
87
77
  - [Project files](doc/files.md): browse, search, mention, open, and edit workspace files.
88
- - [Integrated Editor](doc/editor.md): open files from the shell or composer, edit in-place, and choose editor keybindings.
78
+ - [Integrated editor](doc/editor.md): open files from the shell or composer, edit in-place, and choose editor keybindings.
89
79
  - [Git](doc/git.md): review changes, use the diff viewer, stage files, and commit from the interactive TUI.
90
80
  - [Shell](doc/shell.md): use `/shell`, the embedded Kward shell with aliases, completion, and per-tab state.
91
81
  - [Memory](doc/memory.md): opt-in core, soft, and session memory.
92
82
  - [Personas](doc/personas.md): configure Kward's tone and role by default, workspace, model, reasoning effort, time, and weekday.
93
83
  - [Skills](doc/skills.md): add reusable instructions that load only for matching tasks.
84
+ - [Prompt templates](doc/prompt-templates.md): create reusable slash prompts and use the starter templates installed by `kward init`.
94
85
  - [MCP servers](doc/mcp.md): connect trusted local Model Context Protocol tool servers.
95
86
  - [Pan mode](doc/pan.md): use the mobile-friendly browser interface on a trusted local network.
87
+ - [Local models](doc/local-models.md): connect Ollama, LM Studio, or llama.cpp and use a minimal replacement prompt.
96
88
 
97
- Advanced:
89
+ Extend and integrate:
98
90
 
99
- - [Extensibility](doc/extensibility.md): `PRINCIPLES.md`, workspace `AGENTS.md`, skills, prompt templates, and extension choices.
91
+ - [Extensibility](doc/extensibility.md): choose between `PRINCIPLES.md`, workspace `AGENTS.md`, skills, prompt templates, and other extension points.
100
92
  - [Plugins](doc/plugins.md): trusted Ruby plugins for commands, footer UI, prompt context, transcript events, and RPC clients.
101
93
  - [Lifecycle hooks](doc/lifecycle-hooks.md): deterministic runtime hooks for policy, approvals, automation, and command-hook integrations.
102
94
  - [RPC protocol](doc/rpc.md): JSON-RPC backend mode for trusted local UI clients.
103
95
  - [Releasing](doc/releasing.md): release checklist for RubyGems publishing.
96
+
97
+ Reference guides:
98
+
104
99
  - [Agent tools](doc/agent-tools.md): overview of model-callable tools, token-saving behavior, and tool categories.
105
100
  - [Workspace tools](doc/workspace-tools.md): local file, edit, and shell command tools.
106
101
  - [Context budgeting](doc/context-budgeting.md): focused context gathering, budgeted reads, output compaction, and token-saving history.
@@ -108,9 +103,9 @@ Advanced:
108
103
  - [Code search](doc/code-search.md): package lookup, GitHub repository cache, and external source reading for the code search agent tool.
109
104
  - [Context tools](doc/context-tools.md): skills, compacted output retrieval, and structured clarification questions.
110
105
 
111
- API reference:
106
+ Generated Ruby API:
112
107
 
113
- - [API reference](doc/api.md): generated Ruby API entry points, indexes, and public API expectations.
108
+ - [API reference](doc/api.md): generated Ruby API entry points, indexes, and supported API expectations.
114
109
 
115
110
  ## Development
116
111
 
data/doc/agent-tools.md CHANGED
@@ -2,14 +2,13 @@
2
2
 
3
3
  Agent tools are the model-callable operations Kward uses to inspect projects, change files, run commands, search outside sources, and ask for clarification. Most users do not call these tools directly. You ask for an outcome in natural language, and Kward decides which tools are needed.
4
4
 
5
- Tools are part of Kward's safety and context-management boundary:
5
+ Tools also enforce important boundaries:
6
6
 
7
- - schemas describe what the model is allowed to call,
8
- - Ruby tool objects validate and execute those calls,
9
- - workspace tools stay inside the active workspace by default (see [Configuration](configuration.md) for the guardrail setting),
10
- - file-changing tools require the file to be read first,
11
- - large outputs are bounded or compacted before they enter model context,
12
- - full tool outputs are kept in the session record for later inspection.
7
+ - Kward validates every tool call before running it.
8
+ - Workspace tools stay inside the active workspace by default (see [Configuration](configuration.md) for the guardrail setting).
9
+ - File-changing tools require the file to be read first.
10
+ - Large outputs are bounded or compacted before they enter model context.
11
+ - Full tool outputs remain available in the session record for later inspection.
13
12
 
14
13
  ## Tool categories
15
14
 
@@ -22,7 +21,7 @@ Tools are part of Kward's safety and context-management boundary:
22
21
 
23
22
  ## How tools save tokens
24
23
 
25
- Kward tries to keep tool context useful without flooding the model. The built-in prompt tells Kward to start with focused context tools and escalate from outlines/previews to exact ranges before full-file reads:
24
+ Kward tries to gather enough evidence without flooding the conversation. It usually starts with focused context tools, then moves from outlines and previews to exact ranges or full files only when needed:
26
25
 
27
26
  - `read_file` reads bounded line ranges, supports continuation with `offset` and `limit`, and accepts explicit `preview`, `outline`, `range`, and `full` modes with optional per-call byte budgets.
28
27
  - `context_for_task` builds a task-shaped bundle from ranked files, outlines, and matching excerpts within a caller-supplied byte budget.
@@ -32,13 +31,13 @@ Kward tries to keep tool context useful without flooding the model. The built-in
32
31
  - Repeated identical tool output is replaced with a short reference instead of being sent again.
33
32
  - Compacted outputs are stored as artifacts that can be reopened with `retrieve_tool_output`, including after resuming a saved session that contains the original tool execution record.
34
33
 
35
- When a tool output exceeds 12 KB, Kward compacts it before sending it to the model. The compactor preserves the first 40 and last 40 lines, keeps lines matching error, test, or search-result patterns with 2 lines of surrounding context, and replaces omitted sections with `[... omitted lines ...]` markers. Shell command output is section-aware: STDOUT and STDERR sections are compacted separately. Compacted outputs include a header with the original and compacted byte counts and the artifact ID for retrieval. Error outputs under 8 KB are left intact so failure details stay visible.
34
+ When output exceeds 12 KB, Kward keeps the most useful sections in context and stores the original output for later retrieval. The compacted result includes an artifact ID, so Kward can reopen an exact section without repeating the tool call. Error output under 8 KB stays intact so useful failure details are not lost.
36
35
 
37
- This lets the assistant reason from focused evidence while preserving access to original outputs when needed. For a fuller overview of Kward's context budgeting and token-saving work, see [Context budgeting](context-budgeting.md).
36
+ See [Context budgeting](context-budgeting.md) for the full compaction strategy, limits, and token-saving workflow.
38
37
 
39
38
  ## How tools are exposed
40
39
 
41
- `Kward::ToolRegistry` builds the available tool objects and the schemas advertised to the model. Some tools are always available in normal CLI/RPC sessions, while others depend on configuration or frontend capability:
40
+ `Kward::ToolRegistry` builds the available tool objects and the schemas advertised to the model. Kward instructs models to call only tools advertised for the current turn; a restricted RPC turn therefore receives schemas only for its selected set. Some tools are always available in normal CLI/RPC sessions, while others depend on configuration or frontend capability:
42
41
 
43
42
  - web tools can be hidden with web search configuration,
44
43
  - `read_skill` is advertised only when skills are available,
data/doc/api.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # API reference
2
2
 
3
- Kward's generated Ruby API documentation is mainly for contributors, plugin authors, tool authors, and people building RPC or editor integrations.
3
+ Kward's generated Ruby API documentation is for contributors, plugin authors, tool authors, and people building RPC or editor integrations.
4
4
 
5
- If you use Kward from the terminal, start with the [user guides](file.README.html#Documentation) instead. The API reference exposes many internal classes because it is generated from the source tree; not every documented class is a stable extension API.
5
+ If you use Kward from the terminal, start with the [user guides](file.README.html#Documentation). This reference also includes internal classes and methods that may change. Treat the behavior described in the guides, the Plugin DSL, and the methods in the [RPC protocol](rpc.md) as Kward's supported public interfaces.
6
6
 
7
7
  ## Start here
8
8
 
@@ -84,7 +84,7 @@ The generated comments focus on these supported extension boundaries rather than
84
84
 
85
85
  ## Public API expectations
86
86
 
87
- Kward is still evolving. The generated reference is useful for understanding the codebase, but it should not be read as a promise that every class, method, or constructor is public and stable.
87
+ The generated reference is useful for understanding the codebase, but it does not make every class, method, or constructor a supported public API.
88
88
 
89
89
  Prefer the documented guides for supported extension behavior. Use generated class and method pages when you need implementation detail, are contributing to Kward itself, or are coordinating a frontend integration with the current codebase.
90
90