@dikolab/kbdb 0.5.0 → 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.
- package/CLA.md +68 -0
- package/LICENSE +676 -12
- package/LICENSING.md +58 -0
- package/README.md +47 -24
- package/README.md.bak +320 -0
- package/dist/README.md +320 -0
- package/dist/{chunk-BJXEVALU.mjs → chunk-QLJ33C74.mjs} +44 -44
- package/dist/chunk-QLJ33C74.mjs.map +7 -0
- package/dist/cli.cjs +550 -232
- package/dist/cli.cjs.map +4 -4
- package/dist/cli.d.ts +0 -8
- package/dist/cli.mjs +483 -154
- package/dist/cli.mjs.map +4 -4
- package/dist/kbdb-worker.cjs +36 -5
- package/dist/kbdb-worker.cjs.map +3 -3
- package/dist/mod.cjs +89 -30
- package/dist/mod.cjs.map +4 -4
- package/dist/mod.mjs +88 -30
- package/dist/mod.mjs.map +4 -4
- package/dist/src/cli.d.ts +0 -8
- package/dist/src/shared/cli/constants/defaults.constant.d.ts +1 -1
- package/dist/src/shared/cli/constants/recfile-command-field-map.constant.d.ts +8 -0
- package/dist/src/shared/cli/constants/recfile-field-maps.constant.d.ts +21 -0
- package/dist/src/shared/cli/functions/compute-directory-level.function.d.ts +14 -0
- package/dist/src/shared/cli/functions/dispatch-command.function.d.ts +2 -28
- package/dist/src/shared/cli/functions/format-command-output.function.d.ts +14 -0
- package/dist/src/shared/cli/functions/format-db-not-found.function.d.ts +20 -0
- package/dist/src/shared/cli/functions/format-output.function.d.ts +1 -0
- package/dist/src/shared/cli/functions/format-recfile-output.function.d.ts +11 -0
- package/dist/src/shared/cli/functions/render-recfile-value.function.d.ts +11 -0
- package/dist/src/shared/cli/functions/resolve-db-dir.function.d.ts +24 -0
- package/dist/src/shared/cli/functions/resolve-recfile-key.function.d.ts +9 -0
- package/dist/src/shared/cli/functions/run-db-path.function.d.ts +10 -0
- package/dist/src/shared/cli/functions/run-export.function.d.ts +8 -4
- package/dist/src/shared/cli/functions/run-import.function.d.ts +4 -0
- package/dist/src/shared/cli/functions/run-learn.function.d.ts +12 -0
- package/dist/src/shared/cli/index.d.ts +4 -1
- package/dist/src/shared/cli/typings/cli-options.interface.d.ts +9 -2
- package/dist/src/shared/cli/typings/db-resolution.interface.d.ts +9 -0
- package/dist/src/shared/cli/typings/recfile-field-map.type.d.ts +10 -0
- package/dist/src/shared/version/constants/version.constant.d.ts +1 -1
- package/dist/src/shared/wasm-codec/functions/decode-option-u8.function.d.ts +9 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-records.function.d.ts +4 -0
- package/dist/src/shared/wasm-codec/functions/encode-add-section-params.function.d.ts +2 -45
- package/dist/src/shared/wasm-codec/functions/encode-update-section-params.function.d.ts +10 -1
- package/dist/src/shared/wasm-codec/index.d.ts +1 -1
- package/dist/src/shared/wasm-codec/typings/add-section-input.model.d.ts +6 -0
- package/dist/src/shared/wasm-codec/typings/section-record-trailing.model.d.ts +5 -0
- package/dist/src/shared/wasm-codec/typings/section-record.model.d.ts +5 -0
- package/dist/src/shared/worker-client/functions/build-deno-permissions.function.d.ts +11 -0
- package/dist/src/shared/worker-client/functions/read-crash-reason.function.d.ts +9 -0
- package/dist/src/shared/worker-client/functions/resolve-spawn-script.function.d.ts +6 -0
- package/dist/src/shared/worker-client/functions/spawn-daemon.function.d.ts +1 -1
- package/dist/src/shared/worker-client/typings/section.model.d.ts +5 -0
- package/dist/src/shared/worker-client/typings/worker-client-options.interface.d.ts +0 -6
- package/dist/src/shared/worker-daemon/functions/count-files.function.d.ts +12 -0
- package/dist/src/shared/worker-daemon/functions/handle-import.function.d.ts +2 -0
- package/dist/src/shared/worker-daemon/functions/handle-read-ops.function.d.ts +8 -0
- package/dist/src/shared/worker-daemon/functions/validate-daemon-path.function.d.ts +15 -0
- package/dist/src/worker.d.ts +0 -7
- package/dist/wasm/default-embedding/kbdb_default_embedding_bg.wasm +0 -0
- package/dist/wasm/default-embedding/package.json +1 -1
- package/dist/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
- package/dist/wasm/fs-database/package.json +1 -1
- package/dist/wasm/fs-migration/package.json +1 -1
- package/dist/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
- package/dist/wasm/kb-worker/package.json +1 -1
- package/dist/wasm/query-parser/kbdb_query_parser_bg.wasm +0 -0
- package/dist/wasm/query-parser/package.json +1 -1
- package/dist/worker.d.ts +0 -7
- package/dist/worker.mjs +37 -6
- package/dist/worker.mjs.map +3 -3
- package/package.json +10 -9
- package/dist/chunk-BJXEVALU.mjs.map +0 -7
- package/dist/src/shared/cli/functions/resolve-raw-db-path.function.d.ts +0 -10
- package/docs/details/README.md +0 -30
- package/docs/details/agent-tooling.md +0 -132
- package/docs/details/cli.md +0 -777
- package/docs/details/knowledge-base.md +0 -180
- package/docs/details/library-api.md +0 -495
- package/docs/details/mcp-server.md +0 -482
- package/docs/details/search-and-ranking.md +0 -575
- package/docs/details/storage.md +0 -531
- package/docs/goals/agents.md +0 -751
- package/docs/goals/architecture.svg +0 -198
- package/docs/goals/auto-capture.md +0 -378
- package/docs/goals/benchmarking.md +0 -296
- package/docs/goals/cli.md +0 -2654
- package/docs/goals/concurrency.md +0 -259
- package/docs/goals/content-composer.md +0 -609
- package/docs/goals/content-parser.md +0 -279
- package/docs/goals/database.md +0 -1679
- package/docs/goals/document.md +0 -368
- package/docs/goals/hybrid-search.md +0 -465
- package/docs/goals/mcp.md +0 -1541
- package/docs/goals/overview.md +0 -124
- package/docs/goals/query-parser.md +0 -373
- package/docs/goals/query-result.md +0 -860
- package/docs/goals/semantic-dedup.md +0 -233
- package/docs/goals/skills.md +0 -810
- package/docs/goals/sync.md +0 -217
- package/docs/goals/worker-client.md +0 -1005
- package/docs/goals/worker-daemon.md +0 -1547
- package/docs/modules/overview.md +0 -319
- package/docs/modules/rust/embedding/module.md +0 -91
- package/docs/modules/rust/fs-database/functions/document.md +0 -48
- package/docs/modules/rust/fs-database/functions/integrity.md +0 -79
- package/docs/modules/rust/fs-database/functions/io.md +0 -87
- package/docs/modules/rust/fs-database/functions/module.md +0 -22
- package/docs/modules/rust/fs-database/functions/query-exec.md +0 -44
- package/docs/modules/rust/fs-database/functions/section.md +0 -76
- package/docs/modules/rust/fs-database/indexes/btree.md +0 -35
- package/docs/modules/rust/fs-database/indexes/corpus.md +0 -61
- package/docs/modules/rust/fs-database/indexes/inverted.md +0 -60
- package/docs/modules/rust/fs-database/indexes/module.md +0 -64
- package/docs/modules/rust/fs-database/indexes/positional.md +0 -39
- package/docs/modules/rust/fs-database/indexes/vectors.md +0 -110
- package/docs/modules/rust/fs-database/module.md +0 -150
- package/docs/modules/rust/fs-database/types/catalog.md +0 -53
- package/docs/modules/rust/fs-database/types/module.md +0 -12
- package/docs/modules/rust/fs-database/types/section.md +0 -127
- package/docs/modules/rust/kb-worker/functions/compose.md +0 -57
- package/docs/modules/rust/kb-worker/functions/module.md +0 -20
- package/docs/modules/rust/kb-worker/functions/retrieve.md +0 -194
- package/docs/modules/rust/kb-worker/functions/search.md +0 -173
- package/docs/modules/rust/kb-worker/functions/write.md +0 -172
- package/docs/modules/rust/kb-worker/module.md +0 -171
- package/docs/modules/rust/kb-worker/types/cache.md +0 -90
- package/docs/modules/rust/kb-worker/types/context.md +0 -26
- package/docs/modules/rust/kb-worker/types/module.md +0 -16
- package/docs/modules/rust/kb-worker/types/status.md +0 -29
- package/docs/modules/rust/kb-worker/types/token.md +0 -50
- package/docs/modules/rust/overview.md +0 -531
- package/docs/modules/rust/query-parser/functions/extract.md +0 -56
- package/docs/modules/rust/query-parser/functions/module.md +0 -18
- package/docs/modules/rust/query-parser/functions/parse.md +0 -33
- package/docs/modules/rust/query-parser/functions/pipeline.md +0 -9
- package/docs/modules/rust/query-parser/functions/rank.md +0 -85
- package/docs/modules/rust/query-parser/module.md +0 -131
- package/docs/modules/rust/query-parser/types/cache.md +0 -39
- package/docs/modules/rust/query-parser/types/keyphrase.md +0 -71
- package/docs/modules/rust/query-parser/types/module.md +0 -18
- package/docs/modules/rust/query-parser/types/token.md +0 -46
- package/docs/modules/rust/shared/content-composer/functions.md +0 -114
- package/docs/modules/rust/shared/content-composer/module.md +0 -147
- package/docs/modules/rust/shared/content-composer/types.md +0 -93
- package/docs/modules/rust/shared/content-parser/functions.md +0 -72
- package/docs/modules/rust/shared/content-parser/module.md +0 -99
- package/docs/modules/rust/shared/content-parser/types.md +0 -71
- package/docs/modules/rust/shared/corpus/module.md +0 -24
- package/docs/modules/rust/shared/corpus/types.md +0 -141
- package/docs/modules/rust/shared/document/module.md +0 -25
- package/docs/modules/rust/shared/document/types.md +0 -154
- package/docs/modules/rust/shared/encode/module.md +0 -22
- package/docs/modules/rust/shared/encode/traits.md +0 -304
- package/docs/modules/rust/shared/error/module.md +0 -28
- package/docs/modules/rust/shared/error/types.md +0 -302
- package/docs/modules/rust/shared/kbid/module.md +0 -24
- package/docs/modules/rust/shared/kbid/types.md +0 -147
- package/docs/modules/rust/shared/memory/functions.md +0 -209
- package/docs/modules/rust/shared/memory/module.md +0 -24
- package/docs/modules/rust/shared/module.md +0 -196
- package/docs/modules/rust/shared/pipeline/functions.md +0 -141
- package/docs/modules/rust/shared/pipeline/module.md +0 -62
- package/docs/modules/rust/shared/pipeline/types.md +0 -43
- package/docs/modules/rust/shared/query/module.md +0 -27
- package/docs/modules/rust/shared/query/types.md +0 -236
- package/docs/modules/rust/shared/section/module.md +0 -25
- package/docs/modules/rust/shared/section/types.md +0 -294
- package/docs/modules/rust/shared/term/module.md +0 -25
- package/docs/modules/rust/shared/term/types.md +0 -139
- package/docs/modules/typescript/cli.md +0 -131
- package/docs/modules/typescript/kbdb-worker.md +0 -150
- package/docs/modules/typescript/overview.md +0 -400
- package/docs/modules/typescript/shared/auto-capture/module.md +0 -73
- package/docs/modules/typescript/shared/cli/constants.md +0 -23
- package/docs/modules/typescript/shared/cli/functions.md +0 -809
- package/docs/modules/typescript/shared/cli/module.md +0 -138
- package/docs/modules/typescript/shared/cli/typings.md +0 -197
- package/docs/modules/typescript/shared/embedding/functions.md +0 -200
- package/docs/modules/typescript/shared/embedding/module.md +0 -77
- package/docs/modules/typescript/shared/embedding/typings.md +0 -124
- package/docs/modules/typescript/shared/hash/functions.md +0 -20
- package/docs/modules/typescript/shared/hash/module.md +0 -21
- package/docs/modules/typescript/shared/log/constants.md +0 -82
- package/docs/modules/typescript/shared/log/functions.md +0 -131
- package/docs/modules/typescript/shared/log/module.md +0 -153
- package/docs/modules/typescript/shared/log/typings.md +0 -82
- package/docs/modules/typescript/shared/mcp/classes.md +0 -179
- package/docs/modules/typescript/shared/mcp/functions.md +0 -386
- package/docs/modules/typescript/shared/mcp/module.md +0 -160
- package/docs/modules/typescript/shared/mcp/typings.md +0 -529
- package/docs/modules/typescript/shared/module.md +0 -110
- package/docs/modules/typescript/shared/platform/functions.md +0 -42
- package/docs/modules/typescript/shared/platform/module.md +0 -25
- package/docs/modules/typescript/shared/runtime/functions.md +0 -26
- package/docs/modules/typescript/shared/runtime/module.md +0 -27
- package/docs/modules/typescript/shared/runtime/typings.md +0 -13
- package/docs/modules/typescript/shared/version/module.md +0 -27
- package/docs/modules/typescript/shared/wasm-codec/functions.md +0 -391
- package/docs/modules/typescript/shared/wasm-codec/module.md +0 -98
- package/docs/modules/typescript/shared/worker-client/classes.md +0 -264
- package/docs/modules/typescript/shared/worker-client/functions.md +0 -175
- package/docs/modules/typescript/shared/worker-client/module.md +0 -92
- package/docs/modules/typescript/shared/worker-client/typings.md +0 -511
- package/docs/modules/typescript/shared/worker-daemon/classes.md +0 -239
- package/docs/modules/typescript/shared/worker-daemon/constants.md +0 -37
- package/docs/modules/typescript/shared/worker-daemon/functions.md +0 -234
- package/docs/modules/typescript/shared/worker-daemon/module.md +0 -118
- package/docs/modules/typescript/shared/worker-daemon/typings.md +0 -132
- package/docs/overview.md +0 -191
- package/docs/release-notes/0.1.0.md +0 -189
- package/docs/release-notes/0.1.1.md +0 -46
- package/docs/release-notes/0.1.2.md +0 -38
- package/docs/release-notes/0.1.3.md +0 -42
- package/docs/release-notes/0.2.0.md +0 -147
- package/docs/release-notes/0.3.0.md +0 -89
- package/docs/release-notes/0.3.1.md +0 -121
- package/docs/release-notes/0.3.2.md +0 -64
- package/docs/release-notes/0.4.0.md +0 -80
- package/docs/release-notes/0.4.1.md +0 -149
- package/docs/release-notes/0.4.3.md +0 -60
- package/docs/release-notes/0.5.0.md +0 -41
- package/docs/release-notes/README.md +0 -16
package/docs/goals/skills.md
DELETED
|
@@ -1,810 +0,0 @@
|
|
|
1
|
-
# Skills -- Reusable AI Agent Capabilities
|
|
2
|
-
|
|
3
|
-
*Parameterised prompt templates stored in the knowledge
|
|
4
|
-
base that AI agents can discover, retrieve, and invoke
|
|
5
|
-
by name.*
|
|
6
|
-
|
|
7
|
-
## Goal
|
|
8
|
-
|
|
9
|
-
Skills are reusable capability definitions that AI
|
|
10
|
-
agents can discover through MCP and invoke by name.
|
|
11
|
-
Each skill is a prompt template with named argument
|
|
12
|
-
placeholders. At invocation time, an AI agent supplies
|
|
13
|
-
argument values and receives a rendered prompt message
|
|
14
|
-
ready for use in its workflow.
|
|
15
|
-
|
|
16
|
-
Skills are the composable building blocks for agent
|
|
17
|
-
workflows. Rather than hard-coding prompt text into
|
|
18
|
-
agent code, skills are stored in the knowledge base,
|
|
19
|
-
indexed for search, and surfaced through the MCP
|
|
20
|
-
prompts protocol. This makes them discoverable,
|
|
21
|
-
shareable, and updateable independently of any
|
|
22
|
-
consuming agent.
|
|
23
|
-
|
|
24
|
-
Skills are stored as knowledge base sections with
|
|
25
|
-
`sectionType = 'skill'`. They benefit from the same
|
|
26
|
-
content-addressing, indexing, and search infrastructure
|
|
27
|
-
as regular sections. The skill name and description are
|
|
28
|
-
weighted during indexing so that agents can find
|
|
29
|
-
relevant skills through keyword search.
|
|
30
|
-
|
|
31
|
-
## Skill Content Schema
|
|
32
|
-
|
|
33
|
-
### SkillDefinition type
|
|
34
|
-
|
|
35
|
-
The full definition of a skill as stored in and
|
|
36
|
-
returned from the knowledge base:
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
interface SkillDefinition {
|
|
40
|
-
/** Unique human-readable identifier (kebab-case). */
|
|
41
|
-
readonly name: string;
|
|
42
|
-
/** Short sentence describing what the skill does. */
|
|
43
|
-
readonly description: string;
|
|
44
|
-
/** Declared arguments. Auto-detected when omitted. */
|
|
45
|
-
readonly arguments?: readonly SkillArgument[];
|
|
46
|
-
/** Prompt template body with {{argName}} placeholders. */
|
|
47
|
-
readonly body: string;
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### SkillArgument type
|
|
52
|
-
|
|
53
|
-
A single named argument accepted by a skill template:
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
interface SkillArgument {
|
|
57
|
-
/** Argument name matching a {{name}} placeholder. */
|
|
58
|
-
readonly name: string;
|
|
59
|
-
/** Value type hint for the MCP client. */
|
|
60
|
-
readonly type?: 'string' | 'number' | 'boolean';
|
|
61
|
-
/** Human-readable description for MCP prompt listing. */
|
|
62
|
-
readonly description?: string;
|
|
63
|
-
/** Whether the argument must be supplied for render. */
|
|
64
|
-
readonly required?: boolean;
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Template Syntax
|
|
69
|
-
|
|
70
|
-
Skill bodies use a simple `{{argName}}` placeholder
|
|
71
|
-
syntax:
|
|
72
|
-
|
|
73
|
-
- `{{argName}}` is replaced with the supplied argument
|
|
74
|
-
value during `prompts/get`.
|
|
75
|
-
- Argument names are **auto-detected** by scanning the
|
|
76
|
-
body for all `{{...}}` patterns. Auto-detected
|
|
77
|
-
arguments have no type, description, or required
|
|
78
|
-
constraint unless explicitly declared in
|
|
79
|
-
`arguments`.
|
|
80
|
-
- When an argument value is not supplied, the
|
|
81
|
-
placeholder remains in the rendered output
|
|
82
|
-
unchanged -- no error is raised.
|
|
83
|
-
- No nested templates, conditionals, loops, or
|
|
84
|
-
escaping mechanism. `{{` not followed by a valid
|
|
85
|
-
identifier and `}}` is treated as literal text.
|
|
86
|
-
|
|
87
|
-
### Skill Content Example
|
|
88
|
-
|
|
89
|
-
Full JSON representation of a skill as stored on disk
|
|
90
|
-
and returned by `skill-get`:
|
|
91
|
-
|
|
92
|
-
```json
|
|
93
|
-
{
|
|
94
|
-
"name": "summarize-document",
|
|
95
|
-
"description": "Summarize a document into key points
|
|
96
|
-
with configurable depth",
|
|
97
|
-
"arguments": [
|
|
98
|
-
{
|
|
99
|
-
"name": "docid",
|
|
100
|
-
"type": "string",
|
|
101
|
-
"description": "Document identifier to summarize",
|
|
102
|
-
"required": true
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"name": "max_points",
|
|
106
|
-
"type": "number",
|
|
107
|
-
"description": "Maximum number of bullet points",
|
|
108
|
-
"required": false
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
"body": "Summarize the document identified by
|
|
112
|
-
{{docid}}.\nExtract at most {{max_points}} key
|
|
113
|
-
points.\nReturn as a bulleted markdown list."
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## Storage
|
|
118
|
-
|
|
119
|
-
Skills are stored as knowledge base sections with
|
|
120
|
-
`sectionType = 'skill'`. No separate file format or
|
|
121
|
-
entity type is used. This means skills:
|
|
122
|
-
|
|
123
|
-
- Receive a kbid via the same content-addressing scheme
|
|
124
|
-
as regular sections.
|
|
125
|
-
- Are indexed by the same term-extraction pipeline.
|
|
126
|
-
- Are returned by `search` when the query matches a
|
|
127
|
-
skill's name, description, or body terms.
|
|
128
|
-
- Are cleaned up by `gc` when no document references
|
|
129
|
-
them (though skills are never attached to documents
|
|
130
|
-
by default).
|
|
131
|
-
|
|
132
|
-
### Section File Format
|
|
133
|
-
|
|
134
|
-
Skills are persisted in
|
|
135
|
-
`.kbdb/sections/{prefix}/{kbid}.sec`. The file uses the
|
|
136
|
-
same TOML header / JSON body format as all section
|
|
137
|
-
files:
|
|
138
|
-
|
|
139
|
-
```toml
|
|
140
|
-
kbid = "abc123def456abc123def456ab"
|
|
141
|
-
docids = []
|
|
142
|
-
type = "skill"
|
|
143
|
-
title = "summarize-document"
|
|
144
|
-
description = "Summarize a document into key points
|
|
145
|
-
with configurable depth"
|
|
146
|
-
size = 423
|
|
147
|
-
token_count = 35
|
|
148
|
-
heading_token_count = 2
|
|
149
|
-
body_token_count = 35
|
|
150
|
-
code_token_count = 0
|
|
151
|
-
created_at = "2026-06-19T10:00:00Z"
|
|
152
|
-
checksum = "sha256:e3b0c44298fc1c149afb..."
|
|
153
|
-
---
|
|
154
|
-
{"name":"summarize-document","description":"Summarize a
|
|
155
|
-
document into key points with configurable depth",
|
|
156
|
-
"arguments":[{"name":"docid","type":"string",
|
|
157
|
-
"description":"Document identifier to summarize",
|
|
158
|
-
"required":true},{"name":"max_points","type":"number",
|
|
159
|
-
"description":"Maximum number of bullet points",
|
|
160
|
-
"required":false}],"body":"Summarize the document
|
|
161
|
-
identified by {{docid}}.\nExtract at most
|
|
162
|
-
{{max_points}} key points.\nReturn as a bulleted
|
|
163
|
-
markdown list."}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Header fields specific to skill sections:
|
|
167
|
-
|
|
168
|
-
| Field | Source |
|
|
169
|
-
|-------------|-------------------------------------|
|
|
170
|
-
| `type` | Always `"skill"` |
|
|
171
|
-
| `title` | Skill `name` field |
|
|
172
|
-
| `description` | Skill `description` field |
|
|
173
|
-
|
|
174
|
-
The JSON body below the `---` separator is the full
|
|
175
|
-
serialised `SkillDefinition` object.
|
|
176
|
-
|
|
177
|
-
### Indexing
|
|
178
|
-
|
|
179
|
-
Skill sections are indexed using the standard indexing
|
|
180
|
-
weights:
|
|
181
|
-
|
|
182
|
-
- `title` (the skill name) is indexed with **2.0x
|
|
183
|
-
heading weight** -- skill names rank higher in
|
|
184
|
-
keyword searches than body text.
|
|
185
|
-
- `description` is indexed at **1.0x body weight**.
|
|
186
|
-
- `body` text (the template) is indexed at **1.0x
|
|
187
|
-
body weight**.
|
|
188
|
-
|
|
189
|
-
This means an agent searching for `"summarize"` will
|
|
190
|
-
find the `summarize-document` skill through its name
|
|
191
|
-
(higher score) or through occurrences of the word in
|
|
192
|
-
its description or body.
|
|
193
|
-
|
|
194
|
-
### Content-Addressing
|
|
195
|
-
|
|
196
|
-
The kbid for a skill section is computed using the
|
|
197
|
-
same SHA-256-based content-addressing scheme used for
|
|
198
|
-
all sections. The kbid is derived from the full
|
|
199
|
-
serialised content of the `SkillDefinition` JSON body.
|
|
200
|
-
|
|
201
|
-
Two skills with identical names but different bodies
|
|
202
|
-
receive different kbids. Two skills with identical
|
|
203
|
-
bodies receive the same kbid (deduplication applies).
|
|
204
|
-
|
|
205
|
-
## MCP Surface
|
|
206
|
-
|
|
207
|
-
### Skills as MCP Prompts
|
|
208
|
-
|
|
209
|
-
Skills are exposed through the MCP prompts protocol
|
|
210
|
-
(see [MCP](mcp.md) for the full protocol
|
|
211
|
-
specification). Each skill appears as an `McpPrompt`
|
|
212
|
-
entry in the `prompts/list` response and is retrievable
|
|
213
|
-
by name via `prompts/get`.
|
|
214
|
-
|
|
215
|
-
The skill `name` field maps directly to the MCP prompt
|
|
216
|
-
`name` field. MCP clients discover available skills by
|
|
217
|
-
calling `prompts/list` and invoke them by calling
|
|
218
|
-
`prompts/get` with the skill name and argument values.
|
|
219
|
-
|
|
220
|
-
### prompts/list
|
|
221
|
-
|
|
222
|
-
The `prompts/list` request returns all skills as
|
|
223
|
-
`McpPrompt` entries. The response includes skills
|
|
224
|
-
alongside agent prompts (agents use an `agent:` prefix;
|
|
225
|
-
see [Agents](agents.md)):
|
|
226
|
-
|
|
227
|
-
```json
|
|
228
|
-
{
|
|
229
|
-
"prompts": [
|
|
230
|
-
{
|
|
231
|
-
"name": "summarize-document",
|
|
232
|
-
"description": "Summarize a document into key
|
|
233
|
-
points with configurable depth",
|
|
234
|
-
"arguments": [
|
|
235
|
-
{
|
|
236
|
-
"name": "docid",
|
|
237
|
-
"description": "Document identifier
|
|
238
|
-
to summarize",
|
|
239
|
-
"required": true
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
"name": "max_points",
|
|
243
|
-
"description": "Maximum number of
|
|
244
|
-
bullet points",
|
|
245
|
-
"required": false
|
|
246
|
-
}
|
|
247
|
-
]
|
|
248
|
-
}
|
|
249
|
-
]
|
|
250
|
-
}
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
Skill arguments are mapped from `SkillArgument` to MCP
|
|
254
|
-
prompt arguments. The `type` field is not included in
|
|
255
|
-
the MCP response (MCP prompt arguments are untyped
|
|
256
|
-
strings from the protocol's perspective).
|
|
257
|
-
|
|
258
|
-
### prompts/get
|
|
259
|
-
|
|
260
|
-
The `prompts/get` request supplies a skill name and
|
|
261
|
-
optional argument values:
|
|
262
|
-
|
|
263
|
-
```json
|
|
264
|
-
{
|
|
265
|
-
"name": "summarize-document",
|
|
266
|
-
"arguments": {
|
|
267
|
-
"docid": "DOC-001",
|
|
268
|
-
"max_points": "5"
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
The response is a single user-role message containing
|
|
274
|
-
the rendered template:
|
|
275
|
-
|
|
276
|
-
```json
|
|
277
|
-
{
|
|
278
|
-
"messages": [
|
|
279
|
-
{
|
|
280
|
-
"role": "user",
|
|
281
|
-
"content": {
|
|
282
|
-
"type": "text",
|
|
283
|
-
"text": "Summarize the document identified
|
|
284
|
-
by DOC-001.\nExtract at most 5 key
|
|
285
|
-
points.\nReturn as a bulleted markdown
|
|
286
|
-
list."
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
]
|
|
290
|
-
}
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
Argument values are always strings in the MCP protocol.
|
|
294
|
-
Numeric and boolean argument values are passed as
|
|
295
|
-
their string representation and substituted verbatim
|
|
296
|
-
into the template.
|
|
297
|
-
|
|
298
|
-
### Argument Substitution
|
|
299
|
-
|
|
300
|
-
Template rendering applies simple string replacement:
|
|
301
|
-
|
|
302
|
-
1. For each `{{argName}}` placeholder in the body,
|
|
303
|
-
look up `argName` in the supplied arguments map.
|
|
304
|
-
2. If found, replace the placeholder with the string
|
|
305
|
-
value.
|
|
306
|
-
3. If not found, leave the placeholder unchanged
|
|
307
|
-
(no error).
|
|
308
|
-
4. Return the resulting string as the message text.
|
|
309
|
-
|
|
310
|
-
Substitution is applied left-to-right, scanning for
|
|
311
|
-
`{{` and matching `}}`. Each placeholder is replaced
|
|
312
|
-
independently. Multiple occurrences of the same
|
|
313
|
-
placeholder are each replaced with the same value.
|
|
314
|
-
|
|
315
|
-
## MCP Tools
|
|
316
|
-
|
|
317
|
-
### skill-learn
|
|
318
|
-
|
|
319
|
-
Create a new skill in the knowledge base.
|
|
320
|
-
|
|
321
|
-
| Parameter | Type | Required | Description |
|
|
322
|
-
|---------------|--------|----------|------------------------------|
|
|
323
|
-
| `name` | string | yes | Skill name (kebab-case) |
|
|
324
|
-
| `description` | string | yes | What the skill does |
|
|
325
|
-
| `arguments` | array | no | Declared argument definitions|
|
|
326
|
-
| `body` | string | yes | Template body text |
|
|
327
|
-
|
|
328
|
-
**Returns:** `AddSectionResult` containing the assigned
|
|
329
|
-
kbid:
|
|
330
|
-
|
|
331
|
-
```json
|
|
332
|
-
{
|
|
333
|
-
"kbid": "abc123def456abc123def456ab",
|
|
334
|
-
"name": "summarize-document",
|
|
335
|
-
"arguments": ["docid", "max_points"]
|
|
336
|
-
}
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
The `arguments` array in the return value lists the
|
|
340
|
-
auto-detected placeholder names found in the body,
|
|
341
|
-
regardless of whether `arguments` was supplied in the
|
|
342
|
-
request.
|
|
343
|
-
|
|
344
|
-
Maps to client method:
|
|
345
|
-
`client.addSection({ sectionType: 'skill', ... })`
|
|
346
|
-
|
|
347
|
-
### skill-list
|
|
348
|
-
|
|
349
|
-
List all skills stored in the knowledge base.
|
|
350
|
-
|
|
351
|
-
No parameters.
|
|
352
|
-
|
|
353
|
-
**Returns:** JSON array of skill summary objects:
|
|
354
|
-
|
|
355
|
-
```json
|
|
356
|
-
[
|
|
357
|
-
{
|
|
358
|
-
"kbid": "abc123def456abc123def456ab",
|
|
359
|
-
"name": "summarize-document",
|
|
360
|
-
"description": "Summarize a document into key
|
|
361
|
-
points with configurable depth",
|
|
362
|
-
"argumentCount": 2
|
|
363
|
-
}
|
|
364
|
-
]
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
Maps to client method: `client.listByType('skill')`
|
|
368
|
-
|
|
369
|
-
### skill-get
|
|
370
|
-
|
|
371
|
-
Retrieve the full definition of a skill by name or
|
|
372
|
-
kbid.
|
|
373
|
-
|
|
374
|
-
| Parameter | Type | Required | Description |
|
|
375
|
-
|-----------|--------|----------|--------------------------|
|
|
376
|
-
| `name` | string | no* | Skill name to look up |
|
|
377
|
-
| `kbid` | string | no* | Skill kbid to look up |
|
|
378
|
-
|
|
379
|
-
\* At least one of `name` or `kbid` must be supplied.
|
|
380
|
-
When both are supplied, `kbid` takes precedence.
|
|
381
|
-
|
|
382
|
-
**Returns:** Full `SkillDefinition` with kbid:
|
|
383
|
-
|
|
384
|
-
```json
|
|
385
|
-
{
|
|
386
|
-
"kbid": "abc123def456abc123def456ab",
|
|
387
|
-
"name": "summarize-document",
|
|
388
|
-
"description": "Summarize a document into key
|
|
389
|
-
points with configurable depth",
|
|
390
|
-
"arguments": [
|
|
391
|
-
{
|
|
392
|
-
"name": "docid",
|
|
393
|
-
"type": "string",
|
|
394
|
-
"description": "Document identifier",
|
|
395
|
-
"required": true
|
|
396
|
-
}
|
|
397
|
-
],
|
|
398
|
-
"body": "Summarize the document identified by
|
|
399
|
-
{{docid}}.\nExtract at most {{max_points}}
|
|
400
|
-
key points.\nReturn as a bulleted markdown list."
|
|
401
|
-
}
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
Maps to client method: `client.getSection(kbid)` or
|
|
405
|
-
`client.listByType('skill')` filtered by name.
|
|
406
|
-
|
|
407
|
-
### skill-delete
|
|
408
|
-
|
|
409
|
-
Remove a skill from the knowledge base by kbid.
|
|
410
|
-
|
|
411
|
-
| Parameter | Type | Required | Description |
|
|
412
|
-
|-----------|--------|----------|------------------------|
|
|
413
|
-
| `kbid` | string | yes | Skill kbid to remove |
|
|
414
|
-
|
|
415
|
-
**Returns:** Removal confirmation:
|
|
416
|
-
|
|
417
|
-
```json
|
|
418
|
-
{
|
|
419
|
-
"kbid": "abc123def456abc123def456ab",
|
|
420
|
-
"removed": true
|
|
421
|
-
}
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
When the kbid does not exist, `removed` is `false`
|
|
425
|
-
and no error is thrown.
|
|
426
|
-
|
|
427
|
-
Maps to client method: `client.removeSection(kbid)`
|
|
428
|
-
|
|
429
|
-
## CLI Commands
|
|
430
|
-
|
|
431
|
-
### kbdb skill learn
|
|
432
|
-
|
|
433
|
-
```
|
|
434
|
-
kbdb skill learn [options] --name <name> --body <file|->
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
Create a new skill in the knowledge base by reading
|
|
438
|
-
the template body from a file or stdin.
|
|
439
|
-
|
|
440
|
-
**Options:**
|
|
441
|
-
|
|
442
|
-
| Option | Short | Required | Description |
|
|
443
|
-
|-----------------|-------|----------|--------------------------------|
|
|
444
|
-
| `--name <n>` | | yes | Skill name (kebab-case) |
|
|
445
|
-
| `--description` | | no | Short description of the skill |
|
|
446
|
-
| `--body <file>` | | yes | Template body: file path or `-`|
|
|
447
|
-
| `--db <path>` | | no | Path to .kbdb directory |
|
|
448
|
-
|
|
449
|
-
**Behaviour:**
|
|
450
|
-
|
|
451
|
-
Reads the template body from the specified file path
|
|
452
|
-
or from stdin when `--body -` is given. Scans the body
|
|
453
|
-
for `{{argName}}` placeholders to auto-detect argument
|
|
454
|
-
names. Serialises the `SkillDefinition` to JSON and
|
|
455
|
-
calls `addSection` with `sectionType = 'skill'`.
|
|
456
|
-
|
|
457
|
-
**Output:**
|
|
458
|
-
|
|
459
|
-
```json
|
|
460
|
-
{
|
|
461
|
-
"kbid": "abc123def456abc123def456ab",
|
|
462
|
-
"name": "summarize-document",
|
|
463
|
-
"arguments": ["docid", "max_points"]
|
|
464
|
-
}
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
**Delegation chain:**
|
|
468
|
-
```
|
|
469
|
-
src/cli.ts parseArgs()
|
|
470
|
-
-> findDb() / promptUser() / runInit()
|
|
471
|
-
-> createWorkerClient({ contextPath })
|
|
472
|
-
-> versionGate(client, dbDir)
|
|
473
|
-
-> dispatchCommand(client, options)
|
|
474
|
-
-> runSkillLearn(client, options)
|
|
475
|
-
-> client.addSection({
|
|
476
|
-
sectionType: 'skill',
|
|
477
|
-
content: serialisedJson,
|
|
478
|
-
title: name,
|
|
479
|
-
description })
|
|
480
|
-
-> IPC -> worker daemon
|
|
481
|
-
-> kb-worker.wasm
|
|
482
|
-
-> fs-database.wasm (store)
|
|
483
|
-
-> query-parser.wasm (index)
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
**Examples:**
|
|
487
|
-
|
|
488
|
-
```sh
|
|
489
|
-
# Create a skill from a file
|
|
490
|
-
kbdb skill learn --name summarize-document \
|
|
491
|
-
--description "Summarize docs into key points" \
|
|
492
|
-
--body ./prompts/summarize.txt
|
|
493
|
-
|
|
494
|
-
# Create a skill from stdin
|
|
495
|
-
cat ./prompts/review.txt | kbdb skill learn \
|
|
496
|
-
--name code-review --body -
|
|
497
|
-
|
|
498
|
-
# Specify database directory explicitly
|
|
499
|
-
kbdb skill learn --name my-skill --body ./skill.txt \
|
|
500
|
-
--db /path/to/project
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
### kbdb skill list
|
|
504
|
-
|
|
505
|
-
```
|
|
506
|
-
kbdb skill list [options]
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
List all skills stored in the knowledge base.
|
|
510
|
-
|
|
511
|
-
**Options:**
|
|
512
|
-
|
|
513
|
-
| Option | Short | Required | Description |
|
|
514
|
-
|---------------|-------|----------|-------------------------|
|
|
515
|
-
| `--db <path>` | | no | Path to .kbdb directory |
|
|
516
|
-
|
|
517
|
-
**Output:**
|
|
518
|
-
|
|
519
|
-
JSON array of skill summary objects:
|
|
520
|
-
|
|
521
|
-
```json
|
|
522
|
-
[
|
|
523
|
-
{
|
|
524
|
-
"kbid": "abc123def456abc123def456ab",
|
|
525
|
-
"name": "summarize-document",
|
|
526
|
-
"description": "Summarize a document into key
|
|
527
|
-
points with configurable depth",
|
|
528
|
-
"argumentCount": 2
|
|
529
|
-
}
|
|
530
|
-
]
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
Empty array when no skills are stored.
|
|
534
|
-
|
|
535
|
-
**Delegation chain:**
|
|
536
|
-
```
|
|
537
|
-
src/cli.ts parseArgs()
|
|
538
|
-
-> findDb() / promptUser() / runInit()
|
|
539
|
-
-> createWorkerClient({ contextPath })
|
|
540
|
-
-> versionGate(client, dbDir)
|
|
541
|
-
-> dispatchCommand(client, options)
|
|
542
|
-
-> runSkillList(client, options)
|
|
543
|
-
-> client.listByType('skill')
|
|
544
|
-
-> IPC -> worker daemon
|
|
545
|
-
-> kb-worker.wasm
|
|
546
|
-
-> fs-database.wasm (scan)
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
**Examples:**
|
|
550
|
-
|
|
551
|
-
```sh
|
|
552
|
-
# List all skills in current directory's database
|
|
553
|
-
kbdb skill list
|
|
554
|
-
|
|
555
|
-
# List skills from a specific database
|
|
556
|
-
kbdb skill list --db /path/to/project
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
### kbdb skill get
|
|
560
|
-
|
|
561
|
-
```
|
|
562
|
-
kbdb skill get [options] <name-or-kbid>
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
Retrieve the full definition of a skill by its name or
|
|
566
|
-
kbid.
|
|
567
|
-
|
|
568
|
-
**Arguments:**
|
|
569
|
-
|
|
570
|
-
- `<name-or-kbid>` -- the skill name or 26-character
|
|
571
|
-
kbid string. Required.
|
|
572
|
-
|
|
573
|
-
**Options:**
|
|
574
|
-
|
|
575
|
-
| Option | Short | Required | Description |
|
|
576
|
-
|---------------|-------|----------|-------------------------|
|
|
577
|
-
| `--db <path>` | | no | Path to .kbdb directory |
|
|
578
|
-
|
|
579
|
-
**Output:**
|
|
580
|
-
|
|
581
|
-
Full `SkillDefinition` with kbid:
|
|
582
|
-
|
|
583
|
-
```json
|
|
584
|
-
{
|
|
585
|
-
"kbid": "abc123def456abc123def456ab",
|
|
586
|
-
"name": "summarize-document",
|
|
587
|
-
"description": "Summarize a document into key points
|
|
588
|
-
with configurable depth",
|
|
589
|
-
"arguments": [
|
|
590
|
-
{
|
|
591
|
-
"name": "docid",
|
|
592
|
-
"type": "string",
|
|
593
|
-
"description": "Document identifier to summarize",
|
|
594
|
-
"required": true
|
|
595
|
-
},
|
|
596
|
-
{
|
|
597
|
-
"name": "max_points",
|
|
598
|
-
"type": "number",
|
|
599
|
-
"description": "Maximum number of bullet points",
|
|
600
|
-
"required": false
|
|
601
|
-
}
|
|
602
|
-
],
|
|
603
|
-
"body": "Summarize the document identified by
|
|
604
|
-
{{docid}}.\nExtract at most {{max_points}} key
|
|
605
|
-
points.\nReturn as a bulleted markdown list."
|
|
606
|
-
}
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
**Delegation chain:**
|
|
610
|
-
```
|
|
611
|
-
src/cli.ts parseArgs()
|
|
612
|
-
-> findDb() / promptUser() / runInit()
|
|
613
|
-
-> createWorkerClient({ contextPath })
|
|
614
|
-
-> versionGate(client, dbDir)
|
|
615
|
-
-> dispatchCommand(client, options)
|
|
616
|
-
-> runSkillGet(client, options)
|
|
617
|
-
-> client.getSection(kbid) (if kbid)
|
|
618
|
-
-> client.listByType('skill') (if name)
|
|
619
|
-
-> IPC -> worker daemon
|
|
620
|
-
-> kb-worker.wasm
|
|
621
|
-
-> fs-database.wasm (fetch)
|
|
622
|
-
```
|
|
623
|
-
|
|
624
|
-
**Examples:**
|
|
625
|
-
|
|
626
|
-
```sh
|
|
627
|
-
# Get a skill by name
|
|
628
|
-
kbdb skill get summarize-document
|
|
629
|
-
|
|
630
|
-
# Get a skill by kbid
|
|
631
|
-
kbdb skill get abc123def456abc123def456ab
|
|
632
|
-
|
|
633
|
-
# Use explicit database path
|
|
634
|
-
kbdb skill get summarize-document --db /path/to/project
|
|
635
|
-
```
|
|
636
|
-
|
|
637
|
-
### kbdb skill delete
|
|
638
|
-
|
|
639
|
-
```
|
|
640
|
-
kbdb skill delete [options] <kbid>
|
|
641
|
-
```
|
|
642
|
-
|
|
643
|
-
Remove a skill from the knowledge base by kbid.
|
|
644
|
-
|
|
645
|
-
**Arguments:**
|
|
646
|
-
|
|
647
|
-
- `<kbid>` -- the 26-character kbid of the skill to
|
|
648
|
-
remove. Required. Names are not accepted to prevent
|
|
649
|
-
accidental deletion of the wrong skill when duplicate
|
|
650
|
-
names exist.
|
|
651
|
-
|
|
652
|
-
**Options:**
|
|
653
|
-
|
|
654
|
-
| Option | Short | Required | Description |
|
|
655
|
-
|---------------|-------|----------|-------------------------|
|
|
656
|
-
| `--db <path>` | | no | Path to .kbdb directory |
|
|
657
|
-
|
|
658
|
-
**Output:**
|
|
659
|
-
|
|
660
|
-
```json
|
|
661
|
-
{
|
|
662
|
-
"kbid": "abc123def456abc123def456ab",
|
|
663
|
-
"removed": true
|
|
664
|
-
}
|
|
665
|
-
```
|
|
666
|
-
|
|
667
|
-
**Delegation chain:**
|
|
668
|
-
```
|
|
669
|
-
src/cli.ts parseArgs()
|
|
670
|
-
-> findDb() / promptUser() / runInit()
|
|
671
|
-
-> createWorkerClient({ contextPath })
|
|
672
|
-
-> versionGate(client, dbDir)
|
|
673
|
-
-> dispatchCommand(client, options)
|
|
674
|
-
-> runSkillDelete(client, options)
|
|
675
|
-
-> client.removeSection(kbid)
|
|
676
|
-
-> IPC -> worker daemon
|
|
677
|
-
-> kb-worker.wasm
|
|
678
|
-
-> fs-database.wasm (delete)
|
|
679
|
-
```
|
|
680
|
-
|
|
681
|
-
**Examples:**
|
|
682
|
-
|
|
683
|
-
```sh
|
|
684
|
-
# Delete a skill by kbid
|
|
685
|
-
kbdb skill delete abc123def456abc123def456ab
|
|
686
|
-
|
|
687
|
-
# Delete from a specific database
|
|
688
|
-
kbdb skill delete abc123def456abc123def456ab \
|
|
689
|
-
--db /path/to/project
|
|
690
|
-
```
|
|
691
|
-
|
|
692
|
-
## Edge Cases
|
|
693
|
-
|
|
694
|
-
**Duplicate skill names.** Two or more skills may share
|
|
695
|
-
the same `name` (they receive different kbids because
|
|
696
|
-
their content differs). `skill-get` by name returns the
|
|
697
|
-
most recently created skill with that name. `skill-list`
|
|
698
|
-
returns all entries. This is not an error.
|
|
699
|
-
|
|
700
|
-
**Empty body.** A skill with an empty `body` string is
|
|
701
|
-
rejected with an `INVALID_PARAMS` error. A prompt
|
|
702
|
-
template must have non-empty content.
|
|
703
|
-
|
|
704
|
-
**Body without placeholders.** A skill body that
|
|
705
|
-
contains no `{{...}}` patterns is valid. It is a
|
|
706
|
-
fixed prompt with no arguments. The `arguments` array
|
|
707
|
-
is empty and `prompts/get` returns the body unchanged.
|
|
708
|
-
|
|
709
|
-
**Invalid JSON in section content.** If a skill
|
|
710
|
-
section's stored JSON body cannot be parsed as a valid
|
|
711
|
-
`SkillDefinition`, `skill-get` and `prompts/get` return
|
|
712
|
-
a parse error for that skill. Other skills are
|
|
713
|
-
unaffected.
|
|
714
|
-
|
|
715
|
-
**Skill referenced by agent then deleted.** When a
|
|
716
|
-
skill is deleted after an agent has been created
|
|
717
|
-
referencing it, the agent's skill reference becomes a
|
|
718
|
-
dangling kbid. The agent is not deleted. See
|
|
719
|
-
[Agents](agents.md) for how dangling references are
|
|
720
|
-
handled at retrieval time.
|
|
721
|
-
|
|
722
|
-
## Default Skills
|
|
723
|
-
|
|
724
|
-
### Overview
|
|
725
|
-
|
|
726
|
-
When a new database is created via `kbdb db init`, a
|
|
727
|
-
set of default skills are automatically installed.
|
|
728
|
-
These skills provide baseline capabilities that
|
|
729
|
-
improve AI agent effectiveness. Default skills are
|
|
730
|
-
stored as regular skill sections (no special treatment
|
|
731
|
-
in the engine) and can be deleted by users if not
|
|
732
|
-
needed.
|
|
733
|
-
|
|
734
|
-
### `query-guidance` Default Skill
|
|
735
|
-
|
|
736
|
-
A built-in skill that teaches AI agents how to
|
|
737
|
-
effectively search the knowledge base. This addresses
|
|
738
|
-
the limitation that lexical search requires
|
|
739
|
-
disciplined query generation for good recall.
|
|
740
|
-
|
|
741
|
-
**Skill definition:**
|
|
742
|
-
|
|
743
|
-
```json
|
|
744
|
-
{
|
|
745
|
-
"name": "query-guidance",
|
|
746
|
-
"description": "How to effectively search this knowledge base. Read this before issuing search queries.",
|
|
747
|
-
"arguments": [],
|
|
748
|
-
"body": "This knowledge base uses lexical search (stemmed BM25F), not semantic/vector search. Follow these guidelines for effective retrieval:\n\n1. Issue MULTIPLE short keyword queries rather than one long natural-language question. Each query should target 2-3 specific terms.\n\n2. EXPAND SYNONYMS yourself. \"login\" will not match \"sign-in\" unless both terms appear in the content. Try alternative phrasings: search for \"login\", then \"sign-in\", then \"authentication\".\n\n3. USE BOOLEAN AND PHRASE SYNTAX:\n - Exact phrases: \"error handling\"\n - Boolean AND: auth AND token\n - Boolean OR: cache OR redis\n - Exclusion: auth -oauth\n\n4. LEAN ON HEADINGS. Headings carry 2x weight in ranking. Search for terms that are likely in section titles.\n\n5. STEMMING IS AUTOMATIC. \"connections\" matches \"connect\", \"running\" matches \"run\". You do not need to try inflected forms.\n\n6. USE RECALL AFTER SEARCH. After finding relevant sections with search, use recall with increasing depth (0-3) to progressively expand context: depth 0 = full content, depth 1 = parent documents + back-references, depth 2 = siblings + forward references, depth 3 = referenced sections.\n\n7. CODE IDENTIFIERS ARE SPLIT. camelCase and snake_case names are decomposed: getUserById becomes searchable as \"get\", \"user\", \"by\", \"id\".\n\n8. PAGINATION. Default limit is 20 results. Use offset for additional pages if total > limit."
|
|
749
|
-
}
|
|
750
|
-
```
|
|
751
|
-
|
|
752
|
-
### Installation Behaviour
|
|
753
|
-
|
|
754
|
-
Default skills are installed during `kbdb db init`.
|
|
755
|
-
The `runDbInit` function installs each default skill
|
|
756
|
-
via `client.addSection({ sectionType: 'skill', ... })`
|
|
757
|
-
after creating the database scaffold.
|
|
758
|
-
|
|
759
|
-
Default skills receive kbids via the same
|
|
760
|
-
content-addressing scheme as user-created skills.
|
|
761
|
-
Re-running `db init` on a fresh database produces
|
|
762
|
-
identical kbids for the same default skill content.
|
|
763
|
-
|
|
764
|
-
### `memory-protocol` Default Skill
|
|
765
|
-
|
|
766
|
-
A built-in skill that teaches AI agents *when* and
|
|
767
|
-
*what* to store in the knowledge base. This addresses
|
|
768
|
-
the risk of the brain filling with transient junk or
|
|
769
|
-
failing to capture durable facts.
|
|
770
|
-
|
|
771
|
-
**Skill definition:**
|
|
772
|
-
|
|
773
|
-
```json
|
|
774
|
-
{
|
|
775
|
-
"name": "memory-protocol",
|
|
776
|
-
"description": "Guidelines for what to store in this knowledge base and when. Read this before using the learn tool.",
|
|
777
|
-
"arguments": [],
|
|
778
|
-
"body": "Follow these guidelines to keep the knowledge base accurate and useful:\n\n1. STORE DURABLE FACTS: decisions, architecture choices, configuration values, corrections to prior knowledge, API contracts, and resolved incidents. These are the facts that matter weeks later.\n\n2. DO NOT STORE: transient conversation context, debugging output, ephemeral task state, raw log dumps, or information that changes every session. The brain should contain knowledge, not activity logs.\n\n3. SEARCH BEFORE STORING. Always search the knowledge base before adding new content. If a section already covers the topic, use learn with --replace to update it rather than creating a duplicate.\n\n4. USE --replace FOR CORRECTIONS. When a fact changes (e.g., rate limit updated from 100 to 200 req/min), re-learn the corrected content with --replace so the old version is superseded. Without --replace, both the old and new versions coexist with equal ranking.\n\n5. ATTACH TAGS for scoping. Use tags like project name, domain, or topic (e.g., --tags auth,api,v2) so queries can be filtered by scope later.\n\n6. PREFER RECENT RESULTS. When search returns multiple sections covering the same topic, prefer the one with the most recent created_at timestamp -- it is more likely to reflect the current state.\n\n7. USE RECALL AFTER SEARCH. After finding relevant sections, use recall with increasing depth (0-3) to expand context progressively before making decisions.\n\n8. INCLUDE HEADINGS. Always provide a descriptive title when storing content. Headings carry 2x ranking weight -- omitting them significantly reduces searchability."
|
|
779
|
-
}
|
|
780
|
-
```
|
|
781
|
-
|
|
782
|
-
### Future Default Skills
|
|
783
|
-
|
|
784
|
-
Additional default skills may be added in future
|
|
785
|
-
versions (e.g. `content-authoring-tips`,
|
|
786
|
-
`search-syntax-reference`). Each follows the same
|
|
787
|
-
installation pattern and is a regular skill section.
|
|
788
|
-
|
|
789
|
-
## Design Constraints
|
|
790
|
-
|
|
791
|
-
- **Skills are plain sections.** No separate entity
|
|
792
|
-
type, storage schema, or index is introduced. Skills
|
|
793
|
-
use `sectionType = 'skill'` within the existing
|
|
794
|
-
section infrastructure.
|
|
795
|
-
- **Default skills are regular sections.** They use
|
|
796
|
-
the same storage, indexing, and retrieval
|
|
797
|
-
infrastructure. There is no distinction between a
|
|
798
|
-
default skill and a user-created skill beyond the
|
|
799
|
-
installation source.
|
|
800
|
-
- **No skill versioning.** Updating a skill means
|
|
801
|
-
creating a new skill section (new kbid) and
|
|
802
|
-
optionally deleting the old one. The kbid changes
|
|
803
|
-
whenever the content changes.
|
|
804
|
-
- **Template substitution is simple string
|
|
805
|
-
replacement.** There is no template engine, no
|
|
806
|
-
conditionals, no loops, no escaping, and no nested
|
|
807
|
-
templates. `{{argName}}` is the only syntax.
|
|
808
|
-
- **No template inheritance or composition.** Skills
|
|
809
|
-
do not reference other skills. Each skill is a
|
|
810
|
-
self-contained prompt template.
|