KB-439F

GPT Handoff — Opus New Session: DOT-119 Complete, Pack 2B Next

10 min read Revision 1
handoffopuspack2biu-0dot-119-completeschema-first

GPT Handoff — Opus New Session: DOT-119 Complete, Pack 2B Next

Date: 2026-05-05 Author: GPT-5.5 Thinking / Incomex Hội đồng AI Purpose: Copy nguyên văn cho Opus phiên mới để tiếp tục liền mạch, không tự search lan man.

0. One-line status

DOT-119 repair arc đã hoàn thành. information_unit đã có birth trigger. Bước tiếp theo là Pack 2B, nhưng KHÔNG được nhảy thẳng CRUD; phải làm P2B-P0 schema inspection read-only trước.

1. Roadmap tổng thể đang ở đâu

Mục tiêu lớn của Đ44/IU-0 là đưa information_unit vào hoạt động chính thức theo hướng Text-as-Code:

  1. Có schema IU / unit_version.
  2. Có registry/governance registration.
  3. Có birth path đúng luật.
  4. Có pilot CRUD thật để chứng minh insert/read/version/birth hoạt động.
  5. Sau đó mới mở các phần sau như edge/composition, vector/outbox/Qdrant, multi-axis traceability.

Hiện đã xong phần 1–3 ở mức cần thiết cho pilot:

  • information_unitunit_version đã đăng ký collection_registry từ Pack 2A.
  • Description policy đã có để không ép IU data rows phải có detailed description.
  • DOT-119 đã được sửa thành metadata-driven, no-hardcode, no-clobber.
  • trg_birth_information_unit đã được cài qua DOT-119 v2.

Bây giờ đang chuẩn bị bước 4:

Pack 2B — tạo 1–2 IU pilot rows thật, verify birth trigger fire.

2. Những gì đã hoàn thành — không làm lại

2.1 DOT-119 repair arc: PASS toàn bộ

Phase Nội dung Status
P0 Read-only mapping 166 collections PASS
P1a Schema tool inspection PASS
P1 Tạo 3 metadata fields + seed + PG constraints PASS
P2 Rewrite DOT-119 v2, metadata-driven, 18/18 smoke PASS
18c Install trg_birth_information_unit qua DOT-119 v2 PASS
P3 HC registration Deferred TD, non-blocking

2.2 Runtime facts hiện tại

  • DOT-119 v2 active tại /opt/incomex/dot/bin/dot-birth-trigger-setup.
  • DOT-119 v2 md5 report: 5883bce405b86ab436e885cf16fd22de.
  • DOT-119 v2 không chứa CREATE OR REPLACE FUNCTION fn_birth_registry_auto.
  • DOT-119 v2 không chứa KNOWN_V2_FN_HASH.
  • fn_birth_registry_auto md5 hiện tại: 1f729b3571a74963089bb3ef388217f3.
  • Trigger count sau 18c: 31.
  • trg_birth_information_unit đã tồn tại.
  • trg_birth_information_unit gọi fn_birth_registry_auto('__birth_synthetic_id__').
  • information_unit rows = 0 tại thời điểm 18c report.
  • birth_registry rows cho information_unit = 0 tại thời điểm 18c report.

Không được rollback hay làm lại DOT-119 nếu không có chỉ đạo riêng.

3. File phải đọc đầu phiên mới

Đọc theo thứ tự này, không search lan man trước khi đọc:

Core status / directives

  1. knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-18c-report-and-pack2b-directive-2026-05-05.md
  2. knowledge/dev/laws/dieu44-trien-khai/reports/iu-birth-trigger-install-18c-report.md
  3. knowledge/dev/laws/dieu44-trien-khai/design/19-iu0-pack2b-pilot-crud-and-birth-fire-execution-pack.md

DOT-119 / metadata context

  1. knowledge/dev/laws/dieu44-trien-khai/reports/dot119-repair-p2-script-rewrite-report.md
  2. knowledge/dev/laws/dieu44-trien-khai/reports/dot119-repair-p1-metadata-ddl-seed-report.md
  3. knowledge/dev/laws/dieu44-trien-khai/design/18a-dot119-metadata-driven-no-clobber-redesign.md
  4. knowledge/dev/laws/dieu44-trien-khai/design/18b-dot119-repair-execution-pack.md

