Datanotes
v3.0.0The engine of your second brain: Markdown notes as database tables, for you and your agents.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
read_note
Read a note or another file of the vault: `{path, content, front_matter, tags, modified_at, created_at, size}`. `content` is the whole text, front matter included; `tags` are without `#`, from the text and the front matter; the times are in the database's time zone. A missing file is an error. `path`: vault-relative, forward slashes.
| Parameter | Type | Description |
|---|---|---|
path * | string | The file's vault path, with its extension ("Films/Metropolis.md"). |
list_folder
The direct children of a vault folder: `{folder, folders, files}`, each a vault path, sorted; dot-files and dot-folders are left out. `folder` "" is the vault root. A missing folder is an error.
| Parameter | Type | Description |
|---|---|---|
folder | string | Vault-relative folder; "" is the vault root. |
search_notes
Plain-text search: every word of `query` must occur, case- and accent-insensitive, in the note's path or text; there are no operators. Returns `{query, results: [{path, score, matches: [{start, end, context}]}], total}`, best first: at most 200 notes (`total` counts them all) and 20 matches per note. `context_length`: characters of context on each side (default 100, max 1000).
| Parameter | Type | Description |
|---|---|---|
query * | string | |
context_length | integer | Characters of context on each side of a match (at most 1000). |
list_tables
List every table: `name`, `catalog`, `schema`, `qualified` (`personal.metrics.mood` — use it wherever a table is expected; `metrics.mood` or `mood` also work when unambiguous), `path` and, when declared, `description`, `aliases` (other words for what it records) and `tags`. Tables are defined in `metastore.yaml` (catalog → schema → table): read it freely, but it is read-only for agents and changes only through the schema operations (create_table, add_column, …). Returns `{tables, views}`: `views` lists the stored views (same fields, no path): select them like tables. `system.informatio…
describe_table
Describe a table (`catalog.schema.table` or a shorter unambiguous name): `qualified`, `name`, `catalog`, `schema`, `description`, `aliases`, `layout` (`folder`, `row_folder`: the folder pattern of new rows, `archive`), `options` (`partition`, `filename`, `archive`, `exclude`), typed `columns` with label/aliases/description and the dense flag, `untyped_fields`, `row_count`, and when set: `tags`, `bases` (the bases it inherits from, in order), `constraints` (its CHECKs, name → where), `row_template`, `history`, `autolink_target`, `fields` (their values). Before adding a column (e.g. a new met…
| Parameter | Type | Description |
|---|---|---|
table * | string |
create_table
Create a table: `name`, in `catalog` and `schema` (default: the database's defaults); the definition goes in metastore.yaml, the rows in `<root>/<catalog>/<schema>/<name>/`. Names: lowercase letters, digits, `_` (no dots: pass the catalog and the schema as their own arguments). - `description` (required): what a row of the table records. Every column needs its own `description` too, what it holds: the table is refused otherwise, with every missing one listed. Descriptions are how agents and people understand the schema, so write them for a reader who never saw the notes. The engine write…
| Parameter | Type | Description |
|---|---|---|
columns * | array | |
name * | string | |
aliases | Other words for what the table records, for agents. | |
archive | Archive folder: a folder name inside the table folder (default: the database's archive_folder). | |
autolink_target | May automatic links link the table's rows? Default: yes, unless its rows are named by a date or a time. | |
catalog | ||
description | What a row of the table records (required: the table is refused without it, as without a column's own description). | |
dry_run | boolean | |
exclude | Folders whose notes are never rows of the table (e.g. templates that create them). | |
fields | Untyped fields of the table (name → default), kept on every row; a field cannot share a name with a column. | |
filename | File name pattern of the rows, e.g. "{name}" (instead of time_column). | |
history | Keep the table's versions (time travel, restore); default: the database's setting. | |
partition | Sub-folder pattern of the rows, e.g. "{occurred_at:YYYY/MM}"; "" = flat. | |
row_template | Markdown body of new rows; {column} placeholders are filled from the row. | |
schema | ||
tags | Key/value labels of the table (strings), e.g. {"domain": "health"}. | |
time_column |
drop_table
Drop a table. Refused while it has rows unless `mode: "archive"`, which removes the definition from `metastore.yaml` and moves all rows to the table's archive folder (nothing is hard-deleted; undo restores). The transaction log is kept: `restore_table` can bring it back. Refused while a CHECK that follows links, or a `ref_where` / `ref_by`, of another table reads this table through a link (link targets are not rewritten): the conflicts name them; drop or change them first. The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
| Parameter | Type | Description |
|---|---|---|
table * | string | |
dry_run | boolean | |
mode | "archive": drop a table that has rows, moving them to its archive folder. |
add_column
Add a typed column. Sparse by default (written only on rows that have a value — use for metrics, e.g. `{"name": "metric_mood", "type": "integer", "min": 1, "max": 5, "label": "Mood", "aliases": ["mood"], "description": "Mood of the day, 1 = bad, 5 = great"}`). `description` is required: what the column holds, for the agents and people who read the schema (the engine writes it for `identity` "uuid" / "created" columns). `dense: true` in the spec adds it to every row with its `default`. Call `describe_table` first: never add a column whose meaning an existing column (name/label/aliases/descrip…
| Parameter | Type | Description |
|---|---|---|
column * | object | The column's spec: name, type, description and its other attributes; `dense: true` writes it on every row. |
table * | string | |
dry_run | boolean |
rename_column
Rename a column in metastore.yaml and on every row. Refused if `to_column` is already a column of the table; a row that has a stray `to_column` key with a different value is a conflict, and nothing is written. CHECKs, `ref_where` and `ref_by` that read the column (in this table, or through a link from another table: `parent.kind`) follow the new name. Views and note text that mention the old name are not rewritten. The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
| Parameter | Type | Description |
|---|---|---|
from_column * | string | |
table * | string | |
to_column * | string | |
dry_run | boolean |
drop_column
Remove a column from the schema and every row. Previous values are journaled; revert with `undo_migration`. Refused while a CHECK, `ref_where` or `ref_by` of any table reads the column (directly or through a link): the conflicts name them; drop or change them first. The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
| Parameter | Type | Description |
|---|---|---|
column * | string | The column's name. |
table * | string | |
dry_run | boolean |
alter_column
Change a column's attributes (type, min/max/step, values, required, default, label, aliases, description, note, `ref_where`, `ref_by` (see list_link_targets); `null` removes an attribute, except `description`, which changes but never goes (null or "" is refused); `dense` true/false). Refused with the list of violating rows when existing values do not satisfy the new definition. A different scale means a different column: add a new one instead of rescaling. To rename one enum value use `rename_value`. Dropping an enum value that a `ref_by` (of any table) allows as a target level is refused, nam…
| Parameter | Type | Description |
|---|---|---|
changes * | object | |
column * | string | The column's name. |
table * | string | |
dry_run | boolean |
alter_table
Alter a table: move it (`catalog`, `schema`), rename it (`name`), change `partition` / `filename` patterns, `description` (changes, never goes: "" is refused), `aliases`, `exclude` folders, `row_template` ("" removes it), `history` (true | false | "default"), `autolink_target` (true | false | "default": may automatic links link its rows? default: yes, unless its rows are named by a date or a time) or `tags` (key/value labels merged into the table's, e.g. `{"domain": "health"}`; a `null` value removes that tag; `clear_tags: true` removes every tag first, so with `tags` the table keeps exactly t…
| Parameter | Type | Description |
|---|---|---|
table * | string | |
aliases | ||
archive | Archive folder: a folder name inside the table folder (e.g. "_archive"); "" = the database default (`archive_folder`). Archived rows follow. | |
autolink_target | May automatic links link the table's rows? true, false, or "default" (yes, unless its rows are named by a date or a time). | |
catalog | ||
clear_tags | boolean | Remove every tag first (with `tags`: the table keeps exactly those). |
description | The new description: what a row records (it changes, never goes: "" is refused). | |
dry_run | boolean | |
exclude | ||
fields | Untyped fields to set (name → default, as in create_table `fields`); a null value removes that field. The other fields are kept; a name cannot be a column. | |
filename | ||
history | Keep the table's versions: true, false, or "default" (the database's setting). | |
name | ||
partition | ||
row_template | Markdown body of new rows; "" removes it. | |
schema | ||
tags | Tags to add or change (strings); a null value removes that tag. The other tags are kept. |
define_base
Create or replace a base: a named set of columns (same spec as `create_table`) that tables inherit, like a parent class (`bases` in `metastore.yaml`). Tables using it get the columns with the same name and meaning; `ref: "self"` means the inheriting table (e.g. a `parent` column with `hierarchy: true`). `bases` builds on other bases. Descriptions are required, as in create_table: `description` says what the tables of the base share, and each column has its `description` (a column given without one keeps the one the base had for it). Replacing a base changes every inheriting table: `rename_colu…
| Parameter | Type | Description |
|---|---|---|
columns * | array | |
name * | string | |
bases | ||
description | What the tables of the base share (required, as a table's description is). | |
drop_columns | ||
dry_run | boolean | |
rename_columns |
set_table_bases
Set the bases a table inherits from (`bases`, in order; `[]` removes them). Inherited columns come after `id` and before the table's own columns. An own column with the name of an inherited one is replaced by the inherited definition (rows must fit it, its `ref_where` / `ref_by` included); a table may only restyle an inherited column (label, description, aliases, note, dense) with `alter_column`. Dense and generated/identity columns are filled on existing rows. The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
| Parameter | Type | Description |
|---|---|---|
bases * | array | |
table * | string | |
dry_run | boolean |
describe_database
Describe the database: its folder (`root`), `metastore` (`metastore.yaml`: read it freely, but it is read-only for agents and changes only through the schema operations), configuration (default catalog and schema, row partition and file-name formats, archive folder, time zone, history, automatic links), journal folder, `bases` (shared column sets and the tables using them), `catalogs` → `schemas` → `tables` (with `row_count`, `tags`, and `unreadable_count` when some rows' front matter cannot be read) and `views`; catalogs and schemas show their `comment` (set with `comment_on`). A table or…
configure_database
Configure the database (persisted in metastore.yaml `config:`): `root` (rename the database folder; links follow; revert by renaming back), `default_catalog`, `default_schema`, `default_partition` ("" = flat) and `default_filename` (date formats for new time-based tables), `archive_folder`, `timezone` (IANA; completes date-times written without offset), `history` (transaction log for every table: true in a database the engine creates, false when `config` lacks it, as in a metastore from before 3.0.0; change it only on the user's request), `autolink` (the text a write puts in a body links the n…
| Parameter | Type | Description |
|---|---|---|
archive_folder | ||
autolink | Automatic links: the text a write puts in a note's body links the notes it mentions by name (on by default). A write's own `autolink` overrides it. | |
default_catalog | ||
default_filename | ||
default_partition | ||
default_schema | ||
history | ||
root | ||
timezone |
comment_on
COMMENT ON CATALOG / SCHEMA: set the `description` of a catalog (`catalog` alone) or of one of its schemas (`catalog` and `schema`) in metastore.yaml: what it holds, so agents pick the right place. `description` "" removes it. An unknown catalog or schema is refused with the existing ones. describe_database and `system.information_schema.catalogs` / `schemata` show it. Undo with `undo_migration`. A table's description: alter_table. The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
| Parameter | Type | Description |
|---|---|---|
catalog * | string | |
description * | string | The new description; "" removes it. |
dry_run | boolean | |
schema | A schema of the catalog; omitted, the description is the catalog's. |
rename_value
Rename one value of an enum column (e.g. `high` → `very high`) in metastore.yaml and every row, keeping its position, so an ordered scale is unchanged. CHECKs and `ref_where` conditions on the column (also through a link from another table) and `ref_by` levels / maps that name the value use the new one. Note text (queries, prose) is not rewritten. Refused if `to_value` already exists. Undo with `undo_migration`. Adding or removing classes changes the scale: create a new table instead. The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation,…
| Parameter | Type | Description |
|---|---|---|
column * | string | |
from_value * | string | |
table * | string | |
to_value * | string | |
dry_run | boolean |
insert_row
Insert a row (new note). Values are validated against the columns; the note path comes from the table's `path`/`filename` patterns (e.g. an event logged today about last night lands in last night's day folder when you set `occurred_at` to last night). `body` is the note text. Generated / identity columns are computed (do not pass them); CHECK constraints are enforced. Returns `migration_id` (undo) and the created path in `planned_creates`. `body` links the notes it mentions by name, at their first mention (automatic links; off with `autolink: false` or the database's `autolink` setting). `link…
| Parameter | Type | Description |
|---|---|---|
table * | string | |
values * | object | |
autolink | Automatic links for this write: true links the notes `body` mentions by name, false writes it as given. Default: the calling token's `autolink` default, else the database's `autolink` setting (on unle… | |
body | ||
dry_run | boolean | |
path | Optional note path (vault-relative), instead of the table's file-name pattern; `.md` is added if missing; it must stay inside the vault. |
update_rows
Update every row matching `where` (required: `{}` is every row). `where`: keys AND-ed; values are equality or operators eq, ne, gt, gte, lt, lte, in, contains, icontains (case/accent-insensitive, also inside lists — use it for names and aliases), exists, within (a hierarchy link: that row and everything below); combine with `or` / `and` / `not` (nestable); `path` is a pseudo-column. A dotted key follows a link column: `{"project.area": "[[Work]]"}` matches rows whose `project` links a row with that `area`. `set` sets, `unset` removes; all rows are validated first. `expect_count`: refuse unle…
| Parameter | Type | Description |
|---|---|---|
table * | string | |
where * | object | The rows to change; {} is every row of the table. |
dry_run | boolean | |
expect_count | Refuse (nothing written) unless `where` matches exactly this many rows. | |
set | ||
unset |
update_row
Update exactly ONE row, addressed by its `id` (the system UUID) or its `path`; refused when the row does not exist (or id and path disagree). Same validation, journal and history as `update_rows`. - `set` / `unset`: columns to set or remove. - `body`: replace the whole note body; or edit it keeping the rest: `body_sections` `{"History": "…"}` replaces the text under that heading (any level, up to the next heading of the same level; added as `## History` when missing), `body_prepend` / `body_append` add text before / after. - `expect`: compare-and-set — `{"status": "open"}` writes on…
| Parameter | Type | Description |
|---|---|---|
table * | string | |
autolink | Automatic links for this write: true links the notes the text written (`body`, `body_sections`, `body_prepend`, `body_append`) mentions by name, false writes it as given. Default: the calling token's… | |
body | ||
body_append | ||
body_prepend | ||
body_sections | ||
dry_run | boolean | |
expect | ||
id | ||
path | ||
set | ||
unset |
delete_rows
Delete rows matching `where`. `mode`: "archive" (default, move to the table's archive folder) or "delete" (trash; content journaled for undo). `on_referenced`: "restrict" (default, refuse rows other notes link to), "set_null" (clear front matter links to them) or "ignore" (the links stay, to no row: an archived row is gone as a trashed one, so check_table reports them as `broken_link` and new links to it are refused). `where` is required: `{}` deletes every row.
| Parameter | Type | Description |
|---|---|---|
table * | string | |
where * | object | The rows to change; {} is every row of the table. |
dry_run | boolean | |
mode | ||
on_referenced |
move_rows
Move rows matching `where` (required: `{}` is every row) to another table (e.g. split a domain out of `log` into its own table): sets each row's `table` to the destination, applies `rename` (`{"metric_distance_km": "distance_km"}`), `set` and `drop`, adds the destination's missing dense fields, and validates every row against the destination first. Keys unknown to the destination are reported, never dropped silently — rename or drop them explicitly. `relocate: true` also moves the files to the destination table's folder (named by its filename pattern); by default rows stay where they are, as…
| Parameter | Type | Description |
|---|---|---|
table * | string | |
to_table * | string | |
where * | object | The rows to change; {} is every row of the table. |
drop | ||
dry_run | boolean | |
relocate | boolean | |
rename | ||
set |
adopt_rows
Turn existing notes (not rows of any table yet) into rows of `table`, keeping their body and links: `rename` keys (`{"data": "occurred_at"}`), `set` for all, `per_row` values by note path (`{"Home/x.md": {"zone": "[[Kitchen]]"}}`), `drop` keys the table does not have. Every note gets `table` and a system `id`; with `relocate` (default true, unlike move_rows: notes become rows where the table keeps its rows) it moves to the table's folder, named by its filename pattern (links to it are rewritten). All notes are validated first (as rows of `table`, so notes of the same call may link to one anoth…
| Parameter | Type | Description |
|---|---|---|
paths * | array | |
table * | string | |
drop | ||
dry_run | boolean | |
per_row | ||
relocate | boolean | |
rename | ||
set |
select_rows
Query rows: `{table, total, rows: [{path, ...}]}`. `table` may be a view, `system.information_schema.<catalogs|schemata|tables|columns|views|check_constraints>`, or `base:<name>` — every table that extends that base (e.g. `base:record`: all event-like tables), on the base's columns, each row tagged `_source` with its table. - `where`: as in update_rows; relative dates `"{today}"`, `"{today-7d}"`, `"{now-24h}"` (on a date column a date-time counts by its day); file columns `file_name`, `file_link`, `file_modified`, `file_backlink_count`. - `columns`, `order_by` (`-col` descending), `limit…
| Parameter | Type | Description |
|---|---|---|
table * | string | |
aggregates | ||
columns | ||
expand | ||
group_by | ||
include_body | boolean | |
join | ||
limit | ||
offset | ||
order_by | ||
this_note | ||
timestamp | ||
version | ||
where |
check_table
Validate every row against the table (required, types, ranges, enums, links, unknown columns, CHECK constraints, those that follow links included, filtered link targets (ref_where / ref_by), stale generated/identity values, missing inverse links, front matter that cannot be read: code `unreadable`, with no column, for a note whose `table` line names the table but whose YAML is broken, which every other read leaves out). A CHECK violation has code `check` and the CHECK's name as `constraint` (every other code names its `column`), as in the `violations` of list_changes. Use it to find rows edite…
| Parameter | Type | Description |
|---|---|---|
limit | integer | Rows with violations returned (paging). |
offset | integer | Rows with violations skipped first (paging). |
table | Omit to check every table. |
list_link_targets
The rows a link column may point to, for one row: what an agent or a picker offers before writing the link. A link column can filter its targets: - `ref_where`: a `where` filter every target must match (`{"kind": {"in": ["area", "project"]}}`). - `ref_by`: a column of the row picks the targets' level: `{"column": "kind", "map": {"area": null, "project": ["area"], "workstream": ["project"]}}`: a workstream's parent must have kind project; `null` is a top level (the link must stay empty); any other level needs the link; a value missing from the map is refused. `levels: ["area", "project",…
| Parameter | Type | Description |
|---|---|---|
column * | string | A link column (or list of links) with ref. |
table * | string | |
limit | At most this many targets: a positive integer (default 50, at most 500). | |
row | The row the link is for: its path, a link to it or its name (its values are read). | |
values | Values of the row (a new one, or changes to `row`), e.g. {"kind": "workstream"}. |
undo_migration
Revert a journaled table operation by its `migration_id`. Refused (nothing written) when any touched note changed since; the conflicts are listed. Also refused when the revert would leave rows breaking a CHECK that follows links or a `ref_where` / `ref_by` (rows it writes, or rows that link to them), listed like the refusals of other writes with the way out (fix the row, or drop the rule). The rules are those of the schema the revert puts back: undoing a rename_value / rename_column puts the old names back with the rows, and a rule the revert puts back must hold on every row. A `batch` is chec…
| Parameter | Type | Description |
|---|---|---|
migration_id * | string |
batch
Several writes that succeed or fail together. `operations`: `[{"op": ..., ...arguments}]` where `op` is a row operation (`insert_row`, `update_row`, `update_rows`, `delete_rows`, `merge_rows`, `move_rows`, `adopt_rows`, `recompute_columns`, `align_relations`, `restore_table`) or a DDL op (`create_table`, `add_column`, `alter_column`, …), with the same arguments as the operation (an unknown one refuses the batch) (e.g. `values` for insert_row, `set` for update_row / update_rows). They run in order, each seeing the previous ones; if one is refused, the ones already applied are undone (`rolled_…
| Parameter | Type | Description |
|---|---|---|
operations * | array | |
dry_run | boolean | |
summary |
align_relations
Add the reciprocal links missing on a table's `inverse` link columns (e.g. Alice lists Carol in `friends` but Carol does not list Alice). Run it after declaring `inverse` on existing data; check_table reports such rows (code `inverse`). Single-value links already pointing elsewhere are conflicts (nothing written). The links it adds are checked like other writes (CHECKs that follow links, `ref_where` / `ref_by`). Writes through the tools already keep both sides in step.
| Parameter | Type | Description |
|---|---|---|
table * | string | |
dry_run | boolean | |
paths |
infer_table
Read-only schema inference from notes' front matter. - `folder` (recursive; "" = whole vault) and/or `paths`: notes not yet in a table. Returns `columns` (type, enum `values`, link `ref` to the table most targets belong to, `required`, `unique`, `dense`, `from` when the front matter key is not a valid column name, `stats`), `proposal`, the create_table arguments (`name`, `description`, `filename` or `time_column`, `columns`), and `adopt` ready for adopt_rows (`paths`, `rename`, `relocate: false`), plus `hints` to read. The notes cannot say what the table and its columns mean: `desc…
| Parameter | Type | Description |
|---|---|---|
folder | ||
max_enum_values | ||
name | ||
paths | ||
table |
semantic_search
Find notes by meaning, not exact words: `{query, results: [{path, score, heading, snippet, table?}]}`, one result per note (its best passage), best first. Use it for vague questions ("the dinner where we talked about moving", "what did I decide about the car") and to find the rows to read or update; then read_note / select_rows for the details. Filters: `tables` (qualified or short names), `folder`, `min_score` (cosine 0–1; ~0.5+ is usually relevant). `limit`: default 10, max 100. Fails with a clear message when semantic search is not enabled in the engine settings.
| Parameter | Type | Description |
|---|---|---|
query * | string | |
folder | ||
limit | integer | |
min_score | ||
tables |
describe_semantic_index
The semantic search index: `enabled`, `provider`, `model`, `files`, `passages`, `pending`, `running`, `last_sync`, `last_error`. sync_semantic_index brings it up to date.
sync_semantic_index
Bring the semantic search index up to date: embed the notes changed since the last run (the engine also does it on its own about ten seconds after edits). `rebuild: true` re-embeds everything: slow, and costs money with a paid provider — ask first.
| Parameter | Type | Description |
|---|---|---|
rebuild | boolean | Re-embed every note, not only the changed ones. |
list_migrations
The operation journal, newest first: `total` (the matching operations) and `migrations`, each with `migration_id` (for undo_migration), `op`, `summary`, `table` (when it was about one), `executed_at`, `notes_changed`, `files_changed`, `undone`, `undoes`, `files_failed`, `by` (the agent), and `members` (a batch's operations) or `batch` (the batch of an operation). Filters: `op` (e.g. "update_rows"), `table` (substring of the table name, e.g. "personal.tasks.task"), `since` (ISO date). `limit` default 50. The journal is kept in the engine's store, outside the vault (`store:journal/`); entries ol…
| Parameter | Type | Description |
|---|---|---|
limit | ||
op | ||
since | ||
table |
merge_rows
MERGE (upsert) `rows` into `table` by the key columns `on` (e.g. `["occurred_at"]` or `["id"]`): a row matching an existing one updates it (`when_matched`: "update" default or "ignore"), the others are inserted (`when_not_matched`: "insert" default or "ignore"). Date-times are compared after completion with the database time zone. A source key matching several rows, or repeated, is a conflict. One journaled, undoable operation.
| Parameter | Type | Description |
|---|---|---|
on * | array | |
rows * | array | |
table * | string | |
dry_run | boolean | |
when_matched | ||
when_not_matched |
describe_history
DESCRIBE HISTORY: the table's versions, newest first — `version`, `timestamp`, `operation` (CREATE TABLE, WRITE, UPDATE, DELETE, MERGE, ALTER TABLE, ADD COLUMNS, RESTORE, UNDO, …; `EXTERNAL_EDIT` = changed outside the engine: an editor, git, sync), `operation_metrics` and `migration_id` (undo). An EXTERNAL_EDIT's `operation_metrics.violations` counts the rules this table's rows break because of the hand edits it holds (each once): the edited rows whose front matter changed and the rows of the table linking to them, a removed or renamed row included (rows of other tables count in their tabl…
| Parameter | Type | Description |
|---|---|---|
limit | ||
since | ||
table | A table; omitted, the whole database. |
table_changes
Change data feed between two versions (both included, end defaults to latest): one entry per row change with its values plus `_change_type` (insert, delete, update_preimage, update_postimage, metadata), `_commit_version`, `_commit_timestamp`, `_operation`, `path`. Use it to answer "what changed since …" without diffing full tables.
| Parameter | Type | Description |
|---|---|---|
start_version * | integer | |
table * | string | |
end_version |
list_changes
Change feed across all tables: numbered row changes (`seq`), oldest first, from engine writes and from hand edits (`source: external`). Each has `table`, `kind` (insert, update, delete, move, metastore, unreadable), `op` (the operation that made it), `path`, `row_id`, `changes` ({column: {before, after}}), `actor`, `migration_id`. Hand edits are compared in batches (0.7 s after the last vault change, at most 5 s after the first), in the order they happened, renames included. A hand edit that creates, changes, renames or removes a row is checked against the tables' rules (as check_table does) w…
| Parameter | Type | Description |
|---|---|---|
columns | ||
exclude_actor | ||
kinds | ||
limit | integer | |
since | integer | |
tables | ||
wait_ms | integer | |
where |
list_webhooks
Webhooks of the change feed: id, url, filter (tables, ops, columns, exclude_actor), `cursor` (last change delivered), `status` (ok, failing, disabled), `last_delivery`, `last_error`. Secrets are not shown.
restore_table
RESTORE TABLE to a `version` or `timestamp`: rows and definition return to that state — rows added since are deleted, changed rows get their old content, removed rows come back (a dropped table is re-created). History is not rewritten: the restore is a new version, and `undo_migration` reverts it. Refused (rows listed, with the way out) when the rows it writes, or rows that link to them, would break a CHECK that follows links or a `ref_where` / `ref_by` (as the restored definition has them: a rule added since does not hold the old rows). Run with `dry_run` first and show the user what change…
| Parameter | Type | Description |
|---|---|---|
table * | string | |
dry_run | boolean | |
timestamp | ||
version |
restore_database
RESTORE DATABASE to a `timestamp` (each table as of its last version committed at or before it) or to `before_migration` (a `migration_id` or a `batch`: every table as it was just before that operation ran — to rewind an agent's run). Every table that keeps a transaction log goes back, rows and definition: rows added since are deleted, changed rows get their old content, removed rows come back; a table created since is dropped with its rows moved to its archive folder (as drop_table with mode "archive": nothing is hard-deleted), a table dropped since comes back. Tables already as they were a…
| Parameter | Type | Description |
|---|---|---|
before_migration | ||
dry_run | boolean | |
timestamp |
vacuum_table
Delete transaction-log history older than `retain_from_version` (default: keep only the latest version); time travel before it becomes impossible. Rows are not touched. `dry_run` defaults to true: it lists the log files that would go. Only on the user's explicit request.
| Parameter | Type | Description |
|---|---|---|
table * | string | |
dry_run | boolean | |
retain_from_version |
add_constraint
ALTER TABLE ADD CONSTRAINT `name` CHECK: `check` is a where filter every row must match, e.g. `{"value": {"gte": 1, "lte": 5}}`. A condition on a column the row leaves empty passes, like SQL; inside `or` / `and` / `not` an empty value is tested as it is (`{"exists": true}` there fails). A key may follow a link column to the row it names, as in queries: `{"parent.kind": "project"}` (further dots follow further links). An empty link passes at the top level and fails inside `or` / `and` / `not`; only the first link of a longer path is skipped when empty (`parent.parent.kind` fails for a row whose…
| Parameter | Type | Description |
|---|---|---|
check * | object | |
name * | string | |
table * | string | |
dry_run | boolean |
drop_constraint
Remove the CHECK constraint `name` from `table`. The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
| Parameter | Type | Description |
|---|---|---|
name * | string | |
table * | string | |
dry_run | boolean |
create_view
Create (or `replace`) a view: a named select stored in metastore.yaml. Name it with the prefix `vw_` (e.g. `vw_open_tasks`): views share names and folders with tables. `query` takes the select_rows parameters (table, columns, where, order_by, limit, join, group_by, aggregates, expand; relative dates keep it current) and must run now. Or `query: {union: [{table, columns, where}, …], columns, where, order_by, limit, expand}` stacks the rows of several tables (UNION ALL, each row tagged `_source`). Its filters may read the note the view is shown for: `{this.<property>}` (`{this.date+1d}`, `{thi…
| Parameter | Type | Description |
|---|---|---|
name * | string | |
query * | object | |
aliases | ||
catalog | ||
description | What the view shows, for agents and people. | |
dry_run | boolean | |
labels | ||
replace | boolean | |
schema |
drop_view
Remove a view from `metastore.yaml` (undo with `undo_migration`). The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
| Parameter | Type | Description |
|---|---|---|
view * | string | |
dry_run | boolean |
clone_table
CREATE TABLE `target` CLONE `source`: same definition plus independent copies of its rows (deep clone), optionally as of a `version` / `timestamp`. `copy_rows: false` copies the definition only (CREATE TABLE LIKE). `target`: `catalog.schema.table`, `schema.table` (in the source's catalog) or a name (source's catalog and schema). Useful for experiments, e.g. a sandbox copy in the `agent` catalog. The clone is a new table, so it needs the descriptions create_table does: a source without them is refused, naming what to describe first (alter_table, alter_column). A past version lacking one gets th…
| Parameter | Type | Description |
|---|---|---|
source * | string | |
target * | string | |
copy_rows | boolean | Copy the rows (default); false copies the definition only (CREATE TABLE LIKE). |
dry_run | boolean | |
timestamp | ||
version |
recompute_columns
Bring generated and identity columns up to date (all rows, or only `paths`), e.g. after rows were edited by hand (an editor, git, sync) or a generated expression changed with `alter_column`. Also gives rows without an `id` a new one, and a duplicated note (same `id` as an older row) a new id. `new_ids=true` regenerates every id in scope (new ones on every call): only on the user's explicit request. `check_table` reports stale values with code `generated`. No-op when nothing is stale; otherwise journaled (undo_migration) and a RECOMPUTE version in the table's history.
| Parameter | Type | Description |
|---|---|---|
table * | string | |
dry_run | boolean | |
new_ids | boolean | |
paths |
graph_neighbors
Direct neighbours of notes: what they link to (`out`) and what links to them (`in`, backlinks), with counts per edge label. `direction`: out, in or both (default). `from_nodes` selects the notes: `{"paths": [...]}` and/or `{"table": ..., "where": {...}}`. Edges are labelled with their link column (`people`, `event`, …) or `link` for other links.
| Parameter | Type | Description |
|---|---|---|
from_nodes * | object | |
direction | ||
edges |
graph_traverse
Breadth-first walk over links from `from_nodes` (`{"paths": [...]}` and/or `{"table", "where"}`). - `direction`: out (default, follow links), in (follow backlinks) or both. - `edges`: edge labels to follow (link columns such as `people`, `event`, or `link`). - `tables`: return only notes of these tables; `through`: only walk on through these tables. - `min_depth` (default 1) / `max_depth` (default 2, max 10), `limit` (default 500). Each node comes with `depth` and `via` (one shortest route). Example — moods tied to events with Alice: from `{"table": "person", "where": {"name": "Alice"}}`,…
| Parameter | Type | Description |
|---|---|---|
from_nodes * | object | |
direction | ||
edges | ||
limit | ||
max_depth | ||
min_depth | ||
tables | ||
through |
graph_path
Shortest chain of links between two sets of notes (each `{"paths": [...]}` and/or `{"table", "where"}`): `found`, `length` and `path`: the steps (`from`, `label`, `direction`, `to`). `direction` both by default; `max_depth` default 6 (max 10).
| Parameter | Type | Description |
|---|---|---|
from_nodes * | object | |
to_nodes * | object | |
direction | ||
edges | ||
max_depth |
list_docs
List the pages of the Datanotes documentation of this version (read offline, from the package): path, title and description, one per line. `prefix` keeps the pages under a folder (`guides/`, `reference/`, `start/`). Read one with read_docs(path).
| Parameter | Type | Description |
|---|---|---|
prefix | string | Only the pages under this folder or path, such as `guides/`. |
read_docs
Read a page of the Datanotes documentation of this version as Markdown, or one section of it: `guides/read-and-write/read-and-filter`, or `guides/read-and-write/read-and-filter#compare-values-with-operators` (the anchor of its heading, as in the docs links of the errors; the datanotes.dev addresses work too). Read a section rather than a whole page: list_docs lists the pages, search_docs finds the sections on a topic. At most 20000 characters at a time: a longer text ends with a note on how to read the rest (`offset`, or its sections one by one).
| Parameter | Type | Description |
|---|---|---|
path * | string | The page (`guides/read-and-write/read-and-filter`), optionally with a section's anchor (`guides/read-and-write/read-and-filter#compare-values-with-operators`). |
offset | integer | The character to start from, to read on after a cut (the note at the cut gives it). |
section | string | The anchor of a section of the page, instead of `#anchor` in `path`. |
search_docs
Search the Datanotes documentation of this version for the sections on a topic, best first: each with the path to pass to read_docs (`guides/read-and-write/read-and-filter#compare-values-with-operators`), its page and heading, and a short excerpt. Words in a heading count most; a word matches in any form (`rows`, `row`) and its synonyms too (`revert` for `undo`). Syntax: a quoted phrase ("time travel") or a +term (`+view`) must appear in a section, a -term (`-sql`) must not; the other words only rank. When the engine has semantic search on, the sections are also ranked by meaning and the two r…
| Parameter | Type | Description |
|---|---|---|
query * | string | A few words of the topic: `filter rows by date`, `undo a write`, `"time travel" +view -sql`. |
limit | integer | The most sections to return. |