KB-7D66

00 — Registries-Pivot OS Agency — Master Design v0.1 (canonical)

9 min read Revision 1
designregistries-pivotos-agencymaster-designv0.1pivot-onlyno-hardcodepg-firstrender-shelldrilldownreadiness-gate2026-05-31

title: 00 — Registries-Pivot OS Agency — Master Design v0.1 (canonical) date: 2026-05-31 status: DESIGN-ONLY · canonical · NOT ratified · zero substrate mutation supersedes_for_design: consolidates the 4 prior read-only packages (see §Sources) route_target: /knowledge/registries-pivot

00 — Master Design v0.1 (canonical)

This is the canonical design for the Registries-Pivot OS Agency surface at /knowledge/registries-pivot. It consolidates four prior read-only packages into one ratifiable design. It is not implementation: no PG/Directus/Qdrant mutation, no schema, no production Nuxt, no route build. Where evidence is missing it is marked explicitly (LAW_DEFINITION_GAP · PIVOT_MISSING · REGISTRY_MISSING · DATA_MISSING · GATED_BY_APPROVAL · DEFERRED).

0. What this surface is

Registries-Pivot is the automatic PG reflection screen for the whole system — not a human-authored report. It shows, for every layer/species/group/object: total · plus · minus · orphan · phantom · drift · verification · warning · next-action, and lets a viewer drill from any count > 1 down to the final DB/relationship substrate. Every number is produced by the pivot engine or is explicitly PIVOT_MISSING. It is the operational expression of Điều 26 (Pivot Law) rendered through Điều 28 (Display Technology Law).

1. Non-negotiable principles (from law + GPT direction)

  1. Pivot-only counting. pivot_count() is the single counting method (Đ26 rename rationale + MT2 "đếm by definition, không cache"). No Nuxt math. meta_catalog.record_count is a served snapshot field, not truth; truth = the live pivot. Divergence ⇒ drift, surfaced.
  2. No hardcode, including disguised hardcode. Nuxt = render-shell only (Đ28 NT-D1: no business logic, no DB query, no components outside registered templates, no hardcode; NT-D3: config in PG JSONB, not text/arrays). Constitution no_hardcode_absolute: true, no_direct_PG_from_Nuxt: true, assembly flow PG → Directus → Nuxt.
  3. PG-first / Directus-exposed / Nuxt render-shell. Counts, labels, thresholds, layers, pins, orphan/phantom all originate in PG, are served by Directus/API, and are only rendered by Nuxt.
  4. Dynamic drill-down. count > 1 ⇒ backend exposes a child layer; depth is dynamic (data-decided), never hardcoded; leaf = the object DB row / relationship edge.
  5. Accounting invariant. total_system_objects = counted_in_registries_pivot + orphan + phantom, leaf-scoped; failure ⇒ count_integrity_status=failed + notification, never hidden.
  6. Everything is itself a managed entity (Đ2/Đ0 Atom): any NEW registry (labels, pins) must have ID + birth record + meta_catalog row + pivot, or it is itself an orphan.
  7. Reversible / design-before-implementation (Đ20, Đ30): nothing implemented until this design is ratified; all later changes additive + BEGIN..ROLLBACK first.

2. The 5-Layer drill model (Điều 26 §II-QUATER) = the dynamic drill-down spine

Layer Đ26 Content Hard/Soft
L1 Summary CỨNG 9 rows = 6 composition layers (atom·molecule·compound·material·product·building) + Species + DOT Tools + Collections; columns Lớp/Phân loại/Tổng/Số loài/Mồ côi(+OS-Agency cols); fixed order, no alphabetical sort hard
L2 Group List CỨNG click an L1 row → child-group list (reuse existing dynamic page, AP-11: do not mint a new page) hard
L3 Entity List MỀM click a group → entity list (Directus readItems filtered) soft
L4 Entity Detail MỀM "DB về chính nó" (Đ21): 6 headings Identity/Relations/Dependencies/History/Labels/Metrics soft
L5 Matrix CỨNG multi-dim matrix at the END of every layer; 1 main axis + ≤6 sub-axes = max 7 dims; data = pivot GROUP-BY; created via pivot_definitions INSERT, never code hard

The generic recursive rule (doc 04) — count>1 → child layer until singular object → substrate — is the generalization of L1→L2→L3→L4 with variable depth driven by species/composition/grouping, with L5 attachable at any layer. OS-Agency columns (doc 10) ride on every node.

3. The 7 dimensions (Species Taxonomy v1.2)

Registries UI = 6 composition layers + 1 species meta-layer = 7 dimensions. Species is a meta-entity standing OUTSIDE the 6 layers (entity_species, 42 rows, has parent_id+depth → 3-tier tree designed). composition_levels is NOT a physical table (DATA_MISSING — the 6 layers exist as enum values in composition_level columns).

