Skip to content

feat: add lean PDD prompt mode research harness (#1473)#1479

Open
prompt-driven-github[bot] wants to merge 2 commits into
mainfrom
change/issue-1473
Open

feat: add lean PDD prompt mode research harness (#1473)#1479
prompt-driven-github[bot] wants to merge 2 commits into
mainfrom
change/issue-1473

Conversation

@prompt-driven-github

Copy link
Copy Markdown
Contributor

Summary

Adds a publishable research harness (research/lean-prompt-mode/) that measures and reduces PDD prompt token overhead through deterministic section-level pruning, while preserving all required source-truth, output, verifier, delimiter, and safety contract fields. Emits auditable prompt_policy.json and prompt_token_audit.json artifacts on every lean run.

Closes #1473

Changes Made

New Research Harness Files

  • research/lean-prompt-mode/lean_prompt.py — main pruner with --mode {current,lean} parameter; emits both audit artifacts; uses litellm/tiktoken for token counting
  • research/lean-prompt-mode/README.md — design document, usage guide, fixture format, CI integration notes
  • research/lean-prompt-mode/fixtures/current_prompt.txt — frozen golden PDD prompt in current (unmodified) form
  • research/lean-prompt-mode/fixtures/lean_prompt.txt — expected lean-pruner output on the golden fixture
  • research/lean-prompt-mode/fixtures/prompt_policy.json — expected prompt_policy.json for the golden fixture
  • research/lean-prompt-mode/fixtures/prompt_token_audit.json — expected prompt_token_audit.json for the golden fixture
  • research/lean-prompt-mode/schemas/prompt_policy.schema.json — JSON Schema v1 for prompt_policy.json
  • research/lean-prompt-mode/schemas/prompt_token_audit.schema.json — JSON Schema v1 for prompt_token_audit.json
  • research/lean-prompt-mode/tests/test_lean_prompt.py — unit tests: pruning rules, invariant preservation, schema validation, default-mode regression, anomaly detection

Documentation Updated

  • docs/prompting_guide.md — new ## Lean Prompt Mode section added after ## Automated Context Compression, covering pruning rules, audit artifacts, structural floor, relationship to context compression, and default behavior
  • README.md — new ### Lean Prompt Mode Research Harness subsection under ## Utilities after ### Regenerate Model Catalog

Review Checklist

  • Prompt syntax is valid
  • PDD conventions followed
  • Documentation is up to date
  • lean_prompt.py preserves all five required field groups (source-truth content, output files, verifier command, output delimiters, safety constraints)
  • prompt_policy.json and prompt_token_audit.json schema versions are "1.0"
  • Default mode (--mode current) leaves prompts unchanged
  • Tests pass: pytest research/lean-prompt-mode/tests/

Next Steps After Merge

  1. No modules to sync (research harness is additive; no PDD-managed .prompt files modified)
  2. Run tests to verify:
    pytest research/lean-prompt-mode/tests/ -vv
  3. Try the harness on a real prompt:
    python research/lean-prompt-mode/lean_prompt.py --mode lean prompts/your_module.prompt

Created by pdd change workflow

pdd-bot and others added 2 commits June 8, 2026 00:04
Implements a deterministic section-level pruner under research/lean-prompt-mode/
that reduces prompt token overhead while preserving the five required field groups
(source-truth content, output files, verifier, output delimiters, safety constraints).
Emits prompt_policy.json and prompt_token_audit.json audit artifacts per run.
Adds documentation in README.md and docs/prompting_guide.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix minor issues in lean_prompt.py, README, prompt_policy.json fixture,
and prompt_token_audit.schema.json identified during review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

research: add lean PDD prompt mode with token audit

1 participant