@dikolab/kbdb 0.4.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/CLA.md +68 -0
  2. package/LICENSE +676 -12
  3. package/LICENSING.md +58 -0
  4. package/README.md +50 -27
  5. package/README.md.bak +320 -0
  6. package/dist/README.md +320 -0
  7. package/dist/{chunk-BJXEVALU.mjs → chunk-QLJ33C74.mjs} +44 -44
  8. package/dist/chunk-QLJ33C74.mjs.map +7 -0
  9. package/dist/cli.cjs +550 -232
  10. package/dist/cli.cjs.map +4 -4
  11. package/dist/cli.d.ts +0 -8
  12. package/dist/cli.mjs +483 -154
  13. package/dist/cli.mjs.map +4 -4
  14. package/dist/kbdb-worker.cjs +36 -5
  15. package/dist/kbdb-worker.cjs.map +3 -3
  16. package/dist/mod.cjs +89 -30
  17. package/dist/mod.cjs.map +4 -4
  18. package/dist/mod.mjs +88 -30
  19. package/dist/mod.mjs.map +4 -4
  20. package/dist/src/cli.d.ts +0 -8
  21. package/dist/src/shared/cli/constants/defaults.constant.d.ts +1 -1
  22. package/dist/src/shared/cli/constants/recfile-command-field-map.constant.d.ts +8 -0
  23. package/dist/src/shared/cli/constants/recfile-field-maps.constant.d.ts +21 -0
  24. package/dist/src/shared/cli/functions/compute-directory-level.function.d.ts +14 -0
  25. package/dist/src/shared/cli/functions/dispatch-command.function.d.ts +2 -28
  26. package/dist/src/shared/cli/functions/format-command-output.function.d.ts +14 -0
  27. package/dist/src/shared/cli/functions/format-db-not-found.function.d.ts +20 -0
  28. package/dist/src/shared/cli/functions/format-output.function.d.ts +1 -0
  29. package/dist/src/shared/cli/functions/format-recfile-output.function.d.ts +11 -0
  30. package/dist/src/shared/cli/functions/render-recfile-value.function.d.ts +11 -0
  31. package/dist/src/shared/cli/functions/resolve-db-dir.function.d.ts +24 -0
  32. package/dist/src/shared/cli/functions/resolve-recfile-key.function.d.ts +9 -0
  33. package/dist/src/shared/cli/functions/run-db-path.function.d.ts +10 -0
  34. package/dist/src/shared/cli/functions/run-export.function.d.ts +8 -4
  35. package/dist/src/shared/cli/functions/run-import.function.d.ts +4 -0
  36. package/dist/src/shared/cli/functions/run-learn.function.d.ts +12 -0
  37. package/dist/src/shared/cli/index.d.ts +4 -1
  38. package/dist/src/shared/cli/typings/cli-options.interface.d.ts +9 -2
  39. package/dist/src/shared/cli/typings/db-resolution.interface.d.ts +9 -0
  40. package/dist/src/shared/cli/typings/recfile-field-map.type.d.ts +10 -0
  41. package/dist/src/shared/version/constants/version.constant.d.ts +1 -1
  42. package/dist/src/shared/wasm-codec/functions/decode-option-u8.function.d.ts +9 -0
  43. package/dist/src/shared/wasm-codec/functions/decode-section-records.function.d.ts +4 -0
  44. package/dist/src/shared/wasm-codec/functions/encode-add-section-params.function.d.ts +2 -45
  45. package/dist/src/shared/wasm-codec/functions/encode-update-section-params.function.d.ts +10 -1
  46. package/dist/src/shared/wasm-codec/index.d.ts +1 -1
  47. package/dist/src/shared/wasm-codec/typings/add-section-input.model.d.ts +6 -0
  48. package/dist/src/shared/wasm-codec/typings/section-record-trailing.model.d.ts +5 -0
  49. package/dist/src/shared/wasm-codec/typings/section-record.model.d.ts +5 -0
  50. package/dist/src/shared/worker-client/functions/build-deno-permissions.function.d.ts +11 -0
  51. package/dist/src/shared/worker-client/functions/read-crash-reason.function.d.ts +9 -0
  52. package/dist/src/shared/worker-client/functions/resolve-spawn-script.function.d.ts +6 -0
  53. package/dist/src/shared/worker-client/functions/spawn-daemon.function.d.ts +1 -1
  54. package/dist/src/shared/worker-client/typings/section.model.d.ts +5 -0
  55. package/dist/src/shared/worker-client/typings/worker-client-options.interface.d.ts +0 -6
  56. package/dist/src/shared/worker-daemon/functions/count-files.function.d.ts +12 -0
  57. package/dist/src/shared/worker-daemon/functions/handle-import.function.d.ts +2 -0
  58. package/dist/src/shared/worker-daemon/functions/handle-read-ops.function.d.ts +8 -0
  59. package/dist/src/shared/worker-daemon/functions/validate-daemon-path.function.d.ts +15 -0
  60. package/dist/src/worker.d.ts +0 -7
  61. package/dist/wasm/default-embedding/kbdb_default_embedding_bg.wasm +0 -0
  62. package/dist/wasm/default-embedding/package.json +1 -1
  63. package/dist/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
  64. package/dist/wasm/fs-database/package.json +1 -1
  65. package/dist/wasm/fs-migration/kbdb_fs_migration_bg.wasm +0 -0
  66. package/dist/wasm/fs-migration/package.json +1 -1
  67. package/dist/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
  68. package/dist/wasm/kb-worker/package.json +1 -1
  69. package/dist/wasm/query-parser/kbdb_query_parser_bg.wasm +0 -0
  70. package/dist/wasm/query-parser/package.json +1 -1
  71. package/dist/worker.d.ts +0 -7
  72. package/dist/worker.mjs +37 -6
  73. package/dist/worker.mjs.map +3 -3
  74. package/package.json +13 -12
  75. package/dist/chunk-BJXEVALU.mjs.map +0 -7
  76. package/dist/src/shared/cli/functions/resolve-raw-db-path.function.d.ts +0 -10
  77. package/docs/details/README.md +0 -30
  78. package/docs/details/agent-tooling.md +0 -132
  79. package/docs/details/cli.md +0 -777
  80. package/docs/details/knowledge-base.md +0 -180
  81. package/docs/details/library-api.md +0 -495
  82. package/docs/details/mcp-server.md +0 -482
  83. package/docs/details/search-and-ranking.md +0 -575
  84. package/docs/details/storage.md +0 -531
  85. package/docs/goals/agents.md +0 -751
  86. package/docs/goals/architecture.svg +0 -198
  87. package/docs/goals/auto-capture.md +0 -378
  88. package/docs/goals/benchmarking.md +0 -296
  89. package/docs/goals/cli.md +0 -2654
  90. package/docs/goals/concurrency.md +0 -259
  91. package/docs/goals/content-composer.md +0 -609
  92. package/docs/goals/content-parser.md +0 -279
  93. package/docs/goals/database.md +0 -1679
  94. package/docs/goals/document.md +0 -368
  95. package/docs/goals/hybrid-search.md +0 -465
  96. package/docs/goals/mcp.md +0 -1541
  97. package/docs/goals/overview.md +0 -124
  98. package/docs/goals/query-parser.md +0 -373
  99. package/docs/goals/query-result.md +0 -860
  100. package/docs/goals/semantic-dedup.md +0 -233
  101. package/docs/goals/skills.md +0 -810
  102. package/docs/goals/sync.md +0 -217
  103. package/docs/goals/worker-client.md +0 -1005
  104. package/docs/goals/worker-daemon.md +0 -1547
  105. package/docs/modules/overview.md +0 -319
  106. package/docs/modules/rust/embedding/module.md +0 -91
  107. package/docs/modules/rust/fs-database/functions/document.md +0 -48
  108. package/docs/modules/rust/fs-database/functions/integrity.md +0 -79
  109. package/docs/modules/rust/fs-database/functions/io.md +0 -87
  110. package/docs/modules/rust/fs-database/functions/module.md +0 -22
  111. package/docs/modules/rust/fs-database/functions/query-exec.md +0 -44
  112. package/docs/modules/rust/fs-database/functions/section.md +0 -76
  113. package/docs/modules/rust/fs-database/indexes/btree.md +0 -35
  114. package/docs/modules/rust/fs-database/indexes/corpus.md +0 -61
  115. package/docs/modules/rust/fs-database/indexes/inverted.md +0 -60
  116. package/docs/modules/rust/fs-database/indexes/module.md +0 -64
  117. package/docs/modules/rust/fs-database/indexes/positional.md +0 -39
  118. package/docs/modules/rust/fs-database/indexes/vectors.md +0 -110
  119. package/docs/modules/rust/fs-database/module.md +0 -150
  120. package/docs/modules/rust/fs-database/types/catalog.md +0 -53
  121. package/docs/modules/rust/fs-database/types/module.md +0 -12
  122. package/docs/modules/rust/fs-database/types/section.md +0 -127
  123. package/docs/modules/rust/kb-worker/functions/compose.md +0 -57
  124. package/docs/modules/rust/kb-worker/functions/module.md +0 -20
  125. package/docs/modules/rust/kb-worker/functions/retrieve.md +0 -194
  126. package/docs/modules/rust/kb-worker/functions/search.md +0 -173
  127. package/docs/modules/rust/kb-worker/functions/write.md +0 -172
  128. package/docs/modules/rust/kb-worker/module.md +0 -171
  129. package/docs/modules/rust/kb-worker/types/cache.md +0 -90
  130. package/docs/modules/rust/kb-worker/types/context.md +0 -26
  131. package/docs/modules/rust/kb-worker/types/module.md +0 -16
  132. package/docs/modules/rust/kb-worker/types/status.md +0 -29
  133. package/docs/modules/rust/kb-worker/types/token.md +0 -50
  134. package/docs/modules/rust/overview.md +0 -531
  135. package/docs/modules/rust/query-parser/functions/extract.md +0 -56
  136. package/docs/modules/rust/query-parser/functions/module.md +0 -18
  137. package/docs/modules/rust/query-parser/functions/parse.md +0 -33
  138. package/docs/modules/rust/query-parser/functions/pipeline.md +0 -9
  139. package/docs/modules/rust/query-parser/functions/rank.md +0 -85
  140. package/docs/modules/rust/query-parser/module.md +0 -131
  141. package/docs/modules/rust/query-parser/types/cache.md +0 -39
  142. package/docs/modules/rust/query-parser/types/keyphrase.md +0 -71
  143. package/docs/modules/rust/query-parser/types/module.md +0 -18
  144. package/docs/modules/rust/query-parser/types/token.md +0 -46
  145. package/docs/modules/rust/shared/content-composer/functions.md +0 -114
  146. package/docs/modules/rust/shared/content-composer/module.md +0 -147
  147. package/docs/modules/rust/shared/content-composer/types.md +0 -93
  148. package/docs/modules/rust/shared/content-parser/functions.md +0 -72
  149. package/docs/modules/rust/shared/content-parser/module.md +0 -99
  150. package/docs/modules/rust/shared/content-parser/types.md +0 -71
  151. package/docs/modules/rust/shared/corpus/module.md +0 -24
  152. package/docs/modules/rust/shared/corpus/types.md +0 -141
  153. package/docs/modules/rust/shared/document/module.md +0 -25
  154. package/docs/modules/rust/shared/document/types.md +0 -154
  155. package/docs/modules/rust/shared/encode/module.md +0 -22
  156. package/docs/modules/rust/shared/encode/traits.md +0 -304
  157. package/docs/modules/rust/shared/error/module.md +0 -28
  158. package/docs/modules/rust/shared/error/types.md +0 -302
  159. package/docs/modules/rust/shared/kbid/module.md +0 -24
  160. package/docs/modules/rust/shared/kbid/types.md +0 -147
  161. package/docs/modules/rust/shared/memory/functions.md +0 -209
  162. package/docs/modules/rust/shared/memory/module.md +0 -24
  163. package/docs/modules/rust/shared/module.md +0 -196
  164. package/docs/modules/rust/shared/pipeline/functions.md +0 -141
  165. package/docs/modules/rust/shared/pipeline/module.md +0 -62
  166. package/docs/modules/rust/shared/pipeline/types.md +0 -43
  167. package/docs/modules/rust/shared/query/module.md +0 -27
  168. package/docs/modules/rust/shared/query/types.md +0 -236
  169. package/docs/modules/rust/shared/section/module.md +0 -25
  170. package/docs/modules/rust/shared/section/types.md +0 -294
  171. package/docs/modules/rust/shared/term/module.md +0 -25
  172. package/docs/modules/rust/shared/term/types.md +0 -139
  173. package/docs/modules/typescript/cli.md +0 -131
  174. package/docs/modules/typescript/kbdb-worker.md +0 -150
  175. package/docs/modules/typescript/overview.md +0 -400
  176. package/docs/modules/typescript/shared/auto-capture/module.md +0 -73
  177. package/docs/modules/typescript/shared/cli/constants.md +0 -23
  178. package/docs/modules/typescript/shared/cli/functions.md +0 -809
  179. package/docs/modules/typescript/shared/cli/module.md +0 -138
  180. package/docs/modules/typescript/shared/cli/typings.md +0 -197
  181. package/docs/modules/typescript/shared/embedding/functions.md +0 -200
  182. package/docs/modules/typescript/shared/embedding/module.md +0 -77
  183. package/docs/modules/typescript/shared/embedding/typings.md +0 -124
  184. package/docs/modules/typescript/shared/hash/functions.md +0 -20
  185. package/docs/modules/typescript/shared/hash/module.md +0 -21
  186. package/docs/modules/typescript/shared/log/constants.md +0 -82
  187. package/docs/modules/typescript/shared/log/functions.md +0 -131
  188. package/docs/modules/typescript/shared/log/module.md +0 -153
  189. package/docs/modules/typescript/shared/log/typings.md +0 -82
  190. package/docs/modules/typescript/shared/mcp/classes.md +0 -179
  191. package/docs/modules/typescript/shared/mcp/functions.md +0 -386
  192. package/docs/modules/typescript/shared/mcp/module.md +0 -160
  193. package/docs/modules/typescript/shared/mcp/typings.md +0 -529
  194. package/docs/modules/typescript/shared/module.md +0 -110
  195. package/docs/modules/typescript/shared/platform/functions.md +0 -42
  196. package/docs/modules/typescript/shared/platform/module.md +0 -25
  197. package/docs/modules/typescript/shared/runtime/functions.md +0 -26
  198. package/docs/modules/typescript/shared/runtime/module.md +0 -27
  199. package/docs/modules/typescript/shared/runtime/typings.md +0 -13
  200. package/docs/modules/typescript/shared/version/module.md +0 -27
  201. package/docs/modules/typescript/shared/wasm-codec/functions.md +0 -391
  202. package/docs/modules/typescript/shared/wasm-codec/module.md +0 -98
  203. package/docs/modules/typescript/shared/worker-client/classes.md +0 -264
  204. package/docs/modules/typescript/shared/worker-client/functions.md +0 -175
  205. package/docs/modules/typescript/shared/worker-client/module.md +0 -92
  206. package/docs/modules/typescript/shared/worker-client/typings.md +0 -511
  207. package/docs/modules/typescript/shared/worker-daemon/classes.md +0 -239
  208. package/docs/modules/typescript/shared/worker-daemon/constants.md +0 -37
  209. package/docs/modules/typescript/shared/worker-daemon/functions.md +0 -234
  210. package/docs/modules/typescript/shared/worker-daemon/module.md +0 -118
  211. package/docs/modules/typescript/shared/worker-daemon/typings.md +0 -132
  212. package/docs/overview.md +0 -191
  213. package/docs/release-notes/0.1.0.md +0 -189
  214. package/docs/release-notes/0.1.1.md +0 -46
  215. package/docs/release-notes/0.1.2.md +0 -38
  216. package/docs/release-notes/0.1.3.md +0 -42
  217. package/docs/release-notes/0.2.0.md +0 -147
  218. package/docs/release-notes/0.3.0.md +0 -89
  219. package/docs/release-notes/0.3.1.md +0 -121
  220. package/docs/release-notes/0.3.2.md +0 -64
  221. package/docs/release-notes/0.4.0.md +0 -80
  222. package/docs/release-notes/0.4.1.md +0 -149
  223. package/docs/release-notes/0.4.3.md +0 -60
  224. package/docs/release-notes/README.md +0 -13
