[CLAUDE] Infra: adopt AI_INFRA Harness 1/2/3 — monitor subs (roster 8->10) + wave-folder isolation + email channel (S49)
Harness 1 (Self-observability): NEW tooling-auditor (H1 tooling/docs-freshness 4-faceted) + harvest-curator (H2 harvest-integrity 5-axis) INFORM-only monitor subs, TACH BIET per anh-mandate -> roster 8->10. Wire session-start Phase 2.1.1 RE-REPORT + session-end L.b 6->7-step (H2 5-axis GATE + H1 chot + B5 wave-gom). H3 plugin/skill = gop-vai doc, 0 new agent. Harness 2 (wave-folder isolation): hmw.js WAVE-MODE (subMdPath + tool-aware writeGuard) + .gitignore wave-*/ + agent-teams/ (B6 git-check-ignore verified) + NEW workflows/README convention. Harness 3 (email channel): broadcasts/ (6+6 folder + 13 .gitkeep + _index + inbox/README, committed) + send/check-email cmd (self=se) + adap-apply base-path fix outbox/all/. HMW-mode ON: recon fan-out 4 read-only agent -> em main single-writer WRITE -> reviewer PASS all 3. Containment: git-diff 1 benign self-MEMORY + chunk-count 2414=2414 (0 RAG-write). Nac executed-file, verified-runtime PENDING CLI restart. 3 adap-reports + session log. Test 181 unchanged (no product code). CI runs (hmw.js/.gitignore/.gitkeep not path-ignored) but no bundle/migration change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
26
.claude/agent-memory/harvest-curator/MEMORY.md
Normal file
26
.claude/agent-memory/harvest-curator/MEMORY.md
Normal file
@ -0,0 +1,26 @@
|
||||
# Harvest-Curator Agent — Persistent Memory
|
||||
|
||||
> **Persistent diary cross-session.** Auto-injected first ~200 lines at spawn (L1 HOT).
|
||||
> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars.
|
||||
> **NEW agent 2026-06-07** (adopt AI_INFRA Harness 1 — H2 harvest-integrity; TÁCH khỏi tooling-auditor H1 per anh-mandate "H1/H2 hay quên+nhầm → riêng-biệt").
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Role baseline
|
||||
H2 harvest-MD-integrity auditor **SOLUTION_ERP-self**. Read-only + **propose-only** (em main = single-writer, VERIFY→APPEND B3). Tools: Read/Grep/Glob/Bash + 4 RAG-read. NO `store_memory`, NO Write/Edit. Verify HARVEST mỗi session ĐỦ+ĐÚNG **5-trục**: Coverage · Completeness · Fidelity-FLAG · Placement · Corruption. @session-end GATE trước đóng + gom wave-folder (Harness 2 B5); @session-start báo harvest mới + delta mồ-côi.
|
||||
|
||||
## 🚫 Split boundary
|
||||
- ✅ MINE: harvest-memory integrity (5-trục) + spawn-record 4-field + wave-folder gom (B5) + delta mồ-côi — SOLUTION_ERP-self
|
||||
- ❌ NOT: tooling/skill/plugin/docs-freshness → **tooling-auditor** (H1) · corpus/RAG/deploy → cicd-monitor · Fidelity tự-phán "bịa" → escalate **reviewer** · write/decide → em main
|
||||
|
||||
## 📋 Baseline state (2026-06-07 seed)
|
||||
- **Nền H2 đã có 1 phần:** `session-end.md` Phase 1.5 §L.b(d) spawn-record 4-field + (f) double-check moved-not-cut + (c) 0-byte AS-8 = **3/5 trục** (Coverage+Completeness+Corruption). Sub này NÂNG +Fidelity-escalate +Placement = đủ 5.
|
||||
- **Spawn-record 4-field SE:** `{task · verdict · learned · surprise}` (memoryDelta R1 contract HMW).
|
||||
- **agent-memory:** 10 folder `.claude/agent-memory/<role>/MEMORY.md` (placement target).
|
||||
- **Wave-folder (Harness 2):** `.claude/workflows/wave-<tên>/sub-*.md` (gitignored) — gom @B5.
|
||||
|
||||
## ⚠️ Anti-patterns
|
||||
❌ Tự ghi/overwrite memory (propose→em main APPEND) · ❌ tự phán Fidelity "bịa" (→ reviewer) · ❌ tick "đã flush?" nhị-phân (phải đủ 5-trục) · ❌ đụng tooling-freshness (đó là tooling-auditor) · ❌ G-015 overclaim "read-only enforced".
|
||||
|
||||
## 📅 Recent activity (FIFO — older → archive/git)
|
||||
- **2026-06-07 (CREATED):** Seeded H2 harvest-curator (adopt AI_INFRA Harness 1, anh giao). Tailored SE: 4 RAG-read · `model:inherit` · omit color · Fidelity-escalate → SE `reviewer` (KHÔNG AI_INFRA-specific). Wired @session-end §L.b GATE (nâng 3/5→5/5 trục) + @session-start RE-REPORT harvest-mới (Phase 2.1.1) + Harness 2 B5 wave-gom. Nấc: **executed-file, verified-runtime PENDING** CLI restart + first spawn smoke. Tag [created, harness-1, h2].
|
||||
@ -30,6 +30,7 @@ Read-only EXTERNAL research specialist. WebFetch/WebSearch official docs + NuGet
|
||||
|
||||
- **2026-05-29 (S39 agent split setup):** NEW agent created từ split investigator. Seeded external-research half. Prior cross-project audits (NamGroup Phase 10 port G-H1/G-O2 + FullCalendar eval S36 + BVAAU 7-agent config S39) absorbed into role baseline.
|
||||
- **2026-05-29 (S40 FIRST SPAWN — smoke-verify + RAG fleet report):** Agent load OK confirmed. `list_projects` → 7 project, total **39,798 chunks**. Rerank pipeline LIVE verdict **PASS** (search_memory scope=self use_rerank=true → top rerank_score **0.8789**, 3 results all carry rerank_score). Staleness >5d (vs 05-29): dh_y_duoc (05-23, 6d) / namgroup_main (05-22, 7d) / ashico_erp (05-22, 7d). solution_erp 05-28 fresh-ish but missing S37-S39 content. `shared_global` = 0 chunks (chưa promote pattern nào). MINOR drift: namgroup_main actual 11306 (brief said 11305). vipix_ai_infra (1652) = AI_INFRA hub root `D:\...\AI_INFRA`. No re-ingest performed (report-only).
|
||||
- **2026-06-07 (Harness 1 H3 — plugin/skill adoption audit):** Browsed marketplace `claude-plugins-official` (full marketplace.json ~200+ plugin; local folder 35). Enabled user-global (`~/.claude/settings.json`) = **15 plugin**. **KEY surprise:** `sql-database-assistant` + `frontend-design` + `skill-creator` + `code-reviewer` exist as **standalone user-global skills** at `~/.claude/skills/` (auto-available every project — NO plugin enable needed). `~/.claude/skills/` has 23 standalone skills. Value-locus verdict: frontend-design=skill-only (clean); code-modernization=**agent-bearing** (5 agent incl security-auditor/test-engineer + 7 cmd — NOT skill-only); pr-review-toolkit + feature-dev = agent-bearing, BOTH ship agent `code-reviewer` → **name-collision** ×2 + collides roster `reviewer.md`. csharp-lsp = **Windows no-op** (`csharp-ls` NOT on PATH, needs `dotnet tool install`). code-review = command-only, gh-CLI based → partial no-op (project = Gitea not GitHub). session-report = node `.mjs` (Win-OK, Node 20). Roster ACTUAL = 8 agent (cicd-monitor/frontend-designer/implementer-backend|frontend/investigator-api|codebase/reviewer/test-specialist); "8→10" = planned H1 tooling-auditor + H2 harvest-curator. Recommend: GỘP skill vào sub hiện-có, KHÔNG enable agent-bearing plugin (roster đủ). Report-only.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@ -70,6 +70,8 @@ Bearer từ `POST api.solutions.com.vn/api/auth/login` → status matrix expecte
|
||||
|
||||
## 📅 Recent activity (FIFO — older → archive/git)
|
||||
|
||||
- **2026-06-07 (Harness 1/2/3 adap-apply recon — 3 slice, HMW wave):** Governance recon AI_INFRA broadcast harness-1/2/3. **H1/H2 (Harness 1):** roster 8→10 — CREATE 2 sub TÁCH BIỆT `tooling-auditor` (H1 freshness 4-mặt skill/sub-role/plugin/docs) + `harvest-curator` (H2 integrity 5-trục). H2 PARTIAL sẵn: `session-end.md` Phase 1.5 §L.b(d) spawn-record 4-field + (f) double-check moved-not-cut + (c) 0-byte AS-8 = Coverage+Completeness+Corruption (3/5); THIẾU Fidelity-escalate + Placement. RE-REPORT @session-start = 0 (chỉ generic Phase 2.7). 2 sub mirror inv-codebase read-set + store_memory strip + NO Write/Edit; color brown+teal (8 màu cũ hết). **H2 wave (Harness 2):** SE `hmw.js` = OLD pre-wave (no subMdPath/writeGuard/wave-block); AI_INFRA `hmw.js` = canonical template. ⭐ `git check-ignore -v` = ground-truth B6: `.claude/workflows/wave-test/wave.md` HIỆN match `.gitignore:83 !.claude/**` = TRACKED → wave pattern PHẢI đặt AFTER `!.claude/**` (last-match-wins, mẫu `hmw-mode.on` :87). Read-only sub (4)=inv-cb/inv-api/reviewer/cicd; Write sub (4)=impl×2/test/fe-designer. B5 depends H2 harvest-curator. **H3 email (Harness 3):** broadcasts/ absent; id authoritative = `se` (NOT solution_erp), 6 others short `{ai_infra,vipix,dyd,namgroup,ashico,bvaau}` từ `AI_INFRA/broadcasts/sister-commands/send-email.md:13-22` (folder name = 2nd source-truth); `adap-apply.md:14` base-path STALE flat → `outbox/all/*.md` (latent bug). broadcasts/ ở root → commit OK (no gitignore rule). **Containment post-P2:** git-diff bắt 1 file-write (inv-api self-MEMORY), chunk-count 2414=2414 (0 RAG-write) = defense-in-depth proven. Tag [harness-recon, governance, hmw-wave, 2026-06-07].
|
||||
|
||||
- **2026-06-01 (P11-C Vehicle+Driver catalog pre-flight):** Mig 44 next (latest=Mig 43 `FilterHolidayUniqueIndexByIsDeleted` S45). **NO Vehicle/Driver master exists** — chỉ `Office/VehicleBooking.cs` (request, Mig 39) dùng FREE-TEXT (`VehicleLicense`/`VehicleName`/`DriverName?` strings, :13-19 comment "defer catalog Phase 11"). **RECOMMEND home = extend HrmConfigs** (NOT new module): `Application/Hrm/HrmConfigFeatures.cs` mega 4-region + `HrmConfigsController` (`[Authorize]` read / `[Authorize(Roles="Admin")]` write) — add Region 5 Vehicle + 6 Driver (kind `vehicles`/`drivers`), pattern proven 12-bis. ⚠️ HRM entities KHÔNG global HasQueryFilter → manual `.Where(!IsDeleted)` + UNIQUE soft-delete cần `.HasFilter("[IsDeleted]=0")` (Holiday Mig 43 lesson, LeaveType/Shift UNIQUE Code chưa có filter → nếu Vehicle BienSo UNIQUE phải add filter). **FE cheap:** `HrmConfigsPage.tsx` declarative KIND_CONFIG Record — add 2 entry vào KIND_CONFIG + KINDS[] + `renderCells` branch + smart-defaults; NO new page. **Menu+perm:** add 6 const `MenuKeys.cs` (+`Hrm_Config_Vehicles/Drivers`), thêm vào `All[]` (:140) → Admin auto-grant qua `SeedAdminPermissionsAsync` loop (:1909 idempotent), +2 MenuItem `DbInitializer` :1757, +2 `menuKeys.ts` mirror. Hrm_Config KHÔNG inherit-root (4 root=Contracts/Workflows/Pe/PeWf only) → leaf cần row riêng (loop lo). **Fields (NamGroup XeCong DROPPED Mig 2026-05-15, ref response shape only):** Vehicle{Code/BienSo UNIQUE, Hang, MauXe, SoCho int, TrangThai, GhiChu}; Driver{Code/Hoten, SDT, GPLX, Hang bằng, TrangThai}. FK link defer: P11-C = catalog only, optional FK `VehicleBooking.VehicleId?/DriverId?` giữ free-text back-compat (Mig sau). Tag `[pre-flight, p11-c, vehicle-driver-catalog]`.
|
||||
- **2026-06-01 (MONTHLY DRIFT AUDIT):** Ground truth code: **migrations=42** (last `AddLeaveBalances`, path `.../Persistence/Migrations/*.cs`) · **gotchas highest=#56** (file header NO self-count → drift chỉ ở file *reference* gotchas.md) · tests=154 (58 Domain+96 Infra, em main verified) · tables≈91 (45 config class nhưng Catalogs=4+ContractDetails=7+7 Identity untracked → khớp STATUS 91, KHÔNG cheap-exact). **Biggest drift: ef-core-migration SKILL** (frontmatter:3 "31 migration"→42, :19 history "31"→42 + thiếu rows Mig 27-42, :50 "59 bảng"→91, :80 "111 test"→154, :258/:267 "59 bảng"). dependency-audit SKILL:153 "49 bẫy"→56. CLAUDE.md:53 "40 mig→84 bảng"→42/91, :66 "130 test"→154, :133 "52 bẫy"→56. docs/CLAUDE.md:65 "52"→56. **schema-diagram GAP:** migration TABLE dừng Mig 16 (line 487); detail § cuối =§15=Mig 26 (§16=Related KHÔNG phải mig) → thiếu § cho **Mig 27-42** (16 mig). database-guide:4 "47 bảng/13 mig"→91/42. STATUS:97 backlog "Curate 4 agent MEMORY 35.7/35.3/30.9/28.4" STALE (đã curate S40 `78c9de3`, all ≤16KB) → REMOVE. NO-CHANGE: contract-workflow (historical counts OK), form-engine, iis-deploy (no count), HANDOFF (S43 current), PROJECT-MAP (no count). Tag `[drift-audit, monthly, 2026-06]`.
|
||||
- **2026-05-30 (P11-A WorkflowApps wire pre-flight):** 4 module Leave/OT/Travel/Vehicle. Schema pin ĐÃ CÓ SẴN (Mig 39): `Office/{Module}.cs` đều có `ApprovalWorkflowId?`+`CurrentApprovalLevelOrder?`+`WorkflowAppStatus` (5-state khớp ProposalStatus). SKELETON tại `Application/Office/WorkflowAppsFeatures.cs:11-15` (chỉ Create+List, KHÔNG Approve/Reject/Return/GetById). **Proposal = mirror HOÀN HẢO** (cùng Office ns, Mig 38): `ProposalFeatures.cs:403-486` ApproveHandler = flatten `Steps.OrderBy(Order).SelectMany(Levels.OrderBy(Order))` global level index → `allLevels[CurrentApprovalLevelOrder-1]` → actor match `Level.ApproverUserId==uid||Admin` → UPSERT LevelOpinion → advance++/DaDuyet. ⚠️ `ApprovalWorkflow.cs:72` nói Level **KHÔNG OR-of-N** (1 ApproverUserId/Level) — KHÁC memory cũ "OR-of-N", verify lại. Gap: 4 bảng `{Module}LevelOpinion` mới (Mig 41+), 3 route/controller, 4 seed WF, FE Detail+Opinion (chỉ có WorkflowAppsListPage chung). ⚠️ enum `ApplicableType` THIẾU Travel (có Leave=5/OT=6/Vehicle=7/ItTicket=8); `ExtendApplicableTypeForWorkflowApps` mig empty Up/Down (enum-only). Tag `[pre-flight, p11-a, workflowapps]`.
|
||||
|
||||
@ -57,6 +57,8 @@ Adversarial pre-commit reviewer SOLUTION_ERP. Read-only verify + live curl prod
|
||||
|
||||
## 📅 Recent activity (FIFO — older → archive/git)
|
||||
|
||||
- **2026-06-07 (S49 Harness 1/2/3 adopt pre-commit — PASS all 3, no blocker):** Governance/infra adopt (no product code, no test impact). VERIFIED: H1/H2 = 2 sub scope-DISJOINT + tools `[Read,Grep,Glob,Bash+4RAG]` NO store_memory/Write (INFORM-only); genuinely **TAILORED not copy-paste** (SE 4-RAG vs AI_INFRA 2-RAG · dropped effort:max + agent-ops-monitor/sister · Fidelity→SE `reviewer`). H2 5-trục in harvest-curator.md + session-end §L.b(f). H2 wave-mode hmw.js mirror AI_INFRA + **B6 `git check-ignore` VERIFIED** (wave-*/+agent-teams/ ignored · hmw.js/README tracked). H3 self=`se` complete substitution · **SHA256 canonical formula byte-identical send==check** · 13 .gitkeep exact · adap-apply base-path `outbox\all\`. honest nấc executed-file/verified-runtime-PENDING. G-015 scan = 6 hits ALL negating ("KHÔNG enforced") = correct honesty. **1 MINOR (non-block):** README:11/18 "7-agent" ASCII diagram = **PRE-EXISTING** drift (git diff proved work này chỉ touch load-bearing title/decision-tree/tool-grant/matrix; diagram predates S47 frontend-designer) → tooling-auditor H1 designed-to-catch = self-validating adoption. **learned:** `git diff base..head` = discriminator introduced-defect vs pre-existing-drift (đừng đổ lỗi work mới cho drift cũ); name-collision tailor-verify = diff frontmatter AI_INFRA-canonical vs SE-instance. **surprise:** mojibake scan false-pos trên "ĐÃ" (U+00C3 = valid VN uppercase, KHÔNG double-encode → verify codepoint in-context trước flag); broadcast floor "12 .gitkeep" UNDERCOUNT (correct=13 incl `all/` adap-channel — em main đúng). Verdict PASS, safe commit + restart. Tag [s49, harness-adopt, governance, max-clean].
|
||||
|
||||
- **2026-05-30 (S43 P11-B LeaveBalance pre-commit — PASS, Max no-truncate):** 14 file (LeaveBalance entity+config+Mig42 + Features + Controller + deduction hook + Create/Update LeaveType guard + embed balance + FE×4 + tests). 154 PASS (130→154). **Deduction exactly-once VERIFIED** (terminal else only, guard Status!=DaGuiDuyet chặn re-approve; advance/reject/return no-deduct). **FK invariant fully closed** — grep 2 write site LeaveTypeId (Create + UpdateDraft) cả 2 guard AnyAsync→Conflict, bogus type không thể tới terminal FK insert. Embed balance = RequesterUserId (approver thấy đúng người tạo). admin `[Authorize(Roles=Admin)]`. **2 MINOR defer:** concurrency lost-update UsedDays (no RowVersion — human-sequential accept) · stale line-num comment. Verdict PASS. Tag `[s43, p11b-leavebalance, max-clean]`.
|
||||
- **2026-05-28 (S35 G-H2 BE CRUD 16 endpoint pre-commit — PASS, Smart Friend 8× CLEAN):** 2 NEW file `HrmConfigFeatures.cs` 439 + Controller 137. build clean, 130/130 PASS. Cat1: 0 mock, 8 ConflictException (Holiday Update composite `(Year,Date)` BOTH fields). Cat3: class `[Authorize]` + 12 per-action `[Authorize(Roles="Admin")]`. Cat5: 8 Validator MaxLength MATCH EF source (Code=50 not spec 20). **2 MINOR defer:** ListHolidays no IsActive filter (inconsistent sibling) · OtPolicy "1 active unique" NOT enforced handler (G-P1 ambiguous nếu 2+ active). Verdict PASS. Tag `[s35, smart-friend-8x-clean]`.
|
||||
- **2026-05-26 (S33 Plan B G-H1 Phase 2 pre-commit — PASS, Smart Friend 6× CLEAN):** 17 file (3 BE + 6 FE new + 6 mod + 2). SHA256 mirror 3 file IDENTICAL admin==user. 5 endpoint real mediator.Send 0 mock. Mig 34 `AddEmployeeProfiles` 7 table UNIQUE indexes + FK Cascade. SeedDemoEmployeeProfiles NOT gated DemoSeed (gotcha #51 ✓). gotcha #50 Layout staticMap mirror ✓. **3 MINOR defer:** EmployeeCode race SERIALIZABLE low-risk · Update 3 bool not nullable (partial reset) · Delete DateTime.UtcNow direct. Verdict PASS. Tag `[s33, hrm-mig34, smart-friend-6x]`.
|
||||
|
||||
26
.claude/agent-memory/tooling-auditor/MEMORY.md
Normal file
26
.claude/agent-memory/tooling-auditor/MEMORY.md
Normal file
@ -0,0 +1,26 @@
|
||||
# Tooling-Auditor Agent — Persistent Memory
|
||||
|
||||
> **Persistent diary cross-session.** Auto-injected first ~200 lines at spawn (L1 HOT).
|
||||
> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars.
|
||||
> **NEW agent 2026-06-07** (adopt AI_INFRA Harness 1 — H1 tooling-freshness; TÁCH khỏi harvest-curator H2 per anh-mandate "H1/H2 hay quên+nhầm → riêng-biệt").
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Role baseline
|
||||
H1 tooling-freshness auditor **SOLUTION_ERP-self**. Read-only + **propose-only** (em main = single-writer). Tools: Read/Grep/Glob/Bash + 4 RAG-read. NO `store_memory`, NO Write/Edit. Audit **4-mặt** mỗi session: skill · sub-role · plugin · docs — đầy-đủ + kịp-thời. @session-start báo state + diff-vs-last; @session-end chốt + new-alloc audit.
|
||||
|
||||
## 🚫 Split boundary
|
||||
- ✅ MINE: tooling/docs freshness (4-mặt) + roster-drift + skill/plugin new-alloc — SOLUTION_ERP-self
|
||||
- ❌ NOT: harvest-memory/5-trục → **harvest-curator** (H2) · corpus/RAG/deploy → cicd-monitor · code/SQL audit → investigator-codebase · write/decide → em main
|
||||
|
||||
## 📋 Baseline state (2026-06-07 seed — VERIFY mỗi session, đừng tin số cũ)
|
||||
- **Roster:** 10 sub (8 product/quality: investigator-codebase/api · implementer-backend/frontend · test-specialist · reviewer · cicd-monitor · frontend-designer + 2 monitor INFORM-only: tooling-auditor · harvest-curator).
|
||||
- **Skills:** 6 project (`.claude/skills/`) + ~23 standalone (`~/.claude/skills/`, vd sql-database-assistant).
|
||||
- **Plugins:** 15 enabled user-global (`~/.claude/settings.json`) — nấc installed/enabled, phần lớn CHƯA assigned-to-roster.
|
||||
- **Docs canonical:** `CLAUDE.md` (root+docs) · `docs/STATUS.md` · `docs/HANDOFF.md` · `.claude/agents/README.md` · `docs/governance/`.
|
||||
|
||||
## ⚠️ Anti-patterns
|
||||
❌ Tự sửa config/doc/enable-plugin (propose-only) · ❌ conflate plugin "enabled"="used" · ❌ tick-checkbox no-evidence · ❌ đụng harvest-memory (đó là harvest-curator) · ❌ G-015 overclaim "read-only enforced" (Bash residual = write-channel mở).
|
||||
|
||||
## 📅 Recent activity (FIFO — older → archive/git)
|
||||
- **2026-06-07 (CREATED):** Seeded H1 tooling-auditor (adopt AI_INFRA Harness 1, anh giao). Tailored SE: 4 RAG-read (KHÔNG copy AI_INFRA 2-RAG) · `model:inherit` (KHÔNG effort:max) · omit color (8 màu chuẩn cyan/blue/yellow/orange/purple/red/green/pink đã hết). Wired @session-start RE-REPORT (Phase 2.1.1) + @session-end H1 chốt. Nấc: **executed-file, verified-runtime PENDING** CLI restart + first spawn smoke. Tag [created, harness-1, h1].
|
||||
@ -1,20 +1,23 @@
|
||||
# Multi-agent SOLUTION_ERP — Master Coordination Guide (7-agent)
|
||||
# Multi-agent SOLUTION_ERP — Master Coordination Guide (10-agent)
|
||||
|
||||
> **Architecture:** 8 sub-agents Opus 4.8 1M Max + em main coordinator (7 core + frontend-designer pink, S47).
|
||||
> **Architecture:** 10 sub-agents Opus 4.8 1M Max + em main coordinator — **8 product/quality** (7 core + frontend-designer pink, S47) + **2 monitor INFORM-only** (`tooling-auditor` H1 + `harvest-curator` H2, 2026-06-07 Harness 1).
|
||||
> 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.
|
||||
> **Upgrade S47 (2026-06-02):** **+frontend-designer (8th sub, pink)** — FD1–FD10 visual-verification design floor (forked AI_INFRA canonical, broadcast `Agent-frontend-designer-floor`). + **`store_memory` STRIPPED khỏi MỌI sub → lead = sole RAG-writer** (broadcast `Memory-store-memory-strip-global`); sub ghi finding → MEMORY.md (file). adap-reports: `docs/governance/adap-reports/`.
|
||||
> **Upgrade 2026-06-07 (Harness 1·2·3 adopt — AI_INFRA broadcast):** **+2 monitor sub INFORM-only** `tooling-auditor` (H1 tooling/docs-freshness 4-mặt) + `harvest-curator` (H2 harvest-integrity 5-trục) → roster 8→10, **TÁCH BIỆT** per anh-mandate (H1≠H2 "hay quên+nhầm"). + **wave-folder memory-isolation** (Harness 2 — `hmw.js` wave-mode + `.claude/workflows/wave-*/` gitignored, B1–B6). + **email channel** `broadcasts/` (Harness 3 — cross-project comms, self-id=`se`). KHÔNG copy-paste AI_INFRA — tailor SE roster/stack.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Architecture (7 agent)
|
||||
## 🎯 Architecture (10 agent)
|
||||
|
||||
> ⓘ **Diagram dưới = 7 core lane (pre-S47 snapshot).** Roster THẬT = **10 sub**: 7 core (diagram) + 🩷 frontend-designer (S47) + 🟫 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.)
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────┐
|
||||
│ EM (Main) — Opus 4.8 1M Max │
|
||||
│ • Reasoning + write code (single-threaded principle) │
|
||||
│ • Schema/UX/architecture decision + cross-stack tight coupling│
|
||||
│ • Coordinate 7 sub-agents via spawn + SendMessage │
|
||||
│ • Coordinate 10 sub-agents via spawn + SendMessage │
|
||||
│ • Synthesize cross-agent findings + commit/push (em main only)│
|
||||
│ • Fallback solo nếu spawn fail (gotcha #53 truncate / 529) │
|
||||
└──────────────────────────────────────────────────────────────┘
|
||||
@ -91,6 +94,12 @@
|
||||
├── Adversarial pre-commit / heavy diff / wire BE claim / security?
|
||||
│ → reviewer (red) — Smart Friend 5-category + live curl
|
||||
│
|
||||
├── @session-start/@session-end TOOLING-FRESHNESS audit (skill·sub-role·plugin·docs 4-mặt + drift)?
|
||||
│ → tooling-auditor (H1 monitor, INFORM-only) — báo state+diff @start · chốt+new-alloc @end · em main APPEND
|
||||
│
|
||||
├── @session-end HARVEST-INTEGRITY gate (5-trục Coverage/Completeness/Fidelity/Placement/Corruption) / wave-folder gom (Harness 2 B5) / @session-start harvest mới?
|
||||
│ → harvest-curator (H2 monitor, INFORM-only) — propose delta · em main single-writer VERIFY→APPEND · Fidelity nghi → reviewer
|
||||
│
|
||||
├── Quick task < 30 min? → Em solo direct
|
||||
│
|
||||
└── Schema/UX/architecture/cross-stack tight/bug reasoning chain?
|
||||
@ -130,15 +139,40 @@
|
||||
| reviewer | `dependency-audit-erp` + `contract-workflow` + `permission-matrix` |
|
||||
| cicd-monitor | `iis-deploy-runbook` + `dependency-audit-erp` + `ef-core-migration` |
|
||||
| frontend-designer | `frontend-design` + `senior-frontend` + `brand-guidelines` + `theme-factory` + `webapp-testing` (FD2 loop) + `web-artifacts-builder` |
|
||||
| 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` |
|
||||
|
||||
## 🔧 Tool grant (S39 — +3 RAG MCP per agent)
|
||||
|
||||
All 7 agent có **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).
|
||||
All 10 agent có **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:** đây KHÔNG = "read-only enforced" — sub vẫn giữ `Bash` (write-channel mở qua shell/curl). Containment thật = em main single-writer + **git-diff + chunk-count post-session** (defense-in-depth), KHÔNG allowlist đơn-độc.
|
||||
|
||||
> ⚠️ **`store_memory` GỠ khỏi MỌI sub (2026-06-02 — AI_INFRA broadcast `Memory-store-memory-strip-global`, adap-report cùng id).** → **lead (em main) = sole RAG-writer** (mechanized failure-safe: sub vật-lý không gọi được `store_memory`). Sub tìm thấy finding/pattern mới → ghi **MEMORY.md** (file); lead + re-index đưa vào RAG. *Accuracy (G-015): đây KHÔNG = sub "read-only" — sub vẫn giữ `Bash` (+ vai write giữ `Write/Edit`); containment thật = defense-in-depth git-diff + Qdrant chunk-count, chưa phải allowlist đơn độc.*
|
||||
|
||||
---
|
||||
|
||||
## 🔌 External skill/plugin mapping (H3 — Harness 1 adopt 2026-06-07)
|
||||
|
||||
> Floor H3: nạp đúng skill/plugin hợp stack, **gộp-vai KHÔNG phình roster**. Audit (investigator-api 2026-06-07): 15 plugin enabled user-global (`~/.claude/settings.json`) + ~23 standalone skill (`~/.claude/skills/`). **0 agent mới** — mọi cái = skill→gộp-vai-hiện-có. Nấc: enabled/available → **assigned** (bảng dưới = doc) → used (per-session auto-trigger). tooling-auditor (H1) rà new-alloc mỗi session-end.
|
||||
|
||||
| Skill/plugin (nguồn) | Value-locus | Map → vai | Ghi chú |
|
||||
|---|---|---|---|
|
||||
| `sql-database-assistant` (standalone) | skill-only | investigator-codebase + implementer-backend | SQL/EF query; đọc kèm `ef-core-migration` (KHÔNG override pin EF Core 10 / dbo single-schema) |
|
||||
| `frontend-design` (standalone, KHÔNG enable plugin trùng) | skill-only | frontend-designer | duplicate plugin↔standalone → chọn standalone |
|
||||
| `skill-creator` | skill-only | mọi sub (khi tạo skill project) | additive |
|
||||
| `claude-md-management` (`claude-md-improver`) | skill+cmd | em main | doc-maintenance |
|
||||
| `pr-review-toolkit` (silent-failure-hunter / type-design-analyzer / comment-analyzer / pr-test-analyzer) | agent-bearing | reviewer (tham-chiếu .md như CHECKLIST, KHÔNG enable agent) | giữ roster `reviewer` canonical |
|
||||
| `session-report` (node `.mjs`, Win-OK Node 20) | skill-only | em main / cicd-monitor | optional — token/spawn-cost observability |
|
||||
|
||||
**🔴 KHÔNG enable (tránh phình roster + name-collision — H3.3):**
|
||||
- `code-modernization` (5 agent: legacy-analyst/security-auditor/test-engineer…) — SE = .NET 10 greenfield, agent-set trùng test-specialist/reviewer/investigator. Chỉ cmd `modernize-assess/map` ad-hoc khi port NamGroup module.
|
||||
- `code-reviewer` (×3 nguồn: pr-review-toolkit + feature-dev + standalone skill) collide roster `reviewer` → **giữ `reviewer` canonical**, KHÔNG dùng plugin code-reviewer.
|
||||
- `csharp-lsp` — **Windows no-op** (`csharp-ls` không trên PATH; cần `dotnet tool install --global csharp-ls` trước). Defer (Bash dotnet build + grep symbol đủ).
|
||||
- `commit-commands/commit-push-pr` — giả định GitHub `gh`; SE = Gitea → partial no-op (chỉ `commit.md` dùng được).
|
||||
|
||||
---
|
||||
|
||||
## 🚦 HMW-mode — Workflow fan-out governance (S49, broadcast `ultracode-hmw-mem-governance`)
|
||||
|
||||
> Áp dụng KHI chạy **Workflow runtime fan-out** (`.claude/workflows/hmw.js`). Vận hành thường (Agent-tool spawn lẻ / parallel-trong-1-message) KHÔNG đổi — decision-tree trên vẫn chuẩn. Toggle: `/ultra-on` · `/ultra-off`.
|
||||
|
||||
54
.claude/agents/harvest-curator.md
Normal file
54
.claude/agents/harvest-curator.md
Normal file
@ -0,0 +1,54 @@
|
||||
---
|
||||
name: harvest-curator
|
||||
description: |
|
||||
Read-only INFORM-only HARVEST-MD-INTEGRITY auditor cho SOLUTION_ERP (H2 — adopt AI_INFRA Harness 1, anh giao 2026-06-07; TÁCH BIỆT khỏi tooling-auditor H1 vì 2 việc hay quên+nhầm khi gộp). Verify HARVEST mỗi session ĐỦ + ĐÚNG: quét agent-memory mọi sub đã spawn + wave-folder workflow (Harness 2 B5) + agent-team → đề-xuất spawn-record 4-field + chạy harvest-integrity 5-trục (Coverage·Completeness·Fidelity-flag·Placement·Corruption). Lifecycle: @session-end HỖ TRỢ em main HARVEST (gom delta sub/wave/team → propose APPEND vào agent-memory sub tương-ứng + 5-trục GATE trước đóng + flag chore); @session-start BÁO harvest-MD MỚI + delta mồ-côi chưa-APPEND. Propose-only — em main single-writer (VERIFY→APPEND B3 no-overwrite-unverified). KHÔNG tooling/skill/plugin/docs-freshness (đó là tooling-auditor H1). KHÔNG store_memory. PHẢI dùng khi harvest agent-memory/wave-folder cuối session hoặc verify harvest-integrity.
|
||||
model: inherit
|
||||
tools: [Read, Grep, Glob, Bash, mcp__rag-unified__search_memory, mcp__rag-unified__search_code, mcp__rag-unified__cross_project_search, mcp__rag-unified__list_projects]
|
||||
memory: project
|
||||
maxTurns: 18
|
||||
---
|
||||
|
||||
# Harvest-Curator — SOLUTION_ERP (H2 harvest-MD integrity, read-only INFORM-only)
|
||||
|
||||
> Verify HARVEST mỗi session ĐỦ + ĐÚNG, hỗ trợ em main gom memory về sub-agent tương-ứng. **Read-only · propose-only.** Em main = single-writer. Adopt AI_INFRA Harness 1 (anh giao 2026-06-07) — TÁCH khỏi `tooling-auditor` (H1): H2≠H1, "hay quên+nhầm" → riêng-biệt. KHÔNG copy: tailor SE (4 RAG-read, roster 10, reviewer-escalate). Nền H2 đã có 1 phần ở `session-end.md` §L.b — sub này NÂNG thành 5-trục đầy-đủ + chuyên-trách.
|
||||
|
||||
## 🎯 Role (1 câu)
|
||||
Verify + gom **harvest-MD toàn session** (agent-memory sub · wave-folder workflow · agent-team) → @session-end đề-xuất harvest-delta + 5-trục integrity GATE; @session-start báo harvest mới. KHÔNG ghi, KHÔNG quyết, KHÔNG tooling-freshness (đó là tooling-auditor).
|
||||
|
||||
## ✅ SCOPE — ĐƯỢC làm (H2 harvest-integrity 5-trục)
|
||||
|
||||
**@session-end (HỖ TRỢ harvest — GATE trước đóng + Harness 2 B5):**
|
||||
- Quét `.claude/agent-memory/*/MEMORY.md` mọi sub đã spawn → đề-xuất spawn-record 4-field `{task·verdict·learned·surprise}` cho em main APPEND.
|
||||
- **🌊 Wave-folder harvest (Harness 2 B5):** sau workflow-dài / cuối-session, quét `.claude/workflows/wave-<tên>/sub-*.md` (+ agent-team `.claude/agent-teams/<tên>/`) → gom delta → đề-xuất em main consolidate APPEND vào `agent-memory/<role>` sub tương-ứng (để sub-chính có đầy-đủ memory). Ghi `wave-<tên>/_harvest.md` propose (em main verify).
|
||||
- Chạy **5-trục:** **Coverage** (0 silent-miss — mọi sub/wave/team đã-chạy đều harvest) · **Completeness** (đủ 4-field) · **Placement** (delta đúng nhà `agent-memory/X`, B2) · **Corruption** (mojibake / `$`-shell-expansion / encoding scan — phải dùng Write/Edit-tool, KHÔNG Bash-append-ẩu) · **Fidelity-FLAG** (nghi bịa / record on-behalf khớp việc-thật → escalate `reviewer`, KHÔNG tự phán).
|
||||
- Flag chore-memory: agent-memory >30KB → archive L2 · wave-folder chưa-harvest tồn-đọng · delta mồ-côi · 0-byte memory (closeout-truncate gotcha #53).
|
||||
|
||||
**@session-start (BÁO harvest mới):**
|
||||
- **🌾 Harvest MD mới:** tổng hợp MD/memory MỚI từ workflow-wave · sub-agent · agent-team kể từ last-session (spawn-record mới · finding mới · **delta CHƯA APPEND** = mồ-côi cần em main xử-lý).
|
||||
- Wave-folder tồn-đọng (workflow chạy mà chưa harvest) → flag.
|
||||
|
||||
## ❌ SCOPE — CẤM
|
||||
- ❌ KHÔNG ghi/sửa BẤT KỲ file (em main single-writer — propose → VERIFY + APPEND B3 no-overwrite-unverified). KHÔNG `store_memory` (RAG single-writer = em main).
|
||||
- ❌ KHÔNG quyết · KHÔNG tự archive/prune/curate (chỉ đề-xuất).
|
||||
- ❌ KHÔNG audit tooling/skill/plugin/docs-freshness + new-alloc (đó là **tooling-auditor** H1; double-touch CẤM, anh-mandate riêng-biệt).
|
||||
- ❌ KHÔNG tự phán Fidelity "bịa" — nghi → escalate `reviewer`.
|
||||
- ❌ KHÔNG fan-out repo khác (SOLUTION_ERP-self only).
|
||||
|
||||
## 🔗 Quan hệ (ranh giới tránh double-touch)
|
||||
- vs **tooling-auditor (H1):** tooling = TOOLING-FRESHNESS (skill/role/plugin/docs). harvest = HARVEST-MEMORY (spawn-record · 5-trục · wave-gom). 🔴 TÁCH BIỆT (anh 06-07). Overlap = 0.
|
||||
- vs **reviewer:** reviewer = adversarial PASS/FAIL + Fidelity-escalation. harvest-curator = deterministic 4-trục (Coverage/Completeness/Placement/Corruption) + **FLAG** Fidelity (nghi → reviewer). Hybrid.
|
||||
- vs **cicd-monitor:** cicd = corpus/RAG/eval/deploy. harvest-curator = agent-memory/wave harvest. Khác lãnh-địa.
|
||||
|
||||
## 📤 OUTPUT contract
|
||||
- @session-end: bảng harvest {sub/wave · spawn-record-đề-xuất · 5-trục verdict · flag} + wave-consolidate propose + chore-memory. Propose-delta cho em main APPEND.
|
||||
- @session-start: harvest-mới report (delta mồ-côi + wave tồn-đọng) gọn cho Phase 2/3.
|
||||
- ≤ vài K token. Mọi claim có ref (path / count). KHÔNG tự ghi.
|
||||
|
||||
## 💾 Memory
|
||||
`.claude/agent-memory/harvest-curator/MEMORY.md` — harvest-trend · wave-harvest history · 5-trục verdict history · spawn-record 4-field. Tiered (L1 HOT ~30KB / L2 archive / L3 RAG-read).
|
||||
|
||||
## 🔒 RULES + G-015 accuracy
|
||||
- Read-only + propose-only. Output qua em main verify (em main re-Read ref trước APPEND).
|
||||
- 🌊 **Harness 2 audit (B6):** khi gom wave-folder, VERIFY sub-workflow CHỈ ghi `wave-<tên>/` — phát-hiện sub ghi ra MD chính (`agent-memory/*` hay canonical) = **FLAG vi-phạm isolation** cho em main (git-diff evidence).
|
||||
- 🔴 **G-015 KHÔNG overclaim:** sub này = propose-only. `store_memory` strip (RAG-write không-gọi-được) NHƯNG giữ `Bash` = write-channel mở → KHÔNG "read-only enforced". Containment = em main single-writer + git-diff + chunk-count post-session.
|
||||
- KHÔNG tự ghi memory kênh nào (return delta → em main APPEND B3).
|
||||
57
.claude/agents/tooling-auditor.md
Normal file
57
.claude/agents/tooling-auditor.md
Normal file
@ -0,0 +1,57 @@
|
||||
---
|
||||
name: tooling-auditor
|
||||
description: |
|
||||
Read-only INFORM-only TOOLING-FRESHNESS auditor cho SOLUTION_ERP (H1 — adopt AI_INFRA Harness 1, anh giao 2026-06-07; TÁCH BIỆT khỏi harvest-curator H2 vì 2 việc hay quên+nhầm khi gộp). Audit 4-MẶT mỗi session có cập-nhật ĐẦY-ĐỦ + KỊP-THỜI không: (1) skill (.claude/skills/ 6 project + ~/.claude/skills standalone — mới/đổi/stale/đã-map-vai chưa) · (2) vai-trò sub-agent (.claude/agents/ roster khớp README/CLAUDE.md/STATUS · thừa/idle/scope-drift) · (3) plugin (~/.claude/settings.json enabledPlugins user-global · installed/enabled/assigned/used) · (4) docs (CLAUDE.md·docs/STATUS·agents/README·governance phản-ánh trạng-thái THẬT · drift doc-vs-reality). Lifecycle: @session-start BÁO state + diff-vs-last (THÊM/ĐỔI/XÓA/stale); @session-end CHỐT freshness + AUDIT skill/plugin MỚI phân-bổ (new-alloc) cho em main + sub. Propose-only — em main single-writer (VERIFY→APPEND B3). KHÔNG harvest-memory (đó là harvest-curator). KHÔNG corpus/RAG/deploy (đó là cicd-monitor). KHÔNG store_memory. PHẢI dùng khi audit tooling/docs-freshness + skill/plugin-state + roster-drift đầu/cuối session.
|
||||
model: inherit
|
||||
tools: [Read, Grep, Glob, Bash, mcp__rag-unified__search_memory, mcp__rag-unified__search_code, mcp__rag-unified__cross_project_search, mcp__rag-unified__list_projects]
|
||||
memory: project
|
||||
maxTurns: 18
|
||||
---
|
||||
|
||||
# Tooling-Auditor — SOLUTION_ERP (H1 tooling/docs freshness, read-only INFORM-only)
|
||||
|
||||
> Canh "ĐỘ TƯƠI" bộ-đồ-nghề SOLUTION_ERP: skill · vai-sub-agent · plugin · docs có cập-nhật **đầy-đủ + kịp-thời** không. **Read-only · propose-only.** Em main = single-writer. Adopt AI_INFRA Harness 1 (anh giao 2026-06-07) — TÁCH khỏi `harvest-curator` (H2): H1≠H2, "hay quên+nhầm" → riêng-biệt. KHÔNG copy AI_INFRA: tailor SE stack (4 RAG-read thay 2, roster 10, 6 skill, bỏ sister/agent-ops-monitor vì SE là sister).
|
||||
|
||||
## 🎯 Role (1 câu)
|
||||
Audit 4-mặt freshness tooling/docs SOLUTION_ERP → @session-start báo state+diff; @session-end chốt + audit new-alloc. KHÔNG ghi, KHÔNG quyết, KHÔNG harvest-memory (đó là harvest-curator).
|
||||
|
||||
## ✅ SCOPE — ĐƯỢC làm (4-MẶT — đầy-đủ + kịp-thời)
|
||||
|
||||
**@session-start (BÁO tooling-state + diff vs last):**
|
||||
- **① skill** — `.claude/skills/` (6 project: contract-workflow / form-engine / permission-matrix / dependency-audit-erp / ef-core-migration / iis-deploy-runbook) + `~/.claude/skills/` (standalone user-global, vd sql-database-assistant): skill mới/đổi/mất; SKILL.md stale (mô-tả lệch thực-tế)?; đã map vào vai phù-hợp chưa (agents/README skill matrix).
|
||||
- **② vai-trò sub-agent** — `.claude/agents/`: roster (10 sub) khớp `agents/README.md` + `CLAUDE.md`/`docs/STATUS.md` count không; sub thừa/idle/scope-drift; role-scope đúng; agent mới chưa-active (no hot-reload) vs đã-active.
|
||||
- **③ plugin** — `~/.claude/settings.json` enabledPlugins (**user-global** — áp mọi project, KHÔNG chỉ SE `.claude/`) + marketplace `~/.claude/plugins/marketplaces/claude-plugins-official/plugins`: installed/enabled/đổi; đã phân-bổ vai chưa; pending. **Báo đúng nấc: installed → enabled → assigned → used** (KHÔNG conflate).
|
||||
- **④ docs** — `CLAUDE.md` (root + docs/) · `docs/STATUS.md` · `docs/HANDOFF.md` · `agents/README.md` · `docs/governance/`: phản-ánh ĐÚNG trạng-thái THẬT? (vd roster đổi 8→10 mà doc chưa sửa · count drift · path trỏ sai = **drift cần flag**).
|
||||
- **Diff vs last-session:** THÊM/ĐỔI/XÓA/stale mỗi mặt.
|
||||
|
||||
**@session-end (CHỐT freshness + new-alloc audit):**
|
||||
- **CHỐT** trạng-thái 4-mặt: đổi gì session này, cần update doc gì, stale gì.
|
||||
- **🔌 Skill/plugin new-allocation audit:** rà skill/plugin MỚI (marketplace + `~/.claude/skills`) CHƯA phân-bổ → đề-xuất gán cho **em main + TỪNG sub** phù-hợp vai (em main quyết+ghi). Khác cicd-monitor (deploy/dependency-CVE) — đây = NEW-alloc MỖI session-end.
|
||||
- **Flag chore (tooling/docs):** doc-drift · roster-doc lệch · skill/plugin stale · MD double/over-context (consolidate — KHÔNG cắt thứ quan trọng, chỉ phân-tầng).
|
||||
|
||||
## ❌ SCOPE — CẤM
|
||||
- ❌ KHÔNG ghi/sửa BẤT KỲ file (em main single-writer — propose → VERIFY + APPEND B3). KHÔNG `store_memory`.
|
||||
- ❌ KHÔNG enable/disable plugin · KHÔNG tự sửa config/doc · KHÔNG archive/prune (chỉ đề-xuất).
|
||||
- ❌ KHÔNG harvest agent-memory / verify spawn-record (đó là **harvest-curator** H2; double-touch CẤM, anh-mandate H1/H2 riêng-biệt).
|
||||
- ❌ KHÔNG corpus/RAG re-index/eval/deploy (đó là **cicd-monitor**).
|
||||
- ❌ KHÔNG fan-out repo khác (SOLUTION_ERP-self only; `cross_project_search` = READ reference, KHÔNG audit repo bạn).
|
||||
|
||||
## 🔗 Quan hệ (ranh giới tránh double-touch)
|
||||
- vs **harvest-curator (H2):** harvest = HARVEST-MEMORY (spawn-record · 5-trục · wave-gom). tooling = TOOLING-FRESHNESS (skill/role/plugin/docs). 🔴 TÁCH BIỆT (anh 06-07). Overlap = 0.
|
||||
- vs **cicd-monitor:** cicd = post-deploy Gitea/bundle-hash/smoke + dependency CVE. tooling-auditor = MD/skill/plugin/docs/roster freshness. Khác lãnh-địa.
|
||||
- vs **investigator-codebase:** inv-cb = audit code/SQL/schema theo task. tooling-auditor = audit META (tooling/docs/roster) theo lifecycle session.
|
||||
|
||||
## 📤 OUTPUT contract
|
||||
- @session-start: tooling-state report (4-mặt inventory + diff + stale/drift-flag) gọn cho Phase 2/3.
|
||||
- @session-end: bảng freshness-chốt {mặt · trạng-thái · cần-update} + new-alloc đề-xuất + chore-list (tooling/docs).
|
||||
- ≤ vài K token. Mọi claim có ref (path:line / count / timestamp). KHÔNG tự ghi.
|
||||
- 🔴 **Verify đầy-đủ + kịp-thời bằng BẰNG-CHỨNG** (path:line / git-diff / size / timestamp), KHÔNG tin "đã update rồi". Audit tick-checkbox-no-evidence = vô-giá-trị.
|
||||
|
||||
## 💾 Memory
|
||||
`.claude/agent-memory/tooling-auditor/MEMORY.md` — snapshot tooling-state gần nhất (4-mặt) · freshness-trend · drift/stale-flag history · new-alloc đề-xuất history. Tiered (L1 HOT ~30KB / L2 archive / L3 RAG-read).
|
||||
|
||||
## 🔒 RULES + G-015 accuracy
|
||||
- Read-only + propose-only. Output qua em main verify (em main re-Read ref trước APPEND).
|
||||
- 🔴 **G-015 KHÔNG overclaim:** sub này = propose-only. `store_memory` đã strip (tool RAG-write không-gọi-được) NHƯNG vẫn giữ `Bash` = write-channel mở → **KHÔNG "read-only enforced"**. Containment thật = em main single-writer + git-diff post-session (defense-in-depth), KHÔNG allowlist đơn-độc.
|
||||
- Plugin: báo nấc (installed / enabled / assigned / used) — KHÔNG conflate "enabled" = "đang dùng".
|
||||
- KHÔNG tự ghi memory kênh nào (return delta → em main APPEND B3).
|
||||
@ -11,7 +11,7 @@ argument-hint: <id | all-pending>
|
||||
**ID/topic:** $ARGUMENTS
|
||||
|
||||
## Flow (lead sister)
|
||||
1. **Đọc outbox AI_INFRA:** `D:\Dropbox\CONG_VIEC\AI_INFRA\broadcasts\outbox\*.md` *(base path configurable — AI_INFRA đổi path/web-migration thì sửa 1 dòng này)*. Fallback chi tiết canonical: `cross_project_search`.
|
||||
1. **Đọc outbox AI_INFRA:** `D:\Dropbox\CONG_VIEC\AI_INFRA\broadcasts\outbox\all\*.md` *(Harness 3 §8 06-07: broadcast fan-out gom vào `outbox/all/`; base path configurable — AI_INFRA đổi path/web-migration thì sửa 1 dòng này)*. Fallback chi tiết canonical: `cross_project_search`.
|
||||
2. **Filter — broadcast `targets` gồm project này (hoặc `all-fit`) VÀ chưa-applied:**
|
||||
- **Dedup key:** tồn tại `docs/governance/adap-reports/<id>.md` ⇒ ĐÃ xử → **skip**.
|
||||
- **Cold-start:** folder `adap-reports/` chưa có ⇒ **tạo folder** + coi **mọi broadcast = chưa-applied** (lần đầu).
|
||||
|
||||
28
.claude/commands/check-email.md
Normal file
28
.claude/commands/check-email.md
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
description: Nhận email cross-project (2-stage) qua broadcasts/ (Harness 3 §N) cho SOLUTION_ERP (self=se). Verify hash đối chứng. §J2. Adopt AI_INFRA Harness 3 (2026-06-07).
|
||||
argument-hint: <from_project | all>
|
||||
---
|
||||
# /check-email <from_project> — nhận email cross-project (Harness 3 · self=`se`)
|
||||
|
||||
> 🔴 Kênh DUY NHẤT (§N) · **pull-copy** chỉ ghi repo MÌNH (§J2). self=`se`. Path map: xem `send-email`. Detail: AI_INFRA `broadcasts/README.md` §Harness 3.
|
||||
|
||||
## Tham số
|
||||
- `$1` = from_project (BẮT BUỘC) ∈ 6 others, hoặc `all` = quét cả 6.
|
||||
|
||||
## Quy trình 2-STAGE (audit qua folder)
|
||||
**STAGE 1 — Nhận (đọc → inbox root, PENDING):**
|
||||
1. Validate `$1`.
|
||||
2. READ `<from>/broadcasts/outbox/se/*.md` (message gửi cho se).
|
||||
3. Mỗi file CHƯA có trong inbox (so id): **COPY VERBATIM** → `broadcasts/inbox/<id>.md` (**root = pending**). [repo MÌNH §J2]
|
||||
4. **Verify đối chứng:** (a) **whole-file** `Get-FileHash` copy == nguồn (byte-identical = tuyến CHÍNH); (b) **body** recompute `SHA256(body)` == `content_sha256`, body canonical `(($txt -split "(?m)^---\s*$",3)[2] -replace "^\r?\n","")`. ✗ → **flag tamper, KHÔNG move**, báo anh.
|
||||
5. Log `_index.md` §INBOUND: `received · id · <from> → se · status=pending · folder=(root) · sha256(12) · verify=✓`.
|
||||
|
||||
**STAGE 2 — Xử lý xong → archive (PROCESSED):**
|
||||
6. Sau khi xử lý → **MOVE** `inbox/<id>.md` → `inbox/<from>/<id>.md`.
|
||||
7. Update `_index.md`: `status=processed · folder=<from>`.
|
||||
|
||||
## Audit (anh)
|
||||
`ls broadcasts/inbox/*.md` (root) = **pending chưa xử lý** (backlog hiện ngay) · `inbox/<proj>/` = **đã xử lý**.
|
||||
|
||||
## Luật
|
||||
🔴 §N single-channel · 🔴 §J2 pull-copy chỉ-ghi-inbox-MÌNH (KHÔNG push repo bên kia) · **KHÔNG sửa** file copy (bằng chứng) · PHẢI committed · verify-hash trước move.
|
||||
36
.claude/commands/send-email.md
Normal file
36
.claude/commands/send-email.md
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
description: Gửi email cross-project qua broadcasts/ (Harness 3 §N) cho SOLUTION_ERP (self=se). Ghi outbox/<to>/ repo MÌNH. §J2. Adopt AI_INFRA Harness 3 (2026-06-07).
|
||||
argument-hint: <to_project> [category] [intent...]
|
||||
---
|
||||
# /send-email <to_project> — gửi email cross-project (Harness 3 · self=`se`)
|
||||
|
||||
> 🔴 Kênh DUY NHẤT (§N) · chỉ ghi repo MÌNH (§J2). self=`se`. Detail: AI_INFRA `broadcasts/README.md` §Harness 3 (pull `cross_project_search`).
|
||||
|
||||
## Tham số
|
||||
- `$1` = to_project (BẮT BUỘC) ∈ 6 project ≠ `se` (self/unknown → ABORT).
|
||||
- `$2` = category ∈ `Governance·Agent·Memory·Rag·Mcp·Skill·Cmd·Coord` (default `Coord`). ✅ *infra-CC ACTIVE: `category` ≠ `Coord` + `to` ≠ `ai_infra` → auto bản-2 vào `outbox/ai_infra/` (bước 6b) để AI_INFRA giám sát infra-comms.*
|
||||
|
||||
## Project-path map (7 project — se dùng 6 ≠ self · path-coupling, web-migration sẽ bỏ)
|
||||
| id | broadcasts root |
|
||||
|---|---|
|
||||
| ai_infra | `D:\Dropbox\CONG_VIEC\AI_INFRA\broadcasts` |
|
||||
| vipix | `D:\Dropbox\CONG_VIEC\VIPIX_MULTISITE_PROJECT\broadcasts` |
|
||||
| se | `D:\Dropbox\CONG_VIEC\SOLUTION\SOLUTION_ERP\broadcasts` (← self) |
|
||||
| dyd | `D:\Dropbox\CONG_VIEC\DAI_Y_DUOC\DH_Y_DUOC_SOURCECODE\DH_Y_DUOC\broadcasts` |
|
||||
| namgroup | `D:\Dropbox\CONG_VIEC\NAMGROUP\SOURCECODE_CÔNG_TY\NAMGROUP\broadcasts` |
|
||||
| ashico | `D:\Dropbox\CONG_VIEC\ASHICO\SOURCE_CODE_WEBSITE_ASHICO\broadcasts` |
|
||||
| bvaau | `D:\Dropbox\CONG_VIEC\BENHVIEN_A_AU\SOURCE_CODDE\broadcasts` |
|
||||
|
||||
## Quy trình
|
||||
1. **Validate** `$1` ∈ 6 others (≠ `se`/unknown) → else ABORT.
|
||||
2. **Soạn body** markdown theo intent.
|
||||
3. **id** = `<YYYY-MM-DD>-se-to-<to>-<slug>` (unique).
|
||||
4. **content_sha256** = `SHA256(body)` **canonical** (strip 1 leading newline — Y HỆT receive): `(($txt -split "(?m)^---\s*$",3)[2] -replace "^\r?\n","")` → SHA256-UTF8.
|
||||
5. **Frontmatter:** `id · from: se · to: <to> · category · type: broadcast|update|fix|report|request|coord · date · content_sha256 · nac: sent`.
|
||||
6. **Ghi** `broadcasts/outbox/<to>/<id>.md` (**Write tool**, KHÔNG shell-write — chống mojibake). [chỉ repo MÌNH §J2]
|
||||
6b. **infra-CC** (Harness-3 §N3) — NẾU `category` ∈ {Governance·Agent·Memory·Rag·Mcp·Skill·Cmd} (≠`Coord`) VÀ `to` ≠ `ai_infra`: ghi **bản-2** `broadcasts/outbox/ai_infra/<id>-cc.md` (Write tool — repo MÌNH = §J2-safe, KHÔNG ghi inbox ai_infra) — **body + `content_sha256` Y HỆT** primary; frontmatter `id: <id>-cc · from: se · to: ai_infra · cc-of: <to> · category · type · date · content_sha256 · nac: sent`. (Đã có `outbox/ai_infra/.gitkeep`.) → AI_INFRA pull qua `/check-email se`.
|
||||
7. **Log** append `broadcasts/_index.md` §OUTBOUND (+ 1 row tag `cc` nếu có bản-2).
|
||||
8. **Báo.** KHÔNG tự relay — bên nhận tự `/check-email se`.
|
||||
|
||||
## Luật
|
||||
🔴 §N single-channel · 🔴 §J2 chỉ-ghi-repo-mình · `from`+`to` BẮT BUỘC · id unique · folder khớp `to` · infra-CC bản-2 (category≠Coord → `outbox/ai_infra/`, ghi repo MÌNH = §J2-safe). Outward content → reviewer-gate (no-overclaim G-015) trước relay.
|
||||
@ -1,5 +1,5 @@
|
||||
---
|
||||
description: Đóng session SOLUTION_ERP — flush 7-agent memory, sync MD/RAG, commit + push, eval. Run cuối mỗi session.
|
||||
description: Đóng session SOLUTION_ERP — flush 10-agent memory + H2 harvest-gate (5-trục) + H1 tooling-chốt, sync MD/RAG, commit + push, eval. Run cuối mỗi session.
|
||||
---
|
||||
|
||||
# /session-end — Session closeout (FLUSH + WRITE + VERIFY + REPORT + COMMIT + EVAL)
|
||||
@ -28,6 +28,8 @@ Em main PHẢI echo **TOÀN BỘ nội dung command body này** (đầy đủ Ph
|
||||
- 🟪 **test-specialist** — test bundle added + coverage gap + spec drift detected
|
||||
- 🟥 **reviewer** — anti-patterns observed + Smart Friend catches + claim verification
|
||||
- 🟢 **cicd-monitor** — Run verdict + bundle hash rotate + Mig prod + corpus drift
|
||||
- 🟫 **tooling-auditor** (monitor H1) — CHỐT tooling/docs-freshness 4-mặt + new-alloc audit (chạy ở §L.b(g))
|
||||
- ⬜ **harvest-curator** (monitor H2) — GATE harvest-integrity 5-trục + wave-folder gom (chạy ở §L.b(d)(f))
|
||||
|
||||
2. Synthesize cross-agent learnings → integrate vào:
|
||||
- User auto-memory `MEMORY.md` (index — append entry mới, KHÔNG rewrite)
|
||||
@ -40,13 +42,14 @@ Em main PHẢI echo **TOÀN BỘ nội dung command body này** (đầy đủ Ph
|
||||
|
||||
**§L.a — Deterministic detect (scan action-signature, KHÔNG để AI tự-phán):** quét session theo bảng **AS-1..AS-9** trong error-ledger. Mỗi hit → 1 RCA entry blameless (5-why + fix + guard). **Bug-production = lỗi KÉP → 2 fix** (vá code **VÀ** vá guard/eval-case). List AS mở — gặp class mới thì thêm.
|
||||
|
||||
**§L.b — 6-step auto-maintain (đủ 6, KHÔNG skip — thiếu = ledger thối):**
|
||||
**§L.b — 7-step auto-maintain (đủ 7, KHÔNG skip — thiếu = ledger thối). (d)(f) = H2 harvest-curator · (g) = H1 tooling-auditor (2026-06-07 Harness 1):**
|
||||
- **(a) summary-index** += 1 dòng/session vào `STATUS.md` Recently Done (pointer, KHÔNG full-log).
|
||||
- **(b) Active-Guards** (error-ledger): promote guard **2-strike** (episodic→procedural) · mark `verified` nếu held qua session · retire theo **net-effect** (hại>lợi → gỡ).
|
||||
- **(c) chore-flag:** agent L1 >~30KB → archive L2 · error-ledger open-entry quá ngưỡng · **0-byte memory check (AS-8)**.
|
||||
- **(d) flush agent-memory** mỗi sub đã spawn session này — **spawn-record 4-field** `{agent · task · nấc(agreed/executed/verified) · evidence}`. (0 sub spawn → "n-a".)
|
||||
- **(d) flush agent-memory** mỗi sub đã spawn session này — **spawn-record 4-field** `{agent · task · nấc(agreed/executed/verified) · evidence}`. (0 sub spawn → "n-a".) → **⬜ harvest-curator (H2) HỖ TRỢ:** spawn → propose spawn-record cho mọi sub đã chạy → em main single-writer VERIFY → APPEND (B3 no-overwrite-unverified).
|
||||
- **(e) pending-request audit:** request anh CHƯA-thực-thi đã log SPECIFICS chưa (KHÔNG placeholder).
|
||||
- **(f) harvest-integrity double-check:** verify spawn-record (d) đủ + đúng mọi sub (moved-not-cut).
|
||||
- **(f) 🌾 harvest-integrity GATE (⬜ harvest-curator H2 — 5-trục, Harness 1+2):** verify spawn-record (d) đủ+đúng mọi sub TRƯỚC khi đóng — **Coverage** (0 silent-miss) · **Completeness** (đủ 4-field) · **Placement** (delta đúng `agent-memory/X`) · **Corruption** (moved-not-cut, no-mojibake/shell-baked) · **Fidelity-FLAG** (nghi bịa/on-behalf → escalate 🟥 reviewer, KHÔNG tự phán). + **🌊 wave-folder gom (Harness 2 B5):** nếu session chạy WAVE-MODE (tồn tại `.claude/workflows/wave-*/`) → quét `sub-*.md` → consolidate APPEND `agent-memory/<role>` + verify **B6 isolation** (git-diff: sub KHÔNG ghi ra MD chính; chunk-count: 0 RAG-write). GATE = chưa đủ 5-trục thì CHƯA đóng.
|
||||
- **(g) 🔌 tooling-freshness CHỐT (🟫 tooling-auditor H1 — Harness 1):** spawn → chốt 4-mặt (skill·sub-role·plugin·docs) đổi gì session này + **new-alloc audit** (skill/plugin MỚI chưa phân-bổ → đề-xuất gán em main + sub phù-hợp vai) + flag doc-drift/roster-lệch/count-stale. Propose → em main APPEND/sửa doc (single-writer). 🔴 G-015: 2 monitor = propose-only, em main VERIFY trước APPEND (Bash residual → KHÔNG "read-only enforced").
|
||||
|
||||
## Phase 2 — WRITE (update MD/RAG)
|
||||
|
||||
@ -75,7 +78,7 @@ Em main PHẢI echo **TOÀN BỘ nội dung command body này** (đầy đủ Ph
|
||||
- Phase 9 UAT mode: feature test-after (có thể skip per chunk), vẫn `npm run build` × 2 app. Nếu chỉ docs/infra → ghi "N/A".
|
||||
|
||||
### 3.2 Sub-agent state
|
||||
- Kiểm tra trạng thái spawn sub-agent (7-agent)
|
||||
- Kiểm tra trạng thái spawn sub-agent (10-agent — 8 product/quality + 2 monitor INFORM-only)
|
||||
- Task bất kỳ phải phân việc đầy đủ đúng vai trò split boundary (BE→backend, FE→frontend, test→test-specialist)
|
||||
|
||||
### 3.3 RAG + MCP state
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
---
|
||||
description: Bootstrap session SOLUTION_ERP — load context, audit state (7-agent + RAG + tests), report plan. Run đầu mỗi session.
|
||||
description: Bootstrap session SOLUTION_ERP — load context, audit state (10-agent + RAG + tests + monitor RE-REPORT), report plan. Run đầu mỗi session.
|
||||
---
|
||||
|
||||
# /session-start — Session bootstrap (READ + AUDIT + REPORT)
|
||||
@ -34,15 +34,15 @@ Em main đọc `.claude/hmw-mode.on` → **BÁO ngay đầu response** (anh kh
|
||||
4. **`docs/PROJECT-MAP.md`** — bản đồ tổng quan module
|
||||
5. **`docs/changelog/migration-todos.md`** — atomic tasks theo phase (Phase 11 polish hiện tại)
|
||||
6. **`docs/workflow-contract.md`** — state machine 9 phase HĐ (base pattern cho PE/Proposal workflow V2)
|
||||
7. **`.claude/agents/README.md`** — 7-agent decision tree + skill matrix + split boundary
|
||||
7. **`.claude/agents/README.md`** — 10-agent decision tree + skill matrix + split boundary
|
||||
8. **`.claude/agent-memory/{spawned-agent}/MEMORY.md`** — L1 HOT auto-inject (Tiered Memory v1 ~30KB) + L2 `archive/` Read-on-demand + L3 RAG `search_memory` just-in-time
|
||||
9. **User auto-memory `MEMORY.md`** — auto-loaded bởi harness (index feedback_* entries)
|
||||
10. **Liên quan task hiện tại:** `docs/rules.md`, `docs/architecture.md`, `docs/gotchas.md` (55), `docs/database/schema-diagram.md`, `docs/flows/`
|
||||
|
||||
## Phase 2 — AUDIT (state check)
|
||||
|
||||
### 2.1 Sub-agent state (7-agent topology)
|
||||
- Check 7 sub-agent đã spawn chưa:
|
||||
### 2.1 Sub-agent state (10-agent topology — 8 product/quality + 2 monitor INFORM-only)
|
||||
- Check 10 sub-agent đã spawn chưa:
|
||||
- 🟦 **investigator-codebase** — internal SQL/EF/grep/reference mirror audit
|
||||
- 🟦 **investigator-api** — external docs/CVE/lib/cross-project reference
|
||||
- 🟨 **implementer-backend** — .NET Domain+App+Infra+Api scaffold
|
||||
@ -50,11 +50,21 @@ Em main đọc `.claude/hmw-mode.on` → **BÁO ngay đầu response** (anh kh
|
||||
- 🟪 **test-specialist** — tests/ xUnit dedicated
|
||||
- 🟥 **reviewer** — adversarial pre-commit + live curl prod
|
||||
- 🟩 **cicd-monitor** — post-deploy Gitea + bundle hash + smoke
|
||||
- 🟫 **tooling-auditor** (monitor H1, INFORM-only) — tooling/docs-freshness 4-mặt (skill·sub-role·plugin·docs)
|
||||
- ⬜ **harvest-curator** (monitor H2, INFORM-only) — harvest-integrity 5-trục (Coverage/Completeness/Fidelity/Placement/Corruption)
|
||||
- Task match delegate criteria (ACCEPT) → BẮT BUỘC delegate (xem `.claude/agents/README.md` decision tree)
|
||||
- KHÔNG spawn mới khi con cũ rảnh → fresh spawn re-inject MEMORY (SendMessage N/A harness này)
|
||||
- Nạp full context project cho sub-agent spawn, giữ context sống đến cuối session
|
||||
- Em main solo CHỈ khi: schema/UX/architecture decision · cross-stack tight · bug reasoning chain · gotcha #53/#54/#55 fallback (truncate/529)
|
||||
|
||||
### 2.1.1 Monitor RE-REPORT — H1 tooling-freshness + H2 harvest-integrity (2026-06-07 Harness 1)
|
||||
|
||||
> Đầu session: 2 monitor sub BÁO LẠI trạng-thái + **diff vs session trước** (floor Harness 1 H1.2 + H2.2). INFORM-only — em main đọc + VERIFY→APPEND nếu có delta hợp-lệ (B3), KHÔNG sub tự sửa.
|
||||
|
||||
- **🟫 tooling-auditor (H1):** spawn → báo tooling-state 4-mặt (skill · sub-role · plugin · docs) + **DIFF vs last-session** (THÊM/ĐỔI/XÓA/stale). Bắt drift doc-vs-thực-tế ngay đầu session (vd roster/count lệch, skill stale, plugin pending).
|
||||
- **⬜ harvest-curator (H2):** spawn → báo **harvest-MD mới** (workflow-wave / sub-agent / agent-team kể từ last) + **delta mồ-côi chưa-APPEND** + wave-folder tồn-đọng. Bắt 0-byte memory (gotcha #53) + delta chưa thu-hoạch.
|
||||
- Cơ-chế = báo-lại-diff đầu session (FORM tự do trình bày). 2 monitor spawn parallel OK. **Light session / hỏi-đáp → có thể skip; bug/feature/multi-agent/wave session → nên chạy.**
|
||||
|
||||
### 2.2 Skill registry (6 skill)
|
||||
- Liệt kê: `contract-workflow` · `form-engine` · `permission-matrix` · `dependency-audit-erp` · `ef-core-migration` · `iis-deploy-runbook`
|
||||
- Dùng skill khi task khớp (KHÔNG tự suy luận lại). Phân bổ per agent: xem README skill matrix.
|
||||
|
||||
47
.claude/workflows/README.md
Normal file
47
.claude/workflows/README.md
Normal file
@ -0,0 +1,47 @@
|
||||
# `.claude/workflows/` — Workflow + wave-folder convention (Harness 2)
|
||||
|
||||
> **Mục đích:** convention cho HMW workflow fan-out + **wave-folder memory-isolation** (adopt AI_INFRA Harness 2, anh 06-07). Canonical rule: AI_INFRA `CANONICAL-RULES.md` §J4 (return-delta default) + §J6 (wave-mode + agent-team) — pull qua `cross_project_search`, KHÔNG copy. Tailor SE 8-role roster + S1 scope.
|
||||
|
||||
## Files (tracked)
|
||||
- `hmw.js` — HMW P2 fan-out script. 2 mode: DEFAULT return-delta-only (§J4) · WAVE-MODE (§J6, `args.wave`).
|
||||
- `README.md` — file này (convention).
|
||||
- `wave-<tên>/` — **gitignored** (`.gitignore:93` `.claude/workflows/wave-*/`), transient per-workflow.
|
||||
|
||||
## 2 MODE memory (ADD — anh 06-07, KHÔNG thay return-delta)
|
||||
|
||||
| | DEFAULT return-delta-only (§J4) | WAVE-MODE (§J6, Harness 2) |
|
||||
|---|---|---|
|
||||
| Khi dùng | fan-out NHẸ (~2-3 phút, read/analyze — vd recon wave) | workflow DÀI / sinh nhiều detail |
|
||||
| Sub ghi file? | KHÔNG — chỉ return `memoryDelta` | GHI full-detail vào `wave-<tên>/sub-<role>-<i>.md` |
|
||||
| Lead làm | VERIFY + APPEND @P3 (B3) | đọc wave on-demand + H2 gom @session-end (B5) |
|
||||
| Rủi ro mất detail | có (delta lossy) — chấp nhận cho việc nhẹ | KHÔNG (full-detail giữ isolated) |
|
||||
|
||||
> Mặc định DEFAULT. WAVE-MODE chỉ bật khi workflow dài/nhiều detail (set `args.wave`). KHÔNG bắt mọi fan-out wave-folder.
|
||||
|
||||
## Wave-folder structure (WAVE-MODE)
|
||||
```
|
||||
.claude/workflows/wave-<tên>/ ← gitignored (transient; H2 gom rồi → có thể xóa sau commit)
|
||||
├── wave.md ← Wave-MD chính — EM MAIN ghi @P1 (task-list + vai + spec + status + harvest-state)
|
||||
├── sub-<role>-<i>.md ← sub-MD — SUB tự ghi @P2 (vd sub-investigator-codebase-0.md) — full working detail
|
||||
└── _harvest.md ← H2 (harvest-curator) ghi propose @session-end (gom gì về agent-memory nào)
|
||||
```
|
||||
|
||||
## Quy trình WAVE-MODE (B1–B6)
|
||||
1. **B3 SCAFFOLD TRƯỚC (em main @P1):** tạo folder `wave-<tên>/` + `wave.md` (task-list + vai rõ). ⚠️ `hmw.js` chạy JS-sandbox **no-filesystem** → KHÔNG tự tạo folder; **em main Write @P1** TRƯỚC khi invoke Workflow.
|
||||
2. **B1 spawn-from-real-sub:** mỗi task `role ∈ VALID_ROLES` (8 sub) → workflow-agent = sub THẬT (`agentType` inherit memory-pack slice + skill identity), KHÔNG agent vô-danh.
|
||||
3. **B4 phân-quyền TOOL-AWARE:** `hmw.js` inject vào prompt mỗi sub đường-dẫn `sub-<role>-<i>.md` + lệnh ghi ĐÚNG file đó.
|
||||
- **Write sub (CÓ Write/Edit):** implementer-backend · implementer-frontend · test-specialist · frontend-designer → ghi-direct sub-MD via Write/Edit.
|
||||
- **Read-only sub (CHỈ Bash):** investigator-codebase · investigator-api · reviewer · cicd-monitor → 🔴 KHÔNG Bash-write MD (mojibake) → full-detail vào `findings` + `subMdPath` → **em main scribe @P3** (single-writer).
|
||||
4. **B6 ISOLATION (AUDIT cẩn-thận):** sub CHỈ ghi `wave-<tên>/sub-*.md` (+ code-file-disjoint nếu giao). 🔴 KHÔNG ghi `agent-memory/*` chính · KHÔNG MD canonical (CLAUDE/README/STATUS/agents) · KHÔNG sub-MD agent khác. **Em main `git status`/`git diff` + chunk-count sau P2** → tracked-file đổi NGOÀI code-disjoint = **vi-phạm** (wave-folder gitignored nên KHÔNG hiện trong diff = sạch). Verify pattern bằng `git check-ignore -v` (test match thật, đừng tin .gitignore text).
|
||||
5. **B5 HARVEST (⬜ harvest-curator H2 @session-end §L.b(f)):** đọc `wave-<tên>/sub-*.md` → 5-trục integrity → đề-xuất em main consolidate APPEND vào `agent-memory/<role>` sub tương-ứng → sub-chính có đầy-đủ memory. Ghi `_harvest.md` propose.
|
||||
|
||||
## Agent-team (`.claude/agent-teams/<tên>/` — gitignored `.gitignore:94`)
|
||||
- Cùng nguyên-lý isolation: teammate **KHÔNG có memory-dir built-in** (khác subagent) → folder riêng cho teammate ghi MD-session (A1, tránh overwrite memory chuẩn).
|
||||
- Team spawn TỪ **sub-agent chính có memory dự-án rõ-ràng** (A2 — mang identity/skill sub thật trong 8 roster).
|
||||
- H2 harvest-curator gom `.claude/agent-teams/<tên>/` → agent-memory tương-ứng (giống wave).
|
||||
- ⚠️ **Caveat: Agent-Team experimental + Windows 11 in-process only** (no split-pane) → SE **CHƯA dùng team thật** → A = **convention-ready** (n-a runtime), cơ-chế isolation chung qua workflow.
|
||||
|
||||
## Guard
|
||||
- **S1:** Workflow CHỈ repo SOLUTION_ERP — KHÔNG fan-out repo/corpus khác (`cross_project_search` = READ reference only).
|
||||
- **S2/S3:** chỉ chạy khi HMW-mode ON (`/ultra-on` → marker `.claude/hmw-mode.on`) + checkpoint INFORM (`hmw.js` throw nếu `checkpointApproved≠true`) + sub KHÔNG spawn sub.
|
||||
- **G-015 accuracy:** isolation = defense-in-depth (gitignore wave-*/ + em main git-diff post-P2 + chunk-count), KHÔNG sandbox cứng. Read-only sub vẫn giữ Bash = ghi-ngoài-repo (git-diff mù) / curl Qdrant (chunk-count bắt). KHÔNG claim "ENFORCED".
|
||||
@ -2,10 +2,11 @@
|
||||
// top-level await/return hợp lệ); KHÔNG node-runnable trực tiếp (`node hmw.js` sẽ lỗi await).
|
||||
// Em main lo P0/P1/P3/P4 NGOÀI workflow; script này CHỈ lo P2 fan-out.
|
||||
// Invoke bằng {scriptPath} (no hot-reload — restart/re-invoke sau khi sửa). Scope = repo SOLUTION_ERP ONLY (S1).
|
||||
// ⚠️ Script chạy JS-sandbox KHÔNG filesystem → KHÔNG tự tạo folder/ghi file. Scaffold wave-folder = EM MAIN @P1 (Harness 2 B3).
|
||||
|
||||
export const meta = {
|
||||
name: 'hmw',
|
||||
description: 'HMW P2 execute (SOLUTION_ERP) — fan-out 8-agent roster có MEMORY-PACK slice (qua args vì script không đọc file) + return findings + checklistEvidence + memoryDelta (spawn-record 4-field). DEFAULT read/analyze; write fan-out = file-disjoint + em main git-diff sau P2. taskList thoải mái (queue theo slot, không cap cứng). memoryDelta KHÔNG tự ghi — em main VERIFY + APPEND-only @P3 (no-overwrite-unverified, B3). Same-model inherit Opus. Scope = repo SOLUTION_ERP ONLY (S1 — KHÔNG fan-out repo/corpus khác).',
|
||||
description: 'HMW P2 execute (SOLUTION_ERP) — fan-out 8-agent roster có MEMORY-PACK slice (qua args vì script không đọc file) + return findings + checklistEvidence + memoryDelta (spawn-record 4-field). 2 MODE (Harness 2, 06-07): (A) DEFAULT return-delta-only — fan-out nhẹ, sub KHÔNG ghi file, git-diff verify. (B) WAVE-MODE (args.wave) — workflow DÀI, em main scaffold .claude/workflows/wave-<tên>/ @P1, sub ghi full-detail vào CHỈ sub-MD mình (B4/B6), H2 harvest-curator gom wave→agent-memory @session-end (B5). taskList thoải mái (queue theo slot, không cap cứng). memoryDelta KHÔNG tự ghi — em main VERIFY + APPEND-only @P3 (no-overwrite-unverified, B3). Same-model inherit Opus. Scope = repo SOLUTION_ERP ONLY (S1 — KHÔNG fan-out repo/corpus khác).',
|
||||
phases: [{ title: 'Execute', detail: 'fan-out memory-pack-injected agents, structured return' }],
|
||||
}
|
||||
|
||||
@ -15,6 +16,7 @@ export const meta = {
|
||||
// spec: '<acceptance-criteria / context chung>',
|
||||
// checkpointApproved: true, // em main set SAU khi BÁO {số agent·vai·task} @inform (S2)
|
||||
// taskList: [ { role:<VALID_ROLES|null>, label:'..', prompt:'..' }, ... ]
|
||||
// wave: { name:'<tên-wave>', dir:'.claude/workflows/wave-<tên>' } // OPTIONAL — bật WAVE-MODE (B). Folder + wave.md em main ĐÃ scaffold @P1 (script no-fs).
|
||||
// }
|
||||
|
||||
const VALID_ROLES = [
|
||||
@ -29,6 +31,7 @@ const SCHEMA = {
|
||||
properties: {
|
||||
findings: { type: 'string', description: 'Kết quả chính. MỌI claim kèm evidence file:line. KHÔNG narrative suông.' },
|
||||
checklistEvidence: { type: 'string', description: 'Bằng chứng cho acceptance-checklist P1 (số đo / PASS-FAIL / verdict).' },
|
||||
subMdPath: { type: 'string', description: 'WAVE-MODE: đường-dẫn sub-MD agent đã ghi (em main/H2 đọc on-demand). DEFAULT-mode: bỏ trống.' },
|
||||
memoryDelta: {
|
||||
type: 'object',
|
||||
description: 'Spawn-record 4-field — RETURN-only để EM MAIN harvest @P3. Agent KHÔNG tự ghi ký ức (KHÔNG file MEMORY.md, KHÔNG store_memory/RAG). Em main VERIFY + APPEND-only (KHÔNG overwrite entry cũ nếu chưa kiểm tra — B3).',
|
||||
@ -63,8 +66,14 @@ if (A.taskList.length > 16) {
|
||||
const memoryPack = A.memoryPack || {}
|
||||
const spec = A.spec || ''
|
||||
|
||||
// ─── WAVE-MODE (Harness 2 B) ─────────────────────────────────────────────────
|
||||
// wave = { name, dir }. Folder + wave.md em main ĐÃ scaffold @P1 (script no-fs). Bật → sub ghi full-detail
|
||||
// vào CHỈ sub-MD mình + return memoryDelta. Isolation B6 (gitignore wave-*/ + em main git-diff post-P2 + chunk-count).
|
||||
const wave = (A.wave && A.wave.dir) ? A.wave : null
|
||||
if (wave) log(`hmw: WAVE-MODE on → dir=${wave.dir} (sub ghi sub-MD isolated; em main scaffold @P1; H2 harvest-curator gom @session-end B5).`)
|
||||
|
||||
phase('Execute')
|
||||
log(`HMW P2: fan-out ${A.taskList.length} task (same-model inherit, memory-pack-injected, scope=SOLUTION_ERP repo only)`)
|
||||
log(`HMW P2: fan-out ${A.taskList.length} task (${wave ? 'WAVE-MODE' : 'return-delta-only'}, same-model inherit, memory-pack-injected, scope=SOLUTION_ERP repo only)`)
|
||||
|
||||
const results = await parallel(A.taskList.map((t, i) => () => {
|
||||
const raw = t && t.role
|
||||
@ -72,6 +81,26 @@ const results = await parallel(A.taskList.map((t, i) => () => {
|
||||
if (raw && !role) log(`⚠️ hmw: agentType "${raw}" ∉ VALID_ROLES → default subagent cho task #${i}`)
|
||||
|
||||
const mem = role && memoryPack[role] ? memoryPack[role] : ''
|
||||
const subMd = wave ? `${wave.dir}/sub-${role || 'task'}-${i}.md` : null
|
||||
|
||||
// Write-guard TOOL-AWARE theo MODE (B6 isolation). SE read-only sub (KHÔNG Write tool): investigator-codebase/api,
|
||||
// reviewer, cicd-monitor (+ monitor tooling-auditor/harvest-curator). Write sub: implementer-backend/frontend, test-specialist, frontend-designer.
|
||||
const writeGuard = wave
|
||||
? [
|
||||
`## ✍️ WAVE-MODE ghi sub-MD (Harness 2 B4/B6) — TOOL-AWARE (chống mojibake G-009):`,
|
||||
`- Full-detail công-việc của mày → ĐÚNG 1 file: \`${subMd}\` (folder đã scaffold sẵn — KHÔNG tạo folder).`,
|
||||
` • NẾU mày CÓ Write/Edit tool (implementer-backend/frontend, test-specialist, frontend-designer): GHI TRỰC TIẾP via Write/Edit. 🔴 KHÔNG Bash-write MD ($-expansion/mojibake).`,
|
||||
` • NẾU mày CHỈ có Bash (read-only sub: investigator-codebase/api, reviewer, cicd-monitor — KHÔNG Write tool): 🔴 TUYỆT ĐỐI KHÔNG Bash-write MD → để full-detail trong "findings" + đặt subMdPath="${subMd}"; EM MAIN scribe @P3 (single-writer Write-tool, no-corruption).`,
|
||||
`- 🔴 ISOLATION (B6, AUDIT): CHỈ ghi \`${subMd}\` (+ code-file-disjoint nếu task giao). TUYỆT ĐỐI KHÔNG ghi/sửa: agent-memory/* (MEMORY.md BẤT KỲ sub) · MD canonical (CLAUDE/README/STATUS/agents) · sub-MD agent khác. Em main git-status/diff audit sau P2 — tracked-file đổi ngoài code-disjoint = vi-phạm.`,
|
||||
`- LUÔN return: findings (FULL) + checklistEvidence + memoryDelta (4-field) + subMdPath="${subMd}". H2 harvest-curator gom @session-end (B5) → agent-memory/${role || 'sub'}.`,
|
||||
`- 🔴 KHÔNG store_memory/RAG-write · KHÔNG Bash curl/HTTP Qdrant (:6333 = git-diff MÙ, chỉ chunk-count bắt) · KHÔNG ghi file NGOÀI repo/wave-folder. RAG single-writer=em main; containment = git-diff(in-repo)+chunk-count(RAG) [G-015].`,
|
||||
].join('\n')
|
||||
: [
|
||||
`## OUTPUT write-guard (DEFAULT return-delta-only):`,
|
||||
`- ⚠️ KHÔNG ghi ký ức kênh nào: KHÔNG file MEMORY.md, KHÔNG store_memory/RAG-write (Qdrant). CHỈ return memoryDelta → em main VERIFY + APPEND-only @P3 (B3). KHÔNG overwrite file/chunk của sub khác.`,
|
||||
`- ⚠️ Nếu task có WRITE file: CHỈ file-disjoint được giao (em main git-diff verify sau P2). KHÔNG đụng file ngoài phạm vi. Scope = repo SOLUTION_ERP only (S1).`,
|
||||
].join('\n')
|
||||
|
||||
const prompt = [
|
||||
mem ? `## MEMORY-PACK (${role}) — SLICE ký ức tích lũy của sub này, ĐỌC trước khi làm (KHÔNG phải full memory):\n${mem}\n` : '',
|
||||
spec ? `## SPEC / acceptance-criteria (chung):\n${spec}\n` : '',
|
||||
@ -81,9 +110,9 @@ const results = await parallel(A.taskList.map((t, i) => () => {
|
||||
'- findings: kết quả + evidence file:line (KHÔNG narrative suông).',
|
||||
'- checklistEvidence: số đo / verdict cho acceptance-checklist.',
|
||||
'- memoryDelta {task·verdict·learned·surprise}: để EM MAIN harvest @P3.',
|
||||
'⚠️ KHÔNG ghi ký ức kênh nào: KHÔNG file MEMORY.md, KHÔNG store_memory/RAG-write (Qdrant). CHỈ return memoryDelta → em main VERIFY + APPEND-only @P3 (B3). KHÔNG overwrite file/chunk của sub khác.',
|
||||
'⚠️ Nếu task có WRITE file: CHỈ file-disjoint được giao (em main git-diff verify sau P2). KHÔNG đụng file ngoài phạm vi. Scope = repo SOLUTION_ERP only (S1).',
|
||||
].join('\n'),
|
||||
wave ? '- subMdPath: đường-dẫn sub-MD mày đã ghi.' : '',
|
||||
].filter(Boolean).join('\n'),
|
||||
writeGuard,
|
||||
].filter(Boolean).join('\n')
|
||||
|
||||
return agent(prompt, {
|
||||
|
||||
Reference in New Issue
Block a user