GPT Handoff — Opus New Session DOT-119 Repair
GPT Handoff — Opus New Session DOT-119 Repair
Date: 2026-05-05 Author: GPT-5.5 Thinking / Incomex Hội đồng AI Purpose: Handoff for a new Opus session so it can resume DOT-119 repair work without rediscovering the whole history.
0. Current strategic state
We are working on IU-0 / Information Unit so that “miếng thông tin” can become usable and later support Đ38/TAC.
We paused IU Pack 2B because we discovered the existing birth-trigger tool DOT-119 is stale and potentially dangerous. Per Điều 20, we are fixing the tool design before continuing.
1. Roadmap from here
DONE
- IU-0 Pack 1 DB foundation: DONE/PASS.
- Pack 2A governance registration: DONE/PASS.
- Description Policy runtime: DONE/RATIFIED WITH TDs.
- Existing birth-code investigation: DONE/PASS.
- Misleading docs cleaned:
- file 16 superseded;
- file 17 superseded;
- file 16b rev2 corrected assumptions.
- 18a DOT-119 redesign: rev4 FINAL / DESIGN PASS.
NOW
- Review and harden 18b DOT-119 repair execution pack.
NEXT AFTER 18b PASS
- Dispatch Claude Code to execute 18b: DDL metadata + seed + DOT-119 script rewrite + HC.
- Review 18b runtime report.
- Create/execute 18c: use repaired DOT-119 to install
trg_birth_information_unit. - Only then resume IU Pack 2B CRUD pilot.
2. Key reason for the pause
Agent investigation proved the birth system already solved “collections without code” at scale.
Important findings:
- Current installed
fn_birth_registry_autois v2 and has synthetic fallback. - Dominant precedent is
table::uuidsynthetic entity_code (~70k rows). - DOT-119 script on disk is stale v1 and may clobber the installed v2 function if run.
- Therefore DOT-119 must be repaired before using it for IU.
3. Legal/jurisdiction principle
DOT-119 is under Đ4 — Birth Process Law because it performs birth-trigger setup.
But DOT-119 repair touches multiple laws:
- Đ4: birth semantics and strategy.
- Đ35: DOT lifecycle/tool governance.
- Đ36 / collection protocol: collection_registry schema fields.
- Đ20 / NT15: design-before-execution, cost/roundtrip discipline.
- Đ43: context graph / metadata discoverability.
Each specialty must follow its governing law. Do not treat this as a free-form script edit.
4. Files to read first, in order
Read these exact files before doing anything:
knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-handoff-opus-new-session-dot119-repair-2026-05-05.mdknowledge/dev/laws/dieu44-trien-khai/design/18a-dot119-metadata-driven-no-clobber-redesign.mdknowledge/dev/laws/dieu44-trien-khai/design/18b-dot119-repair-execution-pack.mdknowledge/dev/laws/dieu44-trien-khai/reports/existing-birth-code-column-patterns-report.mdknowledge/current-state/reports/s145-m2-dot119-birth-triggers-reportknowledge/dev/laws/dieu44-trien-khai/reviews/gpt-roadmap-pause-iu-fix-dot119-first-2026-05-05.mdknowledge/ops/processes/birth-process-v1.mdknowledge/dev/laws/law-04-birth-process.mdknowledge/dev/laws/dieu20-thiet-ke-truoc-trien-khai.mdknowledge/dev/laws/dieu44-trien-khai/design/16b-iu0-existing-birth-pipeline-adaptation.md
Optional but useful:
knowledge/dev/laws/dieu44-trien-khai/design/16-iu0-pack2b-f6-birth-path-design.md— superseded; read only to understand why not to follow it.knowledge/dev/laws/dieu44-trien-khai/design/17-iu0-pack2b-option-b-persisted-pilot-execution-pack.md— superseded; read only to understand why not to follow it.
5. Current accepted design decisions from 18a rev4
- Metadata endpoint:
collection_registry. - Minimum fields: 3 fields:
birth_code_strategybirth_code_columnbirth_identity_source
- Default strategy:
unclassified, notsynthetic_id. - DOT-119 must require explicit mode:
--dry-run--execute--verify- optional admin
--drop
- DOT-119 must support
--jsonoutput. - DOT-119 must not embed or replace
fn_birth_registry_auto. - DOT-119 must be no-clobber: function hash before/after must not change.
- DOT-119 emits JSON findings, but does not raw INSERT
system_issues. H-BIRTH-IDENTITY-UNCLASSIFIEDhealth check/report path aggregates unclassified metadata.- Execution split:
- 18b: metadata fields + seed + DOT-119 repair + HC.
- 18c: IU trigger setup via repaired DOT-119.
6. Review status of 18b rev1
18b rev1 exists and is a good first execution-design draft, but GPT has not approved it for dispatch yet.
Main likely issues to review/patch before execution:
- 18b contains raw DDL / raw UPDATE / script rewrite / HC insert. It must specify legal tool/path and STOP conditions for each write channel.
- Phase 2 says “wait for review if confidence != high” but a Claude Code run cannot pause mid-run for external review unless the prompt/report is explicitly split. Consider splitting seed-mapping preflight into a separate read-only phase or require HARD STOP before Phase 3 if any uncertainty exists.
- Phase 3 has placeholders like “Agent fill from Phase 2 mapping”. Execution prompt must be exact or require the agent to print exact SQL and STOP for GPT/User review before running.
- Phase 5 HC registration uses raw
INSERT INTO system_health_checks. Need legal/tooling preflight and maybe a KB query doc creation path. Do not let agent invent a raw insert path if a DOT/health-check registration tool exists. - Rollback uses wildcard backup restore; should require exact backup path captured in report.
- Directus metadata for 3 new fields should likely be TD/verify only; no manual
directus_fieldsinsert. - Script rewrite must include machine-readable JSON schema and exit-code tests; do not accept pseudocode.
- Function hash mismatch after COMMIT cannot roll back trigger/script automatically; report as critical and stop.
7. Immediate task for new Opus session
Do not execute. Do not dispatch Claude Code.
Task: review 18b rev1 and patch it to rev2 so that it is safe as an execution-pack draft.
Expected output:
knowledge/dev/laws/dieu44-trien-khai/design/18b-dot119-repair-execution-pack.md rev2
Rev2 should be an execution design only, not a runtime prompt.
8. Requirements for 18b rev2
Patch 18b with these concrete improvements:
-
Add a Channel/Authority Matrix:
- DDL on
collection_registry: Đ36/schema path; exact approval required. - Metadata seed updates: Đ36/registry metadata path; no raw UPDATE unless approved by this execution pack.
- DOT-119 script rewrite: Đ35 DOT governance path.
- HC registration / KB query doc: Đ43/health-check path; inspect tool/path first.
- Đ4 controls birth strategy semantics.
- DDL on
-
Split execution into safer gates:
- 18b-P0: read-only seed-mapping preflight and script inspection.
- 18b-P1: DDL + metadata seed only after mapping is deterministic.
- 18b-P2: script rewrite and smoke tests.
- 18b-P3: HC registration, possibly separate if tooling unclear.
-
Remove vague placeholders from SQL execution:
- No “Agent fill …” inside SQL that could execute.
- Require agent to produce full mapping table and exact generated seed SQL.
- If any row is medium/low confidence, HARD STOP after report; no seed.
-
Strengthen DDL phase:
- inspect schema/migration tools before raw ALTER;
- print exact DDL;
- run in transaction;
- verify columns;
- function hash unchanged;
- Directus field visibility verify/TD only.
-
Strengthen seed phase:
- exact mapping table;
- exact update counts;
- update only high-confidence rows;
unclassifiedremains default;- all manual classifications (
information_unit,unit_version) explicitly listed.
-
Strengthen DOT-119 rewrite:
- backup exact path;
- write new script atomically using temp file + chmod + move;
- run syntax check if bash;
- grep/assert no
CREATE OR REPLACE FUNCTION fn_birth_registry_auto; - run
--help,--dry-run --json,--verify --jsontests; - capture function hash before/after.
-
HC registration:
- first inspect
system_health_checksschema and any DOT/health registration tool; - create KB query doc only through Agent Data/authorized KB path, not VPS raw file write unless approved;
- if legal path unclear, mark HC as follow-up and do not block DOT-119 repair.
- first inspect
-
Rollback:
- exact backup path;
- exact restore command;
- if DDL committed and script rewrite fails, state whether to keep metadata columns or rollback/drop them;
- do not claim rollback can undo function changes unless hash proves unchanged.
-
Report requirements:
- preflight outputs;
- mapping table;
- exact DDL;
- seed SQL + counts;
- script diff summary/hash;
- smoke outputs;
- function hash trail;
- birth trigger count and birth_registry count before/after;
- HC status;
- TDs/follow-ups.
-
Keep hard boundaries:
- no runtime execution from Opus;
- no Claude Code dispatch yet;
- no IU trigger;
- no IU rows;
- no Pack 2B;
- no function edits.
9. After 18b rev2
Opus stops. GPT/User reviews 18b rev2.
Only after 18b rev2 PASS should Opus draft a Claude Code execution prompt.
10. Short summary
We are not fixing IU directly now. We are repairing the birth-trigger tool DOT-119 first so future collections are handled by metadata, not hardcoded patches. This is the correct Điều 20 path and prevents repeating the same failure later.