@@ -1,132 +0,0 @@
1
- # worker-daemon/typings -- Daemon Type Definitions
2
-
3
- *Interfaces and type aliases for daemon configuration,
4
- IPC message shapes, and WASM module references.*
5
-
6
- ## Source
7
-
8
- `src/shared/worker-daemon/typings/`
9
-
10
- ## Typings
11
-
12
- ### `DaemonConfig`
13
-
14
- **File:** `daemon-config.interface.ts`
15
-
16
- Parsed contents of `worker.toml`. Missing keys use
17
- defaults from
18
- [daemon-defaults.constant.ts](constants.md).
19
-
20
- ```ts
21
- interface DaemonConfig {
22
- readonly contextPath: string;
23
- readonly itemLimit: number;
24
- readonly indexLimit: number;
25
- readonly timeoutMs: number;
26
- readonly itemTtlMs: number;
27
- }
28
- ```
29
-
30
- | Property | Type | Default | Description |
31
- |---------------|----------|----------|-------------------|
32
- | `contextPath` | `string` | -- | Absolute path to |
33
- | | | | the context dir |
34
- | `itemLimit` | `number` | `1000` | Max content items |
35
- | | | | in cache |
36
- | `indexLimit` | `number` | `100` | Max index entries |
37
- | | | | in cache |
38
- | `timeoutMs` | `number` | `300000` | Daemon idle |
39
- | | | | timeout (ms) |
40
- | `itemTtlMs` | `number` | `60000` | Per-item cache |
41
- | | | | TTL (ms) |
42
-
43
- ### `IpcRequest`
44
-
45
- **File:** `ipc-handler.interface.ts`
46
-
47
- A JSON-RPC 2.0 request sent to the daemon over IPC.
48
-
49
- ```ts
50
- interface IpcRequest {
51
- readonly jsonrpc: '2.0';
52
- readonly id: number | string;
53
- readonly method: string;
54
- readonly params?: unknown;
55
- }
56
- ```
57
-
58
- ### `IpcErrorDetail`
59
-
60
- **File:** `ipc-handler.interface.ts`
61
-
62
- Error detail included in a failed JSON-RPC response.
63
-
64
- ```ts
65
- interface IpcErrorDetail {
66
- readonly code: number;
67
- readonly message: string;
68
- readonly data?: unknown;
69
- }
70
- ```
71
-
72
- ### `IpcResponse`
73
-
74
- **File:** `ipc-handler.interface.ts`
75
-
76
- A JSON-RPC 2.0 response returned by the daemon.
77
-
78
- ```ts
79
- interface IpcResponse {
80
- readonly jsonrpc: '2.0';
81
- readonly id: number | string;
82
- readonly result?: unknown;
83
- readonly error?: IpcErrorDetail;
84
- }
85
- ```
86
-
87
- ### `IpcHandler`
88
-
89
- **File:** `ipc-handler.interface.ts`
90
-
91
- Function type for handling a single IPC request and
92
- returning a JSON-RPC response.
93
-
94
- ```ts
95
- type IpcHandler = (
96
- request: IpcRequest,
97
- ) => Promise<IpcResponse>;
98
- ```
99
-
100
- The `WorkerDaemon.handleRequest` method satisfies this
101
- type and is passed to `createIpcServer`.
102
-
103
- ### `WasmModules`
104
-
105
- **File:** `wasm-modules.interface.ts`
106
-
107
- References to the compiled and instantiated WASM
108
- modules and their shared exported memory.
109
-
110
- ```ts
111
- interface WasmModules {
112
- readonly memory: WebAssembly.Memory;
113
- readonly kbWorker: WebAssembly.Instance;
114
- readonly embedding?: WebAssembly.Instance;
115
- }
116
- ```
117
-
118
- | Property | Type | Description |
119
- |-------------|------------------------|------------------------|
120
- | `memory` | `WebAssembly.Memory` | Linear memory exported |
121
- | | | by `kb-worker.wasm` |
122
- | `kbWorker` | `WebAssembly.Instance` | Instantiated |
123
- | | | `kb-worker.wasm` |
124
- | `embedding` | `WebAssembly.Instance?`| Instantiated |
125
- | | | `default-embedding.wasm`. |
126
- | | | Optional -- absent only |
127
- | | | when build omits the |
128
- | | | embedding crate. |
129
-
130
- Returned by `loadWasmModules()`.
131
-
132
- No spec -- typings are compile-time only.
package/docs/overview.md DELETED
@@ -1,191 +0,0 @@
1
- # @dikolab/kbdb -- Knowledge Base Database
2
-
3
- *A file-based knowledge store and MCP server for
4
- AI agents -- your second brain, on disk.*
5
-
6
- ## What Is kbdb?
7
-
8
- AI agents forget everything between sessions. kbdb
9
- gives them a searchable, persistent memory.
10
-
11
- Import your documents, and kbdb indexes them
12
- automatically. Search returns ranked results
13
- instantly. No database server to install, no cloud
14
- account to create -- your knowledge base is just a
15
- folder on disk.
16
-
17
- kbdb works as both a command-line tool and an
18
- [MCP](https://modelcontextprotocol.io/) server.
19
- Humans use it from the terminal; AI agents connect
20
- to it as a tool.
21
-
22
- ## Who Is This For?
23
-
24
- - **AI agent developers** -- persistent, searchable
25
- knowledge across agent sessions
26
- - **MCP tool authors** -- a local knowledge backend
27
- for Model Context Protocol servers
28
- - **Knowledge workers** -- a second brain your AI
29
- assistant can search across conversations
30
- - **Vibe coders** -- a searchable doc store for
31
- your AI-assisted projects
32
- - **CLI-first developers** -- composable commands
33
- for managing knowledge from the terminal
34
-
35
- ## What Can It Do?
36
-
37
- - **Import** Markdown files with automatic keyword
38
- extraction and indexing
39
- - **Search** three ways: keyword (default),
40
- hybrid, or AI similarity via `--algo`
41
- - **Auto-fallback** -- loosens your query when
42
- exact matches return nothing
43
- - **Recall** sections with progressive context
44
- (depth 0--3)
45
- - **Smart updates** -- re-learning a file replaces
46
- the old version, not duplicates it
47
- - **Near-duplicate detection** -- warns when
48
- imported content closely matches existing data
49
- - **Skills** -- reusable prompt templates with
50
- fill-in-the-blank arguments
51
- - **Agents** -- AI profiles combining a persona
52
- with skills
53
- - **Auto-capture** -- MCP server proactively
54
- suggests knowledge to store from conversations
55
- - **Export and sync** -- snapshot your knowledge
56
- base for backup or sharing across machines
57
- - **Verify** database integrity and clean up stale
58
- data
59
- - **MCP server** with 20 tools, prompts, resources,
60
- and completions
61
-
62
- ### Install
63
-
64
- ```sh
65
- # Node.js
66
- npm install -g @dikolab/kbdb
67
-
68
- # Deno
69
- deno add @dikolab/kbdb
70
- ```
71
-
72
- ## Architecture
73
-
74
- Five layers, top to bottom:
75
-
76
- ```
77
- User / AI Agent
78
- -> kbdb command (CLI or MCP mode)
79
- -> Worker Client (TypeScript IPC)
80
- -> Worker Daemon (background process)
81
- -> Rust/WASM Engine
82
- -> File Database (folder on disk)
83
- ```
84
-
85
- **kbdb command** -- One executable, two modes. CLI
86
- mode runs short-lived commands (`learn`, `search`,
87
- `recall`). MCP mode starts a long-lived server for
88
- AI agents over stdio.
89
-
90
- **Worker Client** -- Connects to the background
91
- daemon and gives your code a typed API.
92
-
93
- **Worker Daemon** -- Background process that loads
94
- the search engine, caches data in memory, and
95
- handles requests.
96
-
97
- **Search Engine** -- Compiled from Rust to
98
- WebAssembly for speed. Three modules handle
99
- tokenization, indexing, ranking, and file I/O.
100
-
101
- **File Database** -- Structured folder on disk.
102
- No server process. Portable, version-controllable,
103
- and human-readable.
104
-
105
- ### Technology Stack
106
-
107
- | Layer | Technology | What it does |
108
- |-------|-----------|--------------|
109
- | Runtime | Node.js, Deno | Runs the tools |
110
- | Language | TypeScript | CLI, MCP server, I/O |
111
- | Engine | Rust -> WebAssembly | Fast indexing and search |
112
- | Protocol | MCP | AI agent integration |
113
- | Distribution | NPM, JSR | Install from either |
114
- | Storage | File database | Your data, in a folder |
115
-
116
- ## Design Principles
117
-
118
- 1. **No server needed** -- A folder is your whole
119
- database. Works anywhere.
120
- 2. **Built for AI agents** -- Commands and output
121
- are optimized for machine use.
122
- 3. **MCP-first** -- The MCP server is a primary
123
- interface, not an add-on.
124
- 4. **Fast** -- Heavy work runs in compiled Rust
125
- via WebAssembly.
126
- 5. **Portable** -- Runs on Node.js or Deno. The
127
- database is a plain directory.
128
- 6. **Section-level search** -- Returns the specific
129
- passage that matters, not a whole document.
130
-
131
- ## Design Documents
132
-
133
- Deeper docs for each part of the system. You don't
134
- need to read these to use kbdb -- they're here for
135
- contributors and anyone curious about internals.
136
-
137
- - **[Database](goals/database.md)** -- File storage
138
- engine, directory structure, section and document
139
- operations
140
- - **[Query Parser](goals/query-parser.md)** --
141
- Tokenization, query parsing, keyword extraction,
142
- ranking
143
- - **[Hybrid Search](goals/hybrid-search.md)** --
144
- Lexical + vector retrieval with score fusion
145
- - **[Document](goals/document.md)** -- Content format
146
- with markers and cross-references
147
- - **[Content Parser](goals/content-parser.md)** --
148
- Marker extraction from section content
149
- - **[Content Composer](goals/content-composer.md)** --
150
- Rendered Markdown composition from identifiers
151
- - **[CLI](goals/cli.md)** -- Commands, run modes,
152
- output formats
153
- - **[MCP](goals/mcp.md)** -- MCP server, tools,
154
- resources, agent wiring
155
- - **[Auto-Capture](goals/auto-capture.md)** --
156
- Proactive knowledge capture via MCP sampling
157
- - **[Sync](goals/sync.md)** -- Cross-machine export
158
- and import
159
- - **[Worker Daemon](goals/worker-daemon.md)** --
160
- Background daemon, WASM loading, caching, IPC
161
- - **[Worker Client](goals/worker-client.md)** --
162
- Client module, daemon discovery, typed API
163
-
164
- ## Project Status
165
-
166
- All layers are wired and working end-to-end. Every
167
- core operation -- learn, search, recall, content
168
- retrieval, skills, agents, export, and maintenance
169
- -- runs through the full stack.
170
-
171
- **548 e2e assertions** pass on both Node.js and Deno
172
- with zero failures and zero skips.
173
-
174
- - 18 CLI commands across 6 groups
175
- - 20 MCP tools with prompts, resources, completions
176
- - Three search algorithms: lexical, vector, hybrid
177
- - Sequential MCP request processing
178
- - Worker daemon with fully implemented WASM host I/O
179
- - Paginated search with rich metadata
180
- - Progressive recall at depths 0--3
181
- - Bidirectional reference graph
182
- - Skills and agent document management
183
- - Auto-capture hooks via MCP sampling
184
- - Export/import sync primitives
185
- - esbuild bundling (ESM + CJS + .d.ts)
186
- - Docker build containers
187
- - npm and JSR packages with documentation
188
-
189
- ## Links
190
-
191
- - **Repository**: https://gitlab.com/tech-slaves/knowledge-base-db
@@ -1,189 +0,0 @@
1
- # 0.1.0
2
-
3
- *Initial release -- 2026-06-19*
4
-
5
- The first public release of **@dikolab/kbdb**, a
6
- file-based knowledge base database that stores,
7
- indexes, and searches documentation without needing
8
- a database server.
9
-
10
- ---
11
-
12
- ## Highlights
13
-
14
- - Store documentation in a plain folder on disk --
15
- no server, no cloud account, no infrastructure
16
- - Ranked search powered by a Rust/WASM engine
17
- - CLI with 17 commands for managing documents,
18
- skills, and agents
19
- - MCP server that gives AI agents a searchable
20
- second brain
21
- - Runs on both Node.js (>= 20) and Deno (>= 2)
22
-
23
- ---
24
-
25
- ## Installation
26
-
27
- ```sh
28
- # Node.js
29
- npm install -g @dikolab/kbdb
30
-
31
- # Deno
32
- deno install -Agf jsr:@dikolab/kbdb/cli
33
- ```
34
-
35
- ---
36
-
37
- ## CLI
38
-
39
- The `kbdb` command organises 17 commands across
40
- 6 groups:
41
-
42
- | Group | Commands |
43
- |-------|----------|
44
- | Knowledge Base | `learn`, `unlearn`, `search`, `content` |
45
- | Database | `db init`, `db migrate` |
46
- | Maintenance | `status`, `check`, `gc`, `rebuild` |
47
- | Skills | `skill learn`, `skill list`, `skill get`, `skill delete` |
48
- | Agents | `agent create`, `agent list`, `agent get`, `agent delete` |
49
- | Server | `mcp` |
50
-
51
- See the [CLI Reference](../details/cli.md) for
52
- options and examples.
53
-
54
- ---
55
-
56
- ## Search and Ranking
57
-
58
- Search uses **BM25F** field-weighted ranking with
59
- three indexed fields per section:
60
-
61
- | Field | Weight | Description |
62
- |-------|--------|-------------|
63
- | Heading | 2.0x | Titles and headings |
64
- | Body | 1.0x | Main text content |
65
- | Code | 1.5x | Code blocks and inline code |
66
-
67
- Queries support keywords, exact phrases
68
- (`"error handling"`), boolean operators
69
- (`auth AND token`, `cache OR redis`), and term
70
- exclusions (`auth -oauth`).
71
-
72
- See [How Search Works](../details/search-and-ranking.md)
73
- for internals.
74
-
75
- ---
76
-
77
- ## MCP Server
78
-
79
- The `kbdb mcp` command starts an MCP server over
80
- stdio using JSON-RPC 2.0 (MCP Protocol 2025-11-25).
81
-
82
- **17 tools** available to AI agents:
83
-
84
- - **Knowledge Base**: `search`, `learn`, `unlearn`,
85
- `retrieve`, `content`
86
- - **Database**: `status`, `check`, `gc`, `rebuild`
87
- - **Skills**: `skill-learn`, `skill-list`,
88
- `skill-get`, `skill-delete`
89
- - **Agents**: `agent-create`, `agent-list`,
90
- `agent-get`, `agent-delete`
91
-
92
- Works with Claude Code, Claude for VS Code,
93
- Claude Desktop, and any MCP-compatible agent.
94
- See the [MCP Server Guide](../details/mcp-server.md)
95
- for setup instructions.
96
-
97
- ---
98
-
99
- ## Skills and Agents
100
-
101
- **Skills** are reusable templates with placeholder
102
- arguments. Store common prompts or instructions
103
- once and reference them by name.
104
-
105
- **Agents** are AI agent profiles that combine a
106
- persona with a set of skills. Create named agent
107
- configurations that persist across sessions.
108
-
109
- ---
110
-
111
- ## Storage
112
-
113
- All data lives in a `.kbdb` directory on disk:
114
-
115
- ```
116
- .kbdb/
117
- catalog.toml -- version and stats
118
- corpus.bin -- term frequencies
119
- sections/ -- indexed content
120
- documents/ -- document groupings
121
- ```
122
-
123
- Content is identified by **kbid** -- a content-
124
- addressed ID derived from SHA-256 (128-bit
125
- truncation, base32-encoded). Identical content
126
- always produces the same kbid.
127
-
128
- See [Storage Architecture](../details/storage.md)
129
- for file formats and design details.
130
-
131
- ---
132
-
133
- ## Rust/WASM Engine
134
-
135
- The search engine is written in Rust and compiled
136
- to WebAssembly. Four crates handle different
137
- responsibilities:
138
-
139
- | Crate | Role |
140
- |-------|------|
141
- | `kbdb-shared` | Memory management, encoding, error types |
142
- | `kbdb-fs-database` | Storage, indexing, search |
143
- | `kbdb-query-parser` | Query tokenization and parsing |
144
- | `kbdb-worker` | IPC request dispatch |
145
-
146
- WASM modules load at runtime -- no native
147
- compilation needed on the user's machine.
148
-
149
- ---
150
-
151
- ## Build Pipeline
152
-
153
- Development uses a Docker-based build pipeline
154
- that includes Node.js, Deno, Rust, and wasm-pack:
155
-
156
- ```sh
157
- make build # Full pipeline: lint, test, wasm, bundle
158
- make test-node # E2E smoke tests (Node.js)
159
- make test-deno # E2E smoke tests (Deno)
160
- make lint # Rust + TypeScript linting
161
- ```
162
-
163
- See the [Makefile](../../Makefile) for all targets.
164
-
165
- ---
166
-
167
- ## Platforms
168
-
169
- | Runtime | Minimum version |
170
- |---------|----------------|
171
- | Node.js | 20.0.0 |
172
- | Deno | 2.0.0 |
173
-
174
- Published to:
175
-
176
- - [npm](https://www.npmjs.com/package/@dikolab/kbdb)
177
- as `@dikolab/kbdb`
178
- - [JSR](https://jsr.io/@dikolab/kbdb) as
179
- `@dikolab/kbdb`
180
-
181
- ---
182
-
183
- ## Documentation
184
-
185
- - [CLI Reference](../details/cli.md)
186
- - [MCP Server Guide](../details/mcp-server.md)
187
- - [Search and Ranking](../details/search-and-ranking.md)
188
- - [Storage Architecture](../details/storage.md)
189
- - [Library API](../details/library-api.md)
@@ -1,46 +0,0 @@
1
- # 0.1.1
2
-
3
- *Patch release -- 2026-06-20*
4
-
5
- Fixes a Deno type-checking error that blocked
6
- `deno publish`, and improves the build pipeline.
7
-
8
- ---
9
-
10
- ## Fixes
11
-
12
- - **Deno type error in WASM memory buffer** --
13
- `WebAssembly.Memory.buffer` returns
14
- `ArrayBuffer | SharedArrayBuffer` under Deno's
15
- type system but `ArrayBuffer` under Node.js.
16
- Added explicit cast to satisfy both type-checkers.
17
-
18
- ## Improvements
19
-
20
- - **WASM directory resolution** -- `resolveBaseDir`
21
- now supports three fallback strategies for
22
- locating WASM files:
23
- 1. `__dirname` (Node.js CJS)
24
- 2. `import.meta.dirname` (Deno local, Node.js
25
- ESM v21.2+)
26
- 3. URL-based derivation (JSR remote modules)
27
-
28
- - **Build pipeline cleanup** -- `build-wasm.sh`
29
- and `build-ts.sh` now remove stale output
30
- directories (`src/wasm/`, `dist/`) before
31
- building, ensuring fresh builds every time.
32
-
33
- - **Rust test stability** -- Added
34
- `--test-threads=1` to Rust integration tests
35
- to prevent race conditions on shared WASM
36
- return-slot globals.
37
-
38
- ---
39
-
40
- ## Upgrade
41
-
42
- ```sh
43
- npm install -g @dikolab/kbdb@0.1.1
44
- ```
45
-
46
- No breaking changes from 0.1.0.
@@ -1,38 +0,0 @@
1
- # 0.1.2
2
-
3
- *Patch release -- 2026-06-20*
4
-
5
- Fixes WASM loading failure when installed from JSR
6
- (`deno install -Agf jsr:@dikolab/kbdb/cli`).
7
-
8
- ---
9
-
10
- ## Fixes
11
-
12
- - **WASM loading from JSR remote URLs** -- When
13
- installed from JSR, module URLs use `https://`
14
- instead of filesystem paths. `path.join` mangled
15
- these URLs by stripping the `//` in `https://`,
16
- and `readFileSync` cannot open URLs. Added
17
- URL-aware path joining (`joinPath`) and async
18
- WASM loading via `fetch()` for remote URLs.
19
-
20
- - **Worker script resolution for JSR** --
21
- `resolveWorkerScript` now preserves URL format
22
- when the script directory is a remote URL, so
23
- `deno run` receives a valid URL instead of a
24
- mangled path.
25
-
26
- ---
27
-
28
- ## Upgrade
29
-
30
- ```sh
31
- # Node.js
32
- npm install -g @dikolab/kbdb@0.1.2
33
-
34
- # Deno
35
- deno install -Agf jsr:@dikolab/kbdb/cli
36
- ```
37
-
38
- No breaking changes from 0.1.1.
@@ -1,42 +0,0 @@
1
- # 0.1.3
2
-
3
- *Patch release -- 2026-06-20*
4
-
5
- Fixes WASM binaries missing from JSR package, which
6
- caused 404 errors when installed via
7
- `deno install -Agf jsr:@dikolab/kbdb/cli`.
8
-
9
- ---
10
-
11
- ## Fixes
12
-
13
- - **WASM binaries excluded from JSR publish** --
14
- `deno publish` respects `.gitignore`, which listed
15
- `src/wasm/`. Additionally, wasm-pack generates
16
- `.gitignore` files (containing `*`) inside each
17
- WASM output directory. Both layers prevented WASM
18
- binaries from being included in the JSR package.
19
- The build script now removes wasm-pack's nested
20
- `.gitignore` files, and the publish script
21
- temporarily un-ignores `src/wasm/` during
22
- `deno publish`.
23
-
24
- - **Excluded unnecessary wasm-pack artifacts from
25
- JSR** -- Added `publish.exclude` patterns for
26
- `.js`, `.d.ts`, and `package.json` files inside
27
- `src/wasm/`, so only the `.wasm` binaries are
28
- published to JSR.
29
-
30
- ---
31
-
32
- ## Upgrade
33
-
34
- ```sh
35
- # Node.js
36
- npm install -g @dikolab/kbdb@0.1.3
37
-
38
- # Deno
39
- deno install -Agf jsr:@dikolab/kbdb/cli
40
- ```
41
-
42
- No breaking changes from 0.1.2.