CLI reference

Commands and flags for the maester CLI — init, sync, status, config editing, publish, connectors, MCP servers, skills, and global options.

This page lists every Maester subcommand and the flags they accept. For prose explanations of how the commands fit together, start with Getting started.

Entry points

There are two ways to invoke Maester:

  • npx baller-maester — the top-level interactive menu. Detects whether the current repo is a citadel, a maester, both, or neither, and offers the relevant next step (initialize a citadel, configure this repo as a maester, add or remove sources and documents, install or upgrade an agent skill).
  • maester <subcommand> — direct invocation of a named subcommand (e.g. maester sync, maester status, maester skill install). Useful for scripts, CI, and once you know which verb you want.

The top-level menu is the friction-free first run; direct subcommands are the durable scriptable surface.

Global flags

These flags work on every subcommand:

FlagDescription
--verboseLog file paths, per-file metadata and its source, and skip reasons.
--quietPrint only errors and the final summary line.
--jsonEmit machine-readable output — one JSON object per line.
--color, --no-colorForce colored output on or off.
--theme <theme>dark or light, overriding detection.
--no-welcomeSuppress the banner on --help, --version, and first run.
--help, -hShow command help and exit.
--version, -VPrint the installed Maester version and exit.

The MAESTER_NO_WELCOME=1 environment variable has the same effect as --no-welcome.

Command map

AreaCommands
Citadel setupinit, add, remove, list
Keeping content freshsync, status
Publishing (a maester)publish and its sub-verbs
Live servicesconnector, mcp-server, mcp
Agent skillsskill

maester init

Interactive walk-through that creates a citadel.yaml at the current working directory and (if a package.json is present) adds a maester:sync script entry. Reachable directly via maester init or through the npx baller-maester top-level menu.

maester init

The walkthrough collects:

  • One or more sources. For each, it asks “Git repository or local directory?”: a git source takes a URL and ref; a local directory takes a path and a link-or-copy choice.
  • An optional includes list per source. Skipping it means “use the source’s maester.yaml if present, otherwise link the whole repository” (see How a source picks its files).
  • Per-source auth, captured as the name of an environment variable. The secret value never lands on disk.
  • An optional per-source destination override and a top-level baseDir (pre-filled with citadel).
  • Optional connectors and MCP servers.
  • A final, recommended-by-default opt-in to install the Grand Maester agent skill for one or more target agents. Declining writes zero skill artifacts.

The walkthrough is idempotent — re-running it on a repo that already has a citadel shows the existing summary and offers safe options rather than silently overwriting.

maester add, remove, list

Edit the sources in an existing citadel.yaml without hand-editing YAML.

maester add       # same prompts as init, for one source
maester remove    # pick a source to remove
maester list      # table of sources (--json: { filePath, baseDir, sources })
  • Edits keep comments, key order, and every entry you didn’t touch, and are fully re-validated and written atomically.
  • remove refuses the last source. It leaves the source’s synced folder on disk for you to delete.
  • Exit codes: 0 ok · 1 declined · 2 missing or invalid config, or a refused edit · 130 Ctrl-C.

maester sync

Synchronises the configured sources into the citadel’s destination tree.

maester sync                     # all sources
maester sync source-context      # one named source
maester sync source-a source-b   # several
maester sync --concurrency 8     # more sources in parallel (default 4)

Sync is atomic per source: each source’s destination is swapped in only after its checkout completes successfully. Individual source failures are isolated — other sources still land — but the exit code is non-zero if any source failed, so the command is CI-safe.

Each source’s destination receives a small provenance marker (.maester-source.json) recording where the content came from, the resolved commit or content fingerprint, the mode, and the active filter set. maester status reads it to decide whether the source is behind.

How each source is materialised depends on its mode:

SourceResult
Git, includes- or manifest-drivenFiles copied, with metadata stamped inline. Safe to commit.
Git, whole-repositoryOne symlink per file into .maester/cache/<name>/; destination gitignored.
Local, mode: linkOne symlink per file into the source directory; destination gitignored.
Local, mode: copyFiles copied, with metadata stamped inline.

Metadata at sync time

For every copied file, sync resolves state, category, and tags per field in the order inline → first matching rule → default, and writes them into the destination copy using the format’s inline convention. The original source files are never modified. Formats with no inline convention (images, PDFs, binaries) are copied untagged, and linked files are never rewritten.

A value inline in the file that differs from its rule produces a warning (silenced by --quiet). --verbose shows every file’s values and where each came from.

