# 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 (hook hard-limit <17KB) · L2 `archive/2026-06.md` verbatim on-demand · L3 RAG `search_memory`. 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"). Compacted S99 2026-07-02 (19.6KB→~9KB, 12 entry 06-xx → archive NGUYÊN VĂN) · S105 2026-07-07 (19.4→~16KB, S98-S100 → `archive/2026-07.md`) · S106 2026-07-07 (19.7→14.9KB, S102-S104 @start → `archive/2026-07.md`; byte-verified md5×3 @S107) · S107 2026-07-10 @end (17.8→**16.2KB**, S101+S105 @start → archive md5×2) · S109 2026-07-10 @start (17.2→~13KB, S105-end+S106-start → archive md5×2) · S111 2026-07-12 @start+@end (18.35→16.9→~16.4KB, S107×2+S108-end [@start ×2-pass] + S109-start [@end pass-3] → archive fragment+size-verified) · S116 2026-07-13 @end (17.06→13.5→~15.4KB, S110 @start+@end → `archive/2026-07.md` verbatim sed-append +3643B-verified) · S118 2026-07-14 @start (15.7→~15.4KB, 7 pointer-entry S98→S106 gộp 1-digest — verbatim ĐÃ ở archive từ compact trước, 0 move mới) · S125 2026-07-16 @start (21.6→15.8KB, S118-end + S119 @start+META → `archive/2026-07.md` verbatim sed-move +6212B-verified).

---

