kward 0.76.0 → 0.77.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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +8 -1
  3. data/CHANGELOG.md +36 -0
  4. data/Gemfile.lock +2 -2
  5. data/README.md +12 -4
  6. data/doc/agent-tools.md +0 -3
  7. data/doc/api.md +4 -0
  8. data/doc/composer.md +219 -0
  9. data/doc/configuration.md +75 -27
  10. data/doc/editor.md +18 -2
  11. data/doc/files.md +1 -1
  12. data/doc/getting-started.md +4 -0
  13. data/doc/git.md +2 -2
  14. data/doc/lifecycle-hooks.md +2 -14
  15. data/doc/pan.md +167 -0
  16. data/doc/rpc.md +0 -22
  17. data/doc/security.md +180 -0
  18. data/doc/usage.md +15 -32
  19. data/lib/kward/ansi.rb +2 -2
  20. data/lib/kward/cancellation.rb +2 -2
  21. data/lib/kward/cli/commands.rb +1 -3
  22. data/lib/kward/cli/interactive_turn.rb +0 -17
  23. data/lib/kward/cli/plugins.rb +2 -7
  24. data/lib/kward/cli/prompt_interface.rb +1 -0
  25. data/lib/kward/cli/runtime_helpers.rb +0 -38
  26. data/lib/kward/cli/sessions.rb +14 -5
  27. data/lib/kward/cli/settings.rb +22 -0
  28. data/lib/kward/cli/slash_commands.rb +1 -561
  29. data/lib/kward/cli/tabs.rb +14 -2
  30. data/lib/kward/cli.rb +1 -17
  31. data/lib/kward/compactor.rb +3 -3
  32. data/lib/kward/config_files.rb +18 -0
  33. data/lib/kward/ekwsh.rb +0 -4
  34. data/lib/kward/hooks/catalog.rb +0 -5
  35. data/lib/kward/image_attachments.rb +1 -1
  36. data/lib/kward/pan/index.html.erb +459 -64
  37. data/lib/kward/pan/kward_logo.png +0 -0
  38. data/lib/kward/pan/server.rb +248 -23
  39. data/lib/kward/plugin_registry.rb +18 -0
  40. data/lib/kward/prompt_interface/editor/auto_indent.rb +31 -23
  41. data/lib/kward/prompt_interface/editor/modes/vibe.rb +72 -3
  42. data/lib/kward/prompt_interface/layout.rb +0 -4
  43. data/lib/kward/prompt_interface/project_browser.rb +40 -1
  44. data/lib/kward/prompt_interface/runtime_state.rb +4 -0
  45. data/lib/kward/prompt_interface/selection_prompt.rb +0 -1
  46. data/lib/kward/prompt_interface/transcript_renderer.rb +0 -12
  47. data/lib/kward/prompt_interface.rb +18 -1
  48. data/lib/kward/prompts/commands.rb +1 -3
  49. data/lib/kward/prompts.rb +20 -0
  50. data/lib/kward/rpc/server.rb +13 -41
  51. data/lib/kward/rpc/session_manager.rb +75 -25
  52. data/lib/kward/rpc/tool_event_normalizer.rb +2 -0
  53. data/lib/kward/rpc/tool_metadata.rb +23 -0
  54. data/lib/kward/rpc/transcript_normalizer.rb +4 -0
  55. data/lib/kward/session_store.rb +55 -16
  56. data/lib/kward/skills/registry.rb +21 -1
  57. data/lib/kward/tools/base.rb +14 -0
  58. data/lib/kward/tools/registry.rb +11 -16
  59. data/lib/kward/tools/search/code.rb +1 -1
  60. data/lib/kward/tools/search/web.rb +1 -1
  61. data/lib/kward/tools/tool_call.rb +0 -4
  62. data/lib/kward/transcript_export.rb +1 -1
  63. data/lib/kward/version.rb +1 -1
  64. data/templates/default/kward_navigation.rb +5 -1
  65. data/templates/default/layout/html/layout.erb +0 -2
  66. metadata +5 -12
  67. data/lib/kward/workers/git_guard.rb +0 -93
  68. data/lib/kward/workers/job.rb +0 -99
  69. data/lib/kward/workers/live_view.rb +0 -49
  70. data/lib/kward/workers/manager.rb +0 -328
  71. data/lib/kward/workers/queue_runner.rb +0 -166
  72. data/lib/kward/workers/queue_store.rb +0 -112
  73. data/lib/kward/workers/store.rb +0 -72
  74. data/lib/kward/workers/tool_policy.rb +0 -23
  75. data/lib/kward/workers/worker.rb +0 -82
  76. data/lib/kward/workers/write_lock.rb +0 -38
  77. data/lib/kward/workers.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd9108129c3abd1aebeb3d1adb3e9011fbaf4e96c60a4f2ff55505497ff4fd0c
4
- data.tar.gz: 14177ca73389b1e2df9239706f20b879d22322ec89e72f31a81aa573915b0b91
3
+ metadata.gz: 9a18a2a0c800780596999ee897ed61afcef22c964012f2b2ed3f51a3a66239c5
4
+ data.tar.gz: 83badb23b87cae5e3198e00c65f0c53acbe2e0561f00164c4e5b40aacb3d10d4
5
5
  SHA512:
