Command reference

The ascribe commands: their options, outputs, and exit codes.

For AI agents: the documentation index is at llms.txt, and this page is available as Markdown.

The ascribe command checks, builds, and formats an Ascribe project, and runs the language server the editor uses. Its explain, model, outline, link, refs, resolve, and search commands answer questions about a project, for writers and for agents, without changing anything, and ascribe mcp offers them to agents as the tools of an MCP server.

Install it in a project with npm install --save-dev @ascribed/cli (see Install Ascribe) and run it with npx ascribe, or from a script in package.json. Where there’s no Node, install it on your path with Homebrew or the install script (Install Ascribe) and run it as ascribe.

Commands

Each command links to its section, with its options, output, and exit codes, on the page for its kind of work.

Command What it does
ascribe addresses Keeps ascribe.addresses, the record of where the addresses you published went: makes it, records a move or a retired address, and lists the redirects each build writes.
ascribe agents Sets a repository up for agents: writes the project’s rules and the skill where agents read them, indexes the docs for a product’s agents, and runs an agent’s hook.
ascribe baseline Puts a project’s existing advice off for now, so ascribe check reports only what’s new.
ascribe build Checks the project, then writes each build’s outputs.
ascribe check Checks every source file for problems, without building anything.
ascribe diff Shows what changed between a git revision and the working tree, as readers will see it.
ascribe drift Lists the pages whose code examples changed, and whether the words around them changed too.
ascribe explain Says what a diagnostic means, and how to fix it.
ascribe fmt Rewrites Ascribe constructs into canonical form.
ascribe init Starts a project: writes its first ascribe.toml, and makes the folder its pages go in.
ascribe link Says whether a link works, written on a given page, and the destination to write there.
ascribe lsp Runs the language server, for an editor.
ascribe mcp Runs an MCP server, for an agent that has no shell, or a host that approves tools one by one.
ascribe model Shows the content model as ascribe reads it, with the defaults filled in.
ascribe new Starts a page from its type’s template, with its type and title set.
ascribe observe Runs the test of a folder of tested examples, and records what it passed with.
ascribe outline Shows a page’s title and type, and the headings a link to it can name.
ascribe permalinks Keeps the list of permalinks, checks a product’s names against it, and retires a permalink.
ascribe preview Renders a build’s pages as a site, serves it on this computer, and renders it again as you edit.
ascribe refs Lists the places that use a page, a fragment, a heading, an image, or an entry of the content model.
ascribe rename Renames a phrase, a dimension’s value, a heading’s id, or a page, and changes everything that uses it.
ascribe report Reports what state a project is in, section by section.
ascribe resolve Resolves a page for one build and writes it as a reader of that build sees it. A page in the site output says what --emit site writes.
ascribe search Finds where the pages say something, as their readers read it, and names the line to edit.
ascribe sources Copies code from other repositories, pins it in ascribe.lock, and says what changed when the pin moves.
ascribe templates Writes the page templates into a project, and says what’s changed in them.
ascribe vale Writes Vale’s preset out as the project’s own configuration.
ascribe versions Lists a project’s release lines, says what differs between two, and releases, archives, or retires one.

Every command’s synopsis

ascribe init              [DIR] [--templates] [--content-root <DIR>] [--dry-run] [--force] [--format text|json]
ascribe new               TYPE PATH [--title <TITLE>] [--dry-run] [--force] [--format text|json]
ascribe check             [PATHS]... [--stdin] [--path <PATH>] [--build <NAME>]... [--editor-build] [--code <CODE>]... [--summary] [--format text|concise|json|github|prompt] [--limit <N>] [--exit-code[=error|warning]] [--deny-warnings] [--base <REV>] [--base-exact] [--fix] [--dry-run] [--force] [--vale] [--no-baseline]
ascribe fmt               [--check] [--dry-run] [--force] [PATHS]... [--format text|json|github]
ascribe build             [--build <NAME>]... [--emit site,plain,json] [--format text|json] [--anchors] [--no-baseline]
ascribe preview           [--build <NAME>] [--port <PORT>]
ascribe diff              [PAGE] [--base <REV>] [--base-exact] [--build <NAME>]... [--format text|json|html|prompt] [--exit-code] [--pages-only]
ascribe drift             [--base <REV>] [--build <NAME>]... [--format text|json|markdown] [--exit-code]
ascribe report            [SECTION]... [--format text|markdown|json|prompt] [--build <NAME>]... [--not-listed] [--site <URL>] [--limit <N>] [--recheck] [--no-history] [--no-baseline] [--exit-code[=advice|warning|error]]

