Seeds Reference
Seeds are JSON row files that materialize an app's database contract — types, roles, link types, agents, prompt configs, pipelines, triggers — at install time. They are distinct from migrations: migrations are SQL and change schema; seeds are data and are applied by the app installer.
Where seeds live
| Location | Contents | Format |
|---|---|---|
custom/apps/<slug>/seed/*.json | app-owned rows, declared in manifest.json seed[] | JSON array of row objects |
.framework/seeds/ | framework-owned seed payloads (e.g. .framework/seeds/types/spine_instance.json, .framework/seeds/link_types/account_cli_instances.json) | single JSON object per file |
.framework/migrations/ | system rows written by SQL (003_core_system_data.sql seeds roles/types/apps; 053_builtin_action_seeds.sql seeds public.actions) | SQL INSERT … ON CONFLICT DO NOTHING |
When seeds run
Seeds are applied by seedApp in .framework/cli/commands/install-app.ts:
| Command | Runs seeds? |
|---|---|
install-app <pkg> | yes — after runMigrations succeeds, unless --no-seed. Migration failure aborts before seeding; without SUPABASE_URL/SUPABASE_DB_PASSWORD only --no-seed installs may proceed |
seed-app <slug> | yes — seed block only, no npm, no file changes |
update-db-app <slug> | no — upserts the apps row and syncs registration only |
update-app <pkg> | no — refreshes files from npm only |
migrate | no — migrations apply SQL only; system seeds inside migrations run as SQL |
uninstall-app <pkg> | no — removes files and the npm dependency; it does not delete seeded rows |
Requires SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY; seeding uses the service-role client and bypasses RLS.
Apply order
Entries are stable-sorted by SEED_TABLE_ORDER (.framework/cli/commands/install-app.ts), regardless of declaration order:
rolestypespermissions_patchentries (rank 1.5 — always after types)link_typesactionsai_agentsprompt_configspipelinestriggers- unknown tables — last, in declared order
Ordering exists so dependents resolve: a triggers row's pipeline_slug is looked up in public.pipelines (scoped to this app's app_id) and rewritten to pipeline_id, and a pipelines row's stages[].stage_type is validated against public.actions — so a bad stage type fails at install, not at first trigger fire.
Per-entry behavior
Each record is upserted into entry.table with onConflict: entry.conflict.
inject_app_id(defaulttrue): stampsapp_idon every row. Setfalsefor global rows —typesseeds useconflict: "kind,slug"withinject_app_id: falsebecause type slugs are global, not per-app.ignore_duplicates: rows that conflict are skipped, not updated. Always forced on fortypes(the read-then-compare below decides the real outcome) and opt-in per entry viaignore_duplicates: true.typesrows are never silently overwritten. Before each types upsert the existing row is read: an identicaldesign_schemaskips cleanly; a differing one throws — unless the slug is declared inmanifest.owned_typesand--reconcile-owned-typeswas passed, which prompts[U]pdate / [K]eepand merges (seedwins shared fields, DB-only fields are preserved) with a regeneratedvalidation_schema.permissions_patchrows ({kind, slug, record_permissions}) replacedesign_schema.record_permissionson an existing type after a[R]eplace / [K]eepprompt; grant lists may only containcreate/read/update/delete. Aseed/type_permissions.jsonfile is auto-declared when no patch entry exists.typesseeds get a freshvalidation_schemagenerated fromdesign_schemaat apply time — authordesign_schemaonly.pipelinesseeds are validated before upsert: everystages[].stage_typemust exist inpublic.actions;send_notification/send_emailconfig.recipientsmust berole:<slug>,self,owner,watchers, a person UUID, or (email only) an email address.triggersseeds may usepipeline_slug; it is resolved topipeline_idwithin the app's pipelines and removed before upsert.
Failure model
Seeding is fail-closed: a malformed manifest, a missing declared seed file, an unparseable file, a non-array file, a missing referenced type/pipeline/role, or any row-write error throws and aborts the run. Files not declared in manifest.seed are skipped silently (except the auto-added type_permissions.json). All validation runs before the database client is created, so bad input produces zero writes.
After all entries apply, syncAppRegistration writes the resolved registration policy to apps.config.registration and spine.config.json.
Authoring checklist
- [ ] Every
seed[]entry'sfileexists inside the app dir and parses as a JSON array of objects - [ ]
conflictnames real unique columns (slugfor roles;kind,slugfor types;app_id,slugfor app-scoped config tables) - [ ]
typesrows have a completedesign_schema— see Design Schema;validation_schemais generated - [ ]
inject_app_id: falseontypesentries - [ ]
pipeline_slugused in trigger seeds; pipelines seeded (they always apply first) - [ ]
owned_typesdeclared in the manifest for any type the app must reconcile - [ ]
manifest.seedomitted only when the conventional trio (seed/roles.json,seed/types.json,seed/link-types.json) covers everything
Related files
.framework/cli/commands/install-app.ts—seedApp,SEED_TABLE_ORDER,reconcileOwnedType,validatePipelineSeedStages.framework/cli/commands/migrate.ts— migration runner (SQL only)- App Manifest · CLI · Design Schema