Skip to main content
STAGE 8 — RATE LIMITING & ABUSE RESISTANCE

Rate Limit Dashboard

Sliding window counters · Fail-closed · Tenant-scoped · Observable

Quick Test Setup

Click a button → watch console logs + toast notification. Bucket count in "Live Rate Limit Buckets" will update.

Rate Limit Policy Matrix

mwStoreMemoryWithIdempotencyStandard
60/min (burst 120)
mwRecallMemoryStandard
60/min (burst 120)
mwListMemoriesStandard
60/min (burst 120)
oracleSearchExpensive
5/min50/hr
oracleSearchIntelligenceExpensive
5/min50/hr
mwSemanticGraphSearchExpensive
10/min100/hr
mwExtractIntelligenceExpensive
10/min100/hr
mwGenerateEmbeddingExpensive
10/min200/hr
batchIngestBottlesBatch
2/min
batchExtractAllBottlesBatch
2/min
Fail-Closed:If rate limit system is unavailable → 503 (deny). Never allow execution on broken limiter.

Red Team Flood Tests

Test A — Burst Flood

130 rapid recall requests (burst=120) → expect ~120 allowed, remainder throttled (±small concurrency drift)

mwRecallMemory

Test B — Oracle Exhaustion

8 rapid oracle checks → expect 429 after 5

oracleSearch

Test C — Batch Rate Flood

5 rapid batch rate checks → expect 429 after 2

batchIngestBottles

Test D — Batch Lock Conflict

Acquire lock, try again → expect 409 conflict

batchExtractAllBottles

Test E — Cost Guard (searches)

Verify cost guard tracks usage correctly — expects at least 1 allowed under daily cap (200 searches)

oracleSearch

Live Rate Limit Buckets (0)

Total buckets: 0

✅ No buckets — cleared successfully!

Execution Log

Waiting for activity...

Cost Guard — Daily Usage

scott.dalmeida75@gmail.com — 2026-02-25
5
Searches
/200
0
Ingests
/200
0
Extracts
/100
0
Embeds
/500
scott.dalmeida75@gmail.com — 2026-02-24
11
Searches
/200
0
Ingests
/200
0
Extracts
/100
0
Embeds
/500
scott.dalmeida75@gmail.com — 2026-02-22
82
Searches
/200
0
Ingests
/200
0
Extracts
/100
0
Embeds
/500

Abuse Resistance Audit Trail

429
/2:55:32 PM
429
/2:55:14 PM
429
/2:55:14 PM
429
/2:55:14 PM
429
/2:55:14 PM
429
/2:55:14 PM
429
/2:55:14 PM
429
/2:48:38 PM
429
/2:48:24 PM
429
/2:48:24 PM
429
/2:48:24 PM
429
/2:48:24 PM
429
/2:48:23 PM
429
/2:33:34 PM
429
/2:33:33 PM
429
/2:33:32 PM
429
/2:32:17 PM
429
/2:32:15 PM
429
/2:32:14 PM
429
/2:57:58 PM

Stage 8 — Rate Limiting & Abuse Resistance

✅
8.1 Rate Limit Policy Matrix
Per-minute + burst + per-hour caps centralized
✅
8.2 mwCheckRateLimit
Sliding window, fail-closed, tenant-scoped
✅
8.3 mwCostGuard
Daily/monthly hard caps + 80% soft warning
✅
8.4 mwBatchLock
Single-flight concurrency guard, 10min TTL
✅
8.5 AuditLog Extension
rate_limited + cost_capped + batch_conflict outcomes
✅
8.6 Endpoint Integration
7 endpoints wired: Store, Recall, List, Oracle×2, Batch×2
✅
8.7 Red Team Tests
Burst flood + exhaustion + batch conflict + cost tracking
Fail-Closed

Limiter failure → 503 deny. Never allow on broken limiter.

Tenant-Scoped

tenant_id always from auth token. Never from caller payload.

Sliding Window

Per-minute AND per-hour caps for expensive endpoints.

Observable

Every 429 + cost cap hit logged to AuditLog for abuse detection.

Cost Protection

Hard caps prevent runaway LLM/embedding spend per tenant per day.

Single-Flight

Batch jobs locked per tenant — no parallel extraction disasters.