GPT Review — P10B-1B D32 Package Generation Prompt v0.2
GPT Review — P10B-1B D32 Package Generation Prompt v0.2
Date: 2026-04-29
Verdict
Much improved, but patch before dispatch.
v0.2 fixes the main hardcode issue with candidate-units.json, adaptive collision, trigger join, and role verification. However, there are still gaps that could make Agent guess body content or omit required vocab checks during SQL package generation.
Accepted
- Splitting package generation from execution.
- Read-only scope.
- Candidate JSON requirement.
- Anti-hardcode rule distinguishing generation logic from generated SQL data.
- Schema-adaptive collision direction.
- Trigger query via
pg_trigger JOIN pg_proc. - Role verification instead of role assertion.
Required final patches
P1 — candidate-units.json must include exact body or body_source_span
Current JSON example contains metadata but not body text. Insert SQL needs the full unit body. Without a formal body source, Agent may copy/paste or hardcode bodies.
Patch:
candidate-units.jsonmust include for each unit:canonical_addressparentsection_typesort_ordertitlebodybody_sha256word_countsource_markersource_spanif available
- Body must be extracted from source and SHA-verified against P10B-1A-HASH.
- If body cannot be reproduced from source + evidence, STOP.
P2 — load both segmentation and hash reports, not only hash report
The hash evidence report alone may not contain the complete accepted segmentation context. Agent should load both:
p10b-1a-d32-segmentation-candidate-2026-04-29.mdor the accepted v1.1 artifact if uploaded;p10b-1a-d32-hash-vocab-evidence-2026-04-29.md.
Then merge:
- structure/title/parent/sort/section_type from segmentation;
- body hash/word_count/body coverage from HASH evidence.
If either report is missing required fields, STOP and report missing fields instead of reconstructing from memory.
P3 — verify all non-section vocab needed by insert
The prompt checks section types, but insert needs more codes. Agent must query production vocab/config for:
tac_publication_type_vocab:lawtac_pub_lifecycle_vocab: mutable publication lifecycle used in package, likelyproposedtac_lu_lifecycle_vocab: mutable LU lifecycle used, likelydraft_onlytac_uv_lifecycle_vocab: mutable UV lifecycle used, likelydrafttac_review_state_vocab: review state used, likelyunreviewedtac_section_type_vocab: all 8 section types from candidate
Do not assume names from P10A. If any code missing/inactive, STOP.
P4 — collision should prefer exact business keys
Patch collision guidance:
- If
doc_codeandversioncolumns exist ontac_publication, use exact:doc_code='DIEU-32' AND version='v1.1'. - If only
doc_codeexists, use exact doc_code but report weaker key. - If
canonical_addressexists on LU, checkcanonical_address LIKE 'D38-DIEU32-%'. - Do not use
slugunless discovered and documented as actual column. - If no safe key found, STOP.
P5 — hardcode audit needs broader logic check
The current grep is useful but too narrow. Add:
- inspect helper scripts for arrays/lists of unit identifiers;
- any array with multiple
DIEU32,S2,S3,P1-style values in generation logic is suspicious; - allow values only inside
candidate-units.jsonand generated SQL/data artifacts; - report script paths inspected and audit method.
P6 — generated SQL package should be created from a generator script that is retained as evidence
Because the risk is in generation logic, the generator script should be included in the report or hashed:
- generator script path;
- generator script SHA256;
- hardcode audit result on that script;
- statement that SQL was generated by iterating
candidate-units.json.
Do not rely on manual SQL editing.
Directive to Opus 4.6
Patch P10B-1B prompt v0.2 → v0.3 with P1–P6 above.
After patch, if no new scope is added:
- mark
GPT AUTHORIZED — execute immediately; - dispatch Agent for read-only package generation;
- Agent uploads package report and stops.
Do not authorize execution/insert yet.
Status
- P10B-1A: PASS.
- P10B-1A-HASH: PASS.
- P10B-1B v0.2: needs final patch.
- Next: Opus patch to v0.3, then Agent read-only package generation.