Skip to content

Script registry ​

You probably already have scripts that talk to your tools: a jira.mjs, a tempo.py, the scripts shipped with your Claude skills. The script registry lets Znote call them: from apps with script blocks, and from the AI as tools.

Scripts are declared per vault in .znote/scripts.json, and managed in Settings → Scripts.

An entry ​

json
{
  "jira.search": {
    "description": "Search Jira issues with a JQL query",
    "path": "~/scripts/jira.mjs",
    "args": ["search", "{{jql}}", { "flag": "--limit", "value": "{{limit}}" }, "--json"],
    "effects": "read",
    "output": "json"
  }
}
KeyPurpose
descriptionWhat the command does. The AI reads it to choose the command
pathThe script (~ allowed). .mjs/.js/.cjs run with node, .py with python3, others as executables
argsThe arguments after the script (see below)
effectsread (default), or write when the command changes something: it then always asks for confirmation
outputjson (default, falls back to text) or text

args items take three forms:

ItemMeaning
"{{name}}" or "literal"Passed as is. {{name}} is a required parameter
{ "flag": "--limit", "value": "{{limit}}" }Optional option: left out when empty
{ "flag": "--all", "when": "{{all}}" }Switch: the flag alone, when the value is true

Scripts are started without a shell: a value can never inject a command. A script reads its own credentials (from its config file or the environment), prints its result on stdout, and exits with a non-zero code on error.

Add scripts ​

The header of Settings → Scripts has four ways to add entries:

  • + Add a script: declare one command by hand.
  • From your Claude skills: lists the scripts shipped by your Claude Code skills, grouped by source (your own skills first, plugins collapsed). You can add other folders to scan.
  • From a script file: pick any script and discover its commands.
  • Open .znote/scripts.json: edit the file directly.

Discover a script's commands ​

Commands… reads the script's usage text (its header comment, or its Usage: messages). The script is not run. Each subcommand becomes a proposed entry, with its parameters, its options and a read/write guess:

  • read commands are checked, write commands are opt-in;
  • click read / write to correct a guess;
  • commands that are already declared are greyed out.

Declare writes the checked entries.

Ask the AI ​

When the script has no usable usage text, ✨ Ask the AI… sends its source to the AI selected in Znote, which drafts the entries. You review them before anything is declared.

Before anything is sent, Znote scans the whole file for credentials: tokens and API keys, passwords assigned in the code, user:password@host URLs, private keys. If any line looks like a credential, nothing is sent, and the dialog lists the suspicious lines (never their values). Move the credential to the script's config file or to the environment, or declare the commands by hand. There is no override.

Approve ​

A declared entry does not run until you approve it: Review & approve… shows the exact command for each entry. Any change to the entry cancels its approval. An AI agent can declare entries, never approve them.

Use scripts ​

  • In an app: a script use=<name> block (see App note format).
  • With the AI: turn on the Tools chip of the AI overlay. Approved scripts appear in the tools menu, grouped by prefix (jira for jira.search, jira.get…). A write script asks for confirmation at each call, and Save as app turns the calls into script blocks.
  • In a note's frontmatter: tools: script:jira or tools: script:jira.search limits the AI to these scripts.

Znote — your notes, your files, your machine.