Skip to content

Code-owned configuration

Forms and configurationSDKconfigSourceresetrolesworkerstopicsagentsscanSchemes

Set configSource to code and every declared role, workflow, topic, agent and scan scheme is diffed and applied on each boot from git.

The situation

Local development reseeds on every docker compose down -v. Production has a database that is years old. A role’s form changed in a pull request, and production should match the commit without anyone clicking through an admin screen.

The recipe

start.ts
const lt = await start({
database: { connectionString: process.env.DATABASE_URL },
configSource: 'code',
roles: ROLES,
workers: WORKERS,
topics: [
{ topic: 'app.orders.created', description: 'A new order.' },
{ topic: 'ops.notes', description: 'Free-form notes.', reset: false },
],
agents: AGENTS,
scanSchemes: SCAN_SCHEMES,
});
configSource Behavior
'db' (default) Declarations seed insert-if-absent; the database owns each record afterward and drift is logged as a warning
'code' Declarations are compared and applied on every boot; dashboard edits to declared surfaces are replaced at the next deploy

reset on any entry overrides the dial in either direction: ops.notes above stays editable by admins. The domain dictionary’s override is mcp.domainDictionaryReset.

The guarantee

An unchanged declaration is a no-op: no write, no version bump. Only declared fields are written; memberships, run history and other runtime state are left alone. Role schemas advance through the same versioned write path the dashboard uses, so in-flight rows keep their pinned edition. Concurrently booting containers serialize the pass on an advisory lock, and every upsert carries an IS DISTINCT FROM guard. See Code-owned configuration.