ascribe explain           [CODE] [--list] [--format text|json]
ascribe model             [PATH] [--section types|frontmatter|fragments|dimensions|lifecycle|phrases|features|notes|glossary|images|widgets|releases|builds|sources|apis|from|intended|project|versions|consumer|editor|checks|crawlers|listing|navigation] [--format text|json]
ascribe outline           PAGE [--build <NAME>] [--format text|json]
ascribe link              TARGET --from <PAGE> [--format text|json]
ascribe refs              TARGET [--limit <N>] [--format text|json]
ascribe search            QUERY [PATHS]... [--type <NAME>] [--case] [--word] [--summary] [--build <NAME>]... [--limit <N>] [--format text|json]
ascribe resolve           PAGE [--build <NAME>] [--emit plain|site] [--frontmatter] [--format text|json]
ascribe rename            TARGET NEW [--dry-run] [--force] [--format text|json]

ascribe baseline write    [--dry-run] [--force] [--format text|json]
ascribe baseline prune    [--dry-run] [--force] [--format text|json]
ascribe versions list     [--format text|json]
ascribe versions changes  FROM TO [--format text|json|markdown]
ascribe versions release  LINE [--next <LINE>] [--dry-run] [--force] [--format text|json]
ascribe versions export   LINE --to <DIR> [--build <NAME>] [--current <URL>] [--format text|json]
ascribe versions retire   LINE [--url <URL>] [--dry-run] [--force] [--show-unused] [--remove-unused] [--format text|json]
ascribe permalinks sync   [--check] [--dry-run] [--force] [--format text|json]
ascribe permalinks list   [--format text|json]
ascribe permalinks verify [NAME]... [--from <FILE>] [--against <PATH>] [--format text|json]
ascribe permalinks retire [NAME]... [--reason <TEXT>] [--to <PAGE>] [--page <PAGE>] [--under <FOLDER>] [--dry-run] [--force] [--format text|json]
ascribe addresses init    [--dry-run] [--force] [--format text|json]
ascribe addresses move    [OLD] [NEW] [--from-git] [--base <REV>] [--base-exact] [--dry-run] [--force] [--format text|json]
ascribe addresses retire  OLD --reason <TEXT> [--dry-run] [--force] [--format text|json]
ascribe addresses list    [--build <NAME>] [--format text|json]
ascribe sources fetch     [NAME]... [--dry-run] [--force] [--format text|json]
ascribe sources update    [NAME]... [--to <REV>] [--dry-run] [--force] [--format text|json|markdown]
ascribe sources status    [--format text|json]
ascribe observe           [--name <NAME>] [--check] [--dry-run] [--force] [--yes] [--format text|json]
ascribe templates list    [--format text|json]
ascribe templates eject   [NAME]... [--to <DIR>] [--keep-type] [--dry-run] [--force] [--format text|json]
ascribe templates status  [--format text|json] [--exit-code] [--diff <NAME>]
ascribe vale eject        [--dry-run] [--force] [--format text|json]

ascribe agents sync       [--check] [--dry-run] [--force] [--target agents-md|skills|claude|claude-rules|copilot|codex]... [--with-hook] [--cloud] [--agent] [--command <COMMAND>] [--format text|json]
ascribe agents rules      [PATH]
ascribe agents index      [--build <NAME>] [--into <FILE>] [--pages <DIR>] [--dry-run] [--force] [--format text|json]
ascribe agents skill      [FILE]
ascribe agents prompt     [NAME] [--arg <KEY=VALUE>]... [--list] [--format text|json]
ascribe agents hook       HARNESS [--event edit|stop] [--command <COMMAND>]
ascribe mcp
ascribe lsp
ascribe --version

Output formats

--format takes the same words on every command that has it. Every command that takes text takes concise too: ascribe check lists one line a problem, and a command with no one-line form writes its text.

Commands that write

Every command that changes a file you commit, such as ascribe fmt, ascribe check --fix, ascribe rename, ascribe init, ascribe sources update, ascribe templates eject, ascribe vale eject, ascribe agents sync, or ascribe observe, takes --dry-run, which says what it would change and changes nothing. It also refuses to change a file git couldn’t put back as it was: one with changes not committed, one git doesn’t track, or one in no repository. The error names the files; commit or stash them, or pass --force to write them anyway. A file that isn’t there yet is only added, so it’s never refused.

