GPT Directive to Opus — Patch Pack1 Phase4 DRAFT v6 G3/G7 Planner Contract
GPT Directive to Opus — Patch P3D Pack 1 Phase 4 DRAFT v6: G3/G7 Planner Contract Only
Date: 2026-05-11 Issuer: GPT-5.5 Thinking / Incomex Hội đồng AI Receiver: Opus 4.6/4.7 Mode: PATCH DRAFT PROMPT ONLY — no execution
0. Current state
The approved v5 prompt was dispatched. Agent executed correctly. G1–G6 passed. G7 failed because the prompt called a non-existent fn_iu_create_plan signature. Transaction rolled back cleanly; no vocab rows were committed.
The v5 architecture is mostly validated. Only G3/G7 planner-contract handling must be patched.
1. Read first
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-pack1-phase4-vocab-species-seed-implementation-report.md
knowledge/dev/laws/dieu44-trien-khai/reviews/opus-post-dispatch-review-p3d-pack1-phase4-v5-rolled-back-g7-2026-05-11.md
knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-p3d-pack1-phase4-v5-rolled-back-g7-and-v6-directive-2026-05-11.md
knowledge/dev/laws/dieu44-trien-khai/prompts/p3d-pack1-phase4-governance-vocab-species-prep-implementation-prompt-DRAFT.md
2. Target outputs
Patch prompt in place to DRAFT v6:
knowledge/dev/laws/dieu44-trien-khai/prompts/p3d-pack1-phase4-governance-vocab-species-prep-implementation-prompt-DRAFT.md
Create patch report:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-pack1-phase4-implementation-draft-v6-patch-report.md
3. Scope
Patch only G3 and G7 plus header/status/report wording needed to reflect v6.
Do not restructure the prompt. Do not weaken any no-hardcode safeguard. Do not change delta logic, insert logic, rollback model, or species/hash scope unless necessary to reference G7.
4. Mandatory G3 changes
G3 must verify function contract before seed preparation proceeds.
It must fail before delta/insert if fn_iu_create_plan contract is incompatible.
Minimum checks:
- function exists in
public; - return type is
jsonb; - input args include the production-compatible nine-arg contract:
p_canonical_address text
p_title text
p_body text
p_actor text
p_unit_kind text
p_section_type text
p_owner_ref text
p_publication_type text
p_parent_ref uuid
Implementation can use pg_proc, pg_type, pg_get_function_identity_arguments, proargnames, proallargtypes/proargtypes as appropriate.
If exact verification is too difficult, use a safe equivalent gate:
- call a read-only planner probe inside the transaction with all nine named args before insert;
- assert it returns a JSONB object with expected keys;
- if not, RAISE EXCEPTION before any insert.
But do not rely on the old 4-arg call.
5. Mandatory G7 changes
G7 must call production function using named args:
public.fn_iu_create_plan(
p_canonical_address := 'planner-probe/p3d-phase4-v6-' || current_setting('p3d.run_marker'),
p_title := 'Phase 4 v6 planner probe',
p_body := 'Probe body',
p_actor := current_setting('p3d.run_marker'),
p_unit_kind := 'law_unit',
p_section_type := <live registered section_type value>,
p_owner_ref := NULL,
p_publication_type := <live registered publication_type value or NULL if safe>,
p_parent_ref := NULL::uuid
)
Do not hardcode a section type if a live registered value can be selected from dot_config.
Recommended live selection:
SELECT value INTO v_section_type
FROM public.dot_config
WHERE key LIKE 'vocab.section_type.%'
ORDER BY key
LIMIT 1;
For publication type, use live value if needed:
SELECT value INTO v_publication_type
FROM public.dot_config
WHERE key LIKE 'vocab.publication_type.%'
ORDER BY key
LIMIT 1;
If the planner can safely accept NULL publication type and auto-resolve, that is acceptable only if the JSONB result proves status is not unresolved.
G7 must:
- store result in
v_plan jsonb; - verify
jsonb_typeof(v_plan) = 'object'; - verify required keys exist before reading them, at minimum
statusandresolved_unit_kind; - fail if
v_plan ->> 'status' ILIKE '%unresolved_vocab%'; - fail if
v_plan ->> 'resolved_unit_kind' IS DISTINCT FROM 'law_unit'; - print a
G7_PASSnotice including status/resolved kind.
6. Hard boundaries
- No agent run.
- No seed execution.
- No migration.
- No DDL.
- No function/trigger patch.
- No species INSERT.
- No Directus/Nuxt/Qdrant.
- No collection promotion.
- No edge materialization.
- No hardcoded seed list.
7. Patch report requirements
Report must include:
phase4_draft_v6_status=PATCHED
patched_scope=G3_G7_ONLY
v5_run_status=ROLLED_BACK_ACCEPTED
g3_contract_gate_updated=true
g7_jsonb_planner_probe_updated=true
no_delta_logic_changed=true
no_insert_logic_changed=true
no_species_execution_added=true
no_migration_added=true
requires_GPT_User_review_before_dispatch=true
Also include top 5 exact changes.
8. Final response expected from Opus
Return only:
- DRAFT v6 prompt path.
- Patch report path.
- Top 5 changes from v5.
- Confirmation that only G3/G7 were materially changed.
- Confirmation GPT/User review is required before dispatch.
9. Status
v5_run=ROLLED_BACK_ACCEPTED
v6_patch_allowed=true
agent_dispatch_allowed=false
seed_execution_allowed=false
migration_allowed=false