IU schema/design context

  1. knowledge/dev/laws/dieu44-trien-khai/design/04-information-unit-profile-schema.md
  2. Any Pack 1 / IU schema gate docs referenced by file 04 or file 19 if needed, but do not expand scope.

4. Những tài liệu đã superseded — không theo nữa

Không dùng các hướng sau để chỉ đạo Pack 2B:

  • 16-iu0-pack2b-f6-birth-path-design.md nếu còn đề xuất defer/birth exception cũ.
  • 17-iu0-pack2b-option-b-persisted-pilot-execution-pack.md — đã SUPERSEDED.
  • Bất kỳ thiết kế “pilot exception” nào coi IU birth path chưa có.

Lý do: thực tế hiện tại đã có DOT-119 v2 và trg_birth_information_unit.

5. Bài học bắt buộc giữ trong phiên mới

5.1 Anti-hardcode là nguyên tắc cứng

Không hardcode:

  • row count bảng sống từ phiên trước;
  • mapping collection → column trong script;
  • function hash làm gate dài hạn;
  • danh sách cột IU từ trí nhớ;
  • payload INSERT từ phỏng đoán.

Dùng:

  • schema inspection thực tế;
  • run-local baselines;
  • capability checks;
  • metadata-driven behavior;
  • exact evidence report.

5.2 Schema-first trước CRUD

Không được tạo IU row từ memory. Trước Pack 2B-P1 INSERT phải có P2B-P0 read-only report về schema thật.

5.3 Bảng sống không dùng total count làm hard gate

Với birth_registry, chỉ dùng:

  • IU-specific birth count làm invariant chính;
  • total birth count là audit/drift only.

5.4 Nếu mutation fail sau khi tạo state mới, phải có rollback path

Không để hệ thống ở trạng thái nửa vời. Nếu Pack 2B tạo rows rồi verify fail, prompt sau phải có cleanup/rollback decision rõ.

6. Việc đang dừng lại

Đang dừng ở đây:

Chuẩn bị Pack 2B-P0 schema inspection read-only.

Không phải P2B-P1 INSERT. Không phải Pack 2B execution. Không phải vector. Không phải edge/composition.

7. Chỉ đạo trực tiếp cho Opus phiên mới

7.1 Không hỏi lại User “có muốn soạn P0 không”

Hãy tự làm bước tiếp theo đúng mạch: soạn P2B-P0 prompt.

7.2 Deliverable cần tạo ngay

Tạo prompt:

knowledge/dev/laws/dieu44-trien-khai/prompts/19-p2b-p0-iu-schema-inspection-readonly-prompt.md

Mục tiêu: Agent/Claude Code inspect schema thật của information_unitunit_version, upload report, HARD STOP.

7.3 P2B-P0 prompt phải là read-only tuyệt đối

Hard boundaries:

  • no DDL;
  • no INSERT/UPDATE/DELETE;
  • no IU rows;
  • no unit_version rows;
  • no trigger/function edits;
  • no DOT-119 execute;
  • no Pack 2B CRUD;
  • no vector/outbox/Qdrant;
  • no Directus exposure;
  • no P3/HC.

7.4 P2B-P0 prompt phải yêu cầu đọc docs

Trong prompt, yêu cầu Agent đọc trước:

  1. knowledge/dev/laws/dieu44-trien-khai/design/19-iu0-pack2b-pilot-crud-and-birth-fire-execution-pack.md
  2. knowledge/dev/laws/dieu44-trien-khai/reports/iu-birth-trigger-install-18c-report.md
  3. knowledge/dev/laws/dieu44-trien-khai/design/04-information-unit-profile-schema.md
  4. knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-18c-report-and-pack2b-directive-2026-05-05.md

7.5 P2B-P0 queries tối thiểu cần có

