feat: Session Bus — real-time cross-session heartbeat registry#470
Closed
creandoaldia wants to merge 1 commit into
Closed
feat: Session Bus — real-time cross-session heartbeat registry#470creandoaldia wants to merge 1 commit into
creandoaldia wants to merge 1 commit into
Conversation
Add Session Bus layer for inter-session awareness:
- session_heartbeats table in SQLite (session_id, project, current_task,
status_blob, last_seen) with 2-min staleness window
- 3 new MCP tools: mem_session_heartbeat, mem_session_status,
mem_active_sessions (agent profile, 22 total tools)
- 3 HTTP endpoints: POST /sessions/{id}/heartbeat,
POST /sessions/{id}/status, GET /sessions/active
- ActiveSession struct and 5 store methods (UpsertHeartbeat,
UpdateSessionStatus, CleanStaleHeartbeats, ActiveSessions)
- Heartbeats auto-cleaned on every read via datetime('now', '-120 seconds')
Enables sessions to know what other sessions are working on in real time.
No new dependencies. Fully Go-first, zero external services.
Collaborator
|
Closing this because it introduces a new Session Bus architecture without an approved issue or design discussion. This changes Engram's runtime coordination model through store tables, MCP tools, and HTTP endpoints, so it needs a real proposal first. Open an issue describing the problem, the intended contract, and the tradeoffs, then we can discuss whether this belongs in Engram before any PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Session Bus layer for real-time cross-session awareness. Sessions send periodic heartbeats with task descriptions, and Engram tracks active sessions with a 2-minute staleness window.
How it works
Each coding session sends a heartbeat on every tool call (throttled to 30s):
\
POST /sessions/{id}/heartbeat → returns list of other active sessions
\\
Other sessions can query the bus:
\
GET /sessions/active?project=X → all sessions with recent heartbeats
\\
Stale sessions (no heartbeat in 2 min) are auto-cleaned on every read.
Changes
Store (store.go)
MCP (mcp.go) — 3 new tools (agent profile, 22 total)
HTTP (server.go) — 3 new endpoints
Dependencies
Zero. No new imports, no new services, no Redis, no WebSocket. Pure SQLite + existing REST API.
Companion PRs