# adap-report — 2026-06-08-Agent-database-codebase-agents

> SISTER = SOLUTION_ERP. Report-format LOCK (5 trường). Generated 2026-06-08 (S52), apply by em main solo (governance task — 0 agent spawned; HMW-mode ON nhưng adoption = single-writer file-work, parallel với investigator P11 recon đang chạy). Agent `.md` **chưa runtime-live pre-restart** (no hot-reload).

## 1. id-broadcast
`2026-06-08-Agent-database-codebase-agents` (from: ai_infra · category: **Agent** · reviewer_gate: **PASS_WITH_FIXES-applied** · nac: published · targets: **all-fit** · content_sha256 `76de8f24…`). 2 agent KHUNG: **A `database-agent`** (floor DB1–DB11, EF-Core/SQL-Server-centric) + **B `codebase-agent`** (floor CB1–CB8, .NET semantic + LSP). Recon-grounded: AI_INFRA quét 6/6 sister = .NET + EF Core + SQL Server → 2 floor universal.

## 2. nac G-011
**executed-file** (database-agent.md tailored + agent-memory seed + agents/README roster 10→11 5-điểm sync) → **VERIFIED-pending CLI restart** (agent `.md` no hot-reload → cần (a) anh restart Claude Code để registry load `database-agent`, (b) 1 spawn-test task DB nhỏ — đọc schema 1 bảng `sys.tables` / introspect ItTicket — confirm load OK + chạy DB1–DB11 thật). **codebase-agent = SKIP n-a** (KHÔNG executed — lý do §3).

## 3. evidence
**PROJECT-FIT:**
- **database-agent = ADOPT (tailored READ-advisory).** STRONG-FIT 6/6 (broadcast): SE = .NET 10 + EF Core 10 + SQL Server single `ApplicationDbContext`. Differentiator vs roster hiện có: KHÔNG sub nào OWN DB-layer như specialty (investigator = broad audit · reviewer = broad pre-commit · implementer-backend = author). DB11 concurrency floor lấp gap THẬT: **S43 LeaveBalance trừ phép KHÔNG RowVersion = lost-update risk**.
- **codebase-agent = SKIP n-a** (KHÔNG behind): (1) `investigator-codebase` đã cover grep/symbol/reference-mirror/architecture-map (CB1/CB2/CB5/CB7 overlap) — broadcast §B.30 chính nó nói "investigator đủ → skip, KHÔNG thêm trùng"; (2) skill `csharp-lsp` = **Windows no-op** (`csharp-ls` không trên PATH — agents/README §H3 đã ghi; CB1 LSP-semantic-nav = nền tảng codebase-agent → absent = floor rỗng). Re-assess khi cần LSP-rename refactor an-toàn quy-mô-lớn.

**Files written/edited (repo SOLUTION_ERP):**
- **NEW** `.claude/agents/database-agent.md` — floor DB1–DB11 đầy đủ (canonical, 0 hạ) + FORM SE (READ-advisory tier · skill `sql-database-assistant`+`ef-core-migration` · boundary ⟂ implementer-backend/investigator/reviewer · DB11 tie-in S43). `model: inherit` · `tools:` 4-RAG-read + Read/Grep/Glob/Bash/Skill (no Edit/Write/store_memory) · `description` block-scalar `|` parse-safe.
- **NEW** `.claude/agent-memory/database-agent/MEMORY.md` — seed (vai + SE facts 45mig/92tbl + DB11 S43-gap + boundary + G-015).
- **EDIT** `.claude/agents/README.md` (5-điểm): title 10→**11-agent** · arch line (9 product/quality + 2 monitor) + upgrade-note S52 · skill matrix +database-agent row · decision tree +nhánh DB-design/perf/concurrency · boundary matrix +row + Mig-design row note.

