@tyvm/knowhow 0.0.88 β†’ 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 (90) 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 +2 -2
  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/src/worker.ts +9 -7
  26. package/ts_build/package.json +2 -2
  27. package/ts_build/src/ai.js +18 -1
  28. package/ts_build/src/ai.js.map +1 -1
  29. package/ts_build/src/config.js +17 -2
  30. package/ts_build/src/config.js.map +1 -1
  31. package/ts_build/src/index.js +12 -2
  32. package/ts_build/src/index.js.map +1 -1
  33. package/ts_build/src/processors/TokenCompressor.js +2 -2
  34. package/ts_build/src/processors/TokenCompressor.js.map +1 -1
  35. package/ts_build/src/processors/ToolResponseCache.js +3 -3
  36. package/ts_build/src/processors/ToolResponseCache.js.map +1 -1
  37. package/ts_build/src/processors/tools/grepToolResponse.d.ts +3 -1
  38. package/ts_build/src/processors/tools/grepToolResponse.js +8 -2
  39. package/ts_build/src/processors/tools/grepToolResponse.js.map +1 -1
  40. package/ts_build/src/processors/tools/jqToolResponse.d.ts +3 -1
  41. package/ts_build/src/processors/tools/jqToolResponse.js +10 -4
  42. package/ts_build/src/processors/tools/jqToolResponse.js.map +1 -1
  43. package/ts_build/src/processors/tools/listStoredToolResponses.js +1 -1
  44. package/ts_build/src/processors/tools/listStoredToolResponses.js.map +1 -1
  45. package/ts_build/src/processors/tools/tailToolResponse.d.ts +3 -1
  46. package/ts_build/src/processors/tools/tailToolResponse.js +8 -2
  47. package/ts_build/src/processors/tools/tailToolResponse.js.map +1 -1
  48. package/ts_build/src/worker.js +5 -3
  49. package/ts_build/src/worker.js.map +1 -1
  50. package/autodoc/chat.mdx +0 -20
  51. package/autodoc/cli.mdx +0 -11
  52. package/autodoc/plugins/asana.mdx +0 -47
  53. package/autodoc/plugins/downloader/downloader.mdx +0 -38
  54. package/autodoc/plugins/downloader/plugin.mdx +0 -37
  55. package/autodoc/plugins/downloader/types.mdx +0 -42
  56. package/autodoc/plugins/embedding.mdx +0 -41
  57. package/autodoc/plugins/figma.mdx +0 -45
  58. package/autodoc/plugins/github.mdx +0 -40
  59. package/autodoc/plugins/jira.mdx +0 -46
  60. package/autodoc/plugins/language.mdx +0 -37
  61. package/autodoc/plugins/linear.mdx +0 -35
  62. package/autodoc/plugins/notion.mdx +0 -38
  63. package/autodoc/plugins/plugins.mdx +0 -59
  64. package/autodoc/plugins/types.mdx +0 -51
  65. package/autodoc/plugins/vim.mdx +0 -39
  66. package/autodoc/tools/addInternalTools.mdx +0 -1
  67. package/autodoc/tools/agentCall.mdx +0 -1
  68. package/autodoc/tools/asana/definitions.mdx +0 -10
  69. package/autodoc/tools/asana/index.mdx +0 -12
  70. package/autodoc/tools/askHuman.mdx +0 -1
  71. package/autodoc/tools/callPlugin.mdx +0 -1
  72. package/autodoc/tools/embeddingSearch.mdx +0 -1
  73. package/autodoc/tools/execCommand.mdx +0 -1
  74. package/autodoc/tools/fileSearch.mdx +0 -1
  75. package/autodoc/tools/finalAnswer.mdx +0 -1
  76. package/autodoc/tools/github/definitions.mdx +0 -6
  77. package/autodoc/tools/github/index.mdx +0 -8
  78. package/autodoc/tools/index.mdx +0 -14
  79. package/autodoc/tools/lintFile.mdx +0 -7
  80. package/autodoc/tools/list.mdx +0 -16
  81. package/autodoc/tools/modifyFile.mdx +0 -7
  82. package/autodoc/tools/patch.mdx +0 -9
  83. package/autodoc/tools/readBlocks.mdx +0 -1
  84. package/autodoc/tools/readFile.mdx +0 -1
  85. package/autodoc/tools/scanFile.mdx +0 -1
  86. package/autodoc/tools/textSearch.mdx +0 -6
  87. package/autodoc/tools/types/fileblock.mdx +0 -1
  88. package/autodoc/tools/visionTool.mdx +0 -1
  89. package/autodoc/tools/writeFile.mdx +0 -1
  90. package/test-comprehensive.ts +0 -31
