Repository navigation
Knowledge Base
Create or update knowledge entries (batch). Each entry: id present → update that document in place (partial — only provided fields change); id absent → upsert by type+project+category+title.
kb(entries[])
Each entry: {id?, type, project, title, content?, notes?, category?, tags?, metadata?}
-
id — when present, addresses an existing document for an in-place partial update instead of the natural-key upsert. Use this to retitle a document without creating a duplicate under the new title (the natural key includes title, so a title change without
idwould otherwise insert a new row). Errors if the id doesn't exist; required fields (type/project/title/content) can be repointed but not blanked (an explicit empty string is rejected). -
type —
decision,fact,note,relation -
project — project name (upsert key component when
idabsent) -
title — concise, searchable (upsert key component when
idabsent) - content — body text, ≤500 chars
-
notes — unlimited narrative; shown only with
verbose=true -
category — grouping within a project (upsert key component when
idabsent) - tags — string array
- metadata — key-value map
content supports [[Title]] autolinks: each [[...]] reference resolves — as an item id shape (e.g. [[BB-9]]) against backlog items, otherwise against a same-project KB document title — and creates an explains edge from this document to the resolved target. An unresolved title is silently skipped (no error). Idempotent: re-writing a document drops stale autolinks and recreates current ones, so edges always reflect the latest content. On an id-addressed update, autolinks are only re-scanned when content is one of the provided fields — a title-only or notes-only update leaves existing autolinks untouched.
FTS is refreshed after both the natural-key upsert path and the id-addressed update path, so a search immediately reflects a retitle or content change.
Retrieve entries by ID or filters. Returns summaries by default. Requires domain: "kb".
get(domain, ids?[], types?[], projects?[], categories?[], query?, tags?[], limit?, verbose?)
Modes:
-
ids=[] — batch fetch full documents by ID (omits misses)
-
Filters — list summaries matching types/projects/categories/query/tags
-
types — array of entry types to filter (e.g.,
["decision", "fact"]) -
categories — array of categories to filter (e.g.,
["arch", "ops"]) -
projects — array of project names to filter
-
limit — default 10, max 500
-
verbose — include notes (default false)
Summary responses use date-only updated_at (YYYY-MM-DD). Fields project_id and component are omitted when empty.
ids=[] fetch with verbose: true includes an edges array sidecar (every edge touching the document, as source or target); omitted when verbose is false.
Example — list architecture decisions:
{
"domain": "kb",
"types": ["decision"],
"categories": ["arch"],
"projects": ["ouroboros"]
}Full-text search (FTS5) across all documents. Returns summaries. Requires domain: "kb".
search(domain, query?, queries?[], types?[], projects?[], categories?[], limit?)
Modes:
-
query — single search string
-
queries=[] — batch search; response is positional
[[...], [...]] -
types — array of entry types to filter
-
categories — array of categories to filter
-
projects — array of project names to filter
-
limit — per query, default 10, max 500
A multi-term query is implicit AND (every term must match). If an AND query with 2+ terms matches zero rows, the search retries once with the terms OR-joined instead of returning a silent empty result; single-term queries never fall back. A widened row carries relaxed: true; omitted (falsy) on an exact match. If the OR retry also matches nothing, the result is a genuinely empty (non-relaxed) list. This AND-with-OR-fallback applies identically to backlog and roadmap search (see Backlog#search, Roadmap#search) — backlog signals it via a response-text prefix instead of a per-row field, since backlog search results aren't summary objects with room for an extra field.
"2+ terms"/"single-term" above means server-side FTS5 tokens, not whitespace-separated words: the query is split on every rune that isn't a letter or digit — so hyphens, underscores, and punctuation are all separators, matching unicode61's default tokenizer boundary. A caller wanting to know in advance whether fallback was even possible must tokenize the same way, not just count words. bb_data looks like one word but is two tokens (bb, data) and IS eligible for the OR fallback; only a true single-token query like foo is not. Practical consequence: for a multi-token query, relaxed: false (or absent) on an empty result means the AND attempt AND the OR retry both matched nothing — the search was already maximally widened, and re-querying with the same terms won't help.
Example — search for decisions in a specific category:
{
"domain": "kb",
"query": "database schema",
"types": ["decision"],
"categories": ["arch"]
}Note:
delete,export, andimportare CLI-only operations. See CLI for usage.