# 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) → `archive/2026-07.md` verbatim (compact S140, byte-verified +4329B):** ALL-4 PASS + 1 MED (G-015 overclaim 2-vai-H24, Bash residual) + 2 LOW; FP-census lane tôi 17/19 DƯƠNG-GIẢ · status6-stale-header 4th-recur (H24-1 mù) · measured{} 12/14 · perm-matrix silent-watch-loss. Lessons hoisted → user-memory `feedback_citation_trap_selfreference` + `feedback_goodhart_leave_measurement_set`.
- **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]`.
- **S140 (2026-07-18) session-end CHỐT [opus-worker] — governance-only (0 code/mig/FE); diff `0b0285c..HEAD`:** **①SKILL PASS** 6-proj+23-standalone 0-diff (skills git-diff rỗng) · **NOTE** "183KB/5-file un-gisted baseline" ở 3 command-file (`session-start.md:131`·`session-end.md:56`·`sleep-recovery-memory-l2.md:52`) NAY stale-as-live: sleep-compress `aa88d01` gist 5/5 archive 2026-07 ⇒ un-gisted=0 (5/5 GIST-EXISTS verified). Display đo LIVE `(Get-Item).Length` KHÔNG consume số ⇒ 0 wiring-bug, chỉ misread-risk. Rec: coi ví-dụ-lịch-sử (đã dated 17-07). **②ROSTER PASS 14=14=14=14** (disk · STATUS:450 `**14**` · agents/README:3 B1-pointer-0-số · hmw.js:22-36 VALID_ROLES) + 0 agents-diff. **③PLUGIN PASS** 18/15/3 IDENTICAL (disabled pr-review·code-mod·hookify); settings user-global 0-touch. **④DOCS PASS_WITH_FLAGS:** (a) `session-model-se-draft.md` NEW anchored auto-memory `project_session_model_direction:14`+WAL:12+email — NOT orphan; HANDOFF-carry PENDING @closeout (WATCH) · (b) adap `624c378d` Vòng-5 verified-pending→executed-runtime self-contained (§2+§5 consistent) + checklist row-8 phép-8 + _index +1 email-row; NO further sync (_index=email-layer, lead-view S140) · (c) HANDOFF stamp S138-S139: NEXT (5)DP-5-sleep+(6)force-fire-H24+(8)phép-8 ĐÃ actioned → closeout reconcile + refresh "183.054B chưa-gist". **NEW-ALLOC:** 5 gist = per-agent L2 own-dir (archive-flow auto-covers) ⇒ 0 alloc-action. Boundary: STATUS-header-stale = lead-view H24, KHÔNG double-touch. Model Opus 4.8. Tag `[s140-end, 3-mặt-pass-docs-flags, sleep-183kb-now-historical, draft-anchored-carry-pending, adap-vong5-executed-runtime, 5-gist-L2-autocover, L1-compact-s123]`