$ ascribe addresses move guides/old.md guides/new.md
error: this would change files git can't put back as they are: ascribe.addresses; commit or stash them, or pass --force

One that takes --check, such as ascribe fmt, ascribe permalinks sync, ascribe agents sync, or ascribe observe, changes nothing with it either, and is for CI: it prints each change as a unified diff, and exits with 1 when something would change.

Options every command accepts

  • --config <PATH>: The content model, ascribe.toml, or a folder that holds one. By default, the nearest ascribe.toml in the current folder or a parent, so the commands work from anywhere inside a project. Not for lsp, whose project comes from the editor, init, which starts one, or observe, which runs in a folder of code.
  • --color <WHEN>: When to color text output.
    • auto (the default): When writing to a terminal, unless NO_COLOR is set.
    • always: Always.
    • never: Never.

Without --config, a command’s project is the nearest ascribe.toml at or above the current folder, or at or above the path it’s given.

A path a command takes is from the current folder, as a shell’s is: ascribe check, ascribe fmt, and ascribe search take paths that way alone, and ascribe new a path from the current folder inside the content root. The commands that take one page, outline, link --from, refs, rename, resolve, diff, addresses move, and addresses retire, also take its path from the content root, as links write it.

When there’s none, and the folder holds projects in its subfolders, as a repository with several does at its root, the error names their folders, so you can run the command in one, or pass --config with its folder: the projects below it are in docs, handbook: run ascribe in one of them, or pass --config with its folder. ascribe agents sync is the exception: there, it syncs each of them.

Exit codes

Every command exits with the same three codes, and each command’s section has a table that says what they mean for it:

Code Meaning
0 It did what it was asked, whatever it found, unless finding something fails it.
1 It ran, and found something, such as errors, with ascribe check and ascribe build; a file that would change, with --check; a target that doesn’t exist, with ascribe link and ascribe refs; nothing matched, with ascribe search; or a test that failed, with ascribe observe. --exit-code means two things. On ascribe report, ascribe diff, ascribe drift, and ascribe templates status, it turns 1 on for what they find. On ascribe check, it sets the level that fails, error unless you say warning.
2 It couldn’t run: a usage error, no ascribe.toml, a content model with errors, a file it can’t read or write, or, without --force, a file git couldn’t put back. The reason goes to standard error.

A command with nothing to find, such as ascribe init or ascribe new, has no 1: it did its work, or it couldn’t. A content model with errors is a 2 for every command, ascribe check and ascribe model included: the errors are shown, and nothing else is done.

A few don’t follow the pattern:

  • ascribe agents hook exits with 1 when its input isn’t JSON, a failure an agent shows to you and not to the model, and with 0 whatever its checks find.
  • ascribe lsp exits with 1 when the editor stops it without asking it to shut down first, as the Language Server Protocol says, and with 0 when it shuts down.
  • ascribe preview runs until you stop it, so it has no 0 or 1: it exits with 2 only when it couldn’t start.

Environment variables

The ascribe binary, and the tools that run it, read these. Each is for a test, a CI job, or a machine set up differently from most, and none is needed: unset, each has the default its row gives.

Variable Read by What it does Default
ASCRIBE_BIN @ascribed/astro The ascribe binary the integration runs, when its binary option doesn’t name one. The binary @ascribed/cli installed
ASCRIBE_CACHE_DIR ascribe sources, and ascribe agents hook’s check server The folder Ascribe keeps fetched repositories and the check server’s files in. ascribe in your user’s cache folder: $XDG_CACHE_HOME, ~/.cache, ~/Library/Caches, or %LOCALAPPDATA%
ASCRIBE_HOOK_SERVER ascribe agents hook off checks in the hook’s own process every time, instead of starting a check server that keeps the project loaded. A check server
ASCRIBE_LINKS_RETRY_WAIT ascribe report links How many seconds to wait before asking again about a link that answered with a server error, such as 0 in a test. 30
ASCRIBE_PATH The Claude Code plugin The ascribe binary the plugin runs. The project’s node_modules/.bin/ascribe, then ascribe on your path
ASCRIBE_TODAY Every command that checks, the language server, and the hook’s check server The day, written YYYY-MM-DD, the checks that depend on the date check as of. A value that isn’t a date is reported, and today’s is used. Today’s date in UTC
NO_COLOR Every command, with --color auto Set to anything, it turns color off at a terminal too. Color when writing to a terminal

ASCRIBE_BLESS, which rewrites generated files, is for the tests of Ascribe’s own repository, and no command reads it.