[CLAUDE] Docs: S149-S150 closeout — bookend lượt đầu end-to-end (hình B) + 2 arc đóng + tally #53 chốt 45
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m48s

- Arc-1 hội-tụ-bookend (rename 5 vai + 4 máy PS1 + C9-C12) + arc-2 adap-backlog 23/23 + probe Opus-5 khép (S149)
- Bookend @close S150: wave 6 vai (4 đo + 2 KIỂM) → 20 FLAG disposition từng-dòng; ring1 31/34-ĐẠT, ring2 10/10 + M-1 view-stale-role-desc
- Khoá _frozen_until_owner CẮM trước h24-signal-write (frozen-held in thật); 9 class FIRE; JUMP dải {5,4,4,3}+asym{1,4} chờ anh #21
- STATUS bump CURRENT S149-S150 + 2 khối Recently Done; HANDOFF segment mới + re-stamp đủ-slug + (17)(18)(19) lật + (14) viết lại + 6 slot #21-#26
- K2 posture-A @engine PHẦN K + K5 luật TÁCH vòng-đo-mới @session-end (O-2/O-3 OWNER-DELEGATED execute)
- sleep-doc derive-monitor-set (bỏ hardcode 4-tên); spawn-model-audit desc/comment fix; h24-signal-write param-default fix (first-live bug)
- M9 on-behalf ×3 (tooling + inv-cb F3 + reviewer F4); ring1/ring4 nhà seed; ring2 3 cite-dead vá
- Sổ garble #53 derive-from-body chốt 45 + sub-class ngược-#53/skeleton-ruột-rỗng (ghi-đĩa CẦN-KHÔNG-ĐỦ)
- Session-log S149-S150 (Sàn-5 đăng-ký 6 run=) + closeout-synthesis dạng-1

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-07-25 12:17:05 +07:00
parent 2f39a7e22c
commit 398d343403
122 changed files with 7666 additions and 250 deletions

View File

