From b51fc94ca621d12fdd36f778003b39d5e0c3ff07 Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Fri, 22 May 2026 12:32:58 +0700 Subject: [PATCH] [CLAUDE] Skill: Add MCP RAG tools cho 4 sub-agent definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add mcp__rag-unified__search_memory + mcp__rag-unified__cross_project_search vào tools list 4 agents (Investigator + Implementer + Reviewer + CICD Monitor). Tại sao: - Sub-agent spawn KHÔNG inherit MCP server access từ parent session - 4 agents previously CHỈ có Read/Grep/Glob/Bash → re-read MD files manually - Plan B pre-flight Investigator phải Read PE Mig 22-26 thủ công thay vì 1 RAG query - Plan CA Reviewer Cat 1 wire claim verify KHÔNG retrieve historical gotcha cross-session - Plan CA Hotfix 1 silent sidebar drop nếu Implementer có RAG → catch Pattern 16-bis trước commit Trade-off accepted (anh chốt full 4 agents): - Token cost spawn cao hơn (~5-10K extra per RAG query) - Risk noise dilute focus → mitigate by skill-specific prompt focus Pitfall #1 reinforced (S27 multi-agent setup): - Session đang chạy KHÔNG hot-reload registry - Anh restart Claude Code CLI để spawn S30+ pick up MCP RAG tools - Plan B Chunk D Implementer đang chạy dùng config CŨ (no MCP) — KHÔNG affect Verify post-restart (Anh): - Spawn test Investigator → call mcp__rag-unified__search_memory thử - Pass = MCP tools loaded; Fail = YAML syntax issue (fallback wildcard mcp__rag-unified__*) Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/agents/cicd-monitor.md | 5 ++--- .claude/agents/implementer.md | 5 ++--- .claude/agents/investigator.md | 5 ++--- .claude/agents/reviewer.md | 5 ++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.claude/agents/cicd-monitor.md b/.claude/agents/cicd-monitor.md index 82f9474..630084d 100644 --- a/.claude/agents/cicd-monitor.md +++ b/.claude/agents/cicd-monitor.md @@ -2,9 +2,8 @@ name: cicd-monitor description: | CI/CD pipeline + post-deploy verification specialist for SOLUTION_ERP. Use proactively AFTER every push to main that triggers Gitea Actions deploy (code commits — skip docs-only per path-filter gotcha #41). Polls Gitea Actions run status via API, verifies test gate pass (Domain 58 + Infra 23 tests baseline), confirms deploy actually shipped (FE bundle hash change × 2 app + EF migrations applied prod), smoke tests prod endpoints (api/admin/eoffice.solutions.com.vn). NEVER writes code — produces PASS/FAIL verdict with concrete evidence from logs + curl + sqlcmd. Catches deploy fail tự động không phụ thuộc em main nhớ verify. -model: claude-opus-4-7 -effort: max -tools: [Read, Grep, Glob, Bash, WebFetch] +model: inherit +tools: [Read, Grep, Glob, Bash, WebFetch, mcp__rag-unified__search_memory, mcp__rag-unified__cross_project_search] skills: - iis-deploy-runbook - dependency-audit-erp diff --git a/.claude/agents/implementer.md b/.claude/agents/implementer.md index ed390df..dbcc784 100644 --- a/.claude/agents/implementer.md +++ b/.claude/agents/implementer.md @@ -2,9 +2,8 @@ name: implementer description: | Code execution specialist for SOLUTION_ERP. Use proactively ONLY for: (1) Cookie-cutter mechanical refactors (rename, retype, bulk migration across N>=5 independent files with deterministic spec — vd FE rename prop cross 2 app mirror); (2) Multi-file independent changes via orchestrator-workers pattern (Anthropic Building Effective Agents — different file each modified differently, each verifiable independently — vd entity scaffold 10 files); (3) Test generation for isolated methods (Domain policy / codegen format); (4) Mass code migration (framework upgrade, strict mode TS6). DO NOT invoke for: schema design, UX flow decisions, bug fix tight coupling, integration testing, OR any tightly coupled cross-stack feature. Main agent handles those single-threaded per Cognition's "writes stay single-threaded" principle. Implementer auto-refuses out-of-scope tasks. -model: claude-opus-4-7 -effort: max -tools: [Read, Edit, Write, Bash, Skill, Grep, Glob] +model: inherit +tools: [Read, Edit, Write, Bash, Skill, Grep, Glob, mcp__rag-unified__search_memory, mcp__rag-unified__cross_project_search] skills: - ef-core-migration - permission-matrix diff --git a/.claude/agents/investigator.md b/.claude/agents/investigator.md index d2f3547..27e7bdd 100644 --- a/.claude/agents/investigator.md +++ b/.claude/agents/investigator.md @@ -2,9 +2,8 @@ name: investigator description: | Read-only research and audit specialist for SOLUTION_ERP codebase. Use proactively when main agent needs to scan >5 files for patterns, audit controllers/endpoints, research external sources (Anthropic docs, community blogs), pre-flight reconnaissance before implementation, smoke test endpoints, search V1/V2 workflow schema or sys.triggers, gather reference implementations from similar features (PE → Contract V2 mirror), audit memory entries cross-reference. NEVER writes code — only returns concise structured findings. -model: claude-opus-4-7 -effort: max -tools: [Read, Grep, Glob, Bash, WebFetch, WebSearch] +model: inherit +tools: [Read, Grep, Glob, Bash, WebFetch, WebSearch, mcp__rag-unified__search_memory, mcp__rag-unified__cross_project_search] skills: - contract-workflow - permission-matrix diff --git a/.claude/agents/reviewer.md b/.claude/agents/reviewer.md index fe91c34..6378688 100644 --- a/.claude/agents/reviewer.md +++ b/.claude/agents/reviewer.md @@ -2,9 +2,8 @@ name: reviewer description: | Adversarial code review specialist for SOLUTION_ERP. Use proactively BEFORE every commit involving: wire BE claim (especially CRUD endpoints with POST/PUT/DELETE), schema migration, cross-stack feature, security-sensitive diff, or any change > 50 LOC. Provides independent verification that main agent's implementation matches spec, catches blind spots from self-review bias (gotcha #44 silent 403 type issues), and runs live verification on prod UAT environment for deploy claims. NEVER writes code — produces PASS/FAIL verdict with concrete issues file:line. -model: claude-opus-4-7 -effort: max -tools: [Read, Grep, Glob, Bash] +model: inherit +tools: [Read, Grep, Glob, Bash, mcp__rag-unified__search_memory, mcp__rag-unified__cross_project_search] skills: - dependency-audit-erp - iis-deploy-runbook