Folio

v0.8.0
io.github.jakubro/folio Checked 1 day ago Published 1 day ago

A live view of a folder of markdown and data, and read-only tools over what the folder holds.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

folio_documents List the folder's documents

List every markdown and diagram document under a folder of the served folder, with the kind a FOLIO.md declaration gives it. Use it to see what exists or which documents are of a kind; for documents matching a condition - a title, a field's value, a link - query folio.documents or kind.<name> with folio_query, and for one document's blocks use folio_document. Answers {ready, documents: [{path, kind}]}: kind is null where no declaration places the document; ready false means Folio is still reading the folder, the list then the documents it knew before it stopped with those read since, so ask ag…

ParameterTypeDescription
folderstringA folder, relative to the served folder or absolute under it, such as notes/; omit for the whole folder

folio_document Read a document's blocks

Read one document as Folio's model holds it: its blocks with their ids, the blocks its page shows once includes are expanded, its declared kind and fields, and the data files it reads. Call it for the block ids that folio_provenance and folio_history take and that a link to a block names - an id is 8 hex characters Folio derives, never invented - and to see what a page is made of; read the file itself for its full text. Answers {path, kind: markdown or mermaid, blocks: [{id, kind, lines: [first, last] from 1, text: its first 100 characters}], page: [{id, kind, source: the file the block comes…

ParameterTypeDescription
path *stringThe document's path, relative to the served folder or absolute under it, such as notes/plan.md

folio_provenance Trace where a block came from

