Summary
Add human-in-the-loop apply for pdd checkup prompt <target>.
Users apply selected source-set improvements suggested by the unified prompt report, only with explicit human approval:
pdd checkup prompt csv_parser --interactive --apply
pdd checkup prompt csv_parser --interactive --apply --dry-run
Both --interactive and --apply are required in v1.
Part of epic #833. Depends on #1379 (unified report + actions[]).
Product goal
Keep users in prompt space longer. When PDD finds missing vocabulary, coverage, stories, or waivers, users should not manually copy-paste every fix. PDD proposes schema-aware edits; the human remains in control.
Authority model:
Deterministic report finds issues.
Optional explanation suggests actions (#1379 --explain).
Human approves selected actions.
Deterministic applicators edit prompt/story files.
Postflight re-runs checks.
LLM never writes files directly.
Focused commands (pdd checkup lint, pdd checkup contract check, …) remain unchanged for CI; postflight may call them or pdd checkup prompt <target> --strict on touched files.
Scope — writable files only
| Writable |
Not writable |
.prompt files |
generated src/ |
user_stories/story__*.md |
tests generated from code |
|
PDD implementation files |
|
arbitrary paths |
|
full-file LLM rewrites |
CLI rules
| Command |
Behavior |
pdd checkup prompt foo --interactive |
Preview / choices; no writes |
pdd checkup prompt foo --interactive --apply |
Apply approved patches |
pdd checkup prompt foo --apply |
Error (must pair with --interactive) |
non-TTY + --interactive |
Error |
| default patch answer |
No |
| deterministic errors |
Block apply unless --force-apply |
Patch kinds (v1)
Parse-aware only:
- add vocabulary definition
- create vocabulary section
- add coverage line
- append contract rule
- add waiver
- create story file from template
- append story
## Covers
No arbitrary unified-diff application in v1.
Safety
- Atomic writes
- Backup:
.pdd/evidence/checkups/backups/<run_id>/
- Apply log:
.pdd/evidence/checkups/apply-<run_id>.json
- Postflight:
pdd checkup contract check or pdd checkup prompt <target> --strict on touched files
- On failure: show restore / backup path
Example UX
Issue 1 of 3: The term "valid row" is not defined.
Suggested patch:
Add to <vocabulary>:
- Valid row: a CSV row with the expected number of columns and parseable field values.
Apply this change? [y/N/e/s]
Modules (suggested)
pdd/checkup_apply.py — deterministic patch applicators
- Wire into
checkup_prompt_main.py from #1379
- Reuse
contract_ir.py section boundaries
Non-goals
- No non-interactive auto-apply.
- No apply-by-confidence.
- No writes to generated code (#1371 territory).
- No arbitrary LLM patch application.
- No CI apply mode.
- No capability policy code-file changes.
Acceptance criteria
Summary
Add human-in-the-loop apply for
pdd checkup prompt <target>.Users apply selected source-set improvements suggested by the unified prompt report, only with explicit human approval:
Both
--interactiveand--applyare required in v1.Part of epic #833. Depends on #1379 (unified report +
actions[]).Product goal
Keep users in prompt space longer. When PDD finds missing vocabulary, coverage, stories, or waivers, users should not manually copy-paste every fix. PDD proposes schema-aware edits; the human remains in control.
Authority model:
Focused commands (
pdd checkup lint,pdd checkup contract check, …) remain unchanged for CI; postflight may call them orpdd checkup prompt <target> --stricton touched files.Scope — writable files only
.promptfilessrc/user_stories/story__*.mdCLI rules
pdd checkup prompt foo --interactivepdd checkup prompt foo --interactive --applypdd checkup prompt foo --apply--interactive)--interactive--force-applyPatch kinds (v1)
Parse-aware only:
## CoversNo arbitrary unified-diff application in v1.
Safety
.pdd/evidence/checkups/backups/<run_id>/.pdd/evidence/checkups/apply-<run_id>.jsonpdd checkup contract checkorpdd checkup prompt <target> --stricton touched filesExample UX
Modules (suggested)
pdd/checkup_apply.py— deterministic patch applicatorscheckup_prompt_main.pyfrom #1379contract_ir.pysection boundariesNon-goals
Acceptance criteria
--applywithout--interactivereturns a clear error.--dry-runleaves bytes unchanged.pdd checkup lint/contract check/ … still work unchanged.