@tyvm/knowhow 0.0.89 → 0.0.90

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 (87) hide show
  1. package/CONFIG.md +52 -0
  2. package/README.md +344 -29
  3. package/WORKER.md +169 -334
  4. package/autodoc/chat-guide.md +540 -0
  5. package/autodoc/cli-reference.md +765 -0
  6. package/autodoc/config-reference.md +541 -0
  7. package/autodoc/embeddings-guide.md +566 -0
  8. package/autodoc/generate-guide.md +477 -0
  9. package/autodoc/language-plugin-guide.md +443 -0
  10. package/autodoc/modules-guide.md +352 -0
  11. package/autodoc/plugins-guide.md +720 -0
  12. package/autodoc/quickstart-guide.md +129 -0
  13. package/autodoc/skills-guide.md +468 -0
  14. package/autodoc/worker-guide.md +526 -0
  15. package/package.json +1 -1
  16. package/src/ai.ts +33 -2
  17. package/src/config.ts +28 -4
  18. package/src/index.ts +22 -2
  19. package/src/processors/TokenCompressor.ts +2 -2
  20. package/src/processors/ToolResponseCache.ts +3 -3
  21. package/src/processors/tools/grepToolResponse.ts +9 -4
  22. package/src/processors/tools/jqToolResponse.ts +11 -6
  23. package/src/processors/tools/listStoredToolResponses.ts +1 -1
  24. package/src/processors/tools/tailToolResponse.ts +9 -4
  25. package/ts_build/package.json +1 -1
  26. package/ts_build/src/ai.js +18 -1
  27. package/ts_build/src/ai.js.map +1 -1
  28. package/ts_build/src/config.js +17 -2
  29. package/ts_build/src/config.js.map +1 -1
  30. package/ts_build/src/index.js +12 -2
  31. package/ts_build/src/index.js.map +1 -1
  32. package/ts_build/src/processors/TokenCompressor.js +2 -2
  33. package/ts_build/src/processors/TokenCompressor.js.map +1 -1
  34. package/ts_build/src/processors/ToolResponseCache.js +3 -3
  35. package/ts_build/src/processors/ToolResponseCache.js.map +1 -1
  36. package/ts_build/src/processors/tools/grepToolResponse.d.ts +3 -1
  37. package/ts_build/src/processors/tools/grepToolResponse.js +8 -2
  38. package/ts_build/src/processors/tools/grepToolResponse.js.map +1 -1
  39. package/ts_build/src/processors/tools/jqToolResponse.d.ts +3 -1
  40. package/ts_build/src/processors/tools/jqToolResponse.js +10 -4
  41. package/ts_build/src/processors/tools/jqToolResponse.js.map +1 -1
  42. package/ts_build/src/processors/tools/listStoredToolResponses.js +1 -1
  43. package/ts_build/src/processors/tools/listStoredToolResponses.js.map +1 -1
  44. package/ts_build/src/processors/tools/tailToolResponse.d.ts +3 -1
  45. package/ts_build/src/processors/tools/tailToolResponse.js +8 -2
  46. package/ts_build/src/processors/tools/tailToolResponse.js.map +1 -1
  47. package/autodoc/chat.mdx +0 -20
  48. package/autodoc/cli.mdx +0 -11
  49. package/autodoc/plugins/asana.mdx +0 -47
  50. package/autodoc/plugins/downloader/downloader.mdx +0 -38
  51. package/autodoc/plugins/downloader/plugin.mdx +0 -37
  52. package/autodoc/plugins/downloader/types.mdx +0 -42
  53. package/autodoc/plugins/embedding.mdx +0 -41
  54. package/autodoc/plugins/figma.mdx +0 -45
  55. package/autodoc/plugins/github.mdx +0 -40
  56. package/autodoc/plugins/jira.mdx +0 -46
  57. package/autodoc/plugins/language.mdx +0 -37
  58. package/autodoc/plugins/linear.mdx +0 -35
  59. package/autodoc/plugins/notion.mdx +0 -38
  60. package/autodoc/plugins/plugins.mdx +0 -59
  61. package/autodoc/plugins/types.mdx +0 -51
  62. package/autodoc/plugins/vim.mdx +0 -39
  63. package/autodoc/tools/addInternalTools.mdx +0 -1
  64. package/autodoc/tools/agentCall.mdx +0 -1
  65. package/autodoc/tools/asana/definitions.mdx +0 -10
  66. package/autodoc/tools/asana/index.mdx +0 -12
  67. package/autodoc/tools/askHuman.mdx +0 -1
  68. package/autodoc/tools/callPlugin.mdx +0 -1
  69. package/autodoc/tools/embeddingSearch.mdx +0 -1
  70. package/autodoc/tools/execCommand.mdx +0 -1
  71. package/autodoc/tools/fileSearch.mdx +0 -1
  72. package/autodoc/tools/finalAnswer.mdx +0 -1
  73. package/autodoc/tools/github/definitions.mdx +0 -6
  74. package/autodoc/tools/github/index.mdx +0 -8
  75. package/autodoc/tools/index.mdx +0 -14
  76. package/autodoc/tools/lintFile.mdx +0 -7
  77. package/autodoc/tools/list.mdx +0 -16
  78. package/autodoc/tools/modifyFile.mdx +0 -7
  79. package/autodoc/tools/patch.mdx +0 -9
  80. package/autodoc/tools/readBlocks.mdx +0 -1
  81. package/autodoc/tools/readFile.mdx +0 -1
  82. package/autodoc/tools/scanFile.mdx +0 -1
  83. package/autodoc/tools/textSearch.mdx +0 -6
  84. package/autodoc/tools/types/fileblock.mdx +0 -1
  85. package/autodoc/tools/visionTool.mdx +0 -1
  86. package/autodoc/tools/writeFile.mdx +0 -1
  87. package/test-comprehensive.ts +0 -31
