pdd update is the Code-to-Prompt Update workflow. When code has been modified — manually or by another tool — pdd update reads those changes and rewrites the prompt to reflect them, preserving the PDD principle that prompts are the source of truth.
By default, pdd update uses an agentic AI (Claude Code, Gemini, or Codex) to produce compact, high-quality prompts. It falls back to a simpler two-stage LLM process when no agentic CLI is available.
Usage
Arguments
The code file that was modified, or the code file for which a prompt should be generated. Required in all single-file modes.
The existing prompt file to update. Required for update modes (B and C). Not used in generation mode (A) or repository-wide mode.
The original (pre-modification) code file. Required for manual update mode (C). Not used when
--git is set or in generation mode.Options
Use git history to find the original code file automatically, eliminating the need for
ORIGINAL_CODE_FILE. Requires the prompt file and the modified code file as arguments.Where to save the updated prompt file. If not specified, the original prompt file is overwritten in place to maintain it as the authoritative source of truth. Also reads from
PDD_UPDATE_OUTPUT_PATH.Use the legacy two-stage LLM update process instead of the default agentic mode. Faster, but requires no agentic CLI tools.
Comma-separated file extensions to process in repository-wide mode (e.g.,
py,js,ts). Cannot be used in single-file modes.Base branch for change detection in repository-wide mode. Cannot be used in single-file modes.
Agentic update (default)
The default agentic update runs a 4-step optimization:Assess differences
Read the prompt (including all
<include> files) and compare it against the modified code.Filter using guide and tests
Consult
docs/prompting_guide.md and existing tests to determine what content belongs in the prompt.claude(Anthropic Claude Code) withANTHROPIC_API_KEYgemini(Google Gemini CLI) withGOOGLE_API_KEYorGEMINI_API_KEYcodex(OpenAI Codex CLI) withOPENAI_API_KEY
pdd update automatically falls back to the legacy simple mode.
Modes
- Repository-wide (no args)
- A: Generate / regenerate
- B: Git-based update
- C: Manual update
Scans the entire repository, finds all code/prompt pairs, creates any missing prompt files, and updates all of them based on the latest git changes. The easiest way to keep the entire project in sync.
Examples
Related commands
pdd sync— Callspdd updateas the final step of its automated workflow.pdd generate— The reverse direction: generates code from a prompt.