Trace one block of a page to its origin: the file and lines it comes from, when it last changed, the data files and queries behind its embedded tables and values with when each changed, and each figure in it checked against its data. Use it to explain why a number or table reads as it does, or whether a figure still matches its data; take the block's id - and, for a block an include brings, its source - from folio_document's page. For every problem in the folder at once use folio_health. An id not on the page is an error. Answers {source, kind, lines: [first, last], changed: ISO time, included…

ParameterTypeDescription
block *stringThe block's id, 8 hex characters, as folio_document lists it
path *stringThe page's path, relative to the served folder or absolute under it, such as notes/plan.md
sourcestringThe file the block's text comes from when an include brings it onto the page, as folio_document's page names it; omit for the page's own blocks

folio_query Run a SQL query over the folder

Run one read-only DuckDB SELECT over the served folder's data files and its documents as tables, and return the rows. Use it for any question data answers - counts, filters, joins across CSV, JSON, Parquet, SQLite or DuckDB files - and for questions about documents as data: what links to a page (folio.links where target is its path), open tasks, documents of a kind by a field. To read what one reference written in a document shows, use folio_embed. Anything but one SELECT, a path outside the folder and a web address are refused; a query stops after 10 seconds, and one reading the documents as…

ParameterTypeDescription
sql *stringOne SELECT. A data file is a table named by its path in single quotes, relative to folder, from the served folder after a slash, or absolute under the served folder: 'data/daily.csv', 'archive.sqlite#…
folderstringThe folder the query runs from, relative to the served folder or absolute under it, such as reports/; quoted paths resolve against it. Omit for the served folder

folio_embed Resolve a reference a document writes

Resolve one data reference as a document writes it in {table: ...}, {value: ...}, a figure or a chart, from that document's folder, and return what it shows there. Use it to check a reference before writing it into a document, or to read the value a page shows; for a question of your own over the data use folio_query. Answers {version, grid: {columns, rows, total, partial} for a table, value: for a reference naming one value, error: why the reference resolves to nothing, waiting: why it shows nothing yet - Folio still reads the folder, for a reference reading the documents as tables, so ask ag…

ParameterTypeDescription
path *stringThe document whose folder the reference resolves from, relative to the served folder or absolute under it, such as reports/weekly.md
reference *stringThe reference as written: a data file relative to the document (data/daily.csv) or absolute under the served folder, a part of it after # (data/daily.csv#0.rain_mm, archive.sqlite#readings), a .sql fi…

folio_kinds Read the declared kinds and rules

Read what the FOLIO.md declarations applying at a path declare: the kinds of documents with the fields each carries, the rules - queries whose every row is a violation - and the health entries, layered from the served folder down as Folio applies them. Use it before writing a document of a kind, to learn its fields and the rules it must keep; for one document's own kind and field values use folio_document, and for the rules broken now folio_health. Answers {declarations: [FOLIO.md paths, outermost first], kinds: [{name, declaredIn, where, fields: {name: {from, type, of, key, pattern, to, by, e…

ParameterTypeDescription
pathstringA document, relative to the served folder or absolute under it, such as notes/plan.md, or a folder, such as notes/; omit for the served folder itself

folio_health List everything wrong in the folder

List every problem in the served folder, or with path only in that document or under that folder: links to files, headings or blocks not there, includes that find nothing and include loops, figures their data contradicts, diagrams, charts, components and queries that fail, data that cannot be read, frontmatter that is not YAML, and declarations, fields, rules and saved views a document breaks. Use it after editing documents, given the path of what you edited, to answer which figures disagree with their data, or to find what to fix; for one block's figures in detail use folio_provenance, and fo…

ParameterTypeDescription
pathstringA document, relative to the served folder or absolute under it, such as notes/plan.md, or a folder, such as notes/; omit for the whole folder

folio_changes List what changed since the reader read it

List the documents the reader has read before whose blocks changed since they last read them, newest change first - what they have to catch up on; with path, only that document or those under that folder. Use it for what changed for the reader; for every change in the folder over a period, read or not, use folio_digest, and for the marks on one page folio_reads with its path. It reveals which documents the reader has read. While the reader pauses sharing in Folio, it answers only {paused: true, message}. Answers {ready: false while Folio still reads the folder, the list then as last worked out…

ParameterTypeDescription
pathstringA document, relative to the served folder or absolute under it, such as notes/plan.md, or a folder, such as notes/; omit for the whole folder

folio_needs List what needs the reader

List what needs the reader's attention, ranked: every error in the folder, then problems in documents they have read, rows of the folder's declared attention queries, and documents they read that changed since; with path, only what lies in that document or under that folder. Use it to triage what to look at first; for every problem whoever reads it use folio_health, and for only the documents changed since read folio_changes. It reveals what the reader has read. While the reader pauses sharing in Folio, it answers only {paused: true, message}. It answers at once with what was last worked out,…

ParameterTypeDescription
pathstringA document, relative to the served folder or absolute under it, such as notes/plan.md, or a folder, such as notes/; omit for the whole folder

folio_presence See what the reader is looking at

Show what the reader is looking at now: the page open in each browser tab and the block under their pointer with the start of its text, the most recent first. Use it when the reader means what is on their screen - this page, this paragraph; for what they read before use folio_reads. It reveals the reader's screen; a hidden tab shows nothing. While the reader pauses sharing in Folio, it answers only {paused: true, message}. Answers {paused: false, looking: [{page, block: {source, id, text}, at: ISO time}]}. A list cut to fit one answer adds omitted, how many entries each list left out, and narr…

folio_stale List documents that outlived their use

List documents that have probably outlived their use - by default unchanged for a year, never read and linked from nowhere, or what the folder's declared stale query names - each with when its file last changed and why; with path, only that document or those under that folder. Use it to suggest what to archive; Folio only lists them and never moves or deletes anything. For documents the reader should catch up on use folio_changes instead, and for everything wrong in the folder folio_health. It reveals which documents the reader never read. While the reader pauses sharing in Folio, it answers o…

ParameterTypeDescription
pathstringA document, relative to the served folder or absolute under it, such as notes/plan.md, or a folder, such as notes/; omit for the whole folder

folio_reads Read what the reader has read

Read the reader's read record. For a folder, or with no path, every document read under it and when it was last read; for a document, each block with the version the reader read and when, and the marks its page shows. Use it to tell whether the reader has seen a passage or what is new to them on a page; for the list of documents changed since read use folio_changes. It reveals the reader's reading. While the reader pauses sharing in Folio, it answers only {paused: true, message}. Answers {documents: [{path, at: ISO time}]} for a folder, or for a document {blocks: [{id, kind, source, lines, ver…

ParameterTypeDescription
pathstringA document, relative to the served folder or absolute under it, such as notes/plan.md, or a folder, such as notes/; omit for every document read

folio_history Read a document's history

Read a document's versions, newest first, merged from its git commits and every save Folio saw - a document since deleted included. With version, that version's full text; with block, each text the block has had; with reference, each result that embed has shown. Use it to answer how a passage or a value changed and when; for everything that changed in the folder over a period use folio_digest. Give at most one of version, block and reference. Answers {path, versions: [{id, at: ISO time, seen: a list of saved, committed and file, by: the commit's author, removed}]}, {path, version, text: null w…

ParameterTypeDescription
path *stringThe document's path, relative to the served folder or absolute under it, such as notes/plan.md, also one since deleted
blockstringA block's id as folio_document lists it, for each text the block has had
referencestringAn embed's reference as the document writes it, such as #totals#0.n, for each result it has shown
versionstringA version's id from this tool's versions, for that version's text

folio_used_by List the documents a file feeds

List the documents that include a file or whose embeds and queries read it - the pages a change to it moves. Use it before editing, moving or deleting a document, data file or query file; it does not list links, so for what links to a document query folio.links with folio_query. Answers {ready, documents: [{source, how: includes or embeds}]}; while Folio still reads the folder it is refused saying so - ask again shortly. A list cut to fit one answer adds omitted, how many entries each list left out, and narrow, how to ask for less.

ParameterTypeDescription
path *stringThe file's path, relative to the served folder or absolute under it: a document, data file or .sql file, such as data/daily.csv

folio_digest Summarize what changed in a period

Summarize what changed in the served folder over a period: every document created, changed or removed, with the versions it started and ended on, and every embedded value that moved, before and after. Use it for what changed this week or since a date across the whole folder, read or not; for what changed of what the reader read use folio_changes, and for one document's versions folio_history. Answers {from, to, documents: [{path, status: created, changed or removed, from, to: version ids folio_history takes}], values: [{document, reference, before, after, at}]}, times ISO 8601. A list cut to f…

ParameterTypeDescription
fromstringThe period's start, an ISO 8601 date or time such as 2026-11-02 or 2026-11-02T09:00:00+01:00 - a date alone is midnight UTC, a time without an offset UTC; default a day before to
tostringThe period's end, an ISO 8601 date or time as from is; default now