Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
// The CoS agent records in the runtime working set (running agents plus finished
// ones not yet archived to data/cos/agents/<date>/), one row per agent. `agent`
// is the record's exact JSON text (`json`, not `jsonb`, so key order and bytes
// round-trip); the other columns are projections for queries. `seq` keeps the
// map's insertion order. `cos_agent_store.version` bumps on every write and a
// write names the version it was planned against, so a stale cache is refused.
// Machine-local, never federated.
export const cosAgentsDdl = [
`CREATE TABLE IF NOT EXISTS cos_agents (
agent_id TEXT COLLATE "C" PRIMARY KEY,
seq BIGINT GENERATED BY DEFAULT AS IDENTITY,
task_id TEXT,
status TEXT NOT NULL,
started_at TIMESTAMPTZ,
completed_at TIMESTAMPTZ,
pid INTEGER,
agent JSON NOT NULL
)`,
`CREATE INDEX IF NOT EXISTS idx_cos_agents_seq ON cos_agents (seq)`,
`CREATE INDEX IF NOT EXISTS idx_cos_agents_status ON cos_agents (status)`,
`CREATE TABLE IF NOT EXISTS cos_agent_store (
id SMALLINT PRIMARY KEY CHECK (id = 1),
version BIGINT NOT NULL DEFAULT 0
)`,
];