@dikolab/kbdb 0.2.2 → 0.3.1
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/README.md +47 -31
- package/dist/bench/constants/corpus-defaults.constant.d.ts +3 -0
- package/dist/bench/functions/format-report.function.d.ts +11 -0
- package/dist/bench/functions/generate-corpus.function.d.ts +12 -0
- package/dist/bench/functions/measure-operation.function.d.ts +14 -0
- package/dist/bench/functions/seeded-rng.function.d.ts +11 -0
- package/dist/bench/functions/zipf-word.function.d.ts +13 -0
- package/dist/bench/index.d.ts +10 -0
- package/dist/bench/typings/bench-result.interface.d.ts +11 -0
- package/dist/bench/typings/bench-suite-result.interface.d.ts +10 -0
- package/dist/bench/typings/corpus-config.interface.d.ts +11 -0
- package/dist/bench/typings/corpus-section.interface.d.ts +9 -0
- package/dist/cli.cjs +523 -80
- package/dist/cli.cjs.map +4 -4
- package/dist/cli.mjs +515 -72
- package/dist/cli.mjs.map +4 -4
- package/dist/kbdb-worker.cjs +395 -60
- package/dist/kbdb-worker.cjs.map +4 -4
- package/dist/mod.cjs +17 -0
- package/dist/mod.cjs.map +2 -2
- package/dist/mod.mjs +17 -0
- package/dist/mod.mjs.map +2 -2
- package/dist/src/shared/auto-capture/classes/auto-capture-controller.class.d.ts +33 -0
- package/dist/src/shared/auto-capture/constants/auto-capture-defaults.constant.d.ts +8 -0
- package/dist/src/shared/auto-capture/functions/build-capture-prompt.function.d.ts +11 -0
- package/dist/src/shared/auto-capture/functions/evaluate-trigger.function.d.ts +12 -0
- package/dist/src/shared/auto-capture/index.d.ts +7 -0
- package/dist/src/shared/auto-capture/typings/auto-capture-config.interface.d.ts +13 -0
- package/dist/src/shared/auto-capture/typings/auto-capture-state.interface.d.ts +13 -0
- package/dist/src/shared/auto-capture/typings/auto-capture-trigger.interface.d.ts +7 -0
- package/dist/src/shared/cli/constants/global-help.constant.d.ts +8 -0
- package/dist/src/shared/cli/constants/leaf-help.constant.d.ts +7 -0
- package/dist/src/shared/cli/constants/memory-protocol-body.constant.d.ts +7 -0
- package/dist/src/shared/cli/constants/query-guidance-body.constant.d.ts +7 -0
- package/dist/src/shared/cli/constants/subcommand-help.constant.d.ts +8 -0
- package/dist/src/shared/cli/functions/collect-files.function.d.ts +13 -0
- package/dist/src/shared/cli/functions/compute-section-kbid.function.d.ts +15 -0
- package/dist/src/shared/cli/functions/dispatch-command.function.d.ts +3 -1
- package/dist/src/shared/cli/functions/format-mcp-output.function.d.ts +9 -0
- package/dist/src/shared/cli/functions/format-text-output.function.d.ts +9 -0
- package/dist/src/shared/cli/functions/generate-group-help.function.d.ts +11 -0
- package/dist/src/shared/cli/functions/handle-data-command.function.d.ts +16 -0
- package/dist/src/shared/cli/functions/handle-mcp.function.d.ts +15 -0
- package/dist/src/shared/cli/functions/handle-migrate.function.d.ts +15 -0
- package/dist/src/shared/cli/functions/hydrate-search-previews.function.d.ts +14 -0
- package/dist/src/shared/cli/functions/install-default-skills.function.d.ts +12 -0
- package/dist/src/shared/cli/functions/resolve-skill-names.function.d.ts +16 -0
- package/dist/src/shared/cli/functions/run-check.function.d.ts +47 -5
- package/dist/src/shared/cli/functions/run-export.function.d.ts +34 -0
- package/dist/src/shared/cli/functions/run-gc.function.d.ts +6 -0
- package/dist/src/shared/cli/functions/run-learn.function.d.ts +35 -6
- package/dist/src/shared/cli/functions/run-recall.function.d.ts +45 -0
- package/dist/src/shared/cli/functions/run-search.function.d.ts +53 -15
- package/dist/src/shared/cli/functions/version-gate.function.d.ts +15 -0
- package/dist/src/shared/cli/functions/wrap-command.function.d.ts +15 -0
- package/dist/src/shared/cli/index.d.ts +4 -0
- package/dist/src/shared/cli/typings/agent-create-client.interface.d.ts +42 -0
- package/dist/src/shared/cli/typings/agent-get-client.interface.d.ts +36 -0
- package/dist/src/shared/cli/typings/check-client.interface.d.ts +58 -0
- package/dist/src/shared/cli/typings/cli-deps.interface.d.ts +48 -0
- package/dist/src/shared/cli/typings/cli-options.interface.d.ts +15 -0
- package/dist/src/shared/cli/typings/disconnectable-client.interface.d.ts +26 -0
- package/dist/src/shared/cli/typings/dispatch-client.type.d.ts +27 -0
- package/dist/src/shared/cli/typings/learn-client.interface.d.ts +52 -0
- package/dist/src/shared/cli/typings/learn-io.interface.d.ts +5 -0
- package/dist/src/shared/cli/typings/learn-result.model.d.ts +19 -0
- package/dist/src/shared/cli/typings/search-client.interface.d.ts +71 -0
- package/dist/src/shared/cli/typings/search-display.model.d.ts +18 -0
- package/dist/src/shared/embedding/classes/null-embedding-provider.class.d.ts +20 -0
- package/dist/src/shared/embedding/constants/near-duplicate-thresholds.constant.d.ts +15 -0
- package/dist/src/shared/embedding/functions/build-vector-index.function.d.ts +14 -0
- package/dist/src/shared/embedding/functions/cosine-similarity.function.d.ts +10 -0
- package/dist/src/shared/embedding/functions/detect-near-duplicates.function.d.ts +18 -0
- package/dist/src/shared/embedding/functions/jaccard-coefficient.function.d.ts +9 -0
- package/dist/src/shared/embedding/functions/read-vector-index-meta.function.d.ts +10 -0
- package/dist/src/shared/embedding/functions/rrf-fuse.function.d.ts +14 -0
- package/dist/src/shared/embedding/functions/search-vectors.function.d.ts +14 -0
- package/dist/src/shared/embedding/index.d.ts +16 -0
- package/dist/src/shared/embedding/typings/embedding-config.interface.d.ts +20 -0
- package/dist/src/shared/embedding/typings/embedding-provider.interface.d.ts +23 -0
- package/dist/src/shared/embedding/typings/near-duplicate-candidate.model.d.ts +23 -0
- package/dist/src/shared/embedding/typings/near-duplicate-result.model.d.ts +24 -0
- package/dist/src/shared/embedding/typings/vector-index-entry.model.d.ts +12 -0
- package/dist/src/shared/embedding/typings/vector-index-meta.model.d.ts +11 -0
- package/dist/src/shared/embedding/typings/vector-search-result.model.d.ts +7 -0
- package/dist/src/shared/mcp/classes/mcp-server.class.d.ts +8 -0
- package/dist/src/shared/mcp/constants/tool-agent-create.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-agent-delete.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-agent-get.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-agent-list.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-auto-capture-review.constant.d.ts +8 -0
- package/dist/src/shared/mcp/constants/tool-check.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-content.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-export.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-gc.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-learn.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-rebuild.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-recall.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-retrieve.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-search.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-skill-delete.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-skill-get.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-skill-learn.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-skill-list.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-status.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-unlearn.constant.d.ts +3 -0
- package/dist/src/shared/mcp/functions/as-boolean-or-undefined.function.d.ts +7 -0
- package/dist/src/shared/mcp/functions/as-string-array-or-undefined.function.d.ts +7 -0
- package/dist/src/shared/mcp/functions/as-string-array.function.d.ts +7 -0
- package/dist/src/shared/mcp/functions/as-string.function.d.ts +8 -0
- package/dist/src/shared/mcp/functions/build-skills-text.function.d.ts +18 -0
- package/dist/src/shared/mcp/functions/handle-agent-prompt.function.d.ts +14 -0
- package/dist/src/shared/mcp/functions/handle-mcp-request.function.d.ts +14 -0
- package/dist/src/shared/mcp/functions/handle-prompt-get.function.d.ts +4 -3
- package/dist/src/shared/mcp/functions/handle-skill-prompt.function.d.ts +16 -0
- package/dist/src/shared/mcp/functions/handle-tool-auto-capture-review.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-check.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/handle-tool-content.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-export.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-gc.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/handle-tool-learn.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-rebuild.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/handle-tool-retrieve.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-search.function.d.ts +13 -0
- package/dist/src/shared/mcp/functions/handle-tool-skill-delete.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-skill-get.function.d.ts +13 -0
- package/dist/src/shared/mcp/functions/handle-tool-skill-learn.function.d.ts +13 -0
- package/dist/src/shared/mcp/functions/handle-tool-skill-list.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/handle-tool-status.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/handle-tool-unlearn.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/parse-agent-meta.function.d.ts +14 -0
- package/dist/src/shared/mcp/functions/parse-skill-arguments.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/read-agent-meta.function.d.ts +17 -0
- package/dist/src/shared/mcp/functions/resolve-skill-refs.function.d.ts +23 -0
- package/dist/src/shared/mcp/functions/run-startup-health-check.function.d.ts +14 -0
- package/dist/src/shared/mcp/typings/mcp-capabilities.interface.d.ts +16 -0
- package/dist/src/shared/mcp/typings/mcp-client.interface.d.ts +45 -0
- package/dist/src/shared/mcp/typings/mcp-completion.interface.d.ts +43 -0
- package/dist/src/shared/mcp/typings/mcp-content-result.model.d.ts +9 -0
- package/dist/src/shared/mcp/typings/mcp-export-result.model.d.ts +11 -0
- package/dist/src/shared/mcp/typings/mcp-gc-result.model.d.ts +15 -0
- package/dist/src/shared/mcp/typings/mcp-integrity-check-result.model.d.ts +16 -0
- package/dist/src/shared/mcp/typings/mcp-integrity-error.model.d.ts +9 -0
- package/dist/src/shared/mcp/typings/mcp-notification.interface.d.ts +9 -0
- package/dist/src/shared/mcp/typings/mcp-rebuild-result.model.d.ts +9 -0
- package/dist/src/shared/mcp/typings/mcp-request.interface.d.ts +11 -0
- package/dist/src/shared/mcp/typings/mcp-resource-result.interface.d.ts +12 -0
- package/dist/src/shared/mcp/typings/mcp-resource-template.interface.d.ts +11 -0
- package/dist/src/shared/mcp/typings/mcp-response.interface.d.ts +18 -0
- package/dist/src/shared/mcp/typings/mcp-server-info.interface.d.ts +7 -0
- package/dist/src/shared/mcp/typings/mcp-server-state.interface.d.ts +16 -0
- package/dist/src/shared/mcp/typings/mcp-tool-annotations.interface.d.ts +32 -0
- package/dist/src/shared/mcp/typings/mcp-tool-definition.interface.d.ts +15 -0
- package/dist/src/shared/mcp/typings/mcp-tool-result.interface.d.ts +19 -0
- package/dist/src/shared/mcp/typings/mcp-worker-client.interface.d.ts +220 -0
- package/dist/src/shared/mcp/typings/tool-call-result.model.d.ts +17 -0
- package/dist/src/shared/sync/functions/build-import-report.function.d.ts +18 -0
- package/dist/src/shared/sync/functions/parse-export-entry.function.d.ts +11 -0
- package/dist/src/shared/sync/functions/resolve-conflict.function.d.ts +13 -0
- package/dist/src/shared/sync/functions/serialize-export-entry.function.d.ts +8 -0
- package/dist/src/shared/sync/index.d.ts +9 -0
- package/dist/src/shared/sync/typings/conflict-resolution.type.d.ts +8 -0
- package/dist/src/shared/sync/typings/export-entry.interface.d.ts +13 -0
- package/dist/src/shared/sync/typings/export-options.interface.d.ts +9 -0
- package/dist/src/shared/sync/typings/import-options.interface.d.ts +7 -0
- package/dist/src/shared/sync/typings/import-report.interface.d.ts +15 -0
- package/dist/src/shared/wasm-codec/functions/decode-add-section-result.function.d.ts +48 -0
- package/dist/src/shared/wasm-codec/functions/decode-one-recall-result.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-option-string.function.d.ts +12 -0
- package/dist/src/shared/wasm-codec/functions/decode-recall-document.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-recall-reference.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-recall-sibling.function.d.ts +13 -0
- package/dist/src/shared/wasm-codec/functions/decode-scored-results.function.d.ts +58 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-match.function.d.ts +15 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-record-trailing.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-record.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-records.function.d.ts +33 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-type.function.d.ts +13 -0
- package/dist/src/shared/wasm-codec/functions/decode-wasm-list.function.d.ts +17 -0
- package/dist/src/shared/wasm-codec/functions/encode-add-section-params.function.d.ts +52 -0
- package/dist/src/shared/wasm-codec/index.d.ts +2 -0
- package/dist/src/shared/wasm-codec/typings/add-section-input.model.d.ts +45 -0
- package/dist/src/shared/wasm-codec/typings/add-section-result.model.d.ts +27 -0
- package/dist/src/shared/wasm-codec/typings/document-manifest.model.d.ts +19 -0
- package/dist/src/shared/wasm-codec/typings/document-section.model.d.ts +12 -0
- package/dist/src/shared/wasm-codec/typings/item-decoder.type.d.ts +6 -0
- package/dist/src/shared/wasm-codec/typings/near-duplicate.model.d.ts +16 -0
- package/dist/src/shared/wasm-codec/typings/paged-search-result.model.d.ts +21 -0
- package/dist/src/shared/wasm-codec/typings/section-match.model.d.ts +31 -0
- package/dist/src/shared/wasm-codec/typings/section-record-trailing.model.d.ts +38 -0
- package/dist/src/shared/wasm-codec/typings/section-record.model.d.ts +66 -0
- package/dist/src/shared/wasm-codec/typings/section-type-result.model.d.ts +12 -0
- package/dist/src/shared/worker-client/classes/worker-client.class.d.ts +16 -0
- package/dist/src/shared/worker-client/functions/handle-ipc-data.function.d.ts +16 -0
- package/dist/src/shared/worker-client/functions/send-ipc-request.function.d.ts +19 -0
- package/dist/src/shared/worker-client/index.d.ts +1 -1
- package/dist/src/shared/worker-client/typings/add-section-result.model.d.ts +31 -15
- package/dist/src/shared/worker-client/typings/export-result.model.d.ts +14 -0
- package/dist/src/shared/worker-client/typings/gc-result.model.d.ts +6 -0
- package/dist/src/shared/worker-client/typings/json-rpc-response.interface.d.ts +16 -0
- package/dist/src/shared/worker-client/typings/pending-call.interface.d.ts +7 -0
- package/dist/src/shared/worker-client/typings/recall-document.model.d.ts +16 -0
- package/dist/src/shared/worker-client/typings/recall-params.model.d.ts +15 -0
- package/dist/src/shared/worker-client/typings/recall-reference.model.d.ts +32 -0
- package/dist/src/shared/worker-client/typings/recall-sibling.model.d.ts +11 -0
- package/dist/src/shared/worker-client/typings/recall-single-result.model.d.ts +40 -0
- package/dist/src/shared/worker-client/typings/search-result.model.d.ts +12 -0
- package/dist/src/shared/worker-client/typings/section.model.d.ts +16 -0
- package/dist/src/shared/worker-daemon/classes/ipc-error.class.d.ts +17 -0
- package/dist/src/shared/worker-daemon/classes/worker-daemon.class.d.ts +35 -0
- package/dist/src/shared/worker-daemon/constants/wasm-method-map.constant.d.ts +16 -0
- package/dist/src/shared/worker-daemon/functions/build-ipc-error-response.function.d.ts +9 -0
- package/dist/src/shared/worker-daemon/functions/check-catalog-version.function.d.ts +9 -0
- package/dist/src/shared/worker-daemon/functions/check-preconditions.function.d.ts +10 -0
- package/dist/src/shared/worker-daemon/functions/detect-stale-pid.function.d.ts +15 -0
- package/dist/src/shared/worker-daemon/functions/dispatch-request.function.d.ts +35 -0
- package/dist/src/shared/worker-daemon/functions/handle-check-version.function.d.ts +23 -0
- package/dist/src/shared/worker-daemon/functions/handle-config-method.function.d.ts +11 -0
- package/dist/src/shared/worker-daemon/functions/handle-read-ops.function.d.ts +52 -0
- package/dist/src/shared/worker-daemon/functions/handle-write-ops.function.d.ts +44 -0
- package/dist/src/shared/worker-daemon/functions/parse-auto-capture-section.function.d.ts +14 -0
- package/dist/src/shared/worker-daemon/functions/parse-catalog-version.function.d.ts +10 -0
- package/dist/src/shared/worker-daemon/functions/parse-embedding-section.function.d.ts +13 -0
- package/dist/src/shared/worker-daemon/functions/parse-worker-toml.function.d.ts +11 -0
- package/dist/src/shared/worker-daemon/functions/run-startup-integrity-check.function.d.ts +18 -0
- package/dist/src/shared/worker-daemon/functions/scan-near-duplicates.function.d.ts +21 -0
- package/dist/src/shared/worker-daemon/functions/wasm-bridge.function.d.ts +51 -0
- package/dist/src/shared/worker-daemon/functions/wasm-memory-helpers.function.d.ts +22 -0
- package/dist/src/shared/worker-daemon/functions/write-lock.function.d.ts +32 -0
- package/dist/src/shared/worker-daemon/typings/allocator-ref.interface.d.ts +16 -0
- package/dist/src/shared/worker-daemon/typings/daemon-config.interface.d.ts +6 -0
- package/dist/src/shared/worker-daemon/typings/fs-adapter.interface.d.ts +22 -0
- package/dist/src/shared/worker-daemon/typings/handler-context.interface.d.ts +18 -0
- package/dist/src/shared/worker-daemon/typings/memory-ref.interface.d.ts +13 -0
- package/dist/src/shared/worker-daemon/typings/wasm-fn.type.d.ts +2 -0
- package/dist/src/shared/worker-daemon/typings/write-lock.interface.d.ts +15 -0
- package/dist/wasm/fs-database/kbdb_fs_database.d.ts +22 -1
- package/dist/wasm/fs-database/kbdb_fs_database.js +28 -1
- package/dist/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
- package/dist/wasm/fs-database/kbdb_fs_database_bg.wasm.d.ts +1 -0
- package/dist/wasm/kb-worker/kbdb_worker.d.ts +48 -1
- package/dist/wasm/kb-worker/kbdb_worker.js +60 -1
- package/dist/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
- package/dist/wasm/kb-worker/kbdb_worker_bg.wasm.d.ts +2 -0
- package/dist/wasm/query-parser/kbdb_query_parser_bg.wasm +0 -0
- package/dist/worker.mjs +396 -60
- package/dist/worker.mjs.map +4 -4
- package/docs/details/cli.md +102 -15
- package/docs/details/library-api.md +55 -6
- package/docs/details/mcp-server.md +10 -4
- package/docs/details/search-and-ranking.md +63 -5
- package/docs/details/storage.md +2 -0
- package/docs/goals/auto-capture.md +378 -0
- package/docs/goals/benchmarking.md +296 -0
- package/docs/goals/cli.md +255 -14
- package/docs/goals/concurrency.md +259 -0
- package/docs/goals/database.md +244 -17
- package/docs/goals/document.md +1 -1
- package/docs/goals/hybrid-search.md +436 -0
- package/docs/goals/mcp.md +83 -14
- package/docs/goals/query-parser.md +98 -4
- package/docs/goals/query-result.md +177 -10
- package/docs/goals/semantic-dedup.md +229 -0
- package/docs/goals/skills.md +72 -0
- package/docs/goals/sync.md +217 -0
- package/docs/goals/worker-daemon.md +54 -7
- package/docs/modules/rust/fs-database/functions/integrity.md +11 -0
- package/docs/modules/rust/fs-database/functions/section.md +23 -6
- package/docs/modules/rust/fs-database/indexes/vectors.md +110 -0
- package/docs/modules/rust/fs-database/module.md +1 -0
- package/docs/modules/rust/fs-database/types/section.md +27 -1
- package/docs/modules/rust/overview.md +2 -1
- package/docs/modules/rust/query-parser/functions/module.md +2 -2
- package/docs/modules/rust/query-parser/functions/pipeline.md +44 -6
- package/docs/modules/rust/query-parser/module.md +5 -4
- package/docs/modules/rust/query-parser/types/keyphrase.md +11 -0
- package/docs/modules/rust/query-parser/types/module.md +3 -3
- package/docs/modules/typescript/shared/auto-capture/module.md +73 -0
- package/docs/modules/typescript/shared/cli/functions.md +68 -3
- package/docs/modules/typescript/shared/embedding/functions.md +94 -0
- package/docs/modules/typescript/shared/embedding/module.md +71 -0
- package/docs/modules/typescript/shared/embedding/typings.md +122 -0
- package/docs/overview.md +148 -166
- package/docs/release-notes/0.2.0.md +3 -3
- package/docs/release-notes/0.3.0.md +89 -0
- package/docs/release-notes/0.3.1.md +111 -0
- package/docs/release-notes/README.md +2 -0
- package/package.json +1 -1
- package/src/shared/auto-capture/classes/auto-capture-controller.class.ts +62 -0
- package/src/shared/auto-capture/constants/auto-capture-defaults.constant.ts +15 -0
- package/src/shared/auto-capture/functions/build-capture-prompt.function.ts +27 -0
- package/src/shared/auto-capture/functions/evaluate-trigger.function.ts +50 -0
- package/src/shared/auto-capture/index.ts +7 -0
- package/src/shared/auto-capture/typings/auto-capture-config.interface.ts +13 -0
- package/src/shared/auto-capture/typings/auto-capture-state.interface.ts +13 -0
- package/src/shared/auto-capture/typings/auto-capture-trigger.interface.ts +7 -0
- package/src/shared/cli/constants/global-help.constant.ts +73 -0
- package/src/shared/cli/constants/leaf-help.constant.ts +219 -0
- package/src/shared/cli/constants/memory-protocol-body.constant.ts +39 -0
- package/src/shared/cli/constants/query-guidance-body.constant.ts +37 -0
- package/src/shared/cli/constants/subcommand-help.constant.ts +195 -0
- package/src/shared/cli/functions/collect-files.function.ts +55 -0
- package/src/shared/cli/functions/compute-section-kbid.function.ts +49 -0
- package/src/shared/cli/functions/dispatch-command.function.ts +53 -1
- package/src/shared/cli/functions/format-mcp-output.function.ts +41 -0
- package/src/shared/cli/functions/format-output.function.ts +36 -12
- package/src/shared/cli/functions/format-text-output.function.ts +42 -0
- package/src/shared/cli/functions/generate-group-help.function.ts +41 -0
- package/src/shared/cli/functions/generate-help.function.ts +56 -1
- package/src/shared/cli/functions/handle-data-command.function.ts +67 -0
- package/src/shared/cli/functions/handle-mcp.function.ts +56 -0
- package/src/shared/cli/functions/handle-migrate.function.ts +64 -0
- package/src/shared/cli/functions/hydrate-search-previews.function.ts +29 -0
- package/src/shared/cli/functions/install-default-skills.function.ts +296 -0
- package/src/shared/cli/functions/parse-args.function.ts +16 -0
- package/src/shared/cli/functions/resolve-skill-names.function.ts +43 -0
- package/src/shared/cli/functions/run-check.function.ts +87 -6
- package/src/shared/cli/functions/run-export.function.ts +40 -0
- package/src/shared/cli/functions/run-gc.function.ts +6 -0
- package/src/shared/cli/functions/run-init.function.ts +2 -0
- package/src/shared/cli/functions/run-learn.function.ts +68 -16
- package/src/shared/cli/functions/run-recall.function.ts +66 -0
- package/src/shared/cli/functions/run-search.function.ts +60 -15
- package/src/shared/cli/functions/version-gate.function.ts +44 -0
- package/src/shared/cli/functions/wrap-command.function.ts +34 -0
- package/src/shared/cli/index.ts +4 -0
- package/src/shared/cli/typings/agent-create-client.interface.ts +47 -0
- package/src/shared/cli/typings/agent-get-client.interface.ts +39 -0
- package/src/shared/cli/typings/check-client.interface.ts +66 -0
- package/src/shared/cli/typings/cli-deps.interface.ts +54 -0
- package/src/shared/cli/typings/cli-options.interface.ts +15 -0
- package/src/shared/cli/typings/disconnectable-client.interface.ts +29 -0
- package/src/shared/cli/typings/dispatch-client.type.ts +46 -0
- package/src/shared/cli/typings/learn-client.interface.ts +53 -0
- package/src/shared/cli/typings/learn-io.interface.ts +5 -0
- package/src/shared/cli/typings/learn-result.model.ts +16 -0
- package/src/shared/cli/typings/search-client.interface.ts +73 -0
- package/src/shared/cli/typings/search-display.model.ts +18 -0
- package/src/shared/embedding/classes/null-embedding-provider.class.ts +29 -0
- package/src/shared/embedding/constants/near-duplicate-thresholds.constant.ts +17 -0
- package/src/shared/embedding/functions/build-vector-index.function.ts +79 -0
- package/src/shared/embedding/functions/cosine-similarity.function.ts +31 -0
- package/src/shared/embedding/functions/detect-near-duplicates.function.ts +69 -0
- package/src/shared/embedding/functions/jaccard-coefficient.function.ts +26 -0
- package/src/shared/embedding/functions/read-vector-index-meta.function.ts +44 -0
- package/src/shared/embedding/functions/rrf-fuse.function.ts +33 -0
- package/src/shared/embedding/functions/search-vectors.function.ts +59 -0
- package/src/shared/embedding/index.ts +20 -0
- package/src/shared/embedding/typings/embedding-config.interface.ts +23 -0
- package/src/shared/embedding/typings/embedding-provider.interface.ts +25 -0
- package/src/shared/embedding/typings/near-duplicate-candidate.model.ts +25 -0
- package/src/shared/embedding/typings/near-duplicate-result.model.ts +26 -0
- package/src/shared/embedding/typings/vector-index-entry.model.ts +13 -0
- package/src/shared/embedding/typings/vector-index-meta.model.ts +14 -0
- package/src/shared/embedding/typings/vector-search-result.model.ts +8 -0
- package/src/shared/mcp/classes/mcp-server.class.ts +36 -4
- package/src/shared/mcp/constants/tool-agent-create.constant.ts +39 -0
- package/src/shared/mcp/constants/tool-agent-delete.constant.ts +26 -0
- package/src/shared/mcp/constants/tool-agent-get.constant.ts +24 -0
- package/src/shared/mcp/constants/tool-agent-list.constant.ts +18 -0
- package/src/shared/mcp/constants/tool-auto-capture-review.constant.ts +32 -0
- package/src/shared/mcp/constants/tool-check.constant.ts +21 -0
- package/src/shared/mcp/constants/tool-content.constant.ts +29 -0
- package/src/shared/mcp/constants/tool-export.constant.ts +27 -0
- package/src/shared/mcp/constants/tool-gc.constant.ts +21 -0
- package/src/shared/mcp/constants/tool-learn.constant.ts +58 -0
- package/src/shared/mcp/constants/tool-rebuild.constant.ts +21 -0
- package/src/shared/mcp/constants/tool-recall.constant.ts +36 -0
- package/src/shared/mcp/constants/tool-retrieve.constant.ts +31 -0
- package/src/shared/mcp/constants/tool-search.constant.ts +51 -0
- package/src/shared/mcp/constants/tool-skill-delete.constant.ts +24 -0
- package/src/shared/mcp/constants/tool-skill-get.constant.ts +27 -0
- package/src/shared/mcp/constants/tool-skill-learn.constant.ts +37 -0
- package/src/shared/mcp/constants/tool-skill-list.constant.ts +18 -0
- package/src/shared/mcp/constants/tool-status.constant.ts +20 -0
- package/src/shared/mcp/constants/tool-unlearn.constant.ts +25 -0
- package/src/shared/mcp/functions/as-boolean-or-undefined.function.ts +11 -0
- package/src/shared/mcp/functions/as-string-array-or-undefined.function.ts +17 -0
- package/src/shared/mcp/functions/as-string-array.function.ts +15 -0
- package/src/shared/mcp/functions/as-string.function.ts +10 -0
- package/src/shared/mcp/functions/build-skills-text.function.ts +43 -0
- package/src/shared/mcp/functions/create-tool-definitions.function.ts +74 -5
- package/src/shared/mcp/functions/handle-agent-create.function.ts +1 -1
- package/src/shared/mcp/functions/handle-agent-prompt.function.ts +68 -0
- package/src/shared/mcp/functions/handle-mcp-request.function.ts +202 -0
- package/src/shared/mcp/functions/handle-prompt-get.function.ts +18 -12
- package/src/shared/mcp/functions/handle-skill-prompt.function.ts +44 -0
- package/src/shared/mcp/functions/handle-tool-auto-capture-review.function.ts +24 -0
- package/src/shared/mcp/functions/handle-tool-call.function.ts +88 -2
- package/src/shared/mcp/functions/handle-tool-check.function.ts +21 -0
- package/src/shared/mcp/functions/handle-tool-content.function.ts +23 -0
- package/src/shared/mcp/functions/handle-tool-export.function.ts +25 -0
- package/src/shared/mcp/functions/handle-tool-gc.function.ts +21 -0
- package/src/shared/mcp/functions/handle-tool-learn.function.ts +69 -0
- package/src/shared/mcp/functions/handle-tool-rebuild.function.ts +21 -0
- package/src/shared/mcp/functions/handle-tool-retrieve.function.ts +40 -0
- package/src/shared/mcp/functions/handle-tool-search.function.ts +47 -0
- package/src/shared/mcp/functions/handle-tool-skill-delete.function.ts +34 -0
- package/src/shared/mcp/functions/handle-tool-skill-get.function.ts +59 -0
- package/src/shared/mcp/functions/handle-tool-skill-learn.function.ts +61 -0
- package/src/shared/mcp/functions/handle-tool-skill-list.function.ts +39 -0
- package/src/shared/mcp/functions/handle-tool-status.function.ts +21 -0
- package/src/shared/mcp/functions/handle-tool-unlearn.function.ts +24 -0
- package/src/shared/mcp/functions/parse-agent-meta.function.ts +27 -0
- package/src/shared/mcp/functions/parse-skill-arguments.function.ts +36 -0
- package/src/shared/mcp/functions/read-agent-meta.function.ts +41 -0
- package/src/shared/mcp/functions/resolve-skill-refs.function.ts +50 -0
- package/src/shared/mcp/functions/run-startup-health-check.function.ts +34 -0
- package/src/shared/mcp/typings/mcp-capabilities.interface.ts +16 -0
- package/src/shared/mcp/typings/mcp-client.interface.ts +47 -0
- package/src/shared/mcp/typings/mcp-completion.interface.ts +45 -0
- package/src/shared/mcp/typings/mcp-content-result.model.ts +9 -0
- package/src/shared/mcp/typings/mcp-export-result.model.ts +11 -0
- package/src/shared/mcp/typings/mcp-gc-result.model.ts +15 -0
- package/src/shared/mcp/typings/mcp-integrity-check-result.model.ts +17 -0
- package/src/shared/mcp/typings/mcp-integrity-error.model.ts +15 -0
- package/src/shared/mcp/typings/mcp-notification.interface.ts +9 -0
- package/src/shared/mcp/typings/mcp-rebuild-result.model.ts +9 -0
- package/src/shared/mcp/typings/mcp-request.interface.ts +11 -0
- package/src/shared/mcp/typings/mcp-resource-result.interface.ts +12 -0
- package/src/shared/mcp/typings/mcp-resource-template.interface.ts +11 -0
- package/src/shared/mcp/typings/mcp-response.interface.ts +18 -0
- package/src/shared/mcp/typings/mcp-server-info.interface.ts +7 -0
- package/src/shared/mcp/typings/mcp-server-state.interface.ts +17 -0
- package/src/shared/mcp/typings/mcp-tool-annotations.interface.ts +32 -0
- package/src/shared/mcp/typings/mcp-tool-definition.interface.ts +16 -0
- package/src/shared/mcp/typings/mcp-tool-result.interface.ts +19 -0
- package/src/shared/mcp/typings/mcp-worker-client.interface.ts +243 -0
- package/src/shared/mcp/typings/tool-call-result.model.ts +18 -0
- package/src/shared/sync/functions/build-import-report.function.ts +40 -0
- package/src/shared/sync/functions/parse-export-entry.function.ts +45 -0
- package/src/shared/sync/functions/resolve-conflict.function.ts +31 -0
- package/src/shared/sync/functions/serialize-export-entry.function.ts +18 -0
- package/src/shared/sync/index.ts +9 -0
- package/src/shared/sync/typings/conflict-resolution.type.ts +8 -0
- package/src/shared/sync/typings/export-entry.interface.ts +13 -0
- package/src/shared/sync/typings/export-options.interface.ts +9 -0
- package/src/shared/sync/typings/import-options.interface.ts +7 -0
- package/src/shared/sync/typings/import-report.interface.ts +15 -0
- package/src/shared/wasm-codec/functions/decode-add-section-result.function.ts +112 -0
- package/src/shared/wasm-codec/functions/decode-one-recall-result.function.ts +86 -0
- package/src/shared/wasm-codec/functions/decode-option-string.function.ts +24 -0
- package/src/shared/wasm-codec/functions/decode-recall-document.function.ts +59 -0
- package/src/shared/wasm-codec/functions/decode-recall-reference.function.ts +52 -0
- package/src/shared/wasm-codec/functions/decode-recall-sibling.function.ts +43 -0
- package/src/shared/wasm-codec/functions/decode-scored-results.function.ts +86 -0
- package/src/shared/wasm-codec/functions/decode-section-match.function.ts +80 -0
- package/src/shared/wasm-codec/functions/decode-section-record-trailing.function.ts +75 -0
- package/src/shared/wasm-codec/functions/decode-section-record.function.ts +85 -0
- package/src/shared/wasm-codec/functions/decode-section-records.function.ts +87 -0
- package/src/shared/wasm-codec/functions/decode-section-type.function.ts +30 -0
- package/src/shared/wasm-codec/functions/decode-wasm-list.function.ts +31 -0
- package/src/shared/wasm-codec/functions/encode-add-section-params.function.ts +68 -0
- package/src/shared/wasm-codec/index.ts +5 -0
- package/src/shared/wasm-codec/typings/add-section-input.model.ts +45 -0
- package/src/shared/wasm-codec/typings/add-section-result.model.ts +28 -0
- package/src/shared/wasm-codec/typings/document-manifest.model.ts +20 -0
- package/src/shared/wasm-codec/typings/document-section.model.ts +12 -0
- package/src/shared/wasm-codec/typings/item-decoder.type.ts +10 -0
- package/src/shared/wasm-codec/typings/near-duplicate.model.ts +16 -0
- package/src/shared/wasm-codec/typings/paged-search-result.model.ts +22 -0
- package/src/shared/wasm-codec/typings/section-match.model.ts +31 -0
- package/src/shared/wasm-codec/typings/section-record-trailing.model.ts +38 -0
- package/src/shared/wasm-codec/typings/section-record.model.ts +66 -0
- package/src/shared/wasm-codec/typings/section-type-result.model.ts +12 -0
- package/src/shared/worker-client/classes/worker-client.class.ts +19 -0
- package/src/shared/worker-client/functions/handle-ipc-data.function.ts +49 -0
- package/src/shared/worker-client/functions/send-ipc-request.function.ts +39 -0
- package/src/shared/worker-client/index.ts +4 -1
- package/src/shared/worker-client/typings/add-section-result.model.ts +32 -15
- package/src/shared/worker-client/typings/export-result.model.ts +14 -0
- package/src/shared/worker-client/typings/gc-result.model.ts +6 -0
- package/src/shared/worker-client/typings/json-rpc-response.interface.ts +17 -0
- package/src/shared/worker-client/typings/pending-call.interface.ts +7 -0
- package/src/shared/worker-client/typings/recall-document.model.ts +16 -0
- package/src/shared/worker-client/typings/recall-params.model.ts +15 -0
- package/src/shared/worker-client/typings/recall-reference.model.ts +32 -0
- package/src/shared/worker-client/typings/recall-sibling.model.ts +11 -0
- package/src/shared/worker-client/typings/recall-single-result.model.ts +41 -0
- package/src/shared/worker-client/typings/search-result.model.ts +12 -0
- package/src/shared/worker-client/typings/section.model.ts +16 -0
- package/src/shared/worker-daemon/classes/ipc-error.class.ts +22 -0
- package/src/shared/worker-daemon/classes/worker-daemon.class.ts +315 -46
- package/src/shared/worker-daemon/constants/wasm-method-map.constant.ts +69 -0
- package/src/shared/worker-daemon/functions/build-ipc-error-response.function.ts +16 -0
- package/src/shared/worker-daemon/functions/check-catalog-version.function.ts +54 -0
- package/src/shared/worker-daemon/functions/check-preconditions.function.ts +28 -0
- package/src/shared/worker-daemon/functions/create-host-imports.function.ts +19 -4
- package/src/shared/worker-daemon/functions/create-ipc-server.function.ts +5 -1
- package/src/shared/worker-daemon/functions/detect-stale-pid.function.ts +33 -0
- package/src/shared/worker-daemon/functions/dispatch-request.function.ts +190 -0
- package/src/shared/worker-daemon/functions/handle-check-version.function.ts +74 -0
- package/src/shared/worker-daemon/functions/handle-config-method.function.ts +27 -0
- package/src/shared/worker-daemon/functions/handle-read-ops.function.ts +236 -0
- package/src/shared/worker-daemon/functions/handle-write-ops.function.ts +257 -0
- package/src/shared/worker-daemon/functions/parse-auto-capture-section.function.ts +51 -0
- package/src/shared/worker-daemon/functions/parse-catalog-version.function.ts +20 -0
- package/src/shared/worker-daemon/functions/parse-embedding-section.function.ts +38 -0
- package/src/shared/worker-daemon/functions/parse-worker-toml.function.ts +104 -0
- package/src/shared/worker-daemon/functions/run-startup-integrity-check.function.ts +55 -0
- package/src/shared/worker-daemon/functions/scan-near-duplicates.function.ts +92 -0
- package/src/shared/worker-daemon/functions/wasm-bridge.function.ts +144 -0
- package/src/shared/worker-daemon/functions/wasm-memory-helpers.function.ts +41 -0
- package/src/shared/worker-daemon/functions/write-lock.function.ts +49 -0
- package/src/shared/worker-daemon/typings/allocator-ref.interface.ts +16 -0
- package/src/shared/worker-daemon/typings/daemon-config.interface.ts +7 -0
- package/src/shared/worker-daemon/typings/fs-adapter.interface.ts +22 -0
- package/src/shared/worker-daemon/typings/handler-context.interface.ts +19 -0
- package/src/shared/worker-daemon/typings/memory-ref.interface.ts +13 -0
- package/src/shared/worker-daemon/typings/wasm-fn.type.ts +2 -0
- package/src/shared/worker-daemon/typings/write-lock.interface.ts +13 -0
- package/src/wasm/fs-database/kbdb_fs_database.d.ts +22 -1
- package/src/wasm/fs-database/kbdb_fs_database.js +28 -1
- package/src/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
- package/src/wasm/fs-database/kbdb_fs_database_bg.wasm.d.ts +1 -0
- package/src/wasm/kb-worker/kbdb_worker.d.ts +48 -1
- package/src/wasm/kb-worker/kbdb_worker.js +60 -1
- package/src/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
- package/src/wasm/kb-worker/kbdb_worker_bg.wasm.d.ts +2 -0
- package/src/wasm/query-parser/kbdb_query_parser_bg.wasm +0 -0
package/docs/details/cli.md
CHANGED
|
@@ -30,12 +30,14 @@ kbdb <command> <subcommand> [options] ...[parameters]
|
|
|
30
30
|
| Knowledge Base | `learn` | Import content from files or stdin |
|
|
31
31
|
| Knowledge Base | `unlearn` | Remove sections by kbid |
|
|
32
32
|
| Knowledge Base | `search` | Query the knowledge base |
|
|
33
|
+
| Knowledge Base | `recall` | Recall full context for sections |
|
|
33
34
|
| Knowledge Base | `content` | Compose rendered content from ids |
|
|
34
35
|
| Database | `db init` | Initialise a new `.kbdb` directory |
|
|
35
36
|
| Database | `db migrate` | Migrate database to current format |
|
|
36
37
|
| Maintenance | `status` | Show database status |
|
|
37
38
|
| Maintenance | `check` | Verify knowledge base integrity |
|
|
38
39
|
| Maintenance | `gc` | Garbage collect unreferenced sections |
|
|
40
|
+
| Maintenance | `export` | Export database snapshot |
|
|
39
41
|
| Maintenance | `rebuild` | Reconstruct all index files |
|
|
40
42
|
| Skills | `skill learn` | Create a new skill definition |
|
|
41
43
|
| Skills | `skill list` | List all skills |
|
|
@@ -76,6 +78,7 @@ These options apply to the `search` command.
|
|
|
76
78
|
|--------|-------|---------|--------|-------------|
|
|
77
79
|
| `--mode <mode>` | `-m` | `sections` | `sections`, `documents`, `stats` | Result granularity |
|
|
78
80
|
| `--limit <n>` | `-l` | `20` | positive integer | Maximum results returned |
|
|
81
|
+
| `--offset <n>` | | `0` | non-negative integer | Zero-based result offset for pagination |
|
|
79
82
|
| `--format <fmt>` | `-f` | `json` | `json`, `text`, `mcp` | Output format |
|
|
80
83
|
| `--content` | `-c` | off | boolean flag | Hydrate results with section content |
|
|
81
84
|
|
|
@@ -115,6 +118,8 @@ or `-` for stdin.
|
|
|
115
118
|
| `--title <title>` | Section title (applies to all sections) |
|
|
116
119
|
| `--description <d>` | Section description |
|
|
117
120
|
| `--docid <docid>` | Attach sections to this document ID |
|
|
121
|
+
| `--tags <t,...>` | Comma-separated tags for scoping and filtering |
|
|
122
|
+
| `--replace` | Enable supersession by source key |
|
|
118
123
|
|
|
119
124
|
**Output:** JSON array of `LearnResult` objects:
|
|
120
125
|
|
|
@@ -124,7 +129,10 @@ or `-` for stdin.
|
|
|
124
129
|
"kbid": "abcdef1234567890abcdef1234",
|
|
125
130
|
"path": "/absolute/path/to/file.md",
|
|
126
131
|
"size": 1234,
|
|
127
|
-
"skipped": false
|
|
132
|
+
"skipped": false,
|
|
133
|
+
"superseded": null,
|
|
134
|
+
"warnings": [],
|
|
135
|
+
"near_duplicates": []
|
|
128
136
|
}
|
|
129
137
|
]
|
|
130
138
|
```
|
|
@@ -162,26 +170,77 @@ are joined into a single query string.
|
|
|
162
170
|
**Output (json):**
|
|
163
171
|
|
|
164
172
|
```json
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
{
|
|
174
|
+
"items": [
|
|
175
|
+
{
|
|
176
|
+
"kbid": "abcdef1234567890abcdef1234",
|
|
177
|
+
"heading": "Machine Learning Overview",
|
|
178
|
+
"type": "text/markdown",
|
|
179
|
+
"docids": ["doc-5678"],
|
|
180
|
+
"snippet": "...applies machine learning...",
|
|
181
|
+
"matched_terms": ["machine", "learning"],
|
|
182
|
+
"matched_fields": ["heading", "body"],
|
|
183
|
+
"confidence": 1.0,
|
|
184
|
+
"created_at": "2026-06-15T10:00:00Z"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"total": 42,
|
|
188
|
+
"offset": 0,
|
|
189
|
+
"limit": 20,
|
|
190
|
+
"has_more": true,
|
|
191
|
+
"relaxed": false
|
|
192
|
+
}
|
|
176
193
|
```
|
|
177
194
|
|
|
178
195
|
**Output (text):**
|
|
179
196
|
|
|
180
197
|
```
|
|
181
|
-
1. [abcdef1234567890abcdef1234] (
|
|
198
|
+
1. [abcdef1234567890abcdef1234] (confidence: 1.00)
|
|
199
|
+
Machine Learning Overview
|
|
200
|
+
...applies machine learning...
|
|
201
|
+
matches: machine, learning (heading, body)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### `recall` -- Recall Context
|
|
182
205
|
|
|
183
|
-
matches: machine, learning
|
|
184
206
|
```
|
|
207
|
+
kbdb recall [options] <kbid>...
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Retrieve full content and progressive context for
|
|
211
|
+
one or more sections. Use after `search` to read
|
|
212
|
+
relevant results.
|
|
213
|
+
|
|
214
|
+
**Options:**
|
|
215
|
+
|
|
216
|
+
| Option | Default | Description |
|
|
217
|
+
|--------|---------|-------------|
|
|
218
|
+
| `--depth <n>` | `0` | Context expansion level (0--3) |
|
|
219
|
+
|
|
220
|
+
**Expansion levels:**
|
|
221
|
+
|
|
222
|
+
| Depth | Returns |
|
|
223
|
+
|-------|---------|
|
|
224
|
+
| 0 | Full section content with heading, type, docids |
|
|
225
|
+
| 1 | Depth 0 + parent documents + back-references |
|
|
226
|
+
| 2 | Depth 1 + sibling sections + forward references |
|
|
227
|
+
| 3 | Depth 2 + full text of referenced sections |
|
|
228
|
+
|
|
229
|
+
**Output:**
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
{
|
|
233
|
+
"kbid": "abcdef1234567890abcdef1234",
|
|
234
|
+
"heading": "Architecture Overview",
|
|
235
|
+
"type": "text/markdown",
|
|
236
|
+
"content": "Full section text...",
|
|
237
|
+
"docids": ["doc-5678"]
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
When multiple kbids are provided, output is a JSON
|
|
242
|
+
array. The `--depth` parameter applies to all
|
|
243
|
+
sections.
|
|
185
244
|
|
|
186
245
|
### `content` -- Compose Rendered Content
|
|
187
246
|
|
|
@@ -229,6 +288,11 @@ document references, and type consistency.
|
|
|
229
288
|
"type": "orphan_section",
|
|
230
289
|
"entity": "x9y8z7w6v5u4t3s2r1q0p9o8n7",
|
|
231
290
|
"detail": "Section not referenced by any document"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"type": "divergent_content",
|
|
294
|
+
"entity": "a1b2c3d4e5f67890",
|
|
295
|
+
"detail": "Sections sharing source key have different content"
|
|
232
296
|
}
|
|
233
297
|
]
|
|
234
298
|
}
|
|
@@ -251,7 +315,8 @@ document manifest references).
|
|
|
251
315
|
```json
|
|
252
316
|
{
|
|
253
317
|
"removed_sections": 3,
|
|
254
|
-
"removed_bytes": 15360
|
|
318
|
+
"removed_bytes": 15360,
|
|
319
|
+
"stale_sources": 1
|
|
255
320
|
}
|
|
256
321
|
```
|
|
257
322
|
|
|
@@ -273,6 +338,28 @@ and document manifests on disk.
|
|
|
273
338
|
}
|
|
274
339
|
```
|
|
275
340
|
|
|
341
|
+
### `export` -- Export Database
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
kbdb export [options] [<path>]
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Export the knowledge base as a self-contained
|
|
348
|
+
directory snapshot for backup or versioning. Copies
|
|
349
|
+
sections, documents, and catalog (no indexes -- they
|
|
350
|
+
are rebuildable via `rebuild`). Defaults to
|
|
351
|
+
`./kbdb-export/`.
|
|
352
|
+
|
|
353
|
+
**Output:**
|
|
354
|
+
|
|
355
|
+
```json
|
|
356
|
+
{
|
|
357
|
+
"path": "/absolute/path/to/export",
|
|
358
|
+
"sections_exported": 39,
|
|
359
|
+
"documents_exported": 5
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
276
363
|
### `db init` -- Initialise Database
|
|
277
364
|
|
|
278
365
|
```
|
|
@@ -69,7 +69,9 @@ Queries the knowledge base and returns ranked
|
|
|
69
69
|
results.
|
|
70
70
|
|
|
71
71
|
```typescript
|
|
72
|
-
search(
|
|
72
|
+
search(
|
|
73
|
+
params: SearchParams,
|
|
74
|
+
): Promise<PagedSearchResult>
|
|
73
75
|
```
|
|
74
76
|
|
|
75
77
|
| Param | Type | Description |
|
|
@@ -188,6 +190,36 @@ listDocumentsByType(
|
|
|
188
190
|
|
|
189
191
|
---
|
|
190
192
|
|
|
193
|
+
### Recall
|
|
194
|
+
|
|
195
|
+
#### `recall(params)`
|
|
196
|
+
|
|
197
|
+
Retrieves full content and progressive context for
|
|
198
|
+
one or more sections. Use after `search()` to read
|
|
199
|
+
relevant results.
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
recall(
|
|
203
|
+
params: RecallParams,
|
|
204
|
+
): Promise<RecallResult | RecallResult[]>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
| Param | Type | Description |
|
|
208
|
+
|-------|------|-------------|
|
|
209
|
+
| `params.kbid` | `string?` | Single section identifier. |
|
|
210
|
+
| `params.kbids` | `string[]?` | Batch section identifiers. |
|
|
211
|
+
| `params.depth` | `number?` | Expansion depth (0--3). Default `0`. |
|
|
212
|
+
|
|
213
|
+
At least one of `kbid` or `kbids` is required.
|
|
214
|
+
Returns a single `RecallResult` for `kbid`, or an
|
|
215
|
+
array for `kbids`. Depth controls progressive
|
|
216
|
+
context expansion: 0 = section content, 1 = adds
|
|
217
|
+
parent documents and back-references, 2 = adds
|
|
218
|
+
siblings and forward references, 3 = adds full text
|
|
219
|
+
of referenced sections.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
191
223
|
### Content
|
|
192
224
|
|
|
193
225
|
#### `content(ids)`
|
|
@@ -339,6 +371,21 @@ interface SearchParams {
|
|
|
339
371
|
readonly query: string;
|
|
340
372
|
readonly mode?: 'sections' | 'documents' | 'stats';
|
|
341
373
|
readonly limit?: number;
|
|
374
|
+
readonly offset?: number;
|
|
375
|
+
readonly content?: boolean;
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### `PagedSearchResult`
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
interface PagedSearchResult {
|
|
383
|
+
readonly items: readonly SearchResult[];
|
|
384
|
+
readonly total: number;
|
|
385
|
+
readonly offset: number;
|
|
386
|
+
readonly limit: number;
|
|
387
|
+
readonly has_more: boolean;
|
|
388
|
+
readonly relaxed: boolean;
|
|
342
389
|
}
|
|
343
390
|
```
|
|
344
391
|
|
|
@@ -347,11 +394,13 @@ interface SearchParams {
|
|
|
347
394
|
```typescript
|
|
348
395
|
interface SearchResult {
|
|
349
396
|
readonly kbid: string;
|
|
350
|
-
readonly
|
|
351
|
-
readonly
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
397
|
+
readonly heading: string | null;
|
|
398
|
+
readonly type: string;
|
|
399
|
+
readonly docids: readonly string[];
|
|
400
|
+
readonly snippet: string;
|
|
401
|
+
readonly matched_terms: readonly string[];
|
|
402
|
+
readonly matched_fields: readonly string[];
|
|
403
|
+
readonly created_at: string;
|
|
355
404
|
}
|
|
356
405
|
```
|
|
357
406
|
|
|
@@ -188,7 +188,7 @@ own worker client connection.
|
|
|
188
188
|
|
|
189
189
|
## Tools Reference
|
|
190
190
|
|
|
191
|
-
The MCP server exposes
|
|
191
|
+
The MCP server exposes 20 tools grouped by
|
|
192
192
|
function. All tools communicate with the worker
|
|
193
193
|
daemon via JSON-RPC 2.0 over IPC.
|
|
194
194
|
|
|
@@ -196,15 +196,18 @@ daemon via JSON-RPC 2.0 over IPC.
|
|
|
196
196
|
|
|
197
197
|
| Tool | Parameters | Description | Read-only | Destructive |
|
|
198
198
|
|------|-----------|-------------|-----------|-------------|
|
|
199
|
-
| `search` | `query` (string, required), `mode` (string), `limit` (number) | Query the knowledge base by keywords. Returns ranked results with
|
|
200
|
-
| `learn` | `content` (string, required), `type` (string), `title` (string), `description` (string), `docid` (string) | Import content into the knowledge base.
|
|
199
|
+
| `search` | `query` (string, required), `mode` (string), `limit` (number), `offset` (number), `content` (boolean) | Query the knowledge base by keywords. Returns ranked results with heading, snippet, and matched terms. Use multiple short keyword queries for best coverage. | yes | no |
|
|
200
|
+
| `learn` | `content` (string, required), `type` (string), `title` (string), `description` (string), `docid` (string), `tags` (string[]), `replace` (boolean) | Import content into the knowledge base. Use for durable facts, decisions, and corrections. Use `replace` when updating existing knowledge. Attach `tags` for scoping. | no | no |
|
|
201
201
|
| `unlearn` | `kbid` (string, required) | Remove a section by kb-id. Cascades deletion to index entries and ranking data. | no | yes |
|
|
202
202
|
| `retrieve` | `kbid` (string), `docid` (string) | Fetch a specific section or document by identifier. At least one of `kbid` or `docid` required. | yes | no |
|
|
203
|
+
| `recall` | `kbid` (string), `kbids` (string[]), `depth` (number) | Retrieve full content and progressive context for sections. Use after `search` to read relevant results. Depth 0-3 controls context expansion. | yes | no |
|
|
203
204
|
| `content` | `ids` (string[], required) | Compose a rendered Markdown document from one or more kbid or docid identifiers. | yes | no |
|
|
204
205
|
| `status` | (none) | Return database status and cache statistics. | yes | no |
|
|
205
206
|
| `check` | (none) | Verify knowledge base integrity. Reports checksum mismatches, orphan sections, broken references. | yes | no |
|
|
206
207
|
| `gc` | (none) | Remove unreferenced sections (no document manifest references). | no | yes |
|
|
207
208
|
| `rebuild` | (none) | Reconstruct all index files from section files and document manifests on disk. | no | no |
|
|
209
|
+
| `export` | `path` (string) | Export the knowledge base as a self-contained directory snapshot for backup or versioning. Copies sections, documents, and catalog (no indexes). | no | no |
|
|
210
|
+
| `auto-capture-review` | `action` (string: list, approve, reject) | Review and approve pending auto-captured knowledge before storage. | no | no |
|
|
208
211
|
|
|
209
212
|
### Skills Tools
|
|
210
213
|
|
|
@@ -236,7 +239,9 @@ daemon via JSON-RPC 2.0 over IPC.
|
|
|
236
239
|
| `status` | yes |
|
|
237
240
|
| `check` | yes |
|
|
238
241
|
| `gc` | no |
|
|
242
|
+
| `recall` | yes |
|
|
239
243
|
| `rebuild` | no |
|
|
244
|
+
| `export` | yes |
|
|
240
245
|
| `skill-learn` | yes |
|
|
241
246
|
| `skill-list` | yes |
|
|
242
247
|
| `skill-get` | yes |
|
|
@@ -245,6 +250,7 @@ daemon via JSON-RPC 2.0 over IPC.
|
|
|
245
250
|
| `agent-list` | yes |
|
|
246
251
|
| `agent-get` | yes |
|
|
247
252
|
| `agent-delete` | yes |
|
|
253
|
+
| `auto-capture-review` | yes |
|
|
248
254
|
|
|
249
255
|
## Prompts
|
|
250
256
|
|
|
@@ -336,7 +342,7 @@ Protocol version **2025-11-25** and advertises the
|
|
|
336
342
|
following capabilities:
|
|
337
343
|
|
|
338
344
|
- **tools** -- `tools/list` and `tools/call` for
|
|
339
|
-
all
|
|
345
|
+
all 20 tools.
|
|
340
346
|
- **resources** -- `resources/list`,
|
|
341
347
|
`resources/read`, and
|
|
342
348
|
`resources/templates/list` for URI-based content
|
|
@@ -43,7 +43,7 @@ sections containing both "auth" and "flow".
|
|
|
43
43
|
## Tokenization Pipeline
|
|
44
44
|
|
|
45
45
|
Both indexing and search queries pass through the
|
|
46
|
-
same
|
|
46
|
+
same nine-stage pipeline. Using identical processing
|
|
47
47
|
for both sides guarantees that stored terms match
|
|
48
48
|
query terms.
|
|
49
49
|
|
|
@@ -69,10 +69,13 @@ query terms.
|
|
|
69
69
|
6. Stop word removal
|
|
70
70
|
|
|
|
71
71
|
v
|
|
72
|
-
7.
|
|
72
|
+
7. Synonym expansion
|
|
73
73
|
|
|
|
74
74
|
v
|
|
75
|
-
8.
|
|
75
|
+
8. Stemming
|
|
76
|
+
|
|
|
77
|
+
v
|
|
78
|
+
9. N-gram extraction
|
|
76
79
|
|
|
|
77
80
|
v
|
|
78
81
|
Normalized tokens
|
|
@@ -111,13 +114,24 @@ query terms.
|
|
|
111
114
|
no discriminative value (`the`, `is`, `and`,
|
|
112
115
|
etc.). The stop word list is configurable.
|
|
113
116
|
|
|
114
|
-
7. **
|
|
117
|
+
7. **Synonym expansion** -- Look up each token in a
|
|
118
|
+
built-in bidirectional synonym map and insert
|
|
119
|
+
synonym tokens alongside the original. Bridges
|
|
120
|
+
vocabulary gaps: a document using "sign-in" becomes
|
|
121
|
+
findable via "login". The map covers common
|
|
122
|
+
IT/development vocabulary (~30-50 entries:
|
|
123
|
+
login/sign-in, auth/authentication,
|
|
124
|
+
remove/delete, config/configuration, etc.).
|
|
125
|
+
Applied symmetrically during both indexing and
|
|
126
|
+
querying.
|
|
127
|
+
|
|
128
|
+
8. **Stemming** -- Reduce words to root forms using
|
|
115
129
|
the Snowball/Porter2 stemmer. `running` and `runs`
|
|
116
130
|
both stem to `run`. Both the stemmed form and the
|
|
117
131
|
original are stored so exact-match queries still
|
|
118
132
|
work.
|
|
119
133
|
|
|
120
|
-
|
|
134
|
+
9. **N-gram extraction** -- Generate bigrams and
|
|
121
135
|
trigrams for phrase indexing and multi-word term
|
|
122
136
|
matching. Supports phrase queries without requiring
|
|
123
137
|
a separate phrase index.
|
|
@@ -291,6 +305,35 @@ and freshness are additive boosts with configurable
|
|
|
291
305
|
weights. Results are sorted by `final_score`
|
|
292
306
|
descending; ties broken by kbid lexicographic order.
|
|
293
307
|
|
|
308
|
+
### Score Normalization
|
|
309
|
+
|
|
310
|
+
Raw BM25F scores are normalized to a 0.0--1.0
|
|
311
|
+
`confidence` value within each result set. Each
|
|
312
|
+
score is divided by the maximum score in the result
|
|
313
|
+
set, so the top result always has confidence 1.0.
|
|
314
|
+
This lets agents distinguish strong matches from
|
|
315
|
+
weak tail results without interpreting raw score
|
|
316
|
+
magnitudes.
|
|
317
|
+
|
|
318
|
+
Confidence is exposed in CLI output but omitted from
|
|
319
|
+
MCP results (ordering is the signal for agents).
|
|
320
|
+
|
|
321
|
+
## Relaxed-Match Fallback
|
|
322
|
+
|
|
323
|
+
When a multi-term AND query returns zero results,
|
|
324
|
+
the engine automatically retries with OR semantics
|
|
325
|
+
-- any term matches instead of all required. This
|
|
326
|
+
prevents silent misses when the query is too
|
|
327
|
+
specific for the corpus.
|
|
328
|
+
|
|
329
|
+
The fallback is transparent: no special syntax
|
|
330
|
+
needed. Results from relaxed matching are flagged
|
|
331
|
+
with `relaxed: true` in the response envelope so
|
|
332
|
+
the caller knows the match is weaker. Single-term
|
|
333
|
+
queries are unaffected (AND and OR are equivalent
|
|
334
|
+
for one term). Phrase queries and exclusions are
|
|
335
|
+
preserved in both modes.
|
|
336
|
+
|
|
294
337
|
## Keyword Extraction
|
|
295
338
|
|
|
296
339
|
When content is added to the knowledge base, the
|
|
@@ -347,6 +390,7 @@ indexes/
|
|
|
347
390
|
+-- meta.toml human-readable metadata
|
|
348
391
|
+-- terms.idx inverted index (B+ tree)
|
|
349
392
|
+-- positions.idx positional index (B+ tree)
|
|
393
|
+
+-- references.idx reference graph (B+ tree)
|
|
350
394
|
+-- corpus.dat corpus statistics (binary)
|
|
351
395
|
```
|
|
352
396
|
|
|
@@ -378,6 +422,20 @@ zero-based token offsets. Supports three functions:
|
|
|
378
422
|
- **Zone scoring** -- Determine whether a term falls
|
|
379
423
|
in the heading zone (first 20% of the section).
|
|
380
424
|
|
|
425
|
+
### `references.idx` -- Reference Graph Index
|
|
426
|
+
|
|
427
|
+
B+ tree mapping section kbids to their content
|
|
428
|
+
marker cross-references. Stores bidirectional
|
|
429
|
+
edges: for each `$(text:)`, `$(code:)`, `$(image:)`,
|
|
430
|
+
`$(link:)`, `$(document:)`, and `$(doc-link:)`
|
|
431
|
+
marker, both a forward entry (source -> target) and
|
|
432
|
+
a back entry (target -> source) are recorded. This
|
|
433
|
+
enables the `recall` command's progressive context
|
|
434
|
+
expansion -- depth 1+ retrieves back-references
|
|
435
|
+
(sections that point to this one) and depth 2+
|
|
436
|
+
retrieves forward references (sections this one
|
|
437
|
+
points to).
|
|
438
|
+
|
|
381
439
|
### `corpus.dat` -- Corpus Statistics
|
|
382
440
|
|
|
383
441
|
Binary file storing corpus-wide aggregates:
|
package/docs/details/storage.md
CHANGED
|
@@ -24,6 +24,7 @@ version-controlled.
|
|
|
24
24
|
| +-- meta.toml
|
|
25
25
|
| +-- terms.idx
|
|
26
26
|
| +-- positions.idx
|
|
27
|
+
| +-- references.idx
|
|
27
28
|
| +-- corpus.dat
|
|
28
29
|
+-- worker.toml
|
|
29
30
|
+-- .gitignore
|
|
@@ -37,6 +38,7 @@ version-controlled.
|
|
|
37
38
|
| `indexes/meta.toml` | TOML | Index metadata: rebuild timestamp, term count, statistics summary |
|
|
38
39
|
| `indexes/terms.idx` | Binary | Inverted index (B+ tree): maps terms to posting lists with per-field term frequencies |
|
|
39
40
|
| `indexes/positions.idx` | Binary | Positional index (B+ tree): maps (term, kbid) to token offset arrays |
|
|
41
|
+
| `indexes/references.idx` | Binary | Reference graph index (B+ tree): bidirectional content marker cross-references between sections |
|
|
40
42
|
| `indexes/corpus.dat` | Binary | Corpus statistics: section count, average lengths per field, per-term document frequencies |
|
|
41
43
|
| `worker.toml` | TOML | Cache daemon configuration |
|
|
42
44
|
| `.gitignore` | Text | Excludes `indexes/` from version control |
|