| name | spacetimedb-manager |
| description | Manage SpacetimeDB modules for real-time state synchronization — define tables, reducers, and subscriptions for live agent coordination.
|
| version | 0.1.0 |
| author | Jero (LATTICE / MARPA Design Studios) |
| triggers | ["spacetimedb","real-time state","create a spacetime module","live sync","agent state"] |
| tools | ["Bash","Read","Write","Edit","Glob","Grep"] |
SpacetimeDB Manager
USE WHEN the user wants to create SpacetimeDB modules, define real-time tables and reducers, set up live state synchronization between agents, or manage subscriptions.
What It Does
Build real-time state management using SpacetimeDB's module system:
- Define Modules — Create Rust or C# modules with tables and reducers
- Tables — Define schemas for agent state, pipeline progress, coordination data
- Reducers — Server-side functions that mutate state atomically
- Subscriptions — Clients subscribe to table changes for real-time updates
- Deploy — Publish modules to local or cloud SpacetimeDB instance
Usage
create a spacetimedb module for agent coordination
add a table tracking graftline phase progress
set up subscriptions for pipeline status changes
Module Structure (Rust)
use spacetimedb::{spacetimedb, Identity, Timestamp};
#[spacetimedb(table)]
pub struct AgentState {
#[primarykey]
pub agent_id: String,
pub status: String,
pub current_phase: String,
pub last_heartbeat: Timestamp,
pub owner: Identity,
}
#[spacetimedb(reducer)]
pub fn update_agent_status(
ctx: ReducerContext,
agent_id: String,
status: String,
phase: String,
) {
if let Some(mut agent) = AgentState::filter_by_agent_id(&agent_id) {
agent.status = status;
agent.current_phase = phase;
agent.last_heartbeat = Timestamp::now();
AgentState::update_by_agent_id(&agent_id, agent);
}
}
Python Client
from spacetimedb_sdk import SpacetimeDBClient
client = SpacetimeDBClient("localhost:3000", "graftkit")
client.subscribe(["SELECT * FROM AgentState"])
@client.on("AgentState")
def on_agent_update(row, event):
print(f"Agent {row.agent_id}: {row.status} @ {row.current_phase}")
GRAFTKIT Use Cases
| Use Case | Tables | Reducers |
|---|
| Agent coordination | AgentState, TaskQueue | claim_task, complete_task |
| Pipeline progress | GraftlinePhase, PhaseMetrics | advance_phase, log_metric |
| Live dashboard | SessionStats, EventStream | emit_event, update_stats |