Back
CTECX / Data Plan

Ledgers before launch.

07Core tables
SQLiteDurable boundary
PLANNot implemented
Design only — no database has been built yet

DeckerGUI coordination runs on durable ledgers. This is the planned schema that makes every persona, workflow, tool call and KPI accountable — the backbone for metered execution and audit trails. Shown here as a design document, ahead of implementation.

personas
-- role-based agent definitions
CREATE TABLE personas (
  id          TEXT PRIMARY KEY,
  slug        TEXT UNIQUE NOT NULL,
  name        TEXT NOT NULL,
  role        TEXT NOT NULL,      -- orchestrator | worker | validator
  scope       TEXT,            -- allowed action scope
  permissions TEXT,            -- fail-closed gate set
  offline     INTEGER DEFAULT 0,
  created_at  INTEGER DEFAULT (unixepoch())
);
agents
-- live agent instances
CREATE TABLE agents (
  id          TEXT PRIMARY KEY,
  persona_id  TEXT NOT NULL REFERENCES personas(id),
  status      TEXT DEFAULT 'idle',
  session     TEXT,            -- SSE hub session
  last_active INTEGER,
  config      TEXT
);
workflows
-- coordinated task chains
CREATE TABLE workflows (
  id         TEXT PRIMARY KEY,
  title      TEXT NOT NULL,
  status     TEXT DEFAULT 'pending',
  owner_agent TEXT REFERENCES agents(id),
  context    TEXT,             -- shared TCR context
  started_at INTEGER,
  finished_at INTEGER
);
tool_calls
-- metered execution record
CREATE TABLE tool_calls (
  id          TEXT PRIMARY KEY,
  workflow_id TEXT REFERENCES workflows(id),
  tool        TEXT NOT NULL,
  `arguments` TEXT,
  `result`    TEXT,
  approved    INTEGER DEFAULT 0,  -- gate outcome
  tokens      INTEGER DEFAULT 0,
  at          INTEGER DEFAULT (unixepoch())
);
ledger_meter
-- per-tenant metering
CREATE TABLE ledger_meter (
  id        TEXT PRIMARY KEY,
  tenant    TEXT NOT NULL,
  key_id    TEXT REFERENCES enterprisely(...),
  usage     INTEGER DEFAULT 0,
  period    TEXT,             -- usage window
  `state`   TEXT DEFAULT 'open'
);
kpi_log
-- auditable metric history
CREATE TABLE kpi_log (
  id       TEXT PRIMARY KEY,
  metric   TEXT NOT NULL,
  value    REAL NOT NULL,
  source   TEXT,              -- emitter | iot | manual
  at       INTEGER DEFAULT (unixepoch())
);
Planned Flow

How records move.

Personarole definition
Agentlive instance · SSE hub
Workflowcoordinated chain · TCR context
Tool callsgated · metered
Ledgerdurable account of everything

This schema is a plan, reviewed against the coordination runtime before any bytes are committed. When it ships it will run on node:sqlite durable ledgers with WAL, and every table above becomes auditable history.