
# Commands

> [!TIP]
> Commands are grouped below. `spec <command> --help` shows arguments and examples,
> `spec help <command> --markdown` prints one command's reference page, and every command takes
> `--json`.

## Query

- `spec context` — The documents that govern code paths: read this before changing code
- `spec find` — Find documents by words, type, owner, status or tag
- `spec show` — Frontmatter, outline, one section, or relations of a document
- `spec resolve` — Resolve an id, alias, path or slug to one document
- `spec graph` — Graph queries: impact, chain, governs, consumers; or the whole graph
- `spec owners` — Owners, their documents and where public owners store theirs
- `spec assets` — Agent skills, rules, subagents and instruction files declared under [[assets]]
- `spec log` — The history of a document's status and relations, from git
- `spec census` — Counts of documents, references and attachments

## Write

- `spec new` — Create a document at the place its owner and type decide
- `spec set` — Change frontmatter with the lifecycle enforced
- `spec edit` — Replace or append to a section or the whole body; previews until --write
- `spec mv` — Move or rename a document and rewrite every reference to it
- `spec fix` — Apply fixes that need no judgement
- `spec sync` — Copy asset sources over the [[assets]] roots that declare copy_of; previews until --write
- `spec attach` — Register files with a document, in the repository or the store
- `spec fetch` — Download a document's stored attachments, verified by hash
- `spec files` — A document's attachments and where each is kept

## Check

- `spec check` — Run the rules
- `spec verify` — Run sot verify commands
- `spec guard` — Run guards over files and commit messages
- `spec audit` — Diagnose what passes the rules yet needs attention; build review packs; record audits
- `spec explain` — Why a rule exists and how to fix it; or the configuration keys
- `spec schema` — Document types and their frontmatter; or output schema names

## Set up and connect

- `spec init` — Write a starter spec.toml
- `spec import` — Bring documents from another layout in through an import map
- `spec agents` — The lines to put in an agent's instruction file
- `spec hook` — Hook snippets for git, pre-commit, lefthook or husky
- `spec plugins` — Configured plugins and what they provide
- `spec export` — Export through an exporter plugin
- `spec mcp` — Serve these commands as MCP tools over stdio
- `spec lsp` — Serve check findings as editor diagnostics (Language Server Protocol over stdio)
- `spec help` — Commands and arguments; with --json, the whole command tree

## All commands

There are <!-- spec:count rows="All commands" -->33<!-- /spec:count --> commands. This table is
generated by `spec help --markdown`; do not edit it by hand.

<!-- spec:commands:begin -->

| command | what it does |
| ------- | ------------ |
| `spec context` | The documents that govern code paths: read this before changing code |
| `spec find` | Find documents by words, type, owner, status or tag (also `spec list`, `spec ls`) |
| `spec show` | Frontmatter, outline, one section, or relations of a document |
| `spec resolve` | Resolve an id, alias, path or slug to one document |
| `spec graph` | Graph queries: impact, chain, governs, consumers; or the whole graph |
| `spec owners` | Owners, their documents and where public owners store theirs |
| `spec assets` | Agent skills, rules, subagents and instruction files declared under [[assets]] |
| `spec log` | The history of a document's status and relations, from git |
| `spec new` | Create a document at the place its owner and type decide |
| `spec set` | Change frontmatter with the lifecycle enforced |
| `spec edit` | Replace or append to a section or the whole body; previews until --write |
| `spec mv` | Move or rename a document and rewrite every reference to it |
| `spec fix` | Apply fixes that need no judgement |
| `spec sync` | Copy asset sources over the [[assets]] roots that declare copy_of; previews until --write |
| `spec attach` | Register files with a document, in the repository or the store |
| `spec fetch` | Download a document's stored attachments, verified by hash |
| `spec files` | A document's attachments and where each is kept |
| `spec init` | Write a starter spec.toml, or upgrade an existing one |
| `spec import` | Bring documents from another layout in through an import map |
| `spec check` | Run the rules |
| `spec verify` | Run sot verify commands |
| `spec guard` | Run guards over files and commit messages |
| `spec audit` | Diagnose what passes the rules yet needs attention; build review packs; record audits |
| `spec census` | Counts of documents, references and attachments |
| `spec doctor` | Read-only setup diagnosis: configuration, conflict markers, ignored local documents |
| `spec explain` | Why a rule exists and how to fix it; or the configuration keys |
| `spec schema` | Document types and their frontmatter; or output schema names |
| `spec help` | Commands and arguments; with --json, the whole command tree |
| `spec agents` | The lines to put in an agent's instruction file |
| `spec hook` | Hook snippets for git, pre-commit, lefthook or husky |
| `spec plugins` | Configured plugins and what they provide |
| `spec export` | Export through an exporter plugin |
| `spec mcp` | Serve these commands as MCP tools over stdio |
| `spec lsp` | Serve check findings as editor diagnostics (Language Server Protocol over stdio) |

<!-- spec:commands:end -->
