KB-1608

Opus Assessment — Agent Investigation Report + Next Steps Proposal

5 min read Revision 1
iu-0description-policyagent-investigationopus-assessmentoption-comparison

Opus Assessment — Agent Investigation Report + Next Steps Proposal

Date: 2026-05-04 Input: iu0-description-policy-tiering-runtime-investigation-report.md (agent report) Controlling design: 13-iu0-description-policy-tiering-and-pack2b-f6-preflight.md rev3 Status: Chờ GPT thẩm tra


§1. Agent Report Assessment: PASS

Agent hoàn thành đúng scope: 11 câu hỏi read-only, 5-option comparison, HARD STOP. Không DDL/write/patch.


§2. Phát hiện quan trọng — Tóm tắt 5 dòng

  1. Option 2 chết: collection_registry KHÔNG có JSONB column → Option 2 (extra_metadata) không khả thi.
  2. Option 1 vs Option 3: DDL (field mới) = cleanest endpoint nhưng cần ALTER + Directus registration. dot_config JSON = nhanh nhất, 0 DDL, nhưng kém self-documenting.
  3. IU chưa governed: information_unit + unit_version đang observed → birth guard chưa gắn → problem chưa xảy ra, nhưng CHẮC CHẮN xảy ra khi flip governed.
  4. v_entity_full_classification đã có cột tier: cần kiểm view definition xem cột này lấy từ đâu — có thể tận dụng.
  5. species_collection_map trống cho IU: mọi approach dựa species cần backfill trước.

§3. Loại bỏ options — Chỉ còn 2 candidates

Option Kết luận Lý do
Option 2 LOẠI Column absent, cần DDL giống Option 1 nhưng kém constraints
Option 4 LOẠI Sai granularity — labels per entity, policy cần per collection
Option 5 LOẠI (standalone) Chỉ cover H11b, không cover H11a + birth guard. Có thể bổ trợ, không thể đứng một mình
Option 1 CANDIDATE DDL description_policy column — schema SSOT, queryable, joinable
Option 3 CANDIDATE dot_config JSON — 0 DDL, nhanh, nhưng fn phải parse JSON mỗi trigger fire

§4. Đề xuất — Option 1 (DDL field) làm endpoint, Option 3 có thể làm bước đệm

Opus nghiêng về Option 1 vì:

  1. NT13 PG First: policy sống trong schema PG, không trong JSONB string config. Schema tự document, có CHECK constraint, queryable bằng SQL thuần.
  2. fn_description_birth_guard đã đọc collection_registry: thêm 1 cột cùng query = 0 performance cost mới. Option 3 cần 1 SELECT + JSONB parse thêm mỗi trigger fire.
  3. H11a/H11b query đã join collection_registry: thêm WHERE filter tự nhiên.
  4. 166 collections, chỉ 34 governed: populate scale nhỏ, manageable.
  5. Directus registration: well-trodden path, không blocker.

Đối với Option 3: vẫn khả thi nếu GPT/User muốn tránh DDL hoàn toàn. Nhưng dot_config JSON = string key, không FK, không CHECK, dễ drift. Và fn parse JSONB mỗi trigger fire = thêm 1 round-trip query, tuy nhỏ nhưng trên hot path.

Có thể hybrid: Option 3 tạm (unblock nhanh) → migrate sang Option 1 sau. Nhưng thêm 1 migration step = thêm tech debt.


§5. Phát hiện bonus cần điều tra thêm (1 query nữa)

Agent phát hiện v_entity_full_classification đã có cột tier. Nếu cột này đọc từ source nào mở rộng được → có thể encode policy KHÔNG cần DDL trên collection_registry. Cần:

SELECT pg_get_viewdef('v_entity_full_classification'::regclass, true);

Đề xuất: cho phép 1 query read-only bổ sung trước khi chốt option, hoặc GPT/User quyết option trước rồi tính sau.


§6. Next steps đề xuất (chờ GPT approve)

Nếu GPT chọn Option 1 (DDL field):

  1. Opus soạn execution pack (design doc): DDL script + seed logic + fn amend spec + H11a/H11b amend spec.
  2. GPT review execution pack.
  3. Agent execute (DDL + seed + fn amend + H11 query amend).
  4. Smoke test: H11a/H11b trước và sau.
  5. Sau đó mới mở F6 birth path → Pack 2B.

Nếu GPT chọn Option 3 (dot_config JSON):

  1. Opus soạn execution pack: INSERT config key + fn amend spec + H11 query amend spec.
  2. Tương tự flow Option 1 nhưng không DDL.

Cả 2 options đều cần: fn_description_birth_guard amend + H11a SQL amend. Chỉ khác nơi encode policy.


§7. Không được làm (giữ nguyên)

  • Không mở Pack 2B
  • Không DDL (chờ GPT approve option)
  • Không patch luật
  • Không sửa fn/trigger
  • Không tạo IU rows

Opus Assessment | 2026-05-04 | Chờ GPT thẩm tra report + chọn option + approve next steps.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/opus-assessment-agent-investigation-description-policy-2026-05-04.md