- Rename muc 3: "Chon NCC / TP thang thau" -> "Don vi NCC/TP duoc chon" (anh Kiet chot chu) x2 app + wording phu nhat quan - Guard gui duyet du CA 4 (anh chot): don vi duoc chon + gia chao thau >0 + ngan sach (Budget link HOAC nhap tay) + bang so sanh dinh kem + BE ConflictException gop moi muc thieu 1 lan, ap ca Admin (TransitionAsync submit branch) + FE pre-check missingForApproval cung predicate -> disable nut + tooltip liet ke du (computeGiaChaoThau extract single-source) - Bypass drafter-in-chain (luat GENERIC theo cap, anh chot): V2-only, BUOC DAU only - nguoi soan la approver cap k -> auto qua Cap 1..k khi gui + Audit 3 tang: Approval row AutoApprove per cap + LevelOpinion CHI slot chinh chu (khong gan chu ky NV bi skip) + Changelog + Pointer: k<max -> Cap k+1; het buoc -> Buoc 2 Cap 1; workflow 1 buoc -> terminal DaDuyet + TraLai resubmit ap lai idempotent (opinion UPSERT) - Tests: +14 PeSubmitGuardAndBypassTests (240 -> 254 PASS) - Reviewer die mid-run (gotcha #53 class) -> em main self-gate evidence-checklist PASS 0 blocker Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
15 KiB
Harvest-Curator Agent — Persistent Memory
Persistent diary cross-session. Auto-injected first ~200 lines at spawn (L1 HOT). Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2
archive/on-demand · L3 RAGsearch_memoryjust-in-time. Keep entry ≤ 1.5K chars. NEW agent 2026-06-07 (adopt AI_INFRA Harness 1 — H2 harvest-integrity; TÁCH khỏi tooling-auditor H1 per anh-mandate "H1/H2 hay quên+nhầm → riêng-biệt").
🎯 Role baseline
H2 harvest-MD-integrity auditor SOLUTION_ERP-self. Read-only + propose-only (em main = single-writer, VERIFY→APPEND B3). Tools: Read/Grep/Glob/Bash + 4 RAG-read. NO store_memory, NO Write/Edit. Verify HARVEST mỗi session ĐỦ+ĐÚNG 5-trục: Coverage · Completeness · Fidelity-FLAG · Placement · Corruption. @session-end GATE trước đóng + gom wave-folder (Harness 2 B5); @session-start báo harvest mới + delta mồ-côi.
🚫 Split boundary
- ✅ MINE: harvest-memory integrity (5-trục) + spawn-record 4-field + wave-folder gom (B5) + delta mồ-côi — SOLUTION_ERP-self
- ❌ NOT: tooling/skill/plugin/docs-freshness → tooling-auditor (H1) · corpus/RAG/deploy → cicd-monitor · Fidelity tự-phán "bịa" → escalate reviewer · write/decide → em main
📋 Baseline state (2026-06-07 seed)
- Nền H2 đã có 1 phần:
session-end.mdPhase 1.5 §L.b(d) spawn-record 4-field + (f) double-check moved-not-cut + (c) 0-byte AS-8 = 3/5 trục (Coverage+Completeness+Corruption). Sub này NÂNG +Fidelity-escalate +Placement = đủ 5. - Spawn-record 4-field SE:
{task · verdict · learned · surprise}(memoryDelta R1 contract HMW). - agent-memory: 10 folder
.claude/agent-memory/<role>/MEMORY.md(placement target). - Wave-folder (Harness 2):
.claude/workflows/wave-<tên>/sub-*.md(gitignored) — gom @B5.
⚠️ Anti-patterns
❌ Tự ghi/overwrite memory (propose→em main APPEND) · ❌ tự phán Fidelity "bịa" (→ reviewer) · ❌ tick "đã flush?" nhị-phân (phải đủ 5-trục) · ❌ đụng tooling-freshness (đó là tooling-auditor) · ❌ G-015 overclaim "read-only enforced".
📅 Recent activity (FIFO — older → archive/git)
- 2026-06-07 (CREATED): Seeded H2 harvest-curator (adopt AI_INFRA Harness 1, anh giao). Tailored SE: 4 RAG-read ·
model:inherit· omit color · Fidelity-escalate → SEreviewer(KHÔNG AI_INFRA-specific). Wired @session-end §L.b GATE (nâng 3/5→5/5 trục) + @session-start RE-REPORT harvest-mới (Phase 2.1.1) + Harness 2 B5 wave-gom. Nấc: executed-file, verified-runtime PENDING CLI restart + first spawn smoke. Tag [created, harness-1, h2]. - 2026-06-07 (S50 FIRST REAL RUN — verified-runtime ✅): Spawned @session-start (harvest RE-REPORT) + @session-end (5-trục GATE + B5 wave-gom). Load OK → verified-runtime CONFIRMED. @start: harvest 🟢 clean. @end: GATE PASS 5/5 (Coverage 4 subs · Completeness 4-field · Placement correct homes · Corruption 0-byte/mojibake=0 · Fidelity no-flag — independently re-verified inv-codebase
.gitignore:93claim). B5 wave-gom executed: 2 wave sub-MDs → propose APPEND agent-memory/{investigator-codebase,test-specialist} (em main wrote). B6 re-verify HELD (git diff agent-memory EMPTY). Method-learning (⭐): chunk-count CANNOT verify via Bashcurl localhost:6333— RAG MCP points at DIFFERENT Qdrant host → collection 'not found' false-negative. Use RAG MCP channel (list_projects) for chunk-count, NOT shell probe; em main (single RAG-writer) = authoritative (confirmed 2415). Tag [first-run, verified-runtime, gate-pass, chunk-via-mcp]. - 2026-06-08 (S51
/session-end5-trục GATE — DIRECT spawns, RAG down): Verified 6 product subs · nấc=verified-runtime (on-disk ground-truth, 0 file written, git-diff agent-memory clean = E-006 backstop ✅) · evidence=GATE PASS 5/5 (Coverage 6/6 S51 entries · Completeness 4-field · Placement correct · Corruption 0-byte=0 + investigator-killed file intact 92L terminates-clean + mojibake/shell-bake=0 · Fidelity reviewer-proxy honestly-marked + "1 MAJOR" claim ground-truthedHrmConfigsPage.tsx:132-134). B5 wave-gom n-a (DIRECT spawns, nowave-*/). 3 non-block flags → em main: (1) test 185→186 honest RED→GREEN (raw 174 attrs→runtime 186) (2) cicd self-tag [s50]→should-be-s51 cosmetic (3) Mig 45→92 tables, CLAUDE.md stale 43→91. Method-learning ⭐: killed-mid-write sub → verify file terminates cleanly (wc -l+tail+closing-Tag), NOT just-size 0(partial-write = truncated tail not 0-byte). Tag [s51, gate-pass, killed-sub-verify, direct-spawns]. - 2026-06-10 (S57-interrupted @session-start RE-REPORT): Verdict VÀNG — orphan delta investigator-codebase 3 entry S57 uncommitted (agent DUY NHẤT có delta post-S56; so mtime vs closeout-commit timestamp
a62e79720:20:51 = phương pháp detect interrupted-session). 4-field PASS ×3 · fidelity spot-check: flag "master-write-open" → fixRoles="Admin,CatalogManager"×3 controller đã apply working-tree (recon khớp việc-thật — đọc memory khi resume đừng tưởng còn hở) · wave/stray/0-byte = 0 · flags: investigator 33.5KB>cap archive-L2, entry-3 tag s56→s57, double-blank-line nit. 0 file written (em main append B3). Tag [s57-orphan, mtime-vs-closeout-method, gate-na-start]. - 2026-06-10 (S57-RESUME @start RE-REPORT): Verdict 🟢 — 3 delta agent-memory uncommitted (harvest-curator +1 · investigator +3-entry · tooling +1+baseline-reground) ALL SANE, attribution nhất quán em main proxy-append B3 (mtime 2 đợt: investigator 10:56 S57-work → harvest/tooling 11:55-57 resume-attempt; style/nội-dung khớp em-main, KHÔNG dấu hiệu sub tự ghi — G-015 honest "no evidence" ≠ "impossible"). 5-trục: Corruption 0-byte=0 (11/11 ≥4.4KB, tail terminate sạch, mojibake=0) · Wave/stray=0 (7 vị-trí check, S54-pattern không tái) · Fidelity sample 8/8 deep-verify PASS (authz ×3 controller · hmw.js:26=9 · README:192/:201 · gotcha-58 ×2 skill · ef-core 93/48 · roster 11=11 folder · catalog.manager:1608 · GetMyMenuTree:96 exact) · Completeness 4-field đủ ×5 entry · Coverage 🟡→resolved: 8 file code KHÔNG có delta implementer-* vì evidence nghiêng em-main-direct implement (mtime implementer pre-closeout + diff nhỏ + comment [S57] style em-main + investigator entry viết "Flag em-main" như brief) → không phải Coverage-miss. 2 nit em main FIXED in-session: investigator entry-3 tag s56→s57 + double-blank-line ×2 gộp 1. Chore còn: investigator 33.5KB>30KB cap → curate L2 @closeout/monthly. Nhắc P1: commit 16 file PHẢI kèm docs-closeout (STATUS/HANDOFF/log) tránh "code committed, docs mù". Tag [s57-resume, gate-start-pass, mtime-attribution, coverage-resolved].
- 2026-06-11 (S57bis @start RE-REPORT + spawn-test post-restart ✅): Self-report
claude-fable-5[1m]→ promote-tierinheritGIỮ Fable 5 runtime-VERIFIED (H4.3c). Verdict 🟢 KEEP-ALL-5 — 5 agent-memory delta uncommitted (harvest+2 · impl-backend+1 · investigator+3 · reviewer+1 · tooling+baseline-reground+3) ALL dated 06-10 S57/S57-resume, em-main-proxy-append B3, attribution mtime-cluster 21:52–22:28 nhất quán, commit AS-IS. Corruption: 11/11 ≥4.4KB, 0-byte=0, tail sạch, mojibake=0. Wave-folder=0 tồn (S56 2 workflow harvest sạch). 3 untracked = em-main governance docs (KHÔNG phải harvest-MD) → vào commit bundle. Chore giữ: investigator-codebase 33.5KB>30KB cap → L2 @closeout/monthly (reviewer 29.6KB + cicd 29.2KB sát cap, watch). Tag [s57bis, spawn-test-verified, keep-all-5, promote-inherit-proof]. - 2026-06-11 (post-S57bis @start RE-REPORT — rushed-closeout 4 Coverage-MISS): S57bis đóng vội (commit 12:12-13 → post-commit ghi 12:23-25 rồi dừng, KHÔNG end-GATE). Verdict 🟡: Coverage 4 MISS / 9 role spawned — implementer-backend+frontend (CẢ 2 return-truncated #53) · database-agent (Mig-49 design DELIVERED mà 0 delta — miss đau nhất) · reviewer (die-0-byte ×2 resume-kill → em main self-gate) → propose 4 spawn-record on-behalf. 5 record có sẵn (inv-codebase·test-spec·tooling·harvest·cicd-dirty) 4-field PASS, fidelity ground-truthed (Mig 49 file
Persistence/Migrations/20260611044424exists + count 240 consistent ×4 nguồn). Method ⭐: commit-stat "có append" ≠ "có fanout-record" — impl-backend/reviewer append trong17b23a4= carry 06-10 S57-resume (mtime 06-10 22:21-28); classify bằng grep tag57bis+ mtime, KHÔNG tin stat. Mồ-côi ×2 sane (cicd +Run#381 PASS+1PARTIAL — escalation lock-14-user prod NO-OP email-stale · gotchas #59 PS5.1 quote→-F) → commit bundle; cicd entry chứa bundle-hash CP4CB1ym/BmZ3VHnm = resolve flag "unverified" của tooling. Wave=0 · stray=0 · 0-byte=0 (find -size 0 empty). Chore: cicd 32.3KB + inv-codebase 32.1KB ĐỀU >30KB (inv vừa curate 11:30 vẫn over). Wrote OWN diary only (em main explicit). Tag [post-s57bis, coverage-4-miss, carry-vs-fanout-classify, die-0-byte]. - 2026-06-11 (S58
/session-end5-trục GATE — chiều, 8 spawn): GATE PASS 5/5 — Coverage 9 record/8 spawn (H1+H2 start · inv recon:73· cicd #382/#383/#384 + #385→#386 supersede-chain UNCOMMITTED mtime 14:20 — run-cuối3ebaf84đã về có record, nhắc commit bundle · designer proxy:39) · Completeness 4-field 8/8 · Placement đúng nhà, stray=0, NIT: cicd #383 nằm:89GIỮA khu archived (dưới #377, trên Run #232) thay vì slot FIFO :72-73 → propose MOVE trước curate kẻo archive nhầm entry 1-ngày-tuổi · Corruption 0-byte=0 cả repo + user-memory, last-byte 11/110a, 9/9 entry mới close-Tag sạch, mojibake 1 hit = quoted-evidenceC<EFBFBD>ngcicd:79 (#377 sqlcmd lesson, cố ý) · Fidelity 5 on-behalf/proxy marked tường minh ("on-behalf em main ghi hộ, H2-proposed" ×4 + designer "[em main proxy — truncated #53, 2nd consecutive]") + reviewer honest "KHÔNG DELIVER die-0-byte ×2", spotgit merge-base --is-ancestor ea793a4 3ebaf84=YES khớp claim #386 → no-escalate. Wave=0 confirm (workflows chỉ README+hmw.js). Chore: cicd 41.1KB (sáng 32.2 → +4 entry siêu dài/ngày!) + inv-codebase 32.9KB ĐỀU over-cap → curate-L2 P1 next session; reviewer 29.6KB + impl-be 27.9KB watch. Method ⭐: diff-filtergrep -v "^[+-][+-]"NUỐT dòng+- **…bullet-append → suýt false-MISS investigator; extract added-bullet phải dùnggrep "^+-". Trend: self-tag session-drift lần 3 (inv:73tag s57bis cho spawn S58; trước: cicd s50→s51, inv s56→s57). 12-vs-8 spawn-count để em main reconcile. Wrote OWN diary only. Tag [s58-end, gate-pass-5/5, 383-misplaced, cicd-41kb]. - 2026-06-11 (S59 @start RE-REPORT — post-S58 đóng-sạch): Verdict 🟢 CLEAN cả 5 mục — tree clean HEAD
1577927(commit 14:33:20), 11/11 agent-memory mtime ≤14:32 đều TRONG closeout → 0 delta mồ-côi. Wave=0 (workflows/ chỉ README+hmw.js) · stray=0 (find prune node_modules) · 0-byte=0 (agent-memory + user-memory) · user-memory index 22 entry = 22 file khớp, MEMORY.md 5.6KB>0. Record-S58 hiện hữu: cicd:71-74(#385→#386/#384/#382/#381) · designer proxy:39· inv:73(tag s57bis drift giữ nguyên). 4 on-behalf s57bis (db/impl-be:77/impl-fe:45/reviewer:60) mtime 13:00 = closeout đóng 4-MISS ✅. cicd #383 VẪN:89khu archived NHƯNG em main đã ANNOTATE "[⚠️ VỊ TRÍ LẠC — entry MỚI 2026-06-11...]" thay vì MOVE → guard chống archive-nhầm OK, relocate thật khi curate. Mojibake 2 hit ĐỀU quoted-evidence (cicd:79#377 + MY OWN:33self-quote khi tả hit cicd — các session sau đừng false-alarm file mình). Chore carry: cicd 41.3KB + inv-codebase 32.9KB > cap → curate-L2 P1; reviewer 29.6 + impl-be 27.9 watch. Method ⭐:tail -c Ncắt giữa UTF-8 multi-byte in<EFBFBD>GIẢ — corruption thật phải grep literal U+FFFD (chỉ 2 file). Brief em main liệt kê impl-fe+reviewer là "S58 spawn" nhưng on-disk 2 role chỉ có s57bis on-behalf — khớp GATE S58 8-spawn set, flag đối chiếu không phán. Tag [s59-start, clean, mojibake-self-quote]. - 2026-06-11 (S59
/session-end5-trục GATE — tối, 9 body-spawn + closeout-floor): GATE PASS 5/5, 0 MISS (lần đầu 0 on-behalf cần đề xuất kể từ chuỗi 4-MISS post-S57bis). Coverage: tooling ×2 (:35start +:36end-run mtime 18:15 NGOÀI brief 9-spawn = closeout-floor H1 → reconcile tổng 11) · harvest:34· inv recon:73· cicd 6/6 entry RIÊNG #273-278:71-76, sha-chain khớp git log 1:1 (56882ac→9c330d2, topic khớp commit-msg từng run) · 7 role không-spawn 0 phantom. Completeness 4-field 10/10 (#275 honest PASS-PARTIAL PE=1 UAT-leftover). Placement: đúng nhà, stray=0, inv S51→archive VERBATIM moved-not-cut + pointer "curated S59"; nit FIFO swap #273(:75)↔#274(:76) + archive double-blank. Corruption: 0-byte=0 ×2 nơi · mojibake 3 hit ĐỀU quoted-cũ (cicd:85 = #377 shift ĐÚNG +6 từ :79 — arithmetic shift = số dòng insert, method nhanh phân biệt cũ/mới) · cicd 54KB/102-dòng (brief nói ~46) + inv 32.9KB over-cap → curate-L2 P1. Fidelity: bundle BSh2fG2X/D22KfpPc triangulated 5 nguồn (cicd:71 + STATUS:6/:27 + HANDOFF:5 + log:4/:43) · WI=71 ×3 entry · gotcha #61/#62 disk:1099/:1111· tooling end-entry tree-state khớp git status độc lập — no-escalate. 2 flag content: cicd:53"Bundle live S59" STALE 1 run (ghi #277 ex7Tc92G/DzUeSk96, live thật = #278 — entry :71 đúng, chỉ status-line lệch) → propose 1-line fix; #275 "09:46:42 sáng" nghi UTC-mislabel = 16:46 chiều local (STATUS:6 nói "chiều nay"; kết luận not-resurrect GIỮ). Tag [s59-end, gate-pass-5/5, 0-miss, cicd-54kb, line53-stale]. - 2026-06-12 (S60 @start RE-REPORT — post-S59 đóng-TRỌN): Verdict 🟢 CLEAN cả 5 mục — tree clean HEAD
6bf28bf(18:49:21), 11/11 agent-memory mtime ≤18:42:45 đều TRONG closeout → 0 mồ-côi. Coverage S59 14-spawn ĐỦ: H1 tooling:35/:36+ H2 ×2 + recon inv:73+ cicd run-coverage 10/10 #273→#282 (6 entry:72-77+:71#279/280 + extension FINAL-v2 #281/282 — 9 spawn→8 record-unit do supersede-fold, 0 run thiếu). Wave=0 · stray=0 · 0-byte=0 ×2 nơi · user-memory 23 file = index 22 + MEMORY.md 5.6KB khớp · cicd tail0asạch. 2 flag GATE S59-end RESOLVED bởi em main::53bundle-live → FINAL-v2B1DtNT9C/D6uF3Mln#282 ✓ + #275 UTC annotate:75✓. #383 vẫn lạc (:89→:96shift +7 đúng arithmetic, annotation guard intact). Chore P1 carry: cicd 56,480B/103L over-cap 3rd-session + phình 54→56.5KB/buổi + inv 32,931B → curate-L2 (kèm relocate #383 + FIFO swap #273↔#274); watch reviewer 30,354B + impl-be 28,585B. Tag [s60-start, clean, flags-resolved, cicd-56kb]. (em main APPEND B3 — H2-proposed, verify: 0-byte/tree-clean/size đối chiếu độc lập ✓)