@@ -0,0 +1,540 @@
1
+ # `knowhow chat` Guide
2
+
3
+ `knowhow chat` is the primary interactive interface for the **Knowhow CLI**. It runs a REPL-style chat loop where you type messages and can control behavior using **slash commands** (`/…`).
4
+
5
+ At startup, Knowhow typically prints a list of available commands based on:
6
+ - enabled chat modules (agent/search/sessions/shell/voice/etc.)
7
+ - your configuration (`knowhow.json`)
8
+ - the current chat mode (agent vs attached vs voice)
9
+
10
+ > **Tip:** Always look at the startup line like `Commands: /agent, /agents, ...` to confirm what your build exposes.
11
+
12
+ ---
13
+
14
+ ## 1) Starting a chat session
15
+
16
+ Start chat with:
17
+
18
+ ```bash
19
+ knowhow chat
20
+ ```
21
+
22
+ You then enter a prompt loop where you can type normal messages or slash commands.
23
+
24
+ ### Common CLI flags (version/build-dependent)
25
+ Your exact flags depend on the CLI build. Check:
26
+
27
+ ```bash
28
+ knowhow chat --help
29
+ ```
30
+
31
+ Common patterns you may see include:
32
+ - selecting a starting **agent**
33
+ - selecting a **renderer**
34
+ - enabling **voice**
35
+ - attaching/resuming a prior session/task (if your build supports it)
36
+
37
+ Examples (illustrative—verify with `--help`):
38
+ ```bash
39
+ knowhow chat --agent Patcher
40
+ knowhow chat --renderer compact
41
+ knowhow chat --voice
42
+ ```
43
+
44
+ ---
45
+
46
+ ## 2) Chat modes (agent, attached, voice)
47
+
48
+ Knowhow changes behavior based on mode. Mode determines:
49
+ - how inputs are interpreted
50
+ - which slash commands are enabled
51
+ - whether you’re controlling a running task (attached) vs just chatting
52
+
53
+ ### Agent mode
54
+ You’re using a configured agent to respond.
55
+
56
+ In this mode, commands like `/agent`, `/agents`, `/render`, `/search`, `/multi`, etc. are usually available.
57
+
58
+ ### Attached mode (`agent:attached`)
59
+ In attached mode, Knowhow is connected to a running agent task/session and you can inspect/steer it using attached-only commands (if provided by your agent module).
60
+
61
+ ### Voice mode
62
+ If voice is available in your build, voice mode switches input handling so speech is transcribed and sent into the chat loop.
63
+
64
+ ---
65
+
66
+ ## 3) Built-in slash commands (`/…`)
67
+
68
+ Below is the command reference for the commands known to be implemented by the chat modules in the Knowhow codebase (agent/search/sessions/renderer/shell/voice modules).
69
+ If your `Commands:` list includes additional items, use those as well—modules register commands at runtime.
70
+
71
+ ### Agent switching
72
+ - **`/agent <name>`** — switch to a specific configured agent
73
+ **Example**
74
+ ```text
75
+ /agent Patcher
76
+ ```
77
+
78
+ - **`/agents`** — list configured agents (and/or selection help)
79
+ **Example**
80
+ ```text
81
+ /agents
82
+ ```
83
+
84
+ > In attached mode, some agent-control commands may be restricted to attached mode only (see below).
85
+
86
+ ### Attached-mode controls (if provided by your agent module)
87
+ These commands are typically only enabled when you are attached to a running agent task:
88
+
89
+ - **`/pause`** — pause the attached agent
90
+ - **`/unpause`** — resume the attached agent
91
+ - **`/kill`** — terminate the attached agent task (and typically detach)
92
+ - **`/detach`** — detach from the attached agent task
93
+ - **`/done`** — finish/exit the current attached interaction
94
+
95
+ **Examples**
96
+ ```text
97
+ /pause
98
+ /unpause
99
+ /detach
100
+ /done
101
+ ```
102
+
103
+ ### Multi-line input
104
+ - **`/multi`** — start a multi-line input editor for your *next* message (or until you exit the editor, depending on implementation)
105
+
106
+ **Example**
107
+ ```text
108
+ /multi
109
+ Write a runbook for:
110
+ 1) Setup
111
+ 2) Daily use
112
+ 3) Troubleshooting
113
+
114
+ Include a checklist.
115
+ ```
116
+
117
+ ### Rendering control
118
+ - **`/render`** — show current renderer / help for renderer switching
119
+ - **`/render <basic|compact|fancy>`** — switch built-in renderer
120
+
121
+ **Examples**
122
+ ```text
123
+ /render basic
124
+ /render compact
125
+ /render fancy
126
+ ```
127
+
128
+ #### Custom renderer support (from the renderer module)
129
+ Depending on build support, `/render` may also load a renderer from:
130
+ - a path
131
+ - an npm package specifier
132
+
133
+ **Examples**
134
+ ```text
135
+ /render ./my-renderer.js
136
+ /render @my-org/knowhow-renderer
137
+ ```
138
+
139
+ ### Search
140
+ - **`/search`** — enter the interactive search loop (Search module)
141
+
142
+ **Example**
143
+ ```text
144
+ /search
145
+ ```
146
+
147
+ #### Inside `/search` (interactive sub-commands)
148
+ Within the search loop, Knowhow accepts:
149
+
150
+ - **`next`** — show the next result
151
+ - **`exit`** — leave search mode
152
+ - **`embeddings`** — list available embedding scopes
153
+ - **`use`** — choose which embedding scope(s) to search
154
+
155
+ Any other input is treated as a new search query.
156
+
157
+ **Example session**
158
+ ```text
159
+ /search
160
+ searching: "postgres query planner tuning"
161
+
162
+ ### TEXT
163
+ ...match content...
164
+
165
+ ### METADATA
166
+ { "source": "...", "chunk": 12 }
167
+
168
+ searching: next
169
+ ### TEXT
170
+ ...next match...
171
+
172
+ searching: use
173
+ Embedding to search: snippets
174
+ searching: "how to configure agents"
175
+ (search results...)
176
+ searching: exit
177
+ ```
178
+
179
+ ### Session management (attach/resume/logs and listing)
180
+ These are implemented by the Sessions module.
181
+
182
+ - **`/attach [taskId] [--completed]`**
183
+ - With **no args**, opens an interactive selection of attachable sessions/tasks.
184
+ - With `<taskId>`, attaches directly.
185
+ - `--completed` may include completed items in the chooser; completed items are routed to **`/resume`**.
186
+
187
+ **Examples**
188
+ ```text
189
+ /attach
190
+ /attach 8d9f1c2b-3a4e-...
191
+ /attach --completed
192
+ ```
193
+
194
+ - **`/resume [taskId]`**
195
+ - With **no args**, opens an interactive list of saved/completed sessions to resume.
196
+ - With `<taskId>`, resumes that session.
197
+ - When resuming, Knowhow can prompt you to add additional context.
198
+
199
+ **Examples**
200
+ ```text
201
+ /resume
202
+ /resume 8d9f1c2b-3a4e-...
203
+ ```
204
+
205
+ - **`/sessions [--all] [--completed] [--csv]`**
206
+ Lists sessions/tasks so you can choose to attach or resume.
207
+
208
+ - `--completed` includes completed sessions
209
+ - `--all` includes more history/scope (implementation-defined)
210
+ - `--csv` outputs table data in CSV format
211
+
212
+ **Examples**
213
+ ```text
214
+ /sessions
215
+ /sessions --completed
216
+ /sessions --completed --csv
217
+ ```
218
+
219
+ - **`/logs [N]`**
220
+ Shows the last **N** messages from the **currently attached** agent (default `N=20`).
221
+ Typically restricted to **attached mode**.
222
+
223
+ **Examples**
224
+ ```text
225
+ /logs
226
+ /logs 50
227
+ ```
228
+
229
+ > **Note on “save/load”:** the Sessions module primarily exposes **attach** (running tasks) and **resume** (completed/saved tasks). If your build includes explicit `save/load` subcommands under `/sessions`, they will appear in your runtime `Commands:` list or via `/sessions` help.
230
+
231
+ ### Shell commands
232
+ These are provided by the shell module and work in agent/attached modes where enabled.
233
+
234
+ - **`/! [command]`** — run shell commands interactively (module behavior may vary)
235
+ - **`/!! <command>`** — run a shell command, capture output, and send it to the AI for analysis
236
+
237
+ **Examples**
238
+ ```text
239
+ /!
240
+ # (interactive shell mode, if your build uses it)
241
+
242
+ /!! ls -la
243
+ /!! cat ./build.log | tail -n 200
244
+ ```
245
+
246
+ **Typical workflow**
247
+ ```text
248
+ /!
249
+ npm test
250
+ /!!
251
+ npm test
252
+ # then ask the AI to explain failures based on captured output
253
+ ```
254
+
255
+ ### Voice input (if available)
256
+ If your build includes voice support, the Voice module typically exposes a command like:
257
+
258
+ - **`/voice`** — toggle voice mode on/off
259
+
260
+ **Example**
261
+ ```text
262
+ /voice
263
+ ```
264
+
265
+ If `/voice` isn’t present, voice may be controlled only via CLI flags—check:
266
+ ```bash
267
+ knowhow chat --help
268
+ ```
269
+
270
+ ---
271
+
272
+ ## 4) Switching agents (`/agent` and `/agents`)
273
+
274
+ ### List agents
275
+ ```text
276
+ /agents
277
+ ```
278
+
279
+ ### Switch to a configured agent
280
+ ```text
281
+ /agent <AgentName>
282
+ ```
283
+
284
+ **Example**
285
+ ```text
286
+ /agents
287
+ /agent Researcher
288
+ Summarize the tradeoffs between two approaches...
289
+ ```
290
+
291
+ > If you attach/resume a session, Knowhow may also restore the session’s agent context (when the agent still exists in your `knowhow.json`).
292
+
293
+ ---
294
+
295
+ ## 5) Multi-line input (`/multi`)
296
+
297
+ Use `/multi` when you want to paste structured content (requirements, logs, code blocks, JSON/YAML).
298
+
299
+ **Example**
300
+ ```text
301
+ /multi
302
+ Create a step-by-step plan to debug a failing CI job.
303
+
304
+ Input:
305
+ - command I ran:
306
+ - relevant log excerpt:
307
+ - what I already tried:
308
+
309
+ Output:
310
+ - hypotheses
311
+ - commands to verify
312
+ - minimal fix suggestions
313
+ ```
314
+
315
+ ---
316
+
317
+ ## 6) Shell commands (`/!` and `/!!`)
318
+
319
+ ### `/!` — interactive shell
320
+ Use `/!` to run shell commands in an interactive way (depending on your build). For some builds, `/!` may also accept a command directly.
321
+
322
+ **Example**
323
+ ```text
324
+ /!
325
+ ls -la
326
+ cat package.json
327
+ ```
328
+
329
+ ### `/!!` — send shell output to the AI
330
+ Use `/!!` when you want Knowhow to *capture* command output and include it in the AI context.
331
+
332
+ **Example**
333
+ ```text
334
+ /!! npm test --silent
335
+ ```
336
+
337
+ Then ask:
338
+ ```text
339
+ What caused the failure, and what minimal changes should I make?
340
+ ```
341
+
342
+ > **Safety note:** Shell commands run on your machine. Be careful with commands that modify or delete files.
343
+
344
+ ---
345
+
346
+ ## 7) Session management (attach/resume and listing)
347
+
348
+ Think of sessions in two categories:
349
+ - **Attach** to a **running** task/taskId
350
+ - **Resume** a **completed/saved** task/taskId
351
+
352
+ ### List sessions/tasks
353
+ ```text
354
+ /sessions
355
+ ```
356
+
357
+ Include completed items:
358
+ ```text
359
+ /sessions --completed
360
+ ```
361
+
362
+ CSV output:
363
+ ```text
364
+ /sessions --completed --csv
365
+ ```
366
+
367
+ ### Attach to a running task
368
+ ```text
369
+ /attach
370
+ ```
371
+
372
+ Direct attach:
373
+ ```text
374
+ /attach <taskId>
375
+ ```
376
+
377
+ ### Resume a saved/completed session
378
+ Resume interactively:
379
+ ```text
380
+ /resume
381
+ ```
382
+
383
+ Resume by id:
384
+ ```text
385
+ /resume <taskId>
386
+ ```
387
+
388
+ ### View logs from attached agent
389
+ ```text
390
+ /attach <taskId>
391
+ /logs
392
+ ```
393
+
394
+ ---
395
+
396
+ ## 8) Renderers (basic, compact, fancy) and switching with `/render`
397
+
398
+ Use renderers to change how output appears in your terminal.
399
+
400
+ ### Switch renderer
401
+ ```text
402
+ /render basic
403
+ /render compact
404
+ /render fancy
405
+ ```
406
+
407
+ ### Custom renderers (if supported)
408
+ ```text
409
+ /render ./my-renderer.js
410
+ /render @my-org/knowhow-renderer
411
+ ```
412
+
413
+ **Example flow**
414
+ ```text
415
+ /render compact
416
+ Write release notes for version 1.4.2 based on these changes:
417
+ (multi-line text...)
418
+ ```
419
+
420
+ ---
421
+
422
+ ## 9) Voice input (if available)
423
+
424
+ If voice is enabled in your build, toggle voice mode with:
425
+
426
+ ```text
427
+ /voice
428
+ ```
429
+
430
+ Then speak your prompt. Knowhow will transcribe and send it into the same pipeline as typed input.
431
+
432
+ If `/voice` isn’t available, use startup flags (check `knowhow chat --help`).
433
+
434
+ ---
435
+
436
+ ## 10) Custom agents (`knowhow.json` → `agents` array)
437
+
438
+ You can define custom agents in `knowhow.json` under an `agents` array.
439
+
440
+ ### Example `knowhow.json` with custom agents
441
+
442
+ ```json
443
+ {
444
+ "agents": [
445
+ {
446
+ "name": "Patcher",
447
+ "description": "Edits code safely and provides patch-style output.",
448
+ "model": "gpt-4.1-mini",
449
+ "provider": "openai",
450
+ "tools": ["repo", "diff", "tests"],
451
+ "systemPrompt": "You are a careful code patcher. Make minimal changes, explain reasoning, and include a test plan."
452
+ },
453
+ {
454
+ "name": "Researcher",
455
+ "description": "Focuses on explanation, tradeoffs, and decision guidance.",
456
+ "model": "gpt-4.1-mini",
457
+ "provider": "openai",
458
+ "tools": ["web", "search"],
459
+ "systemPrompt": "You are a research assistant. Provide sourced tradeoffs and clear recommendations."
460
+ }
461
+ ]
462
+ }
463
+ ```
464
+
465
+ ### Use your custom agents in chat
466
+ ```text
467
+ /agents
468
+ /agent Researcher
469
+ Ask knowhow: What are the tradeoffs between approach A and approach B?
470
+ ```
471
+
472
+ > **Field names can vary by version/build.** The key requirement is that each agent has a unique **`name`** so it can be selected via `/agent <name>`.
473
+
474
+ ---
475
+
476
+ ## Practical examples
477
+
478
+ ### Example A: Switch agent + compact renderer + normal prompt
479
+ ```text
480
+ /agents
481
+ /agent Researcher
482
+ /render compact
483
+ Summarize the pros/cons of using RAG vs fine-tuning for my product.
484
+ ```
485
+
486
+ ### Example B: Multi-line spec
487
+ ```text
488
+ /multi
489
+ You are helping me design a CLI command system.
490
+
491
+ Requirements:
492
+ - Commands begin with `/`
493
+ - Support agent switching
494
+ - Include rendering and sessions
495
+
496
+ Return:
497
+ 1) Proposed architecture
498
+ 2) Command registry design
499
+ 3) Example user flows
500
+ ```
501
+
502
+ ### Example C: Run shell command and ask the AI to interpret
503
+ ```text
504
+ /!! cat ./build.log | tail -n 200
505
+ What does the failure indicate, and what is the likely fix?
506
+ ```
507
+
508
+ ### Example D: Attach to a running task and inspect logs
509
+ ```text
510
+ /sessions
511
+ /attach <taskId>
512
+ /logs 30
513
+ ```
514
+
515
+ ### Example E: Resume a completed session later
516
+ ```text
517
+ /resume <taskId>
518
+ Add a brief test plan for the next iteration.
519
+ ```
520
+
521
+ ---
522
+
523
+ ## Quick command reference
524
+
525
+ - **Start chat:** `knowhow chat`
526
+ - **List agents:** `/agents`
527
+ - **Switch agent:** `/agent <name>`
528
+ - **Multi-line input:** `/multi`
529
+ - **Renderers:** `/render basic|compact|fancy`
530
+ - **Search:** `/search` (then use `next`, `exit`, `embeddings`, `use`)
531
+ - **Sessions listing:** `/sessions [--completed] [--all] [--csv]`
532
+ - **Attach:** `/attach [taskId] [--completed]`
533
+ - **Resume:** `/resume [taskId]`
534
+ - **Attached logs:** `/logs [N]`
535
+ - **Shell:** `/!` and `/!! <command>`
536
+ - **Voice (if available):** `/voice`
537
+
538
+ ---
539
+
540
+ If you paste the actual module source files that register the `/…` commands in your environment (agent/search/sessions/shell/voice/system modules), I can turn the “known commands” above into a **fully exact** reference (including any optional flags and exact argument syntax for every subcommand).