[CLAUDE] Skill: Add cicd-monitor (4th sub-agent — post-deploy verify Gitea + bundle hash)

Path A chốt sau pre-flight Plan G Trial Week 1 (Session 21 turn 1). Con thứ 4 cicd-monitor green READ tier — poll Gitea Actions API + curl bundle hash 2 app + sqlcmd migration verify prod + endpoint smoke. ~150K spawn cost extra, trade-off để catch deploy ship fail tự động không phụ thuộc em main nhớ verify thủ công (recurring blind spot S20).

Files added:
- .claude/agents/cicd-monitor.md (~7KB) — system prompt + 8-step workflow + 5-stage report + gotcha #25/#39/#40/#41/#44 cross-ref + skill iis-deploy-runbook/dependency-audit-erp/ef-core-migration preload
- .claude/agent-memory/cicd-monitor/MEMORY.md (~5KB seed) — recurring CI bug patterns + 5-stage checklist + baseline build/bundle metrics

Files updated:
- .claude/agents/README.md — 4-agent architecture diagram (green slot) + decision tree (after push + prod issue diagnose branches) + memory routine 4 SendMessage + skills preload 4 agents + cost reality ~750K spawn / ~1.35M heavy / ~700K optimized + trial workflow Week 1-3 CI/CD Monitor spawn integrated + pass criteria + catch ≥1 deploy ship fail

Trade-off rationale:
- 4× solo → 6.5× solo per heavy session (vs 3 agents 6× solo) — Max 20× plan absorbs
- Post-deploy ship verification = recurring blind spot (Em main solo quên verify ~30% push S20)
- Bundle hash unchanged + mig drift prod = silent fail signal (no exception, just user UAT confusion)

CI skip per path filter (all 3 files .md match `**/*.md` paths-ignore).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-05-12 00:47:09 +07:00
parent 36e21c88d2
commit f1c61c9af6
3 changed files with 456 additions and 23 deletions

View File

