GPT Review — Runtime Execution Prompt for Description Policy Option 1
GPT Review — Runtime Execution Prompt for Description Policy Option 1
Date: 2026-05-04 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed: Opus draft prompt "Description Policy Option 1 — Runtime Execution"
Verdict
Prompt is close, but requires 4 small hardening patches before dispatch.
The prompt correctly separates runtime DB work from KB/H11 doc patching, preserves Pack 2B hard stop, and includes preflight/DDL/seed/function/verify/report phases.
However, because this runtime prompt includes DDL and function replacement, it needs additional execution-safety controls before Claude Code is allowed to run it.
Required patches before dispatch
P1 — Wrap Phase 1–3 in explicit transaction where possible
Use a transaction for DDL + seed + function replace:
BEGIN;
-- DDL
-- seed
-- CREATE OR REPLACE FUNCTION
-- verification queries that can run inside transaction
COMMIT;
If any error before COMMIT → ROLLBACK.
If Directus auto-detect behavior requires commit before visibility, state that clearly:
- commit only after PG + fn checks pass;
- Directus visibility check may happen after commit;
- if Directus absent after commit, STOP and report; do not continue to any further mutation.
P2 — Do not allow Agent to synthesize function blindly
Current prompt says "take function source and add 3 changes". That is still risky.
Add:
- Agent must print full new
CREATE OR REPLACE FUNCTIONbefore running. - Agent must compare old vs new and state that only these allowed tokens/blocks changed:
_desc_policy TEXT;SELECT governance_role, description_policy ...- structured_exempt early return;
- unclassified warning.
- If the source shape is not straightforward or the diff touches other logic → STOP and report.
P3 — Phase 0j schema tool check must inspect more broadly
Current query only checks DOT-SCHEMA-MIGRATE% and DOT-COLLECTION-ALTER%. Expand to include schema/apply/pg migration conventions:
SELECT code, name, status, operation, file_path
FROM dot_tools
WHERE code ILIKE '%SCHEMA%'
OR code ILIKE '%MIGR%'
OR code ILIKE '%ALTER%'
OR name ILIKE '%schema%'
OR name ILIKE '%migration%'
OR name ILIKE '%alter%'
ORDER BY code;
If a relevant tool exists and appears intended for schema mutation → STOP and report for GPT/User decision unless file 15 explicitly authorizes it.
P4 — Report must include rollback status and exact mutation list
Report must include:
- exact DDL run;
- exact UPDATE counts for Tier A and Tier B;
- whether function changed and validation result;
- whether transaction committed or rolled back;
- rollback instructions actually available from captured function source;
- final state summary.
Non-blocking note
The prompt currently says Directus field auto-detect may be checked immediately after DDL. Depending runtime behavior, Directus metadata may not auto-populate immediately. This is acceptable if the prompt treats absence as STOP/report, not as a reason to manually insert metadata.
Directive to Opus/Ocus
Patch the draft prompt with P1–P4 only. Do not change the design scope. Do not dispatch before GPT/User sees final prompt.
After patched prompt is approved, it can be dispatched to Claude Code Agent for runtime execution.
Hard boundaries remain:
- no H11 KB patch;
- no law/docs patch;
- no Pack 2B;
- no IU rows;
- no entity_enrichment deployment;
- no manual
directus_fieldsinsert; - hard stop after report.