package/CONFIG.md CHANGED
@@ -372,3 +372,55 @@ This example would load the diff of a PR every time we said "my pr"
372
372
  }
373
373
  }
374
374
  ```
375
+
376
+ ## Language Plugin triggers on file edits
377
+ in .knowhow/language.json you can trigger event driven language expansions
378
+ ```
379
+ ": any,useState<any[]>": {
380
+ "events": ["file:post-edit"],
381
+ "sources": [
382
+ {
383
+ "data": [".knowhow/prompts/any.mdx"],
384
+ "kind": "file"
385
+ }
386
+ ]
387
+ },
388
+
389
+ "packages/client/src/generated/*,@tyvm/knowhow-api-client": {
390
+ "events": ["file:pre-read"],
391
+ "sources": [
392
+ {
393
+ "data": ["./packages/frontend/.knowhow/prompts/ClientHelp.mdx"],
394
+ "kind": "file"
395
+ }
396
+ ]
397
+ },
398
+
399
+ "backend,route,controller,schema,api,server": {
400
+ "events": ["user:say"],
401
+ "sources": [
402
+ {
403
+ "kind": "file",
404
+ "data": ["./packages/backend/.knowhow/prompts/backend.mdx"]
405
+ }
406
+ ]
407
+ },
408
+
409
+ ```
410
+
411
+ ## Language Plugin commands
412
+ If you want the language plugin to run a command. Handled: true prevents the ai from seeing this output
413
+ ```
414
+ "/git": {
415
+ "events": [],
416
+ "handled": true,
417
+ "sources": [
418
+ {
419
+ "kind": "exec",
420
+ "data": [
421
+ "git status"
422
+ ]
423
+ }
424
+ ]
425
+ },
426
+ ```
package/README.md CHANGED
@@ -1,49 +1,364 @@
1
- # Knowhow
1
+ # Knowhow CLI πŸ€–
2
2
 
3
- Knowhow is a powerful tool for managing and utilizing project-specific knowledge and configurations.
3
+ Knowhow is an AI-powered CLI for generating docs, building embeddings for semantic search, and running interactive chat/agentsβ€”powered by a modular system of **plugins, agents, and a secure worker** that can expose your local tools to Knowhow Cloud.
4
4
 
5
- ## Features
5
+ [![npm version](https://img.shields.io/npm/v/@tyvm/knowhow?style=flat)](https://www.npmjs.com/package/@tyvm/knowhow)
6
+ [![npm license](https://img.shields.io/npm/l/@tyvm/knowhow?style=flat)](https://www.npmjs.com/package/@tyvm/knowhow)
6
7
 
7
- - Global configuration storage
8
- - Template management
9
- - Plugin system
10
- - Embedding generation
11
- - Custom agents
8
+ ---
12
9
 
13
- ## Global Configuration
10
+ ## πŸ“‹ Table of Contents
14
11
 
15
- Knowhow now supports a global configuration directory located at `~/.knowhow`. This directory stores global templates and configurations that can be shared across multiple projects.
12
+ 1. [πŸš€ Quickstart](#-quickstart)
13
+ 2. [πŸ’¬ knowhow chat](#-knowhow-chat)
14
+ 3. [βš™οΈ Configuration](#️-configuration)
15
+ 4. [πŸ”Œ Plugins](#-plugins)
16
+ 5. [πŸ“š Embeddings](#-embeddings)
17
+ 6. [πŸ“„ Generate Docs](#-generate-docs)
18
+ 7. [πŸ”§ Worker System](#-worker-system)
19
+ 8. [🧩 Extending Knowhow](#-extending-knowhow)
20
+ 9. [πŸ“– CLI Reference](#-cli-reference)
21
+ 10. [πŸ”— Links](#-links)
16
22
 
17
- ### Global Config Structure
23
+ ---
18
24
 
25
+ ## πŸš€ Quickstart
26
+
27
+ ### Install
28
+ ```bash
29
+ npm install -g @tyvm/knowhow
30
+ ```
31
+
32
+ ### Initialize a project (`knowhow init`)
33
+ From your project directory:
34
+ ```bash
35
+ knowhow init
36
+ ```
37
+
38
+ This creates a local `.knowhow/` workspace (config, prompts, generated docs, embeddings, language tooling, and a JWT placeholder) plus a global template directory in your home folder.
39
+
40
+ ### Login (`knowhow login`)
41
+ Knowhow authenticates to `https://knowhow.tyvm.ai` using **browser-based OAuth** (the CLI opens a browser, you approve, then it polls for approval and saves a JWT).
42
+
43
+ ```bash
44
+ knowhow login
45
+ ```
46
+
47
+ If you want to paste a token manually:
48
+ ```bash
49
+ knowhow login --jwt
50
+ ```
51
+
52
+ After login, Knowhow stores your JWT in `.knowhow/.jwt` and updates `knowhow.json` so models can route through the Knowhow proxy.
53
+
54
+ ### First steps after setup
55
+ Start the interactive chat:
56
+ ```bash
57
+ knowhow chat
58
+ ```
59
+
60
+ Or ask directly (no agent orchestration overhead):
61
+ ```bash
62
+ knowhow ask --input "What should I work on next?"
63
+ ```
64
+
65
+ You can also search embeddings:
66
+ ```bash
67
+ knowhow search --input "How do plugins work in Knowhow?"
68
+ ```
69
+
70
+ ---
71
+
72
+ ## πŸ’¬ knowhow chat
73
+
74
+ **This is the primary way to use Knowhow.** `knowhow chat` starts an interactive REPL-style loop where you type messages and use **slash commands** (`/…`) to control agents, renderers, search, sessions, and tools.
75
+
76
+ > Tip: At startup, Knowhow prints a line like `Commands: /agent, /agents, ...`β€”use it to confirm which `/…` commands your build/config exposes.
77
+
78
+ ### Start a chat session
79
+ ```bash
80
+ knowhow chat
81
+ ```
82
+
83
+ Depending on your build, you may also see flags like selecting an initial agent, renderer, or enabling voiceβ€”check:
84
+ ```bash
85
+ knowhow chat --help
86
+ ```
87
+
88
+ ### Key slash commands (quick reference)
89
+
90
+ #### Agent switching
91
+ - List configured agents:
92
+ ```text
93
+ /agents
94
+ ```
95
+ - Switch to an agent:
96
+ ```text
97
+ /agent <AgentName>
98
+ ```
99
+ Example:
100
+ ```text
101
+ /agent Patcher
102
+ ```
103
+
104
+ #### Multi-line input
105
+ ```text
106
+ /multi
107
+ ```
108
+
109
+ #### Rendering control
110
+ ```text
111
+ /render basic
112
+ /render compact
113
+ /render fancy
114
+ ```
115
+
116
+ #### Search (interactive)
117
+ ```text
118
+ /search
19
119
  ```
