@tyvm/knowhow 0.0.89 → 0.0.91
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.
- package/.depcheckrc +31 -0
- package/CONFIG.md +52 -0
- package/README.md +344 -29
- package/WORKER.md +169 -334
- package/autodoc/chat-guide.md +540 -0
- package/autodoc/cli-reference.md +765 -0
- package/autodoc/config-reference.md +541 -0
- package/autodoc/embeddings-guide.md +566 -0
- package/autodoc/generate-guide.md +477 -0
- package/autodoc/language-plugin-guide.md +443 -0
- package/autodoc/modules-guide.md +352 -0
- package/autodoc/plugins-guide.md +720 -0
- package/autodoc/quickstart-guide.md +129 -0
- package/autodoc/skills-guide.md +468 -0
- package/autodoc/worker-guide.md +526 -0
- package/bin/knowhow.js +1 -1
- package/package.json +4 -32
- package/src/agents/tools/executeScript/index.ts +5 -0
- package/src/agents/tools/googleSearch.ts +2 -2
- package/src/agents/tools/index.ts +0 -3
- package/src/agents/tools/list.ts +0 -147
- package/src/agents/tools/loadWebpage.ts +3 -113
- package/src/ai.ts +33 -2
- package/src/auth/browserLogin.ts +10 -13
- package/src/cli.ts +63 -3
- package/src/clients/gemini.ts +96 -25
- package/src/clients/http.ts +7 -11
- package/src/clients/pricing/google.ts +122 -26
- package/src/config.ts +28 -4
- package/src/conversion.ts +24 -54
- package/src/index.ts +30 -3
- package/src/login.ts +5 -6
- package/src/plugins/language.ts +0 -4
- package/src/plugins/plugins.ts +0 -14
- package/src/plugins/url.ts +31 -12
- package/src/processors/TokenCompressor.ts +2 -2
- package/src/processors/ToolResponseCache.ts +3 -3
- package/src/processors/tools/grepToolResponse.ts +9 -4
- package/src/processors/tools/jqToolResponse.ts +11 -6
- package/src/processors/tools/listStoredToolResponses.ts +1 -1
- package/src/processors/tools/tailToolResponse.ts +9 -4
- package/src/services/GitHub.ts +2 -2
- package/src/services/KnowhowClient.ts +34 -34
- package/src/{plugins/downloader/downloader.ts → services/MediaProcessorService.ts} +109 -267
- package/src/services/S3.ts +16 -16
- package/src/services/index.ts +4 -4
- package/src/services/modules/index.ts +10 -2
- package/src/services/modules/types.ts +5 -2
- package/src/services/script-execution/ScriptExecutor.ts +29 -10
- package/src/services/script-execution/ScriptPolicy.ts +6 -2
- package/src/types.ts +1 -0
- package/src/utils/http.ts +127 -0
- package/src/workers/auth/PasskeySetup.ts +7 -11
- package/tests/clients/AIClient.test.ts +24 -21
- package/tests/manual/file-edits/figma.test.ts +3 -70
- package/tests/plugins/language/languagePlugin-content-triggers.test.ts +2 -0
- package/tests/plugins/language/languagePlugin.test.ts +2 -0
- package/tests/processors/ToolResponseCache.test.ts +2 -2
- package/tests/test.spec.ts +0 -14
- package/tests/unit/modules/moduleLoading.test.ts +7 -4
- package/tests/unit/plugins/pluginLoading.test.ts +6 -6
- package/ts_build/package.json +4 -32
- package/ts_build/src/agents/tools/ast/astAppendNode.d.ts +1 -1
- package/ts_build/src/agents/tools/ast/astAppendNode.js +2 -90
- package/ts_build/src/agents/tools/ast/astAppendNode.js.map +1 -1
- package/ts_build/src/agents/tools/ast/astDeleteNode.d.ts +1 -1
- package/ts_build/src/agents/tools/ast/astDeleteNode.js +2 -88
- package/ts_build/src/agents/tools/ast/astDeleteNode.js.map +1 -1
- package/ts_build/src/agents/tools/ast/astEditNode.d.ts +1 -1
- package/ts_build/src/agents/tools/ast/astEditNode.js +2 -90
- package/ts_build/src/agents/tools/ast/astEditNode.js.map +1 -1
- package/ts_build/src/agents/tools/ast/astGetPathForLine.d.ts +1 -1
- package/ts_build/src/agents/tools/ast/astGetPathForLine.js +2 -72
- package/ts_build/src/agents/tools/ast/astGetPathForLine.js.map +1 -1
- package/ts_build/src/agents/tools/ast/astListPaths.d.ts +1 -1
- package/ts_build/src/agents/tools/ast/astListPaths.js +2 -72
- package/ts_build/src/agents/tools/ast/astListPaths.js.map +1 -1
- package/ts_build/src/agents/tools/executeScript/index.d.ts +3 -2
- package/ts_build/src/agents/tools/executeScript/index.js +4 -1
- package/ts_build/src/agents/tools/executeScript/index.js.map +1 -1
- package/ts_build/src/agents/tools/googleSearch.js +2 -2
- package/ts_build/src/agents/tools/googleSearch.js.map +1 -1
- package/ts_build/src/agents/tools/index.d.ts +0 -3
- package/ts_build/src/agents/tools/index.js +0 -3
- package/ts_build/src/agents/tools/index.js.map +1 -1
- package/ts_build/src/agents/tools/list.js +0 -138
- package/ts_build/src/agents/tools/list.js.map +1 -1
- package/ts_build/src/agents/tools/loadWebpage.js +1 -89
- package/ts_build/src/agents/tools/loadWebpage.js.map +1 -1
- package/ts_build/src/agents/tools/textSearch.d.ts +1 -1
- package/ts_build/src/ai.js +18 -1
- package/ts_build/src/ai.js.map +1 -1
- package/ts_build/src/auth/browserLogin.js +7 -7
- package/ts_build/src/auth/browserLogin.js.map +1 -1
- package/ts_build/src/cli.d.ts +1 -1
- package/ts_build/src/cli.js +47 -1
- package/ts_build/src/cli.js.map +1 -1
- package/ts_build/src/clients/gemini.d.ts +1 -73
- package/ts_build/src/clients/gemini.js +57 -19
- package/ts_build/src/clients/gemini.js.map +1 -1
- package/ts_build/src/clients/http.js +5 -9
- package/ts_build/src/clients/http.js.map +1 -1
- package/ts_build/src/clients/pricing/google.d.ts +17 -73
- package/ts_build/src/clients/pricing/google.js +47 -10
- package/ts_build/src/clients/pricing/google.js.map +1 -1
- package/ts_build/src/config.js +17 -2
- package/ts_build/src/config.js.map +1 -1
- package/ts_build/src/conversion.d.ts +1 -4
- package/ts_build/src/conversion.js +12 -27
- package/ts_build/src/conversion.js.map +1 -1
- package/ts_build/src/index.d.ts +4 -0
- package/ts_build/src/index.js +19 -3
- package/ts_build/src/index.js.map +1 -1
- package/ts_build/src/login.js +5 -4
- package/ts_build/src/login.js.map +1 -1
- package/ts_build/src/plugins/downloader/downloader.js +3 -3
- package/ts_build/src/plugins/downloader/downloader.js.map +1 -1
- package/ts_build/src/plugins/language.js.map +1 -1
- package/ts_build/src/plugins/plugins.js +0 -14
- package/ts_build/src/plugins/plugins.js.map +1 -1
- package/ts_build/src/plugins/tree-sitter/editor.d.ts +3 -32
- package/ts_build/src/plugins/tree-sitter/editor.js +6 -208
- package/ts_build/src/plugins/tree-sitter/editor.js.map +1 -1
- package/ts_build/src/plugins/tree-sitter/parser.d.ts +19 -54
- package/ts_build/src/plugins/tree-sitter/parser.js +19 -293
- package/ts_build/src/plugins/tree-sitter/parser.js.map +1 -1
- package/ts_build/src/plugins/tree-sitter/simple-paths.d.ts +2 -15
- package/ts_build/src/plugins/tree-sitter/simple-paths.js +2 -324
- package/ts_build/src/plugins/tree-sitter/simple-paths.js.map +1 -1
- package/ts_build/src/plugins/url.js +27 -8
- package/ts_build/src/plugins/url.js.map +1 -1
- package/ts_build/src/processors/TokenCompressor.js +2 -2
- package/ts_build/src/processors/TokenCompressor.js.map +1 -1
- package/ts_build/src/processors/ToolResponseCache.js +3 -3
- package/ts_build/src/processors/ToolResponseCache.js.map +1 -1
- package/ts_build/src/processors/tools/grepToolResponse.d.ts +3 -1
- package/ts_build/src/processors/tools/grepToolResponse.js +8 -2
- package/ts_build/src/processors/tools/grepToolResponse.js.map +1 -1
- package/ts_build/src/processors/tools/jqToolResponse.d.ts +3 -1
- package/ts_build/src/processors/tools/jqToolResponse.js +10 -4
- package/ts_build/src/processors/tools/jqToolResponse.js.map +1 -1
- package/ts_build/src/processors/tools/listStoredToolResponses.js +1 -1
- package/ts_build/src/processors/tools/listStoredToolResponses.js.map +1 -1
- package/ts_build/src/processors/tools/tailToolResponse.d.ts +3 -1
- package/ts_build/src/processors/tools/tailToolResponse.js +8 -2
- package/ts_build/src/processors/tools/tailToolResponse.js.map +1 -1
- package/ts_build/src/services/GitHub.js +2 -2
- package/ts_build/src/services/GitHub.js.map +1 -1
- package/ts_build/src/services/KnowhowClient.d.ts +29 -29
- package/ts_build/src/services/KnowhowClient.js +33 -33
- package/ts_build/src/services/KnowhowClient.js.map +1 -1
- package/ts_build/src/services/MediaProcessorService.d.ts +22 -0
- package/ts_build/src/services/MediaProcessorService.js +215 -0
- package/ts_build/src/services/MediaProcessorService.js.map +1 -0
- package/ts_build/src/services/S3.js +12 -18
- package/ts_build/src/services/S3.js.map +1 -1
- package/ts_build/src/services/index.d.ts +3 -2
- package/ts_build/src/services/index.js +3 -3
- package/ts_build/src/services/index.js.map +1 -1
- package/ts_build/src/services/modules/index.js +10 -2
- package/ts_build/src/services/modules/index.js.map +1 -1
- package/ts_build/src/services/modules/types.d.ts +5 -2
- package/ts_build/src/services/script-execution/ScriptExecutor.js +22 -7
- package/ts_build/src/services/script-execution/ScriptExecutor.js.map +1 -1
- package/ts_build/src/services/script-execution/ScriptPolicy.d.ts +1 -1
- package/ts_build/src/services/script-execution/ScriptPolicy.js +4 -2
- package/ts_build/src/services/script-execution/ScriptPolicy.js.map +1 -1
- package/ts_build/src/types.d.ts +1 -0
- package/ts_build/src/types.js +1 -0
- package/ts_build/src/types.js.map +1 -1
- package/ts_build/src/utils/http.d.ts +27 -0
- package/ts_build/src/utils/http.js +98 -0
- package/ts_build/src/utils/http.js.map +1 -0
- package/ts_build/src/workers/auth/PasskeySetup.js +6 -7
- package/ts_build/src/workers/auth/PasskeySetup.js.map +1 -1
- package/ts_build/tests/clients/AIClient.test.js +11 -14
- package/ts_build/tests/clients/AIClient.test.js.map +1 -1
- package/ts_build/tests/manual/file-edits/figma.test.d.ts +0 -1
- package/ts_build/tests/manual/file-edits/figma.test.js +1 -46
- package/ts_build/tests/manual/file-edits/figma.test.js.map +1 -1
- package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js +2 -0
- package/ts_build/tests/plugins/language/languagePlugin-content-triggers.test.js.map +1 -1
- package/ts_build/tests/plugins/language/languagePlugin.test.js +2 -0
- package/ts_build/tests/plugins/language/languagePlugin.test.js.map +1 -1
- package/ts_build/tests/processors/ToolResponseCache.test.js +2 -2
- package/ts_build/tests/processors/ToolResponseCache.test.js.map +1 -1
- package/ts_build/tests/test.spec.js +0 -14
- package/ts_build/tests/test.spec.js.map +1 -1
- package/ts_build/tests/tree-sitter/tree-sitter.test.d.ts +0 -1
- package/ts_build/tests/tree-sitter/tree-sitter.test.js +2 -183
- package/ts_build/tests/tree-sitter/tree-sitter.test.js.map +1 -1
- package/ts_build/tests/unit/modules/moduleLoading.test.js +6 -4
- package/ts_build/tests/unit/modules/moduleLoading.test.js.map +1 -1
- package/ts_build/tests/unit/plugins/pluginLoading.test.js +4 -4
- package/ts_build/tests/unit/plugins/pluginLoading.test.js.map +1 -1
- package/autodoc/chat.mdx +0 -20
- package/autodoc/cli.mdx +0 -11
- package/autodoc/plugins/asana.mdx +0 -47
- package/autodoc/plugins/downloader/downloader.mdx +0 -38
- package/autodoc/plugins/downloader/plugin.mdx +0 -37
- package/autodoc/plugins/downloader/types.mdx +0 -42
- package/autodoc/plugins/embedding.mdx +0 -41
- package/autodoc/plugins/figma.mdx +0 -45
- package/autodoc/plugins/github.mdx +0 -40
- package/autodoc/plugins/jira.mdx +0 -46
- package/autodoc/plugins/language.mdx +0 -37
- package/autodoc/plugins/linear.mdx +0 -35
- package/autodoc/plugins/notion.mdx +0 -38
- package/autodoc/plugins/plugins.mdx +0 -59
- package/autodoc/plugins/types.mdx +0 -51
- package/autodoc/plugins/vim.mdx +0 -39
- package/autodoc/tools/addInternalTools.mdx +0 -1
- package/autodoc/tools/agentCall.mdx +0 -1
- package/autodoc/tools/asana/definitions.mdx +0 -10
- package/autodoc/tools/asana/index.mdx +0 -12
- package/autodoc/tools/askHuman.mdx +0 -1
- package/autodoc/tools/callPlugin.mdx +0 -1
- package/autodoc/tools/embeddingSearch.mdx +0 -1
- package/autodoc/tools/execCommand.mdx +0 -1
- package/autodoc/tools/fileSearch.mdx +0 -1
- package/autodoc/tools/finalAnswer.mdx +0 -1
- package/autodoc/tools/github/definitions.mdx +0 -6
- package/autodoc/tools/github/index.mdx +0 -8
- package/autodoc/tools/index.mdx +0 -14
- package/autodoc/tools/lintFile.mdx +0 -7
- package/autodoc/tools/list.mdx +0 -16
- package/autodoc/tools/modifyFile.mdx +0 -7
- package/autodoc/tools/patch.mdx +0 -9
- package/autodoc/tools/readBlocks.mdx +0 -1
- package/autodoc/tools/readFile.mdx +0 -1
- package/autodoc/tools/scanFile.mdx +0 -1
- package/autodoc/tools/textSearch.mdx +0 -6
- package/autodoc/tools/types/fileblock.mdx +0 -1
- package/autodoc/tools/visionTool.mdx +0 -1
- package/autodoc/tools/writeFile.mdx +0 -1
- package/benchmarks/.dockerignore +0 -7
- package/benchmarks/README.md +0 -166
- package/benchmarks/docker/Dockerfile +0 -68
- package/benchmarks/example-config.yml +0 -27
- package/benchmarks/jest.config.js +0 -13
- package/benchmarks/package-lock.json +0 -4297
- package/benchmarks/package.json +0 -39
- package/benchmarks/results/27b0a06/2025-09-27/xai/xai-grok-code-fast-1.json +0 -2909
- package/benchmarks/results/4057aed/2025-08-14/anthropic/anthropic-claude-sonnet-4-20250514.json +0 -1671
- package/benchmarks/results/4542435/2025-08-05/lms/lms-openai-gpt-oss-20b.json +0 -2814
- package/benchmarks/results/4542435/2025-08-05/lms/lms-qwen-qwen3-30b-a3b-2507.json +0 -2014
- package/benchmarks/results/4fb9125/2025-08-07/anthropic/anthropic-claude-sonnet-4-20250514.json +0 -3121
- package/benchmarks/results/5766aee/2025-08-02/lms-qwen/qwen3-coder-30b.json +0 -98
- package/benchmarks/results/6d73808/2025-08-07/openai/openai-gpt-5.json +0 -3256
- package/benchmarks/results/77bf0a6/2025-08-02/lms-qwen/qwen3-30b-a3b-2507.json +0 -4298
- package/benchmarks/results/8c0d445/2025-08-03/anthropic/anthropic-claude-sonnet-4-20250514.json +0 -3031
- package/benchmarks/results/8c0d445/2025-08-03/openai/openai-gpt-4.1-2025-04-14.json +0 -2990
- package/benchmarks/results/ac6b2ab/2025-08-03/anthropic/anthropic-claude-sonnet-4-20250514.json +0 -3256
- package/benchmarks/results/ac6b2ab/2025-08-03/lms/lms-qwen-qwen3-coder-30b.json +0 -3007
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-2025-04-14.json +0 -3256
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-mini-2025-04-14.json +0 -3036
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-nano-2025-04-14.json +0 -3280
- package/benchmarks/results/adff675/2025-08-04/lms/lms-qwen-qwen3-30b-a3b-2507.json +0 -1920
- package/benchmarks/results/adff675/2025-08-04/lms/lms-qwen-qwen3-coder-30b.json +0 -3281
- package/benchmarks/results/b502ed9/2025-08-03/lms-qwen/qwen3-coder-30b.json +0 -2896
- package/benchmarks/results/d1a8129/2025-08-03/lms/lms-qwen-qwen3-coder-30b.json +0 -3011
- package/benchmarks/results/e60471c/2025-08-03/lms/qwen3-30b-a3b-2507.json +0 -3003
- package/benchmarks/scripts/build-and-run.sh +0 -47
- package/benchmarks/scripts/clone-exercism.sh +0 -92
- package/benchmarks/scripts/validate.sh +0 -48
- package/benchmarks/src/__tests__/runner.test.ts +0 -27
- package/benchmarks/src/cli.ts +0 -90
- package/benchmarks/src/evaluators/EvaluatorRegistry.ts +0 -64
- package/benchmarks/src/evaluators/JavaScriptEvaluator.ts +0 -183
- package/benchmarks/src/evaluators/index.ts +0 -3
- package/benchmarks/src/evaluators/types.ts +0 -22
- package/benchmarks/src/index.ts +0 -3
- package/benchmarks/src/providers.ts +0 -13
- package/benchmarks/src/runner.ts +0 -824
- package/benchmarks/src/types.ts +0 -63
- package/benchmarks/tsconfig.json +0 -19
- package/leaderboard/README.md +0 -148
- package/leaderboard/app/api/benchmark-data/route.ts +0 -131
- package/leaderboard/app/api/benchmark-detail/route.ts +0 -172
- package/leaderboard/app/details/[model]/[provider]/[language]/page.tsx +0 -501
- package/leaderboard/app/exercise/[model]/[provider]/[language]/[exercise]/page.tsx +0 -375
- package/leaderboard/app/globals.css +0 -27
- package/leaderboard/app/layout.tsx +0 -21
- package/leaderboard/app/page.tsx +0 -170
- package/leaderboard/components/LeaderboardTable.tsx +0 -168
- package/leaderboard/components/PerformanceChart.tsx +0 -109
- package/leaderboard/next-env.d.ts +0 -5
- package/leaderboard/next.config.js +0 -4
- package/leaderboard/package-lock.json +0 -6363
- package/leaderboard/package.json +0 -28
- package/leaderboard/postcss.config.js +0 -6
- package/leaderboard/tailwind.config.js +0 -17
- package/leaderboard/tsconfig.json +0 -28
- package/leaderboard/types/benchmark.ts +0 -67
- package/leaderboard/utils/dataProcessor.ts +0 -33
- package/src/agents/tools/asana/definitions.ts +0 -199
- package/src/agents/tools/asana/index.ts +0 -108
- package/src/agents/tools/ast/astAppendNode.ts +0 -90
- package/src/agents/tools/ast/astDeleteNode.ts +0 -88
- package/src/agents/tools/ast/astEditNode.ts +0 -95
- package/src/agents/tools/ast/astGetPathForLine.ts +0 -73
- package/src/agents/tools/ast/astListPaths.ts +0 -66
- package/src/agents/tools/ast/index.ts +0 -7
- package/src/agents/tools/github/definitions.ts +0 -89
- package/src/agents/tools/github/index.ts +0 -67
- package/src/chat-old.ts +0 -446
- package/src/plugins/asana.ts +0 -146
- package/src/plugins/downloader/plugin.ts +0 -103
- package/src/plugins/downloader/types.ts +0 -92
- package/src/plugins/figma.ts +0 -158
- package/src/plugins/github.ts +0 -219
- package/src/plugins/jira.ts +0 -115
- package/src/plugins/linear.ts +0 -230
- package/src/plugins/notion.ts +0 -179
- package/src/plugins/tree-sitter/editor.ts +0 -369
- package/src/plugins/tree-sitter/lang-packs/index.ts +0 -23
- package/src/plugins/tree-sitter/lang-packs/java.ts +0 -59
- package/src/plugins/tree-sitter/lang-packs/javascript.ts +0 -57
- package/src/plugins/tree-sitter/lang-packs/python.ts +0 -45
- package/src/plugins/tree-sitter/lang-packs/types.ts +0 -79
- package/src/plugins/tree-sitter/lang-packs/typescript.ts +0 -49
- package/src/plugins/tree-sitter/parser.ts +0 -470
- package/src/plugins/tree-sitter/simple-paths.ts +0 -467
- package/test-comprehensive.ts +0 -31
- package/tests/tree-sitter/editor.test.ts +0 -113
- package/tests/tree-sitter/invalid.test.ts +0 -299
- package/tests/tree-sitter/paths/common-edits.test.ts +0 -564
- package/tests/tree-sitter/paths/debug-exact-position.test.ts +0 -44
- package/tests/tree-sitter/paths/debug-line-indexing.test.ts +0 -49
- package/tests/tree-sitter/paths/debug-paths.test.ts +0 -90
- package/tests/tree-sitter/paths/paths.test.ts +0 -170
- package/tests/tree-sitter/paths/simple-paths.test.ts +0 -367
- package/tests/tree-sitter/sample-after.ts +0 -48
- package/tests/tree-sitter/sample-before.ts +0 -25
- package/tests/tree-sitter/test-files/completely-broken.ts +0 -7
- package/tests/tree-sitter/test-files/duplicate-braces.ts +0 -39
- package/tests/tree-sitter/test-files/invalid-nesting.ts +0 -39
- package/tests/tree-sitter/test-files/malformed-signature.ts +0 -39
- package/tests/tree-sitter/test-files/mismatched-parens.ts +0 -39
- package/tests/tree-sitter/test-files/missing-semicolon.ts +0 -39
- package/tests/tree-sitter/test-files/partially-broken.ts +0 -20
- package/tests/tree-sitter/test-files/specific-errors.ts +0 -14
- package/tests/tree-sitter/test-files/unclosed-string.ts +0 -39
- package/tests/tree-sitter/tree-sitter.test.ts +0 -251
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
# Language Plugin Guide (Knowhow CLI)
|
|
2
|
+
|
|
3
|
+
The **Language Plugin** is one of the most powerful features of Knowhow. It lets you define custom **hotwords / terms** (like `frontend`, `backend`, `my PR`, `API`, `prod`) that automatically **inject context** into your chat sessions whenever you use those terms—pulling in **files, inline text, GitHub content, and URLs**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1) What the Language Plugin does
|
|
8
|
+
|
|
9
|
+
When you send a message (or when certain file events occur), the Language Plugin:
|
|
10
|
+
|
|
11
|
+
1. Loads your term configuration from **`.knowhow/language.json`**
|
|
12
|
+
2. Finds which configured **term keys/patterns** match your input
|
|
13
|
+
3. Expands each matching term into one or more **sources**:
|
|
14
|
+
- file contents from disk
|
|
15
|
+
- raw inline text
|
|
16
|
+
- GitHub PR/issue/file content
|
|
17
|
+
- content fetched from a URL
|
|
18
|
+
4. Injects the loaded context into the session so your agent can answer using your real project/docs.
|
|
19
|
+
|
|
20
|
+
**In short:** typing a term like `API` can automatically attach your local API docs/specs—no copy/paste required.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2) Configuration file: `.knowhow/language.json`
|
|
25
|
+
|
|
26
|
+
Create or edit this file in your project:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
./.knowhow/language.json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Example structure
|
|
33
|
+
|
|
34
|
+
```jsonc
|
|
35
|
+
{
|
|
36
|
+
"term-or-pattern-key": {
|
|
37
|
+
"sources": [
|
|
38
|
+
{ "kind": "file", "data": ["glob-or-path-1", "glob-or-path-2"] },
|
|
39
|
+
{ "kind": "text", "data": "Inline raw text to inject" },
|
|
40
|
+
{ "kind": "github","data": ["github input payload(s)"] },
|
|
41
|
+
{ "kind": "url", "data": ["https://example.com/..."] }
|
|
42
|
+
],
|
|
43
|
+
"events": ["file:open", "file:save"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Required fields
|
|
49
|
+
- **`sources`**: an array of source entries, each with:
|
|
50
|
+
- **`kind`**: one of `file`, `text`, `github`, `url`
|
|
51
|
+
- **`data`**: varies by kind (see section 4)
|
|
52
|
+
|
|
53
|
+
### Optional fields
|
|
54
|
+
- **`events`**: an array of event names (commonly file events).
|
|
55
|
+
When present, the term is considered for **event-driven triggers** based on the file operation type.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 3) Term matching (comma-separated keys + glob/wildcard matching)
|
|
60
|
+
|
|
61
|
+
### Comma-separated keys = multiple match patterns
|
|
62
|
+
|
|
63
|
+
A single top-level JSON key can represent multiple patterns:
|
|
64
|
+
|
|
65
|
+
```jsonc
|
|
66
|
+
{
|
|
67
|
+
"frontend, ui, web": {
|
|
68
|
+
"sources": [ /* ... */ ]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This means any of these can trigger the same term expansion:
|
|
74
|
+
- `frontend`
|
|
75
|
+
- `ui`
|
|
76
|
+
- `web`
|
|
77
|
+
|
|
78
|
+
### Matching behavior for generic prompt text
|
|
79
|
+
|
|
80
|
+
For normal chat input matching:
|
|
81
|
+
|
|
82
|
+
- If a pattern contains `*`, Knowhow treats it as a **glob/wildcard pattern**
|
|
83
|
+
- matching is performed with glob logic (e.g., via `minimatch`)
|
|
84
|
+
- Otherwise, Knowhow performs **case-insensitive substring** matching:
|
|
85
|
+
- `userPrompt.toLowerCase().includes(pattern.toLowerCase())`
|
|
86
|
+
|
|
87
|
+
**Implication:**
|
|
88
|
+
- Use `*` for families like `api*`, `payment*`, `spec-*`
|
|
89
|
+
- Use plain words for hotphrases like `API`, `prod`, `staging`
|
|
90
|
+
|
|
91
|
+
### Matching behavior for file open/save events
|
|
92
|
+
|
|
93
|
+
For event-driven matching (file open/save), Knowhow checks patterns against the file:
|
|
94
|
+
|
|
95
|
+
- It only considers terms whose config includes the event type in **`events`**
|
|
96
|
+
- For each pattern in the comma-separated key:
|
|
97
|
+
- Match if `minimatch(filePath, pattern)` succeeds **(path glob match)**
|
|
98
|
+
**OR**
|
|
99
|
+
- Match if the file contents contain the pattern (case-insensitive substring match)
|
|
100
|
+
|
|
101
|
+
**Implication:**
|
|
102
|
+
- You can target files by **path globs** (recommended)
|
|
103
|
+
- Or by **content markers** when the path is unpredictable
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 4) Source kinds supported
|
|
108
|
+
|
|
109
|
+
A matching term expands into one or more sources. Knowhow supports these kinds:
|
|
110
|
+
|
|
111
|
+
### `file` — load file contents (supports glob patterns)
|
|
112
|
+
|
|
113
|
+
Loads matching files from your repo/workspace.
|
|
114
|
+
|
|
115
|
+
- `data` is treated as a list of glob/path strings
|
|
116
|
+
- Each file is:
|
|
117
|
+
- checked to exist
|
|
118
|
+
- verified not to be a directory
|
|
119
|
+
- read as UTF-8
|
|
120
|
+
|
|
121
|
+
**Example:**
|
|
122
|
+
|
|
123
|
+
```jsonc
|
|
124
|
+
{
|
|
125
|
+
"API, apis": {
|
|
126
|
+
"sources": [
|
|
127
|
+
{ "kind": "file", "data": ["docs/api/**/*.md", "specs/openapi*.{json,yaml}"] }
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
> Tip: keep paths tight to avoid injecting huge irrelevant bundles.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### `text` — inline raw text
|
|
138
|
+
|
|
139
|
+
Injects literal text directly.
|
|
140
|
+
|
|
141
|
+
**Example:**
|
|
142
|
+
|
|
143
|
+
```jsonc
|
|
144
|
+
{
|
|
145
|
+
"review rubric": {
|
|
146
|
+
"sources": [
|
|
147
|
+
{
|
|
148
|
+
"kind": "text",
|
|
149
|
+
"data": "Review checklist:\n- correctness\n- edge cases\n- performance\n- tests\n- migration plan\n"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### `github` — loads GitHub PR/issue/file content
|
|
159
|
+
|
|
160
|
+
This is resolved through the **GitHub plugin** mechanism. In the language config, you specify what you want loaded via `data`.
|
|
161
|
+
|
|
162
|
+
**Example (conceptual locator payloads):**
|
|
163
|
+
|
|
164
|
+
```jsonc
|
|
165
|
+
{
|
|
166
|
+
"my PR, current PR": {
|
|
167
|
+
"sources": [
|
|
168
|
+
{ "kind": "github", "data": ["CURRENT_PR"] }
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
> The exact `github` payload format depends on your GitHub plugin configuration, but the language plugin will delegate fetching/injection to that plugin.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### `url` — fetches a web URL
|
|
179
|
+
|
|
180
|
+
Resolved via the **URL plugin**. You provide the URL(s) in `data`.
|
|
181
|
+
|
|
182
|
+
**Example:**
|
|
183
|
+
|
|
184
|
+
```jsonc
|
|
185
|
+
{
|
|
186
|
+
"k8s docs": {
|
|
187
|
+
"sources": [
|
|
188
|
+
{ "kind": "url", "data": ["https://kubernetes.io/docs/home/"] }
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 5) Event-driven triggers (`events` field)
|
|
197
|
+
|
|
198
|
+
If you want terms to expand based on file activity (open/save), include an **`events`** array on the term.
|
|
199
|
+
|
|
200
|
+
Typical usage:
|
|
201
|
+
|
|
202
|
+
```jsonc
|
|
203
|
+
{
|
|
204
|
+
"OpenAPI, swagger": {
|
|
205
|
+
"events": ["file:open", "file:save"],
|
|
206
|
+
"sources": [
|
|
207
|
+
{ "kind": "file", "data": ["specs/openapi*.yaml", "specs/openapi*.json"] }
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### How it behaves
|
|
214
|
+
- Knowhow collects all event types referenced in `events`
|
|
215
|
+
- When those events occur, it:
|
|
216
|
+
- filters terms to those that include the active event
|
|
217
|
+
- runs matching against file path and (optionally) file contents
|
|
218
|
+
- injects the configured sources
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 6) Practical examples (full config snippets)
|
|
223
|
+
|
|
224
|
+
Below are copy/paste-friendly examples you can adapt.
|
|
225
|
+
|
|
226
|
+
> Put these entries into `./.knowhow/language.json`.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### Example A — Load frontend/backend architecture docs when you say “frontend” or “backend”
|
|
231
|
+
|
|
232
|
+
```jsonc
|
|
233
|
+
{
|
|
234
|
+
"frontend, ui, web": {
|
|
235
|
+
"sources": [
|
|
236
|
+
{ "kind": "file", "data": ["docs/architecture/frontend/**/*.md", "docs/architecture/web-frontend.md"] },
|
|
237
|
+
{
|
|
238
|
+
"kind": "text",
|
|
239
|
+
"data": "Frontend conventions:\n- Prefer feature-based folder structure\n- Keep API calls in data layer\n- Use typed DTOs\n"
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
"backend, api, service": {
|
|
245
|
+
"sources": [
|
|
246
|
+
{ "kind": "file", "data": ["docs/architecture/backend/**/*.md", "docs/architecture/services/**/*.md"] },
|
|
247
|
+
{
|
|
248
|
+
"kind": "text",
|
|
249
|
+
"data": "Backend conventions:\n- Validate at boundaries\n- Prefer idempotent endpoints when possible\n- Log correlation IDs\n"
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Workflow payoff**
|
|
257
|
+
- Ask: “How does auth work in the frontend?” → Knowhow injects frontend architecture docs automatically.
|
|
258
|
+
- Ask: “Where should we implement input validation in backend?” → Knowhow injects backend guidance.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
### Example B — Load your current PR when you say “my PR”
|
|
263
|
+
|
|
264
|
+
```jsonc
|
|
265
|
+
{
|
|
266
|
+
"my PR, current PR, pr": {
|
|
267
|
+
"sources": [
|
|
268
|
+
{ "kind": "github", "data": ["CURRENT_PR"] },
|
|
269
|
+
{
|
|
270
|
+
"kind": "text",
|
|
271
|
+
"data": "Review approach:\n- Summarize intent\n- Identify risks (correctness, security, perf)\n- Suggest tests and rollback strategy\n"
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Workflow payoff**
|
|
279
|
+
- “Review my PR for concurrency issues and test coverage.”
|
|
280
|
+
- “Summarize changes + highlight any breaking behavior.”
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### Example C — Load a spec file when you mention a feature name (wildcards)
|
|
285
|
+
|
|
286
|
+
Assume specs are organized like:
|
|
287
|
+
|
|
288
|
+
```text
|
|
289
|
+
specs/features/<feature>.md
|
|
290
|
+
specs/features/<feature>/openapi*.yaml
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
```jsonc
|
|
294
|
+
{
|
|
295
|
+
"feature search, search feature": {
|
|
296
|
+
"sources": [
|
|
297
|
+
{ "kind": "file", "data": ["specs/features/search.md", "specs/features/search/**/*.md"] }
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
"payments*, payment*": {
|
|
302
|
+
"sources": [
|
|
303
|
+
{ "kind": "file", "data": ["specs/features/payments*.md", "specs/features/payments/**/openapi*.{yaml,json}"] },
|
|
304
|
+
{ "kind": "text", "data": "Focus for payments:\n- retries & idempotency\n- refund/reconciliation flows\n- edge cases\n" }
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**How it works**
|
|
311
|
+
- `payments*` includes `*`, so it matches using wildcard/glob logic.
|
|
312
|
+
- `feature search` is a plain substring hotphrase.
|
|
313
|
+
|
|
314
|
+
**Workflow payoff**
|
|
315
|
+
- “Explain the payments retry strategy.” → injects payments specs automatically.
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
### Example D — Load API docs when you say “API”
|
|
320
|
+
|
|
321
|
+
```jsonc
|
|
322
|
+
{
|
|
323
|
+
"API, apis, api documentation": {
|
|
324
|
+
"sources": [
|
|
325
|
+
{ "kind": "file", "data": ["docs/api/**/*.md", "docs/api/**/*.mdx"] },
|
|
326
|
+
{ "kind": "file", "data": ["specs/openapi*.json", "specs/openapi*.yaml"] },
|
|
327
|
+
{
|
|
328
|
+
"kind": "text",
|
|
329
|
+
"data": "API answering guidelines:\n- Prefer documented behavior\n- Include request/response schema notes\n- Call out auth and error codes\n- Mention rate limits and pagination\n"
|
|
330
|
+
}
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**Workflow payoff**
|
|
337
|
+
- “What’s the contract for POST /sessions and what errors can it return?”
|
|
338
|
+
- “How do I authenticate for the payments endpoints?”
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
### Example E — Load environment info when you say “prod” or “staging”
|
|
343
|
+
|
|
344
|
+
```jsonc
|
|
345
|
+
{
|
|
346
|
+
"prod, production, live": {
|
|
347
|
+
"sources": [
|
|
348
|
+
{ "kind": "file", "data": ["ops/runbooks/prod/**/*.md"] },
|
|
349
|
+
{ "kind": "file", "data": ["ops/env/prod.env.example", "ops/env/prod.*.example"] },
|
|
350
|
+
{ "kind": "url", "data": ["https://status.yourcompany.com/"] }
|
|
351
|
+
]
|
|
352
|
+
},
|
|
353
|
+
|
|
354
|
+
"staging, stage, preprod": {
|
|
355
|
+
"sources": [
|
|
356
|
+
{ "kind": "file", "data": ["ops/runbooks/staging/**/*.md"] },
|
|
357
|
+
{ "kind": "file", "data": ["ops/env/staging.env.example"] }
|
|
358
|
+
]
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**Workflow payoff**
|
|
364
|
+
- “How do we roll out this change to prod safely?”
|
|
365
|
+
- “What’s the rollback procedure for staging failures?”
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## 7) Dynamic language terms (runtime): `addLanguageTerm` tool
|
|
370
|
+
|
|
371
|
+
Static `.knowhow/language.json` is great, but sometimes you want **temporary terms** created at runtime—for example:
|
|
372
|
+
- “incident-123” should load the incident doc
|
|
373
|
+
- “release candidate 1.2.3” should load the right notes
|
|
374
|
+
- “my PR” should load the PR for the current branch/selection
|
|
375
|
+
|
|
376
|
+
Knowhow provides an `addLanguageTerm` capability to add language terms during execution.
|
|
377
|
+
|
|
378
|
+
### Typical pattern (conceptual)
|
|
379
|
+
1. Call `addLanguageTerm` with:
|
|
380
|
+
- the term key
|
|
381
|
+
- its sources (kind/data)
|
|
382
|
+
- optional `events`
|
|
383
|
+
2. The new term becomes matchable immediately
|
|
384
|
+
3. Next user message can trigger it
|
|
385
|
+
|
|
386
|
+
**Example (conceptual)**
|
|
387
|
+
```ts
|
|
388
|
+
addLanguageTerm({
|
|
389
|
+
key: "incident-123",
|
|
390
|
+
sources: [
|
|
391
|
+
{ kind: "file", data: ["ops/incidents/incident-123.md"] }
|
|
392
|
+
]
|
|
393
|
+
});
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
**Workflow payoff**
|
|
397
|
+
- During an incident response flow, you can dynamically register terms so the agent always references the correct incident/runbook material.
|
|
398
|
+
|
|
399
|
+
> Exact tool argument shapes vary by environment, but the core idea is: **runtime registration of term → sources**.
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## 8) Global vs local language config
|
|
404
|
+
|
|
405
|
+
### Local (project) config
|
|
406
|
+
- Active config for term matching:
|
|
407
|
+
- `./.knowhow/language.json`
|
|
408
|
+
|
|
409
|
+
### Global config
|
|
410
|
+
- Your Knowhow installation may create a template at:
|
|
411
|
+
- `~/.knowhow/language.json`
|
|
412
|
+
- Whether it is merged automatically depends on your Knowhow version/config behavior.
|
|
413
|
+
|
|
414
|
+
### Recommended practice
|
|
415
|
+
- Put **project/team-specific** rules in `./.knowhow/language.json`
|
|
416
|
+
- architecture docs
|
|
417
|
+
- feature specs
|
|
418
|
+
- environment runbooks
|
|
419
|
+
- repo-specific review rubrics
|
|
420
|
+
- If you maintain global defaults, keep them **broad and non-conflicting**
|
|
421
|
+
- e.g., standard “review rubric”, “testing strategy”, “security checklist”
|
|
422
|
+
|
|
423
|
+
**Tip:** avoid overly broad patterns like `"api"` if other teams/tools use the same word differently—prefer `"API,"` or `"api docs"`.
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## Best practices (real-world)
|
|
428
|
+
|
|
429
|
+
- **Target sources tightly**
|
|
430
|
+
- A “frontend” term that injects *every* frontend file can overwhelm answers.
|
|
431
|
+
- **Use globs intentionally**
|
|
432
|
+
- Great: `payments*`, `openapi*`, `docs/api/**/*.md`
|
|
433
|
+
- Risky: `*` or extremely short substrings that match too often
|
|
434
|
+
- **Use `events` for file-driven workflows**
|
|
435
|
+
- Example: expand API spec context only when editing OpenAPI files.
|
|
436
|
+
- **Layer sources**
|
|
437
|
+
- Combine `file` (authoritative docs) + `text` (answering rules)
|
|
438
|
+
- **Prefer human hotphrases**
|
|
439
|
+
- `my PR`, `release notes`, `prod rollback`, `incident <id>`
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
If you paste your current directory structure (or a redacted `.knowhow/language.json`), I can propose an optimized set of term keys + globs tailored to your repo and workflows.
|