Skip to content

Commit 34b5d35

Browse files
hua7450claude
andcommitted
Fix should-address issues in /encode-policy-v2
1. Pass --600dpi to document-collector and /review-program 2. Add "REUSE EXISTING VARIABLES" to parameter-architect, rules-engineer, and test-creator prompts 3. Clarify implementation-validator fixes directly (removed orphaned impl-validation.md write instruction) 4. Add explicit gap-fixer prompt template for Phase 3E 5. Add "LEARN FROM PAST SESSIONS" to implementation-validator Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 760fca4 commit 34b5d35

File tree

1 file changed

+56
-6
lines changed

1 file changed

+56
-6
lines changed

commands/encode-policy-v2.md

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ run_in_background: true
8585
"Research {STATE} {PROGRAM} and gather all official documentation.
8686
- Discover the state's official program name
8787
- Download and extract PDFs with curl + pdftotext
88+
- Render PDF screenshots at {DPI} DPI: pdftoppm -png -r {DPI} /tmp/doc.pdf /tmp/doc-page
8889
- Save all documentation to sources/working_references.md
8990
- Write SHORT research summary (max 20 lines) to /tmp/{PREFIX}-research-summary.md:
9091
- Official program name
@@ -244,6 +245,12 @@ LEARN FROM PAST SESSIONS (read if they exist — skip if not found):
244245
- {LESSONS_PATH}
245246
- lessons/agent-lessons.md
246247
248+
REUSE EXISTING VARIABLES AND PARAMETERS:
249+
PolicyEngine-US has hundreds of existing variables for common concepts (fpg, smi,
250+
tanf_fpg, is_tanf_enrolled, ssi, tanf_gross_earned_income, snap_gross_income, etc.).
251+
Before creating ANY non-program-specific parameter or variable, Grep the codebase to
252+
check if it already exists. Only create new ones for state-program-specific concepts.
253+
247254
RULES:
248255
- Income source lists go in sources.yaml parameters, NOT inline adds
249256
- Follow patterns from the reference implementation
@@ -276,6 +283,12 @@ LEARN FROM PAST SESSIONS (read if they exist — skip if not found):
276283
- {LESSONS_PATH}
277284
- lessons/agent-lessons.md
278285
286+
REUSE EXISTING VARIABLES AND PARAMETERS:
287+
PolicyEngine-US has hundreds of existing variables for common concepts (fpg, smi,
288+
tanf_fpg, is_tanf_enrolled, ssi, tanf_gross_earned_income, snap_gross_income, etc.).
289+
Before creating ANY non-program-specific variable, Grep the codebase to check if it
290+
already exists. Only create new ones for state-program-specific concepts.
291+
279292
RULES:
280293
- Use the parameters created in Step 3A — read them from disk
281294
- Zero hard-coded values — reference parameters only
@@ -305,6 +318,10 @@ LEARN FROM PAST SESSIONS (read if they exist — skip if not found):
305318
- {LESSONS_PATH}
306319
- lessons/agent-lessons.md
307320
321+
REUSE EXISTING VARIABLES:
322+
PolicyEngine-US has hundreds of existing variables. Use only real, existing variables
323+
for test inputs. Grep the codebase to verify variable names before using them in tests.
324+
308325
RULES:
309326
- Create UNIT tests for each variable that will have a formula
310327
- Create INTEGRATION tests (5-7 scenarios) with inline calculation comments
@@ -397,7 +414,35 @@ Write /tmp/{PREFIX}-coverage-report.md (max 40 lines):
397414

398415
Read ONLY `/tmp/{PREFIX}-coverage-report.md` (max 40 lines).
399416

400-
**If missing requirements > 0**: Spawn a fix agent (rules-engineer) to implement the gaps before proceeding. Re-run the requirements-tracker after fixes.
417+
**If missing requirements > 0**: Spawn a gap-fixer to implement the missing requirements, then re-run the requirements-tracker:
418+
419+
```
420+
subagent_type: "complete:country-models:rules-engineer"
421+
team_name: "{PREFIX}-encode"
422+
name: "gap-fixer"
423+
424+
"Implement MISSING requirements for {STATE} {PROGRAM}.
425+
Read the coverage report at /tmp/{PREFIX}-coverage-report.md.
426+
Read the implementation spec at /tmp/{PREFIX}-impl-spec.md.
427+
Read the scope decision at /tmp/{PREFIX}-scope-decision.md.
428+
Study existing variables and parameters already created for this program.
429+
Load skills: /policyengine-variable-patterns, /policyengine-parameter-patterns,
430+
/policyengine-code-style, /policyengine-code-organization.
431+
432+
TASK: Implement ONLY the requirements listed under 'MISSING' in the coverage report.
433+
Do not modify existing variables or parameters — only add what's missing.
434+
435+
REUSE EXISTING VARIABLES: Before creating any non-program-specific variable, Grep the
436+
codebase first. PolicyEngine-US likely already has it.
437+
438+
LEARN FROM PAST SESSIONS (read if they exist — skip if not found):
439+
- {LESSONS_PATH}
440+
- lessons/agent-lessons.md
441+
442+
DO NOT commit — pr-pusher handles all commits."
443+
```
444+
445+
After gap-fixer completes, re-run the requirements-tracker (same prompt as above) to verify all gaps are filled. If gaps remain after one fix round, report to user and proceed.
401446

402447
---
403448

@@ -410,15 +455,18 @@ subagent_type: "complete:country-models:implementation-validator"
410455
team_name: "{PREFIX}-encode"
411456
name: "implementation-validator"
412457
413-
"Validate {STATE} {PROGRAM} implementation for PolicyEngine standards compliance.
458+
"Validate and fix {STATE} {PROGRAM} implementation for PolicyEngine standards compliance.
414459
Load skills: /policyengine-variable-patterns, /policyengine-parameter-patterns,
415460
/policyengine-code-style, /policyengine-period-patterns, /policyengine-vectorization,
416461
/policyengine-aggregation, /policyengine-review-patterns, /policyengine-code-organization.
417462
418-
Check: naming conventions, folder structure, parameter formatting, variable code style,
463+
LEARN FROM PAST SESSIONS (read if they exist — skip if not found):
464+
- {LESSONS_PATH}
465+
- lessons/agent-lessons.md
466+
467+
Check AND fix: naming conventions, folder structure, parameter formatting, variable code style,
419468
hard-coded values, adds vs add(), reference format, entity levels, period handling.
420-
Fix any issues found.
421-
Write findings to /tmp/{PREFIX}-impl-validation.md."
469+
Fix all issues directly — do not just report them."
422470
```
423471

424472
### Step 4B: CI Fixer
@@ -584,9 +632,11 @@ Invoke the `review-program` skill in local-only mode with `--full`:
584632

585633
```
586634
Skill: review-program
587-
Arguments: $PR_NUMBER --local --full
635+
Arguments: $PR_NUMBER --local --full [--600dpi if DPI == 600]
588636
```
589637

638+
If the user passed `--600dpi`, include it here so PDF audit uses high resolution.
639+
590640
### Step 6B: Check Results
591641

592642
Read `/tmp/review-program-summary.md` (max 20 lines).

0 commit comments

Comments
 (0)