QUEUE & BATCH PROCESSING

How KAE batches, deduplicates, and throttles API calls to minimize cost and maximize efficiency

30-SECOND SLIDING WINDOW
0s / 30s
0Queued
0Deduplicated
0Batches run
0API calls made
0API calls saved
INCOMING QUEUE 0 items
Queue is empty — add events above
BATCH GROUPS (next cycle)
Groups form when queue has items
SYSTEM LOG
// KAE Queue System initialized. 30s batch window active.
THREE DEDUPLICATION STRATEGIES
Strategy A — Latest Wins
Same file + same guardian edited twice in 30s? Only the most recent version is processed. The earlier event is silently dropped.
Strategy B — Content Hash
File edited but content didn't change vs last run within 1 hour? Skip it entirely. SHA-256 hash comparison prevents wasted API calls.
Strategy C — Multi-Doc Batch
Multiple different files routed to the same guardian? Bundle them into one API call. One prompt, N documents — results keyed by file path so answers never get mixed up.
Retry & Dead-Letter
A batch item that fails retries automatically. After 3 strikes it moves to a dead-letter queue in kae.db instead of blocking every other item behind it — visible and counted, never silently lost.

🧒 Explain It Like I'm 10

The queue is KAE's carpool system. AI calls cost money, so instead of sending a separate car for every file, KAE waits half a minute and fills each car.

1. Black Box 2. Architecture 3. GHN Routing 4. Guardians 5. Event Pipeline 6. Queue 7. Learning 8. Monitors