Citadels
A citadel is an aggregator that pulls documentation from many sources into one structured tree.
A citadel is a directory that aggregates documentation from many
sources. The directory has a citadel.yaml at its root listing the
sources to pull from, and a destination tree (by default under
citadel/, configurable via baseDir) where the synced content
materialises.
Kinds of source
A source is either a git repository (url:) or a directory on
this machine (path:). What differs between sources is who decides
which files materialise:
- Manifest-driven — the entry has no
includeslist, and the source publishes its ownmaester.yamldeclaring what it makes available. The citadel consumes exactly that surface. The source owns the contract. - Includes-driven — the entry declares its own
includeslist of paths and globs. The citadel owns the filter set directly. Use this mode for public third-party repos or repos you have read access to but don’t own (a traveling maester). - Whole-repository — no
includes, and the source has nomaester.yaml(or one withdocuments: []). Every file is surfaced, minus build output, dependencies, binaries, and anything you list inexcludes.
All three are processed by the same maester sync command. If
includes is set, the source’s maester.yaml is ignored even when
present.
Configuration example
# citadel.yaml
schemaVersion: 1
baseDir: context # parent folder for every source's destination
sources:
# Manifest-driven: the remote owns the publish surface.
- name: source-context
url: https://github.com/your-org/your-source
ref: main
# Includes-driven: the citadel owns the filter set.
- name: external-style-guide
url: https://github.com/another-org/style-guide
ref: main
includes:
- 'README.md' # state defaults to draft
- { path: 'docs/**/*.md', state: draft } # explicit draft
- { path: 'docs/v3/**/*.md', state: canon, category: style-guide }
# Whole-repository: linked, never copied.
- name: handbook
url: https://github.com/your-org/handbook
excludes: [archive/**]
# A sibling checkout on this machine.
- name: platform-docs
path: ../platform-docs
With baseDir: context, the example above surfaces as
context/source-context/, context/external-style-guide/, and so on.
Omitting baseDir uses the default citadel/. Per-source
destination overrides win over both.
See Configuration for every field.
Copied or linked
How a source’s files land depends on what you’d want to commit:
| Source | Lands as | Commit it? |
|---|---|---|
| Git, manifest- or includes-driven | Copies, with state, category and tags stamped inline | Yes |
| Git, whole-repository | Symlinks into the local cache at .maester/cache/<name>/ | No — gitignored automatically |
Local, mode: link (default) | Symlinks to the live files | No — gitignored automatically |
Local, mode: copy | Copies, with metadata stamped inline | Yes |
Linked content is a view of something you already have, so it’s kept
out of git; edits to a linked local source show through immediately.
For agents that won’t follow symlinks, maester mcp exposes
citadel__list_linked_documents and citadel__read_linked_document.
Where content lands
By default, each source materialises under <baseDir>/<source-name>/.
Setting a per-source destination overrides that for the one source.
Changing baseDir after a previous sync is non-destructive — the new
sync writes to the new location and leaves any previously-populated
directories under the old base alone for you to remove with normal
git operations.
Sync semantics
maester sync is atomic per source: each source’s destination is
swapped in only after its checkout completes successfully. If one source
fails, the others still land. A non-zero exit code at the end of the
run signals “at least one source failed” — useful for CI.
When an includes-driven source matches zero files at the resolved ref, sync prints a “no files matched” warning so you can spot drift after the upstream restructures. The run still succeeds; the destination is left in a clean empty state.
Each source’s destination also carries a small provenance marker
(.maester-source.json) recording where the content came from, the
resolved commit (or, for local sources, a content fingerprint), the
mode, and the active filter set — the same data
maester status uses to decide
whether a source is behind. Commit it alongside copied content.
Checking freshness
Before relying on the citadel’s content, you (or an agent reading it) can ask:
maester status
Status reads the provenance markers and reports up-to-date,
behind, or failed for each source. Git sources are checked against
their remote; local sources are compared on disk, with no network
call. It never touches the working tree. Pair it with
maester sync when something is
behind.
More than documents
A citadel can also give agents live context: issue trackers and
other services through connectors, and
any third-party MCP server your team uses. They’re declared in the
same citadel.yaml and reach every agent host through one MCP entry.