## 🎯 Role baseline
H1 tooling-freshness auditor **SOLUTION_ERP-self**. Read-only + **propose-only** (em main = single-writer; NGOẠI LỆ duy nhất: diary/archive của chính mình). Tools: Read/Grep/Glob/Bash + 4 RAG-read. NO `store_memory`. 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. 🔴 Final message = VERDICT trực tiếp, KHÔNG narrative memory-curation (#53 return-garble ×4).

## 🚫 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 (re-ground 2026-07-02 S99 — VERIFY mỗi session, đừng tin số cũ)
- **Roster:** 12 sub (S107 +office-document 📄 Office WRITE, anh giao), **12/12 `model: inherit`** (Harness-8 all-inherit, runtime-verified S98 — Fable 5 RESTORED, inherit-chain self-report `claude-fable-5`). 10 product/quality (investigator-codebase/api · implementer-backend/frontend · test-specialist · reviewer · cicd-monitor · frontend-designer · database-agent read-advisory · office-document Office S107 ✅ verified-runtime cùng-phiên [hot-reload agent-MỚI ăn thật — S27 lesson chỉ còn EDIT-agent/command]) + 2 monitor INFORM-only (tooling-auditor · harvest-curator). VALID_ROLES hmw.js = 12 đủ roster (+2 monitor S110 anh-directed; monitor vẫn INFORM-only, lane RETURN-only).
- **Skills:** 6 project (`.claude/skills/`) + 23 standalone (`~/.claude/skills/`) + 18 command-file (S101 +fable-real/clone · S111 +pause/tiep H22) (`.claude/commands/` — hmw = script `workflows/hmw.js`, KHÔNG phải slash-command).
- **Plugins:** 18 registered (15 enabled / 3 disabled: pr-review-toolkit · code-modernization · hookify) user-global `~/.claude/settings.json:17-35` · marketplace 35 · settings `model: claude-fable-5[1m]` + `effortLevel: xhigh` + `:38 skipWorkflowUsageWarning` (first-noted S111). ⚠️ S111 H22: project `.claude/settings.json` RA ĐỜI = hooks.Stop `wal-flush.ps1` ONLY — KHÔNG plugin/model override → authority ③ VẪN user-global (đừng conflate 2 file settings).
- **Docs canonical:** `CLAUDE.md` (root+docs) · `docs/STATUS.md` (số canonical B1) · `docs/HANDOFF.md` · `.claude/agents/README.md` · `docs/governance/`.

## ⚠️ Anti-patterns
❌ Tự sửa config/doc/enable-plugin (propose-only) · ❌ conflate plugin "enabled"="used" (installed≠enabled≠assigned≠used) · ❌ tick-checkbox no-evidence · ❌ đụng harvest-memory (harvest-curator) · ❌ G-015 overclaim "read-only enforced" (Bash residual = write-channel mở).

## 🧭 Method distilled (S50-S98 — chi tiết verbatim `archive/2026-06.md`)
- **Ground-truth MỌI count từ disk:** `settings.json enabledPlugins` = authoritative plugin# · `skills/README.md` ≠ SKILL.md frontmatter (drift độc lập) · Migrations ở `Infrastructure/Persistence/Migrations` (KHÔNG `Infrastructure/Migrations`).
- **Test count:** KHÔNG attr-count `[Fact]/[Theory]` (Theory expand runtime) — tin session-log/test-run/STATUS.
- **Bundle-hash:** KHÔNG tin 1-source — triangulate (cicd-MEMORY = provenance giàu nhất Run#+sha+rotate); anh-cite chưa verify được → flag "unverified", KHÔNG copy.
- **gotcha format:** entry = `### N.` KHÔNG `#N` — verify format trước khi claim missing.
- **commands/*.md + ultra-on.md = trong radar:** roster-grep (S57 catch) + count-grep (S99 catch "(68)") — lớp file hay bị monthly-audit bỏ sót; index/README files cũng vậy (S50).
- **Drift born-SAU-monthly-CÙNG-NGÀY** = lớp riêng (S97/S98) — per-session monitor bù lớp monthly không thấy.
- **system-reminder claudeMd header = pre-session snapshot** → re-Read line thật trên disk, KHÔNG tin context-injection. Brief "chưa flush" cũng = snapshot lúc spawn → re-ground disk hiện tại (S58).
- **Backlog/coords trong HANDOFF phải re-verify** trước khi tin (stale-contradiction S57-resume).
- **Model spawn-test:** frontmatter no hot-reload — pin/inherit ăn SAU restart CLI; self-report nguyên văn = bằng chứng runtime (H4 S57bis · H8 S98).
- **Tool-gotchas:** Bash nuốt `$` PS-inline → `powershell -NoProfile -Command` escape `\$` · PS `Get-Content -Raw`+`-TotalCount` mutually exclusive → dùng Grep tool `^model:`.
- **Return-cut giữa emit** (S58) = finding chính vẫn salvageable từ partial return; emit finding chính SỚM trong report.
- **Grep-tool brace-glob `{a,b}/**` match 0-FILE → sweep VOID tưởng clean** (S105) — re-run per-dir; phân-biệt "0-match" vs "0-file-searched".

## 📅 Recent activity (FIFO — older → `archive/2026-06.md` verbatim)
- **2026-06 (12 entry S50→S66 → archive):** CREATED+first-run verified-runtime (S50 3-drift: plugin 15→18 · ef-core 31→43 · gotcha 49→57) · S51 new-alloc database-agent STRONG-FIT/codebase-agent SKIP · S57×2 (ultra-on+session-start roster catch; VALID_ROLES 9) · H4 demote spawn-test ×2 (pin ăn post-restart, demote-watch #1 OK) · post-S57bis count-drift top-5 · S58 return-cut-partial · S59×2 ALL-FRESH (bundle triangulate 4-src; SearchableSelect=code KHÔNG skill) · S63 H5 opus-collapse confirm + ef-residual · S66 H8 all-inherit flip (7 pin→inherit). → `archive/2026-06.md`.
- **2026-07-02→07-07 (S98→S106 digest — 7 pointer-entry gộp S118; verbatim ĐÃ ở `archive/2026-07.md` từ compact trước, 0 move mới):** S98 Fable-restore + ef-core stuck-59 · S99 F1 flip-miss / F2 SendMessage-stale / F3 command-count "(68)" · S100 ALL-PASS + method `git log -- .claude/skills/` last-touch · S101×2 MODEL-DRIFT first-catch (self-report = per-session probe, đừng tin last-session claim) + cmd 14→16 fable-real/clone COMMAND-tier≠skill · S102-S104 flip-chain #6-#8 + **S104 Mig-62 ship docs-lag D1-HIGH** (table 89 count-invariant 18-AddColumn; `git show --stat` = commit-scope nhanh) · S105×2 skills/README:20 Mig-61-stale + 4-patch LANDED + FLAG-M closed 3/3 · S106 D-BUNDLE gốc STATUS:27 #484→#488 + CADENCE-proposal (adopted S107) + ĐỪNG-tin-brief-baseline-HEAD (re-ground `git log` mỗi commit-mới). Lesson brace-glob hoisted → Method.
- **2026-07-10 (S107 @start + @end → `archive/2026-07.md` verbatim, compact S111):** @start ALL-4 PASS flip-8-Fable (data-point #11) + self-compact-S106 md5×3 LOSSLESS + D-BUNDLE/D-MODEL closed + CADENCE-proposal ADOPTED (STATUS:24 canonical 1-chain) · @end roster 11→**12** +office-document VERIFIED-RUNTIME cùng-phiên (hot-reload agent-MỚI; S27 lesson thu-hẹp EDIT-only) + new-alloc 5-skill PASS ×3-chỗ + D-BUNDLE-lặp #489 (→ closed S108) + residual-grep 0-sót.
- **2026-07-10 (S108 @end → `archive/2026-07.md` verbatim, compact S111):** ①②③ 0-đổi PASS · ④ PASS +runbook 60KB · marker ON-not-committed ✓ (gitignore:92) · D-BUNDLE S107 CLOSED (STATUS:27 hoisted #489) · propose-LOW runbook-pointer ×2 (→ APPLIED S109 `557642f`).
- **2026-07-10 (S109 @start → `archive/2026-07.md` verbatim, compact S111-end):** ALL-4 PASS 0-flag · Fable streak-3 #12 · runbook-pointer propose-S108 APPLIED-verified `557642f` · sleep-PAUSED resume-point nhất-quán budget.json · ⚠️ lesson marker-name: resolve tên THẬT từ source (fable-real:11/.gitignore:92) TRƯỚC khi flag absence (suýt false-alarm `.fable-real-active`).
- **2026-07-12→07-14 (S111×2 + S116-end + S118-start → `archive/2026-07.md` verbatim, compact S123; byte-verified in-archive trước khi trim):** S111 H22-WAL cmd 16→18 + project `settings.json` FIRST-EVER (hooks.Stop wal-flush ONLY ⇒ authority ③ VẪN user-global) · S116 PE giá-ÂM product-only + 2 stale derived-summary (D-BUNDLE recur) · S118-start Mig-column lớp-check MỚI. Lesson đã hoist → Method.
- **2026-07-14->07-15 (S118 @end + S119 @start+META -> `archive/2026-07.md` verbatim, compact S125; byte-verified +6212B):** S118-end ALL-4 PASS +1 RESIDUAL STATUS:6-chip [test-drift-no-oracle]. S119 PASS_WITH_FLAGS: perm-matrix-stale-S6 + mtv3-taxonomy-lag + flip-9-owner-choice + META return-terminates-agent [on-behalf-by-lead]. Lessons hoisted -> user-memory feedback files.
- **2026-07-17 (S132 DỒN S127→S131 — re-spawn sau session-limit-death S131 [E-011]; by em-main VERIFY→APPEND):** DRIFT-FOUND: ① skill FRESH (6+18+23 stable; session-start:206 re-tune 289ba96 sibling-sạch) · ② roster FRESH **14/14 khớp 4-nguồn** + 2 vai H24 opus+max ✓ + reviewer.md:46 Measured-label-gate (S128) static-present **verified-PENDING → spawn-probe post-restart** (carry) · ③ plugin 0-delta (18/15/3) · ④ docs 1 DRIFT THẬT: `rag-onboarding-guide.md:118/:134` còn `contextual_retrieval: true` + "+15% recall" vô-căn-cứ sau owner-final f5ce2778 → **em-main FIXED cùng phiên** (→false + reword recall-chưa-đo/số-paper). Lesson: onboarding GUIDE = prescriptive ⇒ drift khi fleet-config flip (≠ session-log/adap-report frozen-in-time); config-flip kỹ 2-chỗ vẫn sót mirror ⇒ **grep MỌI prescriptive-doc sau flip**; ranh H1⟂H24 gặp nhau ở doc-config-mirror.
- **2026-07-15 (S123 @start — ALL-4 PASS + 1 MED + 2 LOW; FP-census lane tôi = 17/19 DƯƠNG-GIẢ):** HEAD `cefb183`; tree 1-M `.session-counter.json` (em-main tick 1→2, expected). **①SKILL PASS** 6+23+18 identical S122. **C2 replicate 15/15 KHỚP baseline em-main** ⇒ **15/15 FP, 0 MED**: contract-wf 6 (`:24/:35/:332×2/:367/:371`) · ef-core 7 (`:99/:100/:108/:116/:119` per-mig phrase + `:167` HEADING "Revert 1 migration" + `:184` shell-comment) · CLAUDE:86 · session-end:126 ("vd 130→132 nếu thêm 2 test"). Ratio-band ĐÚNG việc (far-from-canonical→LOW). 🔴 **ĐỪNG vá 13 flag 2 SKILL này** — noise cấu-trúc, KHÔNG suy-giảm. **②ROSTER PASS 14=14=14** (disk 14 = 15 file −README · STATUS:25 · hmw.js VALID_ROLES) + **14/14 `model: inherit`**; `agents/README:3` B1-pointer 0-số ✓. 🔴 **MED — G-015 overclaim 2 vai H24:** `lead-view-auditor:77` + `lead-omission-auditor:68` ghi "KHÔNG Write/Edit/commit (mày không có tool đó)" nhưng cả 2 CÓ `Bash`@:6 ⇒ `git commit` LÀM ĐƯỢC ⇒ SAI cho *commit*. 5 persona khác CÓ caveat; đúng 2 vai soi-LEAD thì KHÔNG. 🟡 LOW: 4 hardcode "roster 14" (`fable-clone:3/:18`·`fable-real:3/:19`) đúng-hôm-nay nhưng `fable-clone:21` CÙNG FILE cấm chép số ⇒ tự mâu-thuẫn + pre-armed (ACTIVE-MARKS:19 "roster 12" đã dính, :26 vá bằng chú-thích). **③PLUGIN PASS** 18/15/3 + m35 + `claude-fable-5[1m]`:11 + xhigh + skipWf IDENTICAL; 0 new-alloc. **④DOCS (a) STATUS:6 `view-stale-header` THẬT** — `Last updated: 2026-07-15 (S119…)` mà `:35 Recently Done (S122)`; mega-line S119×3, **S120/121/122 = 0 hit**. **H24-1 MÙ** (chỉ so NGÀY; 07-15=newest⇒0 flag) = **âm-giả chứng-minh-được**. Tái-phát **lần 4** (S116/S117/S118) ⇒ fix CẤU-TRÚC, không bump. **(b) measured{} 12 vai thiếu 2 vai H24 = DRIFT nhưng số=0:** 2 dir RỖNG + 0 git-track (chưa chạy). Drift thật = `_note` "roster 11->12" (nay 14) + **blind-spot**: `lead-omission-auditor:38` class `gap-underfill` ĐỌC `measured` ⇒ 2 vai mới 0-baseline ⇒ đo NOTHING (= failure-mode GAP-3 policy W4). Fix RẺ: `measure-agent-memory.ps1:10` **auto-discover**, 0 hardcode. 🔴 **+1 delta (45→46):** 45 đo tại **W4 `a09dcae`**, sau 6 commit; `6dcd457` (W6) thêm adap-report H24 `:78` **trích lại** anchor `Status (post Session 6 — 2026-04-30)` khi ĐANG GIẢI-THÍCH chính FP đó ⇒ H24-1 3→4. Số-học khép. 🔴 **GỐC — FP TỰ LÂY qua TRÍCH-DẪN (3 đời):** perm-matrix:16 (defect THẬT, vá W4) → lead-view-auditor:45 (ví-dụ) → adap-report:78 (**= +1 delta**). **Mỗi doc viết VỀ FP tự thành FP.** Chỉ exclusion `runs/` (`:109`) chặn 3 file khác ⇒ **exclusion runs/ VÔ-TÌNH gánh FP-rate**. **DỰ-BÁO:** session-log S123 trong `docs/changelog/sessions/` trích anchor ⇒ TOTAL **47**; trong `runs/` ⇒ **46**. 🔴 **Guard tự-quy-chiếu:** H24-2 `:670-672` CỐ Ý loại `<` cho `[carry:<slug>]` (*self-reference trap*) = **CÙNG LỚP** H24-1 nhưng **KHÔNG port được CƠ-CHẾ** (guard H24-2 ăn nhờ `<` phân-biệt; ví-dụ H24-1 **byte-identical** anchor thật = ĐIỂM của ví-dụ tốt). **ĐO 5/5: backtick-enclosure** — QUOTED = :45+:78 (**2 FP**) · BARE = form-engine:15 + rag-setup-plan:4 + perm-matrix:16-pre-vá (**3 TP**, gồm positive-control lịch-sử). ⚠️ **form-engine:15 = TP + anchor TRUNG-THỰC** (`git log` last-touch `2abbc1d` **2026-04-30** ⇒ file ĐÚNG từ S6). 🔴 **BẪY:** vá kiểu W4 (đổi form→`Status (cập-nhật…)`) ⇒ **rơi khỏi watch-set** như perm-matrix VỪA rơi (nay KHÔNG khớp pattern nào ⇒ `Get-AnchorDate`→null→SKIP = **mất theo-dõi ÂM-THẦM**, dù comment `:508-512` nói pattern#2 sinh ra CHÍNH VÌ perm-matrix). form-engine:15 = **TP DUY-NHẤT nuôi pattern#2**. **5→0 số-học W4 KHÔNG phân-biệt "date refreshed, còn watch" vs "form lạ, hết watch".** Model **Opus 4.8** (flip-9 owner-choice; `settings:11` `claude-fable-5[1m]` = configured-default, KHÔNG drift). ⚠️ L1 over-cap carry S124. Tag `[s123-start, fp-census-17-of-19, fp-self-propagating-via-quotation, backtick-discriminator-5-of-5, g015-overclaim-2-new-vai, status6-stale-header-4th-recur, measured-12-of-14, perm-matrix-silent-watch-loss]`

- **2026-07-16 (S125 @start — ①②③ PASS + ④ PASS_WITH_FLAGS; worker-tier-pin S124 VERIFIED disk+commit):** HEAD `3aacdf9`(wal), tree clean. **②ROSTER PASS** 14 persona; **14/14 `model:opus`@:5+`effort:max`@:6** on-disk+committed (`git show HEAD:tooling-auditor.md`✓); agents/ last-touch `23bbe97`(S124), 0-since. **①SKILL PASS** 6+23+18 identical S123; contract-wf/ef-core count-stale=monthly(08-01). **③PLUGIN PASS** 18/15/3 IDENTICAL; `claude-fable-5[1m]`:11 lead default UNCHANGED (pin=SUBS-only). **R6 ✓** project `settings.json:2` `autoMemoryDirectory`=`.claude/auto-memory`; my ctx-inject FROM that path ⇒ relocate WORKS; authority ③ user-global. **④ 5 RESIDUAL — worker-tier-pin doc-sync NOT finished:** HIGH `STATUS:25` row "all-inherit/TOÀN roster `model:inherit`" + stale "cả **12** lên top-tier"/"**10** product"(roster 14) · HIGH `agents/README:5` "TOÀN BỘ sub `model:inherit`" CONTRADICTS same-file :38 worker-tier-pin · MED `fable-real-runbook.md` **≥2 FALSE CITATION** `:227`/`:563` cite `investigator-codebase.md:5`/`reviewer.md:5`=`inherit` but disk=`opus` (fix NON-trivial: hmw.js alias-vs-frontmatter "chưa test") · MED `fable-real.md:37` · LOW `fable-clone.md:43`(corrected :57). 🔴 **ROOT:** `STATUS:41-42` blurb CLAIMS "doc-sync **ĐÃ vá**" but 5-spot prove INCOMPLETE = tick-no-evidence → NOT-DONE. Ack machine-fired: STATUS:6 header H24-3; harness-11:57 vocab-seed +worker-tier-pin(D7). **Method:** frontmatter tier-flip→grep MỌI doc citing agent `:5`=inherit. Model self **Opus 4.8**. ⚠️L1 carry S126. `[s125-start, worker-tier-pin-verified, doc-sync-incomplete-5spot, false-citation-runbook, da-va-but-incomplete, mem-gap-s124]`
- **S126 (2026-07-16) session-end CHỐT [opus-worker, em-main VERIFY+APPEND]:** 3/4 PASS-clean (① SKILL 6-project 0-diff — task gọi "check-email/send-email skill" thực-ra = **COMMANDS** `.claude/commands/`, 6 skill thật 0-đổi · ② ROSTER 14/14 `opus`@:5 + `max`@:6 disk-verified; README:5 + STATUS:25 flip worker-tier-pin ⇒ **S125-HIGH "README:5 contradicts :38" RESOLVED** · ③ PLUGIN 18/15/3 + `fable-5[1m]`/xhigh IDENTICAL) + ④ DOCS PASS_WITH_FLAGS: 🎯 bắt **5 dòng "H23-precedence CHƯA test" SÓT ở 3 command-file** (`session-start.md:50/:52` canonical BƯỚC 0.6 đọc MỖI phiên · `fable-clone.md:63/:65` cross-ref "hmw.js:44-52 mang cùng ghi-chú" ĐẢO/GÃY sau khi hmw.js vá · `ultra-on.md:35`) trong khi 7 file khác đã "ĐO S126" — **same-class-miss ×2 trong CÙNG PHIÊN đang vá class đó**; em-main vá NGAY 5/5 + LOW STATUS:25 "10+2"→"10+4". Learned: fact-runtime chốt ⇒ grep MỌI file mang claim cũ GỒM lớp **command-doc** (sweep-synthesis liệt consumer thiếu lớp ⇒ miss tái-sinh; commands/*.md blind-spot khớp S57/S99 method-mine). Tag `[s126-end, 5spot-h23-stale-caught, commands-layer-blindspot, s125-high-resolved]`.