KB-4AA9

IU-0 Module C — Protection, Slice Editing, Pilot, OPEN/Risk

9 min read Revision 1
iu-0full-draftmodular-v2protectionslice-editingpilotopen-itemsrisks191

IU-0 Module C — Protection, Slice Editing, Pilot, OPEN/Risk

Trạng thái: FULL DRAFT MODULAR v2 — chờ GPT/User polish review Module: 07c | Sections: §7–§13 Parent: 07-iu0-index-and-core.md Track A: DONE | Schema sketch: NON-NORMATIVE EXAMPLE Sửa file này khi: protection rules, slice editing, pilot plan, hoặc OPEN/risk status thay đổi


§7. Protection — guardrail contract

§7.1 G-1..9

# Guardrail Enforcement
G-1 Enacted immutableenacted → body + hash locked. Sửa = version mới. PG trigger
G-2 APR required DDL — mọi schema change qua Đ32. Process
G-3 universal_edges SSOT — mọi relation lưu universal_edges. Convention + DOT
G-4 Vector = projection — PG thắng. Qdrant down → CRUD chạy. Architecture
G-5 Profile Registry gate — field không registry → cấm. Birth gate + DOT
G-6 2-layer separation — legacy + IU vector tách collection. Qdrant config
G-7 canonical_address immutable — sau birth không đổi. PG constraint
G-8 DOT phụ IDLE = target — active = lệch → điều tra root cause. Dashboard + alert
G-9 UMC major = migration — cần plan + grace period. APR process

§7.2 VG-1..9

→ Chi tiết tại 07b §6.8. Tóm: không đổi legacy collection, chunking, pipeline, checker. Adapter first. PG = SSOT.


§8. Slice-based editing workflow

Lý do thực tế cần IU-0. Không slice → Agent rewrite full file. Với slice → chỉ đọc + sửa 1 miếng.

§8.1 Slice = 1 information_unit

  1. Xác định slice qua canonical_address.
  2. Đọc body (SELECT từ PG, <5ms).
  3. Sửa body.
  4. Ghi lại (INSERT version mới + hash + outbox).

Không đọc toàn bộ. Không ghi toàn bộ.

§8.2 Slice boundary

Option Mô tả Khi dùng
§Section atom (default) Mỗi § = 1 slice Default mọi tài liệu
Logical unit atom Nhỏ hơn section Section >5000 chars
Composite section Gộp sections nhỏ Sections <200 chars

Chốt boundary: OPEN IU-0-δ — pilot thử nghiệm.

§8.3 Canonical address resolution

Agent sửa "§5.A.3 trong IU-0":

  1. Parse: IU-0.§5.A.3 → publication_code + section_path.
  2. Resolve: SELECT unit_id, body WHERE canonical_address = 'IU-0.§5.A.3'.
  3. Read: ~1500 chars thay vì ~50K.
  4. Edit: Sửa trong context.
  5. Write: INSERT version mới + hash + outbox.

Token savings: file 30K ≈ 7500 tokens. 1 slice ≈ 375 tokens. Savings ≈ 95%.

§8.4 7 Operations

# Operation Hot path Hệ quả
1 Read SELECT body. <5ms. Content slice trong context.
2 Edit INSERT version mới + hash + outbox. Version cũ giữ (audit). Vector 120s.
3 Append INSERT unit mới + edge follows. Section mới.
4 Split 1 → 2 units. Gốc retire. Edge split_from.
5 Merge 2+ → 1. Gốc retire. Edge merged_from.
6 Reorder UPDATE sort_order. Content không đổi → không re-embed.
7 Retire Soft-delete + outbox 30-60s. Vector retire. Queryable audit.

§8.5 Local-context editing

User insight: "Ngay tại thời điểm edit, nội dung đã có sẵn trong context."

Aspect Thiết kế
Edit không cần vector Agent đọc slice PG, sửa, ghi PG. Vector chỉ search.
Pending vector = OK 120s window, Agent đã có content mới từ PG.
Cross-reference qua PG SELECT <5ms. Không cần vector.
Vector hữu ích khi Tìm "sections liên quan concept X" không biết address.

§8.6 Concurrency

Hiện tại single-agent (Desktop → CLI/Codex tuần tự). Đề xuất pilot: optimistic locking qua content_hash. OPEN IU-0-ζ.


§9. Minimum Usable Package — chi tiết

§9.1 Tier 0 — Block birth

15 elements strict: 10 UMC + 3 identity_v1 Required (title, owner_lookup_ref, primary_section_type_ref) + 2 publication_v1 Required (publication_authority_ref, publication_type_ref).

Thiếu → block INSERT. Mode per-family qua APR (block production; warn pilot).

Thêm: parent_or_container_ref có giá trị, ≥1 edge belongs_to/contains, composition_role default atomic. DOT warn, không block.

§9.3 Tier 2+ — Defer

