From e27d87717256f9cbd960614ea2a23b0313f266e7 Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Sun, 7 Jun 2026 23:18:43 +0700 Subject: [PATCH] =?UTF-8?q?[CLAUDE]=20Infra:=20adopt=20AI=5FINFRA=20Harnes?= =?UTF-8?q?s=201/2/3=20=E2=80=94=20monitor=20subs=20(roster=208->10)=20+?= =?UTF-8?q?=20wave-folder=20isolation=20+=20email=20channel=20(S49)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../agent-memory/harvest-curator/MEMORY.md | 26 +++++++++ .../agent-memory/investigator-api/MEMORY.md | 1 + .../investigator-codebase/MEMORY.md | 2 + .claude/agent-memory/reviewer/MEMORY.md | 2 + .../agent-memory/tooling-auditor/MEMORY.md | 26 +++++++++ .claude/agents/README.md | 44 ++++++++++++-- .claude/agents/harvest-curator.md | 54 ++++++++++++++++++ .claude/agents/tooling-auditor.md | 57 +++++++++++++++++++ .claude/commands/adap-apply.md | 2 +- .claude/commands/check-email.md | 28 +++++++++ .claude/commands/send-email.md | 36 ++++++++++++ .claude/commands/session-end.md | 13 +++-- .claude/commands/session-start.md | 18 ++++-- .claude/workflows/README.md | 47 +++++++++++++++ .claude/workflows/hmw.js | 39 +++++++++++-- .gitignore | 7 +++ broadcasts/_index.md | 20 +++++++ broadcasts/inbox/README.md | 16 ++++++ broadcasts/inbox/ai_infra/.gitkeep | 0 broadcasts/inbox/ashico/.gitkeep | 0 broadcasts/inbox/bvaau/.gitkeep | 0 broadcasts/inbox/dyd/.gitkeep | 0 broadcasts/inbox/namgroup/.gitkeep | 0 broadcasts/inbox/vipix/.gitkeep | 0 broadcasts/outbox/ai_infra/.gitkeep | 0 broadcasts/outbox/all/.gitkeep | 0 broadcasts/outbox/ashico/.gitkeep | 0 broadcasts/outbox/bvaau/.gitkeep | 0 broadcasts/outbox/dyd/.gitkeep | 0 broadcasts/outbox/namgroup/.gitkeep | 0 broadcasts/outbox/vipix/.gitkeep | 0 docs/HANDOFF.md | 20 ++++++- docs/STATUS.md | 11 +++- .../2026-06-07-S49-harness-1-2-3-adopt.md | 52 +++++++++++++++++ .../2026-06-07-Agent-harness-1.md | 43 ++++++++++++++ .../2026-06-07-Agent-harness-2.md | 42 ++++++++++++++ .../2026-06-07-Agent-harness-3.md | 43 ++++++++++++++ 37 files changed, 626 insertions(+), 23 deletions(-) create mode 100644 .claude/agent-memory/harvest-curator/MEMORY.md create mode 100644 .claude/agent-memory/tooling-auditor/MEMORY.md create mode 100644 .claude/agents/harvest-curator.md create mode 100644 .claude/agents/tooling-auditor.md create mode 100644 .claude/commands/check-email.md create mode 100644 .claude/commands/send-email.md create mode 100644 .claude/workflows/README.md create mode 100644 broadcasts/_index.md create mode 100644 broadcasts/inbox/README.md create mode 100644 broadcasts/inbox/ai_infra/.gitkeep create mode 100644 broadcasts/inbox/ashico/.gitkeep create mode 100644 broadcasts/inbox/bvaau/.gitkeep create mode 100644 broadcasts/inbox/dyd/.gitkeep create mode 100644 broadcasts/inbox/namgroup/.gitkeep create mode 100644 broadcasts/inbox/vipix/.gitkeep create mode 100644 broadcasts/outbox/ai_infra/.gitkeep create mode 100644 broadcasts/outbox/all/.gitkeep create mode 100644 broadcasts/outbox/ashico/.gitkeep create mode 100644 broadcasts/outbox/bvaau/.gitkeep create mode 100644 broadcasts/outbox/dyd/.gitkeep create mode 100644 broadcasts/outbox/namgroup/.gitkeep create mode 100644 broadcasts/outbox/vipix/.gitkeep create mode 100644 docs/changelog/sessions/2026-06-07-S49-harness-1-2-3-adopt.md create mode 100644 docs/governance/adap-reports/2026-06-07-Agent-harness-1.md create mode 100644 docs/governance/adap-reports/2026-06-07-Agent-harness-2.md create mode 100644 docs/governance/adap-reports/2026-06-07-Agent-harness-3.md diff --git a/.claude/agent-memory/harvest-curator/MEMORY.md b/.claude/agent-memory/harvest-curator/MEMORY.md new file mode 100644 index 0000000..eb45a18 --- /dev/null +++ b/.claude/agent-memory/harvest-curator/MEMORY.md @@ -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//MEMORY.md` (placement target). +- **Wave-folder (Harness 2):** `.claude/workflows/wave-/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]. diff --git a/.claude/agent-memory/investigator-api/MEMORY.md b/.claude/agent-memory/investigator-api/MEMORY.md index 41a413a..b8fe5f1 100644 --- a/.claude/agent-memory/investigator-api/MEMORY.md +++ b/.claude/agent-memory/investigator-api/MEMORY.md @@ -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. --- diff --git a/.claude/agent-memory/investigator-codebase/MEMORY.md b/.claude/agent-memory/investigator-codebase/MEMORY.md index 53da2ab..7a3bfbc 100644 --- a/.claude/agent-memory/investigator-codebase/MEMORY.md +++ b/.claude/agent-memory/investigator-codebase/MEMORY.md @@ -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]`. diff --git a/.claude/agent-memory/reviewer/MEMORY.md b/.claude/agent-memory/reviewer/MEMORY.md index 40d21a5..1d7e919 100644 --- a/.claude/agent-memory/reviewer/MEMORY.md +++ b/.claude/agent-memory/reviewer/MEMORY.md @@ -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]`. diff --git a/.claude/agent-memory/tooling-auditor/MEMORY.md b/.claude/agent-memory/tooling-auditor/MEMORY.md new file mode 100644 index 0000000..15b8691 --- /dev/null +++ b/.claude/agent-memory/tooling-auditor/MEMORY.md @@ -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]. diff --git a/.claude/agents/README.md b/.claude/agents/README.md index f6569da..1e84c7c 100644 --- a/.claude/agents/README.md +++ b/.claude/agents/README.md @@ -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`. diff --git a/.claude/agents/harvest-curator.md b/.claude/agents/harvest-curator.md new file mode 100644 index 0000000..c09b8c6 --- /dev/null +++ b/.claude/agents/harvest-curator.md @@ -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-/sub-*.md` (+ agent-team `.claude/agent-teams//`) → gom delta → đề-xuất em main consolidate APPEND vào `agent-memory/` sub tương-ứng (để sub-chính có đầy-đủ memory). Ghi `wave-/_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-/` — 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). diff --git a/.claude/agents/tooling-auditor.md b/.claude/agents/tooling-auditor.md new file mode 100644 index 0000000..a1f0501 --- /dev/null +++ b/.claude/agents/tooling-auditor.md @@ -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). diff --git a/.claude/commands/adap-apply.md b/.claude/commands/adap-apply.md index 178cdca..7297dc1 100644 --- a/.claude/commands/adap-apply.md +++ b/.claude/commands/adap-apply.md @@ -11,7 +11,7 @@ argument-hint: **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/.md` ⇒ ĐÃ xử → **skip**. - **Cold-start:** folder `adap-reports/` chưa có ⇒ **tạo folder** + coi **mọi broadcast = chưa-applied** (lần đầu). diff --git a/.claude/commands/check-email.md b/.claude/commands/check-email.md new file mode 100644 index 0000000..df408a9 --- /dev/null +++ b/.claude/commands/check-email.md @@ -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: +--- +# /check-email — 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 `/broadcasts/outbox/se/*.md` (message gửi cho se). +3. Mỗi file CHƯA có trong inbox (so id): **COPY VERBATIM** → `broadcasts/inbox/.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 · → se · status=pending · folder=(root) · sha256(12) · verify=✓`. + +**STAGE 2 — Xử lý xong → archive (PROCESSED):** +6. Sau khi xử lý → **MOVE** `inbox/.md` → `inbox//.md`. +7. Update `_index.md`: `status=processed · folder=`. + +## Audit (anh) +`ls broadcasts/inbox/*.md` (root) = **pending chưa xử lý** (backlog hiện ngay) · `inbox//` = **đã 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. diff --git a/.claude/commands/send-email.md b/.claude/commands/send-email.md new file mode 100644 index 0000000..7c77387 --- /dev/null +++ b/.claude/commands/send-email.md @@ -0,0 +1,36 @@ +--- +description: Gửi email cross-project qua broadcasts/ (Harness 3 §N) cho SOLUTION_ERP (self=se). Ghi outbox// repo MÌNH. §J2. Adopt AI_INFRA Harness 3 (2026-06-07). +argument-hint: [category] [intent...] +--- +# /send-email — 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** = `-se-to--` (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: · category · type: broadcast|update|fix|report|request|coord · date · content_sha256 · nac: sent`. +6. **Ghi** `broadcasts/outbox//.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/-cc.md` (Write tool — repo MÌNH = §J2-safe, KHÔNG ghi inbox ai_infra) — **body + `content_sha256` Y HỆT** primary; frontmatter `id: -cc · from: se · to: ai_infra · cc-of: · 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. diff --git a/.claude/commands/session-end.md b/.claude/commands/session-end.md index f066b03..1624d23 100644 --- a/.claude/commands/session-end.md +++ b/.claude/commands/session-end.md @@ -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/` + 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 diff --git a/.claude/commands/session-start.md b/.claude/commands/session-start.md index 74e4d7f..43f18d4 100644 --- a/.claude/commands/session-start.md +++ b/.claude/commands/session-start.md @@ -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. diff --git a/.claude/workflows/README.md b/.claude/workflows/README.md new file mode 100644 index 0000000..c153d28 --- /dev/null +++ b/.claude/workflows/README.md @@ -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-/` — **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-/sub--.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-/ ← 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--.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-/` + `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--.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-/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-/sub-*.md` → 5-trục integrity → đề-xuất em main consolidate APPEND vào `agent-memory/` sub tương-ứng → sub-chính có đầy-đủ memory. Ghi `_harvest.md` propose. + +## Agent-team (`.claude/agent-teams//` — 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//` → 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". diff --git a/.claude/workflows/hmw.js b/.claude/workflows/hmw.js index a67d03f..bca4e30 100644 --- a/.claude/workflows/hmw.js +++ b/.claude/workflows/hmw.js @@ -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-/ @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: '', // checkpointApproved: true, // em main set SAU khi BÁO {số agent·vai·task} @inform (S2) // taskList: [ { role:, label:'..', prompt:'..' }, ... ] +// wave: { name:'', dir:'.claude/workflows/wave-' } // 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, { diff --git a/.gitignore b/.gitignore index 44bbbff..247ad60 100644 --- a/.gitignore +++ b/.gitignore @@ -86,6 +86,13 @@ src/Backend/SolutionErp.Api/wwwroot/exports/ # Pattern AFTER !.claude/** so last-match wins (.claude/ itself not excluded → re-include valid). .claude/hmw-mode.on +# HMW wave-folder + agent-team — transient per-workflow detail (Harness 2 B6 isolation — +# H2 harvest-curator gom rồi; gitignore để git-diff audit isolation SẠCH, 0 noise). +# Pattern AFTER !.claude/** so last-match wins (giống hmw-mode.on). +# Verify: git check-ignore -v .claude/workflows/wave-x/wave.md +.claude/workflows/wave-*/ +.claude/agent-teams/ + # Claude harness orphan dumps *.zip diff --git a/broadcasts/_index.md b/broadcasts/_index.md new file mode 100644 index 0000000..190e8a4 --- /dev/null +++ b/broadcasts/_index.md @@ -0,0 +1,20 @@ +# broadcasts/ — _index (Harness 3 · single index) — SOLUTION_ERP (self=`se`) + +> **1 INDEX DUY NHẤT** theo dõi MỌI message qua kênh email (in + out). Adopt AI_INFRA Harness 3 (anh 06-07). +> Mỗi message = 1 dòng. **Append-only.** Inbound: stick **đã-đọc** khi xử lý xong. +> **verify** = `SHA256(body)` bản copy == `content_sha256` (frontmatter) == bản `outbox` bên gửi (byte-identical) → ✓ · lệch = ✗ (tamper-flag, điều tra ngay). +> Folder map: `A/outbox/B/` (A→B) ⇄ `B/inbox/A/` (B kéo về). 6 folder mỗi chiều (trừ self=se). +> **Fan-out adap broadcast** (≠ email directed) → `outbox/all/` (pull `/adap-apply`), track ở COMMS-LEDGER OUT — KHÔNG ở index này (index = email mesh in/out). +> **infra-CC row (§N3):** message `-cc` (`cc-of:`) = bản-2 se gửi `ai_infra` giám sát infra-comms sister↔sister. Ghi rõ `cc-of` vào cell `from → to` — vd OUTBOUND `se → ai_infra (cc-of:vipix)` · INBOUND `vipix → ai_infra (cc-of:se)`. Cùng status/verify như message thường (whole-file + body-hash đối chứng). + +## 📥 INBOUND (nhận — qua `/check-email `) +> status: **pending** (ở `inbox/` root, chưa xử lý) → **processed** (đã MOVE vào `inbox//`). + +| received | id | from → to | status | folder | sha256(12) | verify | +|---|---|---|---|---|---|---| +| _(chưa nhận message nào — H3 scaffold)_ | | | | | | | + +## 📤 OUTBOUND (gửi — qua `/send-email `) +| sent (ISO) | id | from → to | folder | sha256(12) | +|---|---|---|---|---| +| _(chưa gửi message nào — H3 scaffold)_ | | | | | diff --git a/broadcasts/inbox/README.md b/broadcasts/inbox/README.md new file mode 100644 index 0000000..f9bc0a6 --- /dev/null +++ b/broadcasts/inbox/README.md @@ -0,0 +1,16 @@ +# inbox/ — Received-message archive (Harness 3 · 2-stage per-project) — SOLUTION_ERP (self=`se`) + +> **Mục đích:** Lưu **BẢN COPY VERBATIM** message NHẬN → căn cứ đối chứng (anh 06-07). Index: [`../_index.md`](../_index.md). Protocol: AI_INFRA `broadcasts/README.md` §Harness 3 (pull cross_project_search). + +## 2-stage (audit qua folder — anh chốt 06-07) +1. **Nhận** (`/check-email `): COPY VERBATIM `/outbox/se/*` → **`inbox/.md` (root) = PENDING** (chưa xử lý / xử lý sau). [ghi repo mình, §J2] +2. **Xử lý xong** → **MOVE** `inbox/.md` → **`inbox//.md`** = PROCESSED (archive theo project gửi). + +→ **Audit:** `inbox/*.md` (root) = backlog chưa xử lý (lộ ngay) · `inbox//` = đã xử lý. "check folder biết làm ăn đàng hoàng." + +## Per-project (6 folder, trừ self=se) = đã xử lý +`inbox/{ai_infra,vipix,dyd,namgroup,ashico,bvaau}/`. **Map:** `A/outbox/se/` → (xử lý) → `inbox/A/` (byte-identical, đối chứng). + +## Luật +- **KHÔNG sửa** file copy (bằng chứng đông cứng) · **PHẢI committed** (khác wave-folder gitignored) · verify hash khi nhận (✗ = tamper → KHÔNG move, flag). +- 🔴 **Folder rỗng cần `.gitkeep` committed** — git KHÔNG track dir rỗng; thiếu → clone mất `inbox//` → STAGE-2 MOVE vỡ (reviewer-gate H3 catch 06-07). diff --git a/broadcasts/inbox/ai_infra/.gitkeep b/broadcasts/inbox/ai_infra/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/inbox/ashico/.gitkeep b/broadcasts/inbox/ashico/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/inbox/bvaau/.gitkeep b/broadcasts/inbox/bvaau/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/inbox/dyd/.gitkeep b/broadcasts/inbox/dyd/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/inbox/namgroup/.gitkeep b/broadcasts/inbox/namgroup/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/inbox/vipix/.gitkeep b/broadcasts/inbox/vipix/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/outbox/ai_infra/.gitkeep b/broadcasts/outbox/ai_infra/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/outbox/all/.gitkeep b/broadcasts/outbox/all/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/outbox/ashico/.gitkeep b/broadcasts/outbox/ashico/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/outbox/bvaau/.gitkeep b/broadcasts/outbox/bvaau/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/outbox/dyd/.gitkeep b/broadcasts/outbox/dyd/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/outbox/namgroup/.gitkeep b/broadcasts/outbox/namgroup/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/broadcasts/outbox/vipix/.gitkeep b/broadcasts/outbox/vipix/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index 73391b2..64c41c3 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -2,7 +2,25 @@ > **Tiering rule (S40):** giữ **2-3 session gần nhất**. Cũ hơn → `docs/changelog/sessions/`. Full brief history pre-S40 → `docs/_archive/HANDOFF-preS40-fullhistory.md`. -**Last updated:** 2026-06-02 (Session 48 — adap-* verification closure post-restart: #1 store_memory VERIFIED-runtime (0/8 subs) · #2 frontend-designer FD2 loop VERIFIED-RAN (first spawn, login a11y fix ×2 app) · #3 Gov-v2 delta CLOSED (NEW error-ledger.md + §L.b session-end). Login fix deploys. Prev: S47 adap channel install; S46 memory repair.) +**Last updated:** 2026-06-07 (Session 49 — **AI_INFRA Harness 1·2·3 adopt** (HMW-mode ON): H1+H2 = 2 monitor sub TÁCH BIỆT (tooling-auditor + harvest-curator → roster 8→10) + wire session-start/end · H2 wave-folder isolation (hmw.js wave-mode + .gitignore B6) · H3 email channel `broadcasts/` (self=se). reviewer PASS all 3. **executed-file, verified-runtime PENDING CLI restart.** Prev: S48 adap verify closure; S47 adap channel install.) + +--- + +## S49 (2026-06-07) — AI_INFRA Harness 1·2·3 adopt (HMW-mode ON · governance/infra, no product code) + +**User: `/ultra-on` + `/adap-apply harness 1·2·3` — BẬT HMW-mode rồi adopt 3 broadcast harness của AI_INFRA.** + +**HMW flow:** marker `.claude/hmw-mode.on` tạo (ON) → P2 recon fan-out **4 read-only agent** (3× investigator-codebase gap H1/H2/H3 + 1× investigator-api plugin audit · return-delta · 367K tok ~4m46s) → P3 harvest → em main single-writer WRITE ~25 file → reviewer P4 **PASS all 3**. **Containment post-P2:** git-diff 1 file-write (inv-api self-MEMORY benign) + chunk-count 2414=2414 (0 RAG-write) = defense-in-depth proven. + +**Done:** +- **H1 (Self-observability):** roster **8→10** — NEW 2 sub TÁCH BIỆT (anh-mandate H1≠H2 "hay quên+nhầm") `tooling-auditor` (tooling/docs-freshness 4-mặt) + `harvest-curator` (harvest-integrity 5-trục), INFORM-only (4 RAG-read, NO store_memory/Write) + 2 memory seed. Wire `session-start.md` Phase 2.1.1 RE-REPORT + `session-end.md` §L.b 6→7-step. H3 plugin/skill = gộp-vai doc (0 agent mới). +- **H2 (wave-folder isolation):** `hmw.js` wave-mode (subMdPath + tool-aware writeGuard) + `.gitignore` `wave-*/`+`agent-teams/` (B6 **git-check-ignore VERIFIED**) + NEW `.claude/workflows/README.md`. ADD-mode (chỉ workflow DÀI). A agent-team n-a (Windows in-process). +- **H3 (email channel):** NEW `broadcasts/` (outbox/{6 others+all} + inbox/{6 others} + _index + inbox/README + **13 .gitkeep**, committed) + 2 cmd send/check-email (self=`se`, 6 others short-id `{ai_infra,vipix,dyd,namgroup,ashico,bvaau}`) + adap-apply base-path fix `outbox/all/`. +- **3 adap-report** `docs/governance/adap-reports/2026-06-07-Agent-harness-{1,2,3}.md` + reviewer PASS (no blocker; 1 MINOR pre-existing README diagram → fixed). **Test 181 unchanged** (no .cs). + +**🔴 NEXT SESSION FIRST (anh restart CLI):** 1 restart activate 2 sub + 2 cmd + hmw.js wave-mode (agent/cmd `.md` no hot-reload). Then: (a) `/session-start` smoke-test 2 monitor sub load + RE-REPORT chạy thật → verified-runtime; (b) optional wave-run 1 workflow DÀI kiểm B6 isolation + B5 harvest; (c) optional `/send-email ai_infra handshake` → AI_INFRA `/check-email se` prove 2-way byte-identical. + +**Next product (anh pick):** P11-C Vehicle+Driver (Mig 44, recon ready) · gotcha #57 LeaveType/Shift filtered-unique · P11-D/E/F · Phase 9 Ops. --- diff --git a/docs/STATUS.md b/docs/STATUS.md index 0677935..2580ba1 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -3,7 +3,7 @@ > **Update rule:** trước khi bắt đầu 1 task → ghi row `🔥 In Progress`. Xong → `✅ Recently Done`. > **Tiering rule (S40):** chỉ giữ **state hiện tại + 3 session gần nhất** ở file này. Session cũ hơn → `docs/changelog/sessions/`. Full history pre-S40 → `docs/_archive/STATUS-preS40-fullhistory.md`. (Tránh over-context — xóa double, không cắt nội dung.) -**Last updated:** 2026-06-02 (Session 48 — **adap-* verification closure post-restart** (governance + 1 a11y fix): #1 store_memory strip **VERIFIED-runtime** (registry 0/8 subs) · #2 frontend-designer **FD2 loop VERIFIED-RAN** (first spawn — login contrast a11y fix shipped ×2 app) · #3 Gov-v2 delta **CLOSED** (NEW `error-ledger.md` + §L.b 6-step wired session-end). Login fix = code commit (deploys). Prev: S47 adap channel install; S46 memory repair.) +**Last updated:** 2026-06-07 (Session 49 — **AI_INFRA Harness 1·2·3 adopt** (HMW-mode ON — recon fan-out 4 read-only agent @P2 + em main single-writer WRITE ~25 file, governance/infra no product code): H1+H2 = **2 monitor sub TÁCH BIỆT** (tooling-auditor + harvest-curator → roster 8→10) + session-start/end wire · H2 **wave-folder isolation** (hmw.js wave-mode + .gitignore B6 VERIFIED git-check-ignore) · H3 **email channel** `broadcasts/` (self=se, 6+6 folder + 2 cmd). Nấc executed-file, **verified-runtime PENDING CLI restart**. Prev S48: adap verify closure; S47 adap channel install.) --- @@ -20,7 +20,7 @@ | Gotchas | **57** | `docs/gotchas.md` (latest #57 soft-delete UNIQUE phải filter [IsDeleted]=0, S45) | | User memory | **15** | 14 + new S47 (adap-channel); index updated | | Skills | 6 | 3 domain + 3 ops | -| Sub-agents | **8** | Opus 4.8 1M · 7 core + frontend-designer pink (FD2 loop **verified-ran** S48) | +| Sub-agents | **10** | Opus 4.8 1M · 8 product/quality (7 core + frontend-designer) + **2 monitor INFORM-only** (tooling-auditor H1 + harvest-curator H2, S49 2026-06-07 Harness 1 — verified-runtime PENDING CLI restart) | | RAG chunks | **2406** | ✅ S41 re-bootstrap clean (3080→2406, −674 junk: node_modules+_archive now excluded; user-memory 60 chunks/10 files slug-fixed + S38-S41 indexed) | **Bundle hash live (prod):** admin `DPPTx2Kw` · user `CjoUEsoV` (Gitea Run #369, S48 — rotated from `Krjvg_3j`/`6sNStgxa` by login a11y fix). cicd-monitor PASS: test 181 · Mig stays 43 · health/smoke 200 ×4. @@ -44,6 +44,13 @@ ## ✅ Recently Done (newest on top — 3 session; cũ hơn → session logs) +### S49 (2026-06-07) — 🌐 AI_INFRA Harness 1·2·3 adopt (HMW-mode ON · governance/infra, no product code, CI-skip) +- **HMW-mode BẬT** (`/ultra-on` → marker `.claude/hmw-mode.on` gitignored) → anh `/adap-apply harness 1·2·3`. **Recon fan-out 4 read-only agent @P2** (3× investigator-codebase H1/H2/H3 gap + 1× investigator-api plugin/skill audit · return-delta · 367K tok · ~4m46s) → em main single-writer WRITE ~25 file. **Containment audit post-P2:** git-diff = 1 file-write (inv-api self-MEMORY, benign verified) + chunk-count **2414=2414** (0 RAG-write) → defense-in-depth proven (sub giữ Bash/Write — G-015). +- **Harness 1 (Self-observability):** roster **8→10** — NEW 2 sub **TÁCH BIỆT** (anh-mandate) `tooling-auditor` (H1 tooling/docs-freshness 4-mặt skill·sub-role·plugin·docs) + `harvest-curator` (H2 harvest-integrity 5-trục), INFORM-only (4 RAG-read, NO store_memory/Write). Wire `session-start.md` Phase 2.1.1 RE-REPORT + `session-end.md` §L.b **6→7-step** (H2 5-trục GATE + H1 chốt + B5 wave-gom). H3 plugin/skill = gộp-vai doc (0 agent mới — code-modernization/code-reviewer KHÔNG enable). +- **Harness 2 (wave-folder isolation):** `hmw.js` +wave-mode (subMdPath schema + tool-aware writeGuard) · `.gitignore` +`wave-*/`+`agent-teams/` (B6 **VERIFIED** `git check-ignore`) · NEW `.claude/workflows/README.md` convention. A agent-team = n-a (Windows in-process, convention-ready). +- **Harness 3 (email channel):** NEW `broadcasts/` (outbox/{6 others+all}/ + inbox/{6 others}/ + _index + inbox/README + **13 .gitkeep**, committed not-gitignored) + 2 cmd `send/check-email` (self=`se`, 6 others short-id `{ai_infra,vipix,dyd,namgroup,ashico,bvaau}`) + fix `adap-apply.md` base-path → `outbox/all/` (latent bug đóng luôn). +- **3 adap-report** `docs/governance/adap-reports/2026-06-07-Agent-harness-{1,2,3}.md` (nấc executed-file/verified-pending + evidence + tailored/skip + G-015 honest-caveat). 🟥 reviewer P4 **PASS all 3 — no blocker** (genuinely tailored not copy-paste · B6 git-check-ignore verified · SHA256 byte-identical · 1 MINOR pre-existing README diagram drift → fixed). **Test 181 unchanged** (no .cs). 🔴 **NEXT: anh restart CLI** → activate 2 sub + 2 cmd + hmw.js wave-mode → spawn-test confirm verified-runtime. → session log `2026-06-07-S49-harness-1-2-3-adopt.md`. + ### S48 (2026-06-02) — ✅ adap-* verification closure post-restart + FD2 proof + Gov-v2 error-ledger (governance + 1 a11y fix) - **CLI restart confirmed done** (registry has frontend-designer + adap-* cmds + 8 subs sans store_memory) → S47 "verified-pending" upgraded. `/adap-apply all-pending` = 0 new (all 3 applied S47); `/adap-report all-applied` → re-assessed + updated 3 reports honest (§C5/G-015). - **#1 store_memory strip → VERIFIED-runtime:** `grep` agents `tools:` = 0 · loaded registry grants 0 `store_memory` to all **8** subs. NOT "read-only" (subs keep Bash/Write — defense-in-depth caveat holds). diff --git a/docs/changelog/sessions/2026-06-07-S49-harness-1-2-3-adopt.md b/docs/changelog/sessions/2026-06-07-S49-harness-1-2-3-adopt.md new file mode 100644 index 0000000..223a3e6 --- /dev/null +++ b/docs/changelog/sessions/2026-06-07-S49-harness-1-2-3-adopt.md @@ -0,0 +1,52 @@ +# Session 49 — 2026-06-07 — AI_INFRA Harness 1·2·3 adopt (HMW-mode ON) + +> Governance/infra adoption — **no product code** (0 .cs/.tsx), test 181 unchanged, CI-skip (all .md/.js/.gitignore/broadcasts). User: `/ultra-on` + `/adap-apply harness 1·2·3`. + +## Bối cảnh +AI_INFRA broadcast 3 file harness (2026-06-07, reviewer_gate PASS, targets all-fit) trong `outbox/all/`. User BẬT HMW-mode (`/ultra-on`) = consent Workflow fan-out, rồi adopt cả 3 qua `/adap-apply`. + +## HMW flow (8-agent governance) +- **P0 prep (em main):** dedup check (0 report harness-* → all chưa-applied) · audit current infra (roster 8, hmw.js có, broadcasts/ chưa) · đọc 2 investigator memory-slice (B1) · baseline Qdrant 2414 · git clean. +- **P2 recon fan-out (Workflow `harness-recon`, 4 read-only agent, return-delta):** 3× investigator-codebase (H1 roster/session-wiring gap · H2 wave/hmw.js gap · H3 email scaffold spec) + 1× investigator-api (plugin/skill marketplace audit). 367K tok · 67 tool-use · ~4m46s · 4/4 returned. +- **Containment audit post-P2 (defense-in-depth):** `git diff` = 1 file-write (investigator-api tự-APPEND MEMORY.md qua Write/Bash dù store_memory strip — benign, đúng chỗ, verified) · 3 inv-codebase = 0 write (return-only đúng R1). `chunk-count 2414=2414` (0 RAG-write). → G-015 chứng: containment = git-diff + chunk-count, KHÔNG allowlist đơn-độc (sub giữ Bash/Write). +- **P3 harvest (em main single-writer):** APPEND delta 3-slice → investigator-codebase/MEMORY.md; investigator-api self-append giữ (verified). +- **WRITE (em main single-writer governance, ~25 file):** 3 harness (chi tiết dưới). +- **P4 reviewer (full memory, adversarial):** PASS all 3 — no blocker. + +## 3 corrections recon caught (vs giả định ban đầu) +1. **Harness 3 id = `se`** (KHÔNG `solution_erp`); 6 others short-id `{ai_infra,vipix,dyd,namgroup,ashico,bvaau}` — authoritative `AI_INFRA/broadcasts/sister-commands/send-email.md:13-22` (folder name = 2nd source-of-truth). +2. **adap-apply.md base-path STALE** `outbox\*.md` → cần `outbox\all\*.md` (latent bug, đóng luôn). +3. **H3 plugin: 0 agent mới** — sql-database-assistant/frontend-design đã là standalone skill; code-modernization/pr-review-toolkit agent-bearing → KHÔNG enable (trùng vai); code-reviewer ×3 collision → giữ roster `reviewer`. + +## Harness 1 — Self-observability (roster 8→10) +- NEW `.claude/agents/tooling-auditor.md` (H1 tooling/docs-freshness 4-mặt skill·sub-role·plugin·docs) + `.claude/agents/harvest-curator.md` (H2 harvest-integrity 5-trục) — **TÁCH BIỆT** (anh-mandate H1≠H2 "hay quên+nhầm"). INFORM-only, tools `[Read,Grep,Glob,Bash+4 RAG-read]`, NO store_memory/Write. + 2 memory seed. +- `.claude/agents/README.md`: title 7→**10-agent** + architecture note + upgrade-note + skill matrix +2 + tool grant G-015 note + decision tree +2 nhánh + §H3 external skill/plugin mapping. (+ fixed pre-existing diagram drift line 11/18.) +- `session-start.md` Phase **2.1.1** Monitor RE-REPORT (H1 diff + H2 harvest-mới). `session-end.md` §L.b **6→7-step** ((d)(f)=H2 5-trục GATE + B5 wave-gom · (g)=H1 chốt+new-alloc). +- **Tailor SE (KHÔNG copy AI_INFRA):** 4 RAG-read thay 2 · model:inherit thay effort:max · bỏ agent-ops-monitor/sister · omit color (8 màu hết) · Fidelity→SE reviewer. + +## Harness 2 — wave-folder memory-isolation (B1-B6) +- `.claude/workflows/hmw.js` +WAVE-MODE: `subMdPath` schema · `wave` block · tool-aware `writeGuard` (Write-sub ghi-direct / read-only-sub return→lead-scribe) · B6 isolation prompt. Mirror AI_INFRA, tailor 8-role (read-only sub = investigator-codebase/api, reviewer, cicd-monitor). +- `.gitignore` +`.claude/workflows/wave-*/` +`.claude/agent-teams/` (AFTER `!.claude/**` last-match-wins). **B6 VERIFIED** `git check-ignore -v`: wave/agent-teams ignored · hmw.js/README tracked. +- NEW `.claude/workflows/README.md` (2-MODE table · wave structure · B1-B6 · agent-team n-a · guard). +- B5 harvest wired session-end §L.b(f). A agent-team = n-a (Windows in-process, convention-ready). ADD-mode (chỉ workflow DÀI). + +## Harness 3 — email channel cross-project (`broadcasts/`) +- NEW `broadcasts/` tree: `outbox/{ai_infra,vipix,dyd,namgroup,ashico,bvaau,all}/` + `inbox/{6 others}/` + `_index.md` + `inbox/README.md` + **13 .gitkeep** (committed, NOT gitignored). +- NEW `.claude/commands/send-email.md` + `check-email.md` (self=`se`, validate to≠se, 2-stage MOVE, **canonical content_sha256 formula EXACT**, infra-CC §N3). +- `.claude/commands/adap-apply.md` base-path → `outbox\all\*.md`. + +## reviewer verdict (P4) — PASS all 3, no blocker +- H1: 2 sub scope-disjoint + tools correct (no store_memory/Write) + genuinely tailored (not copy-paste) + 4-mặt/5-trục đủ. +- H2: hmw.js valid mirror + VALID_ROLES 8 + B6 git-check-ignore verified + G-015 honest. +- H3: self=se complete + SHA256 formula byte-identical send==check + 13 .gitkeep (floor "12" undercount, em đúng 13) + adap-apply fixed. +- honest nấc PASS (executed-file/verified-runtime-pending). G-015 scan 6 hits ALL negating = correct. mojibake false-pos "ĐÃ" clean. +- **1 MINOR (non-block, fixed):** README:11/18 "7-agent" diagram = PRE-EXISTING (git diff proved work này chỉ touch load-bearing) → em fixed header + line 18 + note. + +## Nấc honest + NEXT +- **executed-file** toàn bộ; **verified-runtime PENDING anh restart CLI** (agent/cmd `.md` no hot-reload). +- 🔴 NEXT: restart → `/session-start` smoke-test 2 monitor sub load + RE-REPORT · optional wave-run kiểm B6/B5 · optional `/send-email ai_infra handshake` → AI_INFRA `/check-email se` 2-way. + +## Artifacts +- 3 adap-report `docs/governance/adap-reports/2026-06-07-Agent-harness-{1,2,3}.md` (5-field LOCK). +- user-memory `feedback_harness_123_adoption.md` (project). +- Commit: [pending — fill sha post-commit]. diff --git a/docs/governance/adap-reports/2026-06-07-Agent-harness-1.md b/docs/governance/adap-reports/2026-06-07-Agent-harness-1.md new file mode 100644 index 0000000..26b11e4 --- /dev/null +++ b/docs/governance/adap-reports/2026-06-07-Agent-harness-1.md @@ -0,0 +1,43 @@ +# adap-report — 2026-06-07-Agent-harness-1 + +> SISTER = SOLUTION_ERP. Report-format LOCK (5 trường). Generated 2026-06-07, apply by em main (HMW-mode ON — recon fan-out 4 read-only agent @P2, WRITE = em main single-writer governance). Agent/command `.md` **chưa runtime-live pre-restart** (no hot-reload). + +## 1. id-broadcast +`2026-06-07-Agent-harness-1` (category: Agent · reviewer_gate: **PASS** · nac: published · targets: **all-fit**). Harness 1 = Self-observability: **H1** tooling-freshness audit + **H2** harvest-integrity audit (⚠️ anh-mandate 2 sub TÁCH BIỆT) + **H3** plugin/skill adoption (gộp-vai, KHÔNG phình roster). + +## 2. nac G-011 +**executed-file** (2 sub mới + 2 memory seed + agents/README roster 8→10 + session-start Phase 2.1.1 + session-end §L.b 7-step + H3 mapping section written) → **VERIFIED-pending CLI restart** (agent `.md` no hot-reload → cần (a) restart Claude Code để registry load tooling-auditor + harvest-curator, (b) 1 spawn-test mỗi sub confirm load OK + chạy 4-mặt/5-trục thật). H3 = recommend-only executed (mapping doc written; 0 plugin enable thực — skills đã available user-global). + +## 3. evidence +**PROJECT-FIT = ADOPT (tailored).** H1 phổ-quát (mọi roster cần freshness). H2 ADOPT (SE có 10-sub roster + Workflow → có memory để harvest). H3 per-stack. + +Files written/edited (repo SOLUTION_ERP): +- **H1 sub** — NEW `.claude/agents/tooling-auditor.md` (4-mặt: skill·sub-role·plugin·docs freshness; @session-start báo+diff, @session-end chốt+new-alloc; INFORM-only) + seed `.claude/agent-memory/tooling-auditor/MEMORY.md`. +- **H2 sub** — NEW `.claude/agents/harvest-curator.md` (5-trục: Coverage·Completeness·Fidelity-FLAG·Placement·Corruption; @session-end GATE + wave-gom B5; @session-start harvest-mới; INFORM-only) + seed `.claude/agent-memory/harvest-curator/MEMORY.md`. +- **roster doc** — `.claude/agents/README.md`: title 7→**10-agent**, architecture line (8 product/quality + 2 monitor), upgrade-note 06-07, skill matrix +2 row, tool grant +monitor note (read-set + store_memory strip + G-015), decision tree +2 nhánh (tooling-auditor/harvest-curator). +- **lifecycle wire** — `session-start.md` Phase **2.1.1** Monitor RE-REPORT (H1 tooling-state+diff · H2 harvest-mới+delta-mồ-côi) + roster 7→10; `session-end.md` §L.b **6-step→7-step** ((d)(f)=H2 5-trục GATE + wave-gom B5 · (g)=H1 chốt+new-alloc) + roster refs 7→10. +- **H3 mapping** — `.claude/agents/README.md` §"External skill/plugin mapping" (sql-database-assistant/frontend-design→vai · pr-review-toolkit→reviewer checklist · KHÔNG enable code-modernization/code-reviewer/csharp-lsp). + +SELF-CHECK (broadcast H1): +- H1.1: tooling-auditor.md audit 4-mặt (skill·sub-role·plugin·docs). ✓ (executed-file) +- H1.2: wired CHỐT @session-end (§L.b g) + RE-REPORT-diff @session-start (2.1.1). ✓ +- H1.3/H2.3: INFORM-only + lead single-writer (VERIFY→APPEND B3); 2 sub `tools:` KHÔNG store_memory/Write. ✓ (verify post-restart `grep store_memory .claude/agents/tooling-auditor.md harvest-curator.md` = 0) +- H2.1: harvest-curator.md 5-trục đủ (nâng từ session-end §L.b 3/5 sẵn có → 5/5 + Fidelity-escalate-reviewer + Placement). ✓ +- H2.2: GATE @session-end §L.b(f) + RE-REPORT @session-start 2.1.1. ✓ +- H3.1/3.2: rà marketplace + 23 standalone skill → gộp-vai, 0 agent mới. ✓ +- H3.3: Windows-no-op (csharp-lsp) + name-collision (code-reviewer→giữ reviewer canonical) + KHÔNG phình roster. ✓ +- **H1/H2 RIÊNG BIỆT (anh-mandate):** 2 file .md TÁCH BIỆT, scope overlap=0. ✓ + +commit-sha: **pending** (fill post-commit — xem follow-up "[CLAUDE] Docs: fill adap-report sha"). + +## 4. tailored-gì + skip-gì-vì-sao +- **FUNCTION-floor adopt FULLY:** H1 4-mặt · H2 5-trục · H1≠H2 2-sub-riêng-biệt (mandate) · INFORM-only + single-writer · @session-start diff + @session-end chốt/gate · H3 gộp-vai-KHÔNG-phình-roster — giữ đủ, KHÔNG hạ floor. +- **FORM tailored SE:** (a) tools 2 sub = **4 RAG-read** (search_memory/search_code/cross_project_search/list_projects) thay AI_INFRA **2-RAG**; `model:inherit` thay `effort:max`. (b) **Bỏ "agent-ops-monitor/sister"** vai (AI_INFRA-specific) — SE là sister, audit self-only. (c) ref SE files (agents/README, docs/STATUS, docs/governance) thay AGENT-ROSTER/CANONICAL. (d) Fidelity-escalate → SE `reviewer`. (e) **omit `color`** (8 màu chuẩn cyan/blue/yellow/orange/purple/red/green/pink đã hết; brown/teal không trong enum chuẩn → tránh load-fail; mirror AI_INFRA cũng omit). (f) H2 NÂNG nền sẵn có (session-end §L.b(d)(f)(c) = 3/5 trục) thay build-from-scratch. +- **KHÔNG skip mục nào** (H1/H2/H3 đều fit). H3 = recommend+map (KHÔNG enable plugin agent-bearing — đúng floor "CHỈ enable nếu lấp lỗ-hổng roster THẬT"; roster 10 đã đủ). + +## 5. honest-caveat +- **🔴 nấc honest:** executed-file, **CHƯA verified-runtime**. 2 sub CHƯA spawn lần nào (agent .md no hot-reload). Đừng đọc report = "monitor đã chạy". verified-runtime cần anh restart CLI + spawn-test tooling-auditor/harvest-curator (giống S39 split + S47 frontend-designer lesson). +- **G-015 KHÔNG overclaim:** 2 sub = **propose-only**, KHÔNG "read-only enforced". `store_memory` strip = tool RAG-write không-gọi-được; NHƯNG giữ `Bash` = write-channel mở (recon-wave này đã CHỨNG: investigator-api tự-APPEND MEMORY.md qua Write/Bash dù strip — git-diff bắt 1 file-write, chunk-count 2414=2414 bắt 0 RAG-write). Containment = defense-in-depth (em main single-writer + git-diff + chunk-count), KHÔNG allowlist đơn-độc. +- **name-collision (FORM, KHÔNG runtime):** tooling-auditor/harvest-curator trùng tên AI_INFRA canonical — KHÁC repo → KHÔNG collision lúc chạy; body ĐÃ tailor SE (KHÔNG copy-paste). code-reviewer (×3 nguồn) collide roster reviewer → giữ `reviewer` canonical, KHÔNG enable plugin code-reviewer. +- **H3 plugin nấc:** 15 plugin = ENABLED user-global, mapping doc = **assigned**, CHƯA used-in-session. KHÔNG conflate "enabled"="đang dùng". +- **Restart-batch:** Harness 1+2+3 (S này) → toàn bộ agent/command/workflow `.md`/`.js` cần 1 restart chung hot-reload. diff --git a/docs/governance/adap-reports/2026-06-07-Agent-harness-2.md b/docs/governance/adap-reports/2026-06-07-Agent-harness-2.md new file mode 100644 index 0000000..632d730 --- /dev/null +++ b/docs/governance/adap-reports/2026-06-07-Agent-harness-2.md @@ -0,0 +1,42 @@ +# adap-report — 2026-06-07-Agent-harness-2 + +> SISTER = SOLUTION_ERP. Report-format LOCK (5 trường). Generated 2026-06-07, apply by em main (HMW-mode ON). Script/doc `.js`/`.md` **chưa runtime-live pre-restart** (no hot-reload). + +## 1. id-broadcast +`2026-06-07-Agent-harness-2` (category: Agent · reviewer_gate: **PASS** · nac: published · targets: **all-fit**). Harness 2 = Agent-team (A1-A2) + **Workflow wave-folder memory-isolation** (B1-B6). Prereq: #1 store_memory-strip (S47 ✓) + #4 ultracode-HMW (S49 ✓) + Harness 1 H2 harvest-curator (cùng session này ✓). + +## 2. nac G-011 +**executed-file** (hmw.js wave-mode patch + .gitignore B6 + workflows/README + session-end B5 wire written; B6 gitignore **VERIFIED-runtime** qua `git check-ignore -v`) → **VERIFIED-pending wave-run** (cần restart + 1 WAVE-MODE workflow thật để prove B6 isolation live + B5 harvest chạy). B1 spawn-from-real-sub = **đã live** (hmw.js VALID_ROLES 8 + slice-inject, dùng từ S49). + +## 3. evidence +**PROJECT-FIT = ADOPT B (tailored) · A = n-a-convention-ready.** SE chạy Workflow fan-out (recon-wave session này = bằng chứng). A (agent-team) = Windows in-process only → SE chưa dùng team thật. + +Files written/edited (repo SOLUTION_ERP): +- **hmw.js wave-mode** — `.claude/workflows/hmw.js`: +`subMdPath` schema · +`wave` block (`A.wave.dir` detect) · +`writeGuard` TOOL-AWARE 2-nhánh (Write-sub ghi-direct sub-MD / read-only-sub return→lead-scribe) · +ISOLATION-B6 prompt (CHỈ wave-folder, KHÔNG agent-memory/MD-canonical) · meta.description 2-MODE · header no-fs scaffold note. Mirror AI_INFRA hmw.js, tailor 8-role. +- **.gitignore B6** — +`.claude/workflows/wave-*/` + `.claude/agent-teams/` (AFTER `!.claude/**` line 83 → last-match-wins). **VERIFIED** `git check-ignore -v .claude/workflows/wave-test/wave.md` → match line 93 (gitignored); `hmw.js`+`README.md` exit=1 (tracked). +- **convention doc** — NEW `.claude/workflows/README.md` (2-MODE table · wave-folder 2-tier structure wave.md+sub-MD+_harvest.md · B1-B6 quy-trình · agent-team n-a note · guard S1/checkpoint/G-015). +- **B5 harvest wire** — `session-end.md` §L.b(f) += wave-folder gom (harvest-curator quét wave-*/sub-*.md → APPEND agent-memory/ + verify B6 git-diff/chunk-count). [làm chung Harness 1 wiring] + +SELF-CHECK (broadcast H2): +- A1: agent-team isolated folder `.claude/agent-teams/` gitignored + README note. ✓ (n-a runtime — convention-ready) +- A2/B1: workflow-agent fork sub THẬT (agentType + memoryPack slice). ✓ (đã live hmw.js) +- B2: wave-folder 2-tầng (wave.md + sub--.md). ✓ (schema subMdPath + README structure) +- B3: lead SCAFFOLD folder+wave.md TRƯỚC fan-out (script no-fs — header comment + README + meta). ✓ +- B4: writeGuard tool-aware (Write-sub direct / read-only-sub return→lead-scribe). ✓ (hmw.js) +- B5: harvest-curator (H2) gom wave→agent-memory @session-end. ✓ (wired §L.b f) +- B6: wave-folder gitignored + git-diff audit. ✓ **VERIFIED git check-ignore** (KHÔNG tin .gitignore text). +- Restart + wave-run thật kiểm B6/B5: ⏳ **pending** (báo đúng nấc). + +commit-sha: **pending** (fill post-commit). + +## 4. tailored-gì + skip-gì-vì-sao +- **FUNCTION-floor adopt FULLY (B1-B6):** scaffold-by-lead · 2-tier · tool-aware writeGuard · isolation-audit · harvest-gom · gitignore-B6 — giữ đủ. +- **FORM tailored SE:** (a) read-only sub list = **investigator-codebase/api, reviewer, cicd-monitor** (4 SE read-only) vs Write sub implementer-backend/frontend, test-specialist, frontend-designer (4); AI_INFRA dùng "investigator/reviewer/cicd/monitor". (b) VALID_ROLES giữ **8** (KHÔNG thêm 2 monitor — tooling-auditor/harvest-curator = session-boundary, KHÔNG P2 fan-out worker). (c) canonical ref → AI_INFRA §J4/§J6 qua cross_project_search (SE không có CANONICAL-RULES local). (d) gitignore pattern mirror SE marker style (line 87 hmw-mode.on). +- **A (agent-team) = SKIP=n-a-convention-ready** (KHÔNG behind): Windows 11 in-process only + SE chưa dùng team. Cơ-chế isolation chung qua workflow (`.claude/agent-teams/` gitignored phòng-trước). +- **ADD-mode (KHÔNG thay return-delta):** wave-mode CHỈ workflow DÀI; fan-out nhẹ (recon-wave session này) giữ return-delta-only — #4 ultracode floor không vỡ. + +## 5. honest-caveat +- **🔴 nấc honest:** B6 gitignore = **verified-runtime** (git check-ignore THẬT). NHƯNG wave-mode END-TO-END (sub ghi sub-MD isolated + B5 harvest) = **CHƯA wave-run nào chạy** → executed-file, pending 1 WAVE-MODE workflow thật post-restart. recon-wave session này = DEFAULT return-delta (KHÔNG wave) → chưa exercise wave path. +- **G-015 KHÔNG overclaim isolation "ENFORCED":** containment = gitignore-wave + lead git-diff post-P2 + lead-scribe(read-only sub) = defense-in-depth, 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). Câu đúng = "sub ghi-direct chỉ wave-folder; ghi-ra-MD-chính bị git-diff bắt (in-repo); ngoài-repo/RAG cần chunk-count". +- **Lead-scribe ≠ sub-write-direct cho read-only sub:** 4 SE read-only sub (investigator×2/reviewer/cicd) KHÔNG có Write → "ghi wave-folder" thực = return findings→em main scribe. Chỉ 4 Write-sub mới ghi-direct được. KHÔNG claim "sub tự-ghi-direct" cho read-only. +- **hmw.js JS chưa node-check được** (top-level await/return — runtime-wrapped). Syntax confidence từ mirror AI_INFRA template (proven) + careful edit; verified-runtime cần 1 invoke thật. diff --git a/docs/governance/adap-reports/2026-06-07-Agent-harness-3.md b/docs/governance/adap-reports/2026-06-07-Agent-harness-3.md new file mode 100644 index 0000000..53510c0 --- /dev/null +++ b/docs/governance/adap-reports/2026-06-07-Agent-harness-3.md @@ -0,0 +1,43 @@ +# adap-report — 2026-06-07-Agent-harness-3 + +> SISTER = SOLUTION_ERP (self-id=`se`). Report-format LOCK (5 trường). Generated 2026-06-07, apply by em main (HMW-mode ON). Command `.md` **chưa runtime-live pre-restart** (no hot-reload); handshake test pending. + +## 1. id-broadcast +`2026-06-07-Agent-harness-3` (category: Agent · reviewer_gate: **PASS** · nac: published · targets: **all-fit** · content_sha256 in frontmatter). Harness 3 = Email channel cross-project (per-project `broadcasts/`) — kênh comms CHUẨN + DUY NHẤT giữa 7 project (§N single-channel · §J2 pull-copy · 2-stage inbox · envelope SHA256 · infra-CC §N3 · adap=fan-out sub-mode). + +## 2. nac G-011 +**executed-file** (broadcasts/ tree 13-dir + 13 .gitkeep + _index + inbox/README + 2 command se-tailored + adap-apply base-path fix — all written/committed-pending) → **VERIFIED-pending** (cần (a) restart Claude Code để `/send-email` `/check-email` hot-reload, (b) 1 handshake round-trip `/send-email ai_infra` → AI_INFRA `/check-email se` prove 2-way byte-identical). PROJECT-FIT = **Universal (KHÔNG n-a)**. + +## 3. evidence +**PROJECT-FIT = ADOPT (Universal).** Mọi project cần kênh comms; SE scaffold để nhận được dù chưa active. + +Files written (repo SOLUTION_ERP): +- **broadcasts/ tree** — `outbox/{ai_infra,vipix,dyd,namgroup,ashico,bvaau,all}/` (6 others + all fan-out) + `inbox/{ai_infra,vipix,dyd,namgroup,ashico,bvaau}/` (6 processed) + `inbox/` root (pending staging). **13 .gitkeep** (6 outbox-others + outbox/all + 6 inbox-others; inbox-root kept bởi README.md, broadcasts-root bởi _index.md). +- **_index.md** — single index 2-section (📥 INBOUND status pending→processed + 📤 OUTBOUND) + infra-CC row note, tailored self=se (seed placeholder rows). +- **inbox/README.md** — 2-stage doc (root pending → MOVE inbox// processed) + per-project line `{ai_infra,vipix,dyd,namgroup,ashico,bvaau}` + .gitkeep mandate. +- **2 command** — NEW `.claude/commands/send-email.md` + `check-email.md` (se-tailored: →se, validate to≠se, 2-stage, infra-CC §N3, **canonical content_sha256 formula GIỮ EXACT** `(($txt -split "(?m)^---\s*$",3)[2] -replace "^\r?\n","")`). +- **adap-apply fix** — `.claude/commands/adap-apply.md:1` base-path `outbox\*.md` → `outbox\all\*.md` (Harness 3 §8 relocate 06-07 — latent bug recon caught, đóng luôn). + +SELF-CHECK (broadcast H3): +- 6+6 folder + _index.md committed (KHÔNG gitignore): `git check-ignore broadcasts/...` exit=1 (tracked). ✓ +- 2 lệnh thay đúng ``=se, validate to≠self. ✓ +- envelope from+to + content_sha256 canonical (strip-1-leading-newline send=receive). ✓ (formula verbatim) +- 2-stage inbox (root pending → sub processed). ✓ (check-email.md + inbox/README) +- §N KHÔNG kênh khác cho cross-project comms. ✓ (process-rule) +- infra-CC: send-email auto bản-2 `outbox/ai_infra/-cc.md` cho category≠Coord, to≠ai_infra. ✓ (step 6b; outbox/ai_infra/.gitkeep sẵn) + +commit-sha: **pending** (fill post-commit). + +## 4. tailored-gì + skip-gì-vì-sao +- **FUNCTION-floor adopt FULLY:** cấu trúc broadcasts/ · 2 lệnh · envelope+SHA256 · §N single-channel · §J2 pull-copy · 2-stage committed · infra-CC §N3 · adap=fan-out sub-mode — giữ đủ. +- **id-map AUTHORITATIVE (KHÔNG tự chế):** self=**`se`** (KHÔNG `solution_erp`), 6 others=**short-id** `{ai_infra,vipix,dyd,namgroup,ashico,bvaau}` — verify từ `AI_INFRA/broadcasts/sister-commands/send-email.md:13-22` (folder name = 2nd source-of-truth: project khác ghi vào `outbox/se/`, nếu SE dùng long-id thì cross-copy folder-match VỠ). Recon MEMORY-PACK ban đầu gợi long-id SAI → recon corrected. +- **FORM tailored:** _index/inbox-README header → SOLUTION_ERP (se) perspective; infra-CC example → `se → ai_infra (cc-of:)`; per-project line → 6 others của se (include ai_infra, exclude se-self) thay AI_INFRA's (include se, exclude ai_infra-self). +- **adap-apply base-path fix** = incidental latent-bug close (Harness 3 §8 relocate broadcast → outbox/all/; SE adap-apply.md đọc flat outbox/*.md stale từ trước — em main đã manually nav outbox/all/ khi chạy /adap-apply session này = bằng chứng bug). +- **KHÔNG skip** (Universal, no n-a). + +## 5. honest-caveat +- **🔴 nấc honest:** scaffold + commands = executed-file. **CHƯA handshake** — verified-runtime cần restart + 1 round-trip `/send-email ai_infra "handshake"` → AI_INFRA `/check-email se` prove byte-identical 2-way. Đừng claim "channel live/active". +- **G-015 accuracy (giữ verbatim broadcast):** "đối chứng" = **whole-file byte-identical 2 bản** (outbox sender vs inbox receiver) = bằng chứng THẬT (primary). `content_sha256` = **self-check phụ** — KHÔNG tamper-proof (kẻ sửa body recompute hash được); chỉ cross-copy-match. KHÔNG mô tả "tamper-proof/secure". §J2 = mỗi bên ghi repo MÌNH (KHÔNG "AI_INFRA ghi giúp"). +- **path-coupling:** 7 broadcasts root = abs Windows path 1 Dropbox (send-email.md:13-22). web-migration sau → sửa 1 chỗ id-map. +- **2 command runtime-pending:** send/check-email `.md` no hot-reload → CHƯA gọi được tới khi restart. (đã thấy trong skill registry = loaded, nhưng invoke-runtime cần restart confirm.) +- **Bash POSIX vs PowerShell:** command .md reference PowerShell `Get-FileHash`/SHA256 (đúng win32 runtime nơi command chạy); scaffold .gitkeep/dir dùng Write/mkdir (KHÔNG shell-encoding ẩu, chống mojibake).