CI, CLI & AI agents
Apps don't need Znote to run. The same engine, znote-runtime, runs them from a terminal, in continuous integration, and as an MCP server for AI agents such as Claude Code. It is pure Node.js (18.17 or later).
Install
npm install -g znote-runtime # installs the znote-cli commandOr run it without installing: npx -y znote-runtime <command>.
znote or znote-cli?
znote-cli runs apps. znote alone is the command that opens the Znote app from a terminal (Settings › General › Shell command).
Command line
znote-cli validate apps/unpaid.md
znote-cli search unpaid invoices
znote-cli run apps/unpaid.md --preset germany-60d
znote-cli run apps/unpaid.md --country ES --days 90 --json
znote-cli trust apps/timesheet.md # human approval, interactive terminal only
znote-cli trust --scripts # approve the entries of .znote/scripts.json--vault <dir> sets the vault. By default, it is the closest folder that contains .znote/.
Scheduled runs and checks — ci:
An app with a ci: section runs unattended with znote-cli ci: on a schedule, in a pull request, without AI.
ci:
schedule: "0 7 * * 1" # cron (5 fields), or a list; optional
preset: germany-60d # optional
params: { days: 90 } # optional, wins over the preset
allow_write: false # default: blocks that write are skipped
assert:
- block: unpaid
path: rows
count: { max: 20 }
message: "Too many unpaid invoices"ci: true is enough to check that the app runs without error. Checks: status, equals, count, value (a number or {min, max, equals}), empty, contains, matches.
An app fails when a block errors, when a block is not approved, or when a check fails.
znote-cli trust --lock # once: write the approvals for the runner (commit the file)
znote-cli ci init # generate .github/workflows/znote-apps.yml
znote-cli ci --trust-lock .znote/trust.lock.json --junit apps.xmlThe runner has no ~/.znote/trust.json: znote-cli trust --lock writes the approvals in .znote/trust.lock.json. This file is in the repository, so protect it like code (review each change). Any change to an approved block, server or script invalidates it. For secrets, add an age private key in the repository secret SOPS_AGE_KEY.
Claude Code (and other agents)
znote-cli mcp is an MCP server that gives an agent your vault's apps, MCP servers and scripts, with the same approvals as Znote. Declare it in the vault's .mcp.json:
{
"mcpServers": {
"znote": { "command": "npx", "args": ["-y", "znote-runtime", "mcp", "--vault", "."] }
}
}The runtime also ships a Claude Code plugin with the znote-apps skill. It teaches the agent the loop: search an existing app first, otherwise explore with the vault's tools, then offer to save what worked as an app. Load it for a session:
claude --plugin-dir "$(npm root -g)/znote-runtime/plugin"What the agent can do:
- reuse an app:
apps_search,app_describe,app_run; - explore:
mcp_callon the vault's MCP servers andscript_callon its scripts. Use these instead of the agent's own tools: only these calls are recorded, and can be saved as an app; - save:
trace_draft_appdrafts an app from what actually ran, thenapp_validateandapp_save; - set up the vault:
setup_statuscompares Claude Code's MCP servers and skill scripts with Znote's,script_discoverproposes registry entries from a script's usage text,script_declaredeclares them.
The safeguards stay with you:
- Approvals are human. An agent can declare a script or write an app, but it cannot approve them. A refused block tells the user to run
znote-cli trust <note>or to approve it in Znote. - Writes need two agreements. The server must be started with
--allow-write, and the agent must passallow_write: trueon each call, after asking you. - Secrets never reach the agent. It only sees names, and resolved values are masked in results.
