[CLAUDE] Docs: S100 Harness-18 adopt — detector v2 ratio-band+glob (fault-inject 4/4, MED 11→0) + retire runs/_ledger 🧊 (0/15 lifetime, sweep 15 điểm/8 file, orphan=folder-scan) + engine §J + cron ghost-wire honest-retire (CronList=0, 5 file) + F2 SendMessage re-verified + 3 adap-report (frontier HELD hash-MISMATCH, flag reviewer_gate-missing) — WF1 wf_50a817ce-a69 · WF2 wf_31ea3985-92c in-flight
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m17s
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m17s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@ -16,7 +16,7 @@ H2 harvest-MD-integrity auditor **SOLUTION_ERP-self**. Read-only + **propose-onl
|
||||
## 📋 Baseline state (re-ground S99)
|
||||
- **Spawn-record 4-field SE:** `{task · verdict · learned · surprise}` (memoryDelta R1 contract HMW).
|
||||
- **agent-memory:** 11 folder `.claude/agent-memory/<role>/MEMORY.md` (placement target). Cap L1 = 25.6KB (H11 `memory-archive-gate.ps1`); hook self-target 17.1KB.
|
||||
- **Run-trace (Harness-10, thay wave-folder Harness-2):** `.claude/workflows/runs/<run-id>/` git-TRACKED, FLAT (`run.md` + `sub-*.md` + `*-synthesis.md`); 5 run cũ 06-18 giữ `sub-md/`+`harvest/` subfolder (dual-accept). Ledger `runs/_ledger.md` two-beat OPEN/CLOSE — orphan = row `⏳`. **Mode-A ephemeral (S98 note):** HMW default KHÔNG tạo run-folder/ledger-row = by-design, vắng row ≠ orphan; ledger chỉ cover MODE B (`args.run`).
|
||||
- **Run-trace (Harness-10, thay wave-folder Harness-2):** `.claude/workflows/runs/<run-id>/` git-TRACKED, FLAT (`run.md` + `sub-*.md` + `*-synthesis.md`); 5 run cũ 06-18 giữ `sub-md/`+`harvest/` subfolder (dual-accept). **🧊 Ledger `runs/_ledger.md` RETIRED H18-B S100** (true-catch 0/15 lifetime + mode-A coverage 0/8; 15 row frozen giữ lịch-sử) — **orphan-authority = folder-scan:** folder có `run.md` mà `*-synthesis.md` VẮNG/0-byte. Mode-A ephemeral (S98 note): HMW default KHÔNG tạo run-folder = by-design, vắng folder ≠ orphan.
|
||||
- **Nền H2 gốc:** `session-end.md` Phase 1.5 §L.b = 3/5 trục; sub này nâng +Fidelity-escalate +Placement = đủ 5.
|
||||
|
||||
## ⚠️ Anti-patterns
|
||||
|
||||
@ -70,6 +70,7 @@ Bearer từ `POST api.solutions.com.vn/api/auth/login` → status matrix expecte
|
||||
|
||||
## 📅 Recent activity (compressed — full verbatim → `archive/2026-06.md` via `archive/_INDEX.md`)
|
||||
|
||||
- **2026-07-02 (S100 H18-adopt WF1 `wf_50a817ce-a69` — 3 lane ∥, on-behalf em main APPEND B3, return-only 0-residual):** L1 measurer-coverage: 3/3 script (`mfe-eval:216`/`selfimprove:133-137`/`archive-gate:106`) **GLOB-LIVE 0-hardcode** — agent thứ 12 tự-cử; ⭐ ghost-wire-class MỚI: **config-key defined-but-unread** (`memory-budget.json:54-55` `role_file_glob`/`diary_path_pattern` — script re-hardcode giá trị TRÙNG → không detector nào flag vì cả 2 phía "đúng"; catch = grep key-name across scripts/) + latent skip-if-no-`tools:` (`selfimprove:147`, 0 affected 11/11 có). L2 ghost-wire+taxonomy: MAST=0 repo-wide (grep PHẢI case-sensitive `\bMAST\b` — insensitive dính "Master" noise); cron monthly = ghost-wire THẬT (CronList=0 + scheduler RỖNG 05-04 log + S96 chạy 13:04 em-main in-session); convention "auto = step em-main kích, no-OS-hook" nhất quán 5 nơi. L3 ledger-đo: `_ledger.md` true-orphan-catch **0/15 lifetime** (single-day artifact 06-18, 15 row/14 folder — mig54-R2 share) · mode-A coverage 0/8 S93+ · ⭐ "S71 `harvest/` rỗng" = **criterion-wording KHÔNG phải incident** (đính chính claim em-main) · repo có 5 "ledger" khác tên → sweep grep `_ledger` EXACT · hmw.js 0-touch. Tag `[s100-h18-wf1, 3-lane, ghostwire-configkey-class, ledger-0-15, on-behalf]`.
|
||||
- **2026-07-02 S98 verify-lane V2 post-flush (VERDICT PASS):** detector 28→25 (derived-stale 11→8; wikilink 14 + vocab-fork 3 giữ by-design). **8 derived-stale còn = 100% FP-class count-token soft-net:** CLAUDE.md:84 tests-tree "(6 test…)" · ef-core SKILL :94/:95 ("2/1 migration tách/GỘP" history) + :103/:111/:114 ("4/3/1 bảng" Budget-defer/Mig-15 module-local) + :162/:179 (heading "Revert 1 migration" + comment "Script từ 1 migration") — 0 genuine drift vs canonical 61/89/440/79; SKILL edit sáng (+rows 60/61 @:82-83) chỉ shift line-number FP cũ, 0 flag MỚI. ⭐ Grep gotcha: **"Fable RESTORED" exact-string CHỈ STATUS:24 + session-start:29; agents/README dùng biến-thể "Fable 5 1M RESTORED" (:3) + "Fable-restore" (:12)** — exact-phrase grep miss README dù substance đủ. HANDOFF:5 mega-line: bundle mEGqlNWc/Dnrp4PU1=#484, CeTA7Z82 chỉ trong note "= #483" (1 line match duy nhất cả file). 3 on-behalf append đúng-chỗ: database-agent :36 (cuối Log = EOF) · reviewer addendum TRONG-entry S97-bis :68 (câu cuối + marker on-behalf @S98) · impl-fe S97-Part2 :16 giữa badge:9/S97:19. cicd "S98" = 2× "(curate S98)" stub :73/:74, 0 material-tag. Ledger :7 Mode-A ephemeral note (wf mode-A vắng ledger-row ≠ orphan) + bảng 15 row :11-25 nguyên.
|
||||
- **2026-07-01 S97 session-end feedback-audit (VERDICT CLEAN):** Grep-verified capture readiness pre-close. ✅ gotcha #77/#78/#79 present `docs/gotchas.md:1301/1317/1325` (format `### N.` count=79 = STATUS header — no self-count drift; all 3 have Triệu-chứng+Cơ-chế+Fix+**Quy-tắc** root-cause). ✅ #53 return-garble **x6 (cicd 5/6)** in BOTH `feedback_agent_return_garble_recover.md` (Why-line ×5→×6 + **structural root-cause: cicd MEMORY self-target ~17.1KB→curate-at-return→thinking-step=message-cuối=return-value**; fix=archive-cicd-sớm NOT instruction) AND S97-log Parts 1/2/4 (lần-4/5/6). cicd MEMORY LIVE=17.5KB (confirms self-target). ✅ Mig 60 wrong-table BUG = 2-fix present: code (Mig 61 `20260701142752` query Changelogs) + guard (gotcha #79 "xác định ĐÚNG bảng writer" + "verify marker-count prod trước"). Mig 60 code `:29-31` confirmed `PurchaseEvaluationApprovals a...a.Comment LIKE` = wrong. Both Mig 60/61 have 3-file rule. ✅ git status CLEAN, 0 stray `.claude` misland, 0 `git add -A` in log, S97 workflows HMW-ephemeral (NOT persisted run-folders — consistent S94+ pattern, runs/ only old 06-18). ✅ Product decisions captured (STATUS/HANDOFF/log + commit-msg): "duyệt là fix"→#480 price-lock, "fix trọn"→Mig 60 endsBeforeCeo-runtime, "hiện luôn CEO duyệt"→#483 badge, Supplier-backlog "15-18 field"→STATUS Next-up. **MINOR only:** S97-log per-Part State footers show progression (Part-1 `:47` "88 bảng gotcha 77" stale vs session-end "89/79" Part-4 `:113`) — intentional per-part snapshot but mid-log reader sees stale count. No BLOCKING/MAJOR gaps.
|
||||
- **2026-07-01 Supplier Excel-import GAP audit (anh Kiệt FDC — 30-col "Database NCC & Nhà thầu phụ" cho bên Pro):** ⭐ **Entity CỰC LEAN 9 domain-prop** (`Domain/Master/Supplier.cs:5-16`: Code·Name·Type·TaxCode·Phone·Email·Address·ContactPerson·Note) + 8 audit inherited (Base/AuditableEntity). EF `SupplierConfiguration.cs`: Code len50 UNIQUE-filtered `[IsDeleted]=0`(:24, Mig47 #57), Name200, TaxCode20, Phone30, Email100, Address500, ContactPerson200, Note1000. **enum `SupplierType.cs:3-10` = NhaCungCap1/NhaThauPhu2/ToDoi3/DonViDichVu4/ChuDauTu5 — KHÔNG có "Cả hai/Both"** (FE mirror `fe-admin/types/master.ts:11-16` identical). **GAP 30→entity: 6✅ · 7⚠️collision · 17❌ no-home** — Excel splits Address×2(invoice/office), Phone×2(company/contact), ContactPerson+role; ❌ Fax·Bank-acct×2·Legal-rep+role·GUQ+3-NAS-links·Status/blacklist·Referral·PMH-owner. ⚠️ **S55 seed `SeedRealMasterDataAsync` (`DbInitializer.cs:2768-2787`) crams NĐD/bank/status/category vào free-text `Note`** (:2771-73 TRUONGGIANG/TANPHU/TGN) — proof entity thiếu home. Seed **UNGATED** (called :128, idempotent-key=`Code` :2780) — KHÁC demo-master (`SeedDemoMasterDataAsync` GATED `DemoSeed:Disabled` :117, #75). POST any-auth (`SuppliersController.cs:37-42` S59). FE SHA-identical 2-app (`c1760788`, 253L, 9 fields). **Prod 20 NCC** (Type1×3+Type2×17; type3/4/5 wiped go-live S91 → "Cả hai" enum genuinely-needed). Precedent NAS-link = `PE.HoSoLink nvarchar(1000)` Mig52. Fork→em-main: core-widen ~15col+CaHai=6 vs satellite `SupplierDetail`. → _INDEX pending.
|
||||
|
||||
@ -163,7 +163,7 @@
|
||||
|
||||
All 11 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 (Harness-10 run-trace model, `runs/_ledger.md:4`):** run-folder `runs/<run-id>/` được git **TRACKED** → mọi write HIỆN trong git-diff = audit trực-tiếp. Containment: tracked-change NGOÀI `runs/<run-id>/` VÀ NGOÀI code-disjoint đã giao = vi-phạm (thay model Harness-2 B6 "mọi tracked-change = vi-phạm"). G-015 no-overclaim: TRACKED ≠ read-only-enforced — sub vẫn giữ `Bash` (write-channel mở qua shell/curl) → containment THẬT = em main single-writer + git-diff(in-repo) + chunk-count (RAG), KHÔNG allowlist đơn-độc.
|
||||
> **2 monitor sub (tooling-auditor H1 + harvest-curator H2 — 2026-06-07):** read-only toolset = `[Read, Grep, Glob, Bash, +4 RAG-read]`, **NO `store_memory`, NO Write/Edit** (mirror investigator read-set). INFORM-only — propose → em main single-writer VERIFY→APPEND (B3). 🔴 **G-015 accuracy (Harness-10 run-trace model, `runs/README.md §Containment` — 🧊 `_ledger.md` retired H18-B S100):** run-folder `runs/<run-id>/` được git **TRACKED** → mọi write HIỆN trong git-diff = audit trực-tiếp. Containment: tracked-change NGOÀI `runs/<run-id>/` VÀ NGOÀI code-disjoint đã giao = vi-phạm (thay model Harness-2 B6 "mọi tracked-change = vi-phạm"). G-015 no-overclaim: TRACKED ≠ read-only-enforced — sub vẫn giữ `Bash` (write-channel mở qua shell/curl) → containment THẬT = em main single-writer + git-diff(in-repo) + chunk-count (RAG), KHÔNG allowlist đơn-độc.
|
||||
|
||||
> ⚠️ **`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.*
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Verify + gom **harvest-MD toàn session** (agent-memory sub · run-folder `runs/
|
||||
|
||||
**@session-start (BÁO harvest mới):**
|
||||
- **🌾 Harvest MD mới:** tổng hợp MD/memory MỚI từ run-folder `runs/<run-id>/sub-md/` · 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ý).
|
||||
- Run-folder tồn-đọng (run chạy mà chưa harvest — đối-chiếu `runs/_ledger.md` OPEN-beat chưa CLOSE) → flag.
|
||||
- Run-folder tồn-đọng (run chạy mà chưa harvest — folder-scan: `runs/<id>/` có `run.md` mà `*-synthesis.md` VẮNG/0-byte; 🧊 đối-chiếu ledger retired H18-B S100) → 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).
|
||||
@ -41,7 +41,7 @@ Verify + gom **harvest-MD toàn session** (agent-memory sub · run-folder `runs/
|
||||
|
||||
## 📤 OUTPUT contract
|
||||
- @session-end: bảng harvest {sub/run · spawn-record-đề-xuất · 5-trục verdict · flag} + run-folder-consolidate propose (idempotent, đã DEDUP vs per-turn) + chore-memory. Propose-delta cho em main APPEND.
|
||||
- @session-start: harvest-mới report (delta mồ-côi + run-folder tồn-đọng vs `runs/_ledger.md`) gọn cho Phase 2/3.
|
||||
- @session-start: harvest-mới report (delta mồ-côi + run-folder tồn-đọng qua folder-scan `runs/*/` — 🧊 ledger retired H18-B S100) gọn cho Phase 2/3.
|
||||
- ≤ vài K token. Mọi claim có ref (path / count). KHÔNG tự ghi.
|
||||
|
||||
## 💾 Memory
|
||||
@ -49,6 +49,6 @@ Verify + gom **harvest-MD toàn session** (agent-memory sub · run-folder `runs/
|
||||
|
||||
## 🔒 RULES + G-015 accuracy
|
||||
- Read-only + propose-only. Output qua em main verify (em main re-Read ref trước APPEND).
|
||||
- 🏃 **Harness-10 run-trace audit (`runs/_ledger.md:4`):** run-folder `runs/<run-id>/` được git **TRACKED** → mọi write HIỆN trong git-diff. Khi gom run-folder, VERIFY sub-workflow CHỈ ghi trong `runs/<run-id>/` (sub-md) + code-disjoint đã giao — phát-hiện tracked-change NGOÀI 2 vùng đó (`agent-memory/*` hay canonical) = **FLAG vi-phạm containment** cho em main (git-diff evidence). (Thay model Harness-2 B6 "mọi tracked-change = vi-phạm" — run-folder giờ tracked nên diff KHÔNG blind.)
|
||||
- 🏃 **Harness-10 run-trace audit (`runs/README.md` §Containment — 🧊 `_ledger.md` retired H18-B S100):** run-folder `runs/<run-id>/` được git **TRACKED** → mọi write HIỆN trong git-diff. Khi gom run-folder, VERIFY sub-workflow CHỈ ghi trong `runs/<run-id>/` (sub-md) + code-disjoint đã giao — phát-hiện tracked-change NGOÀI 2 vùng đó (`agent-memory/*` hay canonical) = **FLAG vi-phạm containment** cho em main (git-diff evidence). (Thay model Harness-2 B6 "mọi tracked-change = vi-phạm" — run-folder giờ tracked nên diff KHÔNG blind.)
|
||||
- 🔴 **G-015 KHÔNG overclaim:** sub này = propose-only. TRACKED ≠ read-only-enforced — `store_memory` strip (RAG-write không-gọi-được) NHƯNG giữ `Bash` = write-channel mở → KHÔNG "read-only enforced". Containment THẬT = em main single-writer + git-diff(in-repo) + chunk-count (RAG).
|
||||
- KHÔNG tự ghi memory kênh nào (return delta → em main APPEND B3).
|
||||
|
||||
@ -5,7 +5,7 @@ description: Đóng session SOLUTION_ERP — flush 10-agent memory + H2 harvest-
|
||||
# /session-end — Session closeout (FLUSH + WRITE + VERIFY + REPORT + COMMIT + EVAL)
|
||||
|
||||
> Trigger cuối session. Em main chủ trì, gọi lại sub-agent đã spawn.
|
||||
> ⚠️ **Harness note:** SendMessage KHÔNG khả dụng → "flush con đã spawn" = agent đã tự update MEMORY khi return (BẮT BUỘC trong agent frontmatter). Em main đọc lại MEMORY on-disk để synthesize, KHÔNG cần re-spawn chỉ để flush.
|
||||
> ⚠️ **Harness note (F2 re-verified S100):** SendMessage khả dụng lại, NHƯNG flush-flow GIỮ NGUYÊN — agent đã tự update MEMORY khi return (BẮT BUỘC trong agent frontmatter) → em main đọc MEMORY on-disk để synthesize, KHÔNG cần re-spawn/SendMessage chỉ để flush.
|
||||
|
||||
## 📋 BƯỚC 0 — Show command body (visibility, no wait)
|
||||
|
||||
@ -48,9 +48,10 @@ Em main PHẢI echo **TOÀN BỘ nội dung command body này** (đầy đủ Ph
|
||||
- **(c) chore-flag:** agent L1 >~30KB → archive L2 · error-ledger open-entry quá ngưỡng · **0-byte memory check (AS-8)** · **🌙 sleep-check (Harness-10b, S72):** `last_sleep_at` null hoặc ≥7d (`memory-budget.json`) → INFORM gợi-ý `/sleep-recovery-memory-l2` (KHÔNG auto-run) · **🗜️ Harness-11 A/D2 (S75):** chạy `powershell.exe -ExecutionPolicy Bypass -File scripts/memory-archive-gate.ps1` (DRY-RUN) → đề-xuất dồn-archive sub over-cap (A4 hysteresis 0.85 + A5 keep-floor 5 + A6 2-strike) + A7 NO-API L1-eval (pointer-resolve + byte-0-loss). Engine → [`docs/governance/harness-11-engine.md`](../../docs/governance/harness-11-engine.md). DRY-RUN báo kế-hoạch; MOVE thật do em-main (D5 AUTO semantic-null sau khi xem). · **📊 Hot-feed %-print CUỐI phiên (Harness-15-v2 §G.4, S82):** in composition Tầng-1 theo **%/4-bucket** SAU khi đã nạp/tăng trong phiên + **Headroom còn-trống** so cap role (`token_governor.tier1_hotfeed_tokens`). Đối-xứng `session-start §2.1.6` (đầu phiên). Mục-đích: anh thấy Tầng-1 phình/teo ra sao + còn trống bao nhiêu → quyết chỉnh cap. 🔴 con-số = quyền anh (chủ-dự-án); em-main chỉ báo-%, KHÔNG tự-chỉnh. · **🧪 MFE retention opt-in (Harness-16 §H):** lệnh kèm `eval` → chạy `scripts/mfe-eval.ps1` cuối-phiên (retention; chênh vs baseline §2.1.6 = rot trong-phiên) → quyết-định 2-ca: **thiếu-chỗ→TĂNG budget** (anh quyết) / **rot→SẮP-XẾP-LẠI** (ưu-tiên-giá-trị). READS budget, KHÔNG ghi/auto-tune. · **🔁 H17 loop-REFINE (§I, S95 — [`harness-11-engine.md §I`](../../docs/governance/harness-11-engine.md)):** lệnh kèm `eval` → chạy thêm `scripts/memory-selfimprove-audit.ps1` (spec-audit CRITERIA+GAP) → áp bảng B1 **tín-hiệu→hành-động**: floor-rot→**reinject-verbatim** (ghi [`reinject-ledger.md`](../governance/reinject-ledger.md) CG-1 ≤1/N=3; đo-lại vẫn thiếu→**escalate anh** KHÔNG tự-reinject-lần-2) · repeat≥2→promote · old+valueless→archive-gate · raw→distill (`/sleep-recovery-memory-l2`). Phân-loại B3 (build-gap vs floor-rot) TRƯỚC reinject. em-main single-writer D9; loop CHỈ đề-xuất (D6). Light→skip.
|
||||
- **(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 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). + **🌊 close-gate C5 Layer3 (Harness-10, thay B5 wave-gom):** với MỌI `runs/<run-id>/` của session → **VERIFY per-turn harvest đã xong** (em-main đã viết `runs/<run-id>/<stage>-synthesis.md` phẳng h10-refine — run cũ S71: `harvest/*.md` — NGAY sau mỗi fan-out turn = C4 Layer1) + `_ledger.md` mọi run đã CLOSE-beat (closed≠⏳). 🔴 **IDEMPOTENT — close-gate chỉ VERIFY, KHÔNG re-APPEND** (per-turn đã APPEND rồi → re-APPEND = DUPLICATE-HARVEST). 5-trục GATE giữ làm **backstop**. GATE = run còn `*-synthesis.md` vắng (run cũ S71: `harvest/` rỗng — C8 dual-accept) HOẶC chưa đủ 5-trục thì CHƯA đóng.
|
||||
- **(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). + **🌊 close-gate C5 Layer3 (Harness-10, thay B5 wave-gom):** với MỌI `runs/<run-id>/` của session → **VERIFY per-turn harvest đã xong** (em-main đã viết `runs/<run-id>/<stage>-synthesis.md` phẳng h10-refine — run cũ S71: `harvest/*.md` — NGAY sau mỗi fan-out turn = C4 Layer1) + mọi `runs/<run-id>/` của session có `*-synthesis.md` present (folder-scan — 🧊 tiêu-chí ledger CLOSE-beat retired H18-B S100). 🔴 **IDEMPOTENT — close-gate chỉ VERIFY, KHÔNG re-APPEND** (per-turn đã APPEND rồi → re-APPEND = DUPLICATE-HARVEST). 5-trục GATE giữ làm **backstop**. GATE = run còn `*-synthesis.md` vắng (run cũ S71: `harvest/` rỗng — C8 dual-accept) HOẶC 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").
|
||||
- **(h) 🔏 User-Mark CHỐT cuối phiên (H-12/13 canonical §P/P7, S79 — `harness-11-engine.md §E`):** đọc [`.claude/governance/ACTIVE-MARKS.md`](../governance/ACTIVE-MARKS.md) → (i) **hiển-thị** status-filtered (Active-High/Active hiện · Medium tóm-tắt · Disable ẩn) cho anh đọc lại (đối-xứng `session-start §2.1.4`); (ii) nếu session này có **quyết-định cấp-governance MỚI** (scope-check P6: đổi CANONICAL §-rule/authority) → chạy `/user-mark-<cấp>` DACI: adjust-gov → double-check → **report-trước-đóng-dấu 3-7 tiêu-chí khách-quan (P4)** → anh confirm → stamp `RC-pqhuy1987-dd-mm-yyyy-hh-mm-ss`; (iii) supersede/disable mark cũ (P5) → con-trỏ-xuôi + Active-High cần anh-confirm RIÊNG. 🔴 **KHÔNG tự đóng dấu / đổi cấp trước khi báo (P4/P8).** 0 quyết-định-mới → "n-a, chỉ hiển-thị".
|
||||
- **(i) 🎯 H18-D(a) outcome spot-check (S100 — [`harness-11-engine.md §J`](../../docs/governance/harness-11-engine.md)):** session governance/review-heavy → chọn **3–5 artifact đã tự-động-qua-cổng** trước đó (cicd GO verdict · detector verdict · monitor verdict · adap-report claim) → **kiểm-lại TƯƠI bằng ground-truth** (tính lại giá-trị đối-chứng · mở định-nghĩa gốc xem claim có thật-cover · đối-chiếu nguyên-văn nguồn). Gấp vào review sẵn có (chi-phí ~0). Sàn-vai trượt-THẬT khỏi nhật-ký → reinject-on-real-miss qua [`reinject-ledger.md`](../governance/reinject-ledger.md) CG-1 (≤1 lần/N=3 phiên, vẫn trượt → escalate anh — REUSE H17 §I B2, KHÔNG sổ mới). Light/hỏi-đáp → skip. (Nấc honest: dogfood n=1 S100 = mẫu hiệu-chỉnh, CHƯA "proven" — caveat 1 broadcast H18.)
|
||||
|
||||
## Phase 2 — WRITE (update MD/RAG)
|
||||
|
||||
@ -60,7 +61,7 @@ Em main PHẢI echo **TOÀN BỘ nội dung command body này** (đầy đủ Ph
|
||||
|
||||
### 2.2 Skill registry
|
||||
- Liệt kê 6 skill. Dùng skill khi task khớp (KHÔNG tự suy luận lại)
|
||||
- Skill staleness audit chỉ chạy theo lịch định kỳ (cron 2026-06-01)
|
||||
- Skill staleness audit chỉ chạy theo lịch định kỳ (cron monthly — lịch kế → `docs/STATUS.md`, B1)
|
||||
- Phân bổ skill mới phù hợp per agent (README matrix)
|
||||
|
||||
### 2.3 Memory entry mới
|
||||
@ -109,7 +110,7 @@ Plan cha: [tên]
|
||||
|
||||
### 5.1 Release + commit
|
||||
- Kiểm tra release, commit task vừa hoàn thành. ⚠️ Update `SolutionErp.slnx` nếu có `.cs/.csproj` mới.
|
||||
- Format: `[CLAUDE] <scope>: <imperative message>` + `Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>`
|
||||
- Format: `[CLAUDE] <scope>: <imperative message>` + `Co-Authored-By: <lead model hiện tại> <noreply@anthropic.com>` (hiện = Claude Fable 5; đổi theo BƯỚC 0.6 session-start)
|
||||
- Scope: `Contract · PurchaseEvaluation · Budget · Form · Workflow · Supplier · Auth · Admin · Api · App · Domain · Infra · FE-Admin · FE-User · Tests · Docs · CICD · Scripts · Skill`
|
||||
|
||||
### 5.2 Push remote
|
||||
|
||||
@ -5,7 +5,7 @@ description: Bootstrap session SOLUTION_ERP — load context, audit state (11-ag
|
||||
# /session-start — Session bootstrap (READ + AUDIT + REPORT)
|
||||
|
||||
> Trigger đầu session. Em main chủ trì, spawn sub-agent khi task match delegate criteria.
|
||||
> ⚠️ **Harness note:** SendMessage KHÔNG khả dụng harness hiện tại → "reuse agent" = **fresh spawn** (MEMORY on-disk auto-inject giữ context). agentId chỉ valid trong-session.
|
||||
> ⚠️ **Harness note (F2 re-verified S100):** SendMessage **KHẢ DỤNG lại** (deferred tool — load qua ToolSearch; resume agent đã spawn TRONG-session, context giữ). Cross-session vẫn = **fresh spawn** (MEMORY on-disk auto-inject giữ context). agentId chỉ valid trong-session.
|
||||
|
||||
## 📋 BƯỚC 0 — Show command body (visibility, no wait)
|
||||
|
||||
@ -59,7 +59,7 @@ Em main xác nhận **lead model resolve được** đầu session. Lead SE = **
|
||||
- 🟫 **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)
|
||||
- Con cũ rảnh TRONG-session → resume qua SendMessage (khả dụng lại — F2 S100) HOẶC fresh spawn re-inject MEMORY; cross-session luôn fresh spawn
|
||||
- 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)
|
||||
|
||||
@ -68,7 +68,7 @@ Em main xác nhận **lead model resolve được** đầu session. Lead SE = **
|
||||
> Đầ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** (run-trace `runs/<id>/` — file `sub-*`/`*-synthesis.md` phẳng h10-refine / sub-agent / agent-team kể từ last) + **delta mồ-côi chưa-APPEND** + **scan `runs/*/` tìm OPEN-beat (ledger `_ledger.md` cột closed=⏳) mà `*-synthesis.md` vắng (run cũ S71: `harvest/` rỗng) = orphan run** (C5 Layer2 post-exec rescan — bù khi C4 per-turn miss hoặc session trước chết giữa run). Bắt 0-byte memory (gotcha #53) + delta chưa thu-hoạch.
|
||||
- **⬜ harvest-curator (H2):** spawn → báo **harvest-MD mới** (run-trace `runs/<id>/` — file `sub-*`/`*-synthesis.md` phẳng h10-refine / sub-agent / agent-team kể từ last) + **delta mồ-côi chưa-APPEND** + **scan `runs/*/` tìm folder có `run.md` mà `*-synthesis.md` VẮNG/0-byte = orphan run** (🧊 tiêu-chí ledger-`⏳` retired H18-B S100; run cũ S71 dual-accept `harvest/<stage>-synthesis.md`) (C5 Layer2 post-exec rescan — bù khi C4 per-turn miss hoặc session trước chết giữa run). 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.1.2 Memory L2 budget-audit (Harness-9 — 2026-06-17)
|
||||
@ -136,7 +136,7 @@ Em main xác nhận **lead model resolve được** đầu session. Lead SE = **
|
||||
- Kiểm tra RAG chủ trì + sub: prompts đã store + đánh dấu re-rank đầy đủ chưa
|
||||
|
||||
### 2.4 Audit cadence
|
||||
- **Monthly (ngày 1):** skill + doc drift audit — cron `solution-erp-skill-audit-monthly`. Next: **2026-06-01**.
|
||||
- **Monthly (ngày 1):** skill + doc drift audit — **thủ-công em-main session đầu-tháng** (🧊 ghost-wire cron gỡ S100, CronList=0 — frontier P2 honest-retire). Next → `docs/STATUS.md` Maintenance backlog (canonical — B1, KHÔNG hard-date ở đây).
|
||||
- KHÔNG tự chạy audit ngoài cadence, trừ khi user yêu cầu hoặc drift nghiêm trọng
|
||||
- Check trạng thái audit định kỳ (đã audit chưa? kết quả ra sao)
|
||||
|
||||
@ -147,7 +147,7 @@ Em main xác nhận **lead model resolve được** đầu session. Lead SE = **
|
||||
|
||||
### 2.6 Unit test check
|
||||
- `dotnet test SolutionErp.slnx --nologo --verbosity minimal` — verify count cho tính năng mới + bug fix gần đây.
|
||||
- Baseline **130 PASS** (58 Domain + 72 Infra). Phase 9 UAT mode: test-after feature (skip per chunk per `feedback_uat_skip_verify`), test-before BẮT BUỘC cho bug fix + critical algo. test-specialist owns; coverage gap backlog xem STATUS.
|
||||
- Baseline hiện tại → `docs/STATUS.md` Tests row (canonical — B1, KHÔNG hard-count ở đây; H1 F-class fix S100). Phase 9 UAT mode: test-after feature (skip per chunk per `feedback_uat_skip_verify`), test-before BẮT BUỘC cho bug fix + critical algo. test-specialist owns; coverage gap backlog xem STATUS.
|
||||
|
||||
### 2.7 Cross-agent synthesis (post-audit) [GENERIC — GIỮ NGUYÊN]
|
||||
- Audit MD/RAG của sub-agent đã spawn, synthesize cross-agent learnings
|
||||
|
||||
@ -17,7 +17,7 @@ Mỗi lần chạy workflow fan-out (RUN-TRACE mode) → **1 thư mục run** gi
|
||||
└── <stage>-synthesis.md ← gom/VERIFIED (suffix `-synthesis.md`) — EM MAIN ghi NGAY sau mỗi fan-out turn (C4 per-turn primary)
|
||||
```
|
||||
Phân biệt RAW (prefix `sub-`) vs VERIFIED (suffix `-synthesis.md`) bằng **TÊN file**, KHÔNG subfolder. **C8:** 5 run cũ S71 (`h10-invest`…`h910-curate`) giữ `sub-md/`+`harvest/` (đừng rewrite history); close-gate chấp nhận CẢ HAI dạng.
|
||||
- `runs/_ledger.md` — sổ run **2-nhịp**: ghi **OPEN-beat** lúc mở run + **CLOSE-beat** (timestamp + verdict + harvest) lúc đóng. **Orphan** = OPEN mà không CLOSE → phải giải-quyết-cứng (điều tra + đóng tay hoặc đánh-dấu aborted). Chi-tiết `runs/README.md`.
|
||||
- `runs/_ledger.md` — 🧊 **RETIRED H18-B S100** (sổ 2-nhịp nghỉ-hưu — đo bắt-thật: true-orphan-catch 0/15 lifetime + mode-A coverage 0/8 workflow từ S93; 15 row lịch-sử GIỮ NGUYÊN, đảo-ngược = gỡ marker). **Orphan-authority = folder-scan:** `runs/<id>/` có `run.md` mà `*-synthesis.md` VẮNG/0-byte. Chi-tiết `runs/README.md`.
|
||||
|
||||
## 2 MODE memory (anh 06-07, KHÔNG thay return-delta)
|
||||
|
||||
@ -31,7 +31,7 @@ Phân biệt RAW (prefix `sub-`) vs VERIFIED (suffix `-synthesis.md`) bằng **T
|
||||
> Mặc định DEFAULT. RUN-TRACE chỉ bật khi workflow dài/nhiều detail/cần dấu-vết (set `args.run = {name, dir}`). KHÔNG bắt mọi fan-out tạo run-folder.
|
||||
|
||||
## Quy trình RUN-TRACE (B1–B6)
|
||||
1. **B3 SCAFFOLD TRƯỚC (em main @P1):** tạo `runs/<run-id>/` + `run.md` (FLAT — KHÔNG cần `sub-md/`/`harvest/` subfolder hay `.gitkeep`; file `sub-*`/`*-synthesis.md` sinh phẳng cùng cấp khi fan-out chạy), **và ghi OPEN-beat vào `runs/_ledger.md`**. ⚠️ `hmw.js` chạy JS-sandbox **no-filesystem** → KHÔNG tự tạo folder; **em main Write @P1** TRƯỚC khi invoke Workflow. (Đây là fragile-point — quên scaffold = run mất dấu-vết âm-thầm; xem `runs/README.md` §C7.)
|
||||
1. **B3 SCAFFOLD TRƯỚC (em main @P1):** tạo `runs/<run-id>/` + `run.md` (FLAT — KHÔNG cần `sub-md/`/`harvest/` subfolder hay `.gitkeep`; file `sub-*`/`*-synthesis.md` sinh phẳng cùng cấp khi fan-out chạy). *(🧊 bước "ghi OPEN-beat vào `runs/_ledger.md`" retired H18-B S100 — orphan-authority = folder-scan.)* ⚠️ `hmw.js` chạy JS-sandbox **no-filesystem** → KHÔNG tự tạo folder; **em main Write @P1** TRƯỚC khi invoke Workflow. (Đây là fragile-point — quên scaffold = run mất dấu-vết âm-thầm; xem `runs/README.md` §C7.)
|
||||
2. **B1 spawn-from-real-sub:** mỗi task `role ∈ VALID_ROLES` (9 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 `runs/<run-id>/sub-<role>-<i>.md` (phẳng) + 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.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# `runs/` — Run-trace convention (Harness-10 · cấu trúc **PHẲNG**)
|
||||
|
||||
> **Mục đích:** mỗi workflow fan-out (RUN-TRACE mode) ghi lại 1 dấu-vết hoàn-chỉnh trong `runs/<run-id>/` git **TRACKED** — plan + per-sub detail + bản-gom — cộng sổ `_ledger.md` 2-nhịp. TRACKED nghĩa là mọi write trong run-folder hiện trong `git diff` → **audit trực-tiếp**, không cần tin lời agent return. Adopt AI_INFRA Harness-10 (anh 06-18) + DELTA `h10-flat-detector-refine` (06-18). Convention cha: `../README.md`.
|
||||
> **Mục đích:** mỗi workflow fan-out (RUN-TRACE mode) ghi lại 1 dấu-vết hoàn-chỉnh trong `runs/<run-id>/` git **TRACKED** — plan + per-sub detail + bản-gom. (🧊 sổ `_ledger.md` 2-nhịp **RETIRED H18-B S100** — đo bắt-thật 0/15 lifetime + mode-A coverage 0/8; orphan-authority = folder-scan L1/L2 dưới.) TRACKED nghĩa là mọi write trong run-folder hiện trong `git diff` → **audit trực-tiếp**, không cần tin lời agent return. Adopt AI_INFRA Harness-10 (anh 06-18) + DELTA `h10-flat-detector-refine` (06-18). Convention cha: `../README.md`.
|
||||
>
|
||||
> 🆕 **REFINE 06-18 — cấu trúc PHẲNG.** Trước đây mỗi run-folder có **2 thư mục con** (`sub-md/` + `harvest/`). NAY mọi vết tích nằm **phẳng cùng MỘT cấp** trong `runs/<run-id>/`; phân biệt **bản-thô (raw, per-sub)** vs **bản-đã-soát (verified, gom)** bằng **TÊN file**, KHÔNG bằng thư mục con. Lý do: engine (`hmw.js` JS-sandbox no-fs) chỉ tạo artifact ở **một cấp** một cách tự nhiên — bỏ thư-mục-con sâu thì xoá luôn **một điểm-hay-quên** ngay tại gốc (không còn thư-mục-con-để-quên-dựng).
|
||||
|
||||
@ -35,7 +35,7 @@ runs/<run-id>/
|
||||
## C2 — Scaffold `run.md` ở OPEN (em main @P1, TRƯỚC khi invoke Workflow)
|
||||
`hmw.js` chạy JS-sandbox **no-filesystem** → KHÔNG tự tạo folder/file. Em main PHẢI Write @P1:
|
||||
1. **Tạo run-folder + PLAN:** `runs/<run-id>/run.md` (điền plan đầy-đủ). 🆕 **KHÔNG cần `mkdir sub-md/` / `harvest/` / `.gitkeep`** — file `sub-*` và `*-synthesis.md` sẽ sinh ra **phẳng cùng cấp** trong cùng folder đó (engine + em main ghi 1 cấp).
|
||||
2. **Ghi OPEN-beat** vào `runs/_ledger.md` (1 dòng, `closed=⏳`).
|
||||
2. ~~Ghi OPEN-beat vào `runs/_ledger.md`~~ — 🧊 **retired H18-B S100** (KHÔNG ghi beat mới; ledger frozen giữ lịch-sử. Orphan-authority = folder-scan L1/L2).
|
||||
3. **(nối stage)** trỏ `input spec:` trong `run.md` sang `<stage>-synthesis.md` của run trước (vd implement đọc `invest-synthesis.md`).
|
||||
|
||||
> 🔴 **C2 là fragile-point.** Quên scaffold = run chạy nhưng KHÔNG có dấu-vết = **lỗ-hổng âm-thầm** (không lỗi, không cảnh-báo — chỉ thiếu file). 3-layer (C5) là lưới giảm-thiểu, KHÔNG khoá-cứng. Xem C7. 🆕 Cấu trúc phẳng bỏ **1 trong 2** điểm-hay-quên (không còn subfolder-to-forget); dư-lượng còn lại = **vẫn phải tự ghi `<stage>-synthesis.md` mỗi run** (close-gate C5/L3 bắt nếu thiếu).
|
||||
@ -68,15 +68,15 @@ Gom là **việc của turn**, không defer. Sau MỖI fan-out turn → em main
|
||||
## C5 — 3-layer anti-miss (lưới chống bỏ-sót — KHÔNG khoá-cứng-cùng-lúc-fire)
|
||||
| Layer | Khi | Làm gì |
|
||||
|---|---|---|
|
||||
| **L1 in-run ledger-check** | em-main @P1, lúc mở run mới (TRƯỚC scaffold) | đọc `_ledger.md`: nếu run TRƯỚC còn `closed=⏳` (OPEN-beat chưa CLOSE / thiếu `<stage>-synthesis.md`) → gom + CLOSE nó TRƯỚC khi mở run mới. *(Engine no-fs → KHÔNG đọc được ledger → L1 là convention **EM-MAIN**, KHÔNG phải `hmw.js` prompt. hmw.js chỉ emit C4 per-turn return-instruction cho sub tại writeGuard.)* |
|
||||
| **L2 session-start orphan-scan** | đầu session (`session-start.md` §2.1.1 H2) | scan `runs/*/` tìm **orphan = OPEN-beat (ledger `closed=⏳`) mà KHÔNG có `<stage>-synthesis.md`** → báo + giải-quyết (C6). |
|
||||
| **L1 in-run folder-check** (🧊 ledger-check retired H18-B S100) | em-main @P1, lúc mở run mới (TRƯỚC scaffold) | scan `runs/*/`: nếu run TRƯỚC còn folder có `run.md` mà **thiếu `<stage>-synthesis.md`** (hoặc synthesis 0-byte) → gom + đóng nó TRƯỚC khi mở run mới. *(L1 là convention **EM-MAIN**, KHÔNG phải `hmw.js` prompt. hmw.js chỉ emit C4 per-turn return-instruction cho sub tại writeGuard.)* |
|
||||
| **L2 session-start orphan-scan** | đầu session (`session-start.md` §2.1.1 H2) | scan `runs/*/` tìm **orphan = folder có `run.md` mà KHÔNG có `<stage>-synthesis.md` (hoặc synthesis 0-byte)** → báo + giải-quyết. (🧊 tiêu-chí ledger-`⏳` retired H18-B S100; run cũ S71 dual-accept `harvest/<stage>-synthesis.md`.) |
|
||||
| **L3 session-end close-gate** | cuối session (`session-end.md` §L.b(f) H2) | VERIFY per-turn gom đã xong cho mọi `runs/<id>/` (**idempotent — KHÔNG re-APPEND**, chống DUPLICATE-HARVEST) + 5-trục GATE backstop trước khi commit. 🆕 close-gate **chấp nhận CẢ 2 dạng** (old-subfolder + new-flat) trong giai-đoạn chuyển — xem C8. |
|
||||
|
||||
> 3 layer **độc-lập, fire ở 3 thời-điểm khác nhau** (run-open @P1 / session-start / session-end) — **KHÔNG layer nào do engine enforce** (hmw.js no-fs), cả 3 là convention em-main/H2. → giảm xác-suất sót, KHÔNG triệt-tiêu. Sót ở P1 (C2) cùng blind-spot với L1 (đều @P1) → chỉ bắt MUỘN ở L2 (session sau) / L3 (close-gate).
|
||||
|
||||
---
|
||||
|
||||
## C6 — Ledger 2-nhịp + orphan resolution (`_ledger.md`)
|
||||
## C6 — Ledger 2-nhịp + orphan resolution (`_ledger.md`) — 🧊 **RETIRED H18-B S100** (nguyên-văn dưới GIỮ làm lịch-sử — dời-đi không xoá; orphan-authority = folder-scan C5 L1/L2; đảo-ngược = gỡ marker này + marker `_ledger.md` header + restore mandate C2-step-2)
|
||||
Sổ tất-cả run, 1 bảng. Mỗi run **2 lần ghi (2-nhịp)**:
|
||||
- **OPEN-beat** (@P1, lúc scaffold): thêm dòng `| <run-id> | <workflow> | <opened> | ⏳ | <agents> | ⏳ | <stage>-synthesis.md |`.
|
||||
- **CLOSE-beat** (lúc đóng run): điền `closed` timestamp + `verdict` (PASS/FAIL + 1 dòng + `wf_…`) + `harvest` (path file synthesis ✓).
|
||||
@ -114,7 +114,7 @@ Sổ tất-cả run, 1 bảng. Mỗi run **2 lần ghi (2-nhịp)**:
|
||||
|
||||
---
|
||||
|
||||
## Containment model (PHẢI khớp `_ledger.md` + `../hmw.js` — đồng-bộ 3 chỗ: đây · `_ledger.md` · `../hmw.js`)
|
||||
## Containment model (PHẢI khớp `../hmw.js` — đồng-bộ 2 chỗ: đây · `../hmw.js`; 🧊 chỗ thứ-3 `_ledger.md` retired H18-B S100, header nó giữ bản frozen)
|
||||
> Run-folder `runs/<run-id>/` được git **TRACKED** → mọi write **HIỆN** trong git-diff = **audit trực-tiếp**. Containment: tracked-change **NGOÀI** `runs/<run-id>/` **VÀ NGOÀI** code-disjoint đã giao = **vi-phạm** (thay model Harness-2 B6 "mọi tracked-change = vi-phạm"). G-015 no-overclaim: TRACKED ≠ read-only-enforced — sub vẫn giữ Bash (write-channel mở), containment THẬT = em-main single-writer + git-diff(in-repo) + chunk-count(RAG).
|
||||
|
||||
---
|
||||
@ -124,7 +124,7 @@ Sổ tất-cả run, 1 bảng. Mỗi run **2 lần ghi (2-nhịp)**:
|
||||
|
||||
**Lý-do tailored-out:**
|
||||
- **SE chạy workflow qua Anthropic Workflow tool (`hmw.js` invoke), KHÔNG có bề-mặt-lách kiểu CLI-launcher.** AI_INFRA threat-model giả-định một node-CLI launcher (đường-vòng chạy lén engine) cần bộ-dò canh. SE **không có launcher như vậy** → không có "đường-vòng" để dò.
|
||||
- **Containment SE đã đủ bằng cơ-chế khác (G-015 defense-in-depth):** `git diff` commit-gate (mọi write tracked HIỆN trong diff) + run-folder git-tracked (audit trực-tiếp) + `_ledger.md` orphan-scan (L2/L3) — backstop THẬT (không phải prompt). Bộ-dò pattern-match thêm = trùng-lặp, không bịt lỗ mới.
|
||||
- **Containment SE đã đủ bằng cơ-chế khác (G-015 defense-in-depth):** `git diff` commit-gate (mọi write tracked HIỆN trong diff) + run-folder git-tracked (audit trực-tiếp) + folder-scan orphan L1/L2 (🧊 ledger-scan retired H18-B S100) — backstop THẬT (không phải prompt). Bộ-dò pattern-match thêm = trùng-lặp, không bịt lỗ mới.
|
||||
|
||||
**3 chức-năng refine — CÂN-NHẮC rồi N/A cho SE:**
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
# Workflow Run Ledger — SOLUTION_ERP (Harness-10)
|
||||
|
||||
> 🧊 **RETIRED (H18-B, S100 2026-07-02):** two-beat orphan-detection NGHỈ-HƯU — đo bắt-thật: ledger true-orphan-catch = **0/15 row lifetime** (đều open+close cùng-ngày 06-18, `⏳` chỉ ở legend) + mode-A ephemeral (default S93+) → coverage workflow gần đây = **0/8**. **Orphan-authority = H2 FOLDER-SCAN:** `runs/<id>/` có `run.md` mà `*-synthesis.md` VẮNG/0-byte (run cũ S71 dual-accept `harvest/`). *Caveat-3 parity (honest): run-folder-orphan chưa từng xảy ra ở CẢ 2 cơ chế (0 data 2 phía) — căn cứ retire = coverage-cấu-trúc + chi-phí duy-trì, KHÔNG phải catch-rate hơn.* 15 row lịch-sử GIỮ NGUYÊN dưới. **Đảo-ngược = gỡ dòng này + restore 6 mandate-consumer** (list → `docs/governance/adap-reports/2026-07-02-Governance-harness-18-architecture-consolidation.md`). KHÔNG ghi beat mới.
|
||||
|
||||
> **Two-beat (C6):** ghi nhịp **OPEN** lúc mở run + nhịp **CLOSE** lúc đóng run. **Orphan** = OPEN mà không CLOSE → phải giải-quyết-cứng (điều tra + đóng tay hoặc đánh dấu aborted).
|
||||
> **Tracked (C3):** thư mục `runs/<run-id>/` được git theo dõi (KHÔNG gitignore). Containment chuyển sang model **"tracked-change NGOÀI run-folder (+ code-disjoint đã giao) = vi phạm"** (thay model Harness-2 B6 "mọi tracked-change = vi phạm").
|
||||
> Cột `closed=⏳` = đang chạy (OPEN-beat). Điền timestamp + verdict khi đóng (CLOSE-beat).
|
||||
|
||||
@ -108,7 +108,7 @@ dotnet test SolutionErp.slnx # chạy cả 2 test project
|
||||
| `form-engine` — render docx/xlsx + PDF | `ef-core-migration` — EF migration + 3-file rule |
|
||||
| `permission-matrix` — role × menu × CRUD | `iis-deploy-runbook` — 3 site IIS + win-acme + runner |
|
||||
|
||||
**Audit định kỳ:** đầu mỗi tháng — combined skill + doc drift audit theo `docs/rules.md §6.4 + §9.4`. Cron `solution-erp-skill-audit-monthly` fire 9:00 ngày 1. Lần kế: **2026-08-01** (S96 đã chạy 07-01).
|
||||
**Audit định kỳ:** đầu mỗi tháng — combined skill + doc drift audit theo `docs/rules.md §6.4 + §9.4`, **em-main chạy thủ-công session đầu-tháng** (🧊 ghost-wire cron gỡ S100 H18 — CronList runtime = 0 job). Lần kế: **2026-08-01** (S96 đã chạy 07-01).
|
||||
|
||||
Quy tắc:
|
||||
- KHÔNG bulk-clone repo skill 3rd party. Chỉ thêm skill PROJECT-SPECIFIC. Xem `docs/rules.md §9` đầy đủ.
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
34
docs/changelog/sessions/2026-07-02-S100-harness-18-adopt.md
Normal file
34
docs/changelog/sessions/2026-07-02-S100-harness-18-adopt.md
Normal file
@ -0,0 +1,34 @@
|
||||
# Session 100 — 2026-07-02 — Harness-18 adopt + frontier HELD-integrity (governance/scripts-only)
|
||||
|
||||
> **Lệnh anh:** `/check-email AI_INFRA` + `/adap-apply` step-by-step cẩn thận + `/ultra-on` + report AI_INFRA trung thực. Em-main-led (single-writer D9), 2 workflow Harness-9 mandate. 0 prod code.
|
||||
|
||||
## Bootstrap (đầu phiên, trước lệnh adopt)
|
||||
|
||||
- `/session-start` đủ: HMW-ON · Fable lead OK · test **440/440 re-verified** (45D 404ms + 395I 1m09s) · detector 25 cờ advisory · spec-audit PASS 5 criteria GAP-none · RAG 2431 rerank-OK · marks 4 Active-High display.
|
||||
- 2 monitor RE-REPORT: 🟫 H1 **ALL-4 PASS** (F1/F3 fix-verified, F2 carry) · ⬜ H2 **4-trục ALL-CLEAN** + 1 live-delta → commit `513aa09` (tooling S100 entry + HC on-behalf append, 2 file 2 insertions, push CI-skip).
|
||||
|
||||
## Adopt H18 (commit S100 chính)
|
||||
|
||||
1. **Check-email:** outbox/se RỖNG (0 directed). 3 broadcast mới outbox/all sau H17.
|
||||
2. **Integrity gate:** hash re-compute — H18 `6cf8c106…` MATCH ✓ · checklist `3b6bd4f2…` MATCH ✓ · **frontier stamped `b8d2a846…` vs computed `8b6a8354…` MISMATCH** (4 biến-thể canonical đều lệch; file thuần LF) → **HELD-integrity**: không codify rule, chỉ self-audit; đề nghị AI_INFRA re-stamp. ⚠️ Cả 3 thiếu frontmatter `reviewer_gate` (24 broadcast cũ đều có — grep evidence) — gate-evidence in-body "ba-làn PASS" → áp function-over-form + flag.
|
||||
3. **WF1 investigate `wf_50a817ce-a69`** (3 lane investigator-codebase, MODE-A, RETURN-ONLY, ~390K tok): L1 3 script đo GLOB-LIVE 0-hardcode + ghost-wire config-key class mới (D-1) + latent `tools:`-skip (D-2) · L2 taxonomy MAST=0 CLEAN + cron monthly ghost-wire-candidate · L3 ledger 0/15 lifetime + mode-A 0/8 + đính-chính "S71 harvest/ rỗng = criterion-wording" + sweep 21 điểm. Containment: git-diff 0-residual + chunk 2431==2431.
|
||||
4. **CronList runtime = 0 job** → ghost-wire CONFIRMED → honest-retire 5 file (rules.md ×2 · CLAUDE.md · STATUS.md · session-start.md).
|
||||
5. **Edits (26 điểm / 13 file + 3 report mới):**
|
||||
- `scripts/governance-detectors.ps1` — J.A: ratio-band mismatch-only + `$derivedDocs` glob động + note. **Fault-inject 4/4** (`-RepoRoot` temp: 68-gotcha→MED · 79-đúng→IM · 6-test→LOW · 88-bảng→MED) + real-repo MED 11→0, self-match 0, exit-0.
|
||||
- `runs/_ledger.md` freeze 🧊 + sweep: `runs/README.md` ×7 · `workflows/README.md` ×2 · `session-start.md` §2.1.1 · `session-end.md` §L.b(f) · `harvest-curator.md` ×3 · `agents/README.md` G-015-cite · HC MEMORY baseline. Orphan-authority = folder-scan.
|
||||
- `session-end.md` +§L.b(i) D(a) spot-check · F2 SendMessage ×2 command · B1-pointer (130-count, cron-date ×2) · Co-Authored → Fable.
|
||||
- `harness-11-engine.md` **+§J** (4 pattern + frontier self-audit + honest nấc 10/12+2 n-a).
|
||||
- STATUS backlog **D-1/D-2** đánh-số (frontier P2 remedy).
|
||||
- 3 adap-report: `2026-07-02-…-harness-18…` + `…-checklist-harness-18` + `2026-07-01-…-frontier-assessment` (HELD).
|
||||
6. **WF2 review `wf_31ea3985-92c`** (3 lane reviewer: completeness-fidelity / correctness-noregression / honesty + D(a) dogfood spot-check) — **IN-FLIGHT lúc anh gọi session-end** → NEXT-em #1 session kế: đọc verdict + fix + điền run-id + email AI_INFRA.
|
||||
|
||||
## Lessons
|
||||
|
||||
- **Stamp-then-edit hash-drift có thật ở nguồn phát** (frontier MISMATCH) + **em tự-bắt 1 ca suýt-bịa** (ghi sẵn run-id+verdict WF2 chưa chạy vào report → sửa placeholder ngay) — đúng lớp "trích-dẫn tự-khen dễ bịa nhất" của chính broadcast.
|
||||
- **Ghost-wire 2 class:** (a) claim-automation-không-dây (cron — CronList=0, session-scoped không persist; function vẫn chạy đúng nhờ em-main); (b) **config-key defined-but-unread** (mfe `role_file_glob` — cả 2 phía "đúng" nên không detector nào flag; catch = grep key-name across consumers).
|
||||
- **Đo-bắt-thật đảo kết luận:** "folder-scan bắt S71" hoá ra là wording tiêu-chí → retire ledger phải đổi căn cứ sang coverage-cấu-trúc + ghi caveat-3 parity honest (0 data 2 phía).
|
||||
- Sev detector = **confidence không phải existence**: ratio-band gần-canonical mới đáng MED; diff-lớn = thường count-cục-bộ (lớp FP cũ NGƯỢC).
|
||||
|
||||
## State
|
||||
|
||||
Mig 61 · 89 bảng · 440 test · gotcha 79 · menu 54 · bundle admin `mEGqlNWc`/user `Dnrp4PU1` (chưa đổi — push S100 có `scripts/*.ps1` → CI sẽ chạy, cicd-verify session kế) · RAG 2431 · detector real-repo: 0 MED derived-stale / 3 vocab-fork known / TOTAL 32 advisory.
|
||||
@ -0,0 +1,22 @@
|
||||
# adap-report — 2026-07-01-Governance-harness-frontier-assessment (SE) — ⚠️ HELD-integrity
|
||||
|
||||
> **Broadcast:** `2026-07-01-Governance-harness-frontier-assessment.md` (outbox/all AI_INFRA, type: update — method-share, KHÔNG checklist 🔴).
|
||||
> **Status: HELD-integrity — KHÔNG áp như broadcast-verified.** `content_sha256` re-compute **MISMATCH**: stamped `b8d2a846…8b9edc` vs computed `8b6a8354…e8bdadd` (canonical chuẩn — CÙNG phép match ✓ 2/2 file H18 cùng đợt → phép đúng, body đã lệch stamp). Thử 4 biến-thể canonicalization (raw / crlf→lf / lf→crlf / trim-end) đều KHÔNG khớp; file thuần LF (0 CRLF). Khả năng cao = **edit-body-sau-stamp phía phát** (đúng lớp "stamp-then-edit drift" mà chính broadcast này cảnh báo ở mục trích-dẫn-phải-thật). → **Đề-nghị AI_INFRA verify + re-stamp**; SE sẽ re-run `/adap-apply` cho id này khi hash khớp.
|
||||
|
||||
## SE đã làm gì (dù HELD — self-audit vô-hại, có giá-trị riêng)
|
||||
|
||||
KHÔNG codify rule nào từ broadcast này (frontier-envy rule → CHƯA vào rules.md §6.6; chờ re-stamp). CHỈ chạy **4 pattern-check như self-audit nội bộ** (WF1 `wf_50a817ce-a69` lane 1+2, read-only):
|
||||
|
||||
| Pattern | Verdict SE | Evidence |
|
||||
|---|---|---|
|
||||
| (1) Taxonomy-matrix | **CLEAN — n-a-legit** | grep `\bMAST\b` = 0 repo-wide; `error-ledger.md` "3-axis tag [TYPE/ACTOR/COMPONENT]" = internal scheme map Gov-v2 §L.b/§G3, KHÔNG claim external-taxonomy → không cần ma-trận ánh-xạ |
|
||||
| (2) Ghost-wire | **1 THẬT (đã fix S100) + 2 defer** | 🔴 **Cron monthly** `solution-erp-skill-audit-monthly`: CronList runtime = **0 job** + scheduler RỖNG 2026-05-04 (session-log) + S96 audit chạy 13:04 bởi em-main in-session (commit `881783c`) + CronCreate harness = session-scoped không persist → **honest-retire 5 file** (rules.md:292+:543 · CLAUDE.md:111 · STATUS.md:62 · session-start.md §2.4): monthly = thủ-công em-main theo cadence-pointer STATUS (function KHÔNG ghost — S44/S96 đều chạy đúng hạn; chỉ wiring-claim sai). ➕ 2 ghost-wire-config-key defer đánh-số STATUS backlog **D-1** (`mfe.sub_denominator.role_file_glob`/`diary_path_pattern` defined-but-unread — `mfe-eval.ps1:216/:237` re-hardcode trùng giá trị). Cadence#4 + mọi auto-claim khác = WIRED hoặc disclaimed-no-daemon (convention G-015 nhất quán) |
|
||||
| (3) Measurer role-coverage | **PASS 3/3** | `mfe-eval.ps1:216` + `memory-selfimprove-audit.ps1:133-137` + `memory-archive-gate.ps1:106` đều GLOB-LIVE, 0 hardcode roster/"11" — agent thứ 12 tự-cử. ➕ 1 latent blind-spot defer **D-2** (selfimprove `:147` skip-if-no-`tools:`-line; 0 affected — 11/11 có `tools:`) |
|
||||
| (4) Correction-cadence proxy | **Ghi-nhận, KHÔNG áp** | 0 điểm-đau đo được hiện tại → áp-không-pain = chính "frontier-envy" broadcast cảnh báo. Ghi-nhận method để dùng khi có pain thật |
|
||||
|
||||
## Nấc (G-011)
|
||||
|
||||
- **agreed:** phương-pháp (2-lượt + trích-dẫn-thật + làn-ground-truth) — SE VỐN đang chạy đúng khuôn này (2-workflow mandate + reviewer adversarial + lane ground-truth WF1); không cần build mới.
|
||||
- **executed:** self-audit 4 pattern (bảng trên) + fix ghost-wire cron (5 file) + defer-đánh-số D-1/D-2 (STATUS backlog — đúng remedy "nâng thành mục-sổ có đánh-số").
|
||||
- **HELD:** codify rule frontier-envy vào rules.md §6.6 — chờ re-stamp.
|
||||
- **Dogfood tự-thân trong chính adopt này:** em-main tự bắt 1 ca suýt-bịa-dẫn-chứng (ghi sẵn run-id + verdict WF2 CHƯA chạy vào report H18 → sửa thành placeholder ngay) — đúng lớp "con-số tự-khen nghe thuận tai càng dễ bịa" của broadcast.
|
||||
@ -0,0 +1,35 @@
|
||||
# adap-report — 2026-07-02-Governance-checklist-harness-18 (SE — completeness self-check)
|
||||
|
||||
> **Broadcast:** `2026-07-02-Governance-checklist-harness-18.md` (`content_sha256` re-compute = `3b6bd4f2…9ebb4a` **MATCH ✓**; frontmatter `status: 🟢 ADOPT`, thiếu `reviewer_gate` field — flag chung với report chị em). Đối-chiếu 12 mục 🔴 + 4 mục 🟡. Chi tiết evidence → report `2026-07-02-Governance-harness-18-architecture-consolidation.md` + engine §J.
|
||||
|
||||
## Cổng completeness — 12 mục 🔴 (phát-biểu chủ-động)
|
||||
|
||||
| # | Sàn 🔴 | Verdict | Nấc | Mechanized-vs-convention (honest) |
|
||||
|---|---|---|---|---|
|
||||
| A1 | Mismatch-only | **ĐẠT** — kể-lại-đúng IM (fault-inject case-2), lệch mới flag; + ratio-band confidence | runtime → executed-file | mechanized (detector) |
|
||||
| A2 | Mở dải quét theo dải THẬT | **ĐẠT** — glob động ALL SKILL.md + ALL commands/*.md (vá lớp-mù F3) | executed-file + runtime | mechanized + convention (định-kỳ kiểm dải) |
|
||||
| A3 | Loại dòng-định-nghĩa/trích-chuẩn | **ĐẠT** — self-exclusion 6 path + `$ExcludeExact`, re-verified 0 self-match | executed-file + runtime | mechanized |
|
||||
| B1 | Đo bắt-thật trước nghỉ-hưu | **ĐẠT** — ledger 0/15 lifetime vs folder-scan 4+ memory-delta catches + mode-A 0/8 (WF1-L3 evidence-grade). ⚠️ Caveat-3 parity ghi rõ: run-folder-orphan 0 data CẢ 2 phía → căn cứ = coverage-cấu-trúc, KHÔNG catch-rate | runtime (đo) → executed | convention (quyết bằng số) |
|
||||
| B2 | Nghỉ-hưu trung-thực, đảo-ngược, giữ lịch-sử | **ĐẠT** — 1 dòng 🧊 header `_ledger.md`, 15 row nguyên, revert = gỡ dòng | executed-file | convention |
|
||||
| B3 | Sweep mọi nơi-tiêu-thụ | **ĐẠT** — 15 điểm/8 file live sweep (grep `_ledger` exact — 5 "ledger" khác tên); HISTORY giữ nguyên | executed-file | mechanized (grep) + convention (classify) |
|
||||
| C1 | Hạ-bậc lớp-thực-thi có cổng-kiểm | **n-a-by-owner-mandate** — H8 all-inherit 🔴 anh-chốt S66 (chất-lượng>chi-phí); escape-hatch `tier:'opus'` per-task GIỮ | n-a (lý-do viết rõ) | — |
|
||||
| C2 | 2-đầu + 4-lớp-không-hạ | **n-a/vacuously-held** — mọi vai top-tier, không gì bị hạ | n-a (lý-do viết rõ) | — |
|
||||
| C3 | Điều-kiện xét-lại đo được | **ĐẠT** — viết ra engine §J.C: anh đảo H8 / cost-pressure → bracket + ≥3-run eval vs baseline | executed-file | convention |
|
||||
| D1 | Spot-check đúng-kết-quả tươi | **ĐẠT** — wired session-end §L.b(i) + dogfood n=1 (WF2-L3, 3 artifact). Caveat-1: n=1 = hiệu-chỉnh, CHƯA proven | executed-file + runtime n=1 | convention (người-soi) |
|
||||
| D2 | Tái-nạp-khi-trượt-thật | **ĐẠT (REUSE)** — H17 §I B2 reinject-ledger CG-1 (dựng TRƯỚC broadcast) | executed-file (S95) | convention (single-writer) |
|
||||
| D3 | Chốt-chặn-lặp | **ĐẠT (REUSE)** — CG-1 ≤1 lần/N=3 phiên + escalate anh + đo-lại phiên kế (`reinject-ledger.md`) | executed-file (S95) | convention |
|
||||
|
||||
**Tổng: 10/12 ĐẠT + 2/12 n-a-reasoned (C1/C2 — owner-mandate H8, caveat-2 broadcast cho phép khi chi-phí ngang nhau; SE = ngang-nhau-BY-DECISION + revisit-condition C3 đã viết).** Phát-biểu chủ-động: đã phủ đủ phần áp-được; KHÔNG nhận "12/12".
|
||||
|
||||
## 4 mục 🟡 (form tùy dự-án)
|
||||
|
||||
| 🟡 | SE form |
|
||||
|---|---|
|
||||
| Regex/ngưỡng detector | ratio-band 0.5–2.0 tự đặt; FP-guard `baseline\|S\d{2}` giữ (blind-spot có-chủ-đích, ghi engine §J.A) |
|
||||
| Ranh-giới bracket | theo H8 owner-mandate (không demote); escape-hatch per-task |
|
||||
| Nơi lưu sổ chốt-chặn | `reinject-ledger.md` git-tracked, TÁCH khỏi `memory-budget.json` (quyền anh) — đúng khuyến-nghị checklist |
|
||||
| Promote-list | n-a (all-inherit — không gì để nâng) |
|
||||
|
||||
## Mechanized-vs-convention tổng (đúng ghi-chú checklist)
|
||||
|
||||
Mechanized THẬT: A1-A3 detector + B3 sweep-grep. Convention: B1/B2 quyết-đo, C3 khai xét-lại, D1 người-soi, D2/D3 kỷ-luật single-writer. **KHÔNG nhận mechanized cho kỷ-luật.**
|
||||
@ -0,0 +1,28 @@
|
||||
# adap-report — 2026-07-02-Governance-harness-18-architecture-consolidation (SE)
|
||||
|
||||
> **Broadcast:** `2026-07-02-Governance-harness-18-architecture-consolidation.md` (outbox/all AI_INFRA). **Adopt S100 (2026-07-02), anh-directed** (`/check-email AI_INFRA` + `/adap-apply` step-by-step + `/ultra-on`).
|
||||
> **Integrity gate:** `content_sha256` re-compute = `6cf8c106…e32858` **MATCH ✓** (canonical `(($txt -split "(?m)^---\s*$",3)[2] -replace "^\r?\n","")` UTF-8 — cùng phép match 2/3 file đợt này). ⚠️ **Format-regression flag về AI_INFRA:** frontmatter **thiếu field `reviewer_gate`** (24 broadcast trước đều có, grep evidence) — gate-evidence CHỈ nằm trong body ("dogfood hai phiên · cổng-kiểm ba-làn PASS") → SE quyết **áp theo function-over-form** (gate có thật in-body) + flag để AI_INFRA khôi phục field.
|
||||
> **Harness-9 mandate 2-workflow:** WF1 investigate `wf_50a817ce-a69` (3 lane investigator-codebase, MODE-A return-delta, containment git-diff 0-residual + chunk 2431==2431) + WF2 review `<run-id + verdict điền SAU khi WF2 chạy thật — KHÔNG stamp trước>`.
|
||||
|
||||
## Nấc per-pattern (G-011: agreed / executed / verified)
|
||||
|
||||
| Pattern | Nấc | Evidence |
|
||||
|---|---|---|
|
||||
| **A — freshness-detector** (mismatch-only · scan-range · exclusion) | **runtime-VERIFIED** (mechanized) | `scripts/governance-detectors.ps1` 3 edit: ratio-band sev 0.5–2.0 (mismatch-only confidence — sửa `\|diff\|≥10=MED` NGƯỢC-lớp) + `$derivedDocs` fixed-list→glob động (ALL skills SKILL.md + ALL commands *.md — vá lớp-mù "(68)" sống ~11 phiên) + self-exclusion re-verified. **Fault-inject 4/4** (temp-tree `-RepoRoot`): stale "68 gotcha" trong commands/ → MED ✓ · kể-lại-đúng "79 gotcha" → IM ✓ · module-local "6 test" → LOW ✓ · anti-Goodhart "88 bảng" → MED ✓. Real-repo: MED derived-stale 11→**0** (8 FP demote LOW), coverage +7 file mới, 0 self-match, exit-0 |
|
||||
| **B — retire ledger trùng vai** (đo bắt-thật · nghỉ-hưu trung-thực · sweep consumers) | **executed** (đo=convention-với-số · sweep=mechanized-grep) | Đo (WF1-L3): ledger `runs/_ledger.md` true-orphan-catch **0/15 row lifetime** (đều open+close cùng-ngày 06-18, `⏳` chỉ legend) · folder/disk-scan H2 bắt thật 4+ memory-delta orphan (S57 · post-S57bis · S98×3 · S99#485) · mode-A coverage **0/8** workflow S93+. Freeze 🧊 1-dòng header `_ledger.md` (15 row GIỮ NGUYÊN, đảo-ngược=gỡ dòng). Sweep 15 điểm/8 file: `runs/README.md`×7 · `workflows/README.md`×2 · `session-start.md` §2.1.1 · `session-end.md` §L.b(f) · `agents/harvest-curator.md`×3 · `agents/README.md` G-015-cite · HC MEMORY baseline. Orphan-authority mới = folder-scan (`run.md` có mà `*-synthesis.md` VẮNG/0-byte). Grep dùng `_ledger` EXACT (repo có 5 "ledger" khác tên — tránh C3-fork) |
|
||||
| **C — bracket model-allocation** | **1/3 executed + 2/3 n-a-by-owner-mandate** | Precondition raw-economics ĐÚNG (Fable > Opus) NHƯNG **H8 all-inherit = owner-directive 🔴 S66 "chất-lượng trên chi-phí"** (anh-chốt mọi sister) → không demote; escape-hatch `tier:'opus'` per-task GIỮ. C3 revisit-condition **VIẾT RA** (engine §J.C): anh đảo H8 / cost-pressure thật → dựng bracket + ≥3-run eval vs baseline. Caveat-2 broadcast cho phép n-a khi chi-phí "ngang nhau" — SE = ngang-nhau-BY-DECISION |
|
||||
| **D — outcome-lane** (spot-check tươi · reinject · chốt-chặn) | **executed + dogfood n=1; D(b/c) REUSE-verified** | D(a) wired `session-end.md §L.b(i)` + **dogfood n=1 trong WF2-L3** (3 artifact đã-qua-cổng kiểm-lại tươi: H2 "0/14" đếm lại disk=14 ✓ · detector "0 self-match" re-grep ✓ · budget "measured" vs live-size ✓). D(b) reinject + D(c) chốt-chặn-lặp = **REUSE H17 §I B2** `reinject-ledger.md` CG-1 (≤1/N=3 + escalate anh) — dựng TRƯỚC broadcast, KHÔNG sổ mới |
|
||||
|
||||
## Tailored / Skip / Phản-biện (§F4 + §M)
|
||||
|
||||
- **Tailored:** ratio-band 0.5–2.0 = ngưỡng SE tự đặt (🟡 form — broadcast không ép số) · sweep giữ HISTORY-class nguyên vẹn (session-log/adap-report/archive/synthesis) · retirement marker song ngữ 🧊 + đảo-ngược 1-dòng.
|
||||
- **Honest caveat-3 parity (phản-biện với chính mình, ghi rõ):** run-folder-orphan **chưa từng xảy ra ở CẢ 2 cơ chế** (0 data 2 phía — "S71 harvest/ rỗng" hoá ra là wording tiêu-chí, KHÔNG phải vụ catch; WF1-L3 ground-truth đính chính claim ban đầu của chính em-main) → căn cứ retire = coverage-cấu-trúc + chi-phí duy-trì + đã cần disclaimer-note S98, **KHÔNG phải** "cái mới bắt tốt hơn". Nếu AI_INFRA đọc đây thấy parity không đủ điều kiện floor B → phản-hồi, SE gỡ 1 dòng là revert xong.
|
||||
- **Skip:** không có pattern nào skip-n-a toàn phần (C chỉ n-a 2/3 có lý-do).
|
||||
- **No-overclaim (G-015):** mechanized THẬT chỉ = detector J.A + sweep-grep J.B; đo-quyết B + spot-check D + kỷ-luật C = **convention**. Command/agent `.md` edits = **executed-file, runtime từ session KẾ** (no hot-reload — ⚠️ anh restart CLI).
|
||||
|
||||
## Codify + hậu-kiểm
|
||||
|
||||
- Engine: `docs/governance/harness-11-engine.md` **§J** (4 khuôn-mẫu + honest nấc + frontier self-audit verdicts).
|
||||
- Completeness-gate 12-sàn 🔴 → chi tiết `2026-07-02-Governance-checklist-harness-18.md` (report chị em): **10/12 ĐẠT + 2/12 n-a-reasoned**.
|
||||
- Containment: git-diff dirty-set == em-main edit-set (13 file, 0 residual sub-write) · Qdrant 2431==2431.
|
||||
- Email report → AI_INFRA (send-email kèm run-id + 2 flag: reviewer_gate-field-missing + frontier-hash-mismatch).
|
||||
@ -278,6 +278,40 @@ SE đã có RAG golden-set harness (KHÔNG phải gap): `eval/golden-set-solutio
|
||||
|
||||
---
|
||||
|
||||
## PHẦN J — Harness-18: Kiện-toàn kiến-trúc (4 khuôn-mẫu additive) + frontier-method self-audit (🔴 FUNCTION-FLOOR + 🟡 form)
|
||||
|
||||
> **Adopt S100 (2026-07-02)** — AI_INFRA broadcast `2026-07-02-Governance-{harness-18-architecture-consolidation, checklist-harness-18}` (content_sha256 re-compute **MATCH ✓ cả 2**; ⚠️ frontmatter cả 3 broadcast đợt này **thiếu field `reviewer_gate`** — 24 broadcast trước đều có; gate-evidence nằm trong body "dogfood 2 phiên · cổng-kiểm ba-làn PASS" → SE áp với reasoning ghi tường-minh + flag format-regression về AI_INFRA). Áp qua 2-workflow Harness-9: **WF1 investigate `wf_50a817ce-a69`** (3 lane investigator-codebase, return-delta MODE-A) + **WF2 review `wf_<điền-sau-WF2>`**. **Additive** — KHÔNG thay đợt nào trước. Broadcast chị-em `2026-07-01-…-harness-frontier-assessment`: **content_sha256 MISMATCH** khi re-compute (4 biến-thể canonicalization đều lệch; 2 file H18 MATCH → phép canonical đúng, body đã lệch stamp) → **HELD-integrity**: KHÔNG codify rule từ nó, CHỈ chạy self-audit vô-hại (kết quả dưới); chờ AI_INFRA verify/re-stamp.
|
||||
|
||||
**J.A — Freshness-detector nâng-cấp (3 sàn 🔴 — mechanized, fault-inject 4/4 + real-repo verified S100):**
|
||||
- **mismatch-only + ratio-band confidence:** `governance-detectors.ps1` C2 chỉ flag khi count-token LỆCH canonical (kể-lại-đúng = IM — fault-inject case-2); sev theo **ratio-band** — gần-canonical 0.5–2.0 = MED (stale-total khả-tín), xa = LOW (count cục-bộ-module) — sửa lớp FP cũ `|diff|≥10=MED` vốn NGƯỢC (S98 verify: 8/8 MED đều FP; post-fix real-repo: MED derived-stale 11→0, giữ 3 vocab-fork known).
|
||||
- **scan-range theo dải THẬT:** `$derivedDocs` fixed-list → **glob động** (ALL `.claude/skills/*/SKILL.md` + ALL `.claude/commands/*.md`) — vá lớp-mù commands/ nơi "(68)" sống ~11 phiên (H1 F3 S99).
|
||||
- **exclusion:** self-exclusion 6 path + `$ExcludeExact` (pre-existing, re-verified 0 self-match).
|
||||
- 🟡 Honest: FP-guard `baseline|S\d{2}` skip-line = blind-spot có-chủ-đích (dòng chứa "Baseline" KHÔNG quét — dòng "130 PASS" session-start đã B1-pointer TAY S100); sev = confidence KHÔNG phải existence (total-cổ-đại "77 test"/440 → LOW advisory vẫn hiện).
|
||||
|
||||
**J.B — Vệ-sinh sổ-ghi: retire `runs/_ledger.md` two-beat (🔴 đo-bắt-thật + nghỉ-hưu-trung-thực + sweep):**
|
||||
- **Đo (WF1-L3, evidence-grade):** ledger true-orphan-catch = **0/15 row lifetime** (đều open+close cùng-ngày 06-18; `⏳` chỉ legend) · folder/disk-scan H2 bắt thật **4+ vụ memory-delta orphan** (S57 · post-S57bis 4-MISS · S98 ×3 · S99 cicd#485) · mode-A ephemeral (default S93+) → ledger coverage workflow gần đây = **0/8**. ⭐ Đính-chính ground-truth: "S71 `harvest/` rỗng" = **wording tiêu-chí** trong session-start, KHÔNG phải vụ catch — run-folder-orphan lifetime = 0 ở CẢ 2 cơ chế.
|
||||
- **Caveat-3 parity (honest):** replacement KHÔNG "proven bắt tốt hơn" trên run-folder-orphan data (0 incident 2 phía) — căn cứ retire = **coverage-cấu-trúc (mode-A 0/8) + chi-phí duy-trì + đã cần disclaimer-note S98 chống nhầm**, KHÔNG phải catch-rate.
|
||||
- **Nghỉ-hưu:** 1 dòng 🧊 header `_ledger.md` (đảo-ngược = gỡ dòng; 15 row GIỮ NGUYÊN — dời-đi không xoá). **Orphan-authority = folder-scan:** `runs/<id>/` có `run.md` mà `*-synthesis.md` VẮNG/0-byte (dual-accept `harvest/` run cũ).
|
||||
- **Sweep 6 mandate-consumer + cites (mechanized-grep `_ledger` exact — 5 "ledger" khác tên trong repo, tránh C3-fork):** `runs/README.md` ×7 (:3/:38/L1/L2/§C6-header/:117/:127) · `workflows/README.md` ×2 (:20/:34-B3) · `session-start.md` §2.1.1-H2 · `session-end.md` §L.b(f) · `agents/harvest-curator.md` ×3 (:28/:44/:52-cite) · `agents/README.md` G-015-cite · + `agent-memory/harvest-curator/MEMORY.md` baseline re-ground. HISTORY class (session-log/adap-report/archive/runs-synthesis) GIỮ NGUYÊN.
|
||||
|
||||
**J.C — Bracket phân-bổ model: 1 ĐẠT + 2 n-a-by-owner-mandate (🔴 điều-kiện xét-lại VIẾT RA):**
|
||||
- Precondition raw-economics ĐÚNG (Fable > Opus 4.8 giá) NHƯNG **H8 all-inherit = owner-directive 🔴 S66 "chất-lượng trên chi-phí"** (anh-chốt, mọi sister) → KHÔNG demote lớp-việc nào; escape-hatch per-task `tier:'opus'` (hmw.js) GIỮ = cơ-chế hạ-bậc-theo-việc ĐÃ TỒN TẠI khi cần. 4 lớp không-hạ + 2-đầu = vacuously-held (mọi vai đang top-tier). Promote-list 🟡 = n-a (không gì để nâng).
|
||||
- **Điều-kiện xét-lại (C3-floor, viết ra — đo được):** NẾU anh đảo H8 HOẶC áp-lực chi-phí thật xuất hiện → dựng bracket theo checklist H18-C, so ≥3-run eval vs baseline TRƯỚC khi cố-định; tới lúc đó C1/C2 hết n-a. (Caveat-2 broadcast: "chi-phí ngang nhau thì khuôn-mẫu không áp" — SE = ngang-nhau-BY-DECISION.)
|
||||
|
||||
**J.D — Đóng làn kết-quả (🔴 3 sàn — 2 ĐẠT wired + 1 REUSE):**
|
||||
- **D(a) spot-check tươi:** wired `session-end §L.b(i)` — session governance/review-heavy chọn 3–5 artifact đã tự-qua-cổng → kiểm-lại tươi bằng ground-truth. Dogfood n=1 S100 (WF2 lane-3). 🟡 Honest: n=1 = mẫu hiệu-chỉnh (caveat-1 broadcast), CHƯA "proven".
|
||||
- **D(b) reinject-on-real-miss + D(c) chốt-chặn-lặp:** = **REUSE §I B2** `reinject-ledger.md` CG-1 (≤1/N=3 + escalate anh + đo-lại phiên kế) — H17 đã dựng ĐÚNG khuôn này TRƯỚC broadcast, KHÔNG sổ mới (chống C3-fork "ledger").
|
||||
|
||||
**Frontier-assessment self-audit (S100 — chạy dù broadcast HELD-integrity, vì self-audit vô-hại + có giá-trị riêng):**
|
||||
- **P1 taxonomy-claim:** CLEAN — grep `\bMAST\b` = 0 repo-wide; error-ledger "3-axis tag" = internal scheme map Gov-v2 (KHÔNG claim external-taxonomy) → ma-trận anh-xạ n-a-legit.
|
||||
- **P2 ghost-wire:** **1 THẬT = cron monthly** (`solution-erp-skill-audit-monthly`: CronList runtime = **0 job** + scheduler RỖNG 2026-05-04 + S96 chạy 13:04 em-main-in-session + CronCreate harness session-scoped không persist) → **honest-retire 5 file S100** (rules.md ×2 · CLAUDE.md · STATUS.md · session-start.md): audit monthly = thủ-công em-main theo cadence-pointer STATUS (function KHÔNG ghost — S44/S96 đều chạy đúng hạn; chỉ WIRING claim sai). +2 ghost-wire-config-key (mfe `role_file_glob`/`diary_path_pattern` defined-but-unread) + 1 latent blind-spot (selfimprove `:147` no-`tools:`-skip) → **defer đánh-số STATUS backlog D-1/D-2** (frontier HELD → không sửa vội). Cadence#4 + mọi auto-claim khác = WIRED hoặc disclaimed-no-daemon đúng convention G-015.
|
||||
- **P3 measurer role-coverage:** 3/3 script (`mfe-eval` + `memory-selfimprove-audit` + `memory-archive-gate`) = **GLOB-LIVE**, 0 hardcode roster/"11" — agent thứ 12 tự-cử (WF1-L1 file:line).
|
||||
- **P4 correction-cadence proxy:** ghi-nhận method, **KHÔNG áp** — 0 điểm-đau đo được hiện tại; áp-không-pain = chính "frontier-envy" mà broadcast cảnh-báo.
|
||||
|
||||
**Honest nấc tổng §J (checklist 12 sàn 🔴):** **A 3/3 ĐẠT** (mechanized + runtime fault-inject 4/4) · **B 3/3 ĐẠT** (đo = convention-với-số-liệu WF1-L3 · retire = executed-file reversible · sweep = mechanized-grep + executed 15 điểm) · **C 1/3 ĐẠT (C3 revisit-condition executed-file) + 2/3 n-a-by-owner-mandate H8** (lý-do khách-quan viết rõ — caveat-2 broadcast) · **D 3/3 ĐẠT** (D-a wired + dogfood n=1 · D-b/D-c REUSE §I CG-1). **Phát-biểu chủ-động: 10/12 ĐẠT + 2/12 n-a-reasoned = phủ đủ phần áp-được.** Mechanized THẬT chỉ: J.A detector + J.B sweep-grep; phần còn lại = convention (KHÔNG nhận mechanized). 🟡 form 4 mục: detector-regex/ngưỡng tự đặt (ratio 0.5–2.0) · bracket-boundary theo H8 · sổ chốt-chặn = reinject-ledger git-tracked (REUSE) · promote-list n-a.
|
||||
|
||||
---
|
||||
|
||||
## CAVEAT (trung-thực — đọc trước khi tự nhận "đã tự-bảo-trì")
|
||||
- **No-OS-hook:** detector + gate chạy TRONG thân session-start/end body do em-main kích — KHÔNG fully-autonomous. Đúng mức: **DÒ tự-động + toàn-diện; SỬA + GÁC dựa người-chủ-trì.**
|
||||
- **Auto-WRITE luật/copy = MỐI-NGUY #1, CỐ Ý CHƯA LÀM** — defer tới ≥2 sự-cố thật mà thủ-công thất-bại (hiện 0). Chọn nhánh chỉ-DÒ-NÊU-CỜ cho mọi thứ chạm luật/copy (1-sửa-sai → N-chỗ-sai + phá hash broadcast đóng-băng).
|
||||
|
||||
@ -289,7 +289,7 @@ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||||
|---|---|---|---|
|
||||
| **Cuối session** (đã làm tự động) | Update STATUS Recently Done + HANDOFF cảnh báo session tiếp | ~10 phút | Mỗi session có code commit |
|
||||
| **Cuối phase** (~1 tháng) | Compact STATUS Recently Done > 30 row → `changelog/recently-done-archive-{YYYY-MM}.md`. Collapse migration-todos Phase done thành 1 paragraph cross-ref session log | ~30 phút | Phase đóng |
|
||||
| **Đầu mỗi tháng** (cron `solution-erp-skill-audit-monthly`) | Audit skill + doc drift + count consistency. Patch stale qua Edit (KHÔNG rewrite). Log kết quả | ~45 phút | 9:00 ngày 1 mỗi tháng |
|
||||
| **Đầu mỗi tháng** (thủ-công em-main — 🧊 ghost-wire "cron fire 9:00" gỡ S100 H18/frontier-P2: CronList runtime = 0 job, cron session-scoped không persist) | Audit skill + doc drift + count consistency. Patch stale qua Edit (KHÔNG rewrite). Log kết quả | ~45 phút | Session đầu-tháng theo pointer next-date → `docs/STATUS.md` (canonical) |
|
||||
| **Khi trigger riêng** | Selective rewrite 1 file (skill drift > 30%, architecture redesign, phase major) | 1-2 giờ | Quantitative trigger |
|
||||
| **KHÔNG BAO GIỜ** | Rewrite toàn bộ docs | — | — |
|
||||
|
||||
@ -540,7 +540,7 @@ when-to-use:
|
||||
|
||||
### 9.4 Audit định kỳ — mỗi đầu tháng (chạy chung với doc audit §6.4)
|
||||
|
||||
**Cadence:** Đầu mỗi tháng, cron `solution-erp-skill-audit-monthly` fire 9:00 ngày 1 → chạy combined audit (skill + doc drift theo §6.4 checklist).
|
||||
**Cadence:** Đầu mỗi tháng, **em-main chạy thủ-công trong session đầu-tháng** (next-date → `docs/STATUS.md` canonical; 🧊 ghost-wire "cron `solution-erp-skill-audit-monthly` fire 9:00" gỡ S100 — CronList runtime = 0 job, audit S44/S96 thực-tế đều em-main chạy in-session đúng hạn) → chạy combined audit (skill + doc drift theo §6.4 checklist).
|
||||
|
||||
**Skill audit phần riêng (mỗi skill SKILL.md):**
|
||||
|
||||
|
||||
@ -212,13 +212,18 @@ $countPatterns = @(
|
||||
@{ Rx = ('(\d+)\s*(?:' + $VN_BANG + '|table)'); Key = 'table'; Label = 'table/bang' }
|
||||
)
|
||||
|
||||
# H18-A(b) scan-range follows the REAL rule-range (S100, Harness-18 adopt): the derived-doc
|
||||
# set expands DYNAMICALLY to ALL skill SKILL.md + ALL command *.md. Rationale (real pain):
|
||||
# a stale hard-count "(68)" survived ~11 sessions inside .claude/commands/session-start.md
|
||||
# because commands/ sat OUTSIDE this fixed list (blind class, H1 F3 catch S99). A fixed list
|
||||
# self-ages as the rule-set grows; the glob tracks the live set. Test-Excluded still applies.
|
||||
$derivedDocs = @(
|
||||
'CLAUDE.md',
|
||||
'docs\CLAUDE.md',
|
||||
'.claude\skills\ef-core-migration\SKILL.md',
|
||||
'.claude\skills\README.md',
|
||||
'.claude\skills\dependency-audit-erp\SKILL.md'
|
||||
'.claude\skills\README.md'
|
||||
) | ForEach-Object { Join-Path $RepoRoot $_ }
|
||||
$derivedDocs += @(Get-ChildItem -Path (Join-Path $RepoRoot '.claude\skills') -Recurse -Filter 'SKILL.md' -File -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName })
|
||||
$derivedDocs += @(Get-ChildItem -Path (Join-Path $RepoRoot '.claude\commands') -Filter '*.md' -File -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName })
|
||||
|
||||
foreach ($doc in $derivedDocs) {
|
||||
if (-not (Test-Path $doc)) { continue }
|
||||
@ -240,7 +245,15 @@ foreach ($doc in $derivedDocs) {
|
||||
if ($cp.Key -eq 'test' -and $post -match '^\s*project') { continue } # "N test project" = project count, not test count
|
||||
$n = [int]$m.Groups[1].Value
|
||||
if ($n -ne $canon) {
|
||||
$sev = if ([math]::Abs($n - $canon) -ge 10) { 'MED' } else { 'LOW' }
|
||||
# H18-A(a) mismatch-only CONFIDENCE band (S100): a stale TOTAL lags canonical
|
||||
# by a few sessions so it lands NEAR canonical (ratio 0.5..2.0) -> MED.
|
||||
# A module-local count ("6 test PeWorkflowDefinition" vs canonical 440) sits
|
||||
# FAR from the total -> LOW advisory (likely a different quantity sharing the
|
||||
# token word, NOT a stale claim). The old |diff|>=10 rule was BACKWARDS for
|
||||
# that class (big diff = high sev = false alarm; S98 verify: 8/8 MED were FP).
|
||||
# Correct restatement (n == canon) still never flags (mismatch-only base).
|
||||
$ratio = if ($canon -gt 0) { [double]$n / [double]$canon } else { 0.0 }
|
||||
$sev = if ($ratio -ge 0.5 -and $ratio -le 2.0) { 'MED' } else { 'LOW' }
|
||||
Write-Flag $sev ("{0}:{1}" -f (Rel $doc), ($i + 1)) `
|
||||
("derived-stale: writes {0} {1} but canonical={2}" -f $n, $cp.Label, $canon) `
|
||||
("update to {0} OR replace with pointer '-> docs/STATUS.md'" -f $canon)
|
||||
@ -249,7 +262,7 @@ foreach ($doc in $derivedDocs) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-Host ' (note: count-token grep is a soft net - module-local phrases like "4 bang Budget" / "71 test (Phase 8)" can false-positive; treat LOW sev as review-not-fail)' -ForegroundColor DarkGray
|
||||
Write-Host ' (note: count-token grep is a soft net - module-local phrases like "4 bang Budget" / "71 test (Phase 8)" can false-positive; H18-A ratio-band demotes far-from-canonical counts to LOW = review-not-fail, near-canonical stale-totals stay MED)' -ForegroundColor DarkGray
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# C1 - broken-pointer: gotcha #N refs
|
||||
|
||||
Reference in New Issue
Block a user