pdd trace implements bidirectional traceability. Given a line number in a generated code file, it finds the corresponding section in the prompt file that produced that code. This makes it easy to navigate from a buggy line of code back to the prompt instruction that caused it.
Usage
Arguments
The prompt file that generated the code being analyzed.
The generated code file containing the line to trace.
The line number in the code file to trace back to its prompt origin.
Options
Where to save the trace analysis results. Default:
<basename>_trace_results.log. Also reads from PDD_TRACE_OUTPUT_PATH.What it outputs
pdd trace prints the corresponding line number in the prompt file for the specified code line. The command also writes a results log (at --output) containing the full trace analysis.
When to use
Usepdd trace as part of the Traceability debugging workflow:
- Debugging prompt logic — When a code line is behaving unexpectedly and you want to locate the prompt instruction that drove that behavior.
- Code review — To understand which requirement or specification produced a particular implementation.
- Root cause analysis — To identify which part of a prompt to modify when fixing a bug in the generated code.
Example
src/factorial_calculator.py back to its origin in factorial_calculator_python.prompt and saves the full analysis to trace_results.log.
Bidirectional traceability
PDD maintains traceability in both directions:- Prompt → Code:
pdd generateandpdd syncproduce code from prompts. - Code → Prompt:
pdd tracenavigates back from a code line to the prompt instruction that produced it.
Related commands
pdd bug— Usetraceto identify which prompt section contributed to a bug, thenbugto create a failing test for it.pdd update— After tracing a bug to a prompt line, useupdateto correct the prompt and propagate the fix.