20
- ~/.knowhow/
21
- β”œβ”€β”€ knowhow.json
22
- └── prompts/
23
- └── [template files]
120
+
121
+ Inside `/search`, you’ll typically get sub-commands like:
122
+ - `next` β€” show next result
123
+ - `exit` β€” leave search
124
+ - `embeddings` β€” list available embedding scopes
125
+ - `use` β€” choose which embedding scope(s) to search
126
+
127
+ #### Sessions (attach / resume / logs)
128
+ - List sessions:
129
+ ```text
130
+ /sessions
131
+ /sessions --completed
132
+ /sessions --completed --csv
133
+ ```
134
+ - Attach to a running task:
135
+ ```text
136
+ /attach
137
+ /attach <taskId>
138
+ ```
139
+ - Resume a completed/saved session:
140
+ ```text
141
+ /resume
142
+ /resume <taskId>
143
+ ```
144
+ - View recent attached logs:
145
+ ```text
146
+ /logs
147
+ /logs 50
148
+ ```
149
+
150
+ Attached-mode controls (if your agent module supports them):
151
+ ```text
152
+ /pause
153
+ /unpause
154
+ /kill
155
+ /detach
156
+ /done
24
157
  ```
25
158
 
26
- - `knowhow.json`: Global configuration file
27
- - `prompts/`: Directory containing global template files
159
+ #### Shell commands (agent context via your machine)
160
+ - Interactive shell (if enabled):
161
+ ```text
162
+ /!
163
+ ```
164
+ - Run command and send output to the AI:
165
+ ```text
166
+ /!! <command>
167
+ ```
168
+ Example:
169
+ ```text
170
+ /!! cat ./build.log | tail -n 200
171
+ ```
172
+
173
+ #### Voice (if available)
174
+ ```text
175
+ /voice
176
+ ```
177
+
178
+ ### Switching agents (the β€œfast path”)
179
+ A typical workflow:
180
+ ```text
181
+ /agents
182
+ /agent Researcher
183
+ Summarize the pros/cons of using RAG vs fine-tuning...
184
+ ```
185
+
186
+ ---
187
+
188
+ ## βš™οΈ Configuration
189
+
190
+ Knowhow reads your project configuration from:
191
+
192
+ - **`.knowhow/knowhow.json`** (local)
193
+ - **`~/.knowhow/knowhow.json`** (global)
194
+
195
+ `knowhow.json` controls:
196
+ - **plugins** (enabled/disabled)
197
+ - **sources** (the docs generation pipeline)
198
+ - **embedSources** (the embeddings pipeline)
199
+ - model/agent wiring
200
+ - **worker** settings and sandbox/security options
201
+ - language tooling setup directory (`.knowhow/language.json`), etc.
202
+
203
+ Full reference: [`autodoc/config-reference.md`](autodoc/config-reference.md)
204
+
205
+ ---
206
+
207
+ ## πŸ”Œ Plugins
208
+
209
+ Plugins are modular capability blocks that enrich agent sessions with:
210
+ - additional context sources (files, URLs, GitHub/Jira/etc.)
211
+ - semantic retrieval via embeddings
212
+ - editor/session context (vim/tmux)
213
+ - post-edit tooling (linter)
214
+ - command execution for context (`exec`, powerfulβ€”use carefully)
215
+
216
+ ### Built-in plugins (by key)
217
+ `language`, `vim`, `embeddings`, `github`, `git`, `asana`, `jira`, `linear`, `figma`, `notion`, `download`, `url`, `linter`, `tmux`, `agents-md`, `exec`, `skills`
218
+
219
+ Full guide: [`autodoc/plugins-guide.md`](autodoc/plugins-guide.md)
220
+
221
+ ### ⭐ Killer feature: Language Plugin (hotwords β†’ injected context)
222
+
223
+ The **Language Plugin** lets you define hotwords/terms (in `.knowhow/language.json`). When you type a term like `API` or `frontend`, Knowhow automatically injects the relevant local files/text into your chat context.
224
+
225
+ Example (`.knowhow/language.json`):
226
+ ```json
227
+ {
228
+ "API, apis, api documentation": {
229
+ "sources": [
230
+ { "kind": "file", "data": ["docs/api/**/*.md", "specs/openapi*.{json,yaml}"] },
231
+ {
232
+ "kind": "text",
233
+ "data": "API answering guidelines:\n- include request/response notes\n- call out auth + errors\n- mention rate limits/pagination\n"
234
+ }
235
+ ]
236
+ }
237
+ }
238
+ ```
239
+
240
+ Then in chat:
241
+ ```text
242
+ Ask: What’s the contract for POST /sessions and what errors can it return?
243
+ ```
244
+
245
+ If your term matches, the plugin injects your configured API docs automatically.
246
+
247
+ ---
248
+
249
+ ## πŸ“š Embeddings
250
+
251
+ Knowhow builds vector embeddings for semantic search.
252
+
253
+ ### Generate embeddings
254
+ ```bash
255
+ knowhow embed
256
+ ```
257
+
258
+ This runs over `embedSources` in `knowhow.json` and writes local embeddings JSON artifacts under paths like `.knowhow/embeddings/`.
259
+
260
+ ### Upload embeddings to Knowhow Cloud (or other backends)
261
+ ```bash
262
+ knowhow upload
263
+ ```
264
+
265
+ Supported flows (from `embedSources.remoteType`):
266
+ - `s3`: uploads to `s3://{bucketName}/{embeddingName}.json`
267
+ - `knowhow`: uses Knowhow API presigned URLs and syncs embedding metadata back to the backend (requires `remoteId`)
268
+
269
+ ### Download embeddings
270
+ ```bash
271
+ knowhow download
272
+ ```
273
+
274
+ Downloads embedding JSON artifacts into your configured `embedSources[].output` from:
275
+ - `s3`, `github`, and `knowhow` (when `remoteId` is set)
276
+
277
+ Full guide: [`autodoc/embeddings-guide.md`](autodoc/embeddings-guide.md)
278
+
279
+ ---
280
+
281
+ ## πŸ“„ Generate Docs
282
+
283
+ Docs generation is driven entirely by your local **`config.sources`** pipeline in `.knowhow/knowhow.json`.
284
+
285
+ ### Run the generator
286
+ ```bash
287
+ knowhow generate
288
+ ```
289
+
290
+ High-level behavior:
291
+ - expands `sources[].input` into matching files
292
+ - resolves `sources[].prompt` from `.knowhow/prompts/` (or uses prompt file / inline prompt)
293
+ - writes results to `sources[].output`
294
+ - skips unchanged inputs using hash-based caching tracked in `.knowhow/.hashes.json`
295
+
296
+ Full guide: [`autodoc/generate-guide.md`](autodoc/generate-guide.md)
297
+
298
+ ---
299
+
300
+ ## πŸ”§ Worker System
301
+
302
+ The **Knowhow worker** is how you safely expose your **local machine** to AI agents running on `knowhow.tyvm.ai`.
303
+
304
+ It:
305
+ - runs a local MCP-over-WebSocket server
306
+ - connects to Knowhow Cloud
307
+ - advertises only the tools you allow (via `worker.allowedTools`)
308
+ - optionally runs tool execution in isolation (Docker sandbox) and/or requires passkeys to unlock
309
+
310
+ ### Start a worker
311
+ ```bash
312
+ knowhow worker
313
+ ```
314
+
315
+ ### Security model
316
+ - **Docker sandbox mode**: run the worker in a Docker container for tool isolation (`--sandbox` or `worker.sandbox: true`)
317
+ - **Passkey-gated locked worker**: when passkey auth is configured, the worker starts **locked** and blocks tool calls until you unlock using the passkey flow
318
+
319
+ ### Allowed tools (recommended flow)
320
+ On first run, if `worker.allowedTools` is missing, Knowhow auto-populates it from the available tool registry, writes it back into `.knowhow/knowhow.json`, and exits early so you can review/tighten your allowlist.
321
+
322
+ ### Share / unshare
323
+ - `knowhow worker --share` / `--unshare` controls whether it’s visible to your organization (via request header)
324
+
325
+ ### Optional tunnel (config-driven)
326
+ When `worker.tunnel.enabled === true`, the worker may forward allowed ports to your local services for cloud-side reachability.
327
+
328
+ Full guide: [`autodoc/worker-guide.md`](autodoc/worker-guide.md)
329
+
330
+ ---
331
+
332
+ ## 🧩 Extending Knowhow
333
+
334
+ Want more than the built-ins? Knowhow supports extension through **modules** and reusable instruction assets through **skills**.
28
335
 
