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.
Defense UAS demo dataset — implementation plan
Spec / source: .ai/specs/2026-10-26-defense-uas-demo-dataset.md
Branch: feat/defense-uas-dataset (in the user's checkout /Users/aashu/work/carbon/carbon, never a worktree)
Mode: autonomous. Never run git commit: the user's standing rule forbids it without permission.
Progress
- Task 1: Create the branch
- Task 2: Add the two optional seed fields (types, tiers 01 and 10, validator, tests)
- Task 3: Align the model's product names with the BOM and export steps.json
- Task 4: Build the assembler and bake the model
- Task 5: Copy satellite into
data/defenseand register the dataset - Task 6: Add the industry migration and the onboarding icon
- Task 7: Rewrite foundation, items and the assembly
- Task 8: Rewrite inventory, sales and purchasing
- Task 9: Rewrite production, quality and change orders
- Task 10: Rewrite accounting, ops, workflows and planning
- Task 11: Write the thumbnails
- Task 12: Update the docs
- Task 13: End-to-end verification (database checks passed in the follow-up run)
Dependencies
- Task 2 needs Task 1. Tasks 3 and 4 are independent of Task 2 (they work outside the repo until Task 4's last step).
- Task 5 needs Task 2. Task 6 needs Task 5.
- Task 7 needs Tasks 4 and 5. Tasks 8, 9 and 10 need Task 7 and run in that order (later slices name earlier records).
- Task 11 needs Task 7 (it reads the final item list). Task 12 needs Tasks 6 and 7. Task 13 needs all.
Global rules for every task
- 🛑 Before any typecheck, test, build or bake, check memory:
vm_stat. Run one heavy process at a time. - Use
pnpm, nevernpm. - All names are invented. Never write a real customer, person or company name.
- Dates in a dataset are
DayOffsetnumbers. Never use JavaScriptDateorCURRENT_DATE.
Task 1: Create the branch
Depends on: none Files: none
Steps:
- Run
git -C /Users/aashu/work/carbon/carbon status --short. If it lists files, STOP the branch step and report them. - Run
git -C /Users/aashu/work/carbon/carbon switch -c feat/defense-uas-dataset.
Verify:
git -C /Users/aashu/work/carbon/carbon branch --show-current
# Expected: feat/defense-uas-dataset
Out of scope: commits, pushes.
Task 2: Add the two optional seed fields
Depends on: 1 Files:
- Modify:
packages/database/src/datasets/types.ts—CustomerSpec(line 66),SupplierSpec(line 78),ItemSpec(line 272) - Modify:
packages/database/src/datasets/tiers/01-foundation.ts— the customer-contact address (about line 379) and the supplier-contact address (about line 436) - Modify:
packages/database/src/datasets/tiers/10-ops.ts— afterseedCustomFields(line 131) - Modify:
packages/database/src/datasets/validate.ts— two new rules - Create:
packages/database/src/datasets/validate-seed-extensions.test.ts - Copy from (precedent):
packages/database/src/datasets/validate-assembly.test.ts
Steps:
- In
types.ts, add this type aboveCustomerSpec:/** A party address that overrides `foundation.partyAddress*` (a foreign customer or supplier). */ export type PartyAddressSpec = { addressLine1: string; city: string; stateProvince: string; postalCode: string; countryCode: string; }; - Add
address?: PartyAddressSpec;toCustomerSpecand toSupplierSpec. - Add to
ItemSpec:/** Values for the item's custom fields, keyed by `CustomFieldSpec.name`. Written into the type table's `customFields`. */ customFieldValues?: Record<string, string | number | boolean>; - In tier 01, at the customer-contact address insert, look up the customer spec by
cc.customer. If it hasaddress, write its five fields. Else keep the currentpartyAddress*values andaddressLine1: "See parent". - Do the same for the supplier-contact address (
sc.supplier, fallbackaddressLine1: "See supplier record"). - In tier 10, after
seedCustomFields, addseedCustomFieldValues(ctx):- Read
customFieldids:SELECT id, "table", name FROM "customField" WHERE "companyId" = $1. - Map item type to table: Part →
part, Material →material, Consumable →consumable, Tool →tool, Service →service. - For each item spec with
customFieldValues, build{ [customField.id]: value }. - Run one
UPDATE "<table>" SET "customFields" = COALESCE("customFields", '{}'::jsonb) || $1::jsonb WHERE id = $2 AND "companyId" = $3per item. Theidis the item'sreadableId(.claude/rules/revision-system.md). - Throw
Seed: custom field "<name>" not found on <table>when a name has no row.
- Read
- In
validate.ts, add two rules next to the existing item rules. Follow their violation format:- Each
customFieldValueskey names aops.customFieldsspec whosetableis the item's type table. - Each
address.countryCodematches/^[A-Z]{2}$/.
- Each
- Write
validate-seed-extensions.test.tswith 3 cases on a cloned satellite dataset: a valid value passes; an unknown field name fails; acountryCodeof"usa"fails.
Verify:
cd /Users/aashu/work/carbon/carbon && pnpm --filter @carbon/database exec vitest run src/datasets/validate-seed-extensions.test.ts
# Expected: 3 passed
cd /Users/aashu/work/carbon/carbon && pnpm exec turbo run typecheck --filter=@carbon/database --concurrency=1
# Expected: 1 successful task
Out of scope: the four existing datasets' data files. They need no change because both fields are optional.
Task 3: Align the model's product names and export steps.json
Depends on: none Files (outside the repo):
- Modify:
/Users/aashu/work/carbon/plans/quad-model/quad.py
Steps:
- Make the top-level
sub()names equal the BOM items in the spec §3:AFR-100 Airframe,ARM-200 Arm Set,PRP-300 Propulsion Set,AVN-500 Avionics Bay,BAT-700 Power System,COM-800 Comms & Navigation,PLD-900 EO/IR Gimbal,LDG-950 Landing Gear,VNS-850 GPS-Denied Navigation Kit,LGT-700 Lighting & Safety,TRC-100 Identification & Data. Rename the root toISR4-AV ISR-4 Air Vehicle. - Re-key the
put()step keys to the spec §4 step list (01-pods,02-arm-*,03-avionics,04-gimbal,05-gear,06-frame, …19-final). - Write
out/isr4-quad/isr4-quad.stepandout/isr4-quad/steps.json(step key → part names), likecadlib.finish.
Verify:
cd /Users/aashu/work/carbon/plans/quad-model && .venv/bin/python quad.py 2>&1 | grep "leaf parts"
# Expected: leaf parts 139
Out of scope: geometry changes. The user approved the look.
Task 4: Build the assembler and bake the model
Depends on: 3 Files:
- Create (outside the repo):
/Users/aashu/work/carbon/plans/quad-model/bake.py— copy ofplans/satellite-model/bake.pywithWORKTREE = "/Users/aashu/work/carbon/carbon"andHEREpointing atquad-model - Create:
packages/database/src/datasets/assets/defense_uas/models/isr4-quad.glb - Create:
packages/database/src/datasets/assets/defense_uas/models/isr4-quad.graph.json
Steps:
- 🛑 Check memory first. Then run
brew install opencascade. - Run
cargo build --release -p assemblerin/Users/aashu/work/carbon/carbon(binary attarget/release/assembler). - Confirm Redis answers on
localhost:6379(redis-cli ping). If not, STOP and re-decide with the resolution ladder. - Run
.venv/bin/python bake.py isr4-quad 0.5 0.3. - If the GLB is over 3.5 MB, re-run with
1.0 0.5. - Copy the GLB and graph into
assets/defense_uas/models/. - Run
plans/satellite-model/motions/plan.pyper build (main build plus each sub-assembly) in fixed-sequence mode. If it fails, keep motion empty and record that in the spec.
Verify:
ls -la /Users/aashu/work/carbon/carbon/packages/database/src/datasets/assets/defense_uas/models/
# Expected: isr4-quad.glb (≤ 3,670,016 bytes) and isr4-quad.graph.json
Then count graph leaves with a one-line Node script. Expected: 139.
If the build fails because of a missing native library, re-decide with the resolution ladder, record it in the spec, and continue. Never improvise silently.
Out of scope: committing the STEP file or the scripts.
Task 5: Copy satellite into data/defense and register the dataset
Depends on: 2 Files:
- Create:
packages/database/src/datasets/data/defense/*.ts(14 files, copied fromdata/satellite/) - Modify:
datasets/types.ts—DatasetKey(line 2223) gains"defense" - Modify:
datasets/index.ts— import andDATASETSentry - Modify:
datasets/tiers/workflow-definitions.ts—SEED_WORKFLOW_BUILDERSgainsdefense
Steps:
- Copy the 14 files.
- In
data/defense/index.ts, setkey: "defense",label: "Defense & Unmanned Systems",industryId: "defense_uas", company name "Halberd Unmanned Systems". - Rename every exported builder that
workflow-definitions.tsimports, so the defense builder has its own name. - Register the key in all three places.
Verify:
cd /Users/aashu/work/carbon/carbon && pnpm exec turbo run typecheck --filter=@carbon/database --concurrency=1
# Expected: 1 successful task
Out of scope: content rewrites (Tasks 7–10).
Task 6: Add the industry migration and the onboarding icon
Depends on: 5 Files:
- Create: a migration from
pnpm db:migrate:new add-defense-industry - Modify:
apps/erp/app/routes/onboarding+/industry.tsx—INDUSTRY_ICONS(lines 77-82) and itsreact-icons/luimport - Copy from (precedent):
packages/database/supabase/migrations/20260813023744_add-aerospace-industry.sql
Steps:
- Write the migration body: one
INSERT INTO "industry" ("id", "name", "description", "iconName", "sortOrder") VALUES ('defense_uas', 'Defense & Unmanned Systems', '<one sentence>', 'shield', 5) ON CONFLICT ("id") DO NOTHING;. Copy the precedent's column list exactly. - Add
shield: <LuShield className="h-5 w-5" />and importLuShield.
Verify:
cd /Users/aashu/work/carbon/carbon && pnpm exec biome check apps/erp/app/routes/onboarding+/industry.tsx
# Expected: no errors
Out of scope: applying the migration (Task 13).
Task 7: Rewrite foundation, items and the assembly
Depends on: 4, 5
Files: data/defense/{foundation,items,assembly,index}.ts
Steps:
- Rewrite
foundation.tsper spec §3: the plant (Huntsville, AL,America/Chicago), departments, abilities, processes, work centers (composite cutting, harness bench, avionics integration, motor run-in, calibration and hover cage, environmental test, final inspection), customer types, the six customers, at least 11 suppliers with the status rows, contacts and procedures (an AS9102-style FAI procedure, an ITAR handling procedure). - Give the Nordic agency
address: { countryCode: "NO", … }and the EUR supplieraddress: { countryCode: "DE", … }. - Rewrite
items.ts: the items in spec §3, theISR4-SYSandISR4-AVBOMs, routings, serial and batch tracking, shelf lives, supplier parts, inspection plans, the export enforcement rule, andcustomFieldValueson every part. - Rewrite
assembly.ts: the spec §4 steps. Generate each step'scomponentNodeIdsfromisr4-quad.graph.jsonandsteps.jsonwith a script. Never hand-type a node id.
Verify:
cd /Users/aashu/work/carbon/carbon && CARBON_SKIP_DATASET_CHECK= pnpm db:check:datasets -- --dataset defense 2>&1 | tail -30
# Expected: no "foundation", "items" or "assembly" violations (later slices may still report)
Out of scope: the other slices.
Task 8: Rewrite inventory, sales and purchasing
Depends on: 7
Files: data/defense/{inventory,sales,purchasing}.ts
Steps:
- Rewrite every record to the drone story. Keep each status that satellite exhibits.
- Sales: CLIN text on lines, DoD-format PO numbers (invented), the Nordic agency's Draft order with an
ISR4-SYSline, spares and depot-repair orders, an RMA for a serialized radio. - Purchasing: POs to each supplier category, receipts with lot numbers, the Pending supplier's approval request.
Verify:
cd /Users/aashu/work/carbon/carbon && pnpm db:check:datasets -- --dataset defense 2>&1 | tail -30
# Expected: no inventory, sales or purchasing violations
Task 9: Rewrite production, quality and change orders
Depends on: 8
Files: data/defense/{production,quality,change-orders}.ts
Steps:
- Production: at least 18 jobs. The hero job is 6 ×
ISR4-AVfor the Army office, In Progress, Hard Deadline. All open jobs are due within the validator's window. - Quality: NCR workflows (supplier escape with MRB, counterfeit suspect), the NCRs from spec §3, receipt inspections, three gauges, the risks.
- Change orders: the arm Revision and the
AVN-500Version. Keep only two leaf make parts locked (onboarding-company-templates.md→ "Open change notices lock more").
Verify: the Task 8 command. Expected: no production, quality or change-order violations.
Task 10: Rewrite accounting, ops, workflows and planning
Depends on: 9
Files: data/defense/{accounting,ops,workflows,planning}.ts
Steps:
- Rewrite every record. Keep the period floors (
dates.ts). - Ops: the five part custom fields and the job field from spec §3, serial sequences, trainings (ITAR awareness, IUID marking, flight test).
- Rename the workflow builder's records to the drone story.
Verify:
cd /Users/aashu/work/carbon/carbon && pnpm db:check:datasets -- --dataset defense 2>&1 | tail -15
# Expected: the validator passes for "defense"
Task 11: Write the thumbnails
Depends on: 7
Files: packages/database/src/datasets/assets/defense_uas/<readableId>.svg
Steps:
- List the items that satellite illustrates. Pick the matching defense items (about 33).
- Write one SVG per item: 1024 × 1024 viewBox, gradient fills, no text. Read two satellite SVGs first for the style.
Verify:
ls /Users/aashu/work/carbon/carbon/packages/database/src/datasets/assets/defense_uas/*.svg | wc -l
# Expected: ≥ 30
Task 12: Update the docs
Depends on: 6, 7 Files:
- Modify:
packages/database/src/datasets/assets/ATTRIBUTION.md— the ISR-4 row - Modify:
.claude/rules/onboarding-company-templates.md— five datasets; the icon step in "Adding an industry"; the two new spec fields; 261 floors - Modify:
packages/database/src/datasets/AGENTS.md,packages/database/AGENTS.md— the dataset count
Verify: grep -n "Four\|four datasets" <each file>. Expected: no stale count.
Task 13: End-to-end verification
Depends on: all
Steps:
- 🛑 Check memory.
- Run
pnpm db:migrate(applies the industry row to the local stack). - Run
pnpm db:check:datasets. Expected: all five pass. - Run
pnpm exec turbo run typecheck --filter=erp --concurrency=1. Expected: success. - Run
pnpm exec biome checkon every changed.ts/.tsxfile. Expected: no errors. - Seed a fresh company with an unused email:
pnpm db:seed:dev -- --email [email protected] --dataset defense. - With SQL, check spec acceptance 5 (the Nordic order's location address is
NO, and the rule namesISR4-SYS) and 6 (theISR4-AVpart'scustomFieldshold the three values). - Write the run log to
.ai/runs/2026-10-26-defense-uas-demo-dataset.md.
Out of scope: the README / www hero swap.