[CLAUDE] Agents: S39 upgrade multi-agent 4→7 + budget +50% + 5 RAG MCP (BVAAU pattern adapted)
Anh main yêu cầu tăng tốc + chất lượng SOLUTION_ERP: tham khảo BVAAU 7-agent config + budget token +50% + thêm 3 sub-agent. Adapted (NOT copied) — SOLUTION_ERP 2-FE-app fit + giữ 6 skill proven battle-test 38 session. Split 4→7 agent (anh main chốt via AskUserQuestion): - investigator → SPLIT: investigator-codebase (cyan, internal SQL/EF/grep) + investigator-api (blue, external docs/CVE/lib/cross-project) - implementer → SPLIT: implementer-backend (yellow, .NET Domain+App+Infra+Api) + implementer-frontend (orange, FE 2 app cookie-cutter mirror SHA256) [anh chốt backend/frontend thay domain/infra BVAAU — fit 2 React app + giảm gotcha #53 truncate] - test-specialist NEW (purple, dedicated tests/ — anh chốt full test layer) - reviewer (red) + cicd-monitor (green) giữ Tool grant +3 RAG MCP all 7 agent (search_code BM25 + store_memory + list_projects) — BVAAU port, MCP server verified support. Prior chỉ 2 (search_memory + cross_project). Skill re-distribute 6 skill across 7 agent (xem README matrix). Memory: rename investigator→investigator-codebase + implementer→implementer-backend (giữ history) + seed 3 new MEMORY (investigator-api/implementer-frontend/test-specialist) extract relevant patterns. Delete old investigator.md + implementer.md. README rewrite: 7-agent architecture + decision tree split-routing + phân việc matrix boundary + token budget +50% cost reality (~1.05M opt / ~2M heavy ceiling) + anti-truncation rules (gotcha #53 5× mitigation: brief ≤8K + curate pre-spawn + entry ≤1.5K + 529 fallback solo). ⚠️ Anh main RESTART Claude Code CLI để registry hot-reload 7 agent (per S27 lesson model:inherit + new files). Verify post-restart: smoke spawn 3 new agent confirm load. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
165
.claude/agent-memory/investigator-codebase/MEMORY.md
Normal file
165
.claude/agent-memory/investigator-codebase/MEMORY.md
Normal file
@ -0,0 +1,165 @@
|
||||
# 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
|
||||
```bash
|
||||
# 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)
|
||||
- `_Design` — `dotnet 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 workflow** — `WorkflowDefinition` pin với PE/Contract cũ. Match Dept+PositionLevel.
|
||||
- **V2 Mig 22-30** — `ApprovalWorkflow` 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-29 (cross-project — BVAAU 7-agent config extract):** Em đọc full 8 file `D:\Dropbox\CONG_VIEC\BENHVIEN_A_AU\SOURCE_CODDE\.claude\agents\` ~22K. **BVAAU split 4→7 trục research(2)/implement(2)/quality(3)**: investigator-api(blue READ external GetFly/Pancake docs) · investigator-codebase(cyan READ internal+sqlcmd) · implementer-domain(yellow WRITE `Domain/**`+`Application/**` only) · implementer-infra(orange WRITE `Infra/**`+`Api/**`+`Web/**`+`Web.Reports React`) · test-specialist(purple WRITE `tests/**` only NEW) · reviewer(red) · cicd-monitor(green). **Boundary key**: repo *interface*=domain, EF *config*=infra, test assertion=test-specialist (2 implementer KHÔNG viết test). **8-criteria REFUSE** cả 2 implementer (schema/UX/cross-stack>2layer/bug-reasoning/<30min/first-time/spec ambiguity>20%). **Token**: ~1.35M/heavy (~6.5× solo) optimized ~700K; Agent fresh ~150K cache-write / warm ~50K / SendMessage 5-30K/turn / parallel SendMessage ⚠️2.25-3×. **Tool diff CRITICAL**: cả 7 BVAAU agent có 5 RAG MCP (`search_memory+search_code+cross_project_search+store_memory+list_projects`) vs SOLUTION_ERP hiện chỉ 2 (`search_memory+cross_project_search`) → BVAAU +3 (`search_code` BM25 saves Read full file + `store_memory` instant index + `list_projects`). **Skill**: BVAAU `skills:` frontmatter KHÔNG có, total skill=0 (Phase 0 all TBD) — SOLUTION_ERP 6 skill+preload MẠNH HƠN, giữ nguyên khi port. **Curate rule**: >25KB archive `<YYYY-MM>.md`, >50KB hard limit. **Parallel patterns**: A=investigator-api→DTO→(infra+domain parallel)→test→reviewer→cicd; B=4 sync job song song file-disjoint. **Surprises**: (a) VIPIX guide `D:\...\VIPIX_MULTISITE_PROJECT\docs\guides\multi-agent-setup-guide.md` KHÔNG tồn tại (glob toàn project miss) → "16 spawn ~1.49M" claim không verify được, đừng cite. (b) 3 inconsistency BVAAU file: cicd ghi cả `.gitea/` (L25) lẫn `.github/` (L159) workflow path; investigator-codebase MEMORY path `/investigator/` mismatch tên agent; README "Setup checklist" L331 vẫn "4 sub-agent" chưa update 7. (c) BVAAU Phase 0 codebase RỖNG → config aspirational template chưa battle-test (vs SOLUTION_ERP 38 session proven). **Recommend port**: trục split + 8-criteria REFUSE + 5-category reviewer adversarial, GIỮ skill-frontmatter SOLUTION_ERP, ADD 3 RAG tool nếu MCP support. Token cost ~22K. Tag `[cross-project, bvaau-agent-config, port-pattern]`.
|
||||
|
||||
- **2026-05-28 (S37 Plan G-O3 Đề xuất pre-flight 4 task):** Em spawn ~14K. **T1 Enum:** `ApprovalWorkflowApplicableType` ở `ApprovalWorkflow.cs:45-50` Mig 22 add — 3 value 1-based (DuyetNcc=1, DuyetNccPhuongAn=2, Contract=3) NOT 0-based. Mig 37 +1 value Proposal=4 (G-O3 first), reserve 5-8 cho G-O4..O6 future. **T2 PE pattern intel** (mirror skeleton Mig 38): main entity 25 field critical (Id/MaPhieu/Type/Phase 5-state/TenGoiThau/ProjectId/DepartmentId/DrafterUserId + ApprovalWorkflowId pin V2/CurrentStepIndex/CurrentLevelOrder + BudgetId/BudgetManual + RejectedFromPhase legacy + 8 nav list). LevelOpinion UNIQUE per-LEVEL NOT per-User (composite `(PEId, LevelId)`), FK Cascade Pe + Restrict Level, denorm SignedByFullName(200). CodeSequence **1 row per Prefix** (NOT N rows per year): `PE/YYYY/A` + `PE/YYYY/B` riêng, 3 col Prefix PK+LastSeq+UpdatedAt, tx SERIALIZABLE. ApproveV2Async logic 7 step (load eager → group Levels by Order = Cấp OR-of-N → match actor.Id ∈ ApproverUserId + Admin bypass → log Approval + UPSERT LevelOpinion auto sync → F2 skipToFinal check matchingLevel.AllowApproverSkipToFinal advance tới last Step+last Level Phase giữ ChoDuyet → advance normal levelOrder++ trong Step → next Step reset 1 → DaDuyet terminal). **T3 NamGroup Proposal**: 3 entity `TblRequest.cs` (25 cols generic + SoTien decimal + NguoiNhanTien + TaiKhoanNganHang advance payment) + `TblRequestConfig.cs` (CSV ListApproval inline + IsDirectManager) + `TblRequestListApproval.cs` (forward mechanism qua NguoiChuyenTiepId/NgayChuyenTiep + ChapThuanHoanToan int). **Verdict: SOL CLEAN-ROOM MẠNH HƠN** — NamGroup generic Request KHÔNG phân biệt Đề xuất/Yêu cầu/Phép (1 entity cover ALL). SOL dedicated `Proposal` entity + Workflow V2 pin FK > NamGroup inline CSV JSON. **T4 Mig 38 propose 4 bảng**: Proposals (Code `DX/YYYY/NNNN`, Title/Desc/Category nullable FK + free text fallback, AmountEstimate decimal? optional, Status ProposalStatus 5-state mirror PE, DepartmentId/DrafterUserId, ApprovalWorkflowId pin ApplicableType=4 + CurrentStep/Level pointer + SLA) + ProposalAttachments + ProposalLevelOpinions UNIQUE (PropId, LevelId) + ProposalCodeSequences 1 row Prefix `DX/YYYY`. **3 decision points em main chốt**: (1) CategoryId nullable FK + free text fallback (lesson Plan C drift 8 FK ZERO populated 1675 NV). (2) 5-state mirror PE NOT 7-state Contract (Đề xuất đơn giản hơn HĐ). (3) Dedicated `ProposalStatus` enum NOT reuse PurchaseEvaluationPhase (anti-pattern cross-module coupling). **Surprises**: (a) NamGroup TblRequest có `SoTien + NguoiNhanTien + TaiKhoanNganHang` advance payment — SOL có cần? Defer Mig 39 optional. (b) F1+F3+F4+F2 per-Level pattern Mig 29-31 — Proposal có nên mirror? Option B "đơn giản KHÔNG flag" tiết kiệm 3 chunk admin Designer. (c) **Recommend gộp Mig 37+38 → 1 Mig** `AddProposalsAndExtendApplicableType` (mirror Mig 20 Contract N-stage gộp). Token cost ~14K.
|
||||
|
||||
- **2026-05-28 (S36 Plan G-O2 pre-flight Phòng họp 3 task):** Em spawn ~10K. **T1 NamGroup `TblResource` + `TblBookingResource`** (`NAMGROUP.Server\Data\Entities\TblPhongHop.cs` 5-47): 2 entity LEGACY V1 reuse, KHÔNG dedicated MeetingRoom. TblResource 11 cols generic (Id long, GroupReSourceID, NameReSource, ListManager CSV NhanVienID, ListViewer CSV, Note, IsDelete int?). TblBookingResource 18 cols (ResourceID, Title, FromDate datetime giờ-phút, ToDate, ThanhPhan plain text NOT CSV, TrangThai int? -1=Rej/0=Pending/1=Approved/2=Cancelled, IsDelete int? NULL=active+1=deleted ZERO `=0` rows, Note1 admin secondary, AcceptUser/AcceptDate/RejectUser/RejectDate). **5 gotcha NamGroup**: (1) IsDelete filter `(IsDelete ?? 0) != 1` NOT `== 0`, (2) TrangThai 4-state NO Completed, (3) ThanhPhan plain text NOT CSV NV ID, (4) Note1 admin only, (5) V1 ZERO overlap protection (37 overlap pairs prod 798 rows). Repo `PhongHopRepository.cs:61-75` overlap app-level: `b.FromDate < toDate AND b.ToDate > fromDate AND TrangThai NOT IN (-1, 2)`. CSV ListManager → manager approve. **Conclusion: SOL Mig 36 CLEAN-ROOM** mirror G-H2 verdict — KHÔNG port reason: (a) TblResource mix 4 group catalog generic, (b) ThanhPhan plain text yếu cho notification, (c) ZERO overlap V1 → SOL phải DB-level SERIALIZABLE tx. **T2 FullCalendar v6 React** (https://fullcalendar.io/docs/react): `@fullcalendar/react` MIT cho core + 3 plugin daygrid/timegrid/interaction. Premium chỉ Resource Timeline + Vertical Resource (NOT cần Plan G-O2). Drag-resize event = MIT `@fullcalendar/interaction`. Bundle ~150-200KB gz (bundlephobia 403). **Alternative**: NamGroup `PhongHopPage.tsx:10-12` S50 hotfix CHỐT custom day-grid HTML NO lib install reason "saves install friction + bundle minimal" — 1 file ~600 LOC month-view custom grid 5-6 rows × 7 cols Sun-Sat. `react-big-calendar` MIT clean alternative nhưng semi-deprecated. **T3 Schema Mig 36 propose 3 entity** (KHÔNG 2): `MeetingRoom` (Id Guid, Code unique nvarchar(20), Name nvarchar(200), Capacity int, Location nvarchar(200), Equipment nvarchar(500)?, IsActive bit, IsDeleted, audit) + `MeetingBooking` (Id, RoomId FK Restrict, BookedByUserId FK Restrict, StartAt datetime2, EndAt datetime2, Title nvarchar(200), Description nvarchar(1000)?, Status enum int Confirmed=1/Cancelled=2/Completed=3, Note nvarchar(500)?, audit) + **`MeetingBookingAttendees` join** (BookingId FK Cascade, UserId FK Restrict, PK composite (BookingId, UserId), Notes nvarchar(200)?). **Attendees mode JOIN TABLE** (NOT JSON) reason: (a) notification push query indexed efficient, (b) FE picker multi-select shadcn reuse Users API, (c) audit "ai từ chối" future ready. **Overlap check** SERIALIZABLE tx + `EXISTS WHERE RoomId=@r AND Status=1 AND StartAt < @newEnd AND EndAt > @newStart AND Id != @currentId` → 409 Conflict. **Recommend index** `IX_MeetingBookings_RoomId_StartAt` composite range query. **Surprises**: (a) NamGroup s47 Plan 9.2 V1 reuse dựa 798 row prod data NOT scratch — SOL có lợi thế clean-room không legacy. (b) NamGroup community ưu tiên bundle size hơn dev velocity (custom HTML grid thay FullCalendar) — em main weigh trade-off ~150KB cost vs drag-drop UX. (c) `TblBookingResource` NO Title index — SOL must add IX. **Recommend forward**: (1) Mig 36 design 3 entity clean-room per propose; (2) FullCalendar v6 MIT fe-admin (manager view drag-drop) + custom day-grid HTML fe-user (book simple) — split UX 2 app per convention; (3) Skill `ef-core-migration` attach Implementer. Token cost ~10K.
|
||||
|
||||
- **2026-05-28 (S36 startup audit — 3 task readonly factual report):** Em spawn 1 lần ~12K token. **Task 1 — MEMORY size 4 sub-agent:** path actual project-level `D:\Dropbox\CONG_VIEC\SOLUTION\SOLUTION_ERP\.claude\agent-memory\{agent}\MEMORY.md` (em main provide path user-level `C:\Users\pqhuy\.claude\projects\...\agents\` KHÔNG tồn tại — em correct path). Investigator 24.7KB/157 lines borderline · Implementer **36.4KB/419 lines PRIORITY curate** · Reviewer 28.4KB/181 lines borderline · CICD **40.4KB/213 lines PRIORITY curate**. Drift +12-15KB ALL 4 agent từ S33 startup baseline (cicd 25.5→40.4, implementer 28.6→36.4, reviewer 25.9→28.4, investigator 20.2→24.7) — heavy S33+S34+S35 entries chưa archive. **Task 2 — Audit định kỳ status:** `docs/changelog/skill-audit-2026-05.md` 6.2KB manual 2026-05-04 + `skill-audit-2026-05-late.md` 9.1KB early-trigger 2026-05-22 (drift +8 gotcha 41→49). Next scheduled 2026-06-01 (CLAUDE.md:60 confirm). Today 2026-05-28 còn **4 ngày → SKIP audit lần này**. Cron `solution-erp-skill-audit-monthly` fire 9:00 AM ngày 1. **Task 3 — Plan G-* progress map 10 atomic (NOT 11 — Cấu hình + Hồ sơ NS gộp Phase 10.1):** ✅ G-H1 S33 (commit 5400983..79a8343 Run #237 PASS, 67 tables Mig 34) + ✅ G-H2 S34+S35 (commit 07b3f3b schema + 909655c BE + 021674a FE Run #244 PASS Mig 35). ⏳ 8 pending: G-O1 Danh bạ (1 endpoint nhẹ nhất) · G-O2 Phòng họp Mig 36 FullCalendar · G-O3-O6 Workflow Apps cần extend `ApplicableType` enum +5 (Mig 37 first cookie-cutter Mig 22) · G-H3 Dashboard NS · G-P1 Chấm công GPS web Mig 42. **NO DRIFT** giữa `feedback_phase10_namgroup_port.md` (4 quyết định) vs `migration-todos.md:637-792` (Phase 10 backlog). **Recommendation forward S36:** (a) Curate session PRIORITY cicd-monitor (40.4KB) + implementer (36.4KB) trước kick off Plan G-O1; (b) Reviewer 28.4KB defer S37 nếu không kịp; (c) Plan G-O1 phù hợp S36 sau curate (1 endpoint + 1 FE page). **Surprise:** Em main note "G-O1 Danh bạ S34 done" trong instruction — DRIFT thực tế. Migration-todos:696-700 G-O1 vẫn ⏳ pending. Anh main confuse với G-H1 S33 + G-H2 S34/35. Token cost ~12K.
|
||||
|
||||
- **2026-05-28 (S35 — Plan G-H2 Task 3+4 pre-flight HRM CRUD audit):** Em spawn 1 lần ~8K token. **Task 1 — Plan CA Chunk B precedent:** SHA `06a441c` "FE move 4 master pages 948 LOC byte-identical". 4 catalog page mirror `fe-admin/master/{Suppliers,Projects,Departments,Catalogs}Page.tsx` → `fe-user/`. LOC actual: Catalogs=321 / Departments=160 / Projects=214 / Suppliers=253 = **948 LOC tổng**. Pattern = single file inline list + create/edit dialog (NO split route /new). DataTable + PageHeader + PermissionGuard + 6 shadcn UI. **Task 2 — NamGroup HRM ref MISS:** Glob `*Phep* *TimeOff* *NgayLe* *Ca* *Ot*` → KHÔNG có entity dedicated. NamGroup chỉ có `TblTimeOffConfig.cs` 14 cols generic + `TblTimeOff.cs` 47 cols (request, Ngay1-10 + TypeNgay1-10 hardcoded over-engineered) + `TblDmChung.cs` 10 cols generic bucket. **SOL Mig 35 entity design MẠNH HƠN:** LeaveType có IsPaid + RequiresAttachment + DaysPerYear decimal(5,2) (NamGroup miss). Holiday composite UNIQUE Year+Date + IsRecurring (NamGroup không có). ShiftPattern WorkDays comma string + TimeOnly Start/End + BreakMinutes (NamGroup không có). OtPolicy 3-tier multiplier weekday/weekend/holiday + 3 cap day/month/year Luật LĐ VN (NamGroup không có). **Kết luận: KHÔNG cần port field từ NamGroup. SOL clean-room design mạnh hơn.** Workflow integration: NamGroup TimeOffConfig embed `ListApproval` JSON inline; SOL sẽ dùng ApprovalWorkflow V2 pattern khi G-O4 LeaveRequest land. **Task 3 — SOL Master pattern:** ProjectFeatures.cs 150 LOC + DepartmentFeatures.cs 128 LOC + CatalogsFeatures.cs **334 LOC** (4 sub-entity Units/Materials/Services/WorkItems gộp 1 file mega). Controller layout: `CatalogsController.cs` 1 controller cho 4 sub-entity. **Pattern Suppliers split** (Suppliers/Dtos/Queries/Commands subdir) = legacy heavyweight scale, KHÔNG nên mirror cho HRM. **Pattern Catalogs single-file mega** = đúng cho HRM (4 simple catalog tương đương Units/Materials/Services/WorkItems). LOC estimate G-H2 Task 4 FE: LeaveTypesPage 200 + HolidaysPage 250 (Year filter + bulk roll-over) + ShiftPatternsPage 250 (WorkDays multi-select + TimeOnly picker) + OtPoliciesPage 220 (1 STANDARD constraint UI) ≈ **920 LOC** ~ Plan CA Chunk B 948 LOC parity. **Recommendation: Option B 1 mega `HrmConfigFeatures.cs` ≈ 600-700 LOC** mirror Pattern 12-bis Catalogs. Reason: (1) 4 simple catalog cùng module HRM lifecycle parallel. (2) Pattern 12-bis cross-module entity cookie-cutter proven 2× (Plan CA Catalogs + Plan B Contract V2). (3) 1 controller `HrmConfigsController.cs` route `/api/hrm/configs/{kind}` mirror `/api/catalogs/{kind}`. (4) Constraints differ (Holiday composite + OtPolicy 1 STANDARD active) handle qua per-handler validation. **Surprise:** EF Configuration files riêng `LeaveTypeConfiguration.cs` + 3 file khác EXIST — KHÔNG cần mirror Application Features file split (Config riêng OK + Features mega OK). Cross-stack KHÔNG conflict. Token cost ~8K.
|
||||
|
||||
- **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).
|
||||
|
||||
- **Archived to `archive/2026-05-q3.md` 2026-05-27 S34 curate (em main proxy):** S28 wrap Layer A governance internalized (3 rules + tag schema mandatory + 4-category default + NO self-authorize cross-project — absorbed forward into agent output discipline) + S27 wrap-up retrospective (pre-flight infrastructure audit must spawn Investigator lesson + S20-S26 spawn audit uncertainty flag) + 2026-05-22 curate session note + S25 wrap Bug 1+2 audit + 2026-05-11 setup baseline. KEY pattern absorbed forward: pre-flight infrastructure audit MUST spawn Investigator + scope-down SOLUTION_ERP self-discipline + tag schema `[type, phase, bc-or-module]` mandatory output.
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Curate trigger
|
||||
|
||||
- Memory size > 25KB → archive recent entries to `archive/<period>.md`
|
||||
- Duplicate entries detected → merge
|
||||
- Stale > 3 months → remove
|
||||
|
||||
**Last curate: 2026-05-27 S34 em main proxy curate** (post-S33 wrap, sequence 1/4) — archived 4 verbose entries (S27 wrap retrospective + 2026-05-22 curate session + S25 wrap + S11 setup) → `archive/2026-05-q3.md`. KEEP: S33 t1 Plan G-H1 pre-flight NamGroup audit (latest 10 bảng inventory + 4 decision schema), S33 startup audit (4 MEMORY size + RAG hit verify), S32 wrap (Plan G 11 module backlog), S32 startup (S31 RAG awareness), S29 wrap (2 spawn Plan CA + Plan B pre-flight + 3 patterns NEW), S28 wrap (Layer A governance). Patterns + Active workflow schemas foundation preserved untouched. MEMORY size before: 26 KB → after: target ~20-22 KB. **Previous curate: 2026-05-26 S32** — 4 verbose entries → `archive/2026-05-q2.md`. **Previous curate: 2026-05-22** — 10 verbose S21→S24 → `archive/2026-05-q1.md`. Next trigger: > 25KB OR Plan G-O1 Danh bạ kick off.
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
# Investigator Agent — Archive Recent Activity Q1 2026-05 (S21-S24)
|
||||
|
||||
> **Archived:** 2026-05-22 by em main SOLUTION_ERP curate session.
|
||||
> **Scope:** Recent activity FIFO entries S21 → S24 Plan AA (10 verbose entries) — moved from MEMORY.md để giữ slim < 25KB threshold.
|
||||
> **Rule §6.5 compliance:** KHÔNG cắt narrative — full verbose entries preserved cho cross-session audit.
|
||||
> **Source MEMORY.md before archive:** 34.9 KB.
|
||||
> **KEEP in MEMORY:** S26 Plan AG + Plan AI RAG (2 spawn), S25 Bug audit + wrap, 2026-05-11 setup baseline. Patterns proven section preserved.
|
||||
|
||||
---
|
||||
|
||||
## Archive entries (FIFO chronological — earliest first)
|
||||
|
||||
### 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.
|
||||
|
||||
### 2026-05-13 (S21 t3-t5, no spawn)
|
||||
|
||||
Em main solo 3 turns (bug fix gotcha #45 + F1+F2+F3 workflow-level Mig 28 + refactor per-NV Mig 29). Implementer REFUSE per cross-stack reasoning chain rule. Investigator KHÔNG spawn — em main đã có context cumulative S20 t12 setup + active dev throughout. No findings to flush. Cumulative state update: 84 test, 29 mig, 45 gotcha, 19 memory entries (+2 S21 t5 pending), 6 skills unchanged. Pattern reusable saved cho future spawn: per-NV permission scope split + EF migration ADD→BACKFILL→DROP reorder.
|
||||
|
||||
### 2026-05-13 (S22, no spawn — em main solo throughout)
|
||||
|
||||
S22 18:00→~21:00 em main solo. Cumulative state: 30 mig (+1 Mig 30 `AddAllowApproverEditBudgetToLevels` F4 per-Level slot), 104 test PASS (+20: 5 reg #44 Authorize policy + 7 ReturnMode + 7 Guard + 1 V2 actor scope reject), ~146 endpoints (+3: PATCH /users/{id}/allow-skip-final + PATCH /pe/{id}/budget-adjust + GET /pe/{id}/attachments/{attId}/view), 46 gotcha unchanged, 19 memory unchanged (recommend +1 entry — see below). Prod active users 13→33 (+20 role-based: act.nv/pp/tp, bod.1/2, equ/fin/hra/pm/qs.nv/pp/tp).
|
||||
|
||||
**Discoveries S22:**
|
||||
1. **Per-NV admin opt-in flag pattern reinforced 2×** — Mig 30 F4 cùng pattern Mig 29 F1+F3 (S21 t5). Bro corrected em main lần đầu: "phải tick checkbox như Section 2", default = admin opt-in per slot, KHÔNG = mở rộng default. Cross-ref memory `feedback_per_nv_permission_scope.md` proven 2×.
|
||||
2. **Plan F drop V1 ABORTED** — pre-flight sqlcmd reveal Contract entity HOÀN TOÀN V1 chưa wire V2 (chưa có ApprovalWorkflowId column) + 4 PE V1-only + 19 PE V1+V2 mix. Lesson: drop migration cần verify entity scope toàn bộ (Contract liên đới — không chỉ PE).
|
||||
3. **Identity password policy ≥12 chars** — seed 20 user FAIL 400 với "User@123456" (11 chars), `TestUser@2026` (13 chars) pass.
|
||||
4. **Identity rename atomic 4 fields** confirm gotcha #38: Email + NormalizedEmail + UserName + NormalizedUserName + FullName; sqlcmd cần `SET QUOTED_IDENTIFIER ON` cho filtered unique index.
|
||||
5. **API login response field name `accessToken` + `refreshToken` + `user`** — KHÔNG có field `token` (correct prior Bash example trong spec dùng `.token` sẽ fail).
|
||||
6. **PS 5.1 ASCII-only script discipline** reinforced gotcha #30: `seed-test-users-prod.ps1` viết Vietnamese names without diacritics tránh parser error. Recommend bro add 1 memory entry "Admin opt-in flag pattern proven 2×" cumulative Mig 29 + Mig 30.
|
||||
|
||||
### 2026-05-14 (S23 t1 spawn K0 — Plan K F2 refactor pre-flight)
|
||||
|
||||
Audit F2 state cho Plan K Mig 31 (move `Users.AllowDrafterSkipToFinal` → `ApprovalWorkflowLevels.AllowApproverSkipToFinal` + change semantic Drafter Nháp → Approver ChoDuyet skip thẳng Cấp cuối). **Confirmed state Mig 30:** Migrations path = `Persistence/Migrations/` (not direct `Migrations`); 30 mig latest = `20260513160703_AddAllowApproverEditBudgetToLevels`; `User.cs:38` AllowDrafterSkipToFinal prop; `ApprovalWorkflow.cs:86-105` 6 Allow* props (4 ReturnMode + EditDetails + EditBudget) per Level slot; F2 Drafter branch ở `PurchaseEvaluationWorkflowService.cs:119-161` trong SUBMIT branch (line 125 `if (skipToFinal && evaluation.ApprovalWorkflowId is Guid skipAwId)` check user.AllowDrafterSkipToFinal); APPROVE STEP branch ở `~line 393-525` (advance pointer). TransitionAsync signature: `skipToFinal` là param thứ 8 (position 47:47), default=false. `TransitionPurchaseEvaluationCommand` ở `PurchaseEvaluationFeatures.cs:393-402` với param `SkipToFinal=false` default. `ApprovalWorkflowOptionsDto` ở `PurchaseEvaluationDtos.cs:86-92` (6 field). `PurchaseEvaluationDetailBundleDto.DrafterAllowSkipToFinal` ở line 217 + `CurrentLevelOptions` ở line 214. UsersController `PATCH /users/{id}/allow-skip-final` ở line 91-98 + `SetAllowDrafterSkipToFinalBody` ở line 105. `SetUserAllowDrafterSkipToFinalCommand` ở `UserFeatures.cs:332`. **FE state:** fe-admin Designer `system/ApprovalWorkflowsV2Page.tsx` slot label "NV #{ei + 1}" ở line 873 (KHÔNG phải "#NV {order}" theo prompt) — inline checkbox panel 5+1=6 checkbox ở line 853-933 (4 ReturnMode + EditDetails + EditBudget). fe-admin `system/UsersPage.tsx` "Skip cuối" column line 306-318 + FastForward button toggle line 365-372 + allowSkipMut hook line 181-186. fe-admin/fe-user PeDetailTabs Drafter Workspace checkbox "Gửi thẳng Cấp cuối (skip trung gian)" ở line 287-297 (admin) / 294-304 (user). **GAP fe-user**: KHÔNG có UsersPage + ApprovalWorkflowsV2Page (admin-only mgmt) → Plan K UI changes localized fe-admin chỉ; fe-user side chỉ touch PeDetailTabs (remove old Drafter checkbox + thêm Approver toggle near Duyệt button). **Drift Dev DB**: Total=2 user (admin + test.drafter), Flagged=0 — NOT match 33-user prod seed. **Prod actual**: Total=33 / Flagged=4 (NOT 2 per S22+2 spec). 4 user flagged sẽ lose value when DROP column — acceptable per new semantic (Drafter pre-submit moot).
|
||||
|
||||
### 2026-05-15 (S23 t2 spawn L2 — F3+F4 edit menu Duyệt audit)
|
||||
|
||||
Bug UAT prod 409a967: admin tick F3+F4 cho slot Approver, login actor user, vào menu "Duyệt" (`?pendingMe=1` cùng `PurchaseEvaluationsListPage` 3-panel), click PE Phase=ChoDuyet → Section 2 Hạng mục/NCC/Báo giá + Section 5 Điều chỉnh ngân sách vẫn read-only. **Root cause F3 = OK / F4 = BROKEN at readOnly short-circuit:** F3 wire ĐÚNG (`PeDetailTabs.tsx:118 itemsReadOnly = readOnly && !approverEditMode` override readOnly per Mig 28 S21 t4 → ItemsTab read prop OK). F4 wire SAI (`PeDetailTabs.tsx:245` passes `readOnly={readOnly}` (=true từ menu Duyệt) xuống BudgetAdjustSection, line 973 compute `canAdjust = !readOnly && (isAdmin || (isDrafter && isDrafterPhase) || isApproverChoDuyet)` — `!readOnly` short-circuits to false BEFORE F4 isApproverChoDuyet evaluate. Edit pencil button hidden line 1030 `{canAdjust && <Button>Điều chỉnh</Button>}`. Asymmetric vs F3 pattern Section 2 (PeDetailTabs.tsx:113-118). **Evidence:** FE F3 OK `fe-user/src/components/pe/PeDetailTabs.tsx:113-118` + `:224 ItemsTab ev={evaluation} readOnly={itemsReadOnly}`; FE F4 BUG `:957-973 BudgetAdjustSection !readOnly gate` + `:245 readOnly={readOnly}`; menu Duyệt route `fe-user/src/pages/pe/PurchaseEvaluationsListPage.tsx:256-261 PeDetailTabs readOnly={true}` (cùng route Danh sách); BE GetPe `PurchaseEvaluationFeatures.cs:735-770 currentLevelOptions populate 7 fields` OK; BE budget-adjust handler `:281-329` Phase ChoDuyet F4 branch + actor match + flag check ĐẦY ĐỦ + return ConflictException nếu Allow=false; BE PurchaseEvaluationDraftGuard.EnsureEditableForDetailsAsync ở `PurchaseEvaluationDetailFeatures.cs:42` (8 callsites Detail+Supplier handlers). **Recommendation:** Fix `BudgetAdjustSection` line 973 mirror approverEditMode pattern Section 2: thay `canAdjust = !readOnly && (isAdmin || ...)` thành `canAdjust = isAdmin || (!readOnly && isDrafter && isDrafterPhase) || isApproverChoDuyet` — Approver bypass readOnly khi F4 conditions met. **LOC ~3-5 LOC 1 file.** Surprise: Inbox `/inbox` route (InboxPage.tsx) navigate sang `/purchase-evaluations/:id` (mobile DetailPage route, default readOnly=false) — chỉ Danh sách `?pendingMe=1` desktop 3-panel mới hard readOnly=true.
|
||||
|
||||
### 2026-05-15 (S23 t2 spawn M0 — Plan M F1+F2+F3+F4 ChoDuyet semantic audit)
|
||||
|
||||
Bro UAT post-Plan L deploy 2026-05-15 ~02:00: "Hiện logic cũ là khi trả lại 1 cấp hoặc chỉ định hoặc edit là trạng thái draft -> cái này thay đổi lại nhé, các tính năng duyệt thẳng, trả lại 1 cấp hoặc người chỉ định hoặc cho edit thì cho xử lý đc ở trạng thái đang gửi duyệt luôn." Audit 4 BE file + 4 FE file × 2 app cho F1+F2+F3+F4 phase semantic ChoDuyet preservation. **Verdict: CODE ĐÃ ĐÚNG semantic mới — đây là DISCONNECT bro mental model vs code reality post-Mig 28/29/30/31.** Evidence per feature: **F1.OneLevel** `PurchaseEvaluationWorkflowService.cs:285-312` SWITCH branch lùi 1 Cấp cùng Step (`curLevel-1`) ELSE lùi Step trước Cấp cuối; **Phase KHÔNG đổi** (giữ ChoDuyet, line 364 reset SLA only); fallback Drafter `:303-310` CHỈ KHI đang Bước 1 Cấp 1 no further back (clear pointer + Phase=TraLai). **F1.Assignee** `:335-360` foreach Steps find ApproverUserId match → set pointer; Phase giữ ChoDuyet; ConflictException nếu không tìm thấy NV trong workflow. **F1.OneStep** `:314-333` lùi prev Step Cấp max; Phase giữ ChoDuyet; fallback Drafter nếu đang Bước 1. **F1.Drafter** `:268-275` SET `Phase=TraLai=98` + clear cả 2 pointer + SLA null — đây là CASE DUY NHẤT về "draft". **F2 skipToFinal** `:483-524` Plan K L1 ĐÃ FIX advance pointer tới Bước cuối Cấp cuối (max), **Phase giữ ChoDuyet** (NV cuối duyệt thật để DaDuyet); guard line 485 ConflictException non-admin + flag off; opinion UPSERT trước line 441-468 ensure actor's signature lưu trước. **F3 EnsureEditableForDetailsAsync** `PurchaseEvaluationDetailFeatures.cs:42-99` 2 trường hợp accepted: Drafter scope (DangSoanThao/TraLai return pe sớm line 49-51) **OR Approver scope ChoDuyet line 54-94** (V2 schema + actor match level.ApproverUserId + level.AllowApproverEditDetails flag). **F4 AdjustPurchaseEvaluationBudgetCommandHandler** `PurchaseEvaluationFeatures.cs:272-329` Drafter scope `:283-290` (DangSoanThao/TraLai + isDrafter) ELSE Approver scope ChoDuyet `:291-323` (V2 + pointer init + actor match + level.AllowApproverEditBudget flag) — Phase ChoDuyet đã handle full. **Validation Allow* flag location** `PurchaseEvaluationWorkflowService.cs:252-265` ApplyReturnModeAsync gate per slot per mode: throw ConflictException nếu disabled (Admin bypass line 252). **FE PeWorkflowPanel.tsx**: TraLai dialog `:331-422` 4 radio button (OneLevel/OneStep/Assignee/Drafter) gated bằng `levelOptions?.allowReturnXxx` flag per current Approver Cấp (line 343-396); useEffect `:60-68` S23 t2 fix default first available mode KHÔNG Drafter khi admin tick F1 modes. Skip Final checkbox `:425-442` chỉ visible khi `levelOptions?.allowApproverSkipToFinal` + Approve forward direction (line 425). **FE PeDetailTabs.tsx F3+F4 wire**: `itemsReadOnly = readOnly && !approverEditMode` line 118 bypass readOnly khi F3 enabled (Mig 28 pattern); `canAdjust = isAdmin || (!readOnly && isDrafter && isDrafterPhase) || isApproverChoDuyet` line 977 bypass readOnly khi F4 enabled (L2 fix). Mirror fe-admin/fe-user line 109-115 + 967-979 ĐỒNG BỘ rule §3.9. **Surprise**: "Trả lại" trong UI memory docs đôi khi gọi "draft" colloquial — bro confuse 2 khái niệm `Phase=TraLai=98` (Drafter sửa rồi gửi LẠI từ Step 0) vs `Phase=DangSoanThao=1` (chưa từng gửi duyệt). KHÔNG code path nào trong F1 OneLevel/OneStep/Assignee/F2/F3/F4 set targetPhase=DangSoanThao mà không nên. **Recommendation: LOW effort** (0-20 LOC): chỉ cần communication clarification em main confirm với bro 4 mode F1 + F2 + F3 + F4 đã giữ Phase=ChoDuyet trừ F1.Drafter; mở DB SELECT phiếu UAT confirm `Phase` column number sau click test; OPTIONAL touch up FE label nếu user thấy "Đã gửi duyệt" nhầm "Bản nháp". KHÔNG cần Service refactor hay handler change. Nếu bro thấy phiếu cụ thể về Phase=1 SAU click F1.OneLevel hoặc F2 → spawn lại Investigator audit DB state + log Changelog cho phiếu đó cụ thể (data debug, not code bug).
|
||||
|
||||
### 2026-05-15 (S23 t3 spawn — UAT bug Allow* flags không hiện cho actor non-row1)
|
||||
|
||||
Bro UAT login `nv.test@solutions.com.vn` vào menu eoffice "Duyệt NCC → Duyệt" phiếu PE/2026/A/026 (Phase=ChoDuyet, WF=QT-DN-V2-001 v12, ở Bước 2 Cấp 1 4 NV: Trần Xuân Lưu/NV Test UAT V2/Hồ Thị Nữ Nguyên/Lê Văn Bính). Admin ĐÃ tick 7 Allow*=TRUE riêng cho slot NV Test UAT V2. Nhưng FE dialog Duyệt KHÔNG hiện checkbox SkipToFinal + Trả lại 4 mode + Edit. **Verdict: HYPOTHESIS B — BE handler picks wrong slot row.** Evidence: (1) `PurchaseEvaluationFeatures.cs:765` `var curLevel = curStep?.Levels.FirstOrDefault(l => l.Order == curLevelOrder);` — match FIRST row có `Level.Order == curLevelOrder`, NOT actor's row. Post-Mig 29 refactor, Level.Order trùng nhau cho mọi NV cùng Cấp (4 row có `Order=1` ở Step 2). EF returns Trần Xuân Lưu trước (PK order) → `FirstOrDefault` lấy row đó (all-false except Drafter=true). (2) API curl admin token + nv.test token return CÙNG `currentLevelOptions={ allowReturnOneLevel=false, OneStep=false, Assignee=false, Drafter=true, EditDetails=false, EditBudget=false, SkipToFinal=false }` — handler currentUser-agnostic confirm. (3) Workflow detail GET `/approval-workflows-v2?applicableType=1` `.types[0].active.steps[1].levels` enumerate 4 slot Bước 2 Cấp 1: NV Test (UAT V2) = ALL 7 TRUE; 3 NV còn lại = ALL FALSE (trừ Drafter=true mặc định). Admin Designer wire ĐÚNG (`fe-admin/src/pages/system/ApprovalWorkflowsV2Page.tsx:889-946` 7 checkbox per-slot). FE consumer wire ĐÚNG (`fe-user/src/components/pe/PeWorkflowPanel.tsx:51 levelOptions = evaluation.currentLevelOptions` + line 343/357/371/397 conditional render mode picker + line 425 SkipToFinal checkbox). **Root cause:** BE line 765 lookup semantic broken sau Mig 29 (S21 t5). Trước Mig 29, 1 Level row per Cấp + `ApproverUsers` join table → `FirstOrDefault(Order==X)` đúng. Sau Mig 29 split 1 Level row PER ApproverUser → `Order` field collide → cần match thêm `ApproverUserId == currentUser.UserId`. **Fix BE 1 dòng:** `var curLevel = curStep?.Levels.FirstOrDefault(l => l.Order == curLevelOrder && l.ApproverUserId == currentUser.UserId);` (admin bypass: fallback `?? curStep?.Levels.FirstOrDefault(l => l.Order == curLevelOrder)` để admin xem detail không lỗi). Edge case: Phase=DaDuyet/TraLai/TuChoi pointer null → existing guard line 760-762 skip block OK. **LOC ~2-3 LOC 1 file.** Surprise: bug PRESENT từ deploy Mig 29 (S21 t5 2026-05-13) — không phải regression S23. Lý do trước đây không bắt: UAT test users (default 13 cũ) đa số là row đầu của slot Cấp (Admin tick toàn FALSE → behavior giống nhau, không lộ); chỉ bộc lộ khi admin tick CHỌN LỌC per-NV (UAT V2 S22+2 thêm 20 user role-based + bro tick chỉ NV Test UAT V2). Cross-reference memory `feedback_per_nv_permission_scope.md` cumulative S21 t5 → S22+5 → S23 t1 — KHÔNG có entry nào nhắc bug lookup BE post-refactor.
|
||||
|
||||
### 2026-05-15 (S23 t6 spawn Plan P FE wire audit — confirm BE-only scope)
|
||||
|
||||
Em main hypothesize Plan P scope BE Controller body record drop. Investigator audit FE × 2 confirm: `PeWorkflowPanel.tsx:113-124` `api.post(/transitions, body)` SEND ĐÚNG 7 fields (TargetPhase + Decision + Comment + ReturnMode + ReturnTargetUserId + SkipToFinal). No service file (untyped object literal). BE `PurchaseEvaluationsController.cs:267` `TransitionPeBody` record CHỈ 3 fields → ASP.NET silent DROP 3 missing fields. Verdict: Plan P BE Controller ONLY ~6 LOC + no test (Mig 28/31 Domain test cover handler). Saved em main blind fix cross-stack.
|
||||
|
||||
### 2026-05-15 (S23 t8 spawn Plan R pre-flight cleanup audit)
|
||||
|
||||
Bro chốt cleanup destructive prod. 4 sqlcmd queries audit: 35 PE total (28 active + 7 soft) + 17 V2 (15 IsUserSelectable=false + 2 ghim) + 4 V1 (2 active + 2 inactive). FK gotcha catch: PE.ApprovalWorkflowId Restrict + ApprovalWorkflow extends `BaseEntity` NO soft-delete → hard-DELETE required; LevelOpinion → ApprovalWorkflowLevel Restrict cascade block. SQL Express limit: NO COMPRESSION + RESTORE VERIFYONLY require sysadmin. Filtered indexes (Mig 29+) require `SET QUOTED_IDENTIFIER ON`. Cascade child estimate: 446 PE children + ~140 V2 + ~37 V1 = ~620 rows. 3 Option compare → bro chốt A (Hard-DELETE PE + V2 unghim + V1 inactive, GIỮ V2 ghim + V1 active). Plan F precedent: KHÔNG drop V1 active (PE pin → BE crash).
|
||||
|
||||
### 2026-05-15 (S24 t1 spawn Pre-A — Plan AA User Workflow Matrix view + sidebar widen)
|
||||
|
||||
5Q audit. Q1 endpoint: `ApprovalWorkflowsV2Controller.cs:16-19` đã class-level `[Authorize]` bare từ S18 2026-05-08 (gotcha #44 fixed permanent), per-method admin Workflows.Create. Handler `GetAwAdminOverviewQuery` KHÔNG có IsUserSelectable filter — cần ADD param + Where conditional. Q2 menu seed: `DbInitializer.cs:1429-1437` peOrder global increment (Group=1, leaves 2/3/4 cycle per type). Permission seed `line 1541-1547` cho 7 role (Drafter/DeptManager/Procurement/CostControl/ProjectManager/Director/AuthorizedSigner). Accounting NOT trong list — admin manual grant nếu cần. Q3 Admin Designer: `ApprovalWorkflowsV2Page.tsx` 975 lines, AwLevelDto 13 fields (7 Allow*), VI labels line 892-948 ("Trả về 1 Cấp trước"/"Trả về 1 Bước trước"/"Trả về Người chỉ định"/"Trả về Drafter (mặc định)"/"Cho phép chỉnh sửa Section 2 (Hạng mục/NCC/Báo giá) lúc đang duyệt"/"Cho phép chỉnh sửa Section ngân sách lúc đang duyệt"/"Cho phép duyệt thẳng Cấp cuối khi đang duyệt"). KHÔNG có usePermission/PermissionGuard wrap (class-level [Authorize] route guard sufficient). Q4 sidebar widen: fe-user `Layout.tsx:325` + fe-admin `Layout.tsx:218` `w-60 xl:w-72` (240/288px). PE Workspace 2-panel `[260px_1fr] xl:[320px_1fr]` (NOT 3-panel như memory `feedback_responsive_laptop_breakpoint` stale claim). After widen `w-72 xl:w-80` (288/320px) SAFE (sidebar 288 + main 992 → workspace 260+732 fit @ 1280px). `w-80 xl:w-96` THRESHOLD RISKY (sát 700px remaining). Q5 ApplicableType enum `ApprovalWorkflow.cs:45-50` {DuyetNcc=1, DuyetNccPhuongAn=2, Contract=3}. Surprises: (1) memory responsive breakpoint stale "3-panel" → cần update sau Plan AA. (2) Order strategy "Luồng duyệt" Order=2 first → shift existing leaves +1 → cần DbInitializer UPDATE Order existing (KHÔNG chỉ INSERT-if-not-exists). (3) Contract=3 chưa wire FE (chỉ DuyetNcc + DuyetNccPhuongAn). Recommendation: Proceed Plan AA — chỉ ADD param filter + 1 menu key + page mới + sidebar widen. Token cost ~32k.
|
||||
|
||||
### 2026-05-15 (S24 t1-t4 post-spawn, em main solo 4 polish chunks — Plan AA wrap)
|
||||
|
||||
7 commits total `a1a910f..ee0902a`: BE+Layout (`ee776d5`) + FE Page (`c667802`) + Docs (`ac2c859`) + 4 polish iter UAT (`da218f1` px-2 + `4d60598` v1 panel-per-NV + `fbbd361` v2 table rowSpan + `ee0902a` sidebar label wrap). **Pattern reusable**: `inline-block icon + inline text + absolute ChevronDown` cho hanging-indent reverse wrap (label dài về đầu hàng). Mirror admin Designer style cho user view read-only. **Sidebar widen tradeoff**: `w-72 xl:w-80` + remove `truncate` FAIL fit 44+ chars label custom Mig 27 — cần combine với `text-[12px] + leading-snug` + restructure flex → block + inline. Sole `truncate` removal không đủ — phải full layout restructure NavLink. **Memory drift confirmed**: `feedback_responsive_laptop_breakpoint.md` claim "PE Workspace 3-panel" → S24 verify ACTUAL **2-panel** (260+1fr only, KHÔNG có panel thứ 3). Cross-ref update needed memory user-level (admin trigger curate sau). **Plan AA color palette success**: STEP_PALETTE 5 màu (blue/purple/emerald/amber/pink) + LEVEL_PALETTE 5 màu (violet/sky/teal/orange/rose) — **Tailwind JIT yêu cầu full class strings array, KHÔNG dynamic interpolation** (`bg-${color}-100` FAIL — class purged). Reusable cross-project cho menu hierarchy color coding (step parent + level child distinct palette). Final layout v2 table rowSpan: Step column merge per-Phòng + Level column rowSpan per-Cấp + NV column 1-row-per-approver, đẹp hơn v1 panel-per-NV stacked. Token cost iteration negligible (em main solo, no spawn).
|
||||
@ -0,0 +1,26 @@
|
||||
# Investigator Agent — Archive Recent Activity Q2 2026-05 (S25-S29 verbose audit)
|
||||
|
||||
> **Archived:** 2026-05-26 S32 em main proxy curate session (post-S31 RAG fix).
|
||||
> **Scope:** 4 verbose Recent activity entries — moved from MEMORY.md để giữ slim < 25KB threshold (was 27.7KB → target ~22KB).
|
||||
> **Rule §6.5 compliance:** KHÔNG cắt narrative — full verbose entries preserved cho cross-session audit.
|
||||
> **KEEP in MEMORY:** S32 startup (latest), S29 wrap summary (Plan CA + Plan B 2 spawn aggregate), S28 Layer A governance, S27 retrospective, S25 wrap (Bug 1+2 audit summary), S22 curate session, S11 setup baseline. Patterns + Active workflow schemas foundation preserved untouched.
|
||||
|
||||
---
|
||||
|
||||
## Archive entries (FIFO chronological — earliest first)
|
||||
|
||||
### 2026-05-19 (S25 t1 spawn audit 2 bug critical UAT — Changelog logging missing)
|
||||
|
||||
Em main report 2 bug UAT: (1) Budget Adjust 2×click → "Lịch sử thay đổi" KHÔNG show 2 entry. (2) Return Assignee mode F1 click → "Lịch sử thay đổi" KHÔNG show return action. Audit 5Q: Q1-DB state Prod SSH fail (auth), fallback code inspect. Q2-Budget handler: `PurchaseEvaluationFeatures.cs:379-387` **ĐÃ log changelog** EntityType=Header + Action=Update + summary diff → **code ĐÚNG, likelihood FE filter bug or UAT DB stale**. Q3-Return handler: `PurchaseEvaluationWorkflowService.cs:215-378 ApplyReturnModeAsync` **ZERO changelog log** — 4 mode branches (OneLevel/OneStep/Assignee/Drafter) mutate pointers only, return summary, caller `TransitionAsync:100 LogTransitionAsync` only logs phase transition KHÔNG log mode side-effect. Q4-Schema: `PurchaseEvaluationChangelog.cs` support EntityType=Workflow(5) enum but **ZERO code populate** — schema incomplete missing Kind/ChangeType subtype enum to disambiguate "budget adjust" vs "detail edit" vs "return mode" (all Header/Workflow entity cùng Action.Update). Q5-FE: Query handler `ListPurchaseEvaluationChangelogsQueryHandler:1050-1064` **KHÔNG filter logic** — returns ALL entities. FE query component unknown (fe-user source not easily searchable) but **likely filter EntityType == (Supplier|Detail|Quote)** omit Header+Workflow → Bug 1 Budget (Header type) hidden, Bug 2 Return (Workflow type unlogged vậy). Root cause B1: FE filter skip Header updates OR Schema gap (Header.Update collision: budget vs section 2 edit). Root cause B2: Handler **intentionally skip logging** (no companion audit table like PurchaseEvaluationApprovals for return history). Fix path B1: Option A (add Kind enum — 30 LOC schema+handlers) vs B (extend EntityType — 20 LOC) vs C (FE filter conditional show Budget — 10 LOC FE). Fix path B2: Add `db.PurchaseEvaluationChangelogs.Add()` per mode (15-25 LOC 1 file). Cross-ref pattern memory: S23 t3 lookup bug (Level.Order collision per-NV Mig 29) — schema Mig 29 OR-of-N refactor created similar subtype ambiguity. Surprise: `EntityType.Workflow=5` enum value design-only, unused 4+ mig history. Recommendation: B2 fix first (clear win, 1 file BE), then B1 design (schema + cross-module pattern audit Contracts). Token ~28k.
|
||||
|
||||
### 2026-05-21 (S26 spawn Plan AG 5Q audit — PE List tree view feedback Tra Sol)
|
||||
|
||||
Bro UAT 2026-05-21 screenshot phàn nàn UI Duyệt NCC flat list "đám rừng" + propose Outlook-style folder template. Em main spawn Investigator audit 5Q: Q1 prod data scale (SSH auth fail, fallback code inspect — ~50-200 projects × 5-15 PE typical). Q2 Project entity `Master/Project.cs:5-14` extends AuditableEntity với Code+Name+dates+Budget+PM+Note, **MISSING MaxLength + navigation tới PE** → ready for Phase 2 ProjectPackage table mở rộng. Q3 PE List structure `PurchaseEvaluationsListPage.tsx:133` 3-panel grid `lg:grid-cols-[340px_1fr_360px]` flat `<ul><li>` line 199-252 + pageSize 50 + filter type/phase/awId/search. Q4 shadcn fe-user component GAP **THIẾU Accordion/Collapsible/Tree/Card/Badge** (chỉ Button/Dialog/Input/Label/Select/Textarea) → Phase 1 fallback HTML `<details>/<summary>` native + inline badge `<div>` (verified S24 Plan AA pattern). Q5 Mig 32 prep naming `AddProjectPackageTable` follow cumulative pattern. **Recommend Approach C Hybrid: Phase 1 FE-only group view ~160 LOC × 2 app (1-2 ngày) + Phase 2 ProjectPackage schema (3-5 ngày defer post-UAT). Implementer Case 2 cookie-cutter mirror 2 app ACCEPT.** Token ~30k.
|
||||
|
||||
### 2026-05-21 (S26 spawn Plan AI RAG distribution research — 4 study cases industry-validated)
|
||||
|
||||
Bro plan setup RAG cho 5 dự án cùng máy localhost share infrastructure. Investigator deep research 7Q: Anthropic patterns + community tools + multi-tenant architecture + distribution mechanism + auth + cost + sync. **Findings 4 study cases:** (1) **Cursor** — Merkle tree + Turbopuffer + 92% similarity reuse pattern, secret key derived Git commit hash, per-team index sharing cut indexing hours→seconds. (2) **Cline Memory Bank** — markdown + JIT retrieval + git-native sync. (3) **Continue.dev Hub** — slug-based YAML config sharing centralized. (4) **Sourcegraph Cody** — interesting anti-pattern, BỎ embeddings sang Search API + graph IR scale 100K+ repos enterprise (alternative if good search infra sẵn). **Multi-tenant 3 patterns:** Single index (pool, cheap), Per-tenant isolated (silo, expensive), Hybrid base+delta (Cursor pattern). **Distribution combo winner cho 5-dev team:** FastMCP HTTP server VPS Hetzner $15/tháng + git-sync embeddings snapshots committed to private repo. Auth JWT RS256 + role scopes + document-level ACL. Cost reality 5 dev ~$20/month vs cloud Qdrant $50/month. Sync git-based weekly cron (real-time chỉ cần khi team > 10 dev). **Surprise:** Voyage AI **200M tokens/month free tier cover 5 devs** comfortably — coi như chỉ tốn $15 VPS. **Anthropic standards 9/9 matched** + community best practices 6/7 matched (Sourcegraph alternative N/A cho memory-heavy). Plan AI architecture chốt với em main: User-level Global MCP (Pattern C — 1 server localhost serve 5 project) thay vì team VPS pattern (anh single dev 5 dự án). Token ~40k.
|
||||
|
||||
### 2026-05-22 (Plan B Contract V2 wire pre-flight audit — Q1-Q5 + Bonus re-chunk)
|
||||
|
||||
Em main spawn Investigator pre-flight Plan B priority HIGH. 5Q audit + Bonus chunk refinement. Tag schema: `[audit, phase-9, contract]`. **Findings:** (Q1) `Contract.cs:8-58` 25 fields, V1 ready (WorkflowDefinitionId line 22 + CurrentWorkflowStepIndex line 39 + Phase line 12 + RejectedAtStepIndex line 40) MISSING `ApprovalWorkflowId Guid?` + `CurrentApprovalLevelOrder int?` → need Mig 32 add. (Q2) `ContractPhase.cs:14-28` 12 values ready ChoDuyet=10 + TraLai=98 + TuChoi=99 mirror PE. `ContractWorkflowService.cs:23-219` 220 LOC V1 ONLY. NO V2 branch. Match Dept+PositionLevel line 113-126. Gen mã HĐ line 148-155 trigger last step → Phase=DaPhatHanh (terminal khác PE DaDuyet). (Q3) Prod: 7 Contracts 100% V1Pinned (Mig 21 flat WorkflowDefinitionId), 6 in-workflow Phase 2-8 → MUST coexist V1+V2, KHÔNG drop V1. ApprovalWorkflows Prod: 2 rows `ApplicableType=1 (DuyetNcc)` ZERO `ApplicableType=3 (Contract)` chưa seed. (Q4) Mig 22 `20260508053749_AddApprovalWorkflowsV2.cs:14-127` 3 CREATE TABLE shared cho cả PE+Contract, Mig 32 chỉ cần ADD COLUMN tại `Contracts`. Mig 23 `20260508072821_AddApprovalWorkflowIdToPurchaseEvaluation.cs:14-31` template 15 LOC cookie-cutter rename Pe→Contract. Mig 24 `20260508074937_AddCurrentApprovalLevelOrderToPe.cs:14-17` 3 LOC. `ApproveV2Async` `PurchaseEvaluationWorkflowService.cs:446-634` 189 LOC clone mẫu — load AW.Steps.Levels + match actorId ∈ pendingLevelGroup.ApproverUserId (line 484-495) + UPSERT opinion (line 522-546) + advance level/step (line 605-633) + skipToFinal F2 (line 561-602). Branch entry pattern line 167-171 ternary `if (evaluation.ApprovalWorkflowId is Guid awId) ApproveV2Async else ApproveV1Legacy`. (Q5) Risk LOW — schema 80% shared. F1-F4 7 flags Mig 29+30+31 trên `ApprovalWorkflowLevels` (entity line 86-114) inherits FREE Contract. **Risk MEDIUM:** ContractType discriminator — 1 workflow serve ALL 7 ContractType vs per-type? PE chỉ 2 type. Defer Q em main. **Bonus re-chunk 6 chunks:** A1 entity 5 LOC (em main) + A2 Mig 32 cookie-cutter (Implementer) + B Service ternary 189 LOC clone adapt gen mã HĐ terminal (em main critical cross-stack) + C Mig 33 ContractLevelOpinions cookie-cutter (Implementer) + D FE-User Workspace Select V2 (Implementer mirror) + E FE Section 5 LevelOpinionsV2 dynamic (Implementer mirror). **Surprises:** (a) ApprovalWorkflows Prod ZERO ApplicableType=3 — recommend Chunk A2 include DbInitializer seed sample. (b) `RejectedAtStepIndex` Contract line 40 DEPRECATED chưa marked obsolete drift với PE line 50. (c) ContractType 7 variants vs ApprovalWorkflow generic ApplicableType=3 — future Mig 34 có thể cần `ContractTypes int[]` filter nếu Solutions cần per-type workflow. **Recommendation: PROCEED coexist V1+V2 pattern, 6 chunk re-chunk.** Token ~25K. source_path: `solution_erp/audit/investigator-plan-b-contract-v2-preflight-2026-05-22`.
|
||||
@ -0,0 +1,30 @@
|
||||
# Investigator — Archive Q3 2026-05 (S34 curate)
|
||||
|
||||
> Verbose Recent activity entries archived from MEMORY.md S34 init (em main proxy curate 2026-05-27).
|
||||
> Patterns proven + Active workflow schemas foundation preserved untouched in MEMORY.md.
|
||||
|
||||
---
|
||||
|
||||
## 2026-05-22 — S27 wrap-up retrospective em main proxy
|
||||
|
||||
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 S29 era
|
||||
|
||||
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 baseline
|
||||
|
||||
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.
|
||||
Reference in New Issue
Block a user