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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
Feature run: MRP planning actions (Order / expedite / defer / cancel) assignable to buyers
- Date: 2026-09-08
- Mode: approval-per-phase (research + spec grill) → fully-autonomous from 2026-09-08 (Brad: "use the autonomous flow to write the spec and the plan, then open a PR")
- Request: "use the /feature skill to rewrite MRP. currently the only action MRP suggests is 'Order' -- but this is not the whole story. in SAP, for instance, MRP will suggest a set of actions -- one of which is 'Order' -- but also includes moving the order date up, moving the order date back, and canceling orders. another big change in perspective is that these actions should be assignable to buyers. this is a big refactor, so let's start with some research."
- Phase plan: research [run — ERP-domain MRP logic, force-included] · spec [run — big refactor, multi-module, data model change] · plan [run] · execute [run] · test [run — user-facing planning UI] · self-review [run]
Decisions
- Scope path (approval): B — focused spec carving the planned-order + action-message core out of MRP-v2 + adding buyer/planner assignment; RCCP / CTP / continuous-regen deferred to the MRP-v2 spec. — Brad, 2026-09-08
Post-PR refinements
- 2026-09-09 (Brad): ladder item-group tier is location-specific. Tree = all → location → item group (per-item leaf + per-message assignee still on top). Item-group ownership moved OFF a column on itemPostingGroup INTO a sparse
itemPostingGroupResponsibilitytable keyed (companyId, locationId, itemPostingGroupId) — mirrors the printer AssignmentsCard inheritance tree (location → work-center → here location → item-group). Updated spec §P1.2/§P1.3/§P1.8/§P1.11 + changelog; plan Task 1 (new table + PK-shape verify for composite FKs), Task 5 (resolver rung from the table by location+group), Task 10 (settings screen nests item-groups under each location). PR #1601 updated. - 2026-09-09 (Brad): fix stale
.claude/rules/supersession-system.md— MRP is@carbon/ee/planningrunMrp, not the deletedfunctions/mrp/**.
Open questions being grilled (one at a time)
- Q1 assignment axis — RESOLVED. Decision C: per-level owner default + per-message assignee override (reuse Assignee/Employee picker, value=user.id). A SINGLE unified field
responsibleEmployee(not separate buyer/planner) at each rung. Resolved via a PRIORITY LADDER (printer-style inheritance UI per resolveContextAssignment/AssignmentsCard), NOT a location×group matrix. Ladder most-specific→general: item (planning tab) → item-group → location → company default → unassigned; per-message assignee overrides. Same ladder for both purchasing (Buy) and production (Make) worklists; the item's replenishmentSystem decides which worklist shows it. itemPostingGroup table confirmed alive (only the party×item matrix was dropped); no buyer/planner table exists today (net-new). — Brad, 2026-09-08. [Superseded 2026-09-09 — see Post-PR refinements]: the item-group rung is LOCATION-SPECIFIC, looked up from the sparseitemPostingGroupResponsibilitytable by(locationId, itemPostingGroupId)— there is NO global item-group fallback. "Not a matrix" means the ownership model is an inheritance tree (each tier falls back up: item → location's item-group entry → location → company), not the removed customer-type × item-group cross-product; only configured cells are stored. - Q2 persistence model — RESOLVED. B + reconciliation (i): a focused persisted
planningActiontable is the v1 spine — ALL action types, each optionally referencing a real open PO-line/job, carrying resolved responsibleEmployee + overridable assignee + status (Open/Dismissed/Actioned), written diff-write (match on natural key, update in place, close stale, insert new; never delete-rewrite — preserves assignment/dismissal). No Firm lifecycle in v1. Heavy MRP-v2 pieces (plannedOrder Planned→Firm→Released lifecycle, plannedOrderPeg, planningRun, planningState, RCCP, CTP, continuous regen) → "Deferred / later phases" section of the SAME spec. Home: UPDATE.ai/specs/2026-08-22-mrp-v2-planned-order-generation.mdin place, with changelog entry; MRP-v2 becomes a phased spec. — Brad: "b" then "i", 2026-09-08 - NOTE: this run's home artifact is the UPDATED MRP-v2 spec, not a new .ai/specs file.
- Q3 terminology/enum — RESOLVED.
planningActionType=Order | Make | Expedite | Defer | Cancel | Increase | Decrease(capitalized display-friendly enum). Order=new PO (Buy), Make=new job (Make); Expedite=pull existing PO-line/job in, Defer=push out, Cancel=drop redundant existing order, Increase/Decrease=qty change on existing order (Increase/Decrease INCLUDED in v1 per Brad). Expedite/Defer/Cancel/Increase/Decrease target existing documents (PO-line or job). One atomic action per row; combined date+qty → single highest-priority message. Will sanity-check names vs @carbon/glossary when writing. — Brad 2026-09-08 - Q4 advisory exceptions — RESOLVED: actionable only in v1. No standalone advisory/warning rows. Urgency = flag on the action row (persist isASAP/isPastDue). Condition (below safety stock, projected stock, reorder point) captured in each action's reason/triggerValues. Dedicated warning/alert channel (below-safety-stock alerts, excess-stock, master-data-broken/no-BOM diagnostics) DEFERRED to later phase. — Brad 2026-09-08
- Q5 tolerance — RESOLVED (my rec, surfaced for veto). ONE company-level scalar
rescheduleToleranceDays(default 7 = one weekly bucket, symmetric, gates Expedite+Defer). NO separate qty dampener in v1 — rely on existing orderMultiple/lotSize/min-max-OQ rounding to absorb trivial qty deltas; add a qty dampener later only if churn is observed. Brad asked for my rec given 80/20 → single scalar. — 2026-09-08. Applying 80/20 to remaining Qs. - Q6 acting on a message — RESOLVED. planningAction is a recommendation; existing owning subsystem executes. Creates (Order/Make) reuse existing planning.update + stamp assignee. Change actions (Expedite/Defer/Increase/Decrease/Cancel) branch on COMMITMENT STATE of target, not action type: (1) UNCOMMITTED (Draft/Planned PO line, un-released job) → one-click auto-apply via existing services (edit requiredDate/purchaseQuantity, cancel/remove line). (2) COMMITTED (PO sent to supplier, job released to floor) → NO silent edit; message still surfaces recommendation but acting NAVIGATES to the PO/job for manual reopen+notify; row flagged "Review on PO". Automated reopen + supplier-notification/change-order flow DEFERRED. One-click + bulk; status flips Actioned/Dismissed. TODO when writing: verify exact PO status marking "sent to supplier" + whether reopen action exists. — Brad "yes" 2026-09-08
- Q7 live grid — RESOLVED. KEEP the live 48-week projection columns (cheap view over MRP's forecast/actual tables). ADD planningAction worklist on the same pages. Persisted planningAction becomes SINGLE SOURCE OF TRUTH for suggestions — grid's suggestion column reads persisted actions instead of live calculate_quantity_to_order; grid+worklist never disagree; change actions live alongside Order/Make. Consequence accepted: suggestions refresh per MRP run (3h + manual Recalculate), not per page load — the correct ERP model + prerequisite for assignment/dismissal. — Brad "i accept it" 2026-09-08
- Q8 UI surface — RESOLVED. Extend the TWO existing planning pages in place (x+/purchasing+/planning, x+/production+/planning) — no new module/page. Add columns: action type, suggested date/qty, reason (triggerValues), assignee, status, urgency flag. Filters: assignee (default "my actions"=current user), action type, status. Reuse Assignee component per row (prefilled from resolved responsibleEmployee, reassignable), bulk assign + bulk accept/dismiss via existing multi-select. ONE new settings screen cloned from printer AssignmentsCard: company-default + list of locations + list of item-groups, inherited placeholders. Per-item override on item Planning tab (responsibleEmployee). Unified cross-module cockpit DEFERRED. — Brad "yes" 2026-09-08
ALL 8 QUESTIONS RESOLVED.
Phase log
- research: DONE — .ai/research/mrp-planning-actions.md (SAP, D365 SCM+BC, NetSuite, Epicor, Infor SyteLine/LN + Carbon current-state map). Key grounding finding: the prior draft MRP-v2 spec (all OQs resolved, NOT implemented) already specified a plannedOrder exception model but had NO buyer/planner assignment; the ee-planning extraction (runMrp in @carbon/ee/planning) IS implemented in code. That drove the Path-B/phased-spec decision above.
- spec: DONE — updated
.ai/specs/2026-08-22-mrp-v2-planned-order-generation.mdin place, re-scoped into phases. Added §P1 (Phase 1: action messages + assignment) with data model, ladder, engine changes, acting, tolerance, UI, design decisions, forward-compat, acceptance criteria, resolved OQs. Reframed prior game-changer content as Phases 2+. Changelog + phase-2 OQ pointer added. - plan: DONE —
.ai/plans/2026-09-08-mrp-planning-actions.md(12 tasks, Phase 1 only; grounded against sso-connection migration precedent, printer AssignmentsCard, existing PO/job services, MRP Phase-7 write path; shared pure sizing module + parity test; generatePlanningActions diff-write wired into runMrp; commitment gate; two planning pages extended; ownership settings screen). - PR: opening now (autonomous — Brad asked). Committing only my artifacts (spec update, plan, research, run record); NOT the unrelated pre-existing tool-manifest.digest.json change.
Outcome
- PR: https://github.com/crbnos/carbon/pull/1601 — now CODE + docs. /execute completed 2026-09-11: all 12 plan tasks done across 8 implementation commits (96d53c0177…fc99093a9d).
- execute: DONE. Verification: 239 utils + 833 ee tests green (sizing parity, change-action derivation, diff-write); repo-wide pnpm test 27/27 tasks; scoped typechecks clean. Browser-verified on the satellite dataset (crbn up stack): 72 persisted actions (41 Order / 27 Make / 2 Expedite / 2 Defer) written by BOTH the scheduled Inngest run (createdBy='system' FK held) and manual Recalculate; commitment gate flagged all 4 change actions on sent POs → "Review on PO" navigates to the PARENT purchase order; company-default ladder rung → recalc → all 72 actions assigned, "My actions · 45"; diff-write idempotent (counts stable) and a Dismissed action survived a full re-run; /x/settings/planning (tolerance + ownership tree) and item Planning tab Responsible Employee field render. Screenshots: .ai/scratch/e2e/.
- Deviations from plan (surfaced for veto): (1) pure sizing fn takes an injected
todayDate(clock-free purity; getLocalTimeZone is server-banned); (2) worklist renders as a dedicated actions card above the projection grid — the grid's legacy quantityToOrder column was NOT re-pointed to persisted rows (both derive from the same RPC inputs; divergence = staleness window only); Order/Make apply flows through the existing order drawer, change actions apply from the worklist; (3) "my actions" default is a local Mine/All toggle (default Mine) rather than a URL filter; (4) self-review fixes landed: Dismissed-row suppression + lot-split aggregation per (type, period). - Follow-ups: /translate fill for the new UI strings (English fallback works meanwhile); optional grid-column re-point per Q7 strict reading; live one-click apply on an UNCOMMITTED PO change action not exercisable on this dataset (all change targets were sent POs) — covered by route logic + gate tests.
- Commit: b788d5ff2f on branch mrp-action-suggestions (4 files; unrelated tool-manifest.digest.json left uncommitted; later committed separately as b062309556 on Brad's ask).
- 2026-09-11: CodeRabbit review round (17 findings) folded into spec + plan — one-action-per-target precedence; no-swallow generation errors; Dismissed-vanished rows retired; strict-
>tolerance boundary + CHECK(>=0) + 0–365 validation; gate on isPurchaseOrderLocked only; IDOR bind (apply loads persisted action by id+companyId, status Open, stored values); explicit job path (updateJob + notifyScheduleInputsChanged "reorder"); itemPostingGroup UNIQUE(id,companyId) prerequisite (PK verified ("id") alone; location already has it via 20260905132037); explicit ENABLE RLS on itemPostingGroupResponsibility; parent purchaseOrderId join for navigation; enum→lowercase wire map; system-user audit actor verified seeded (20230123004317). Proceeding to /execute.