**SELF-CHECK (broadcast database-agent):**
- frontmatter `model: inherit` — KHÔNG `…[1m]` (gotcha #37). ✓
- `color:` unique — **OMIT** (lý do §4; precedent 2 monitor). ✓ (parse-safe)
- Đủ DB1–DB11 (THÊM only-if-increase, 0 hạ floor) · DB2 destructive-guard + DB11 transaction/concurrency hiện diện rõ. ✓ (executed-file)
- Skill `sql-database-assistant` (standalone available) + `ef-core-migration` (project skill registry) — present; **active-verify pending** (tooling-auditor H1 @session-end confirm). ⏳
- `store_memory` KHÔNG trong `tools:` (adap #1) · 4 RAG-read giữ. ✓ (`grep store_memory .claude/agents/database-agent.md` = 0 post-write)
- Restart + spawn-test → verified-runtime. ⏳ (defer session-end/next-session)

commit-sha: **pending S52** (governance .md → CI path-ignore skip; fill sau commit).

## 4. tailored-gì + skip-gì-vì-sao
- **FUNCTION-floor adopt FULLY:** DB1–DB11 giữ đủ canonical (0 hạ). DB2 destructive-guard + DB11 RowVersion concurrency + DB3 EF-Core discipline + DB6 3-file rule — nguyên vẹn.
- **FORM tailored SE:**
  - (a) **READ-advisory tier** (no Edit/Write) — SE `implementer-backend` đã author trọn BE stack cohesive (3-file rule). Tách migration→database-agent = phá coupling entity↔migration. → database-agent = DESIGN/REVIEW/PERF/CONCURRENCY-advise, implementer-backend author. Khác template default "WRITE-tier nếu sinh migration" = tailoring hợp roster (§F4 form tự do, floor giữ).
  - (b) **skill** = `sql-database-assistant` (SQL Server first-class) + **pair `ef-core-migration`** (template warn sql-database-assistant KHÔNG cover EF-Core → DB3 + skill này gánh; giữ pin EF Core 10/dbo).
  - (c) **color OMIT** — 8 màu standard (blue/cyan/green/orange/pink/purple/red/yellow) đã dùng hết bởi 8 product/quality sub; value lạ = risk gotcha #37 (reject cả file → agent không spawn). Theo precedent 2 monitor (cũng omit). Doc-emoji nếu cần.
  - (d) **tools 4-RAG-read** + `model: inherit` (SE convention, khác AI_INFRA 2-RAG/effort:max).
  - (e) **boundary doc** ⟂ implementer-backend (author) / investigator-codebase (broad) / reviewer (pre-commit) — tránh roster-overlap mơ hồ.
  - (f) **SE-fact embed:** 2 DB instance (Dev/Design designtime-gotcha) · gotcha #57 filtered-unique · codegen Serializable pattern · S43 lost-update gap.
- **SKIP codebase-agent = n-a** (KHÔNG behind — investigator cover + csharp-lsp Windows no-op; §3). Đúng floor broadcast "skip nếu investigator đủ, KHÔNG thêm trùng".

## 5. honest-caveat
- **Nấc = executed-file, KHÔNG verified-runtime.** database-agent CHƯA spawn lần nào (agent `.md` no hot-reload) → DB1–DB11 mới là floor-trong-file, chưa chạy thật. Anh restart CLI → spawn-test mới upgrade verified-runtime. KHÔNG claim "database-agent đang hoạt động".
- **G-015 KHÔNG overclaim:** DB7 scope-DB-only + READ-advisory tier = **PHÂN-VAI**, KHÔNG "read-only enforced" — agent giữ `Bash` (write-channel shell mở) + Skill. Containment thật = em main single-writer + git-diff post-session (defense-in-depth), KHÔNG allowlist đơn-độc.
- **Value-add chưa proven-runtime:** lý-lẽ "lấp DB-layer gap + DB11 vá S43 lost-update" = thiết-kế-hợp-lý, nhưng ROI thực phụ thuộc tần-suất task DB-design/concurrency phát sinh. Nếu sau vài session database-agent idle (investigator+reviewer đã đủ) → re-assess prune (tránh roster bloat 11-agent). Theo dõi @tooling-auditor H1 (idle/scope-drift check).
- **skill active-verify pending:** `sql-database-assistant` present trong skill-list nhưng chưa smoke-test trong vai database-agent; `ef-core-migration` project skill OK. tooling-auditor H1 @session-end confirm "đã-map-vai chưa".
- **Restart-batch:** database-agent (S52) gộp chung restart với mọi agent/command `.md` pending khác (nếu có) → 1 restart.
- **AI_INFRA `/adap-audit` Đợt-2** đọc cross-repo agent `.md` verify floor-gate 2-way (KHÔNG cần copy report về).