@ -1,8 +1,8 @@
# Multi-agent SOLUTION_ERP — Master Coordination Guide
> 🔴 **Số vai canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents. KHÔNG chép số vào file này** (B1 derived-trỏ-canonical). *Bản trước S122 cứng-hoá "12-agent" ở **8 chỗ** trong khi roster đã 14 — đó chính là class `view-stale-role-desc`, và `agents/README` bị lấy làm **ví-dụ minh-hoạ** cho class đó trong [`lead-view-auditor.md`](lead-view-auditor.md). Vá @S122 bằng cách **bỏ số**, không phải bằng cách **đổi số** — đổi số thì roster kế lại stale.*
> 🔴 **Số vai canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents. KHÔNG chép số vào file này** (B1 derived-trỏ-canonical). *Bản trước S122 cứng-hoá "12-agent" ở **8 chỗ** trong khi roster đã 14 — đó chính là class `view-stale-role-desc`, và `agents/README` bị lấy làm **ví-dụ minh-hoạ** cho class đó trong [`lead-stale-auditor.md`](lead-stale-auditor.md). Vá @S122 bằng cách **bỏ số**, không phải bằng cách **đổi số** — đổi số thì roster kế lại stale.*
> **Architecture:** sub-agents **worker-tier-pin `opus`+`effort:max` (owner-decision S124 2026-07-15 — thay thế all-inherit Harness-8, trước nữa two-tier Harness-4)** + em main **lead frontier-class (anh chọn per-session)** coordinator — **nhóm product/quality** (7 core S39 + frontend-designer pink S47 + database-agent read-advisory S52 + 📄 office-document S107) + **nhóm monitor INFORM-only** (H1 `tooling-auditor` + H2 `harvest-curator`, 2026-06-07 Harness 1 · H24 `lead-view-auditor` + `lead-omission-auditor`, **S121 W2** · trio-memory `harness-eval` + `harness-refine` + `harness-audit`, **S141** · round-KIỂM ×3 `tooling-harvest-audit`/`h24-audit`/`sleep-audit`, **S145** [C4/C4b TÁCH mỗi-vòng-1-con]). 🔴 **Liệt-kê NHÓM, KHÔNG tổng-số** — số vai canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents (đúng luật dòng đầu file: vá bằng **BỎ số**, không **ĐỔI số**). Tier: **TOÀN BỘ sub `model: opus` + `effort: max`** (worker-tier-pin S124 — sub cố-định KHÔNG theo lead; **đo S126:** lane no-tier resolve `claude-opus-4-8` DÙ lead=Fable = pin ăn runtime, và per-task `tier:'fable'` THẮNG pin trong lượt lệnh engine-đắt anh gõ. **Lead runtime = per-session owner-choice (Fable ↔ Opus); lịch-sử flip-chain lead = canonical [`docs/STATUS.md` §Sub-agents]** (🔴 S106 gộp 1-chain per anh-confirm — reader này KHÔNG enumerate/cập-nhật mỗi flip; BƯỚC 0.6 probe mỗi phiên xác-định runtime lead SỐNG) · effort **Max** (env machine-wide + frontmatter). SE KHÔNG có lớp helper/gopher rẻ (**mọi sub đều substantive memory-bearing → worker-tier = opus+max, KHÔNG hạ thấp hơn**). *(Lineage: two-tier H4 [4 promote inherit + 7 demote pin `claude-opus-4-8`] → all-inherit H8 S66S123 → worker-tier-pin S124 — chi-tiết ở Upgrade 2026-06-10 + S66 dưới.)*
> **Architecture:** sub-agents **worker-tier-pin `opus`+`effort:max` (owner-decision S124 2026-07-15 — thay thế all-inherit Harness-8, trước nữa two-tier Harness-4)** + em main **lead frontier-class (anh chọn per-session)** coordinator — **nhóm product/quality** (7 core S39 + frontend-designer pink S47 + database-agent read-advisory S52 + 📄 office-document S107) + **nhóm monitor INFORM-only** (H1 `tooling-auditor` + H2 `harvest-curator`, 2026-06-07 Harness 1 · H24 `lead-stale-auditor` + `lead-gap-auditor`, **S121 W2** · trio-memory `harness-eval` + `harness-refine` + `harness-audit`, **S141** · round-KIỂM ×3 `ring1-audit`/`ring2-audit`/`ring4-audit`, **S145** [C4/C4b TÁCH mỗi-vòng-1-con]). 🔴 **Liệt-kê NHÓM, KHÔNG tổng-số** — số vai canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents (đúng luật dòng đầu file: vá bằng **BỎ số**, không **ĐỔI số**). Tier: **TOÀN BỘ sub `model: opus` + `effort: max`** (worker-tier-pin S124 — sub cố-định KHÔNG theo lead; **đo S126:** lane no-tier resolve `claude-opus-4-8` DÙ lead=Fable = pin ăn runtime, và per-task `tier:'fable'` THẮNG pin trong lượt lệnh engine-đắt anh gõ. **Lead runtime = per-session owner-choice (Fable ↔ Opus); lịch-sử flip-chain lead = canonical [`docs/STATUS.md` §Sub-agents]** (🔴 S106 gộp 1-chain per anh-confirm — reader này KHÔNG enumerate/cập-nhật mỗi flip; BƯỚC 0.6 probe mỗi phiên xác-định runtime lead SỐNG) · effort **Max** (env machine-wide + frontmatter). SE KHÔNG có lớp helper/gopher rẻ (**mọi sub đều substantive memory-bearing → worker-tier = opus+max, KHÔNG hạ thấp hơn**). *(Lineage: two-tier H4 [4 promote inherit + 7 demote pin `claude-opus-4-8`] → all-inherit H8 S66S123 → worker-tier-pin S124 — chi-tiết ở Upgrade 2026-06-10 + S66 dưới.)*
> 🔍 **Đếm roster = ĐO ĐĨA, đừng tin số trong doc:** `ls -1 .claude/agents/*.md | grep -v README | wc -l`. ⚠️ **Glob thô `ls .claude/agents/*.md` bắt LUÔN `README.md`** ⇒ ra **thừa 1** — đây là bẫy số-học thật (R2-C1: acceptance cũ `=14` **FAIL trên implementation ĐÚNG**, và ép "sửa" bằng cách **xoá `README.md`** = catastrophic-Goodhart).
> **Upgrade S52 (2026-06-08 — AI_INFRA broadcast `2026-06-08-Agent-database-codebase-agents`):** **+database-agent (read-advisory DB specialist, floor DB1DB11)** — schema/query/migration-design-review/perf/concurrency (DB11 RowVersion vá lost-update S43). Tailor READ-tier (implementer-backend vẫn author) · color OMIT (8 standard hết) · `store_memory` strip. `codebase-agent` = **SKIP n-a** (investigator-codebase đã cover grep/audit + `csharp-lsp` Windows no-op). ✅ **verified-runtime** — spawned OK S53 (first real spawn, caught Mig 46 committed-but-unapplied-local drift) + S56 2× (pre-golive-verify schema-stream + golive-harden design+review). DB11 lost-update fix landed S56 (atomic ExecuteUpdate + Serializable tx, gotcha #58).
> Pattern: Anthropic Building Effective Agents orchestrator-workers + Cognition "writes single-threaded" hybrid + post-deploy automated watchdog.
@ -24,7 +24,7 @@
## 🎯 Architecture
> ⓘ **Diagram dưới = 7 core lane (pre-S47 snapshot) — KHÔNG phải roster hiện-hành.** Roster THẬT = 7 core (diagram) + 🩷 frontend-designer (S47) + 🔵 database-agent (S52) + 📄 office-document (S107) + 🟫 tooling-auditor H1 + ⬜ harvest-curator H2 (2026-06-07 Harness 1) + 🔷 lead-view-auditor + 🔶 lead-omission-auditor (**H24, S121 W2**) + 🧪 harness-eval + 🧪 harness-refine + 🧪 harness-audit (**trio-memory, S141**) + 🔬 tooling-harvest-audit + 🔬 h24-audit + 🔬 sleep-audit (**round-KIỂM ×3, S145 — C4/C4b TÁCH mỗi-vòng-1-con: vòng tooling/harvest · soi-lead H24 · nén-ngủ**) — xem skill matrix + decision tree + tool grant dưới. Số vai canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents. (Cosmetic ASCII chưa vẽ lại — H1 tooling-auditor flag drift này @session-start.)
> ⓘ **Diagram dưới = 7 core lane (pre-S47 snapshot) — KHÔNG phải roster hiện-hành.** Roster THẬT = 7 core (diagram) + 🩷 frontend-designer (S47) + 🔵 database-agent (S52) + 📄 office-document (S107) + 🟫 tooling-auditor H1 + ⬜ harvest-curator H2 (2026-06-07 Harness 1) + 🔷 lead-stale-auditor + 🔶 lead-gap-auditor (**H24, S121 W2**) + 🧪 harness-eval + 🧪 harness-refine + 🧪 harness-audit (**trio-memory, S141**) + 🔬 ring1-audit + 🔬 ring2-audit + 🔬 ring4-audit (**round-KIỂM ×3, S145 — C4/C4b TÁCH mỗi-vòng-1-con: vòng tooling/harvest · soi-lead H24 · nén-ngủ**) — xem skill matrix + decision tree + tool grant dưới. Số vai canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents. (Cosmetic ASCII chưa vẽ lại — H1 tooling-auditor flag drift này @session-start.)
> 🔴 **Bài S143 — enumeration TÊN cũng lão-hoá, và grep-theo-SỐ không bắt được:** sweep roster wave S141S142 đặt acceptance là `grep "roster 14|14/14|14 folder|14 vai"` → 0 hit ⇒ tuyên bố sạch. Nhưng đúng 2 dòng tự xưng là bản gốc về roster — dòng NÀY ("Roster THẬT") và `:225` ("VALID_ROLES … ĐỦ roster") — **liệt kê TÊN, không chứa con số nào** ⇒ lọt lưới, giữ 14 vai qua cả wave. **Acceptance cho lần sau: ĐẾM PHẦN TỬ trong mọi enumeration rồi so canonical, đừng so hình-dạng chuỗi.**
```
@ -125,20 +125,20 @@
│ → harvest-curator (H2 monitor, INFORM-only) — propose delta · em main single-writer VERIFY→APPEND · Fidelity nghi → reviewer
├── @session-end §L.b(g-bis) — KIỂM vòng tooling/harvest (verify OUTPUT H1+H2, AUTO sau đo, KHÔNG consent)?
│ → tooling-harvest-audit (round-KIỂM monitor, INFORM-only, C4/C4b S145 vai #1/3) — verdict per-claim + tự tái-dựng ≥1 số + thách-CLEAN · no-self-exempt ≠ H1/H2 · NO-OP nếu H1/H2 không chạy · em main VERIFY→APPEND
│ → ring1-audit (round-KIỂM monitor, INFORM-only, C4/C4b S145 vai #1/3) — verdict per-claim + tự tái-dựng ≥1 số + thách-CLEAN · no-self-exempt ≠ H1/H2 · NO-OP nếu H1/H2 không chạy · em main VERIFY→APPEND
├── @session-end §L.b(j)(ii-bis) — KIỂM vòng soi-lead H24 (verify OUTPUT lead-view+lead-omission, AUTO sau cặp H24)?
│ → h24-audit (round-KIỂM monitor, INFORM-only, C4/C4b S145 vai #2/3) — verdict per-FLAG + thách-CLEAN (H24 báo ít/0 FLAG → tự soi 1 surface tìm FLAG sót) · no-self-exempt ≠ lead-view/omission · KHÔNG soi lead trực-tiếp · NO-OP nếu H24 không chạy
├── @session-end §L.b(j)(ii-bis) — KIỂM vòng soi-lead H24 (verify OUTPUT lead-stale+lead-gap, AUTO sau cặp H24)?
│ → ring2-audit (round-KIỂM monitor, INFORM-only, C4/C4b S145 vai #2/3) — verdict per-FLAG + thách-CLEAN (H24 báo ít/0 FLAG → tự soi 1 surface tìm FLAG sót) · no-self-exempt ≠ lead-stale/lead-gap · KHÔNG soi lead trực-tiếp · NO-OP nếu H24 không chạy
├── sau `/sleep-recovery-memory-l2` Phase 4.5 — KIỂM vòng nén-ngủ (verify gist+Fidelity, AUTO sau nén)?
│ → sleep-audit (round-KIỂM monitor, INFORM-only, C4/C4b S145 vai #3/3) — verdict per-claim + tự đo byte + thách-CLEAN (mở 1 gist vs `<period>.md` gốc) · no-self-exempt độc-lập lượt nén · NO-OP nếu 0 gist tươi
│ → ring4-audit (round-KIỂM monitor, INFORM-only, C4/C4b S145 vai #3/3) — verdict per-claim + tự đo byte + thách-CLEAN (mở 1 gist vs `<period>.md` gốc) · no-self-exempt độc-lập lượt nén · NO-OP nếu 0 gist tươi
├── @session-start §2.1.9 / @session-end §L.b(k) — ĐỒNG-KIỂM CHÍNH-HỆ-MEMORY (độ-giữ · hành-động · đúng-spec), anh ĐÃ GẬT consent?
│ → **TUẦN TỰ 3 spawn RIÊNG** (🔴 CẤM `parallel()`; CẤM tự chạy khi chưa consent):
│ 1. harness-eval (trio-memory monitor, INFORM-only) — ĐO: đọc output instrument + budget.json → SỐ nguyên-văn + verdict
│ 2. harness-refine (…) — ĐỀ-XUẤT: đọc `harness-eval-return.md` PIN → action 4-lớp + mục "đã cân-nhắc→BÁC"
│ 3. harness-audit (…) — KIỂM: đọc run-folder PIN → ĐẠT/TRƯỢT per-claim + re-chạy ≥2 số load-bearing
│ ⟂ vs H1/H2/H24/round-KIỂM: H1 = tooling-freshness · H2 = harvest-integrity · H24 = soi LEAD · round-KIỂM ×3 (`tooling-harvest-audit`/`h24-audit`/`sleep-audit`) = KIỂM 3 vòng tooling-harvest / soi-lead H24 / nén-ngủ [đọc output con-đo vòng mình] · trio = soi CHÍNH HỆ MEMORY (corpus agent-memory)
│ ⟂ vs H1/H2/H24/round-KIỂM: H1 = tooling-freshness · H2 = harvest-integrity · H24 = soi LEAD · round-KIỂM ×3 (`ring1-audit`/`ring2-audit`/`ring4-audit`) = KIỂM 3 vòng tooling-harvest / soi-lead H24 / nén-ngủ [đọc output con-đo vòng mình] · trio = soi CHÍNH HỆ MEMORY (corpus agent-memory)
│ ⟂ vs reviewer: trio KHÔNG chấm diff-code; đụng thao-tác harvest → NHƯỜNG harvest-curator
│ 🔴 3 vai KHÔNG có Write/Edit ⇒ lead scribe return từng con vào `runs/<run-id>/harness-{eval,refine,audit}-return.md` NGAY
@ -187,14 +187,14 @@
| office-document (📄 S107) | `docx` + `xlsx` + `pptx` + `pdf` (bộ 4 Office standalone `~/.claude/skills/` — duplicate namespaced `anthropic-skills:*` → dùng standalone) + `form-engine` (project — template 8 form HĐ `{{field}}` + PDF LibreOffice + RG-001) |
| tooling-auditor (monitor H1) | ref-only — reads skill registry, KHÔNG dùng domain skill |
| harvest-curator (monitor H2) | none — deterministic 5-trục scan + Fidelity-escalate `reviewer` |
| lead-view-auditor (monitor H24, S121 W2) | ref-only — ĐỌC output `scripts/governance-detectors.ps1` làm nền (KHÔNG chạy lại) + enum ĐÓNG `lead_self_audit.flag_classes` (`memory-budget.json`), KHÔNG dùng domain skill |
| lead-omission-auditor (monitor H24, S121 W2) | ref-only — cùng nguồn `lead-view-auditor` (output máy + enum ĐÓNG flag_classes); trục CÁI-THIẾU nên máy gần như mù, KHÔNG dùng domain skill |
| lead-stale-auditor (monitor H24, S121 W2) | ref-only — ĐỌC output `scripts/governance-detectors.ps1` làm nền (KHÔNG chạy lại) + enum ĐÓNG `lead_self_audit.flag_classes` (`memory-budget.json`), KHÔNG dùng domain skill |
| lead-gap-auditor (monitor H24, S121 W2) | ref-only — cùng nguồn `lead-stale-auditor` (output máy + enum ĐÓNG flag_classes); trục CÁI-THIẾU nên máy gần như mù, KHÔNG dùng domain skill |
| harness-eval (monitor trio-memory, S141) | ref-only — ĐỌC output `scripts/{measure-agent-memory,mfe-eval,memory-archive-gate,crystallized-backfill,nhip-no-probe}.ps1`, KHÔNG dùng domain skill |
| harness-refine (monitor trio-memory, S141) | ref-only — reads `harness-eval-return.md` (PIN) + `reinject-ledger.md`, KHÔNG dùng domain skill |
| harness-audit (monitor trio-memory, S141) | ref-only — reads run-folder PIN + `memory-budget.json` + `scripts/`; re-chạy ≥2 số load-bearing để đối-chứng |
| tooling-harvest-audit (monitor round-KIỂM, S145) | ref-only — ĐỌC output H1 `tooling-auditor` + H2 `harvest-curator` (KHÔNG chạy lại đo) + tự đếm `.claude/agents/*.md`/run-folder đối-chứng; no-self-exempt ≠ H1/H2; KHÔNG dùng domain skill |
| h24-audit (monitor round-KIỂM, S145) | ref-only — ĐỌC output `lead-view-auditor` + `lead-omission-auditor` FLAG (KHÔNG re-soi-lead) + `flag_classes` enum ĐÓNG + `class_repeat`; no-self-exempt ≠ 2 vai H24; KHÔNG dùng domain skill |
| sleep-audit (monitor round-KIỂM, S145) | ref-only — ĐỌC output `/sleep-recovery-memory-l2` `.gist.md` + Fidelity verdict; tự đo byte gốc vs gist; no-self-exempt độc-lập lượt nén; KHÔNG dùng domain skill |
| ring1-audit (monitor round-KIỂM, S145) | ref-only — ĐỌC output H1 `tooling-auditor` + H2 `harvest-curator` (KHÔNG chạy lại đo) + tự đếm `.claude/agents/*.md`/run-folder đối-chứng; no-self-exempt ≠ H1/H2; KHÔNG dùng domain skill |
| ring2-audit (monitor round-KIỂM, S145) | ref-only — ĐỌC output `lead-stale-auditor` + `lead-gap-auditor` FLAG (KHÔNG re-soi-lead) + `flag_classes` enum ĐÓNG + `class_repeat`; no-self-exempt ≠ 2 vai H24; KHÔNG dùng domain skill |
| ring4-audit (monitor round-KIỂM, S145) | ref-only — ĐỌC output `/sleep-recovery-memory-l2` `.gist.md` + Fidelity verdict; tự đo byte gốc vs gist; no-self-exempt độc-lập lượt nén; KHÔNG dùng domain skill |
## 🔧 Tool grant (S39 — +3 RAG MCP per agent)
@ -235,8 +235,8 @@ MỌI agent trong roster có **4 RAG-READ MCP**: `search_memory` + `search_code`
- **Keyword = QUYỀN, KHÔNG lệnh (T4):** "workflow"/"ultracode" mở quyền hỏi, KHÔNG auto-run. Mode-OFF + "chạy workflow" → TỪ CHỐI + nhắc `/ultra-on`. CẤM native `/effort ultracode`. *(Bài học 515K-token false-trigger.)*
- **Scope (S1):** Workflow fan-out CHỈ repo SOLUTION_ERP — KHÔNG fan-out repo/corpus khác.
- **Checkpoint (S2):** `hmw.js` **throw** nếu `checkpointApproved≠true` (mechanized tripwire anti-accidental). Em main BÁO {số agent·vai·task} @inform → set cờ → fan-out (KHÔNG chờ confirm từng lần; marker-ON=consent). Sub KHÔNG spawn sub (S3).
- **VALID_ROLES (whitelist `hmw.js` — ĐỦ roster; số vai canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents, B1 KHÔNG chép số):** `investigator-codebase` · `investigator-api` · `implementer-backend` · `implementer-frontend` · `test-specialist` · `reviewer` · `cicd-monitor` · `frontend-designer` · `database-agent` (+S57 — S56 đã dùng 3× qua fail-soft WARN) · `office-document` (+S107 — Office WRITE OD1OD10) · `tooling-auditor` + `harvest-curator` (+S110 anh-directed — H21 roster-parity lệnh-B) · **`lead-view-auditor` + `lead-omission-auditor` (+S121 W2 — H24 lead-self-audit)** · **`harness-eval` + `harness-refine` + `harness-audit` (+S141 — trio-memory)** · **`tooling-harvest-audit` + `h24-audit` + `sleep-audit` (+S145 — C4/C4b round-KIỂM ×3: vòng tooling/harvest · soi-lead H24 · nén-ngủ; AUTO fire-after-measure, no-self-exempt, NO-OP nếu vòng không đo)**. 🔸 **Cả 10 monitor đều INFORM-only, lane RETURN-only** (propose-only). 🔴 **KHÔNG đọc "KHÔNG Write/Edit" thành cơ-chế chặn — đo S143:** frontmatter 9 vai read-only **không khai** `Write/Edit`, nhưng **runtime VẪN cấp**, nối ở cuối tool-list (nhân-chứng trực-tiếp: `reviewer` đã Write+Edit thật trong `runs/2026-07-22-S143-closeout-audit/`). Whitelist = **tuyên-bố ý-định**; containment THẬT = em main single-writer + git-diff commit-gate. Role lạ ∉ VALID_ROLES → `hmw.js` **THROW (STOP-HARD)** + báo owner (S4c, DIRECTED REC-3 2026-07-13); role-less null → inherit lead.
- 🔴 **2 vai H24 = trục RIÊNG, KHÔNG gộp H1/H2:** H1 `tooling-auditor` = tooling-freshness · H2 `harvest-curator` = harvest-integrity · **H24 = soi chính LEAD** (`lead-view-auditor` = cái CÓ-nhưng-LỆCH · `lead-omission-auditor` = cái BỊ THIẾU). Class-flag lấy từ **enum ĐÓNG** `lead_self_audit.flag_classes` (`.claude/agent-memory/memory-budget.json`) — **vai KHÔNG tự chế class**; nhịp = `h24_cadence` (cùng file), chạy **theo NHỊP** không phải mỗi phiên (`session-start §2.1.8` · `session-end §L.b(j)`).
- **VALID_ROLES (whitelist `hmw.js` — ĐỦ roster; số vai canonical → [`docs/STATUS.md`](../../docs/STATUS.md) §Sub-agents, B1 KHÔNG chép số):** `investigator-codebase` · `investigator-api` · `implementer-backend` · `implementer-frontend` · `test-specialist` · `reviewer` · `cicd-monitor` · `frontend-designer` · `database-agent` (+S57 — S56 đã dùng 3× qua fail-soft WARN) · `office-document` (+S107 — Office WRITE OD1OD10) · `tooling-auditor` + `harvest-curator` (+S110 anh-directed — H21 roster-parity lệnh-B) · **`lead-stale-auditor` + `lead-gap-auditor` (+S121 W2 — H24 lead-self-audit)** · **`harness-eval` + `harness-refine` + `harness-audit` (+S141 — trio-memory)** · **`ring1-audit` + `ring2-audit` + `ring4-audit` (+S145 — C4/C4b round-KIỂM ×3: vòng tooling/harvest · soi-lead H24 · nén-ngủ; AUTO fire-after-measure, no-self-exempt, NO-OP nếu vòng không đo)**. 🔸 **Cả 10 monitor đều INFORM-only, lane RETURN-only** (propose-only). 🔴 **KHÔNG đọc "KHÔNG Write/Edit" thành cơ-chế chặn — đo S143:** frontmatter 9 vai read-only **không khai** `Write/Edit`, nhưng **runtime VẪN cấp**, nối ở cuối tool-list (nhân-chứng trực-tiếp: `reviewer` đã Write+Edit thật trong `runs/2026-07-22-S143-closeout-audit/`). Whitelist = **tuyên-bố ý-định**; containment THẬT = em main single-writer + git-diff commit-gate. Role lạ ∉ VALID_ROLES → `hmw.js` **THROW (STOP-HARD)** + báo owner (S4c, DIRECTED REC-3 2026-07-13); role-less null → inherit lead.
- 🔴 **2 vai H24 = trục RIÊNG, KHÔNG gộp H1/H2:** H1 `tooling-auditor` = tooling-freshness · H2 `harvest-curator` = harvest-integrity · **H24 = soi chính LEAD** (`lead-stale-auditor` = cái CÓ-nhưng-LỆCH · `lead-gap-auditor` = cái BỊ THIẾU). Class-flag lấy từ **enum ĐÓNG** `lead_self_audit.flag_classes` (`.claude/agent-memory/memory-budget.json`) — **vai KHÔNG tự chế class**; nhịp = `h24_cadence` (cùng file), chạy **theo NHỊP** không phải mỗi phiên (`session-start §2.1.8` · `session-end §L.b(j)`).
- ⚠️ **Đổi roster = đổi 2 BỀ-MẶT ĐỘC-LẬP:** (1) file `.md` trong `.claude/agents/`**Agent-tool registry** · (2) hằng `VALID_ROLES` trong `hmw.js`**workflow `agentType`**. Sửa 1 quên 1 = vai **spawn được tay nhưng THROW trong workflow** (hoặc ngược lại). 🔴 **Registry = ảnh-chụp lúc khởi phiên, KHÔNG hot-reload** ⇒ vai mới cần **RESTART + spawn-probe THẬT** (`session-start §0.6b`) — `ls` + grep VALID_ROLES là **điều-kiện CẦN, KHÔNG ĐỦ**.
- **Memory governance (M1M5 + R1):** B1 slice-inject (agent ← slice MEMORY của đúng vai qua `args`) · M2 return-delta-only (`memoryDelta{task,verdict,learned,surprise}`) · B3 lead single-writer VERIFY→APPEND-only (no-overwrite-unverified) · B2 harvest-LIỀN sau mỗi workflow vào `agent-memory/<role>` · M5 `store_memory` strip (đã S47). **Containment = defense-in-depth** (git-diff + Qdrant chunk-count post-P2), KHÔNG allowlist đơn-độc (G-015: sub vẫn giữ Bash/Write — KHÔNG "read-only").
@ -246,7 +246,7 @@ MỌI agent trong roster có **4 RAG-READ MCP**: `search_memory` + `search_code`
## 💾 Memory discipline
Each agent `.claude/agent-memory/<name>/MEMORY.md` persistent diary. Spawn auto-inject first 200 lines/25KB. Update BEFORE return (BẮT BUỘC, entry ≤ 1.5K chars). 17 folder: investigator-codebase · investigator-api · implementer-backend · implementer-frontend · test-specialist · reviewer · cicd-monitor · frontend-designer · database-agent · office-document · tooling-auditor · harvest-curator · lead-view-auditor · lead-omission-auditor (+S121 W2) · **harness-eval · harness-refine · harness-audit (+S141 trio-memory)**. *(🔬 3 vai round-KIỂM S145 `tooling-harvest-audit`/`h24-audit`/`sleep-audit` = vai #18/#19/#20 — folder `agent-memory/<vai>/MEMORY.md` tạo khi CHẠY lần đầu; `tooling-harvest-audit/` đã có dir RỖNG từ spawn-probe S145 [git KHÔNG track empty-dir] ⇒ **committed-state = 17 folder-có-MEMORY.md**, khớp. `ls` thô có thể ra 18 dir gồm dir rỗng.)*
Each agent `.claude/agent-memory/<name>/MEMORY.md` persistent diary. Spawn auto-inject first 200 lines/25KB. Update BEFORE return (BẮT BUỘC, entry ≤ 1.5K chars). 17 folder: investigator-codebase · investigator-api · implementer-backend · implementer-frontend · test-specialist · reviewer · cicd-monitor · frontend-designer · database-agent · office-document · tooling-auditor · harvest-curator · lead-stale-auditor · lead-gap-auditor (+S121 W2) · **harness-eval · harness-refine · harness-audit (+S141 trio-memory)**. *(🔬 3 vai round-KIỂM S145 `ring1-audit`/`ring2-audit`/`ring4-audit` = vai #18/#19/#20 — folder `agent-memory/<vai>/MEMORY.md` tạo khi CHẠY lần đầu; `ring1-audit/` đã có dir RỖNG từ spawn-probe S145 [git KHÔNG track empty-dir] ⇒ **committed-state = 17 folder-có-MEMORY.md**, khớp. `ls` thô có thể ra 18 dir gồm dir rỗng.)*
**Tiered Memory Policy v1** (adopt AI_INFRA bulletin 2026-05-29 — thay ngưỡng cứng ">25KB archive" bằng tiered + just-in-time; size to ≠ chất lượng, context-rot):
- **L1 HOT** = `MEMORY.md` soft-cap **~30KB** (role + patterns + anti-patterns + 5-8 entry gần nhất) → auto-inject mỗi spawn