Skip to content

Facet for agents

An agent (or a script) can read and change a Facet workspace without parsing or rewriting Markdown itself. The facet command offers:

Command Does
facet query <dir> prints the nodes that match some filters, as JSON
facet edit <dir> takes JSON ops, changes the files, prints what it changed
facet mcp <dir> serves the same operations to an MCP client
facet lint <dir> checks the workspace against the lint rules
facet schedule <dir> prints the computed dates of every scheduled node
facet demo <dir> writes the demo workspace into a new or empty folder

Edits are the same minimal text edits a view makes (How Facet writes): only the lines that must change are touched, so the rest of a file, its formatting and your hand-written notes stay as they were. Agents, people and the VS Code views all work on the same Markdown.

<dir> is the workspace folder: Facet reads every .md file below it, and its .facetignore, skipping node_modules and names that start with a dot. Every command also takes --today YYYY-MM-DD (default: the local date), which resolves today, lateness and repeating tasks. facet --help prints the usage and facet --version the version.

The Install page explains how to get the facet command.

Every command names nodes with a ref:

Ref Names
!stand-signed the node with id:: stand-signed (or frontmatter id:)
req~load-map the requirement - req~load-map: …
trade-fair/plan.md:8 the heading or item whose title starts on line 8
trade-fair/plan.md the file (a folder’s index.md names the folder)
trade-fair/ the folder; . is the workspace root

Line numbers are 1-based. Paths are relative to the workspace folder and use /. A ref is refused, with a reason, when:

  • an id or a requirement name is used more than once (the error lists where);
  • no heading or item starts on the given line;
  • the file or folder does not exist in the workspace;
  • the text is none of the forms above.

Query and edit output give every node the most stable ref it has: its id, else its requirement name, else its location. Locations shift when lines are added above them; ids do not. Before referring to a node across several edits, give it an id with the id op: it makes one from the title and returns it.

facet lint <dir> checks the workspace against the lint rules and prints one line per problem, in the form path:line:column: severity rule message, then a count. It exits 1 if there is at least one error, 0 otherwise (warnings alone pass), and 2 if the folder cannot be read.

Terminal window
cd examples/workspace/trade-fair
facet lint . --today 2027-01-15
index.md:10:3: warning late ends 2027-04-22, after its due date 2027-04-15
0 errors, 1 warning

The line format is the one compilers use, so editors and CI tools can link each line to its place in the file.

facet schedule <dir> prints the computed dates (Dates and scheduling): one line per node with dates, in tree order, then a count of scheduled and unscheduled nodes. Here the dates are inclusive (2027-02-01..2027-02-14 is two full weeks). A repeating task shows its next occurrence; a task that cannot be scheduled says why; flags at the end mark milestones, boxes, the critical path of the file and late work.

Terminal window
cd examples/workspace
facet schedule . --today 2027-01-15
broken/dependency-cycle.md:4:7: undated (cycle) Axle A
team-rituals.md:7:7: next 2027-01-15 Send the weekly demo recap
trade-fair/plan.md:8:7: 2027-02-01..2027-02-14 Sign stand contract
trade-fair/plan.md:18:7: 2027-03-01..2027-03-28 Build demo course critical

(An excerpt; the real output lists every scheduled node.) The reasons for missing dates are unscheduled (nothing to anchor the task to), undated (error), undated (cycle) and undated (waiting) (a predecessor has no dates). The command exits 0, or 2 if the folder cannot be read.

For agents, the MCP schedule tool returns the same information as JSON.