Commerce Lots & Serials
Track product batches with lot numbers and expiration dates, and manage individual unit serial numbers for full traceability.
How It Works
Lot Tracking
- Create lots with production date, quantity, and expiration.
- Track lot inventory across warehouse locations.
- Consume, adjust, transfer, split, or merge lots.
- Quarantine lots for quality issues.
- Attach certificates (COA, COC, MSDS).
- Trace upstream sources and downstream consumption.
Serial Number Tracking
- Create serial numbers individually or in bulk.
- Track serial lifecycle: Available -> Sold -> Shipped -> InService.
- Reserve serials for orders with expiration.
- Transfer ownership and track location changes.
- Look up complete serial history with warranty info.
Usage
- CLI:
stateset lots ... or stateset serials ...
- Writes require
--apply.
- MCP tools (Lots):
create_lot, list_lots, get_lot, consume_lot, adjust_lot, transfer_lot, split_lot, merge_lots, quarantine_lot, release_quarantine, add_lot_certificate, trace_lot, get_expiring_lots.
- MCP tools (Serials):
create_serial, bulk_create_serials, list_serials, get_serial, mark_serial_sold, mark_serial_shipped, reserve_serial, release_serial_reservation, transfer_serial_ownership, lookup_serial, validate_serial, get_available_serials.
Permissions
- Read:
list_lots, get_lot, trace_lot, get_expiring_lots, list_serials, get_serial, lookup_serial — no --apply needed.
- Write:
create_lot, consume_lot, quarantine_lot, create_serial, bulk_create_serials, mark_serial_sold — requires --apply.
Examples
stateset lots create --sku PHARMA-100 --quantity 500 --expiration 2026-06-30 --apply
stateset lots trace LOT-2025-A001 --direction downstream
stateset serials bulk-create --sku WIDGET-PRO --prefix SN-W001 --count 100 --apply
Statuses
- Lot: Active, Consumed, Expired, Quarantine, Transferred
- Serial: Available, Reserved, Sold, Shipped, InService, Returned, Repaired, Quarantine, Scrapped
Status Flows
Lot: Active -> Consumed (or Quarantine -> Released | Expired | Transferred)
Serial: Available -> Reserved -> Sold -> Shipped -> InService (or Returned -> Repaired | Scrapped)
Quarantine: Quarantined -> Under Review -> Released (or Scrapped)
Output
{"status":"lot_created","lot_number":"LOT-2025-A001","sku":"PHARMA-100","quantity":500}
{"status":"serial_created","serial_number":"SN-W001-00001","sku":"WIDGET-PRO"}
Present Results to User
- Lot number, SKU, quantity, and expiration date.
- Serial number, current status, and owner.
- Traceability chain (upstream sources, downstream consumers).
- Expiring lots within the requested timeframe.
Troubleshooting
- Lot in quarantine: must release quarantine before consumption.
- Serial already reserved: release existing reservation first.
- Expired lot: cannot consume expired lots; adjust or scrap.
- Merge conflict: lots must share the same SKU to merge.
Error Codes
LOT_EXPIRED: Lot has passed its expiration date and cannot be consumed or transferred.
SERIAL_ALREADY_RESERVED: Serial number is reserved by another order; release the existing reservation first.
LOT_MERGE_SKU_MISMATCH: Cannot merge lots with different SKUs; all lots must share the same SKU.
Related Skills
- commerce-inventory — stock levels tied to lot and serial tracked items
- commerce-quality — quality inspections that may quarantine lots
- commerce-receiving — lot assignment during inbound goods receipt
- commerce-warehouse — location tracking for lot and serial items
References
- references/traceability.md
- /home/dom/stateset-icommerce/crates/stateset-core/src/models/lots.rs
- /home/dom/stateset-icommerce/crates/stateset-core/src/models/serials.rs
1---2name: commerce-lots-and-serials3description: Manage lot/batch tracking and serial number management. Use when tracking product batches with expiration dates, assigning serial numbers, or performing traceability lookups.4---56# Commerce Lots & Serials78Track product batches with lot numbers and expiration dates, and manage individual unit serial numbers for full traceability.910## How It Works1112### Lot Tracking131. Create lots with production date, quantity, and expiration.142. Track lot inventory across warehouse locations.153. Consume, adjust, transfer, split, or merge lots.164. Quarantine lots for quality issues.175. Attach certificates (COA, COC, MSDS).186. Trace upstream sources and downstream consumption.1920### Serial Number Tracking211. Create serial numbers individually or in bulk.222. Track serial lifecycle: Available -> Sold -> Shipped -> InService.233. Reserve serials for orders with expiration.244. Transfer ownership and track location changes.255. Look up complete serial history with warranty info.2627## Usage2829- CLI: `stateset lots ...` or `stateset serials ...`30- Writes require `--apply`.31- MCP tools (Lots): `create_lot`, `list_lots`, `get_lot`, `consume_lot`, `adjust_lot`, `transfer_lot`, `split_lot`, `merge_lots`, `quarantine_lot`, `release_quarantine`, `add_lot_certificate`, `trace_lot`, `get_expiring_lots`.32- MCP tools (Serials): `create_serial`, `bulk_create_serials`, `list_serials`, `get_serial`, `mark_serial_sold`, `mark_serial_shipped`, `reserve_serial`, `release_serial_reservation`, `transfer_serial_ownership`, `lookup_serial`, `validate_serial`, `get_available_serials`.3334## Permissions3536- Read: `list_lots`, `get_lot`, `trace_lot`, `get_expiring_lots`, `list_serials`, `get_serial`, `lookup_serial` — no `--apply` needed.37- Write: `create_lot`, `consume_lot`, `quarantine_lot`, `create_serial`, `bulk_create_serials`, `mark_serial_sold` — requires `--apply`.3839## Examples4041```bash42stateset lots create --sku PHARMA-100 --quantity 500 --expiration 2026-06-30 --apply43stateset lots trace LOT-2025-A001 --direction downstream44stateset serials bulk-create --sku WIDGET-PRO --prefix SN-W001 --count 100 --apply45```4647## Statuses4849- **Lot:** Active, Consumed, Expired, Quarantine, Transferred50- **Serial:** Available, Reserved, Sold, Shipped, InService, Returned, Repaired, Quarantine, Scrapped5152## Status Flows5354**Lot:** Active -> Consumed (or Quarantine -> Released | Expired | Transferred)55**Serial:** Available -> Reserved -> Sold -> Shipped -> InService (or Returned -> Repaired | Scrapped)56**Quarantine:** Quarantined -> Under Review -> Released (or Scrapped)5758## Output5960```json61{"status":"lot_created","lot_number":"LOT-2025-A001","sku":"PHARMA-100","quantity":500}62{"status":"serial_created","serial_number":"SN-W001-00001","sku":"WIDGET-PRO"}63```6465## Present Results to User6667- Lot number, SKU, quantity, and expiration date.68- Serial number, current status, and owner.69- Traceability chain (upstream sources, downstream consumers).70- Expiring lots within the requested timeframe.7172## Troubleshooting7374- Lot in quarantine: must release quarantine before consumption.75- Serial already reserved: release existing reservation first.76- Expired lot: cannot consume expired lots; adjust or scrap.77- Merge conflict: lots must share the same SKU to merge.7879## Error Codes8081- `LOT_EXPIRED`: Lot has passed its expiration date and cannot be consumed or transferred.82- `SERIAL_ALREADY_RESERVED`: Serial number is reserved by another order; release the existing reservation first.83- `LOT_MERGE_SKU_MISMATCH`: Cannot merge lots with different SKUs; all lots must share the same SKU.8485## Related Skills8687- commerce-inventory — stock levels tied to lot and serial tracked items88- commerce-quality — quality inspections that may quarantine lots89- commerce-receiving — lot assignment during inbound goods receipt90- commerce-warehouse — location tracking for lot and serial items9192## References93- references/traceability.md94- /home/dom/stateset-icommerce/crates/stateset-core/src/models/lots.rs95- /home/dom/stateset-icommerce/crates/stateset-core/src/models/serials.rs