29
- ### Initialization Process
336
+ ### Modules (tools, agents, plugins, commands)
337
+ Modules are dynamically loaded npm packages (or local files) that can register:
338
+ - **tools** (tool-calling)
339
+ - **agents**
340
+ - **plugins**
341
+ - **commands** (chat-loop extensions)
342
+ - optional `init()` setup
30
343
 
31
- When initializing a new Knowhow project:
344
+ Guide: [`autodoc/modules-guide.md`](autodoc/modules-guide.md)
32
345
 
33
- 1. The global config directory is created if it doesn't exist.
34
- 2. Global templates are checked first and copied to the local project.
35
- 3. If a template doesn't exist globally, it's created both globally and locally.
346
+ ### Skills (SKILL.md β†’ injected instructions)
347
+ Skills are stored as `SKILL.md` files with frontmatter at the top (`name`, `description`). When your prompt contains a skill name (substring match), Knowhow injects the full `SKILL.md` content into the agent context.
36
348
 
37
- This ensures consistency across projects while allowing for project-specific customizations.
349
+ Guide: [`autodoc/skills-guide.md`](autodoc/skills-guide.md)
38
350
 
39
- ## Usage
351
+ ---
40
352
 
41
- [Add usage instructions here]
353
+ ## πŸ“– CLI Reference
42
354
 
43
- ## Contributing
355
+ For command usage and behavior details, see:
356
+ [`autodoc/cli-reference.md`](autodoc/cli-reference.md)
44
357
 
45
- [Add contribution guidelines here]
358
+ ---
46
359
 
47
- ## License
360
+ ## πŸ”— Links
48
361
 
49
- [Add license information here]
362
+ - Website: https://knowhow.tyvm.ai
363
+ - Twitter/X: https://x.com/micahriggan
364
+ - npm: https://www.npmjs.com/package/@tyvm/knowhow