Part of the Simple Agility stack. This contract defines the canonical data flow, event schemas, and monetary reconciliation mechanics spanning inbound inventory sourcing, physical warehouse management (Stockroom), marketplace sales channels (eBay, Amazon FBA, local), payout settlement, and double-entry financial accounting (SA-10, SA-11).
This page is the authoritative architectural contract binding Stockroom (~/source/stockroom), the future dedicated accounting engine (simple-agility-accounting), and any agents operating across the commerce domain.
sequenceDiagram
autonumber
actor Supplier as Estate / Thrift / Haul
participant SR as Stockroom (WMS)
participant Mkt as Marketplaces (eBay/FBA)
participant Ship as Carrier / PirateShip
participant Bank as Business Bank Account
participant Ledger as Accounting Engine (General Ledger)
Note over Supplier,SR: Stage 1: Inbound Sourcing & Cost Allocation
Supplier->>SR: Physical goods purchased (Total cost: \$100.00)
SR->>SR: Create Acquisition (Uniform split + overrides)
SR-->>Ledger: Emit ItemAcquiredEvent (Dr Inventory Asset, Cr Cash/Card)
Note over SR,Mkt: Stage 2: Listing & Active Inventory Holding
SR->>Mkt: Publish Channel Listings (eBay Custom Label: I-<SKU>)
opt Non-Sale Disposition (Damage / Donation)
SR->>SR: Mark Disposed (Reason: DAMAGED / DONATED)
SR-->>Ledger: Emit ItemDisposedEvent (Dr Loss/Expense, Cr Inventory Asset)
end
Note over Mkt,SR: Stage 3: Order Realization & Customer Payment
Mkt->>SR: Order Paid webhook / sync (Price: \$30.00, Ship: \$5.00)
SR->>SR: Create Sale (Status: ACTIVE, fees estimated)
SR-->>Ledger: Emit ItemSoldEvent (Dr Mkt Receivable, Cr Revenue)
Note over SR,Ship: Stage 4: Warehouse Fulfillment & Postage
SR->>Ship: Pick & Purchase Postage (Media Mail: \$3.85)
SR->>SR: Mark SHIPPED (Postage finalized, item exits crate)
SR-->>Ledger: Emit ItemShippedEvent (Dr COGS, Cr Inventory Asset#59; Dr Postage, Cr Cash/Card)
Note over Mkt,Bank: Stage 5: Settlement & Payout Reconciliation
Mkt->>Bank: Lump-Sum Payout Disbursement (\$142.15 net)
Bank-->>Ledger: Bank Transaction (Deposit: \$142.15)
Mkt-->>Ledger: Ingest Settlement Statement (Orders, Returns, Subscriptions)
Ledger->>Ledger: Reconcile Payout (Clear Mkt Receivable, allocate store fees & ad spend)
The commerce lifecycle adheres to three architectural invariants:
L-<code>), item condition grades, photography, triage pricing, eBay sync, and pick/pack workflows.total_cost_cents, price_cents, fees_cents, postage_cents, net_cents).I-<SKU>), an acquisition record (A-<ID>), and where applicable, an external marketplace order or settlement ID.When inventory is purchased (from garage sales, thrift stores, estate liquidations, or library auctions), an Acquisition is created in Stockroom.
Any remainder cents from integer division are assigned to the first item to maintain exact balance equality (\sum \text{item.cost\_cents} = \text{acquisition.total\_cost\_cents}).
ItemAcquiredEvent.
1200 Inventory Asset1010 Operating Cash (or 2010 Credit Card Payable)While items sit in warehouse storage (assigned to crates or locations), physical events may occur before sale:
LocationEvent with zero general ledger impact.| Reason Code | Operational Cause | General Ledger Treatment |
|---|---|---|
DAMAGED_SCRAP | Dropped, water damage, discovered broken | Debit 5040 Inventory Loss & Shrinkage, Credit 1200 Inventory Asset |
CHARITABLE_DONATION | Donated to local thrift, school, or library | Debit 5050 Charitable Inventory Contribution, Credit 1200 Inventory Asset |
OWNER_WITHDRAWAL | Retained by operator for personal collection | Debit 3010 Owner Draw / Personal Equity, Credit 1200 Inventory Asset |
LOT_CONSOLIDATION | Bundled into a new multi-item lot | Internal transfer: Cost basis rolls into the new composite Lot SKU |
When a customer purchases an item on eBay, Amazon, or locally:
SaleEntity linked to the item SKU.price_cents (gross sale price), shipping_charged_cents (postage paid by buyer), and fees_cents (estimated marketplace commissions).listed to sold, automatically queuing delist actions across any other channels.ItemSoldEvent.
1020 Marketplace Clearing (eBay/Amazon Receivable) (\text{price} + \text{shipping\_charged} - \text{fees})5030 Marketplace Commission & Payment Fees (\text{fees})4010 Gross Sales Revenue (\text{price})4020 Shipping Revenue Charged (\text{shipping\_charged})When the order is packaged and dispatched:
shipped and records shipped_at and postage_cents.ItemShippedEvent.
5010 Cost of Goods Sold (COGS) (\text{item.cost\_cents})1200 Inventory Asset (\text{item.cost\_cents})5020 Shipping Postage Expense (\text{postage\_cents})1010 Operating Cash (or 2010 Credit Card / Carrier Account) (\text{postage\_cents})Marketplaces do not disburse funds order-by-order. Periodically (daily or bi-weekly), eBay Managed Payments or Amazon disbursements deposit a consolidated lump sum into the business bank account.
1020 Marketplace Clearing.1010 Operating Cash (Bank Account) (\text{actual deposit received})6010 Marketplace Subscriptions & Overhead (\text{monthly store fee})6020 Advertising & Promoted Listings (\text{ad campaign fees})1020 Marketplace Clearing (\text{clearing individual order accruals})Stockroom emits these structured events as JSON payloads over its event bus / append-log:
{
"event_id": "01M4XR11A8B2C3D4E5F6G7H8J9",
"event_type": "ItemAcquired",
"occurred_at": "2026-10-14T14:30:00Z",
"acquisition_id": "01M4XR00A1B2C3D4E5F6G7H8J0",
"item_id": "01M4XR05X9Y8Z7W6V5U4T3S2R1",
"sku": "I-00482",
"source_name": "Sacramento Estate Sale",
"source_type": "estate_sale",
"cost_cents": 250,
"cost_overridden": false,
"category": "book",
"title": "The Art of Computer Programming, Vol 1"
}
{
"event_id": "01M4XR22B9C8D7E6F5G4H3J2K1",
"event_type": "ItemSold",
"occurred_at": "2026-10-14T18:15:00Z",
"sale_id": "01M4XR20A1B2C3D4E5F6G7H8J1",
"item_id": "01M4XR05X9Y8Z7W6V5U4T3S2R1",
"sku": "I-00482",
"channel": "ebay",
"external_order_id": "14-11892-49201",
"price_cents": 3500,
"shipping_charged_cents": 500,
"fees_cents": 485,
"fees_estimated": true,
"expected_net_cents": 3515
}
{
"event_id": "01M4XR33C1D2E3F4G5H6J7K8L9",
"event_type": "ItemShipped",
"occurred_at": "2026-10-15T09:45:00Z",
"sale_id": "01M4XR20A1B2C3D4E5F6G7H8J1",
"item_id": "01M4XR05X9Y8Z7W6V5U4T3S2R1",
"sku": "I-00482",
"cost_cents": 250,
"postage_cents": 385,
"carrier": "USPS",
"tracking_number": "9449009205568123456789"
}
{
"event_id": "01M4XR44D5E6F7G8H9J0K1L2M3",
"event_type": "ItemDisposed",
"occurred_at": "2026-10-16T11:00:00Z",
"item_id": "01M4XR09W1X2Y3Z4A5B6C7D8E9",
"sku": "I-00483",
"cost_cents": 250,
"reason_code": "DAMAGED_SCRAP",
"notes": "Dropped during warehouse reorganization; cracked casing."
}
The financial engine maps commerce events to the standard small-business Chart of Accounts:
| Account Number | Account Name | Type | Normal Balance |
|---|---|---|---|
1010 | Operating Checking (Bank) | Current Asset | Debit |
1020 | Marketplace Clearing (Receivables) | Current Asset | Debit |
1200 | Inventory Asset (Merchandise) | Current Asset | Debit |
2010 | Credit Card / Accounts Payable | Current Liability | Credit |
3010 | Owner Equity / Draws | Equity | Debit (Draws) / Credit (Equity) |
4010 | Gross Sales Revenue | Operating Revenue | Credit |
4020 | Shipping Revenue Charged | Operating Revenue | Credit |
5010 | Cost of Goods Sold (COGS) | Cost of Sales | Debit |
5020 | Shipping Postage Expense | Cost of Sales | Debit |
5030 | Marketplace Commission & Payment Fees | Cost of Sales | Debit |
5040 | Inventory Loss & Shrinkage | Operating Expense | Debit |
5050 | Charitable Inventory Contributions | Operating Expense | Debit |
6010 | Marketplace Store Subscriptions | Operating Expense | Debit |
6020 | Advertising & Promoted Listings | Operating Expense | Debit |
Consider a concrete transaction flow demonstrating exact cent balancing:
250 cents) to SKU I-00482.1200 Inventory Asset $25.00 | Cr 2010 Credit Card Payable $25.00.I-00482 sells on eBay for $35.00 with $5.00 shipping paid by buyer (Total collected: $40.00).570 cents).1020 Marketplace Clearing $34.30 | Dr 5030 Marketplace Fees $5.70 | Cr 4010 Gross Revenue $35.00 | Cr 4020 Shipping Revenue $5.00.5010 COGS $2.50 | Cr 1200 Inventory Asset $2.50.5020 Shipping Expense $3.92 | Cr 1010 Operating Checking $3.92.1010 Operating Checking $142.15 | Dr 6010 Store Subscriptions $24.95 | Cr 1020 Marketplace Clearing $167.10.