Context Bus

Context changes happen silently. No agent knows what another agent just learned, changed, or decided.

The Context Bus is a persistent, append-only event log with versioned events, causal lineage, consistency levels, and selective routing. Every session mutation, knowledge update, artifact creation, and tool call is published as a typed event with monotonic versioning. Agents subscribe with TopicFilters to receive only relevant events, send directed messages to specific agents, and use cursor-based polling or SSE for real-time updates. Cross-machine transport is supported via signed TransportEnvelopes and the Google A2A JSON-RPC protocol.

The Problem

Silent Context Drift

Agent A learns that the database schema changed. Agent B, working on the same project, has no idea and writes queries against the old schema. Without a shared event stream, context drift is invisible.

Subscribe with TopicFilters for selective event routing. Directed events target specific agents. Cross-machine transport via signed envelopes.

curl
curl (-N http://localhost:7700/v1/events?workspaceId=my-team)
- id: 42
- event: session_mutated
- data: {"id":42,"workspaceId":"my-team","channelId":"feat/auth",
- "kind":"session_mutated","version":42,"consistencyLevel":"strong",
- "actor":"cursor","payload":{"tool":"ctx_session","action":"save"}}
-
- id: 43
- event: knowledge_remembered
- data: {"id":43,"workspaceId":"my-team","channelId":"feat/auth",
- "kind":"knowledge_remembered","version":43,"parentId":42,
- "consistencyLevel":"eventual","actor":"claude","payload":{
- "tool":"ctx_knowledge","key":"auth/strategy"}}
Context Bus

5 tools

01

Selective Routing & TopicFilter

Agents subscribe with TopicFilters — filter by event kind, actor, consistency level, or agent identity. Directed events target specific agents only, reducing noise and saving tokens.

02

Consistency Levels

Each event carries a consistency level — local (informational), eventual (shared, async), or strong (requires sync) — so agents know which changes to prioritize.

03

A2A Transport & Cross-Machine Handoffs

TransportEnvelopeV1 wraps context packages and handoff bundles with HMAC-SHA256 signatures and agent identity for secure cross-machine transport. Send via CLI (<code>lean-ctx pack send</code>) or HTTP (<code>/v1/a2a/handoff</code>).

04

Google A2A Protocol Compatibility

JSON-RPC 2.0 endpoint at <code>/a2a</code> supports <code>tasks/send</code>, <code>tasks/get</code>, and <code>tasks/cancel</code>. Agent Card published at <code>/.well-known/agent.json</code> for standard A2A discovery.

05

Event Search, Lineage & Replay

Full-text search over event payloads (FTS5), causal lineage graphs via parent_id chains, cursor-based replay from any point. Events survive server restarts. Automatic backfill from SQLite.

6 Event Types
SSE Streaming Protocol
Event Replay Depth
tools

2 MCP tools

The Context Bus is a persistent, append-only event log with versioned events, causal lineage, consistency levels, and selective routing. Every session mutation, knowledge update, artifact creation, and tool call is published as a typed event with monotonic versioning. Agents subscribe with TopicFilters to receive only relevant events, send directed messages to specific agents, and use cursor-based polling or SSE for real-time updates. Cross-machine transport is supported via signed TransportEnvelopes and the Google A2A JSON-RPC protocol.

Context Bus

Related Documentation

Verification

Every output carries proof

LeanCTX generates proof artifacts for every session: which files were read, what was compressed, which checks passed, and how tokens were spent. This makes AI work auditable, replayable, and trustworthy.

Explore Context Bus

The Context Bus is a persistent, append-only event log with versioned events, causal lineage, consistency levels, and selective routing. Every session mutation, knowledge update, artifact creation, and tool call is published as a typed event with monotonic versioning. Agents subscribe with TopicFilters to receive only relevant events, send directed messages to specific agents, and use cursor-based polling or SSE for real-time updates. Cross-machine transport is supported via signed TransportEnvelopes and the Google A2A JSON-RPC protocol.