Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
Remaining industry demo datasets — implementation plan
Spec / source: .ai/specs/2026-08-13-remaining-industry-datasets.md
Research: .ai/research/2026-08-13-remaining-industry-datasets.md
Branch: feat/onboarding-templates
Progress
- Task 1: Add the new foundation/production spec types
- Task 2: Move satellite's tier-1 content into its data slice
- Task 3: Make
tiers/01-foundation.tsread the dataset instead of its own literals - Task 4: Dataset-drive the two job ref keys in
tiers/06-production.ts - Task 5: Delete the dead
Dataset.companyNamefield - Task 6: GATE — prove satellite's seeded output is unchanged
- Task 7: Recover the robotics foundation + items slices from the stash
- Task 8: Write the nine remaining robotics slices
- Task 9: Register
roboticsand seed-verify it - Task 10: Write the
precisiondataset - Task 11: Write the
motordataset - Task 12: End-to-end verification across all four datasets
- Task 13: Refresh the docs
Dependencies
- Tasks 1 → 2 → 3 → 6 are a strict chain. Task 4 and Task 5 are independent of 2/3 and may run in parallel with them, but all of 1–5 must land before Task 6.
- Task 6 is a hard gate. Do not start Task 7 until it passes. If satellite's counts changed, the refactor dropped rows and must be fixed first — that is the whole point of doing satellite before robotics.
- Task 7 → 8 → 9.
- Tasks 10 and 11 are independent of each other and both depend only on Task 9 (which proves the engine accepts a second dataset). They may run as parallel subagents.
- Task 12 depends on 9, 10, 11. Task 13 last.
Environment notes
- The local Supabase stack must be up. If
pnpm db:seed:devfails withSELF_SIGNED_CERT_IN_CHAINorFailed to create user: fetch failed, your local certificate chain is the problem. Point Node at the local CA withNODE_EXTRA_CA_CERTS=/path/to/local-ca.pem, or fix the chain. Do not disable certificate validation. - To query the database directly:
DBURL=$(grep -h '^SUPABASE_DB_URL=' .env.local .env 2>/dev/null | head -1 | cut -d= -f2- | tr -d '"') psql "$DBURL" -c "<sql>" - Never rebuild the database. If a migration seems needed, STOP and report — this plan requires none.
journalsurvives the dev wipe (tiers/09-accounting.tsskips an entry whosejournalEntryIdalready exists). When re-seeding to check an accounting change, delete the rows first:psql "$DBURL" -c "DELETE FROM \"journalLine\" WHERE \"companyId\"='<id>'; DELETE FROM journal WHERE \"companyId\"='<id>';"
Rules that apply to every task
These are established branch conventions. Violating any of them is a defect, not a style choice.
- No JavaScript
Dateanywhere underpackages/database/src/datasets/, and noCURRENT_DATEin a tier's SQL. Every date is a signedDayOffsetresolved againstctx.anchorviadates.ts. Nothing enforces this automatically —@carbon/checksdoes not scanpackages/database/src/**. - Never write a literal primary key.
externalLinkandperiodare keyed onidalone, so a fixed literal collides on the second company seeded into the same database. Let the column default mint it and read it back withinsertId. - Journal lines must balance. A positive amount on a Revenue account IS the credit. Asset
+X/ Revenue+Xbalances; Revenue-Xreads as a second debit and blocks period close. - New content goes in
data/<key>/only. The tiers are shared, industry-agnostic code. The only tier edits in this plan are Tasks 3 and 4, which remove industry content. - Comments: one line, only where a future dev genuinely needs the why. No banners, no narration of the change.
Task 1: Add the new foundation/production spec types
Depends on: none Files:
- Modify:
packages/database/src/datasets/types.ts— add five new spec types, extendFoundationDataandProductionData
Steps:
- Add these exported types next to the other foundation specs (near
ContractorSpec, around line 85):
export type ShiftSpec = {
name: string;
/** "HH:MM:SS", plant-local wall clock. */
startTime: string;
endTime: string;
monday?: boolean;
tuesday?: boolean;
wednesday?: boolean;
thursday?: boolean;
friday?: boolean;
saturday?: boolean;
sunday?: boolean;
};
export type PlantSpec = {
name: string;
addressLine1: string;
city: string;
stateProvince: string;
postalCode: string;
countryCode: string;
timezone: string;
};
export type WarehouseSpec = {
/** ctx.refs.warehouses key, and what ShelfSpec.warehouse references. */
key: string;
name: string;
requiresPick?: boolean;
requiresPutAway?: boolean;
requiresBin?: boolean;
};
export type ShelfSpec = {
/** The exact string openingStock[].shelf and the inventory count reference. */
name: string;
/** WarehouseSpec.key this shelf lives in. */
warehouse: string;
/** One of FoundationData.storageTypes. */
storageType: string;
/** Another ShelfSpec.name this nests under, for racking rows. */
parent?: string;
};
export type PrinterRouteSpec = {
name: string;
format: string;
printerUrl: string;
};
export type ContractorAgencySpec = {
name: string;
/** One of FoundationData.supplierTypes. */
type: string;
phone: string;
};
- Extend
FoundationData(currentlytypes.ts:92-113) with these fields, and removebinLevels(the explicitshelveslist replaces it):
plant: PlantSpec;
shifts: ShiftSpec[];
warehouses: WarehouseSpec[];
storageTypes: string[];
shelves: ShelfSpec[];
printerRoute: PrinterRouteSpec | null;
/** Must be one of shippingMethods; applied to every customer and supplier. */
defaultShippingMethod: string;
contractorAgency: ContractorAgencySpec | null;
/** Billing address used for every customer and supplier location. */
partyAddressCity: string;
partyAddressStateProvince: string;
partyAddressPostalCode: string;
partyAddressCountryCode: string;
- Extend
ProductionData(currentlytypes.ts:504-509) with the two job keys tier 6 currently hard-codes:
export type ProductionData = {
jobs: JobSpec[];
shifts: ShiftEventSpec[][];
genealogyInputs: GenealogyInputSpec[];
genealogyAssembly: GenealogyAssemblySpec;
/** JobSpec.key whose operations get production events. */
eventsJobKey: string;
/** JobSpec.key the as-built genealogy hangs off. */
genealogyJobKey: string;
};
Note ProductionData.shifts is ShiftEventSpec[][] (production event blocks) and is unrelated to the new FoundationData.shifts (shift table rows). Do not merge them.
Verify:
pnpm exec turbo run typecheck --filter=@carbon/database 2>&1 | tail -20
# Expected: failures ONLY in data/satellite/*.ts and tiers/*.ts for the new
# required fields — those are fixed in Tasks 2-4. No errors in types.ts itself.
Out of scope: Do not touch SalesData, PurchasingData, QualityData or any other slice type. Do not make the purchasing-RFQ slice optional — that is deliberately deferred.
Task 2: Move satellite's tier-1 content into its data slice
Depends on: Task 1 Files:
- Modify:
packages/database/src/datasets/data/satellite/foundation.ts— add the new consts and wire them intosatelliteFoundation
Steps:
- Add these exported consts. Every value is copied verbatim from
tiers/01-foundation.tsso satellite's output does not change — do not "improve" any of them.
export const PLANT: PlantSpec = {
name: "Manufacturing Plant",
addressLine1: "4500 Space Commerce Drive",
city: "Houston",
stateProvince: "TX",
postalCode: "77058",
countryCode: "US",
timezone: "America/Chicago"
};
export const SHIFTS: ShiftSpec[] = [
{
name: "Day Shift",
startTime: "06:00:00",
endTime: "14:30:00",
monday: true, tuesday: true, wednesday: true, thursday: true, friday: true
},
{
name: "Swing Shift",
startTime: "14:30:00",
endTime: "23:00:00",
monday: true, tuesday: true, wednesday: true, thursday: true, friday: true
}
];
export const WAREHOUSES: WarehouseSpec[] = [
{ key: "Main", name: "Main Warehouse", requiresPick: true, requiresPutAway: true, requiresBin: true },
{ key: "RMA", name: "RMA / Return" },
{ key: "QC", name: "QC Hold", requiresBin: true }
];
export const STORAGE_TYPES = ["Shelf", "Bin", "Rack"];
export const PRINTER_ROUTE: PrinterRouteSpec = {
name: "Main Label Printer",
format: "zpl",
printerUrl: "http://192.168.1.50:9100"
};
export const CONTRACTOR_AGENCY: ContractorAgencySpec = {
name: "Orbital Staffing",
type: "Services",
phone: "+1-281-555-1100"
};
- Replace
BIN_LEVELSwith an explicitSHELVESlist that reproduces exactly what the tier generates today: oneAisle-Arack, thenA{1..3}-{L1,L2,L3}bins under it, then the clean-room shelf. That is 1 + 9 + 1 = 11 entries:
export const SHELVES: ShelfSpec[] = [
{ name: "Aisle-A", warehouse: "Main", storageType: "Rack" },
{ name: "A1-L1", warehouse: "Main", storageType: "Bin", parent: "Aisle-A" },
{ name: "A1-L2", warehouse: "Main", storageType: "Bin", parent: "Aisle-A" },
{ name: "A1-L3", warehouse: "Main", storageType: "Bin", parent: "Aisle-A" },
{ name: "A2-L1", warehouse: "Main", storageType: "Bin", parent: "Aisle-A" },
{ name: "A2-L2", warehouse: "Main", storageType: "Bin", parent: "Aisle-A" },
{ name: "A2-L3", warehouse: "Main", storageType: "Bin", parent: "Aisle-A" },
{ name: "A3-L1", warehouse: "Main", storageType: "Bin", parent: "Aisle-A" },
{ name: "A3-L2", warehouse: "Main", storageType: "Bin", parent: "Aisle-A" },
{ name: "A3-L3", warehouse: "Main", storageType: "Bin", parent: "Aisle-A" },
{ name: "CleanRoom", warehouse: "Main", storageType: "Shelf" }
];
The old generator produced the storage unit named Clean Room Shelf under the ref key CleanRoom. The new model uses one name for both, so the storage unit is now named CleanRoom. That is an intentional, cosmetic rename; note it in the Task 6 report rather than treating it as a regression. Ref keys are unchanged, so data/satellite/inventory.ts needs no edit.
Delete the
BIN_LEVELSconst and itsbinLevels:line fromsatelliteFoundation.Add to
satelliteFoundation:plant: PLANT,shifts: SHIFTS,warehouses: WAREHOUSES,storageTypes: STORAGE_TYPES,shelves: SHELVES,printerRoute: PRINTER_ROUTE,defaultShippingMethod: "UPS Ground",contractorAgency: CONTRACTOR_AGENCY,partyAddressCity: "Houston",partyAddressStateProvince: "TX",partyAddressPostalCode: "77058",partyAddressCountryCode: "US".Import the new types from
../../types.ts.
Verify:
pnpm exec turbo run typecheck --filter=@carbon/database 2>&1 | tail -20
# Expected: no remaining errors in data/satellite/foundation.ts.
# Errors in tiers/01-foundation.ts and tiers/06-production.ts are expected until Tasks 3-4.
Out of scope: Do not change any existing const in this file (DEPT_NAMES, PROCESSES, CUSTOMERS, SUPPLIERS, PROCEDURES, …). Do not change data/satellite/inventory.ts.
Task 3: Make tiers/01-foundation.ts read the dataset instead of its own literals
Depends on: Task 2 Files:
- Modify:
packages/database/src/datasets/tiers/01-foundation.ts
Steps:
Shifts (replaces lines 15–38): loop
data.shifts, inserting oneshiftrow each withlocationIdand the day booleans defaulting tofalsewhen absent. Publish each asctx.refs.shifts[spec.name] = id. Note: the old code published the keysDayandSwing; a grep confirmsrefs.shiftsis read nowhere, so changing the key shape is safe. If that grep now shows a reader, STOP and report.Plant location (replaces lines 64–74): build the
locationinsert fromdata.plant. Keepctx.refs.locations.Plant/.HQand theemployeeJobUPDATE exactly as they are.Warehouses (replaces lines 87–104): loop
data.warehouses, insert withlocationId: plantIdand the three boolean flags defaulting tofalse, publishctx.refs.warehouses[w.key] = id.Storage types + shelves (replaces lines 106–142): insert one
storageTypeperdata.storageTypesentry into a localMap<string, string>. Then insertdata.shelvesin array order so a parent always precedes its children, resolvingparentIdfromctx.refs.shelves[spec.parent]andwarehouseIdfromctx.refs.warehouses[spec.warehouse]. Publishctx.refs.shelves[spec.name] = id. Useneed()from../sql.tsfor the warehouse, the storage type and the parent — a mismatch must be a loud error, because today it silently drops all opening stock. If aparentis named that has not been inserted yet, throw with a message naming both shelves.Default shipping method (lines 253 and 309): replace both
ctx.refs.shippingMethods["UPS Ground"]reads withneed(ctx.refs.shippingMethods, data.defaultShippingMethod).Party addresses (lines 269–275 and 325–331): replace the hard-coded
Houston/TX/77058/USwithdata.partyAddressCityetc. LeaveaddressLine1: "See parent"and"See supplier record"as they are — they are generic.Contractor agency (lines 366–372): if
data.contractorAgencyis null, skip the agency and the whole contractor loop. Otherwise insert the supplier from the spec, withsupplierTypeId: need(ctx.refs.misc, \stype:${data.contractorAgency.type}`), and publishctx.refs.suppliers[data.contractorAgency.name]`.Printer route (lines 398–404): skip entirely when
data.printerRouteis null; otherwise build the insert from the spec.
Verify:
pnpm exec turbo run typecheck --filter=@carbon/database 2>&1 | tail -20
# Expected: no errors in tiers/01-foundation.ts.
grep -nE "Houston|Space Commerce|Orbital Staffing|192\.168|UPS Ground|Day Shift|Swing Shift|Main Warehouse|Clean Room|binLevels" packages/database/src/datasets/tiers/01-foundation.ts
# Expected: no output at all.
Out of scope: Do not touch the payment-term ILIKE '%net%30%' lookup, currencyCode: "USD", supplierProcess.leadTime: 5, or contractor.hoursPerWeek: 40. Those are deferred cleanup and changing them here would muddy the Task 6 baseline diff.
Task 4: Dataset-drive the two job ref keys in tiers/06-production.ts
Depends on: Task 1 Files:
- Modify:
packages/database/src/datasets/tiers/06-production.ts— lines 101 and 163 - Modify:
packages/database/src/datasets/data/satellite/production.ts— add the two new fields
Steps:
- At
06-production.ts:101, replaceneed(ctx.refs.documents, "job:in-progress")withneed(ctx.refs.documents, `job:${data.eventsJobKey}`). - At
06-production.ts:163, replace the same literal withneed(ctx.refs.documents, `job:${data.genealogyJobKey}`). - In
data/satellite/production.ts, addeventsJobKey: "in-progress"andgenealogyJobKey: "in-progress"to the exportedsatelliteProductionobject, preserving today's behaviour exactly.
Verify:
grep -n "job:in-progress" packages/database/src/datasets/tiers/06-production.ts
# Expected: no output.
pnpm exec turbo run typecheck --filter=@carbon/database 2>&1 | tail -10
# Expected: no errors in tiers/06-production.ts or data/satellite/production.ts.
Out of scope: Do not change 07-quality.ts, which reaches jobs through data/satellite/quality.ts:14's own ref string — that is already dataset-driven.
Task 5: Delete the dead Dataset.companyName field
Depends on: none Files:
- Modify:
packages/database/src/datasets/types.ts— removecompanyName: string;(line 681) - Modify:
packages/database/src/datasets/data/satellite/index.ts— removecompanyName: "Orbital Systems Inc.",
Steps:
- Confirm it is genuinely unread first:
If this returns any reader, STOP and report — do not delete.grep -rn "companyName" packages/database/src/datasets packages/jobs/src apps/erp/app --include=*.ts --include=*.tsx | grep -v "data/satellite/index.ts" | grep -v "types.ts:681" - Remove both lines. Keep the company's identity in the file's doc comment so the story is still readable.
Verify:
pnpm exec turbo run typecheck --filter=@carbon/database --filter=@carbon/jobs --filter=erp 2>&1 | tail -6
# Expected: "Tasks: 3 successful, 3 total"
Out of scope: Dataset.label and Dataset.key are both live — do not remove them.
Task 6: GATE — prove satellite's seeded output is unchanged
Depends on: Tasks 1–5 Files: none (verification only)
Steps:
- Seed satellite into a clean company and capture the printed counts:
pnpm db:seed:dev -- --email [email protected] --dataset satellite 2>&1 | tee /tmp/satellite-after.txt - Diff the
Seeded row countsblock against the committed baseline:
Expected: no output. Any difference means the refactor dropped or duplicated rows — fix it before going further.sed -n '/Seeded row counts/,/^$/p' /tmp/satellite-after.txt > /tmp/counts-after.txt diff <(grep -E "^ [a-z]" .ai/runs/2026-08-13-seed-baseline.txt) <(grep -E "^ [a-z]" /tmp/counts-after.txt) - Check the structural sums that counts alone miss, per
.ai/runs/2026-08-13-seed-baseline-structural.txt:methodMaterialcount + quantity sum,methodOperationcount + time sums,salesOrderLinecount + quantity sum. Compare each against that file. - Confirm the shelves resolved — opening stock must not be silently empty:
psql "$DBURL" -c "SELECT count(*) FROM \"itemLedger\" WHERE \"companyId\"='<companyId>';" # Expected: 19, matching the baseline.
If any check fails, STOP and report the exact diff. Do not proceed to Task 7 and do not "fix" the baseline file to match.
Out of scope: Do not edit .ai/runs/2026-08-13-seed-baseline.txt — it is the reference, not an output.
Task 7: Recover the robotics foundation + items slices from the stash
Depends on: Task 6 Files:
- Create:
packages/database/src/datasets/data/robotics/foundation.ts(525 lines, from the stash) - Create:
packages/database/src/datasets/data/robotics/items.ts(746 lines, from the stash)
Steps:
- Restore both files read-only. Do not pop or apply the stash — the working tree has advanced far past it:
Ifmkdir -p packages/database/src/datasets/data/robotics git show "stash@{0}^3:packages/database/src/datasets/data/robotics/foundation.ts" > packages/database/src/datasets/data/robotics/foundation.ts git show "stash@{0}^3:packages/database/src/datasets/data/robotics/items.ts" > packages/database/src/datasets/data/robotics/items.tsstash@{0}is no longer the robotics stash (checkgit stash list— its message must containrobotics dataset), STOP and report rather than restoring the wrong stash. - Delete the one incompatible line in
foundation.ts:structuralSteps: ARM_BASE_STEPS_V2,(was line 513). Keep theARM_BASE_STEPS_V2const itself —PROCEDURESv2 references it. - Add the fields Task 1 introduced to
roboticsFoundation, with robotics-appropriate values (this is a robot-arm OEM, not an aerospace shop — a plausible Midwest US automation company). Supply:plant,shifts,warehouses,storageTypes,shelves,printerRoute,defaultShippingMethod(must be one of its ownshippingMethods),contractorAgency(whosetypemust be one of its ownsupplierTypes), and the fourpartyAddress*fields. Theshelveslist must contain every shelf name thatdata/robotics/inventory.tswill later reference in Task 8 — get these two consistent or opening stock is dropped.
Verify:
grep -n "structuralSteps" packages/database/src/datasets/data/robotics/foundation.ts
# Expected: no output.
grep -c "readableId:" packages/database/src/datasets/data/robotics/items.ts
# Expected: 34 (11 buy + 6 materials + 2 consumables + 2 tools + 1 service + 11 make, plus method references).
Out of scope: Do not restyle or renumber the recovered content. It is at satellite parity by design; changing item counts breaks the coverage contract.
Task 8: Write the nine remaining robotics slices
Depends on: Task 7 Files:
- Create, each mirroring its
data/satellite/counterpart:inventory.ts,sales.ts,purchasing.ts,production.ts,quality.ts,change-orders.ts,accounting.ts,workflows.ts,planning.ts,index.ts— all underpackages/database/src/datasets/data/robotics/ - Copy from (precedent): the same-named file under
packages/database/src/datasets/data/satellite/
Steps:
- For each slice, open satellite's equivalent and write the robotics version with the same structure and cardinality, substituting robotics items, customers and suppliers. Satellite's line counts for reference: workflows 511, sales 290, production 195, purchasing 194, accounting 114, inventory 77, change-orders 71, planning 70, quality 30, index 34.
index.tsmirrorsdata/satellite/index.ts: assemble all eleven slices into an exportedDatasetwithkey: "robotics",label: "Robotics OEM",industryId: "robotics_oem". There is nocompanyNamefield (Task 5 removed it).- Slice-specific requirements:
- inventory — every
openingStock[].shelfmust exactly match aShelfSpec.namefrom Task 7. Buy parts get stock; Make parts do not. - production — set
eventsJobKeyandgenealogyJobKeyto realJobSpec.keyvalues from this dataset's ownjobsarray.shiftsisShiftEventSpec[][], indexed by operation position; supply at least two blocks. - accounting — the journal entry must balance: Asset
+Xand Revenue+X, both positive. Every date is aDayOffset. - sales / purchasing — no
id:field on any external-link spec; the column default mints it. - quality — an NCR's
openDateOffsetmust be on or after the released date of the job it references. Satellite currently violates this (quality.ts:9is-312vs a job released at-297); do not copy that mistake. - planning —
promisedDateOffsetmust land inside the 48-week horizon (satellite uses56).
- inventory — every
- Cross-check every
readableId, customer name and supplier name againstdata/robotics/items.tsandfoundation.ts. A typo becomes a silent NULL or a dropped row, not an error.
Verify:
grep -rn "new Date\|CURRENT_DATE" packages/database/src/datasets/data/robotics/
# Expected: no output.
grep -rnE "\"[0-9a-f]{8}-[0-9a-f]{4}-" packages/database/src/datasets/data/robotics/
# Expected: no output (no UUID literals).
pnpm exec turbo run typecheck --filter=@carbon/database 2>&1 | tail -6
# Expected: "Tasks: 1 successful, 1 total"
Out of scope: Do not modify any tier or any satellite file. If a robotics story genuinely cannot be expressed through the existing slice types, STOP and report rather than widening a type — that is a spec change.
Task 9: Register robotics and seed-verify it
Depends on: Task 8 Files:
- Modify:
packages/database/src/datasets/types.ts—DatasetKeybecomes"satellite" | "robotics" - Modify:
packages/database/src/datasets/index.ts— importrobotics, add toDATASETS - Create:
.ai/runs/2026-08-13-robotics-baseline.txt
Steps:
- Widen the union and the registry.
- Seed robotics into a fresh company:
pnpm db:seed:dev -- --email [email protected] --dataset robotics 2>&1 | tee /tmp/robotics.txt - Save the printed
Seeded row countsblock to.ai/runs/2026-08-13-robotics-baseline.txt. - Check every acceptance criterion for this dataset:
# No table at zero, counts within ~10% of satellite's sed -n '/Seeded row counts/,/^$/p' /tmp/robotics.txt # Journal balances psql "$DBURL" -c "SELECT \"journalEntryId\",\"totalDebits\",\"totalCredits\" FROM \"journalEntries\" WHERE \"companyId\"='<roboticsCompanyId>';" # Expected: totalDebits = totalCredits for every row. # Opening stock landed psql "$DBURL" -c "SELECT count(*) FROM \"itemLedger\" WHERE \"companyId\"='<roboticsCompanyId>';" # Expected: non-zero. # No satellite identity leaked in psql "$DBURL" -c "SELECT count(*) FROM location WHERE \"companyId\"='<roboticsCompanyId>' AND city='Houston';" # Expected: 0.
If seeding throws, report the exact error and the tier it failed in. A need() throw means a ref key the dataset did not define; a silently empty table means a name mismatch.
Out of scope: No migration — robotics_oem already exists as an industry row.
Task 10: Write the precision dataset
Depends on: Task 9 Files:
- Create:
packages/database/src/datasets/data/precision/— all eleven slices +index.ts - Modify:
packages/database/src/datasets/types.ts,packages/database/src/datasets/index.ts— register"precision" - Create:
.ai/runs/2026-08-13-precision-baseline.txt
Steps:
- Story: Meridian Precision Works, a contract machine shop — CNC milling/turning plus sheet-metal fabrication, customer-supplied prints, short lead times, outside processing (anodize, heat treat) as a first-class routing step.
key: "precision",label: "Precision Manufacturing",industryId: "precision_manufacturing". - Follow every step, requirement and constraint from Tasks 7–9, substituting this story. All eleven slices, satellite-parity volume, no empty slice.
- This dataset is data-only — the engine already accepts a second dataset by now. If it does not, STOP and report; that means Tasks 3–4 missed a coupling.
Verify: same command set as Task 9, with --dataset precision and this dataset's company id.
Out of scope: No tier edits. No migration.
Task 11: Write the motor dataset
Depends on: Task 9 Files:
- Create:
packages/database/src/datasets/data/motor/— all eleven slices +index.ts - Modify:
packages/database/src/datasets/types.ts,packages/database/src/datasets/index.ts— register"motor" - Create:
.ai/runs/2026-08-13-motor-baseline.txt
Steps:
- Story: Torque Dynamics LLC, precision motor assemblies — stator / rotor / housing / shaft sub-assemblies, batch-tracked windings and magnets, a tighter inspection regime than the other three.
key: "motor",label: "Motor Assembly",industryId: "automotive_precision". - Otherwise identical process to Task 10.
Verify: same command set as Task 9, with --dataset motor.
Out of scope: No tier edits. No migration.
Task 12: End-to-end verification across all four datasets
Depends on: Tasks 9, 10, 11 Files: none (verification only)
Steps:
- Seed all four into the same database, each into its own company, and confirm no duplicate-key failure:
for d in satellite robotics precision motor; do pnpm db:seed:dev -- --email "[email protected]" --dataset "$d" 2>&1 | tail -3 done - Confirm globally-keyed tables did not collide:
psql "$DBURL" -c "SELECT count(*) AS links, count(DISTINCT id) AS distinct_ids FROM \"externalLink\";" # Expected: links = distinct_ids. psql "$DBURL" -c "SELECT count(*) AS weeks, count(DISTINCT \"startDate\") AS distinct_starts FROM period WHERE \"periodType\"='Week';" # Expected: weeks = distinct_starts = 48 (the advisory lock prevents duplicates). - Confirm each company's journals balance and each has non-zero
itemLedger. - Confirm every industry now resolves to a dataset:
psql "$DBURL" -c "SELECT id, name FROM industry ORDER BY \"sortOrder\";" # Expected: 4 rows, and datasetForIndustry returns non-null for all four. - Run the full check set:
pnpm exec turbo run typecheck --filter=@carbon/database --filter=@carbon/jobs --filter=erp 2>&1 | tail -6 # Expected: "Tasks: 3 successful, 3 total" pnpm exec biome check packages/database/src/datasets 2>&1 | tail -4 # Expected: warnings only, "Found 0 errors" (no error-severity diagnostics). pnpm --filter @carbon/workflows test 2>&1 | tail -6 # Expected: all tests pass. - Browser check: open onboarding, confirm all four industry cards appear, and provision one non-satellite company end to end.
Out of scope: Do not commit until every check above passes.
Task 13: Refresh the docs
Depends on: Task 12 Files:
- Modify:
packages/database/src/datasets/AGENTS.md— four datasets not one; the newFoundationDatafields; shelves are dataset-declared; drop the "Tier 1 hard-codes satellite specifics" rough edge now that it is fixed - Modify:
.claude/rules/onboarding-company-templates.md— the "Adding an industry" section, and the four baseline files - Modify:
packages/database/AGENTS.md— mention the four dataset keys - Move:
.ai/specs/2026-08-13-remaining-industry-datasets.md→.ai/specs/implemented/
Steps:
- Update each file against the code as it now stands — do not describe intent, describe behaviour.
- In
AGENTS.md, replace thebinLevelsmention with the explicitshelvescontract, and state plainly that a shelf name inopeningStockwith no matchingShelfSpecis now a hard error. - Add a
.ai/lessons.mdentry only if something durable was learned that is not already recorded.
Verify:
grep -rn "binLevels\|Houston" packages/database/src/datasets/AGENTS.md .claude/rules/onboarding-company-templates.md
# Expected: no output.
Out of scope: Do not rewrite the parts of these docs that describe the onboarding job, the failure marker, or the transaction model — unchanged by this work.