From 6f08d1f0ebeba52a403474ef57709b2708c2c4bf Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Fri, 29 May 2026 16:58:39 +0700 Subject: [PATCH] [CLAUDE] Docs: S40 adopt AI_INFRA Tiered Memory Policy v1 (bulletin MUC 2) - README Memory discipline -> tiered L1 HOT (soft-cap ~30KB) / L2 archive on-demand / L3 RAG just-in-time (thay hard >25KB) - 7 agent MEMORY.md header -> tiered framing - Anti-truncation rule soft-cap ~30KB - Adopt per AI_INFRA Cross-Project Bulletin 2026-05-29; SE 7-agent in scope Co-Authored-By: Claude Opus 4.8 (1M context) --- .claude/agent-memory/cicd-monitor/MEMORY.md | 2 +- .claude/agent-memory/implementer-backend/MEMORY.md | 2 +- .claude/agent-memory/implementer-frontend/MEMORY.md | 2 +- .claude/agent-memory/investigator-api/MEMORY.md | 2 +- .claude/agent-memory/investigator-codebase/MEMORY.md | 2 +- .claude/agent-memory/reviewer/MEMORY.md | 2 +- .claude/agent-memory/test-specialist/MEMORY.md | 2 +- .claude/agents/README.md | 10 ++++++++-- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.claude/agent-memory/cicd-monitor/MEMORY.md b/.claude/agent-memory/cicd-monitor/MEMORY.md index 857628d..f9107e3 100644 --- a/.claude/agent-memory/cicd-monitor/MEMORY.md +++ b/.claude/agent-memory/cicd-monitor/MEMORY.md @@ -1,7 +1,7 @@ # CI/CD Monitor Agent — Persistent Memory > **Persistent diary cross-session.** Auto-injected first 200 lines / 25KB at spawn. -> Update BEFORE every stop. Curate when > 25KB. Keep entry ≤ 1.5K chars (gotcha #53). +> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53). > Full verbatim run history pre-S40 → git `d2f52ba` + `archive/2026-05-{runs,q2,q3,q4}.md`. --- diff --git a/.claude/agent-memory/implementer-backend/MEMORY.md b/.claude/agent-memory/implementer-backend/MEMORY.md index 998e74d..d4f9305 100644 --- a/.claude/agent-memory/implementer-backend/MEMORY.md +++ b/.claude/agent-memory/implementer-backend/MEMORY.md @@ -1,7 +1,7 @@ # Implementer-Backend Agent — Persistent Memory > **Persistent diary cross-session.** Auto-injected first 200 lines / 25KB at spawn. -> Update BEFORE every stop. Curate when > 25KB. Keep entry ≤ 1.5K chars (gotcha #53). +> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53). > Full verbatim history pre-S40 → git `d2f52ba` + `archive/2026-05-q1..q4.md`. > **Renamed S39:** implementer → implementer-backend (.NET half). FE patterns → `implementer-frontend` MEMORY. Test patterns → `test-specialist` MEMORY. diff --git a/.claude/agent-memory/implementer-frontend/MEMORY.md b/.claude/agent-memory/implementer-frontend/MEMORY.md index ed9cf76..4f06549 100644 --- a/.claude/agent-memory/implementer-frontend/MEMORY.md +++ b/.claude/agent-memory/implementer-frontend/MEMORY.md @@ -1,7 +1,7 @@ # Implementer-Frontend Agent — Persistent Memory > **Persistent diary cross-session.** Auto-injected first 200 lines / 25KB at spawn. -> Update BEFORE every stop. Curate when > 25KB. Keep entry ≤ 1.5K chars (gotcha #53). +> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53). > **NEW agent S39 (2026-05-29)** — split từ implementer (FE 2 app half). Backend scaffold history ở `implementer-backend`. --- diff --git a/.claude/agent-memory/investigator-api/MEMORY.md b/.claude/agent-memory/investigator-api/MEMORY.md index 8f09a4b..383ceb4 100644 --- a/.claude/agent-memory/investigator-api/MEMORY.md +++ b/.claude/agent-memory/investigator-api/MEMORY.md @@ -1,7 +1,7 @@ # Investigator-API Agent — Persistent Memory > **Persistent diary cross-session.** Auto-injected first 200 lines / 25KB at spawn. -> Update BEFORE every stop. Curate when > 25KB. Keep entry ≤ 1.5K chars (gotcha #53). +> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53). > **NEW agent S39 (2026-05-29)** — split từ investigator (external research half). Internal audit history ở `investigator-codebase`. --- diff --git a/.claude/agent-memory/investigator-codebase/MEMORY.md b/.claude/agent-memory/investigator-codebase/MEMORY.md index d49eb7d..dac2058 100644 --- a/.claude/agent-memory/investigator-codebase/MEMORY.md +++ b/.claude/agent-memory/investigator-codebase/MEMORY.md @@ -1,7 +1,7 @@ # Investigator-Codebase Agent — Persistent Memory > **Persistent diary cross-session.** Auto-injected first 200 lines / 25KB at spawn. -> Update BEFORE every stop. Curate when > 25KB. Keep entry ≤ 1.5K chars (gotcha #53). +> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53). > Full verbatim history pre-S40 → git `d2f52ba` + `archive/2026-05-q1..q4.md`. > **Renamed S39:** investigator → investigator-codebase (internal half; external → investigator-api). diff --git a/.claude/agent-memory/reviewer/MEMORY.md b/.claude/agent-memory/reviewer/MEMORY.md index 1b056d4..76f1aa9 100644 --- a/.claude/agent-memory/reviewer/MEMORY.md +++ b/.claude/agent-memory/reviewer/MEMORY.md @@ -1,7 +1,7 @@ # Reviewer Agent — Persistent Memory > **Persistent diary cross-session.** Auto-injected first 200 lines / 25KB at spawn. -> Update BEFORE every stop. Curate when > 25KB. Keep entry ≤ 1.5K chars (gotcha #53). +> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53). > Full verbatim history pre-S40 → git `d2f52ba` + `archive/2026-05-q1..q2.md`. --- diff --git a/.claude/agent-memory/test-specialist/MEMORY.md b/.claude/agent-memory/test-specialist/MEMORY.md index 400fa5b..84ba86c 100644 --- a/.claude/agent-memory/test-specialist/MEMORY.md +++ b/.claude/agent-memory/test-specialist/MEMORY.md @@ -1,7 +1,7 @@ # Test-Specialist Agent — Persistent Memory > **Persistent diary cross-session.** Auto-injected first 200 lines / 25KB at spawn. -> Update BEFORE every stop. Curate when > 25KB. Keep entry ≤ 1.5K chars (gotcha #53). +> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53). > **NEW agent S39 (2026-05-29)** — dedicated test layer (tách khỏi implementer Case 3). --- diff --git a/.claude/agents/README.md b/.claude/agents/README.md index 3426024..801f25c 100644 --- a/.claude/agents/README.md +++ b/.claude/agents/README.md @@ -50,7 +50,7 @@ **Anti-truncation rules (gotcha #53 — 5× occurrence S35-S37):** - Brief WRITE agent ≤ 8K (heavy spec ~10K → truncate risk). FE tight brief proven 0 truncation S36. -- Curate MEMORY pre-spawn nếu > 25KB (Investigator 32KB S37 → truncate mid-MEMORY). +- Tiered Memory v1: L1 HOT soft-cap ~30KB + L2 archive on-demand + L3 RAG just-in-time (per AI_INFRA policy). Investigator 32KB S37 truncate = lesson; soft-cap ~30KB tránh tái diễn. - Agent keep entry ≤ 1.5K chars (frontmatter rule mỗi agent). - Em main grep verify manual nếu agent return truncated mid-task. - 529 Overload transient → em main solo fallback (KHÔNG retry loop). @@ -131,7 +131,13 @@ All 7 agent có 5 RAG MCP: `search_memory` + `search_code` (BM25, prefer over Re ## 💾 Memory discipline -Each agent `.claude/agent-memory//MEMORY.md` persistent diary. Spawn auto-inject 200 lines/25KB. Update BEFORE return (BẮT BUỘC, entry ≤ 1.5K chars). 7 folder: investigator-codebase (history từ investigator) · investigator-api (NEW seed) · implementer-backend (history từ implementer) · implementer-frontend (NEW seed) · test-specialist (NEW seed) · reviewer · cicd-monitor. +Each agent `.claude/agent-memory//MEMORY.md` persistent diary. Spawn auto-inject first 200 lines/25KB. Update BEFORE return (BẮT BUỘC, entry ≤ 1.5K chars). 7 folder: investigator-codebase · investigator-api · implementer-backend · implementer-frontend · test-specialist · reviewer · cicd-monitor. + +**Tiered Memory Policy v1** (adopt AI_INFRA bulletin 2026-05-29 — thay ngưỡng cứng ">25KB archive" bằng tiered + just-in-time; size to ≠ chất lượng, context-rot): +- **L1 HOT** = `MEMORY.md` soft-cap **~30KB** (role + patterns + anti-patterns + 5-8 entry gần nhất) → auto-inject mỗi spawn +- **L2 COLD** = `archive/.md` (activity cũ) → Read on-demand +- **L3 SEARCHABLE** = RAG `search_memory` → just-in-time +- Discipline: search L3 / Read L2 TRƯỚC khi deep-dive (đừng nhồi L1). Agent nhớ vô hạn qua L2+L3, context spawn vẫn gọn. Curate khi L1 > ~30KB (KHÔNG còn hard 25KB). **End-of-session:** em main SendMessage mỗi agent flush MEMORY → đọc 7 update → synthesize cross-agent → integrate project memory/session log → commit/push.