Sync output

By default, sync prints one line per source, plus a category and tag roll-up:

✓  source-context: added (71ce137)  canon: 0 · draft: 25 · untagged: 0
›    categories: spec 24 · changelog 1 · tags: none

Linked sources are labelled (linked), with the reason a source resolved to whole-repository mode.

With --json, sync emits one JSON object per line: progress events, then a result per source carrying name, kind, status, destination, commitSha, mode, filterMode, state counts, categoryBreakdown, tagRollup, and any warnings.

Sync exit codes

CodeMeaning
0All sources synced successfully.
1One or more sources failed, or citadel.yaml is missing or invalid.

maester status

Read-only check that reports whether each configured source is up to date or behind and needs a sync. Status never writes to the working tree — agents and CI scripts can call it freely.

maester status                # check every source
maester status source-context # check one named source

A source is behind for one or more of these reasons:

ReasonMeaning
never-syncedNo provenance marker — no prior sync ran. No network call made.
remote-ref-advanced(Git) The configured ref now resolves to a different commit than the recorded one.
manifest-changedThe source’s maester.yaml publish surface changed, or the source switched filter mode (e.g. a manifest appeared).
cache-missing(Linked git sources) The .maester/cache/ copy the links point into is gone.
local-changed(Local sources) The files differ from the last sync. No network call made.

Includes-driven sources skip the manifest-changed check (their filter set is owned by the citadel, not the remote).

Status verdicts

Each source is reported as one of:

  • up-to-date — matches the recorded provenance for every checked signal.
  • behind — at least one reason above applies.
  • failed — the check itself couldn’t complete (missing env var, network error, unreachable remote). A local source whose directory or linked original is gone fails with reason source-missing. Other sources continue.

Status exit codes

Designed to be branchable in a single check:

CodeMeaning
0Every checked source is up-to-date.
1At least one source is behind, none are failed.
2At least one source is failed, or status couldn’t start.

2 takes precedence over 1 when both behind and failed sources appear in the same run.

Machine-readable output

Pass --json for one object per source, then a summary:

{"name":"source-context","verdict":"behind","kind":"git","mode":"copy","filterMode":"manifest","reasons":["remote-ref-advanced"],"commitSha":"a1b2c3…","resolvedSha":"e4f5g6…"}
{"name":"platform-docs","verdict":"up-to-date","kind":"path","mode":"link","filterMode":"manifest"}
{"type":"summary","upToDate":1,"behind":1,"failed":0}

Exit-code semantics are identical in both output modes. The Grand Maester agent skill uses this interface — and the exit code — to decide whether to offer a sync before reading citadel content.

maester publish

Configure the current repo as a maester — declare what it publishes in maester.yaml.

maester publish   # walkthrough: creates maester.yaml

The walkthrough collects path-or-glob entries with optional description, category, tags, and state. Finishing with zero entries (after a confirmation) writes documents: [], which publishes the whole repository. At the end it offers to install the Publisher skill, so your coding agent can maintain the manifest for you. If maester.yaml already exists, it changes nothing and points you at the editing verbs below.

Editing the manifest

CommandWhat it does
maester publish addAdd an entry with the walkthrough prompts. With --path, runs without prompts.
maester publish removePick an entry to remove. With --path, runs without prompts.
maester publish update --path <path>Change one entry in place, without prompts.
maester publish listTable of entries. --json adds manifest: none | whole-repository | listed.
maester publish applyApply a JSON change set in one validated, atomic edit.

Non-interactive field flags for add --path and update:

FlagDescription
--description <text>One-line description.
--category <slug>Category slug.
--tags <a,b>Comma-separated tag slugs.
--state <canon|draft>Omit to defer to each file’s header.
--unset <field>(update only, repeatable) Clear description, category, tags, or state.
--create(add only) Create maester.yaml if it doesn’t exist.
--dry-runValidate and print the result without writing.
--acknowledge-narrowingConfirm that a whole-repository manifest becomes a list of documents.
--allow-sensitiveAllow an entry that matches a likely-sensitive path (.env, keys, secrets/, …).

maester publish apply

Reads a change set from stdin, or from --from <file> (- for stdin), and applies it all-or-nothing:

