kward 0.74.0 → 0.75.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 (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/Gemfile.lock +2 -2
  4. data/README.md +4 -2
  5. data/Rakefile +18 -0
  6. data/doc/configuration.md +56 -3
  7. data/doc/extensibility.md +6 -19
  8. data/doc/getting-started.md +1 -1
  9. data/doc/lifecycle-hooks.md +424 -0
  10. data/doc/memory.md +1 -1
  11. data/doc/personas.md +2 -2
  12. data/doc/plugins.md +1 -1
  13. data/doc/releasing.md +7 -15
  14. data/doc/rpc.md +108 -16
  15. data/doc/session-management.md +9 -9
  16. data/doc/skills.md +199 -0
  17. data/doc/usage.md +7 -7
  18. data/lib/kward/agent.rb +72 -22
  19. data/lib/kward/auth/anthropic_oauth.rb +5 -87
  20. data/lib/kward/auth/oauth_helpers.rb +105 -0
  21. data/lib/kward/auth/openai_oauth.rb +4 -86
  22. data/lib/kward/cli/commands.rb +9 -2
  23. data/lib/kward/cli/compaction.rb +7 -0
  24. data/lib/kward/cli/git.rb +30 -3
  25. data/lib/kward/cli/hook_commands.rb +258 -0
  26. data/lib/kward/cli/memory_commands.rb +1 -5
  27. data/lib/kward/cli/plugins.rb +41 -1
  28. data/lib/kward/cli/prompt_interface.rb +32 -3
  29. data/lib/kward/cli/rendering.rb +1 -1
  30. data/lib/kward/cli/runtime_helpers.rb +44 -5
  31. data/lib/kward/cli/sessions.rb +13 -0
  32. data/lib/kward/cli/settings.rb +226 -152
  33. data/lib/kward/cli/slash_commands.rb +81 -42
  34. data/lib/kward/cli/tabs.rb +26 -6
  35. data/lib/kward/cli.rb +26 -3
  36. data/lib/kward/cli_transcript_formatter.rb +0 -7
  37. data/lib/kward/compaction/token_estimator.rb +112 -0
  38. data/lib/kward/compactor.rb +42 -116
  39. data/lib/kward/config_files.rb +117 -25
  40. data/lib/kward/deep_copy.rb +42 -0
  41. data/lib/kward/diff_view_mode.rb +36 -0
  42. data/lib/kward/events.rb +1 -0
  43. data/lib/kward/export_path.rb +2 -6
  44. data/lib/kward/frontmatter.rb +43 -0
  45. data/lib/kward/hooks/audit_log.rb +121 -0
  46. data/lib/kward/hooks/catalog.rb +110 -0
  47. data/lib/kward/hooks/command_handler.rb +66 -0
  48. data/lib/kward/hooks/config_loader.rb +104 -0
  49. data/lib/kward/hooks/decision.rb +102 -0
  50. data/lib/kward/hooks/event.rb +60 -0
  51. data/lib/kward/hooks/http_handler.rb +72 -0
  52. data/lib/kward/hooks/manager.rb +158 -0
  53. data/lib/kward/hooks/matcher.rb +75 -0
  54. data/lib/kward/hooks.rb +16 -0
  55. data/lib/kward/markdown_transcript.rb +4 -3
  56. data/lib/kward/mcp/client.rb +1 -1
  57. data/lib/kward/mcp/server_config.rb +7 -3
  58. data/lib/kward/mcp/stdio_transport.rb +7 -1
  59. data/lib/kward/memory/turn_context.rb +19 -0
  60. data/lib/kward/message_access.rb +2 -2
  61. data/lib/kward/message_text.rb +19 -0
  62. data/lib/kward/model/client.rb +13 -45
  63. data/lib/kward/model/context_usage.rb +10 -4
  64. data/lib/kward/model/copilot_models.rb +44 -0
  65. data/lib/kward/model/model_info.rb +24 -0
  66. data/lib/kward/model/payloads.rb +15 -17
  67. data/lib/kward/model/stream_parser.rb +178 -13
  68. data/lib/kward/pan/server.rb +51 -2
  69. data/lib/kward/path_guard.rb +13 -0
  70. data/lib/kward/plugin_registry.rb +86 -25
  71. data/lib/kward/prompt_interface/editor/controller.rb +60 -1
  72. data/lib/kward/prompt_interface/editor/renderer.rb +11 -0
  73. data/lib/kward/prompt_interface/editor/state.rb +5 -1
  74. data/lib/kward/prompt_interface/selection_prompt.rb +26 -6
  75. data/lib/kward/prompt_interface.rb +4 -1
  76. data/lib/kward/prompts/commands.rb +3 -3
  77. data/lib/kward/prompts.rb +7 -7
  78. data/lib/kward/rpc/mcp_status.rb +50 -0
  79. data/lib/kward/rpc/prompt_bridge.rb +38 -4
  80. data/lib/kward/rpc/runtime_payloads.rb +1 -1
  81. data/lib/kward/rpc/server.rb +94 -14
  82. data/lib/kward/rpc/session_manager.rb +258 -33
  83. data/lib/kward/rpc/session_metrics.rb +1 -1
  84. data/lib/kward/rpc/session_tree_rows.rb +13 -64
  85. data/lib/kward/rpc/tool_event_normalizer.rb +16 -2
  86. data/lib/kward/rpc/transcript_normalizer.rb +9 -10
  87. data/lib/kward/rpc/turn_context.rb +109 -0
  88. data/lib/kward/session_store.rb +6 -20
  89. data/lib/kward/session_tree_nodes.rb +98 -18
  90. data/lib/kward/session_tree_renderer.rb +6 -61
  91. data/lib/kward/skills/registry.rb +109 -17
  92. data/lib/kward/tools/mcp_tool.rb +4 -0
  93. data/lib/kward/tools/read_skill.rb +9 -4
  94. data/lib/kward/tools/registry.rb +266 -8
  95. data/lib/kward/tools/search/code.rb +4 -22
  96. data/lib/kward/tools/search/web.rb +28 -2
  97. data/lib/kward/update_check.rb +117 -0
  98. data/lib/kward/version.rb +1 -1
  99. data/lib/kward/workers/manager.rb +43 -3
  100. data/lib/kward/workspace.rb +3 -1
  101. data/templates/default/fulldoc/html/css/kward.css +22 -0
  102. data/templates/default/fulldoc/html/js/kward.js +2 -0
  103. data/templates/default/kward_navigation.rb +4 -2
  104. data/templates/default/layout/html/setup.rb +2 -0
  105. metadata +25 -1
data/doc/rpc.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div class="kward-no-toc"></div>
4
4
 
5
- Kward RPC is an experimental backend protocol for UI clients. It is versioned as protocol version `1`, but method names and payloads may still change while the UI integration is built.
5
+ Kward RPC is a JSON-RPC backend protocol for trusted local UI clients. It is versioned as protocol version `1`: new methods and fields may be added in compatible releases, and clients should ignore unknown fields. Removing or changing existing methods or field meanings requires a protocol version bump. Individual capability groups may still report unsupported status in `initialize.capabilities`.
6
6
 
7
7
  This page is for people building UI clients or integrations. If you use Kward from the terminal, you can skip it.
8
8
 
@@ -44,27 +44,28 @@ Result fields:
44
44
 
45
45
  - `protocolVersion`: currently `1`.
46
46
  - `serverName`: `"kward"`.
47
- - `experimental`: `true`.
48
- - `capabilities`: includes Tauren-compatible capability groups.
47
+ - `experimental`: `false`.
48
+ - `capabilities`: includes frontend-neutral capability groups.
49
49
 
50
50
  Detailed capability fields include:
51
51
 
52
- - `transcript`: Tauren transcript format support, including normalized messages, image/tool support, compaction summaries, and restored assistant reasoning as Pi-compatible `thinking` content blocks.
53
- - `sessions`: explicit RPC session mode, JSONL persistence, supported session methods, startup auto-resume capability/default, immediate transcript support for auto-resume, RPC list support, supported linear-session fork methods, supported compaction, supported tree navigation with labels and branch summarization, explicit unsupported import support, and unsupported live session updates reported with `notification: "session/updated"`.
54
- - `turns`: async turn mode, per-session concurrency, provider-gated native busy-input steering, queued follow-up input, best-effort cancellation, and recent in-memory event replay behavior.
55
- - `events`: `turn/event` notification details, assistant/reasoning event names, normalized tool metadata, diff result support, configured workspace guardrail status, focused context and context-budget stats tool support, and explicit unsupported shell changed-file detection/session update flags.
52
+ - `transcript`: Kward transcript format support, including normalized messages, image/tool support, compaction summaries, and restored assistant reasoning as Pi-compatible `thinking` content blocks.
53
+ - `sessions`: explicit RPC session mode, JSONL persistence, supported session methods, startup auto-resume capability/default, immediate transcript support for auto-resume, RPC list support, active live-session discovery, supported linear-session fork methods, supported compaction, supported tree navigation with labels and branch summarization, explicit unsupported import support, and unsupported live session updates reported with `notification: "session/updated"`.
54
+ - `turns`: async turn mode, per-session concurrency, active/recent turn listing, provider-gated native busy-input steering, queued follow-up input, best-effort cancellation, recent in-memory event replay behavior, per-turn options for model/reasoning/tool scope/tool approval, and structured client context for editor integrations.
55
+ - `events`: `turn/event` notification details, assistant/reasoning event names, normalized tool metadata, tool update/result events, diff result support, configured workspace guardrail status, focused context and context-budget stats tool support, and explicit unsupported shell changed-file detection/session update flags.
56
56
  - `attachments`: supported input attachment contract for `turns/start`, with accepted base64 image MIME types and a stable max byte value.
57
57
  - `models`: model/reasoning RPC methods, explicit OpenRouter catalog listing, exposed model fields, and no scoped model support.
58
58
  - `runtime`: supported state/stats methods with message-count stats and OpenAI/Codex context usage. Cumulative token and cost stats are not computed.
59
+ - `lifecycleHooks`: supported lifecycle hook events, decisions, command/plugin/workspace/HTTP/async hook availability, audit log path, hook approval routing through tool approval, and hook notifications (`hook/event`, `hook/message`).
59
60
  - `runtimeSettings`: live `runtime/updateSetting` support for `defaultModel` and `defaultThinkingLevel`, plus `runtime/reload`.
60
- - `auth`: Tauren auth provider format, OpenAI and Anthropic OAuth, OpenRouter API-key login, GitHub/Copilot status reporting, and provider logout for stored credentials. GitHub OAuth login is CLI-only; RPC reports `supported: false` for the GitHub provider with a reason string.
61
+ - `auth`: Kward auth provider format, OpenAI and Anthropic OAuth, OpenRouter API-key login, GitHub/Copilot status reporting, and provider logout for stored credentials. GitHub OAuth login is CLI-only; RPC reports `supported: false` for the GitHub provider with a reason string.
61
62
  - `memory`: opt-in structured memory support, interactive prompt injection only, JSON/JSONL local storage, and dedicated `memory/*` methods.
62
63
  - `commands`: supported `commands/list` capability for prompt, skill, and plugin command sources, plus plugin execution through `commands/run` or plugin slash turns.
63
- - `mcp`: local stdio MCP server support through the shared `mcpServers` config. RPC exposes MCP tools to turns; MCP resources, prompts, sampling, and Streamable HTTP are explicitly unsupported for now.
64
+ - `mcp`: local stdio MCP server support through the shared `mcpServers` config. RPC exposes MCP tools to turns and advertises discovery with `methods: ["tools/list", "mcp/status"]`, `toolMetadata: true`, and `serverStatus: true`. MCP resources, prompts, sampling, and Streamable HTTP are explicitly unsupported for now.
64
65
  - `startupResources`: supported startup resource listing for context, skills, prompts, and plugins.
65
66
  - `extensionUi`: question bridge support via `ui/question` and `ui/answerQuestion`, plus plugin footer updates via `ui/footer`; other UI primitives are explicitly unsupported.
66
67
  - `composer`: composer-only UI features. Interactive session diff totals are explicitly unsupported over RPC (`composer.sessionDiff.supported: false`) because RPC clients already receive per-tool diff results and no live composer status payload is exposed. Clipboard copy is also unsupported over RPC (`composer.copy.supported: false`) because UI clients own clipboard access.
67
- - `security`: trusted-local behavior; no workspace mutation guard or tool approval, shell/file mutation can run. File-tool workspace guardrails are reported under `capabilities.events.tools.workspaceGuardrails` and `runtime/state.workspaceGuardrailsEnabled`.
68
+ - `security`: trusted-local behavior with optional per-turn tool approval. By default there is no workspace mutation guard or tool approval and shell/file mutation can run. File-tool workspace guardrails are reported under `capabilities.events.tools.workspaceGuardrails` and `runtime/state.workspaceGuardrailsEnabled`.
68
69
  - `export`: supported transcript export formats. Currently `markdown` and `html`; default is `markdown`.
69
70
  - `workers`: experimental agent worker pipeline. Reports `supported: false` by default; set to `supported: true` with `methods: ["workers/list", "workers/show"]` when Kward is launched with `--experimental-workers`.
70
71
  - `starterPack`: explicitly unsupported (`supported: false`, reason `cliOnlyInstallCommand`). Use `kward init` from the shell.
@@ -89,6 +90,23 @@ Returns the real workspace root. Any existing local directory accessible to the
89
90
 
90
91
  Returns root, basename, and writability for a workspace.
91
92
 
93
+ ## Lifecycle hook notifications
94
+
95
+ RPC clients can subscribe by listening for JSON-RPC notifications:
96
+
97
+ - `hook/event`: emitted after a lifecycle hook event runs at least one matching handler. The payload includes event identity, phase, timestamp, session/turn/workspace/frontend/agent metadata, sorted `payloadKeys`, and the final decision summary. Raw event payload values are intentionally omitted.
98
+ - `hook/message`: emitted when trusted hook/plugin code calls `ctx.say`.
99
+
100
+ Both notifications are redacted by the same RPC redactor used for other outbound messages.
101
+
102
+ ### `hooks/logs`
103
+
104
+ Params:
105
+
106
+ - `limit`: optional positive integer, default `20`, capped at `200`.
107
+
108
+ Returns `{ path, records }` from the local lifecycle hook audit log. Unreadable JSONL lines are skipped and records are redacted before they are sent over RPC.
109
+
92
110
  ## Session methods
93
111
 
94
112
  RPC sessions are explicit and have an RPC `id`, a persisted session `path`, and a `workspaceRoot`. When a client creates, resumes, clones, or forks into another session, idle empty unnamed sessions are cleaned up automatically.
@@ -224,13 +242,17 @@ Closes the RPC session. Empty unnamed session files may be cleaned up.
224
242
 
225
243
  Returns session metadata and full conversation messages. Assistant `reasoning_summary` values and existing `thinking`/`reasoning` content parts are restored as normalized `{ "type": "thinking", "thinking": "..." }` blocks before assistant text; reasoning is not merged into normal text blocks.
226
244
 
245
+ ### `sessions/active`
246
+
247
+ Returns currently live RPC sessions in this server process. This is intended for clients reconnecting to an existing local RPC process; it does not list persisted sessions that are not currently open. Use `sessions/list` for persisted session files.
248
+
227
249
  ### `sessions/tree`
228
250
 
229
251
  Params:
230
252
 
231
253
  - `sessionId`
232
254
 
233
- Returns the full branching session tree as flattened Tauren-compatible rows (`tauren-tree-items-v1`). Each row includes `entryId`, `parentId`, `role`, `text` (compact display text), `current` (whether it is the active leaf), `depth`, `isLast`, `ancestorContinues`, `activePath`, `selectable`, `label`, `labelTimestamp`, and `prefix` (tree-drawing connector string). User-message entries are selectable; assistant/tool entries are not.
255
+ Returns the full branching session tree as flattened frontend-neutral rows (`kward-tree-items-v1`). Each row includes `entryId`, `parentId`, `role`, `text` (compact display text), `current` (whether it is the active leaf), `depth`, `isLast`, `ancestorContinues`, `activePath`, `selectable`, `label`, `labelTimestamp`, and `prefix` (tree-drawing connector string). User-message entries are selectable; assistant/tool entries are not.
234
256
 
235
257
  ### `sessions/tree/setLabel`
236
258
 
@@ -267,6 +289,8 @@ Params:
267
289
  - `input`
268
290
  - `streamingBehavior`: optional; `newTurn` by default when idle. `followUp` queues behind the active turn. `steer` routes input to the active turn only when `initialize.capabilities.turns.busyInput.steer` is `native`; unsupported providers return an invalid params error instead of queueing or approximating steering. When native steering is supported and a turn is already running, omitted `streamingBehavior` defaults to `steer`.
269
291
  - `attachments`: optional array of image attachments: `{ "type": "image", "data": "base64", "mimeType": "image/png", "name": "optional.png", "sizeBytes": 12345 }`.
292
+ - `options`: optional object with per-turn overrides. Supported fields are `provider`, `model`, `reasoningEffort`, `allowedTools`, `disabledTools`, and `approvalMode`. `model` may be a string or an object with `id`/`model`. `allowedTools` and `disabledTools` are arrays of model tool names and are mutually exclusive. `approvalMode` is `none` by default; `ask` emits `tool/approvalRequested` before each tool execution and waits for `tool/answerApproval`. Tool scoping and approval affect only the current turn; they do not change the session or saved config.
293
+ - `context`: optional structured client/editor context. Supported fields are `activeFile`, `openFiles`, `selection`, and `diagnostics`. `selection` may include `path`, `startLine`, `endLine`, and `text`; diagnostics may include `path`, `line`, `severity`, and `message`. Kward appends this context to the turn input for model use without persisting it as separate protocol state.
270
294
 
271
295
  Supported attachment MIME types are `image/png`, `image/jpeg`, `image/gif`, and `image/webp`. Image data must be raw base64 without a `data:` prefix, and the RPC boundary limit is 10MB per image.
272
296
 
@@ -295,6 +319,22 @@ Params:
295
319
 
296
320
  Returns recent in-memory events after the requested sequence. Event history is not persisted and is bounded in memory.
297
321
 
322
+ ### `turns/list`
323
+
324
+ Params:
325
+
326
+ - `sessionId`: optional active RPC session ID filter.
327
+
328
+ Returns recent in-memory turn metadata for this server process. Turn metadata is not persisted across RPC process restarts.
329
+
330
+ ### `turns/listActive`
331
+
332
+ Params:
333
+
334
+ - `sessionId`: optional active RPC session ID filter.
335
+
336
+ Returns queued and running turns for this server process. Use this after reconnecting to rebuild live UI state.
337
+
298
338
  ## Turn notifications
299
339
 
300
340
  The server emits `turn/event` notifications:
@@ -321,6 +361,7 @@ Known event types:
321
361
  - `assistantMessage`
322
362
  - `modelRetry`
323
363
  - `toolCall`
364
+ - `toolUpdate`
324
365
  - `toolResult`
325
366
  - `answer`
326
367
  - `turnCancelRequested`
@@ -333,12 +374,14 @@ Lifecycle payloads include `status` for `turnQueued`, `turnStarted`, and `turnFi
333
374
 
334
375
  `steeringApplied` is emitted after queued steering input has been appended to conversation context. Its payload includes `count`, the number of steering messages applied.
335
376
 
336
- `toolCall` and `toolResult` payloads include canonical Tauren-normalized fields:
377
+ `toolCall`, `toolUpdate`, and `toolResult` payloads include canonical Kward-normalized fields:
337
378
 
338
379
  - `toolCallId`: tool call ID.
339
380
  - `toolName`: normalized tool name, such as `read`, `edit`, `write`, or `bash`.
340
381
  - `args`: normalized arguments. Edit replacements use `oldText`/`newText`; shell timeout is `timeout`.
341
382
 
383
+ `toolUpdate` additionally includes `delta.content` and optional `elapsedMs` for clients that want progress/status updates before the final result. Kward currently emits one update after each built-in tool finishes; clients should treat future additional updates as additive.
384
+
342
385
  `toolResult` additionally includes `result` with `content`, `isError`, optional unified `diff`, optional `changedFiles`, and `images`. Failed or declined tools set `isError: true`.
343
386
 
344
387
  Examples:
@@ -347,6 +390,28 @@ Examples:
347
390
  - `write_file`: `toolName: "write"`, `args: { "path": "...", "content": "..." }`.
348
391
  - `run_shell_command`: `toolName: "bash"`, `args: { "command": "...", "timeout": 30 }`.
349
392
 
393
+ ## Tool approval bridge
394
+
395
+ When `turns/start` is called with `options.approvalMode: "ask"`, Kward emits `tool/approvalRequested` before executing each tool.
396
+
397
+ Notification params include:
398
+
399
+ - `sessionId`
400
+ - `approvalRequestId`
401
+ - `toolCallId`
402
+ - `toolName`
403
+ - `args`
404
+
405
+ Clients answer with `tool/answerApproval`:
406
+
407
+ Params:
408
+
409
+ - `sessionId`
410
+ - `approvalRequestId`
411
+ - `approved`: boolean.
412
+
413
+ Denied tools are returned to the model as error-like tool results instead of executing the local operation.
414
+
350
415
  ## UI question bridge
351
416
 
352
417
  Kward supports the structured question bridge and plugin footer updates over RPC. The `extensionUi` capability reports `question.supported: true` with `notification: "ui/question"`, `method: "ui/answerQuestion"`, `maxQuestions: 4`, `multiSelect: false`, and `preview: false`. It also reports `footer.supported: true` with `notification: "ui/footer"`. Other Pi-style extension UI primitives (`select`, `confirm`, `input`, `editor`, `widgets`, `custom`, and `terminalInput`) are explicitly reported as unsupported until Kward has a real plugin/extension consumer for them.
@@ -390,7 +455,7 @@ Params:
390
455
 
391
456
  - `sessionId`: active RPC session ID.
392
457
 
393
- Returns Tauren-compatible runtime state for the session, including session file, persisted session ID/name, active `rpcSessionId`, `persistentSessionId`, current model metadata, current thinking level, streaming/pending-message state, and stable Kward defaults. Clients must send the active RPC session `id`/`rpcSessionId` in RPC request params. Unsupported runtime settings are returned as false or omitted.
458
+ Returns frontend-neutral runtime state for the session, including session file, persisted session ID/name, active `rpcSessionId`, `persistentSessionId`, current model metadata, current thinking level, streaming/pending-message state, and stable Kward defaults. Clients must send the active RPC session `id`/`rpcSessionId` in RPC request params. Unsupported runtime settings are returned as false or omitted.
394
459
 
395
460
  ### `runtime/stats`
396
461
 
@@ -580,7 +645,34 @@ Updates the config-backed OpenAI/Codex reasoning effort and returns the current
580
645
 
581
646
  ### `tools/list`
582
647
 
583
- Returns current tool schemas.
648
+ Params:
649
+
650
+ - `sessionId`: optional active RPC session ID. When supplied, returns the exact tool set for that session/workspace. When omitted, returns the default current tool schemas.
651
+
652
+ Returns current tool schemas. The existing model-facing schema shape is preserved: each entry still has `type: "function"` and `function` with `name`, `description`, and `parameters`. Entries also include additive metadata for UI discovery:
653
+
654
+ - `metadata.source`: one of practical source labels such as `builtin`, `mcp`, `web`, `skill`, `ui`, or `unknown`.
655
+ - `metadata.displayName`: human-readable tool label.
656
+ - MCP tools also include `metadata.serverName` and `metadata.remoteName`. The callable name remains sanitized with a double underscore, for example `github__search_issues`, while `displayName` is `github.search_issues`.
657
+
658
+ Clients that only read `tools[].function` remain compatible.
659
+
660
+ ### `mcp/status`
661
+
662
+ Returns configured MCP stdio server status without exposing environment values or raw sensitive arguments.
663
+
664
+ Result shape:
665
+
666
+ ```json
667
+ {
668
+ "servers": [
669
+ { "name": "github", "transport": "stdio", "status": "available", "toolCount": 8 },
670
+ { "name": "linear", "transport": "stdio", "status": "unavailable", "toolCount": 0, "error": "Failed to start MCP server linear-mcp: command not found" }
671
+ ]
672
+ }
673
+ ```
674
+
675
+ Disabled MCP servers are omitted, matching runtime tool exposure. Unsupported MCP capabilities remain unsupported: resources, prompts, sampling, and Streamable HTTP.
584
676
 
585
677
  ### `commands/list`
586
678
 
@@ -588,7 +680,7 @@ Params:
588
680
 
589
681
  - `sessionId`: active RPC session ID.
590
682
 
591
- Returns Tauren-compatible slash command metadata for configured prompt templates, skills, and plugins. Prompt command names omit the leading slash. Skill command names use `skill:<name>`. Plugin command names omit the leading slash and include `executable: true`. Builtin terminal-only commands are omitted. Prompt commands can be submitted directly to `turns/start` as slash commands or expanded first with `prompts/expand`; plugin commands can be submitted to `turns/start` or run explicitly with `commands/run`.
683
+ Returns frontend-neutral slash command metadata for configured prompt templates, skills, and plugins. Prompt command names omit the leading slash. Skill command names use `skill:<name>`. Plugin command names omit the leading slash and include `executable: true`. Builtin terminal-only commands are omitted. Prompt commands can be submitted directly to `turns/start` as slash commands or expanded first with `prompts/expand`; plugin commands can be submitted to `turns/start` or run explicitly with `commands/run`.
592
684
 
593
685
  ### `resources/startup`
594
686
 
@@ -635,7 +727,7 @@ Returns whether OpenAI OAuth, Anthropic OAuth, OpenAI access token env, and Open
635
727
 
636
728
  ### `auth/providers`
637
729
 
638
- Returns Tauren-compatible provider cards for OpenAI OAuth, Anthropic OAuth, OpenRouter API-key auth, and GitHub/Copilot status. Provider cards report whether credentials are configured, whether they came from stored config or environment variables, and whether stored credentials can be removed.
730
+ Returns frontend-neutral provider cards for OpenAI OAuth, Anthropic OAuth, OpenRouter API-key auth, and GitHub/Copilot status. Provider cards report whether credentials are configured, whether they came from stored config or environment variables, and whether stored credentials can be removed.
639
731
 
640
732
  ### `auth/loginWithApiKey`
641
733
 
@@ -23,7 +23,7 @@ cd ~/code/project
23
23
  kward
24
24
  ```
25
25
 
26
- To automatically resume the last active session for the current workspace on startup, enable `sessions.auto_resume` in your config — see [Configuration](configuration.md). When auto-resume is off (the default), Kward starts fresh each time and you can resume earlier work with `/sessions`.
26
+ To automatically resume the last active session for the current workspace on startup, enable `sessions.auto_resume` in your config — see [Configuration](configuration.md). When auto-resume is off (the default), Kward starts fresh each time and you can resume earlier work with `/session`.
27
27
 
28
28
  ## A normal session workflow
29
29
 
@@ -33,7 +33,7 @@ Start a chat and give it a useful name:
33
33
  /rename oauth cleanup
34
34
  ```
35
35
 
36
- `/rename` requires a name. Use `/name` without an argument to clear the current session name.
36
+ `/rename` requires a name. Use `/session name` without an argument to clear the current session name.
37
37
 
38
38
  Work normally:
39
39
 
@@ -52,19 +52,19 @@ Leave when you are done for now:
52
52
  Later, resume the work:
53
53
 
54
54
  ```text
55
- /sessions
55
+ /session
56
56
  ```
57
57
 
58
58
  The session picker shows recent sessions for the current workspace. Choose one to restore its transcript and continue with the same context.
59
59
 
60
- `/resume` is an alias for `/sessions`.
60
+ `/resume` is an alias for `/session`.
61
61
 
62
62
  ## The sessions picker
63
63
 
64
64
  Open it with:
65
65
 
66
66
  ```text
67
- /sessions
67
+ /session
68
68
  ```
69
69
 
70
70
  Inside the picker you can:
@@ -91,7 +91,7 @@ From inside the active session:
91
91
  /clone
92
92
  ```
93
93
 
94
- Or from `/sessions`, highlight a session and press `c`.
94
+ Or from `/session`, highlight a session and press `c`.
95
95
 
96
96
  A clone keeps the same conversation so far, but future messages are written to the new session file. The original session remains unchanged.
97
97
 
@@ -114,7 +114,7 @@ From inside the active session:
114
114
  /fork
115
115
  ```
116
116
 
117
- Or from `/sessions`, highlight a session and press `f`.
117
+ Or from `/session`, highlight a session and press `f`.
118
118
 
119
119
  Kward shows earlier user prompts. Choose the prompt where the new path should begin. Kward creates a new session containing the conversation before that prompt, then pre-fills the selected prompt so you can edit or resubmit it.
120
120
 
@@ -228,9 +228,9 @@ This is useful when you want to confirm which session you are in or check whethe
228
228
 
229
229
  | Need | Use |
230
230
  | --- | --- |
231
- | Continue earlier work | `/sessions` or `/resume` |
231
+ | Continue earlier work | `/session` or `/resume` |
232
232
  | Give the current session a better name | `/rename <name>` |
233
- | Clear the current session name | `/name` |
233
+ | Clear the current session name | `/session name` |
234
234
  | Keep the current state but try another future | `/clone` |
235
235
  | Start a separate session from before an earlier prompt | `/fork` |
236
236
  | Quickly retry an earlier prompt in this session | `/rewind` |
data/doc/skills.md ADDED
@@ -0,0 +1,199 @@
1
+ # Skills
2
+
3
+ Skills are reusable instructions that Kward loads only when they are useful. They are good for workflows such as testing, code review, release checks, writing documentation, or working in a domain with specific rules.
4
+
5
+ Kward supports the Agent Skills folder format: each skill is a directory with a `SKILL.md` file. Kward shows the model only each skill's name and description at startup. The full instructions are loaded later, either when the model decides they match the task or when you activate the skill yourself.
6
+
7
+ ## When to use a skill
8
+
9
+ Use a skill when you want specialized guidance that should not be in every prompt.
10
+
11
+ Good skill examples:
12
+
13
+ - testing practices for your project
14
+ - release checklist steps
15
+ - API review rules
16
+ - incident response workflow
17
+ - documentation style guidance
18
+ - domain-specific terminology and examples
19
+
20
+ Use `AGENTS.md` instead for repository-wide rules that should apply to almost every task. Use prompt templates when you want to expand a reusable user prompt with arguments.
21
+
22
+ ## Create a skill
23
+
24
+ A minimal skill looks like this:
25
+
26
+ ```text
27
+ ~/.agents/skills/testing/SKILL.md
28
+ ```
29
+
30
+ ```markdown
31
+ ---
32
+ name: testing
33
+ description: Use when adding or changing tests, fixing regressions, or verifying behavior.
34
+ ---
35
+
36
+ Prefer focused tests near the changed behavior.
37
+ Do not weaken assertions to make tests pass.
38
+ Run the smallest relevant test first, then broaden if needed.
39
+ ```
40
+
41
+ The `name` and `description` fields are required. The description matters: Kward puts it in the skill catalog so the model can decide when to load the skill.
42
+
43
+ Skill names should be lowercase letters, numbers, and hyphens, such as `testing`, `code-review`, or `release-checklist`.
44
+
45
+ ## Skill locations
46
+
47
+ User-level skills are available in every project:
48
+
49
+ ```text
50
+ ~/.kward/skills/<name>/SKILL.md
51
+ ~/.agents/skills/<name>/SKILL.md
52
+ ```
53
+
54
+ Project-level skills live in the current workspace:
55
+
56
+ ```text
57
+ <workspace>/.kward/skills/<name>/SKILL.md
58
+ <workspace>/.agents/skills/<name>/SKILL.md
59
+ ```
60
+
61
+ The `.agents/skills` paths are the cross-client Agent Skills convention. Use them when you want skills to work across compatible agents.
62
+
63
+ Project skills are skipped by default because repository-provided instructions may be untrusted. If you trust the repository, enable project skills from inside Kward:
64
+
65
+ ```text
66
+ /settings
67
+ ```
68
+
69
+ Then choose:
70
+
71
+ ```text
72
+ Tools & Search → Trust project skills
73
+ ```
74
+
75
+ Or set it manually:
76
+
77
+ ```json
78
+ {
79
+ "skills": {
80
+ "trust_project": true
81
+ }
82
+ }
83
+ ```
84
+
85
+ ## How Kward uses skills
86
+
87
+ Kward uses progressive loading:
88
+
89
+ 1. At startup, Kward lists available skill names and descriptions in the system prompt.
90
+ 2. When a task matches a skill, the model calls `read_skill` to load `SKILL.md`.
91
+ 3. If the skill references supporting files, the model reads only the needed files.
92
+
93
+ You can also activate a skill explicitly:
94
+
95
+ ```text
96
+ /skill testing
97
+ ```
98
+
99
+ or:
100
+
101
+ ```text
102
+ /skill:testing
103
+ ```
104
+
105
+ Explicit activation loads the skill instructions into the current conversation without asking the model to infer that the skill is relevant.
106
+
107
+ Activated skills are preserved during context compaction, so Kward does not silently forget the workflow in a long session.
108
+
109
+ ## Add supporting files
110
+
111
+ A skill can include extra files:
112
+
113
+ ```text
114
+ ~/.agents/skills/release-checklist/
115
+ ├── SKILL.md
116
+ ├── references/
117
+ │ └── versioning.md
118
+ ├── scripts/
119
+ │ └── check_changelog.rb
120
+ └── assets/
121
+ └── release-template.md
122
+ ```
123
+
124
+ Example `SKILL.md`:
125
+
126
+ ```markdown
127
+ ---
128
+ name: release-checklist
129
+ description: Use when preparing a release, updating versions, or writing changelog entries.
130
+ ---
131
+
132
+ Follow the release checklist:
133
+
134
+ 1. Read `references/versioning.md`.
135
+ 2. Confirm `CHANGELOG.md` has an Unreleased entry.
136
+ 3. If needed, inspect `assets/release-template.md`.
137
+ 4. Run `scripts/check_changelog.rb` before proposing the final release notes.
138
+ ```
139
+
140
+ When Kward loads the skill, it lists bundled files under `references/`, `scripts/`, and `assets/` without reading all of them. The model can then request a specific file with `read_skill`, using a path relative to the skill directory.
141
+
142
+ For example, the model can call:
143
+
144
+ ```json
145
+ {
146
+ "name": "release-checklist",
147
+ "path": "references/versioning.md"
148
+ }
149
+ ```
150
+
151
+ Paths are constrained to the skill directory. Absolute paths and `..` traversal outside the skill are rejected.
152
+
153
+ ## Discovery precedence
154
+
155
+ If multiple skills have the same `name`, Kward uses the first one in this order:
156
+
157
+ 1. `<workspace>/.kward/skills`
158
+ 2. `<workspace>/.agents/skills`
159
+ 3. Kward config directory `skills` (`~/.kward/skills` by default, or beside `KWARD_CONFIG_PATH`)
160
+ 4. `~/.agents/skills`
161
+
162
+ Shadowed skills are skipped with a warning. Rename one of the skills if you want both to be available.
163
+
164
+ ## Optional metadata
165
+
166
+ Kward understands these optional `SKILL.md` frontmatter fields:
167
+
168
+ ```yaml
169
+ license: MIT
170
+ compatibility: Requires git and Ruby.
171
+ metadata:
172
+ author: example-team
173
+ version: "1.0"
174
+ allowed-tools: Bash(git:*) Read
175
+ ```
176
+
177
+ `allowed-tools` is parsed for compatibility with the Agent Skills format, but Kward does not currently use it to grant extra permissions. Treat skill scripts and instructions as trusted only when you trust their source.
178
+
179
+ ## Troubleshooting
180
+
181
+ If a skill does not appear:
182
+
183
+ - Check that the file is named exactly `SKILL.md`.
184
+ - Check that `name` and `description` are present in frontmatter.
185
+ - Check that the directory name and skill name are sensible and unique.
186
+ - If it is a project skill, make sure project skills are trusted in `/settings`.
187
+ - Look for warnings about skipped, malformed, or shadowed skills.
188
+
189
+ If a skill activates but cannot read a supporting file, make sure the path is relative to the skill directory, for example:
190
+
191
+ ```text
192
+ references/details.md
193
+ ```
194
+
195
+ not:
196
+
197
+ ```text
198
+ ../other-skill/details.md
199
+ ```
data/doc/usage.md CHANGED
@@ -94,7 +94,7 @@ kward login # sign in or save credentials
94
94
  kward auth status # show credential status without secrets
95
95
  kward sysprompt # inspect assembled instructions
96
96
  kward stats tokens # export local token telemetry as CSV
97
- kward rpc # start the experimental RPC backend
97
+ kward rpc # start the RPC backend for trusted local UI clients
98
98
  ```
99
99
 
100
100
  Use another workspace without changing directories:
@@ -135,9 +135,9 @@ Slash commands run local actions in the current session. Most do not send a prom
135
135
  | `/tab close` | close the active tab. |
136
136
  | `/tab new` | open a new tab. |
137
137
  | `/tab name <label>` | rename the active tab label. |
138
- | `/sessions` | open the saved sessions picker or continue a previous session by path. |
139
- | `/resume` | alias for `/sessions`. |
140
- | `/name <name>` | name or clear the current session. |
138
+ | `/session` | open the saved sessions picker or continue a previous session by path. |
139
+ | `/resume` | alias for `/session`. |
140
+ | `/session name <name>` | name or clear the current session. |
141
141
  | `/rename <name>` | rename the current session. |
142
142
  | `/clone` | copy the current session into a new branch. |
143
143
  | `/rewind` | revisit an earlier prompt and try a different direction. |
@@ -208,10 +208,10 @@ Typical flow:
208
208
  Later:
209
209
 
210
210
  ```text
211
- /sessions
211
+ /session
212
212
  ```
213
213
 
214
- In the sessions picker, press `r` to rename the highlighted session, `c` to clone it, `f` to fork from an earlier prompt, or `d` twice to delete it. `/resume` remains available as an alias for `/sessions`.
214
+ In the sessions picker, press `r` to rename the highlighted session, `c` to clone it, `f` to fork from an earlier prompt, or `d` twice to delete it. `/resume` remains available as an alias for `/session`.
215
215
 
216
216
  For the full guide to context management, cloning, forking, rewinding, `/tree`, compaction, and exports, read [Sessions](session-management.md).
217
217
 
@@ -280,4 +280,4 @@ Use it only on trusted networks. It exposes the same file, shell, and web tools
280
280
 
281
281
  ## RPC backend
282
282
 
283
- `kward rpc` starts the experimental JSON-RPC backend for UI clients and editor integrations. Terminal users can ignore it. Integration authors should read [RPC protocol](rpc.md).
283
+ `kward rpc` starts the JSON-RPC backend for trusted local UI clients and editor integrations. Terminal users can ignore it. Integration authors should read [RPC protocol](rpc.md).