Directives
Directives
Section titled “Directives”Directives are metadata declarations that use Markdown link syntax. They tell the runtime about document structure but are not rendered as content.
Nav directive
Section titled “Nav directive”Registers a navigation menu.
Syntax
Section titled “Syntax”[!nav:name](path)name— the menu identifier (used in/nav name)path— relative path to the menu file
Example
Section titled “Example”[!nav:main](./nav/main.md)[!nav:api](./nav/api.md)- The directive MUST be on its own line.
nameMUST match[a-z][a-z0-9-]*.pathMUST be a relative path to a valid Markdown file.- Menu names MUST be unique within a document.
pageis a reserved name — it MUST NOT be used as a menu name.- In a CommonMark viewer, the directive renders as a regular link.
Menu file format
Section titled “Menu file format”The file referenced by a nav directive contains shortcut lines:
[@home Home](../index.md)[@intro Introduction](../intro.md)[@guide Blocks Guide](../guide/blocks.md)Each line is a shortcut (see 05-shortcuts.md). Paths are relative to the menu file’s own location.
A menu file SHOULD contain only shortcut lines. Other content is allowed but ignored by the runtime.
Include directive
Section titled “Include directive”Includes content from another file inline.
Syntax
Section titled “Syntax”[!include:id](path)[!include:id]()id— an identifier for the included contentpath— relative path to the source file (optional)
Path resolution
Section titled “Path resolution”When path is omitted (empty parentheses), the runtime resolves
it automatically:
[!include:id]() → filename.source/id.mdWhere filename is the current document’s name without extension.
For example, in dashboard.md:
[!include:header]() → dashboard.source/header.md[!include:sidebar]() → dashboard.source/sidebar.mdThis convention keeps includes organized in a predictable location
without requiring the author to spell out paths. AI agents using
String access included content via document.md#id — they don’t
need to know the underlying file structure.
Example
Section titled “Example”# With explicit path[!include:footer](./partials/footer.md)[!include:terms](./legal/terms.md)
# With auto-resolved path (recommended)[!include:header]()[!include:sidebar]()- The directive MUST be on its own line.
idMUST match[a-z][a-z0-9-]*.- If
pathis provided, it MUST be a relative path to a valid Markdown file. - If
pathis omitted (empty()), the runtime resolves to{filename}.source/{id}.mdrelative to the current document. - Include IDs MUST be unique within a document.
- Circular includes (A includes B includes A) are an error.
- In a CommonMark viewer, the directive renders as a regular link.
Block targeting
Section titled “Block targeting”An include with explicit path MAY topic a specific block:
[!include:pricing](products.md#pricing)Only the content of the #pricing block from products.md is
included.
Requirements directive
Section titled “Requirements directive”Points at a setup/install document for this app or tool. Recommended
(not required) — the convention is that any prerequisite work an agent
or operator needs to do once at install time (API keys, registration,
external accounts, runtime deps) lives in requirements.md, separate
from the always-loaded string.md. Keeps per-turn context small.
Syntax
Section titled “Syntax”[!requirements](path)- No identifier — a document declares at most one requirements doc.
path— relative path to the setup document.
Auto-detection (local files only)
Section titled “Auto-detection (local files only)”For documents loaded from file://, if a sibling file named
requirements.md exists next to the document, the runtime registers
it as the requirements doc automatically — no directive needed.
my-app/├── string.md ← agent-facing, loaded every turn└── requirements.md ← auto-detected, loaded only on /openWeb documents (loaded from https://) MUST declare the directive
explicitly; the runtime cannot probe sibling URLs over HTTP.
An explicit directive always overrides auto-detection — useful when the setup doc lives elsewhere or has a different name.
Runtime behavior
Section titled “Runtime behavior”When a requirements doc is registered, /open of the parent document
prepends a one-line hint:
[setup] /open requirements.mdThis tells the agent where to read setup info if an action fails on missing credentials or unmet dependencies.
Example
Section titled “Example”# Moltbook 🦞
The social network for AI agents.
[!requirements](docs/install.md)Or rely on auto-detection:
moltbook/├── string.md└── requirements.md ← auto-registered- The directive MUST be on its own line.
pathMUST be a relative path or absolute URI to a valid Markdown file.- A document MUST declare at most one
[!requirements]directive — later occurrences are ignored. - Auto-detection applies only to
file://documents, only for the conventional namerequirements.md. - An explicit directive overrides auto-detection.
- In a CommonMark viewer, the directive renders as a regular link.
Path notation
Section titled “Path notation”Directive and link paths SHOULD use bare relative form, not ./:
[!nav:main](nav/main.md) ← preferred[!nav:main](./nav/main.md) ← discouraged[!include:footer](partials/foot.md) ← preferred[Setup](requirements.md) ← preferredThe leading ./ is shell-shaped baggage; in Markdown contexts, bare
relative paths are unambiguous (.md extension distinguishes a file
from a registry name like app:weather). Both forms resolve identically,
but the bare form is the documented convention.
| Path | Meaning |
|---|---|
foo.md | Relative to current document |
dir/foo.md | Relative subdirectory |
/abs/foo.md | Absolute filesystem path |
https://... | External URL |
app:name | Installed app (registry lookup) |
tool:name | Installed tool (registry lookup) |
@shortcut | Resolved via document’s shortcuts |
Directive lines
Section titled “Directive lines”Directives are identified by the [! prefix in link syntax.
Any line matching [!type:name](path) is a directive line.
Directive lines:
- Are parsed as metadata
- Are not shown as content to AI (in String runtime)
- Render as normal links in standard Markdown viewers
Currently defined directive types:
| Type | Purpose |
|---|---|
nav | Register a navigation menu |
include | Include content from another file |
requirements | Point at this app/tool’s setup doc |
Unknown directive types SHOULD be ignored by parsers.