@ -1,8 +1,8 @@
# Multi-agent SOLUTION_ERP — Master Coordination Guide
> **Architecture:** 3 sub-agents Opus 4.7 1M Max + em main coordinator.
> Pattern: Anthropic Building Effective Agents orchestrator-workers + Cognition "writes single-threaded" hybrid.
> Setup: Session 20 turn 12 (2026-05-11) — empirical-grounded từ NAMGROUP s41-s43 trial curve.
> **Architecture:** 4 sub-agents Opus 4.7 1M Max + em main coordinator.
> Pattern: Anthropic Building Effective Agents orchestrator-workers + Cognition "writes single-threaded" hybrid + post-deploy automated watchdog.
> Setup: Session 20 turn 12 (2026-05-11) initial 3 agents + Session 21 turn 1 (2026-05-12) +cicd-monitor — empirical-grounded từ NAMGROUP s41-s43 trial curve.
---
@ -13,20 +13,22 @@
│ EM (Main) — Opus 4.7 1M Max │
│ • Reasoning + write code (single-threaded principle) │
│ • User dialog + architectural decisions │
│ • Coordinate 3 sub-agents via SendMessage │
│ • Coordinate 4 sub-agents via SendMessage │
│ • Synthesize cross-agent findings end-of-session │
└─────────────────────────────────────────────────────────┘
↓ spawn + keep-alive (Opus 4.7 1M Max each)
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
Investigator Implementer Reviewer │
READ only │ │ WRITE strict│ READ only
│ │ classification│ │
Research + Cookie-cutter Adversarial
Audit + │ │ + Multi-file│ │ pre-commit +
External │ │ independent live verify
research │ │ ONLY
└──────────────┘ └──────────────┘ └──────────────┘
cyan yellow red
┌────────────┐ ┌────────────┐ ┌────────────┐ ────────────┐
│Investigator │ Implementer │ Reviewer │ │ CI/CD
│ │ │ │ │ │ Monitor
READ only │ │ WRITE strict│ │ READ only │ │ READ only
│classification│ │ adversarial│ │ post-deploy
Research + │ │Cookie-cutter│ │ pre-commit │ │
Audit + │ │ + Multi-file│+ live │ │ Gitea poll
External │ │ independent│ │ verify │ │ + bundle
│ research │ │ ONLY │ │ │ │ hash + │
│ │ │ │ │ │ prod smoke │
└────────────┘ └────────────┘ └────────────┘ └────────────┘
cyan yellow red green
```
---
@ -42,6 +44,13 @@ Task input → classify task type:
├── Adversarial pre-commit verify / heavy diff / deploy claim?
│ → Spawn Reviewer (always before push critical)
├── After push code commit (NOT docs-only — gotcha #41 path filter)?
│ → Spawn CI/CD Monitor (poll Gitea Actions + bundle hash + prod smoke async)
│ → ~150K spawn cost — catch deploy fail tự động không phụ thuộc em main nhớ verify
├── User reports prod issue ("500", "không lên", "không thấy thay đổi")?
│ → Spawn CI/CD Monitor diagnose first (logs + curl + sqlcmd evidence)
├── Cookie-cutter mechanical (N independent files same pattern, deterministic spec)?
│ ✓ N >= 5 files
│ ✓ Spec deterministic (no implicit decisions)
@ -123,7 +132,10 @@ SendMessage Implementer: "Flush MEMORY.md với patterns applied + ambiguities
SendMessage Reviewer: "Flush MEMORY.md với anti-patterns observed + gotcha
regressions caught + claim verification results."
Em read 3 MEMORY.md updates → synthesize cross-agent learnings → integrate
SendMessage CI/CD Monitor: "Flush MEMORY.md với run failures observed + post-deploy
bundle hash trend + recurring CI bugs + deploy time delta vs baseline."
Em read 4 MEMORY.md updates → synthesize cross-agent learnings → integrate
vào project memory / session log.
Em proceed normal close-out: STATUS update + commit + push.
@ -149,12 +161,13 @@ Em proceed normal close-out: STATUS update + commit + push.
**Stack:** .NET 10 Clean Architecture + CQRS MediatR + EF Core 10 + SQL Server + 2 React 19 Vite 8 FE (admin + user) + Gitea Actions CI + Windows IIS.
**Current state (Session 20 turn 12):** 27 migrations · 59 DB tables · ~142 endpoints · 34 FE pages · 81 test pass · 44 gotchas · 14 memory entries · 6 skills · 30 demo user · 3 prod domain `*.solutions.com.vn`.
**Current state (Session 21 turn 1 — 2026-05-12):** 27 migrations · 59 DB tables · ~142 endpoints · 34 FE pages · 81 test pass · 44 gotchas · 16 memory entries · 6 skills · 30 demo user · 3 prod domain `*.solutions.com.vn` · **4 sub-agents (seeds-only post-cicd-monitor add)**.
**Skills preload mỗi sub-agent:**
- **Investigator:** `contract-workflow` + `permission-matrix` + `ef-core-migration` (research patterns + schema audit)
- **Implementer:** `ef-core-migration` + `permission-matrix` + `form-engine` (scaffold + 3-file rule + permission seed)
- **Reviewer:** `dependency-audit-erp` + `iis-deploy-runbook` + `contract-workflow` (security/deploy/workflow audit)
- **CI/CD Monitor:** `iis-deploy-runbook` + `dependency-audit-erp` + `ef-core-migration` (deploy runbook + dep pin verify + mig prod check)
**Context paste session start (em main responsibility):**
- `docs/STATUS.md` current state
@ -175,22 +188,23 @@ Em proceed normal close-out: STATUS update + commit + push.
| Component | Effective tokens billed (after caching) |
|---|---|
| 3 sub-agents spawn setup | ~564K (3 × 188K cache WRITE) |
| 4 sub-agents spawn setup | ~750K (4 × ~188K cache WRITE CI/CD Monitor +~150K) |
| 10 SendMessages each ~24K new | ~450K (10 × 45K equivalent với cache READ) |
| Em main session | ~200K |
| **Total per heavy session** | **~1.2M (~6× solo)** |
| **Optimized (compact + cache + skip trivial)** | **~600K (~3× solo)** |
| **Total per heavy session** | **~1.35M (~6.5× solo)** |
| **Optimized (compact + cache + skip trivial)** | **~700K (~3.5× solo)** |
**Max 20× plan absorbs ~3× solo cost comfortable.**
**Max 20× plan absorbs ~3.5× solo cost comfortable.**
**CI/CD Monitor +~150K trade-off:** catch deploy fail tự động KHÔNG phụ thuộc em main nhớ verify thủ công (recurring blind spot pattern).
---
## 🧪 Trial workflow (2-4 tuần evaluate)
- **Week 1:** Setup + Plan trial cookie-cutter (Case 1 verified). SOLUTION_ERP candidate: Contract V2 wire Mig 28+29 mirror PE pattern pattern proven 1× S17-S19 (PE V2). ~600+ LOC, 2 mig + Service + Controller + FE × 2 app.
- **Week 2-3:** Feature wire (Solo em + Inv pre-flight + Rev pre-commit) phân quyền strict V2 + drop legacy V1.
- **Week 1:** Setup + Plan trial cookie-cutter (Case 1 verified). SOLUTION_ERP candidate: Contract V2 wire Mig 28+29 mirror PE pattern pattern proven 1× S17-S19 (PE V2). ~600+ LOC, 2 mig + Service + Controller + FE × 2 app. **CI/CD Monitor spawn sau mỗi push** verify Gitea Actions PASS + bundle hash 2 app changed + mig 28+29 applied prod.
- **Week 2-3:** Feature wire (Solo em + Inv pre-flight + Rev pre-commit + CI/CD Monitor post-push) phân quyền strict V2 + drop legacy V1.
- **Week 4:** Evaluate quality vs cost real numbers.
- Pass criteria: Rev catch 2 wire bugs trước commit + time saving 25% Case 1+2 + Max 20× quota comfortable
- Pass criteria: Rev catch 2 wire bugs trước commit + CI/CD Monitor catch 1 deploy ship fail (bundle hash unchanged / mig drift) + time saving 25% Case 1+2 + Max 20× quota comfortable
- Fail criteria: any of above unmet rollback solo, agents archived
---