Skip to content

Prompt XML Syntax

thndrs uses XML-shaped text to make prompt sections easy to scan in --print-prompt output. The tags are a prompt convention, not a separate policy engine or a general XML API.

Prompt fragments live in src/prompt/fragments and are included verbatim in a fixed order. Keep each fragment focused on one concern, use shallow tags, and prefer short imperative instructions.

Use tags for structure:

<communication_style>
<instruction>Be direct and practical.</instruction>
</communication_style>

Do not put unrelated policy, runtime metadata, and project context into the same fragment. Runtime sections such as <environment> and <project_context> are generated by Rust code so their values match the actual run.

Generated sections wrap arbitrary text in CDATA. This is used for values that may contain Markdown, paths, punctuation, or angle brackets, such as workspace paths and AGENTS.md content.1

<workspace><![CDATA[/repo]]></workspace>
<content><![CDATA[# Project
Build with cargo test.
]]></content>

When generated text contains the CDATA terminator, thndrs splits it so the surrounding XML-shaped section remains readable.2

Literal prompt fragments should avoid CDATA unless they are intentionally embedding large text. Most fragment instructions should be ordinary XML text.

The prompt order is part of the contract:

  1. Built-in harness fragments.
  2. Environment metadata.
  3. Project context from AGENTS.md.

AGENTS.md content is guidance. It cannot grant permissions, change tools, bypass safety limits, or override direct user or harness instructions.3

  1. CDATA is used for readability in prompt output, not as a security boundary.

  2. The Rust helper replaces ]]> with adjacent CDATA sections.

  3. See Prompt Assembly for the full prompt order and context contract.