[CLAUDE] Infra: W3 file 4-9 - TRI-ACCEPT authority + GAP#6 tier:opus + roster sweep + ACTIVE-MARKS chu-thich

FILE 4 fable-clone.md -- GAP#6: lane ensemble PHAI mang tier:'opus'.
  Thieu => inherit lead => lead=Fable thanh N x Fable = dot quota gap N lan VA pha dung
  ly-do lenh ton tai (ensemble RE de THAY 1 luot Fable dat). lead=Opus thi tier:'opus'
  ≡ inherit => loi VO HINH, chi lo khi Fable UP (dung loi reviewer bat @S108).
  + khai CHUA VERIFY precedence spawn-param vs frontmatter (H23 §2(2)) => DEFER phien lead=Fable.
  + grep tier:'opus' = DIEU-KIEN CAN, KHONG DU (do CHU trong file, Goodhart-able 100%).

FILE 5 agents/README.md -- bo SO khoi 8 cho (khong doi so: doi thi roster ke lai stale).
  File nay chinh la VI-DU minh-hoa cho class view-stale-role-desc trong lead-view-auditor.md:47.
  + canh-bao bay glob: `ls .claude/agents/*.md` bat LUON README.md => thua 1 (R2-C1).
  + khai: doi roster = doi 2 BE-MAT DOC-LAP (agents/*.md -> registry | VALID_ROLES -> agentType).

FILE 6 fable-real-runbook.md -- 14 hit (lead bao 8 = SAI, xem duoi). + hmw.js:22-30 -> :22-36 (stale line-ref).
FILE 7 sleep-recovery-memory-l2.md -- `all` tu hardcode 9 -> DAN-XUAT TU DIA (do ra 10).
  Danh-sach cung 9 da ROT office-document (them S107) suot tu do. Tro-treu: chinh doc do
  da ghi "luon quet dia that" cho con-so 4/9 ngay duoi, nhung hardcode roster phia tren.
FILE 8 workflows/README.md -- TRI-ACCEPT vao ORPHAN-AUTHORITY (:19-20) + B1 pointer.
FILE 9 ACTIVE-MARKS.md -- chu-thich cho mark RC-...20-42-01 (anh CHOT: giu ban ky nguyen ven,
  them chu-thich; P4/P8). "roster 12" trong than mark = anh chup luc ky, KHONG phai gioi-han.

+ STATUS.md:25 -- STALE THAT trong chinh file CANONICAL: row ghi | Sub-agents | 14 | nhung
  narrative CUNG DONG ghi "ca 12 sub model: inherit" (W2 sua row, bo sot narrative).
  Bay mega-line TAI HIEN: grep -c = 1 vs grep -o|wc -l = 2.

+ spec v3-PATCH -- SUA ACCEPTANCE FIX#6 (ban goc BAT-KHA-THI, tien-le WAL:29):
  "0 hit song" do CA phan CO Y khop => implementation DUNG van truot. Lan thu BA cung ho
  R2-C1 (ls=14) + R3-M3 (TOTAL>=46). Acceptance moi = disposition TUNG DONG theo 6 nhom.
  Sweep that sau W3: 14 hit song, 0 cai la stale-can-va (vi-du co chu-dich / trich lich-su /
  ban da ky / so tam / W5 chua toi luot / canonical history-delta).

LEAD TU BAT 2 LOI DEM (deu o truc dem-ve-viec-minh, -> adap-report):
(a) bao "fable-real-runbook 8 hit" -- that la 14; lay output `head -40` DA BI CAT lam so tong.
(b) bao "do lai tai-hien CHINH XAC du-bao FIX#4" roi lay trung-khop lam cho dua, trong khi
    CA FIX#4 LAN LEAD deu dang do TEN FILE. Con-so dung, huong do sai.
=> khop feedback_meta_count_selfcoverage_blindspot: lead DO tot, lead DEM VE MINH thi sai.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-07-15 14:59:36 +07:00
parent dfa3daef05
commit 53765b0de3
8 changed files with 105 additions and 31 deletions

View File

@ -1,6 +1,9 @@
# Multi-agent SOLUTION_ERP — Master Coordination Guide (12-agent)
# Multi-agent SOLUTION_ERP — Master Coordination Guide
> **Architecture:** 12 sub-agents **all-inherit top-tier (Harness-8 2026-06-16 — thay thế two-tier Harness-4)** + em main **Fable 5 (1M) Max** coordinator — **10 product/quality** (7 core + frontend-designer pink S47 + database-agent read-advisory S52 + 📄 office-document S107) + **2 monitor INFORM-only** (`tooling-auditor` H1 + `harvest-curator` H2, 2026-06-07 Harness 1). Tier: **toàn bộ 12 sub `model: inherit`** (ăn top-tier model của lead — **runtime = per-session (Fable ↔ Opus, outage-driven; Fable DOWN → H5-fallback Opus tự-kích revert-free KHÔNG sửa frontmatter, Fable UP → tự về); lịch-sử flip-chain đầy-đủ (S98→nay) = 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 SỐNG, per-session KHÔNG steady-state) · effort **Max** (env machine-wide). SE KHÔNG có lớp helper/gopher rẻ (cả 12 đều substantive memory-bearing → cả 12 lên inherit). *(Trước H8: 4 promote inherit + 7 demote pin `claude-opus-4-8` — lịch sử ở Upgrade 2026-06-10 + S66 dưới.)*
> 🔴 **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.*
> **Architecture:** sub-agents **all-inherit top-tier (Harness-8 2026-06-16 — thay thế two-tier Harness-4)** + em main **lead frontier-class (anh chọn per-session)** coordinator — **10 product/quality** (7 core + frontend-designer pink S47 + database-agent read-advisory S52 + 📄 office-document S107) + **4 monitor INFORM-only** (`tooling-auditor` H1 + `harvest-curator` H2, 2026-06-07 Harness 1 · `lead-view-auditor` + `lead-omission-auditor` H24, **S121 W2**). Tier: **TOÀN BỘ sub `model: inherit`** (ăn top-tier model của lead — **runtime = per-session (Fable ↔ Opus, outage-driven; Fable DOWN → H5-fallback Opus tự-kích revert-free KHÔNG sửa frontmatter, Fable UP → tự về); lịch-sử flip-chain đầy-đủ (S98→nay) = 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 SỐNG, per-session KHÔNG steady-state) · effort **Max** (env machine-wide). SE KHÔNG có lớp helper/gopher rẻ (**mọi sub đều substantive memory-bearing → tất cả lên inherit**). *(Trước H8: 4 promote inherit + 7 demote pin `claude-opus-4-8` — lịch sử ở 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.
> **Upgrade S39 (2026-05-29):** 4→7 agent (split investigator + implementer, +test-specialist) + budget +50% + 5 RAG MCP per agent. Reference BVAAU 7-agent config (adapted, NOT copied — SOLUTION_ERP 2-FE-app fit + 6 skill proven battle-test 38 session). Prior: S20t12 initial 3 + S21t1 +cicd-monitor.
@ -19,20 +22,20 @@
---
## 🎯 Architecture (12 agent)
## 🎯 Architecture
> ⓘ **Diagram dưới = 7 core lane (pre-S47 snapshot).** Roster THẬT = **12 sub**: 7 core (diagram) + 🩷 frontend-designer (S47) + 🔵 database-agent (S52) + 📄 office-document (S107) + 🟫 tooling-auditor H1 + ⬜ harvest-curator H2 (2026-06-07 Harness 1) — xem skill matrix + decision tree + tool grant dưới. (Cosmetic ASCII chưa vẽ lại — tooling-auditor H1 sẽ 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-view-auditor + 🔶 lead-omission-auditor (**H24, S121 W2**) — 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.)
```
┌──────────────────────────────────────────────────────────────┐
│ EM (Main) — Fable 5 (1M) Max
│ EM (Main) — lead frontier-class (anh chọn per-session, 1M Max)
│ • Reasoning + write code (single-threaded principle) │
│ • Schema/UX/architecture decision + cross-stack tight coupling│
│ • Coordinate 12 sub-agents via spawn + SendMessage
│ • Coordinate TOÀN roster sub-agent via spawn + SendMessage │
│ • Synthesize cross-agent findings + commit/push (em main only)│
│ • Fallback solo nếu spawn fail (gotcha #53 truncate / 529) │
└──────────────────────────────────────────────────────────────┘
↓ spawn + keep-alive (Harness-8 all-inherit: cả 12 sub `model: inherit` = top-tier lead — Max; per-task tier:'opus' escape-hatch giữ)
↓ spawn + keep-alive (Harness-8 all-inherit: MỌI sub `model: inherit` = top-tier lead — Max; per-task tier:'opus' escape-hatch giữ)
── RESEARCH (READ) ────────── ── IMPLEMENT (WRITE) ──────────── ── QUALITY ──────────
┌──────────────────┐ ┌───────┐ ┌─────────────────┐ ┌──────────┐ ┌────────┐ ┌─────────┐ ┌────────┐
│investigator- │ │invest-│ │implementer- │ │implement-│ │test- │ │reviewer │ │cicd- │
@ -168,7 +171,7 @@
## 🔧 Tool grant (S39 — +3 RAG MCP per agent)
All 12 agent**4 RAG-READ MCP**: `search_memory` + `search_code` (BM25, prefer over Read full file — tiết kiệm token) + `cross_project_search` + `list_projects`. Base tools per role (READ: Read/Grep/Glob/Bash [+WebFetch/Search cho api] · WRITE: +Edit/Write/Skill).
MỌI agent trong roster**4 RAG-READ MCP**: `search_memory` + `search_code` (BM25, prefer over Read full file — tiết kiệm token) + `cross_project_search` + `list_projects`. Base tools per role (READ: Read/Grep/Glob/Bash [+WebFetch/Search cho api] · WRITE: +Edit/Write/Skill).
> **2 monitor sub (tooling-auditor H1 + harvest-curator H2 — 2026-06-07):** read-only toolset = `[Read, Grep, Glob, Bash, +4 RAG-read]`, **NO `store_memory`, NO Write/Edit** (mirror investigator read-set). INFORM-only — propose → em main single-writer VERIFY→APPEND (B3). 🔴 **G-015 accuracy (Harness-10 run-trace model, `runs/README.md §Containment` — 🧊 `_ledger.md` retired H18-B S100):** run-folder `runs/<run-id>/` được git **TRACKED** → mọi write HIỆN trong git-diff = audit trực-tiếp. Containment: tracked-change NGOÀI `runs/<run-id>/` VÀ NGOÀI code-disjoint đã giao = vi-phạm (thay model Harness-2 B6 "mọi tracked-change = vi-phạm"). G-015 no-overclaim: TRACKED ≠ read-only-enforced — sub vẫn giữ `Bash` (write-channel mở qua shell/curl) → containment THẬT = em main single-writer + git-diff(in-repo) + chunk-count (RAG), KHÔNG allowlist đơn-độc.
@ -205,7 +208,9 @@ All 12 agent có **4 RAG-READ MCP**: `search_memory` + `search_code` (BM25, pref
- **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 (12 — whitelist `hmw.js`, đủ roster):** `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; monitor vẫn INFORM-only, lane RETURN-only). Role lạ ∉ VALID_ROLES → `hmw.js` THROW (STOP-HARD) + báo owner (S4c, DIRECTED REC-3 2026-07-13); role-less null → inherit lead.
- **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)**. 🔸 **Cả 4 monitor vẫn INFORM-only, lane RETURN-only** (propose-only, KHÔNG Write/Edit). 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)`).
- ⚠️ **Đổ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").
> Floor T/S/M/R đầy đủ → `.claude/commands/ultra-on.md`. adap-report → `docs/governance/adap-reports/2026-06-03-Agent-ultracode-hmw-mem-governance.md`.