pdd preprocess processes a prompt file and saves the expanded result. It resolves <include> directives, removes <pdd> comments, executes <shell> tags, fetches <web> URLs, and optionally doubles curly brackets. Use it to inspect exactly what the LLM will receive before running any generative command.
Usage
Arguments
The prompt file to preprocess.
Options
Where to save the preprocessed prompt file. Default:
<basename>_<language>_preprocessed.prompt. Also reads from PDD_PREPROCESS_OUTPUT_PATH.Insert XML delimiters for long or complex prompts to add structure. When set, the prompt is only preprocessed to insert XML delimiters — other directives are not expanded.
Recursively preprocess all
<include> directives found within included files, not just the top-level prompt.Double all single curly brackets (e.g.,
{x} becomes {{x}}). Already-doubled brackets are preserved. Useful when a prompt will be used as a Python format string downstream.Keys to exclude from curly bracket doubling when
--double is set. Only applies when the entire contents of a {...} pair exactly match the excluded key. For example, --exclude model keeps {model} as-is but still doubles {model_name}.Inject PDD metadata tags (
<pdd-reason>, <pdd-interface>, <pdd-dependency>) from architecture.json into the prompt.Supported directives
pdd preprocess expands the following XML-like tags in prompt files. Tags inside fenced code blocks (``` or ~~~) and inline backticks are left unchanged.
<include> — embed file content
<include> — embed file content
Embeds file content into the prompt. The file path is the tag body.Optional attributes for selective extraction:
select=— Deterministic structural extraction. Supportsdef:foo,class:Bar, line ranges, headings, regex, and JSON/YAML paths. Composable with commas.mode="interface"— Python only. Extracts signatures and docstrings with bodies replaced by....query=— LLM-powered semantic extraction, cached in.pdd/extracts/.optional— A missing file resolves to an empty string instead of an error.
select= and query= are present, select= takes precedence (no LLM cost).<pdd> — comments
<pdd> — comments
Marks content as a comment. Removed from the preprocessed output.
<shell> — shell command output
<shell> — shell command output
Executes a shell command and replaces the tag with its standard output.
<web> — web page content
<web> — web page content
Fetches a web page and includes its Markdown-converted content.
Triple-backtick includes
In addition to XML tags, PDD supports embedding file content inside triple-backtick code blocks using angle brackets:Curly bracket doubling
When--double is used:
- Single curly brackets are doubled if not already doubled.
- Already-doubled brackets are preserved.
- Nested curly brackets are handled correctly.
- Special handling is applied for JSON, JavaScript, TypeScript, and Python code blocks.
- Multiline variables with curly brackets receive special treatment.
--exclude to protect specific variable names from doubling:
Examples
Related commands
pdd auto-deps— Inserts<include>directives; usepreprocessto verify they resolve correctly.pdd generate— Calls preprocessing internally before sending content to the LLM.