#1 Persistent memory for AI coding agents based on real-world benchmarks
TypeScript agentmemoryagentsaiclaudeclaudecodecodexcopilotcursorgenaiharnesshermesmemoryompopenclawopencodepi
fix(health): emit heap_tight alert in warn band too, not only critical
Rohit Ghumare0f09e97e3c11
diff --git a/src/health/thresholds.ts b/src/health/thresholds.tsindex 24387ed8..3d84742e 100644--- a/src/health/thresholds.ts+++ b/src/health/thresholds.ts@@ -71,7 +71,7 @@ export function evaluateHealth(} else if (memPercent > cfg.memoryWarnPercent && rssAboveFloor) {alerts.push(`memory_warn_${Math.round(memPercent)}%_rss${memMb}mb`);degraded = true;- } else if (memPercent > cfg.memoryCriticalPercent) {+ } else if (memPercent > cfg.memoryWarnPercent) {alerts.push(`memory_heap_tight_${Math.round(memPercent)}%_rss${memMb}mb`);}diff --git a/test/health-thresholds.test.ts b/test/health-thresholds.test.tsindex 0b876248..7636456e 100644--- a/test/health-thresholds.test.ts+++ b/test/health-thresholds.test.ts@@ -48,6 +48,22 @@ describe("evaluateHealth memory severity", () => {expect(alerts.some((a) => a.startsWith("memory_critical_"))).toBe(true);});+ it("records heap_tight in the warn band when RSS is below the floor", () => {+ const s = snap({+ memory: {+ heapUsed: 85 * 1024 * 1024,+ heapTotal: 100 * 1024 * 1024,+ rss: 50 * 1024 * 1024,+ external: 0,+ },+ });+ const { status, alerts } = evaluateHealth(s);+ expect(status).toBe("healthy");+ expect(alerts.some((a) => a.startsWith("memory_heap_tight_"))).toBe(true);+ expect(alerts.some((a) => a.startsWith("memory_warn_"))).toBe(false);+ expect(alerts.some((a) => a.startsWith("memory_critical_"))).toBe(false);+ });+it("goes degraded when heap is above warn AND RSS is above the floor", () => {const s = snap({memory: {