6
- metadata.gz: 787448090be2990a36e9d6d5c1911ce3bc5f6031f7c946a6d5d3edde3b78a43742227df6257d64c04e15def86a579e91366db602187200f1c08d241ae705d3b4
7
- data.tar.gz: 9a18e14824b3f38d2d1e030adf706629a4e797cd49a8aa1c23786fb53d174e4e81a3d1462c6e7a15de4efa1df517f0aaed7eba89fab1d94f162ba066fff59743
6
+ metadata.gz: 5c4bd15eb61a2b62b5165b46d393fa60608dc702b773cbb0596bdd64deed1799332f22a5b271c146142f8f1f2769111e3e0075db34626818a71c4e502a14b49d
7
+ data.tar.gz: 9953137b41415eff742904f3a4f4d63a610da01351000d5b08d4191ad180bfbdff5c001315513bbf4fabd1918843a6c214712f9af737c0025c5494e6c84494f8
@@ -13,6 +13,10 @@ permissions:
13
13
  jobs:
14
14
  test:
15
15
  runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby-version: ['3.2', 'ruby']
16
20
  steps:
17
21
  - name: Checkout
18
22
  uses: actions/checkout@v4
@@ -20,11 +24,14 @@ jobs:
20
24
  - name: Set up Ruby
21
25
  uses: ruby/setup-ruby@v1
22
26
  with:
23
- ruby-version: '3.3'
27
+ ruby-version: ${{ matrix.ruby-version }}
24
28
  bundler-cache: true
25
29
 
26
30
  - name: Check syntax
27
31
  run: find lib test -name '*.rb' -print0 | xargs -0 ruby -c
28
32
 
33
+ - name: Check runtime warnings
34
+ run: ruby -w -Ilib -e 'require "kward"'
35
+
29
36
  - name: Run tests
30
37
  run: bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -4,6 +4,42 @@ All notable changes to Kward will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.77.0] - 2026-07-11
8
+
9
+ ### Added
10
+
11
+ - Added `firstChangedLine` to successful RPC file-mutation results when Kward can derive it from the unified diff, allowing clients to navigate to the first changed line.
12
+ - Added an opt-in Nerd Font icon theme for the `/files` browser, configurable through Interface settings or `project_browser.icons`; text-only rows remain the default.
13
+ - Added Vim-style Vibe editor reindent commands: `==`, `={motion}` and text objects, plus visual `=`; reindentation uses the built-in language-aware auto-indent rules.
14
+ - Added a security and trust guide covering local permissions, external data flow, trusted extensions, stored data, and safe use with unfamiliar repositories.
15
+ - Added a dedicated Pan mode guide covering setup, browser and session workflows, prompt queueing, extensions, network security, and limitations.
16
+ - Added an interactive composer guide covering editing keys, command and file completion, history, reasoning and tab shortcuts, busy input, cancellation, images, and terminal compatibility.
17
+ - Added session browsing, creation, resume, rename, and deletion to Pan mode, with a responsive mobile-first interface using the documentation palette, Kward logo, and CLI-inspired startup screen.
18
+ - Added dependency-free Markdown rendering for Pan transcript entries, including fenced code blocks, lists, blockquotes, inline styles, and safe links.
19
+
20
+ ### Fixed
21
+
22
+ - Restored busy-tab `/tab` commands, including tab naming, switching, opening, and moving, without replacing the running tab's agent.
23
+ - Fixed `/reload` so newly loaded plugin slash commands appear in the interactive completion overlay.
24
+ - Pan mode now uses the active persona label for assistant messages and interface copy instead of a fixed Kward label.
25
+ - Pan mode now prints the routed LAN address in its startup URL when available.
26
+ - Fixed RPC session close, delete, and shutdown operations to cancel active turns before releasing session state, with a bounded fallback for uncooperative workers.
27
+ - Fixed concurrent RPC turn event recording so replay sequence numbers remain unique and ordered.
28
+ - Kept intentional empty-session garbage collection from deleting live CLI or RPC session files.
29
+ - Removed scheduler timing from the throttled CLI streaming test and restored Ruby 4 image-attachment compatibility.
30
+
31
+ ### Removed
32
+
33
+ - Removed the experimental worker pipeline, tab-backed worker queue, related CLI flag and commands, RPC capability, lifecycle hooks, and stored-runtime integration. Existing session files, worker metadata, and Git stashes are left untouched.
34
+
35
+ ### Changed
36
+
37
+ - Improved documentation navigation, command and settings coverage, editor and diff-view workflows, configuration task guidance, and generated API comments for supported extension surfaces.
38
+ - CI now tests the minimum supported Ruby and the current stable Ruby.
39
+ - Removed unused private CLI, transcript-rendering, layout, and shell helpers, and clarified compaction guard naming.
40
+ - Removed production Ruby warnings and added a warning-free runtime require check to CI.
41
+ - Limited session listings now fully reconstruct only the requested newest sessions while still garbage-collecting abandoned empty files.
42
+
7
43
  ## [0.76.0] - 2026-07-10