Tier 2: topics, entities, claims. Tier 3: workflow. Tier 4: checker. Tier 5: self-healing, KG.

§9.4 MUP pilot

Tier 0 + partial Tier 1: birth gate 15 strict, publication ref, edge belongs_to. Outbox enqueue nhưng IU collection chưa tạo. Checker OFF. Đủ test slice editing + CRUD + token savings.


§10. Pilot dogfooding plan

§10.1 Scope — 3-5 docs

Priority Document Lý do
P0 IU-0 Self-referential dogfood
P0 P38-XC (~30K) Dài nhất, phức tạp
P0 P44-3 (~25K) Cross-reference test
P1 P11E Test unit_kind khác
P1 1 Đ44 doc Test law_unit — TAC bridge

§10.2 5 phases

Phase Action Success
Prepare Chia → units, assign address, UMC + Tier 0 15/15 birth gate PASS
Dogfood Slice editing. Đo tokens. ≥50% giảm. <5 turns.
Extend + P11E + Đ44. Cross-doc edges. No orphan edge.
TAC bridge Bridge IU → TAC pipeline Render đúng.
Vector + checker IU collection Phase 1. Checker pilot. Search OK. Drift active.

§10.3 Success criteria

# Criteria
SC-1 Slice editing giảm token ≥50%
SC-2 Edit cycle <5 turns per slice
SC-3 0 critical schema bugs
SC-4 Guardrails G-1..9 + VG-1..9 hold
SC-5 CRUD <10ms, embed sau 120s
SC-6 Legacy KB vector không ảnh hưởng
SC-7 Profile fields chỉ từ registry

§10.4 Pilot KHÔNG LÀM

Không P44-6. Không migrate production. Không user ngoài dev. Không legacy vector. Không >5 docs.


§11. OPEN / TD

§11.1 OPEN

ID Item Priority Status
IU-0-α Path verified ✅ RESOLVED
IU-0-β Implementation pattern (single/per-kind/hybrid) HIGH OPEN — APR
IU-0-γ unit_kind extensions dogfooding HIGH OPEN — trước pilot
IU-0-δ Slice boundary final MEDIUM OPEN — pilot
IU-0-ε Vector granularity per kind MEDIUM OPEN — APR
IU-0-ζ Concurrency slice editing MEDIUM OPEN — defer
IU-0-η MUP strict mọi unit_kind? MEDIUM OPEN — pilot
IU-0-θ Profile templates dogfooding LOW OPEN
IU-0-ι Legacy stabilization RESOLVED — Track A DONE
IU-0-κ IU collection design MEDIUM OPEN — Phase 1
IU-0-λ Shared vs separate outbox MEDIUM OPEN — pilot
IU-0-μ Queue observability LOW OPEN
IU-0-ν Worker tuning LOW OPEN — defaults chốt

§11.2 TD

ID Item Resolve khi
TD-1 Migrate design docs → IU format Pilot "Prepare"
TD-2 Slice boundary automation Post-pilot
TD-3 Vector regeneration scheduler Post Phase 1
TD-4 Guardrails enforcement automation P44-6
TD-5 Pilot metrics dashboard Pilot "Dogfood"
TD-6 Outbox worker implementation P44-6
TD-7 Search adapter multi-collection Phase 2
TD-8 Unit-aware chunking Phase 3

§12. Risk / conflict

# Risk Severity Mitigation
R-1 Schema divergence High AP-3 + G-5 + DOT
R-2 Duplicate KB + IU search HIGH/CRITICAL Collection separation + freshness (→ 07b §6.6)
R-3 Outbox worker stuck High HP-10 + alert + HP-12
R-4 Dead-letter accumulation Medium Alert + manual review
R-5 Agent inventing fields High G-5 + birth gate + DOT
R-6 Accidental legacy mutation CRITICAL VG-1..9 + collection hardening
R-7 Over-eager pilot Medium Scope cap 5 docs + SC gates
R-8 UMC/Profile re-design High GR-1 kế thừa + self-audit
R-9 DDL/code lén High GR-2 + reviewer
R-10 P44-6 implicit High GR-3 + scope check
R-11 Content drift slice edit Medium Cross-ref + DOT Tier 4
R-12 Concurrency conflict Low Single-agent. OPEN IU-0-ζ.

Self-contradiction check: IU-0 modules ↔ P38-XC / P44-3/4A/5A / P11 / VRC / Track A = PASS.


§13. Review questions

# Câu hỏi Đề xuất
Q1 3-file modular pack đủ quality? PASS — substance giữ nguyên, gọn hơn.
Q2 Cần thêm ví dụ §8? Đủ — pilot validate.
Q3 Outbox sketch NON-NORMATIVE? Giữ — P44-6 chốt.
Q4 Next step GPT/User polish nội dung → sửa per-file nếu cần.

Module C — §7–§13 | Parent: 07-iu0-index-and-core.md | Cross-ref: 07b §5.A (outbox), 07b §6 (vector/VG)