The Stale Context Problem
Traditional code indexing is a batch operation: index once, then the database is stale until you index again. For an AI agent helping you write code, this means the symbols it sees are always one step behind your edits. SDL-MCP’s live indexing system eliminates this gap. As you type in your editor, SDL-MCP receives buffer updates, parses them in the background, and overlays the new symbols on top of the durable database. Search, cards, and slices reflect your current code, not your last save.Architecture
- Buffer Push — Your editor extension sends the full file content on every keystroke (debounced) via
sdl.buffer.push. - Background Parse — The overlay store queues a tree-sitter parse to extract symbols from the draft content.
- Overlay Merge — When any tool queries the database (search, getCard, slice.build), the overlay symbols are merged on top of the durable DB results. Draft symbols shadow their durable counterparts.
- Checkpoint — On file save or manual checkpoint (
sdl.buffer.checkpoint), the overlay is written to the durable LadybugDB graph. - Reconciliation — A background reconciler ensures overlay and durable state converge, cleaning up stale drafts.
What Gets Overlaid
| Tool | Overlay Behavior |
|---|---|
sdl.symbol.search | Draft symbols appear in results alongside durable symbols |
sdl.symbol.getCard | Returns draft symbol card if the file has unsaved changes |
sdl.slice.build | Includes draft symbols in the BFS traversal |
sdl.code.getSkeleton | Generates skeleton from draft content |
sdl.code.getHotPath | Searches draft content for identifiers |
VSCode Extension Setup
Thesdl-mcp-vscode extension provides automatic buffer push integration so your editor changes flow into SDL-MCP without any manual intervention.
Install the extension
Install
sdl-mcp-vscode from the VSCode marketplace or by loading it from the sdl-mcp-vscode/ directory in the SDL-MCP repository.Open your repo in VSCode
Once the extension is active and the SDL-MCP server is running, the extension automatically sends
sdl.buffer.push events for every file open, change, save, and close.Buffer Tools
sdl.buffer.push
Manually push editor buffer content for live indexing. Accepts the full file content plus metadata about the buffer event type.
The key flow: Editor keystrokes → sdl.buffer.push → Overlay Store → merged reads
On save or idle, the overlay is flushed:
sdl.buffer.checkpoint
Force-write all pending overlay buffers to the durable LadybugDB. Use this when you want to ensure a snapshot is persisted — for example, before running a test suite or handing off work to another agent session.
sdl.buffer.status
Diagnostics for the live indexing pipeline. Returns queue depth, pending/dirty buffer counts, checkpoint status, and parse queue depth. Use this to investigate delays or verify the overlay store is healthy.
Configuration
| Option | Default | Description |
|---|---|---|
enabled | true | Master switch for live indexing |
debounceMs | 75 | Milliseconds to debounce between buffer push events |
idleCheckpointMs | 15000 | Auto-checkpoint when the editor has been idle for this duration |
maxDraftFiles | 200 | Maximum number of files that can be in the overlay simultaneously |
reconcileConcurrency | 1 | Concurrent jobs merging overlay state into the durable DB |
clusterRefreshThreshold | 25 | Number of reconciled symbols before triggering a cluster refresh |
Performance Characteristics
- Background AST parsing — tree-sitter parses happen on a separate queue and never block tool queries.
- Debounced pushes — the 75ms default debounce prevents the overlay store from being flooded during rapid typing.
- Overlay-first reads — all tool queries check the overlay before touching the durable DB, so draft symbols appear with no latency penalty.
- Idle auto-checkpoint — after 15 seconds of editor inactivity, pending buffers are automatically flushed to LadybugDB.
For deeper diagnostics than
sdl.repo.status provides, use sdl.buffer.status. It exposes the full queue state including per-file dirty status and parse queue depth.