The Grand Maester
An optional, installable agent skill that turns a citadel into a first-class context surface for AI coding agents like Claude Code, Codex CLI, and Cursor.
The Grand Maester is an optional, installable integration that turns a citadel into a first-class context surface for whichever AI coding agent you run. After you install it, the agent reasons over the citadel’s content with three behaviors baked in:
- Citadel awareness — it knows where the citadel lives and how it’s organised, so it consults the right files without being asked.
- State awareness — it prefers
canonfiles when answering authoritatively, and marksdraftcitations as informational. - Freshness awareness — before substantial reads it runs
maester statusand surfaces anybehindverdict so the agent never answers from a stale corpus.
Installing the Grand Maester is the difference between an agent that could read the citadel and one that will — every time, with the right policy.
Why this exists
A citadel can be perfectly assembled and still go unused. Without an integration, the host agent has to be told manually about the citadel, has no way to distinguish ratified content from drafts, and will happily read whatever it finds — including stale snapshots from the last sync. The Grand Maester closes that gap by encoding the “how to use a citadel” policy in the agent’s native integration surface (skills, rules, project instructions) and — where the platform supports it — wires the freshness check as an automatic pre-read hook.
Supported agents
Four targets are supported:
Target (--target) | Integration |
|---|---|
claude-code | A skill at .claude/skills/grand-maester/SKILL.md plus a PreToolUse hook that runs maester status before citadel reads. |
codex | A skill at .agents/skills/grand-maester/SKILL.md. Instruction-only. |
cursor | A rules file at .cursor/rules/grand-maester.mdc. Instruction-only. |
agents-md | A managed region in the repo’s AGENTS.md — any agent that reads project-level instructions can use it. |
For Claude Code, Codex CLI, and Cursor, installing also registers
Maester’s MCP server in that host’s project config (.mcp.json,
.codex/config.toml, .cursor/mcp.json) — see
Live tools.
You can install for one target or several in the same run. The artifacts go into the citadel-bearing repository and are safe to commit — they contain no secrets and no machine-local paths.
Installing
Two paths reach the same install flow.
During citadel init (recommended)
The very last step of npx baller-maester init asks:
Install the Grand Maester agent skill? (Y/n)
Yes is the default. Accepting moves you straight into target-agent selection. Declining completes init normally with zero skill artifacts written.
Standalone
If you skipped the install step, or set up your citadel before this feature shipped, install at any time from the citadel repo root:
maester skill install
The command is interactive by default — multi-select the targets you
want — and idempotent: re-running it for the same target leaves the
artifacts byte-identical. Pass --target to skip the prompt:
maester skill install --target claude-code --target codex
See the CLI reference for every
verb the skill command group supports.
How the three behaviors work
Citadel awareness
Every installed artifact carries instruction text that tells the host agent:
- where the citadel lives in the repo (under whatever
baseDiryou configured); - that content is organised per-source under that directory;
- how to find the per-source layout (a recognisable subdirectory per registered source).
For agents whose platform supports a project-instructions surface, this is just text. The agent picks it up the same way it would any other repo-level guidance.
State awareness
The artifacts tell the agent to:
- treat files whose resolved
state is
canonas authoritative; - treat
draftfiles as informational context only, marking citations as draft when used; - read state inline from each file (no external state index is needed — sync writes the state into each file at import time).
This is the same policy a careful human reader would apply. The Grand Maester just makes it a property of the agent rather than something each developer has to keep in mind.
Freshness awareness
Before substantial reads of citadel content, the integration causes
maester status to run. The behavior depends on the platform:
- Active where supported. On Claude Code, the freshness check is
wired as a
PreToolUsehook so it runs automatically before each citadel read. - Instruction elsewhere. On Codex CLI, Cursor, and any
AGENTS.mdagent, the same behavior is encoded as instruction the host agent is expected to follow.
Either way, the verdict drives behavior:
up-to-date→ the agent proceeds silently.behindorfailed→ the agent surfaces the verdict to you and offers to runmaester syncbefore continuing.failedwith a network error → the read still proceeds; the agent is told to flag potential staleness in its answer.
The check is intentionally cheap. It uses status’s documented exit-code contract (network only — no clone, no destination writes) so the cost of running it before every read is negligible.
Live tools
Every host the Grand Maester is installed for gets one maester MCP
entry, which runs maester mcp in the citadel. Through it the agent
can call:
- Connector tools such as
team_issues__list_issues— live data the agent is told to cite by identifier and treat as point-in-time. - Proxied third-party MCP server tools, as
<server>__<tool>. citadel__list_linked_documentsandcitadel__read_linked_document, when the citadel has linked sources, for agents that won’t follow symlinks. The instructions also explain what a dangling link means (the cache or original is gone; sync restores it).
Credentials are forwarded by env-var name only. Claude Code and
Codex CLI receive the names in their MCP entry; Cursor inherits the
environment of the shell that launched it, so its rule lists the
names to export. The agents-md target documents
maester connector exec as a fallback for agents without MCP.
Managed regions and upgrades
Every artifact the Grand Maester writes contains a clearly marked
managed region. Upgrades touch only that region; anything you
add outside it survives. To refresh the installed artifacts to the
shape of your current local maester install:
maester skill upgrade
This is the only way to “update” the Grand Maester — it ships with
the maester package, not over the network. Upgrade maester itself,
then run skill upgrade to refresh the artifacts.
To add a new target to an existing install without reinstalling the
others, use add-target:
maester skill add-target cursor
What it isn’t
- Not the agent. The Grand Maester configures an agent you already have. It does not install Claude Code, Codex CLI, or Cursor; it installs guidance into the citadel repo that those agents read.
- Not a sync. When
maester statusreturnsbehind, the Grand Maester surfaces the verdict and offers a sync — it does not perform the sync itself. - Not network-based. The skill ships with the
maesterpackage. “Upgrade” means re-installing against the localmaesterversion, not fetching from a remote registry. - Not stateful across machines. The installed artifacts live in the citadel repository alongside the existing committed config, so they’re shared with every collaborator at no extra cost.
See also
- Document state, category and tags
— what
canonanddraftmean and how they get into each file. maester status— the freshness check the Grand Maester runs before reads.maester skill— the CLI surface for installing, upgrading, and adjusting the skill.- Publisher — the other installable skill, for the repos that publish documentation.
- Connectors — the live tools the Grand Maester exposes.