Files
solution-erp/.claude/agent-memory/investigator/MEMORY.md
pqhuy1987 b3444a3448 [CLAUDE] Memory: S33 startup + Plan B+C activity 3 sub-agent append
3 sub-agent MEMORY auto-updated qua spawn S33:

🟦 Investigator (a327050, afaf6d5, a103d20) — 3 spawn entries:
- S33 startup audit 4 MEMORY size + cross-agent learnings 4 pattern +
  RAG hit verify 2/3 PASS + 1 WARN boundary 0.684
- Plan B G-H1 Task 1 pre-flight NamGroup TblNhanVien* 10 bảng audit
  (NOT 8 anh main estimate) + field map 70 cols main + 5 satellite
  proposal (defer 3 HĐLĐ Plan H2)

🟥 Reviewer (a5acadc, aaa1df3) — 2 spawn entries:
- S33 startup drift severity assessment CLAUDE.md SEVERE patch now
- Plan C B-Wrap pre-commit verify 9/9 PASS in 4.7s, Smart Friend 5×
  cumulative clean (em main+Implementer quality genuine NOT lowered)

🟩 CICD Monitor (aa504e8) — 1 spawn entry:
- S33 startup health-check HEALTHY 3/3 prod endpoint 200 + Mig 33 prod
  synced + cert api.solutions.com.vn 58 days lead 2026-07-23 + discovery
  paths-ignore thiếu eval/** wastefully deploy S31 RAG telemetry JSON

Pattern: per repo convention (5400983 S32 wrap), 3 sub-agent MEMORY auto-
append commit scope `[CLAUDE] Memory:` separate từ substantive scope.

Implementer MEMORY truncated giữa update Pattern 12-bis lookup (Plan B
Task 3 scaffold) — em main append proxy entry sau (defer).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 18:17:15 +07:00

26 KiB
Raw Blame History

Investigator Agent — Persistent Memory

Persistent diary cross-session. Auto-injected first 200 lines / 25KB at spawn. Update BEFORE every stop. Curate when > 25KB.


🎯 Role baseline

Read-only research + audit for SOLUTION_ERP codebase. Tools: Read, Grep, Glob, Bash, WebFetch, WebSearch. Output: concise structured findings under 500 words.


📋 Patterns proven (cross-session)

Pattern: Smoke verify catalog SOLUTION_ERP

  • Bearer auth từ https://api.solutions.com.vn/api/auth/login (POST email + password)
  • Status code matrix expected vs actual + JSON output + MD audit
  • Test credentials: admin@solutions.com.vn / Admin@123456 (full) OR nv.test@solutions.com.vn / TestUser@123456 (Drafter UAT scope)

Pattern: Schema scan via sqlcmd

# LocalDB Dev (runtime — primary)
sqlcmd -S "(localdb)\MSSQLLocalDB" -d SolutionErp_Dev -Q "..."

# LocalDB Design (ef tooling)
sqlcmd -S "(localdb)\MSSQLLocalDB" -d SolutionErp_Design -Q "..."

# Production (qua SSH vietreport-vps)
ssh vietreport-vps "sqlcmd -S .\SQLEXPRESS -d SolutionErp -U vrapp -P '...' -Q '...'"

Common queries: sys.columns, sys.triggers, __EFMigrationsHistory, COUNT(*), sys.indexes.

Gotcha: 2 LocalDB distinct (memory feedback_designtime_runtime_db):

  • _Dev — runtime API (appsettings.Development.json ConnectionStrings:Default)
  • _Designdotnet ef migrations add/update default target
  • Use --connection "Server=(localdb)\MSSQLLocalDB;Database=SolutionErp_Dev;..." override khi cần Dev specifically.

Pattern: Controller audit

  • Grep \[Route\("api/[a-z]+"\)\] enumerate ~30+ controllers
  • Grep \[Authorize(Policy = "..." audit per-action policy (gotcha #44 silent 403 class-level quá strict)
  • Grep IActionResult vs ActionResult<T> — typed return preferred
  • Grep // Mock / alert( / setEditing(null) // close UI — wire claim bugs

Pattern: Memory cross-reference

19 memory entries tại C:\Users\pqhuy\.claude\projects\D--Dropbox-CONG-VIEC-SOLUTION\memory\ (S20 +2 turn 11/12, S21 +2 turn 5):

  • MEMORY.md — index
  • project_solution_erp.md — cumulative narrative S1-S17
  • feedback_per_chunk_commit.md — 5-chunk A-E discipline
  • feedback_uat_skip_verify.md — Phase 9 skip test rule
  • feedback_drastic_refactor_scope.md — defer dedicated session
  • feedback_audit_reuse_before_clone.md — audit-first pattern (Investigator natural fit)
  • feedback_service_hook_vs_endpoint.md — derived state hook pattern
  • feedback_n_stage_workflow_pattern.md — DEPRECATED (Mig 21 flat workflow replaced)
  • feedback_designtime_runtime_db.md — 2 LocalDB distinct
  • feedback_md_compact_narrative.md — §6.5 KEEP narrative rule
  • feedback_unittest_timing.md — §7 test timing
  • feedback_cron_monthly_limitation.md — Cron SDK 7-day expire
  • feedback_user_manual_style.md — non-tech docs style
  • feedback_node_cicd.md — Node 20.x pin
  • feedback_responsive_laptop_breakpoint.md — 4-tầng responsive pattern (S20 t11)
  • feedback_multi_agent_setup.md — 4 sub-agents setup discipline (S20 t12 init 3 + S21 t1 +cicd-monitor)
  • feedback_rag_hybrid_pattern.md — RAG Hybrid Cách A planning (S21 t2, 5 dự án future)
  • feedback_ef_migration_backfill_reorder.md — ADD→BACKFILL SQL→DROP manual reorder (S21 t5 Mig 29)
  • feedback_per_nv_permission_scope.md — Multi-role flag split scope per role (Approver Level vs Drafter User), S21 t4→t5 refactor
  • reference_session_prompts.md — canonical session start template

Pattern: External research priority sources

  • anthropic.com/engineering/ (official patterns)
  • cognition.ai/blog/ (Devin lessons)
  • philschmid.de + eugeneyan.com + hamel.dev (senior engineers)
  • learn.microsoft.com/en-us/aspnet/core/ (.NET 10 official)
  • tanstack.com/query/latest (TanStack Query)

⚠️ Anti-patterns observed

  • Skip MEMORY.md update before stop — lose knowledge tài sản
  • Vague conclusion "seems like" / "probably" — em main rejects
  • Missing file:line refs — non-verifiable evidence
  • Exceed 500 words — em main reads too slow
  • Scope drift to architectural recommendations — em main decides, not me

🧠 SOLUTION_ERP context essentials (auto-load)

  • DB Dev: SolutionErp_Dev LocalDB (59 tables / 30 migrations / Mig 30 latest AddAllowApproverEditBudgetToLevels)
  • DB Design: SolutionErp_Design (ef tooling distinct)
  • DB Prod: .\SQLEXPRESS / SolutionErp / vrapp user via SSH vietreport-vps (fallback C:\inetpub\solution-erp\api\appsettings.Production.json khi $env:PROD_DB_PASSWORD empty — CICD Monitor discovery S21 t5)
  • Tech stack: .NET 10 Clean Arch (Api → Application ← Domain + Infra) + CQRS MediatR + EF Core 10 + 2 React 19 Vite 8 TS 6 (fe-admin :8082 + fe-user :8080) + SQL Server + Gitea Actions CI + IIS prod
  • Live deploys (Prod UAT): https://api.solutions.com.vn · https://admin.solutions.com.vn · https://eoffice.solutions.com.vn
  • Gitea remote: https://git.baocaogiaoduc.vn/vietreport-admin/solution-erp
  • Gitea Actions API: path /api/v1/repos/.../actions/tasks (NOT /actions/runs — 404). Cache stale ~2 min (gotcha #46) — cross-check VPS file mtime
  • SSH VPS: ssh vietreport-vps (config ~/.ssh/config user=Administrator key=id_ed25519)
  • Gotchas active: 47 (+1 #48 SQLite tie-break pending docs — Plan AB Chunk A2 S25 t1; reference docs/gotchas.md)
  • Tests baseline: 111 PASS (S22 baseline 104 + 7 PE WF cumulative; S25 Plan M tests SQLite tie-break re-stabilized Chunk A2) — Phase 9 UAT skip per chunk (memory feedback_uat_skip_verify)
  • Endpoints: ~146 (S22 +3 stable: PATCH /users/{id}/allow-skip-final + PATCH /pe/{id}/budget-adjust + GET /pe/{id}/attachments/{attId}/view)
  • Memory user-level: 23 entries (+2 S25: Plan AC2 FE merge synthetic recovery + Plan AF userMap fallback patterns)
  • Users: 30 demo + 33 active prod (13 cũ + 20 mới S22+2 role-based: act/bod/equ/fin/hra/pm/qs prefix .nv/.pp/.tp + bod.1/2). Password policy ≥12 chars (S22+2 discovery, TestUser@2026)
  • API auth response: accessToken + refreshToken + user (S22+2, NOT token)
  • Master HEAD reference: check via git log -1 --format='%H'
  • 6 skills: contract-workflow · permission-matrix · form-engine · ef-core-migration · dependency-audit-erp · iis-deploy-runbook

🔄 Active workflow schemas (V1 + V2 coexist post-Session 17)

  • V1 Mig 21 flat workflowWorkflowDefinition pin với PE/Contract cũ. Match Dept+PositionLevel.
  • V2 Mig 22-30ApprovalWorkflow pin với PE mới + match ApproverUserId 1-1 OR-of-N cùng Cấp. Steps (Phòng) > Levels (Cấp). PE đã wire V2. Contract V2 PENDING (Plan F drop V1 ABORTED S22+4 — Contract entity HOÀN TOÀN V1 chưa wire V2 + 4 PE V1-only + 19 PE V1+V2 mix).
    • Mig 25 IsUserSelectable (admin pin/unpin per workflow cho user pick)
    • Mig 26 PE Level Opinions UPSERT (service hook khi Duyệt)
    • Mig 28 (S21 t4) 6 Allow* workflow-level — REPLACED by Mig 29
    • Mig 29 (S21 t5) Allow* refactor per-NV: 5 flag on ApprovalWorkflowLevels (F1+F3 per Approver slot) + 1 flag on Users.AllowDrafterSkipToFinal (F2 per Drafter)
    • Mig 30 (S22+5) F4 AllowApproverEditBudget per-Level slot on ApprovalWorkflowLevels — admin Designer tick per slot cho Approver được edit Budget khi review. Pattern reinforced 2× với Mig 29 F1+F3: default = admin opt-in per slot, KHÔNG = mở rộng default. Cross-ref memory feedback_per_nv_permission_scope.md proven cumulative Mig 29 + Mig 30.

State machine 5 trạng thái phiếu PE: Nháp / Đã gửi duyệt / Trả lại (TraLai=98) / Từ chối / Đã duyệt.

Mode Trả lại 4 option per-Level (S21 t4-t5 Mig 28→29):

  • OneLevel = lùi 1 Cấp cùng Step (peer review)
  • OneStep = lùi sang Bước trước Cấp cuối
  • Assignee = pick NV đã ký runtime (PeLevelOpinions)
  • Drafter = Phase=TraLai clear pointer (S17 backward compat default TRUE)

3 mode đầu giữ Phase=ChoDuyet lùi pointer. Mode Drafter giữ Phase=TraLai. Admin bypass level.Allow* flag.


📅 Recent activity (last 10 FIFO)

  • 2026-05-26 (S33 t1 — Plan G-H1 pre-flight NamGroup TblNhanVien audit):* Em spawn task A+B+C audit NAMGROUP.Server\Data\Entities\ ~10K token. Inventory 10 TblNhanVien bảng* (NOT 8 anh main estimate): 1 main TblNhanVien (105 cols!) + 9 satellite (QtCongTac/QtDaoTao/QuanHeThanNhan/KyNangViTinh/KyNangNgoaiNgu/KyNangKhac/QtHopDong/QtCongTacIn/QtPhulucHd). PK long Id (NOT Guid) — port phải convert. Soft delete IsDelete int? OR bool? (legacy inconsistent). Audit fields KHÔNG có ở satellite (chỉ QtCongTacIn có NhanVienTaoId/SuaId/NgayTao/NgaySua) — port phải fill từ BaseEntity. Main TblNhanVien 105 cols PERSONAL HEAVY: identity (CMND/HoChieu/MaSoThue/SoBhxh) + diachi (6 FK Tinh/Quan/Phuong x HKTT/TamTru + freetext fallback) + bank (SoTK/NganHang/ChiNhanh) + physical (ChieuCao/CanNang/NhomMau) + salary (LuongTN/LuongCB/PhepTrongNam/PhepTon/NghiBu/PhepThamNien) + BHXH (NgayThamGia/NoiDkkCb) + political (IsDangVien/IsHcmDoan/IsCongDoan + 3 Ngay*) + theme cols (BgmenuColor/MenuColor — SKIP UX-only) + 4 contact ng liên hệ + 14 FK catalog (DanToc/TonGiao/TinhTrangHonNhan/QuocTich/GioiTinh/TrinhDo/...). Drift discovered s49 Plan C 8 FK DiaChi cascade ADDED Sep 2025 but ZERO populated 1675 NV — entity drift expose. Tip: SOL Mig 34 nên design FK DiaChi NULLABLE + freetext fallback nvarchar(500) cùng tồn tại từ ngày đầu. Satellite simple: QtCongTac (12 cols work history external), QtDaoTao (16 cols + 4 FK catalog), QuanHeThanNhan (8 cols + FK), KyNangViTinh (3 cols MINIMAL — chỉ TenPhanMem string!), KyNangNgoaiNgu (4 cols + FK NgoaiNgu), KyNangKhac (4 cols freetext). Satellite contract HEAVY: QtHopDong (28 cols HĐLĐ — defer Plan H2), QtCongTacIn (16 cols internal position change — defer), QtPhulucHd (10 cols phụ lục HĐ — defer). DbInitializer GLOB NO MATCH — NamGroup KHÔNG seed demo data via DbInitializer pattern. SOL User existing đã có: FullName + DepartmentId + Position + PositionLevel + Email + IsActive. Skip 5 duplicate fields. Patterns proven NEW: (a) Skip-list aggressive cookie-cutter audit — Mig 34 chỉ port 5 satellite defer 4. (b) FK + freetext fallback dual-write pattern từ Plan C drift lesson. (c) MaNhanVien NV/YYYY/NNNN mirror PE CodeGen atomic Serializable. (d) Polymorphic Skill table — gộp 3 KyNang* thành 1 với Kind enum giảm 2 bảng. (e) 30 demo seed pattern reuse mirror SOL DbInitializer existing 30 user 1-1 link User.Id. Surprise: Theme cols BgmenuColor/MenuColor ở entity hồ sơ NS! NamGroup mix UX preference với business data — SOL SKIP, dùng UserPreferences riêng. Token cost ~10K.

  • 2026-05-26 (S33 startup — em main spawn em đầu S33 audit 4 sub-agent MEMORY + RAG hit rate verify): Em spawn 1 lần đầu S33 task A+B song song readonly. Task A audit 4 MEMORY file sizes: Investigator 20.2KB OK / CICD 25.5KB borderline > 25KB triggers curate flag / Reviewer 25.9KB borderline / Implementer 28.6KB OVER triggers curate priority. Cross-agent learnings ≥ 2 agent: (a) Smart Friend pattern 4× cumulative noted BOTH Reviewer (foundation 4 catches S22 #44 + S25 #48 + S29 Plan B ApplicableType + S29 DemoSeed gate) + CICD (Discovery #6 INFRASTRUCTURE vs DEMO seed catch Run #232 Hotfix SeedSampleContractWorkflowV2 out of DemoSeed gate) — pattern strong candidate Layer B promote OR add to docs/rules.md §10 review process. (b) Per-NV admin opt-in flag wire 10-surface-point noted BOTH Implementer Pattern 7 (4 flag cumulative Mig 29-31 + Mig 30 F4) + CICD MEMORY 10-point checklist foundation (line 142-160) + Reviewer Per-NV scope split + RAG memory user-level cross-ref. (c) Pattern 12-bis cross-module entity cookie-cutter mirror PE→Contract noted BOTH Implementer (line 178-200) + Reviewer Cross-module security validation mirror (S29 Plan B). (d) gotcha #48 SQLite tie-break noted BOTH CICD (line 40-45 detail) + Reviewer (Cat 5 lesson catch from CICD pre-deploy). Drift detected: (1) CICD MEMORY line 124-125 cite "Mig 31 latest" but actual repo Mig 33 prod (Plan B Contract V2 Mig 32+33) per Investigator narrative S29 + RAG hit STATUS. CICD recent activity correctly mentions Mig 32+33 deployed Run #232 but baseline header line 124-125 stale. (2) Reviewer line 130 cite "Migrations: 31 latest" but actual 33 — same baseline header stale post-S29 Plan B. (3) Test baseline 111 unchanged ALL 4 agents consistent OK. (4) Endpoints ~146 (Reviewer line 132) vs ~148 (Investigator line 137) — minor 2 endpoint delta drift. Curate recommend next session: PRIORITY Implementer (28.6KB > 25KB hard, archive 2-3 verbose entries q2) + CICD (25.5KB borderline, drop 1 oldest entry 2026-05-12 setup since baseline preserved foundation section) + Reviewer (25.9KB borderline, drop 1 oldest S25 entry duplicated in S25 wrap below). Investigator self OK 20.2KB headroom. Task B RAG verify 3/3 PASS all rerank > 0.7: Q1 Plan G NamGroup port phase 10 top hit HANDOFF.md rerank 0.848 PASS · Q2 gotcha 52 qdrant client search removed top hit investigator MEMORY S32 startup entry rerank 0.910 PASS (also gotcha doc 0.875 + memory user-level feedback_rag_bootstrap 0.863) · Q3 per-NV admin opt-in F1 F2 F3 F4 wire 10 surface points top hit HANDOFF.md S23 t4 rerank 0.684 BELOW 0.7 threshold WARN (semantic match correct, distance score boundary — RAG indexing for narrative cumulative entries reaches diminishing returns at 5+ session reinforcement). Recommendation forward em main S33: (a) Spawn Investigator pre-flight Plan G-H1 NamGroup TblNhanVien* 8 bảng audit per Phase 10.1 kick off plan; (b) Schedule dedicated curate session 3 sub-agents (Implementer priority) before next heavy plan kick off; (c) Update Reviewer + CICD baseline header Mig 31→33 + endpoint ~146→148 in next curate. Token cost spawn này ~10K (4 Read + 3 RAG query + 1 Bash + Edit MEMORY + final report).

  • 2026-05-26 (S32 wrap — em main proxy update final state): Session 32 đóng clean. Em chủ trì spawn em 2 lần S32: (1) startup verify ~10K (afaf6d52a6a59a844 alive) + (2) NamGroup audit pre-flight ~30K (a533c3e8ed4e03bfe hit limit 157K/72 tool_uses fallback em main solo audit). Em main solo audit NamGroup directly thay vì re-spawn: discovered NAMGROUP.Server\Data\Entities có 8+ TblNhanVien* (QtCongTac/QtDaoTao/QuanHeThanNhan/KyNangViTinh) + 4 bảng org chart (SoDoToChuc/SoDoKhoi/ChucDanh/ViTri) + Announcement/InternalDocument/TblMenu. Plan G 11 module port DOCUMENTED migration-todos với 4 quyết định chốt anh main (FULL 11 module + dbo single + Workflow V2 enum +5 + chunk per-module Plan riêng). S33 priority spawn em pre-flight Plan G-H1 Hồ sơ NS audit NamGroup TblNhanVien* 8 bảng + map fields → SOL EmployeeProfile schema (Mig 34 design 1 main + 5 satellite WorkHistory/Education/FamilyRelation/Skill/Document) — scope narrower 30 phút mục tiêu. Curate Plan A3: MEMORY archived 4 verbose entries q2 (S25 t1 5Q audit Bug Changelog + S26 Plan AG 5Q + S26 Plan AI RAG research + Plan B Contract V2 Q1-Q5 audit detail) → 27.7→19KB. Pending tasks anh main S33 SendMessage gọi em: (a) Plan G-H1 pre-flight NamGroup TblNhanVien* audit (PRIORITY HIGH first thing S33); (b) Plan B-Wrap test bundle pre-flight verify ContractWorkflowService ApproveV2Async test scenarios spec D-Bis trong migration-todos; (c) Phase 9 UAT smoke verify V2 contract create flow post-S29 deploy QT-HD-V2-001 workflow. Token cost wrap ~5K. Tag: [wrap, phase-9-to-phase-10, infra].

  • 2026-05-26 (S32 startup — em main proxy verify context + S31 RAG v1.3 baseline awareness): S31 đóng ~1.5h ngày 2026-05-26 với RAG v1.3 baseline PASS recall@5=1.000 (11/11 queries) + avg_rerank=0.847. Root cause S31 fix: AI_INFRA/claude-rag/lib/retrieval.py xài API cũ qdrant.search() đã bị qdrant-client 1.18 xóa → đổi sang query_points().points API mới. Gotcha #52 NEW add vào docs/gotchas.md (Qdrant search removed). Downstream impact: MCP tools mcp__rag-unified__search_memory + mcp__rag-unified__cross_project_search live PASS post-CLI restart — test query "gotcha 52 qdrant search removed" top_k=3 trả 3 chunks rerank scores 0.515 / 0.479 / 0.461 (all dưới threshold 0.7 cao mong đợi vì query về symbol qdrant.search chỉ match doc rag-setup-plan.md historical, KHÔNG match gotcha #52 doc — doc chưa indexed lần re-index gần nhất hoặc chưa ingest gotchas folder). Memory size 25.8 KB ĐÃ VƯỢT curate trigger 25KB — em append entry này + flag em main curate cuối S32 (archive S25 + S26 verbose entries → archive/2026-05-q2.md). Pending tasks anh có thể spawn em qua SendMessage: (a) Plan B-Wrap test bundle BW1-BW7 (regression ApproveV2Async Contract V2 + ApplicableType=3 validate), (b) Phase 9 UAT audit Contract V2 wire prod usage (V1 7 contract + V2 sample QT-HD-V2-001 smoke verify), (c) gotcha #52 doc verify trong RAG index (cross-check docs/gotchas.md đã re-ingest sau S31 fix chưa). State delta S29 → S32: 30 mig → 33 mig (Plan B Contract V2 Mig 32+33 + Plan CA role CatalogManager) · 59 → 60 tables · ~146 → ~148 endpoints · gotcha 47/48 → 52 (+4 #49 Plan B + #50 Plan CA INFRASTRUCTURE seed gate + #51 + #52 Qdrant) · 111 test PASS UNCHANGED (UAT defer test-after) · 23 → 25 memory user-level. Token cost spawn này ~10K.

  • 2026-05-22 (S29 wrap — Plan CA + Plan B pre-flight 2 spawns + 3 patterns NEW): S29 close 2 big plans cumulative. Plan CA (Move Cấu hình danh mục admin → eoffice) 7 commits 06a441c..6eec8d7 push deployed Run #229+#230 PASS. Plan B (Contract V2 wire mirror PE V2 pattern Mig 22-26) 11 commits 58898e8..38f1c4d push deployed Run #231+#232 PASS. Investigator role 2 spawn: (1) Plan CA pre-flight audit (agentId a7ab5576c77ee3730, ~15K token): map 9 menu danh mục terrain + GOTCHA tree-inherit Catalogs↔Master + recommend chunk structure A/B/C/D. fe-user component parity verified (DataTable + PageHeader + PermissionGuard + 6 shadcn ui). DbInitializer SeedAdminPermissionsAsync admin role grant CRUD 27 menu key. Permission Matrix dynamic load /api/menus → tự reflect post-move. (2) Plan B pre-flight audit Contract V1 state (agentId abf91b30391fb0cdb, ~25K token): map Contract.cs 25 fields (V1 only) + ContractPhase enum 12 values (TraLai=98 + TuChoi=99 ready) + ContractWorkflowService.cs 220 LOC V1 only + sqlcmd prod 7 V1 contract (Phase 2-8 active workflow) + PE Mig 22-26 reference templates + impact assessment (COEXIST V1+V2, KHÔNG drop V1) + re-chunk 6 chunks (split A → A1 entity + A2 mig). 3 surprise: ApprovalWorkflows Prod ZERO ApplicableType=3 (Chunk A2 must seed sample) + RejectedAtStepIndex drift deprecated + ContractType 7 variants generic ApplicableType=3. Patterns proven NEW Investigator perspective S29: (a) 9-menu permission terrain map pattern (Plan CA) — Investigator inventory file paths + line ranges + component parity check + recommend chunk before delegate Implementer. ROI cao. (b) V1+V2 coexist boundary (Plan B) — KHÔNG drop V1 vì 7 prod contract pinned. Mirror PE Mig 22-24 spec. (c) Reference template paths cross-module mirror (PE → Contract V2): Investigator cite EXACT line ranges (PE Mig 23:14-31, Mig 24:14-17, Mig 26 UNIQUE composite, Service ApproveV2Async 446-634, 519-546 UPSERT, 774-783 ResolveActor) → em main + Implementer chỉ cần mirror rename entity. ROI rất cao saving 30%+ time. Anti-patterns observed: (a) Investigator KHÔNG verify endpoint exists end-to-end qua live curl — defer to CICD Monitor stage 4. (b) Investigator output sometimes verbose >700 words → em main hỏi cô đọng <500 next time.

  • Archived 4 verbose entries S25-S26-S29 → archive/2026-05-q2.md 2026-05-26 S32 curate: S25 t1 5Q audit Bug Changelog detail + S26 Plan AG 5Q PE List tree view + S26 Plan AI RAG 4 study cases (Cursor/Cline/Continue/Sourcegraph) + Plan B Contract V2 Q1-Q5 audit detail. KEY recommendations preserved in S29 wrap entry above (Plan B re-chunk 6 chunks pattern + ApplicableType=3 ZERO Prod seed flag + PE Mig 22-26 reference template paths).

  • 2026-05-22 (S28 wrap — Layer A governance internalized + tag schema mandatory forward): S28 5-turn arc t1 RAG ROI verdict → t2 over-reach mistake → t4 bro caught → t5 Layer A active. Investigator agent absorb 3 rules forward: (1) Tag schema mandatory every RAG ingest [<type>, phase-<N>, <bc-or-module>] — type ∈ {bug, plan, audit, schema, ui-pattern, decision, retrospective, gotcha-doc}; phase enum 11 (phase-9 UAT current); bc/module 8 domain {contract, pe, budget, master, identity, forms, notifications, audit-log} + 5 cross-cutting {cicd, infra, rag, governance, deploy}. (2) 4-category default + skip list — skip ephemeral state ("S28 t3 startup ngày 22"), pure file paths không context, single-file < 5-line edit confirmation. Investigator output report tags MUST include all 3. (3) NO self-authorize cross-project rule — lesson S28 t4: stay scope-down SOLUTION_ERP self-discipline, don't generalize policy without bro consent. Pre-flight audit query patterns Layer A §6.2 internalized: Pattern A lookup_gotcha_<id> (top_k=3, narrow), Pattern B verify_precedent_pattern_X (top_k=3 thay default 10 — broad similarity rerank surface 3 best matches), Pattern C find_code_symbol_<class.method> (top_k=5, symbol-anchor). Weekly Friday eval ritual: Investigator support Plan B Contract V2 wire pre-flight audit kick-off khi bro launch. Cumulative audit checklist (foundation cicd-monitor MEMORY S22+5→S23 t6 10-surface-point per-NV): (a) Contract entity V1 state inspect Domain/Contracts/Contract.cs + WorkflowDefinitionId, (b) Mig 22-23/26 PE V2 mirror reference confirm pattern reusable, (c) 4 PE V1-only audit migrate gap (per memory S22+4 Plan F ABORT), (d) 7 V1 contract scope drop boundary, (e) verify 10-surface-point per-NV checklist S22+5 cumulative reusable Contract V2 wire trước Mig 32 schema design. source_path convention output: solution_erp/audit/investigator-<topic>-<date> standardized cho tag schema BC=pe or contract switch per task. Lesson abandoned: S28 t2 "ghi RAG mọi tương tác" rule ABANDONED — Investigator KHÔNG mass-ingest, only specific findings with full tag schema. Audit retroactive S20-S26 "Investigator spawn" claims (memory log discrepancy registry NOT loaded vs token cost ghi 28-40K) defer S28+ priority #4 — uncertainty preserve cross-session, không retract memory unverified.

  • 2026-05-22 (S27 wrap-up em main proxy - retrospective Investigator): Investigator pre-flight CRITICAL miss: nếu spawn pre-Plan A.3 (RAG manual control build) → would have catch Qdrant Web UI static missing PRE-em main write rag-dashboard.ps1 link localhost:6333/dashboard. Pattern reinforced: pre-flight infrastructure audit MUST spawn Investigator trước khi em main claim "X work" trong docs. Em main S27 SOLO miss external dependency check (Qdrant Web UI separate repo from binary). Anh pqhuy catch via UAT browser → escalate.

    Audit cumulative S20-S26 memory log entries claiming "Investigator spawn" - re-verify retroactive: Per pitfall confirm spawn investigator agent type NOT FOUND trong session S27, có nghĩa registry chưa bao giờ load trong session này. Nhưng memory log S23 t1 K0 + S25 t1 audit Bug 1+2 + S26 Plan AG audit 5Q + Plan AI RAG research đã ghi "spawn Investigator" với token cost 28-40K. Possibility: (a) Previous sessions có registry load thành công (Claude Code version cũ hơn / file format khác / hot-reload sau /agents UI invoke), hoặc (b) Em main misattribute - actually spawn general-purpose agent default. Cần audit history Claude Code logs để xác minh - ngoài scope S27. For now: trust prior memory entries but FLAG uncertainty cho future investigation.

  • 2026-05-22 (Curate session em main): Archived 10 verbose Recent activity entries S21 → S24 Plan AA → archive/2026-05-q1.md. KEEP: S25 Bug audit + wrap, S26 Plan AG + Plan AI RAG, 2026-05-11 setup. Patterns proven section + Active workflow schemas section preserved. Memory size before: 34.9 KB → after: target ~20-22 KB.

  • 2026-05-19 (S25 wrap — Plan AB Bug 1+2 audit + 6 follow-up plans em main solo): Pre-Plan AB audit ~28K confirm root cause: Bug 1 Budget Adjust Handler ĐÃ log Changelog (Header+Update) nhưng FE HistoryTab filter strict TraLai-only loại. Bug 2 ApplyReturnModeAsync 4 mode KHÔNG add Changelog.Add() — chỉ caller LogTransitionAsync log phase transition. Recommended fix path: BE add log return mode + FE filter relax + Decision badge differentiation. Em main solo từ Plan AC (cross-stack reasoning Implementer would REFUSE). Patterns reusable Contract V2 audit recovery + Budget changelog UI: synthetic recovery FE merge + userMap fallback + drop misleading badges + preventive batch fix systemic gap. CICD result: 7 commits e23f51c..506cada push remote, runs #215 FAIL Plan M tests SQLite tie-break re-emerge → #216-#221 PASS streak. Gotcha #48 SQLite tie-break pending docs.

  • 2026-05-11 (setup): Investigator agent initialized. Baseline knowledge load complete (44 gotchas + 14 memory entries + 6 skills + 27 mig + 81 test pass cumulative). No investigations performed yet. Awaiting first SendMessage from em main.


🔄 Curate trigger

  • Memory size > 25KB → archive recent entries to archive/<period>.md
  • Duplicate entries detected → merge
  • Stale > 3 months → remove

Last curate: 2026-05-26 S32 em main proxy curate (post-S31 RAG fix) — archived 4 verbose entries (S25 t1 5Q audit detail + S26 Plan AG 5Q + S26 Plan AI RAG research + Plan B Contract V2 Q1-Q5 audit detail) → archive/2026-05-q2.md. KEEP: S32 startup (latest), S29 wrap summary, S28 Layer A governance, S27 retrospective, S25 wrap summary, S22 curate session, S11 setup baseline. Patterns + Active workflow schemas foundation preserved untouched. MEMORY size before: 27.7 KB → after: target ~21 KB. Previous curate: 2026-05-22 — archived 10 verbose (S21 → S24 Plan AA) → archive/2026-05-q1.md. Next trigger: > 25KB OR Plan G-H1 kick off.