Principle:23blocks OS Ai maestro Conversation Delta Indexing
| Knowledge Sources | |
|---|---|
| Domains | Memory, Indexing |
| Last Updated | 2026-10-26 10:00 GMT |
Overview
A delta indexing pattern that discovers new conversation transcript lines since the last indexed count, generates embeddings, and writes them to a per-agent CozoDB — with a concurrency throttle and a pinned database connection.
Description
Delta indexing processes only new conversation content since the last run. `runIndexDelta` discovers conversation JSONL files, computes the delta from the last indexed message count, and calls `indexConversationDelta` to batch-ingest: parse each JSONL line, generate embeddings, extract terms, and write to CozoDB.
A concurrency throttle (`acquireIndexSlot`) bounds the number of simultaneous indexing runs globally (preventing resource exhaustion). The database connection is pinned for the whole run — a large index outlives many LRU evictions, and eviction closes the database mid-write.
Usage
Use this principle when designing an incremental indexer where:
- Only new content since the last run must be processed (not full re-index)
- Concurrent indexing must be bounded (resource throttle)
- Database connections must stay open for the duration of a large batch
Theoretical Basis
The delta is computed from a high-water mark:
runIndexDelta(agentId):
for each conversation file:
lastCount = readLastIndexed(agentId, file)
newLines = readFrom(file, lastCount)
indexConversationDelta(agentDb, file, lastCount, batchSize)
updateLastIndexed(agentId, file, lastCount + newLines)
The concurrency throttle is a semaphore with a queue:
acquireIndexSlot(agentId):
if activeCount < MAX:
activeCount++
return releaseFn
else:
queue.push(agentId, releaseFn) // wait for a slot