Prompt phải yêu cầu Agent chạy read-only:

-- information_unit columns
SELECT column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_schema='public' AND table_name='information_unit'
ORDER BY ordinal_position;

-- unit_version columns
SELECT column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_schema='public' AND table_name='unit_version'
ORDER BY ordinal_position;

-- information_unit constraints
SELECT conname, contype, pg_get_constraintdef(oid)
FROM pg_constraint
WHERE conrelid='information_unit'::regclass
ORDER BY conname;

-- unit_version constraints
SELECT conname, contype, pg_get_constraintdef(oid)
FROM pg_constraint
WHERE conrelid='unit_version'::regclass
ORDER BY conname;

-- information_unit triggers
SELECT tgname, tgfoid::regproc AS func, pg_get_triggerdef(oid) AS def
FROM pg_trigger
WHERE tgrelid='information_unit'::regclass AND NOT tgisinternal
ORDER BY tgname;

-- unit_version triggers
SELECT tgname, tgfoid::regproc AS func, pg_get_triggerdef(oid) AS def
FROM pg_trigger
WHERE tgrelid='unit_version'::regclass AND NOT tgisinternal
ORDER BY tgname;

-- current counts
SELECT count(*) AS iu_count FROM information_unit;
SELECT count(*) AS uv_count FROM unit_version;
SELECT count(*) AS iu_birth_count FROM birth_registry WHERE collection_name='information_unit';
SELECT count(*) AS uv_birth_count FROM birth_registry WHERE collection_name='unit_version';

-- IU collection metadata
SELECT collection_name, governance_role, birth_code_strategy, birth_code_column, birth_identity_source, description_policy
FROM collection_registry
WHERE collection_name IN ('information_unit','unit_version')
ORDER BY collection_name;

-- function hash + trigger count audit
SELECT md5(pg_get_functiondef('fn_birth_registry_auto'::regproc)) AS fn_hash;
SELECT count(*) AS birth_trigger_count FROM pg_trigger WHERE tgname LIKE 'trg_birth_%' AND NOT tgisinternal;

7.6 P2B-P0 report path

knowledge/dev/laws/dieu44-trien-khai/reports/19-p2b-p0-iu-schema-inspection-report.md

Report must include:

  • actual columns and which are NOT NULL without defaults;
  • constraints summary;
  • triggers summary;
  • current counts;
  • IU metadata status;
  • minimum INSERT payload candidate fields, but do not execute;
  • risks/blockers before P2B-P1;
  • recommended pilot payload shape based on actual schema;
  • hard-stop confirmation.

7.7 After P2B-P0

After report upload: HARD STOP.

Then GPT/User review P0 report. Only after PASS should Opus draft P2B-P1 pilot INSERT prompt.

8. Do not do these in new session

  • Do not dispatch Pack 2B-P1 INSERT immediately.
  • Do not create any IU row in Opus session.
  • Do not alter schema.
  • Do not touch DOT-119 again.
  • Do not run Pack 2C/vector/outbox/Qdrant.
  • Do not solve IU parent-child/multi-axis traceability yet. Those are later packs.

9. Nôm na cho phiên mới

Máy khai sinh đã sửa xong. Ống khai sinh cho phòng IU đã gắn xong.

Bây giờ chưa cho em bé vào phòng ngay.

Việc trước mắt là:

Mở tủ hồ sơ của phòng IU, đọc kỹ mẫu giấy khai sinh thật sự cần những trường nào, rồi lập phiếu chuẩn bị sinh thử.

Tức là P2B-P0 schema inspection read-only.

10. Expected first response from Opus new session

Opus phiên mới nên trả lời ngắn gọn:

  • đã đọc handoff;
  • sẽ đọc 4 tài liệu bắt buộc;
  • sẽ tạo P2B-P0 read-only prompt;
  • không dispatch, không CRUD, không INSERT.

Sau đó Opus tạo prompt P2B-P0, upload KB, dừng chờ GPT/User review.


End of handoff. Copy this to Opus new session.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-handoff-opus-new-session-pack2b-next-2026-05-05.md