Agent Prompt — Phase 5C2 DIEU-32 Retry with synthesize_title Policy — 2026-05-14
Agent Prompt — Phase 5C2 DIEU-32 Retry with synthesize_title Policy — 2026-05-14
Mission
Retry DIEU-32 TAC→Information Unit migration only, using approved POLICY_SYNTHESIZE_TITLE_FOR_HEADING_NULL_BODY and conditional V-3b'.
Authorization
Read first:
- GPT policy approval:
knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-dieu32-root-cause-approve-synthesize-title-retry-2026-05-14.md - Root-cause investigation:
knowledge/dev/laws/dieu44-trien-khai/reports/dieu32-null-heading-body-root-cause-investigation-report.md - Prior DIEU-32 block report:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r2-dieu32-pilot-migration-execution-report.md - Consolidated R1/R2 report:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r1-r2-consolidated-status-report.md
Authorization flags:
USER_GO=YES
GPT_FINAL_APPROVAL=YES
DIEU32_SYNTHESIZE_TITLE_POLICY_APPROVED=YES
DIEU32_RETRY_AUTHORIZED=YES
Scope
DIEU-32 only.
Expected current live source count: 23 rows. If live source count, canonical address set, or NULL-body set changed from the investigation, STOP before BEGIN and report SOURCE_DRIFT_REQUIRES_GPT_REVIEW.
Approved synthesize rows must be exactly:
D38-DIEU32-ROOT
D38-DIEU32-S2
D38-DIEU32-S3
D38-DIEU32-S4
All must satisfy:
section_type='heading'
body IS NULL
children > 0
Hard boundaries
Forbidden:
No DDL.
No schema changes.
No trigger/function changes.
No birth-system changes.
No direct INSERT into information_unit or unit_version.
No TAC writes.
No UI cutover.
No Nuxt/Directus/config changes.
No vector/Qdrant mutation or reindex.
No event_outbox/IU event emission work.
No publications beyond DIEU-32.
No touching existing 75 IU rows.
No pattern-matching deletes.
No automatic content repair beyond approved heading-title synthesis.
Allowed:
Use fn_iu_create canonical writer.
Patch identity_profile/content_profile/provenance only for newly captured DIEU-32 rows using allowed marker fn_iu_apply_edit_draft.
Create birth rows via existing trg_birth_information_unit only.
Write rollback-key artifacts to KB + VPS logs before COMMIT.
Exact-key rollback only if needed.
Approved body preparation rule
For each source row:
IF section_type='heading' AND body IS NULL AND children>0 THEN
iu_body := title
body_source := 'synthesized_from_title_due_to_tac_heading_null_body'
src_body_was_null := true
ELSE
iu_body := body
body_source := 'preserved_from_tac_unit_version_body'
src_body_was_null := false
ENDIF
If any non-heading row has body NULL, STOP before BEGIN.
If any heading row with body NULL has children=0, STOP before BEGIN unless it is explicitly reviewed later.
Required preflight
Run live SELECT-only preflight:
- TAC tables exist.
- DIEU-32 publication exists.
- source_count=23.
- render_order contiguous 0..22.
- owner NULL count = 0.
- collisions with existing
information_unit.canonical_address= 0. - body NULL count = 4 and all are approved synthesize rows.
- required vocab keys exist.
fn_iu_createsignature exists.- gateway mode enforced.
- allowed markers include
fn_iu_createandfn_iu_apply_edit_draft. - edit policy require_review.
- birth trigger exists.
- species primary mapping exists.
- pre-existing IU rows captured; expected 75 if live state unchanged.
- TAC table pre-counts captured.
If any hard preflight fails, STOP before BEGIN.
Transaction execution
Open one transaction.
For each of 23 source rows ordered by render_order:
- Prepare
iu_bodyusing the approved body preparation rule. - Call
fn_iu_createonly:
SELECT public.fn_iu_create(
p_canonical_address := :src_canonical_address,
p_title := :src_title,
p_body := :iu_body,
p_actor := 'agent:p3d-phase5c2-dieu32-retry',
p_unit_kind := 'law_unit',
p_section_type := :src_section_type,
p_owner_ref := :src_owner,
p_publication_type := 'law',
p_parent_ref := NULL
);
- Capture returned IU id, UV id, status, warnings.
- Patch only captured IU row with identity_profile, including:
{
"body_source": "<body_source>",
"tac_provenance": { ... },
"tac_hierarchy": { ... },
"publication_authority_ref": "incomex_council",
"publication_authority_vocab_key": "vocab.publication_authority.incomex_council",
"rendering": { ... }
}
- Patch only captured UV row with content_profile/provenance, including:
{
"body_source": "<body_source>",
"src_body_was_null": true|false,
"src_title": "<source title>",
"src_content_hash": "<tac_unit_version.content_hash>",
"source_kind": "tac_unit_version",
"src_unit_version_id": "<uuid>",
"migrated_by": "agent:p3d-phase5c2-dieu32-retry",
"migrated_at": "<utc>"
}
Use allowed marker fn_iu_apply_edit_draft for profile/provenance updates.
Rollback key dual-write before COMMIT
Before COMMIT, write exact rollback keys to both:
KB:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-dieu32-rollback-keys-<utc>.md
VPS log:
/opt/incomex/logs/p3d-phase5c2-dieu32-<utc>.log
If either write fails, rollback.
Validation before COMMIT
Run V-1..V-7:
- V-1: captured IU/UV/source count = 23.
- V-2: render order fidelity 0..22.
- V-3a: IU-side hash consistency.
- V-3b': conditional body policy:
- preserved rows:
unit_version.body = tac_unit_version.body. - synthesized rows:
unit_version.body = tac_logical_unit.title,section_type='heading',source body IS NULL,children>0, body_source flags present,src_body_was_null=true.
- preserved rows:
- V-3c: TAC hash provenance preserved in content_profile.src_content_hash.
- V-3d: cross-system hash equality report-only, not gate.
- V-4: authority incomex_council.
- V-5: birth coverage for 23 captured IU rows.
- V-6: TAC source untouched.
- V-7:
fn_iu_verify_invariantsPASS for captured rows.
If any required validation fails, rollback.
Post-COMMIT validation
After COMMIT:
- gateway triggers attached and marker not leaked.
- pre-existing 75 IU rows untouched.
- rollback keys exist in KB + VPS log.
- final IU count = pre + 23.
- final UV count = pre + 23.
- final birth IU count = pre + 23.
- TAC table counts unchanged.
- UI/vector/bulk flags false.
If post-COMMIT validation fails, exact-key rollback for DIEU-32 only.
Required reports
- Execution report:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r2-dieu32-retry-synthesize-title-execution-report.md
- Rollback keys report if key-capture reached:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-dieu32-rollback-keys-<utc>.md
- Updated 86-unit completion report if PASS:
knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-86-units-completion-report.md
Required final response fields
dieu32_retry_status=PASS|FAILED_ROLLED_BACK|BLOCKED_BEFORE_BEGIN|FAILED_POST_COMMIT_ROLLBACK_FAILED
synthesize_title_policy_used=true|false
source_count_live=<N>
created_iu_count=<N>
created_uv_count=<N>
created_birth_count=<N>
synthesized_rows_count=<N>
preserved_rows_count=<N>
synthesized_rows=[D38-DIEU32-ROOT,D38-DIEU32-S2,D38-DIEU32-S3,D38-DIEU32-S4]
pre_existing_iu_untouched=true|false|unknown
tac_source_untouched=true|false|unknown
v3b_conditional_policy_pass=true|false|unknown
birth_coverage_pass=true|false|unknown
gateway_integrity_pass=true|false|unknown
ui_cutover_performed=false
vector_work_performed=false
bulk_migration_performed=false
rollback_keys_report_path=<path or none>
execution_report_path=knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r2-dieu32-retry-synthesize-title-execution-report.md
completion_report_path=knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-86-units-completion-report.md
next_recommended_action=GPT_REVIEW_DIEU32_RETRY_THEN_START_DOT_IU_CUTTER_DESIGN
Strategic note
In the report, include a section:
Policy extracted for dot-iu-cutter v0.1
Explain how this heading-container policy should be implemented in the automated cutter so future Cắt luật A flows do not rediscover this issue.