4. Component designs (each its own doc)

  • 01 Law & principle map (all laws FOUND, mapped to design clauses).
  • 02 Live substrate map (fresh verified counts + REUSE verdicts).
  • 03 Data contract (the node/list object the API returns).
  • 04 Dynamic drill-down layer model (count>1 algorithm, variable depth, child-summary fields).
  • 05 Pivot-only counting + accounting invariant (incl. live FAILED rehearsal + PIVOT_MISSING ledger).
  • 06 Orphan / phantom / unmanaged / unmonitored / ghost policy (defs + scanner + severity + cleanup + notify).
  • 07 Label / grouping policy (50 = MAX ceiling, per-species; reuse-first; PG-backed labels).
  • 08 Pin / ghim policy (NEW registry_pin, propose-only, governed/scoped/counted).
  • 09 Notification / cleanup trigger contract (system_issues + event_outbox, Đ45 signal-not-data; design-only).
  • 10 UI contract — OS Agency standard (Đ28 render-shell, registered templates, columns, traffic-lights, tokens).
  • 11 No-hardcode acceptance tests (pivot-backed, Đ28 Truth Check, coverage scanner, label/layer/pin tests).
  • 12 Implementation readiness gate (what must be true before any build; Đ20).
  • 13 Next-macro prompts (read-only rehearsal → PG view rehearsal → UI preview → implementation; per 100000x prompt standard).

5. Route / convergence decision (RECONCILE — GATED_BY_APPROVAL)

  • Canonical surface = Registries-Pivot, implemented as the Đ26 Tab Pivot 5-Layer model.
  • /knowledge/pivot = today's counting-truth reference and the render-shell pattern to reuse (PG-driven shells, mostly Đ28-compliant).
  • /knowledge/registries = RECONCILE: preserve its drill-down UX thinking; retire its Đ28-violating client gap-math (health.get.ts totalGap=Σ|gap| → orphan 21,823; CAT-PHA/UNM injected).
  • One converged surface, no 3rd parallel page. The physical route string (mint /knowledge/registries-pivot and alias the other two, vs. keep /knowledge/pivot as the route under the new name) is GATED_BY_APPROVAL.

6. Top-line classification (full table in doc 12)

  • REUSE: pivot engine (pivot_count/query/matrix, pivot_definitions 37, pivot_results 126, refresh_meta_catalog_from_pivot, views v_pivot_by_level/v_pivot_species_by_level/v_registry_counts_compat), orphan refresh fns, check_registry_coverage, fn_birth_onboarding_full_scan, meta_catalog accounting columns, label/taxonomy (Đ24), system_issues+event_outbox (Đ45), design_templates (Đ28), /knowledge/pivot render-shell pattern.
  • EXTEND: populate pivot_definitions.parent_code (NULL on all 37 → drill graph unwired); add meta_catalog.phantom_count.
  • WRAP→RETIRE: frontend gap-math in registries/index.vue + health.get.ts.
  • RECONCILE: stored record_count ↔ live pivot; CAT-006 vs CAT-DOT dual DOT count; /knowledge/registries/knowledge/pivot.
  • NEW: registry_pin; v_count_integrity + fn_count_integrity_check(); pivots PIV-500/30x/31x/32x.
  • DEFER: ghost (cross-store) detection (needs Qdrant read); IU/KG pivots.

7. Readiness verdict (doc 12)

DESIGN COMPLETE / NOT YET IMPLEMENTABLE. Eight gate conditions must be satisfied (ratification, count-integrity P0 accepted, missing pivots classified, phantom def accepted-or-deferred, label/pin registry strategy accepted, UI contract accepted, no-hardcode test plan accepted, rollback plan accepted). No condition may be satisfied by self-approval.

Sources (consolidated, all read this session)

  1. …/registries-pivot-foundation-reuse-audit-rebuild-blueprint-2026-05-30/ (14 docs)
  2. …/registries-pivot-os-agency-surface-master-design-2026-05-30/ (14 docs)
  3. …/registries-pivot-os-agency-count-integrity-orphan-phantom-label-pin-rehearsal-2026-05-31/ (12 docs)
  4. …/law-capability-discovery-second-pass-cross-check-2026-05-30/ (13 docs) 5–7. GPT-direction docs (counting/orphan/phantom/label/pin addendum; auto-label threshold clarification; doc-governance + next-macro)
  5. knowledge/dev/laws/prompt-muc-tieu-mo-for-claude-code.md (100000x open-goal prompt standard v1.3) Laws: Hiến pháp v4.6.3 + Đ0/Atom, Đ0-B/composition, Species Taxonomy v1.2 + Species-Collection v0.5 DRAFT, Đ0-G, Đ2, Đ19, Đ20, Đ23, Đ24, Đ26, Đ28, Đ29, Đ30, Đ31, Đ32, Đ33, Đ35, Đ36 DRAFT, Đ37, Đ44 DRAFT, Đ45 — all FOUND (doc 01).