8
44
 
9
45
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kward (0.76.0)
4
+ kward (0.77.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.76.0)
149
+ kward (0.77.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
@@ -41,18 +41,19 @@ kward init
41
41
 
42
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.
43
43
 
44
- Then start Kward and sign in when needed:
44
+ Then sign in and start Kward:
45
45
 
46
46
  ```bash
47
+ kward login # sign in or save provider credentials
47
48
  kward # start an interactive chat
48
49
  kward help # show available commands and examples
49
- /login # from inside Kward: sign in or save provider credentials
50
- kward login # from your shell: sign in or save provider credentials
51
50
  kward hooks doctor # inspect lifecycle hook setup
52
51
  kward "Explain this project" # run one prompt and exit
53
52
  kward --working-directory ~/code/project "Explain this project"
54
53
  ```
55
54
 
55
+ From inside Kward, `/login` opens the same provider picker.
56
+
56
57
  See [Authentication](doc/authentication.md) for more details about sign-in options and provider credentials.
57
58
 
58
59
  ## What Kward can do
@@ -74,16 +75,23 @@ Start here:
74
75
  - [Usage](doc/usage.md): interactive chat, slash commands, sessions, tools, images, and Pan mode.
75
76
  - [Configuration](doc/configuration.md): config files, providers, models, web search, logging, and color output.
76
77
  - [Authentication](doc/authentication.md): OpenAI OAuth, Anthropic OAuth, OpenRouter API keys, and Copilot/GitHub setup.
78
+ - [Security and trust](doc/security.md): local permissions, external data flow, trusted extensions, and safe work in unfamiliar repositories.
77
79
  - [Troubleshooting](doc/troubleshooting.md): environment-specific install and runtime issues.
78
80
 
79
81
  Feature guides:
80
82
 
81
83
  - [Sessions](doc/session-management.md): resume, clone, fork, rewind, compact, and navigate saved work.
82
- - [Integrated Editor](doc/editor.md): open files from the composer, edit in-place, and choose editor keybindings.
84
+ - [Interactive composer](doc/composer.md): use multiline input, completion, history, files, reasoning shortcuts, busy input, and images.
85
+ - [Tabs](doc/tabs.md): keep several conversations open and run work in another tab.
86
+ - [Project files](doc/files.md): browse, search, mention, open, and edit workspace files.
87
+ - [Integrated Editor](doc/editor.md): open files from the shell or composer, edit in-place, and choose editor keybindings.
83
88
  - [Git](doc/git.md): review changes, use the diff viewer, stage files, and commit from the interactive TUI.
84
89
  - [Shell](doc/shell.md): use `/shell`, the embedded Kward shell with aliases, completion, and per-tab state.
85
90
  - [Memory](doc/memory.md): opt-in core, soft, and session memory.
86
91
  - [Personas](doc/personas.md): configure Kward's tone and role by default, workspace, model, reasoning effort, time, and weekday.
92
+ - [Skills](doc/skills.md): add reusable instructions that load only for matching tasks.
93
+ - [MCP servers](doc/mcp.md): connect trusted local Model Context Protocol tool servers.
94
+ - [Pan mode](doc/pan.md): use the mobile-friendly browser interface on a trusted local network.
87
95
 
88
96
  Advanced:
89
97
 
data/doc/agent-tools.md CHANGED
@@ -8,7 +8,6 @@ Tools are part of Kward's safety and context-management boundary:
8
8
  - Ruby tool objects validate and execute those calls,
9
9
  - workspace tools stay inside the active workspace by default (see [Configuration](configuration.md) for the guardrail setting),
10
10
  - file-changing tools require the file to be read first,
11
- - mutation tools (`edit_file`, `write_file`, `run_shell_command`) are gated by a write lock when agent workers are active, so only one worker can change the workspace at a time,
12
11
  - large outputs are bounded or compacted before they enter model context,
13
12
  - full tool outputs are kept in the session record for later inspection.
14
13
 
@@ -45,8 +44,6 @@ This lets the assistant reason from focused evidence while preserving access to
45
44
  - `read_skill` is advertised only when skills are available,
46
45
  - `ask_user_question` is advertised only when the frontend can display structured questions.
47
46
 
48
- When agent workers are active, the registry can scope each worker to a subset of tools via an allowed-tool-names filter, so workers only see the tools they need.
49
-
50
47
  When `write_file` or `edit_file` changes an `AGENTS.md` file in the workspace root, Kward automatically rebuilds the system message so the model picks up the new instructions without a restart.
51
48
 
52
49
  Unknown tool calls are recorded as tool results instead of crashing the session, so the model can recover and choose an advertised tool on the next turn.
data/doc/api.md CHANGED
@@ -45,6 +45,8 @@ Generated entry points:
45
45
  - [`Kward::Tools::Base`](Kward/Tools/Base.html)
46
46
  - [`Kward::ToolRegistry`](Kward/ToolRegistry.html)
47
47
 
48
+ These pages document the schema and dispatch contract used by built-in tools. Kward does not yet provide a plugin DSL for registering arbitrary model-callable tools; contributors add them through the built-in registry and keep schemas, validation, docs, and tests aligned.
49
+
48
50
  ### RPC and frontend authors
49
51
 
50
52
  The RPC protocol is the supported integration surface for UI clients. Prefer the protocol guide before reading implementation classes.
@@ -78,6 +80,8 @@ Generated entry points:
78
80
  - [`Kward::Skills::Registry`](Kward/Skills/Registry.html)
79
81
  - [`Kward::ConfigFiles`](Kward/ConfigFiles.html)
80
82
 
83
+ The generated comments focus on these supported extension boundaries rather than trying to make every internal orchestration helper public. When a generated method lacks guide coverage, treat it as internal unless the page explicitly marks it as a public API.
84
+
81
85
  ## Public API expectations
82
86
 
83
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.
data/doc/composer.md ADDED
@@ -0,0 +1,219 @@
1
+ # Interactive composer
2
+
3
+ The composer is the input area at the bottom of Kward's interactive terminal UI. It is more than a single-line prompt: it supports multiline editing, command and file completion, persistent history, image attachments, reasoning selection, background tabs, queued follow-ups, and in-flight steering.
4
+
5
+ This guide is a practical keyboard reference for working quickly without leaving the conversation.
6
+
7
+ ## Write and submit a prompt
8
+
9
+ Type a prompt and press Return to submit it:
10
+
11
+ ```text
12
+ Find where authentication errors are handled and explain the flow.
13
+ ```
14
+
15
+ Use Shift+Return to insert a newline without submitting:
16
+
17
+ ```text
18
+ Review the current diff.
19
+ Focus on:
20
+ - correctness
21
+ - missing tests
22
+ - confusing naming
23
+ ```
24
+
25
+ Modified Enter support depends on what your terminal sends. If Shift+Return is swallowed or arrives as an ordinary Return, paste multiline text with bracketed paste, or compose it in another editor before pasting.
26
+
27
+ The composer supports familiar line-editing keys:
28
+
29
+ | Key | Action |
30
+ | --- | --- |
31
+ | `Left` / `Right` | Move by character |
32
+ | `Home` / `Ctrl+A` | Move to the start of the current line |
33
+ | `End` / `Ctrl+E` | Move to the end of the current line |
34
+ | `Ctrl+B` / `Ctrl+F` | Move left or right |
35
+ | `Alt+B` / `Alt+F` | Move by word |
36
+ | `Backspace` / `Delete` | Delete before or at the cursor |
37
+ | `Ctrl+W` | Delete the word before the cursor |
38
+ | `Alt+D` | Delete the word after the cursor |
39
+ | `Ctrl+U` / `Ctrl+K` | Kill from the cursor to the start or end of the line |
40
+ | `Ctrl+Y` | Yank the most recently killed composer text |
41
+ | `Ctrl+L` | Redraw the terminal UI |
42
+ | `Ctrl+D` | Delete at the cursor, or exit when the composer is empty |
43
+
44
+ These are composer bindings. The integrated editor, shell, Git view, file browser, and plugin interfaces have their own keymaps.
45
+
46
+ ## Find slash commands
47
+
48
+ Type `/` at the beginning of the composer to open the slash-command picker:
49
+
50
+ ```text
51
+ /ses
52
+ ```
53
+
54
+ Use Up/Down to select a match. Press Tab to complete it, then add arguments if needed:
55
+
56
+ ```text
57
+ /session name OAuth cleanup
58
+ ```
59
+
60
+ Press Esc to dismiss the picker without deleting your draft. Return submits the command.
61
+
62
+ The picker includes:
63
+
64
+ - Kward's built-in commands,
65
+ - configured prompt templates,
66
+ - configured skills as `/skill:<name>`,
67
+ - plugin slash commands,
68
+ - plugin interactive commands.
69
+
70
+ See [Usage](usage.md#Interactive_slash_commands) for the built-in command reference and [Extensibility](extensibility.md) for adding commands.
71
+
72
+ ## Mention a file with `@`
73
+
74
+ Type `@` followed by part of a workspace path anywhere in a prompt:
75
+
76
+ ```text
77
+ @agent
78
+ ```
79
+
80
+ Kward shows fuzzy project-file matches. Use Up/Down to select one and Tab to insert the path:
81
+
82
+ ```text
83
+ @lib/kward/agent.rb Explain how tool execution works here.
84
+ ```
85
+
86
+ An `@path` is a textual pointer for the agent. It does not automatically place the whole file into model context; Kward can inspect the file with its tools when the task requires it. This keeps large files from being attached blindly.
87
+
88
+ Press Esc to dismiss file completion. You can also insert a mention from the `/files` browser with `@`. See [Project files](files.md).
89
+
90
+ ## Open a file with `$`
91
+
92
+ Start the composer with `$` to open a workspace file in the integrated editor:
93
+
94
+ ```text
95
+ $lib/kward/agent.rb
96
+ ```
97
+
98
+ The `$` token must begin at the first character of the composer. Use Up/Down to choose a match, then press Return or Tab to open it. If you type a path that does not exist and press Return, Kward can ask whether to create it.
99
+
100
+ A successful `$path` open is saved in prompt history using the resolved workspace-relative path. It opens the editor instead of sending a model prompt.
101
+
102
+ See [Integrated Editor](editor.md) for editing modes, save and quit keys, scratchpads, and conflict handling.
103
+
104
+ ## Reuse prompt history
105
+
106
+ Kward stores prompt history per workspace under `~/.kward/history/`.
107
+
108
+ - Press Up/Down when no completion picker is visible to move through earlier prompts.
109
+ - Press `Ctrl+R` to start fuzzy history search.
110
+ - Type a query, then use Up/Down to choose a match.
111
+ - Press Return to place the selected result back into the composer for editing or submission.
112
+ - Press Esc or `Ctrl+C` to cancel search and restore the draft you had before searching.
113
+
114
+ History survives restarts. It contains submitted prompt text and successful `$path` editor-open commands, so protect it like other local Kward data. See [Security and trust](security.md#Local_data_and_permissions).
115
+
116
+ ## Change reasoning effort
117
+
118
+ When no slash or file picker is open, Tab cycles forward through reasoning efforts supported by the current model. Shift+Tab cycles backward. The selection wraps and is persisted for later turns.
119
+
120
+ The composer status line shows the current provider, model, and reasoning effort. Use `/reasoning` or `/model` when you prefer the explicit picker.
121
+
122
+ Tab is context-sensitive:
123
+
124
+ - in slash or `@path` completion, it accepts the selected match,
125
+ - in `$path` completion, it opens the selected file,
126
+ - otherwise, it changes reasoning effort,
127
+ - in other modal interfaces, it follows that interface's own controls.
128
+
129
+ ## Work with tabs
130
+
131
+ `Ctrl+Tab` and `Ctrl+Shift+Tab` switch conversations when your terminal reports those keys. Additional shortcuts depend on `composer.tab_keybindings`:
132
+
133
+ - `ctrl`: `Ctrl+T` creates a tab, `Ctrl+W` closes one, and reported `Ctrl+1` through `Ctrl+9` select numbered tabs.
134
+ - `alt`: `Alt+T` creates a tab, `Alt+Left`/`Alt+Right` move between tabs, and `Alt+1` through `Alt+9` select numbered tabs.
135
+ - `auto`: prefers the Ctrl family on macOS and the Alt family elsewhere.
136
+
137
+ Use `/settings` → Interface → Tab keybindings to change the family. If your terminal intercepts a shortcut, `/tab` commands always provide the same operations.
138
+
139
+ See [Tabs](tabs.md) for background work, status colors, persistence, naming, and moving tabs.
140
+
141
+ ## Type while Kward is busy
142
+
143
+ The composer stays available during a model turn or many long local actions.
144
+
145
+ For a normal model turn:
146
+
147
+ - If the current provider supports native in-flight steering, a non-empty prompt is sent as guidance to the running turn. Kward marks it as steered until the model applies it.
148
+ - If steering is unavailable or fails, the prompt is queued and starts after the active turn.
149
+ - Kward displays queued and steered counts in the busy composer.
150
+
151
+ Use steering for short corrections that should affect work already in progress:
152
+
153
+ ```text
154
+ Do not change the public API. Keep the fix internal.
155
+ ```
156
+
157
+ Use a separate tab when you want an independent task rather than a correction to the current one.
158
+
159
+ Most slash commands typed into a busy composer are intentionally ignored because delayed local state changes would be surprising. `/exit`, `/quit`, and `/new` are queued as control actions. `/tab` commands run immediately while work runs, so you can name, switch, open, or move tabs; closing the running tab remains unavailable.
160
+
161
+ During local operations that do not support steering, submitted text is queued for later processing.
162
+
163
+ ## Cancel running work
164
+
165
+ Press `Ctrl+C` while the busy composer is active to request cancellation of the current operation. Kward stops rendering further work and cooperatively cancels model and tool activity where possible.
166
+
167
+ Cancellation is best effort. A network request, shell command, or side effect already in progress may finish before the underlying API can stop. Always inspect the workspace after cancelling a mutating task.
168
+
169
+ When Kward is idle, `Ctrl+C` does not exit the interactive session. Use `/exit`, `/quit`, or `Ctrl+D` on an empty composer.
170
+
171
+ The busy composer shows a cancellation hint by default. Hide only the hint—not cancellation itself—with `composer.busy_help: false` or the Interface settings menu.
172
+
173
+ ## Attach images
174
+
175
+ Paste supported image references into the composer. Kward recognizes:
176
+
177
+ - image paths,
178
+ - Markdown image links,
179
+ - `file://` URLs,
180
+ - base64 image data URLs.
181
+
182
+ Supported formats are GIF, JPEG, PNG, and WebP, up to 20 MB per image. Pasted references become badges above the draft, and their source text is removed from the visible prompt. Duplicate pasted references are ignored. References typed normally are resolved when the prompt is submitted.
183
+
184
+ Example:
185
+
186
+ ```text
187
+ ./tmp/broken-layout.png Find the likely CSS problem shown in this screenshot.
188
+ ```
189
+
190
+ If the cursor is at the start of an otherwise empty draft, Backspace removes the most recently added pending attachment. Submitting the draft clears its pending attachments.
191
+
192
+ The active model must support image input. iTerm2 and Kitty-compatible terminals can render submitted images inline; other terminals still show attachment badges and send the image to the model without an inline preview.
193
+
194
+ ## Understand composer status
195
+
196
+ The composer area can include:
197
+
198
+ - the current Git branch or short commit, colored yellow when dirty,
199
+ - additions and deletions recorded in the current session,
200
+ - approximate context-window usage,
201
+ - provider, model, and reasoning effort,
202
+ - a tab bar plus queued or steered input counts,
203
+ - an optional plugin footer.
204
+
205
+ Context usage is an estimate, not provider billing. Use `/status` for more session and compaction detail.
206
+
207
+ ## Recover from terminal issues
208
+
209
+ Terminal support for Shift+Return, Ctrl+Tab, modified number keys, OSC clipboard access, and inline images varies.
210
+
211
+ If rendering becomes corrupted after resize or after an external program writes terminal controls:
212
+
213
+ ```text
214
+ /redraw
215
+ ```
216
+
217
+ You can also press `Ctrl+L`. If a shortcut never reaches Kward, prefer its slash-command equivalent or change `composer.tab_keybindings` in `/settings`.
218
+
219
+ For full-screen interactive programs such as Vim or `less`, use `/pty <command>` or `pty <command>` inside `/shell` so the program temporarily owns the terminal instead of fighting the composer.
data/doc/configuration.md CHANGED
@@ -1,10 +1,25 @@
1
1
  # Configuration
2
2
 
3
- Kward reads user configuration from `~/.kward/config.json` by default. Most users do not need to edit this file by hand at first: use `/login`, `/model`, `/reasoning`, and `/settings` from inside Kward when possible.
3
+ Kward reads user configuration from `~/.kward/config.json` by default. Most users should start with `/settings`, `/login`, `/model`, or `/reasoning` inside Kward. Edit JSON directly when you need an advanced setting, an integration, or a reproducible configuration.
4
4
 
5
- On first start, if the file does not exist, Kward creates a starter config with an active Kward persona, explicit disabled memory settings, and the default composer busy-help setting so you can inspect and edit them. Provider-specific model defaults are added only when you choose a provider/model. See [Personas](personas.md) for configuring persona selection by workspace, model, or reasoning effort. If `KWARD_CONFIG_PATH` is set, Kward uses that file instead and treats that file's directory as the config directory for prompts, skills, memory, logs, and caches.
5
+ On first start, Kward creates the file when it does not exist. The starter config records defaults for personas, memory, the composer, editor, overlays, web search, update checks, sessions, skills, MCP, and workspace guardrails. Provider-specific model defaults are added only when you choose a provider or model.
6
6
 
7
- Small examples:
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
+
9
+ ## Common changes
10
+
11
+ | Goal | Recommended path |
12
+ | --- | --- |
13
+ | Sign in or change accounts | `/settings` → Accounts, or `/login` |
14
+ | Choose a provider, model, or reasoning effort | `/settings` → Model & Reasoning, `/model`, or `/reasoning` |
15
+ | Change editor, diff, overlay, or session UI behavior | `/settings` → Interface |
16
+ | Enable memory | `/settings` → Memory |
17
+ | Configure web search or trust project skills | `/settings` → Tools & Search |
18
+ | Tune compaction | `/settings` → Context & Compaction |
19
+ | Configure personas | `/settings` → Personalization; see [Personas](personas.md) |
20
+ | Add MCP servers, lifecycle hooks, or environment-specific paths | Edit `config.json` directly |
21
+
22
+ Here is a minimal direct provider configuration:
8
23
 
9
24
  ```json
10
25
  {
@@ -13,6 +28,10 @@ Small examples:
13
28
  }
14
29
  ```
15
30
 
31
+ ### MCP servers
32
+
33
+ Add trusted local Model Context Protocol servers under `mcpServers`:
34
+
16
35
  ```json
17
36
  {
18
37
  "mcpServers": {
@@ -24,7 +43,11 @@ Small examples:
24
43
  }
25
44
  ```
26
45
 
27
- See [MCP servers](mcp.md) for connecting local Model Context Protocol servers such as Safari's browser automation server.
46
+ See [MCP servers](mcp.md) for setup, supported fields, and security notes.
47
+
48
+ ### Project skills
49
+
50
+ 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:
28
51
 
29
52
  ```json
30
53
  {
@@ -34,40 +57,42 @@ See [MCP servers](mcp.md) for connecting local Model Context Protocol servers su
34
57
  }
35
58
  ```
36
59
 
37
- By default, Kward loads user-level skills but skips project-level skills from the workspace. Set `skills.trust_project` to `true`, or use `/settings` → `Tools & Search` → `Trust project skills`, when you trust the repository's `.kward/skills` or `.agents/skills` directories. See [Skills](skills.md) for skill locations and examples.
60
+ See [Skills](skills.md) for skill locations, precedence, examples, and trust behavior.
38
61
 
39
- ```json
40
- {
41
- "updates": {
42
- "check": true
43
- }
44
- }
45
- ```
62
+ ### Update checks
46
63
 
47
- Kward checks RubyGems for newer `kward` versions on the interactive startup screen. Results are cached under `~/.kward/cache/update_check.json` so startup does not hit RubyGems every time. Set `updates.check` to `false`, or set `KWARD_DISABLE_UPDATE_CHECK=1`, to disable the check.
64
+ Kward checks RubyGems for newer versions on the interactive startup screen. Results are cached so startup does not contact RubyGems every time. Disable this automatic network request with:
48
65
 
49
66
  ```json
50
67
  {
51
- "memory": {
52
- "enabled": true
68
+ "updates": {
69
+ "check": false
53
70
  }
54
71
  }
55
72
  ```
56
73
 
74
+ You can also set `KWARD_DISABLE_UPDATE_CHECK=1` for one run. The cache lives at `<config-dir>/cache/update_check.json`.
75
+
57
76
  ## Config directory
58
77
 
59
- By default, Kward stores user data under `~/.kward`:
78
+ By default, Kward stores user data under `~/.kward`. Common files and directories include:
60
79
 
61
80
  ```text
62
81
  ~/.kward/config.json
63
82
  ~/.kward/auth.json
64
83
  ~/.kward/anthropic_auth.json
65
84
  ~/.kward/github_auth.json
85
+ ~/.kward/PRINCIPLES.md
86
+ ~/.kward/ekwsh.yml
87
+ ~/.kward/prompts/
88
+ ~/.kward/skills/
89
+ ~/.kward/plugins/
66
90
  ~/.kward/sessions/
91
+ ~/.kward/history/
67
92
  ~/.kward/memory/
68
93
  ~/.kward/logs/
69
94
  ~/.kward/cache/
70
- ~/.kward/plugins/
95
+ ~/.kward/trusted_workspace_hooks.json
71
96
  ```
72
97
 
73
98
  When `KWARD_CONFIG_PATH=/path/to/config.json` is set, most config-related files live beside that file instead. User plugins are the exception: they are loaded only from `~/.kward/plugins`. See [Plugins](plugins.md) for writing and loading user plugins.
@@ -234,21 +259,20 @@ Overlay settings control terminal picker/card layout. New default configs includ
234
259
 
235
260
  You can change these interactively with `/settings`.
236
261
 
237
- ## Web search settings
262
+ <a id="project-browser-icons"></a>
263
+ ## Project browser icons
238
264
 
239
- New default configs enable web search with the automatic provider order:
265
+ `/files` uses text-only rows by default so it remains legible in terminals without a patched icon font. To enable Nerd Font icons explicitly:
240
266
 
241
267
  ```json
242
268
  {
243
- "web_search": {
244
- "enabled": true,
245
- "provider": "auto",
246
- "allow_model_providers": false
269
+ "project_browser": {
270
+ "icons": "nerd-font"
247
271
  }
248
272
  }
249
273
  ```
250
274
 
251
- Existing configs without `web_search` keep the same behavior: web search is enabled, the provider is `auto`, and model-provider fallbacks are disabled unless explicitly enabled.
275
+ `icons` defaults to `off`; the supported values are `off` and `nerd-font`. Kward does not detect terminal fonts. Enable `nerd-font` only after configuring a compatible Nerd Font, such as Hack Nerd Font, in your terminal. You can also select **File icons** under the Interface section of `/settings`.
252
276
 
253
277
  ## Composer settings
254
278
 
@@ -290,7 +314,19 @@ The built-in TUI file editor supports three keybinding modes. Modern is the defa
290
314
  }
291
315
  ```
292
316
 
293
- `mode` can be `modern`, `emacs`, or `vibe`. The old `default` value is still accepted as an alias for `modern`. You can change this from `/settings` > Interface > Editor mode; newly opened editor buffers pick up the setting immediately.
317
+ `mode` can be `modern`, `emacs`, or `vibe`. The old `default` value is still accepted as an alias for `modern`. You can change this from `/settings` Interface Editor mode; newly opened editor buffers pick up the setting immediately.
318
+
319
+ The integrated Git and session diff viewers support unified and side-by-side layouts:
320
+
321
+ ```json
322
+ {
323
+ "editor": {
324
+ "diff_view": "auto"
325
+ }
326
+ }
327
+ ```
328
+
329
+ `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.
294
330
 
295
331
  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.
296
332
 
@@ -415,11 +451,23 @@ Manual `/compact [instructions]` works even when auto-compaction is disabled.
415
451
 
416
452
  `host` defaults to `0.0.0.0` and `port` defaults to `8765`. Kward fails to start pan mode unless `username` and `password` are configured.
417
453
 
418
- These credentials are stored in plaintext config. Use a private, user-specific password and do not share the config file. Pan mode exposes the agent's file, shell, and web tools to anyone on the LAN who has the credentials, so use it only on trusted networks.
454
+ These credentials are stored in plaintext config. Use a private, user-specific password and do not share the config file. Pan mode exposes the agent's file, shell, web, and configured extension tools to anyone on the LAN who has the credentials, so use it only on trusted networks. See [Pan mode](pan.md) for the full browser workflow, session behavior, security guidance, and limitations.
419
455
 
420
456
  ## Web search
421
457
 
422
- Web search works without an API key through Exa's public MCP endpoint and is advertised to the model by default. To hide the tool:
458
+ Web search is enabled by default with automatic provider selection. Model-backed fallback providers remain disabled unless you explicitly allow them:
459
+
460
+ ```json
461
+ {
462
+ "web_search": {
463
+ "enabled": true,
464
+ "provider": "auto",
465
+ "allow_model_providers": false
466
+ }
467
+ }
468
+ ```
469
+
470
+ Existing configs without a `web_search` object use those same defaults. Web search works without an API key through Exa's public MCP endpoint and is advertised to the model by default. To hide the tool:
423
471
 
424
472
  ```json
425
473
  {
data/doc/editor.md CHANGED
@@ -16,7 +16,20 @@ The editor is scoped to the current workspace. It only opens files inside that d
16
16
 
17
17
  ## Quick start
18
18
 
19
- Open the file picker by typing `$` as the first character in the composer:
19
+ Open a file directly from your shell:
20
+
21
+ ```bash
22
+ cd ~/code/my-project
23
+ kward edit lib/kward/agent.rb
24
+ ```
25
+
26
+ Kward uses the current directory as the workspace, opens the file in the integrated editor, and exits when you close the editor. Use `--working-directory` when the file belongs to another workspace:
27
+
28
+ ```bash
29
+ kward --working-directory ~/code/my-project edit lib/kward/agent.rb
30
+ ```
31
+
32
+ From an interactive Kward session, open the file picker by typing `$` as the first character in the composer:
20
33
 
21
34
  ```text
22
35
  $lib/kward/agent.rb
@@ -297,6 +310,8 @@ Use normal mode for movement, operators, marks, registers, macros, search, and c
297
310
  | `dir` / `cir` / `yir` | Delete / change / yank inside a Ruby block |
298
311
  | `dar` / `car` / `yar` | Delete / change / yank around a Ruby block |
299
312
  | `yy` | Yank line |
313
+ | `==` | Reindent current line |
314
+ | `={motion}` | Reindent lines covered by a motion or text object |
300
315
  | `"ayy` / `"ap` | Yank / paste with named registers |
301
316
  | `p` | Paste after cursor |
302
317
  | `P` | Paste before cursor |
@@ -338,6 +353,7 @@ Visual mode uses the same motion language as normal mode where practical. Start
338
353
  | `%`, `f`/`F`/`t`/`T` | Extend visual selection with advanced motions |
339
354
  | `iw` / `a(` / `ip` | Select visual text objects |
340
355
  | `>` / `<` | Indent / outdent selected lines |
356
+ | `=` | Reindent selected lines |
341
357
  | `I` / `A` | Insert / append text across visual block lines |
342
358
  | `J` | Join selected lines |
343
359
  | `~` / `u` / `U` | Swapcase / lowercase / uppercase selection |
@@ -408,7 +424,7 @@ Vibe mode is not trying to be Vim. It is a focused subset designed for quick edi
408
424
  - **Counts work with commands and motions**: `3dd` deletes three lines, `2w` moves two words, `5x` deletes five characters.
409
425
  - **`.` repeats the last change**: after `cw word Esc`, pressing `.` changes the next word the same way. Insert-mode keystrokes are recorded as part of the change.
410
426
  - **`/` and `?` search forward and backward**: `n` and `N` repeat the last search. `*` and `#` search for the word under the cursor.
411
- - **Operators with motions**: `d`, `y`, and `c` work with `w` (word), `e` (end of word), `b` (back word), `$` (end of line), `0` (start of line), and `^` (first non-blank).
427
+ - **Operators with motions**: `d`, `y`, `c`, and `=` work with `w` (word), `e` (end of word), `b` (back word), `$` (end of line), `0` (start of line), and `^` (first non-blank). `=` uses Kward's built-in language-aware auto-indent rules.
412
428
  - **Yanks copy to the terminal clipboard**: when OSC 52 is supported, yanked text is also sent to the system clipboard, so you can paste into other applications.
413
429
  - **Registers and macros are supported**: named registers work with yank/delete/paste flows, and `q`/`@` record and replay simple macros for repeated edits.
414
430
  - **Viewport commands**: `zz`, `zt`, and `zb` reposition the cursor line to the center, top, or bottom of the viewport without moving the cursor itself — the same as Vim.
data/doc/files.md CHANGED
@@ -42,7 +42,7 @@ Outside Git, Kward scans the workspace directory and skips common noisy director
42
42
  | `Esc` | Leave search; press again to close the browser |
43
43
  | `@` | Insert the selected file as an `@path` mention |
44
44
 
45
- Directories use `▸` and `▾` markers to show collapsed and expanded state. Files are shown under their containing directory with indentation.
45
+ Directories use `▸` and `▾` markers to show collapsed and expanded state. Files are shown under their containing directory with indentation. File-type icons are off by default; users with a compatible Nerd Font can enable them under Interface in `/settings`. See [Configuration](configuration.md#project-browser-icons).
46
46
 
47
47
  ## Search files
48
48