echo '{
  "add":    [{ "path": "docs/adr/*.md", "category": "adr" }],
  "update": [{ "path": "README.md", "set": { "description": "Overview" }, "unset": ["tags"] }],
  "remove": ["old/notes.md"]
}' | maester publish apply --dry-run --json
  • Operations run remove → update → add, keyed by each entry’s exact path.
  • --create creates maester.yaml when it doesn’t exist; --dry-run writes nothing.
  • Guards: "acknowledgeNarrowing": true is required when the repo currently publishes everything (no file, or documents: []); "allowSensitive": true is required for paths matching likely secrets; the last entry can’t be removed.
  • Exit codes: 0 ok · 2 invalid or refused change set. Under --json, failures print {"ok": false, "error": {"field", "path", "message"}}.

maester publish inventory

Read-only. Lists candidate documents — honouring .gitignore and the built-in excludes — with any inline state / category / tags, which entry covers each, the categories and tags already in use, a per-directory roll-up, and a sensitive list of files that are never offered as candidates. It never prints file contents.

maester publish inventory --json
maester publish inventory --all --limit 500   # every non-excluded file, capped

maester publish preview

Read-only. Shows exactly which files each entry publishes and the state / category / tags each file ends up with, resolved by the same code sync uses.

maester publish preview                                  # the current manifest
echo '<change set>' | maester publish preview --from -   # a proposed change

Entries that match nothing are flagged empty-entry; entries whose files are all published by an earlier entry are flagged redundant; files matched by several entries list every match. In whole-repository mode, preview shows per-directory counts.

maester connector

Manage connectors — live services exposed to agents as MCP tools.

CommandWhat it does
maester connector addRegister a connector. Interactive, or --type --name --env-var --config <json> [--description].
maester connector remove <name>Remove it and refresh every host’s MCP entry.
maester connector listConfigured connectors and the tool names they expose.
maester connector refreshRe-validate citadel.yaml and rewrite each host’s MCP registration. Run it after hand edits. --dry-run shows, per host, which env-var names would be forwarded and why, writing nothing.
maester connector toolsThe tool list maester mcp would expose, without starting a session. --servers also starts proxied MCP servers to list theirs.
maester connector exec <name> <operation> [args…]Fallback for agents without MCP: runs one operation and prints its JSON envelope.

maester mcp-server

Manage third-party MCP servers declared in citadel.yaml.

CommandWhat it does
maester mcp-server addDeclare a server. Interactive, or flags: --name --kind local|remote, then --command --args --env-var (local) or --url --auth-env-var --auth-header (remote), plus --register proxy|direct, --tools, --description, --yes. Shows the exact command or URL before saving.
maester mcp-server remove <name>Remove it and refresh every host registration.
maester mcp-server listName, kind, mode, and env-var names.
maester mcp-server check [names…]Start or connect to each proxied server outside an agent session and report its tools, or why it failed (missing-env-var, command-not-found, connection-refused, auth-failed, timeout, …). Exits 1 if any fails.

maester mcp

Runs the stdio MCP server for the citadel. You don’t run this yourself: agent hosts (Claude Code, Cursor, Codex CLI) start it from the project-level MCP config that skill install and connector refresh write. It exposes connector tools, proxied MCP server tools (as <server>__<tool>), and — when the citadel has a linked destination — citadel__list_linked_documents and citadel__read_linked_document for agents that won’t follow symlinks.

maester skill

Install and manage Maester’s two agent skills:

--skillWhat it teaches your agentNeeds a citadel?
grand-maesterRead the citadel well: state, freshness, connectors. See Grand Maester.Yes
publisherDefine and tidy this repo’s maester.yaml. See Publisher.No

Without --skill, install asks which one when both apply; upgrade and status cover every installed skill.

Targets are claude-code, codex, cursor, and agents-md (any agent that reads a project-root AGENTS.md).

maester skill install

maester skill install                                      # interactive
maester skill install --target claude-code                 # one target
maester skill install --target claude-code --target codex  # several
maester skill install --skill publisher --target cursor    # the Publisher

Interactive mode shows a multi-select of the targets; flag mode skips the prompt. Re-installing an installed target is an idempotent refresh. Both skills can share one AGENTS.md, each in its own managed region.

maester skill upgrade

Refresh installed artifacts to match the locally-installed maester version. Touches only the managed region of each artifact; anything you added outside it survives.

maester skill upgrade
maester skill upgrade --skill publisher

maester skill add-target

Add a target to an existing install without reinstalling the others.

maester skill add-target cursor

maester skill status

Shows, per skill and target, whether it’s installed and up to date.

maester skill status

To switch targets, install the new one and remove the old artifacts manually (there is no uninstall verb). Each target’s artifacts live in their own location, so removing one doesn’t affect the others.

See also