Skip to main content

Module directives

Module directives 

Source
Expand description

Colon-fence directives in operator-authored text — the :::type{attrs}::: container syntax (the MyST / remark-directive / ChatGPT subset), so an instruction can CARRY the machinery it describes:

You triage the queue. Escalate anything risky.

:::workflow
name: triage
steps:
  wake: { kind: subscribe, server: queue, uri: "queue://inbox" }
  act:  { kind: agent, depends_on: [wake], instruction: "triage it" }
  done: { kind: finish, depends_on: [act] }
:::

Design decisions, in order of load-bearing-ness:

  • Directives are a property of the SURFACE, not the text. This module only parses; the config layer runs it over operator-authored instruction text (inline, --instruction-file, a config file). Conversation text is never parsed — executing definitions out of untrusted input would be prompt injection as a feature.
  • Blocks are sugar over existing pipelines, never a parallel mechanism. A :::workflow body joins workflows: exactly as an inline entry — same vars folding, validation, hashing, pinning, reload diffing and retirement. A :::skill joins the skills catalogue like a discovered one. Nothing here can diverge from the real thing, because it IS the real thing.
  • Unknown names fail closed. :::worfklow silently becoming prose is a trap; the known set is enumerated in the error. Text that legitimately needs a literal ::: at column 0 can indent it.
  • The grammar is the small end of MyST: :::name{key=value key="v v"} on one line, body verbatim, closed by a line of at least as many colons. Nest by giving the OUTER fence more colons. No roles, no :key: option lines — those are documentation-system surface, not config surface.

Structs§

Directive
One parsed block.
Extraction
What instruction-surface extraction produces.
InlineSkill
A skill defined inline — the catalogue entry plus its body, no MCP server involved.

Enums§

Segment
A run of plain text, or the index of a directive between runs.

Functions§

extract
Run extraction over an instruction-surface text: parse, interpret the known blocks, rebuild the text a model should see.
merge_missing
Deep-merge frag into doc, DOC-WINS at every leaf — the fragment fills what the explicit config left unsaid and never overrides what it said. Lists are leaves (no splicing), with one deliberate exception: mcp.servers entries APPEND when no explicit server has the same name — declaring a server in the instruction must not require the config file to have none.
parse
Parse every top-level directive out of text. Returns the directives and the text segments between them, or every problem found.