/prometheus-skill-pack:entity-realtime-surreal-livefrom prometheus-skill-pack
Wire SurrealDB LIVE SELECT subscriptions into a Prometheus entity graph via createSurrealLiveAdapter. Covers select-then-live seeding, CREATE/UPDATE/DELETE action mapping, reconnect with exponential backoff, and optional checkpoint-based replay on reconnect.
Ships in prometheus-skill-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Hook up SurrealDB's live-query stream to the Prometheus entity graph.
surrealdb.js / surrealdb).useEntity, useEntityList,
useGQLEntity) to update in real time as rows change server-side, no
per-component subscription wiring.If you're on ElectricSQL + PGlite, see entity-realtime-channel /
entity-realtime-local-first instead.
LIVE SELECT per registered table, opened at app startup and
re-opened automatically after reconnects.select-then-live mode, default) so the graph is
populated before the first render — or skip the seed entirely with
live-only mode.EntityChange mapping handled inside the adapter; each
emitted ChangeSet carries affectedListKeys so derived lists refresh.checkpointStore + checkpointField to replay missed updates
after a disconnect.// app-init.ts
import {
createSurrealLiveAdapter,
getRealtimeManager,
type ChannelConfig,
type SurrealLike,
type SurrealTableConfig,
} from "@prometheus-ags/prometheus-entity-management";
// your already-connected Surreal client (see surreal-client.ts in your app)
declare const db: SurrealLike;
const tables: SurrealTableConfig[] = [
{ type: "client", table: "client" },
{ type: "deal", table: "deal" },
{ type: "contact", table: "contact" },
];
const adapter = createSurrealLiveAdapter({
surreal: db,
tables,
initialQueryStrategy: "select-then-live",
});
const channels: ChannelConfig[] = tables.map(({ type }) => ({ type }));
getRealtimeManager().register(adapter, channels);
That's it — every consumer of useEntity, useEntityList, etc. now
receives live updates as the underlying rows change.
Scope tenancy at the connection layer: give each tenant its own
authenticated Surreal client (namespace / database / credentials) and its own
adapter instance with a distinct name, and re-register on tenant change:
import {
createSurrealLiveAdapter,
type SurrealLike,
type SurrealTableConfig,
} from "@prometheus-ags/prometheus-entity-management";
declare const tenantId: string;
declare const tenantDb: SurrealLike; // client connected with this tenant's credentials
declare const tenantTables: SurrealTableConfig[];
const tenantAdapter = createSurrealLiveAdapter({
name: `surreal-live:${tenantId}`,
surreal: tenantDb,
tables: tenantTables,
});
The adapter pulls entity ids via idField (default "id"). When the
SurrealDB row shape differs from your entity model (for example snake_case
columns), map changes with the normalize argument to
RealtimeManager.register(adapter, channels, normalize) rather than inside
components.
For offline-tolerant apps, supply a checkpointStore. The adapter persists
the latest checkpointField value it has seen (default "updated_at"), and
on reconnect runs SELECT * FROM <table> WHERE <field> > <stored> per table
before re-attaching the live stream:
import {
createSurrealLiveAdapter,
type SurrealCheckpointStore,
type SurrealLike,
type SurrealTableConfig,
} from "@prometheus-ags/prometheus-entity-management";
declare const db: SurrealLike;
declare const tables: SurrealTableConfig[];
declare const localforage: {
getItem<T>(key: string): Promise<T | null>;
setItem(key: string, value: string): Promise<unknown>;
};
const checkpointStore: SurrealCheckpointStore = {
get: (key) => localforage.getItem<string>(key).then((value) => value ?? undefined),
set: (key, value) => localforage.setItem(key, value).then(() => undefined),
};
const adapter = createSurrealLiveAdapter({
surreal: db,
tables,
checkpointField: "updated_at",
checkpointStore,
});
UPDATE actions to
op: "upsert" (not "update"), because SurrealDB doesn't distinguish
partial vs full updates on the wire. The engine handles upsert
semantics correctly.{id}, sometimes the full
prior row. The adapter pulls id defensively.affectedListKeys performance. List-key lookup is derived per
ChangeSet emit; supply listKeyResolver to override the default mapping.
Profile in apps with very high update rates; defer optimisation until it
shows up.Canonical behavior reference:
packages/entity-graph-core/src/adapters/surreal-live.test.ts. The
vitest suite uses a hand-rolled fake Surreal client (no live database
needed) and covers every action mapping, reconnect, and replay scenario.
Run from the entity-management repo root:
pnpm test packages/entity-graph-core/src/adapters/surreal-live.test.ts
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub prometheus-ags/prometheus-skill-system --plugin prometheus-skill-pack2 plugins in one repository ship this exact skill · first indexed Nov 27, 2026
218 skills in this plugin
/actor-modelTokio-native actor model pattern for Prometheus AGS projects. Implements actors as tokio tasks communicating via mpsc channels with a typed message enum, enabling safe concurrent state management without shared locks. Used in UAR session management, pk-librarian event broadcasting, and parking-lot scheduler design. Use when a component needs to own state exclusively while serving concurrent callers.
/adversarial-reviewIsolated, cross-model adversarial review of KBD artifacts and change diffs. Dispatches a fresh-context LLM judge over an OpenAI-compatible REST gateway (openai-proxy or `liter-llm api`) with an explicit mandate to find problems — the model that produced an artifact or change is never the model that reviews it. Runs as a pipeline stage inside kbd-assess/analyze/plan (artifact mode) and kbd-execute's single phase-boundary QA step (diff mode, once over the whole phase diff). Findings are severity-bucketed (CRITICAL/WARNING/SUGGESTION) and the judge's own report is screened by sycophancy-correction before it is surfaced.
/agent-team-creatorCreate, revise, package, and deploy agent-team definitions with staged questions and native exports for UAR, Codex, Claude Code, Copilot, Kimi Code, MiniMax CLI, OpenCode and DeepSeek. Use for team definition and catalog lifecycle; use agent-team-manage for active runtime task state.