# SFIB Operations · the spaghetti, decomposed

**Owner**: Shalaco · **Last edit**: 2026-05-04 · **Repo**: code-compendium-26

A single brief that says: what we've built, what's live, what's next, and in what order. Replaces the implicit roadmap that's been living in chat context.

---

## 1 · The mission

Build SFIB an operator-readable control system covering:

| Layer | Question it answers |
|---|---|
| **Pricing** | What price for each (mix × format) — locked, defensible, year-over-year stable? |
| **Inventory** | What do I have, what's sold, what's listed, what's incoming, what's overcommitted? |
| **Purchasing** | What do I need to buy this week to maintain velocity? |
| **Sales** | Who's our top customer / mix / SKU? Where's the volume? |
| **Operations** | Which orders are late? Which batches are open? Who's assembling what? |
| **Forecasting** | When will I run out at current pace? When will incoming arrive? |

The deliverable surface is `wildfag.com/` (password-gated) — a constellation of self-contained HTML dashboards driven by exported CSVs from Squarespace, ShipStation, supplier invoices, and operator inventory snapshots.

---

## 2 · What's live right now

### On wildfag.com (production, password-gated)

| Page | What it does | Status |
|---|---|---|
| `index.html` | Landing page · 9 dashboard tiles | ✓ live |
| `monday-morning.html` | Daily operator briefing | ✓ live (SLA threshold is a placeholder, see §4) |
| `purchasing.html` | What-to-buy-today, sorted by velocity | ✓ live (NEW today) |
| `inventory-dashboard.html` | Editable 16×9 stock grid + CSV export | ✓ live |
| `inventory-flow.html` | Time-series flow + balance bars + net position | ✓ live |
| `sfib-matrix.html` | 16×9 sales × stock × margin matrix with product images | ✓ live |
| `recipe-matrix.html` | BOM reference: SKU + seed oz + sq-ft per cell | ✓ live |
| `pricing-table.html` | 80-row flat metrics (retail, COGS, margin, vs-market) | ✓ live |
| `pricing-lock-v2.html` | 16×5 toggleable retail/COGS/margin matrix | ✓ live |
| `sq-import-audit.html` | Validate SQ products CSV before import | ✓ live |

### Source-of-truth files (in repo, not on web)

| Path | Role |
|---|---|
| `05-02 SFIB SKU Matrix/outputs/cogs-matrix.csv` | 80 shaker SKUs, locked formula prices + COGS |
| `05-02 SFIB SKU Matrix/outputs/squarespace-import-shakers.csv` | 144-variant SQ import (SQ8- prefix) |
| `05-02 SFIB SKU Matrix/outputs/flow-data.json` | Per-mix timeline (stock/incoming/sold) for inventory-flow page |
| `05-02 SFIB SKU Matrix/inputs/cost-data/inventory-2026-04-28.md` | Seed inventory snapshot from xlsx |
| `05-02 SFIB SKU Matrix/inputs/cost-data/incoming-shipments.csv` | Supplier POs not yet arrived (NE 2×5lb) |
| `05-02 SFIB SKU Matrix/inputs/cost-data/competitor-pricing.md` | American Meadows + Nature's Seed market refs |
| `05-02 SFIB SKU Matrix/inputs/cost-data/pcs-invoices.csv` | Supplier purchase log |
| `001 Active Scripts/Winventory 2026/variant_key.csv` | Gold-standard SKU → mix/format mapper (175 rows) |
| `05-02 SFIB SKU Matrix/scripts/orders-to-flow.py` | Generates flow-data.json + flow-summary.csv |

### Locked decisions

- **SKU format**: `SQ8-{LINE}-{MIX}-{CONTAINER}-{SIZE}` — `SQ8-S-NE-CBD-2OZ` etc. No year in SKU (volatile data lives in price-history + cost-batch tables).
- **Margin tiers**: 30% loss-leader (CBD-2OZ), 65% Xerces premium (XCC/XCV), 55% standard.
- **Min-stock thresholds**: 5 lb for regular mixes, 2 lb for specialty (XCC, XCV, FL, NV, TX).
- **Retail formula**: `retail = ceil_to_99((fixed_tier + container_$ + seed_$) ÷ (1 − target_margin))`.
- **Free-shipping-embedded retail**: USPS cost lives in COGS, retail advertised "free shipping."
- **Bag tier deferred to v3.12**: 64 SKUs at $19 placeholder until reformulated.

---

## 3 · The 30-day roadmap (in priority order)

### NOW · this week

**N1. Operator's first Monday-morning use**
- Visit `wildfag.com/purchasing.html`, confirm the top-of-list (NE) shows 0 buy-today (because 2× 5lb already on order)
- Check that velocity numbers match operator gut-feel
- If wrong → tell me which mix and what the right number is, I'll trace it back to the data
- Pass: operator opens the page Monday and uses it as the source of truth for that week's POs

**N2. Cost refinement for honest margin** (bag tier especially)
- Current bag-tier COGS = `$7.50 fixed + seed_per_lb × oz / 16` — placeholder, probably understates real cost
- Operator provides: actual pouch cost, label cost, USPS rate by weight, labor floor for bags
- I update `cogs-matrix.csv` formula for bag tier
- Margin numbers across all dashboards become trustworthy (right now they're labeled "estimated")

**N3. Git repo + GitHub remote**
- User runs `git init` at `scripts 2026/` root (commands ready, sandbox can't do it)
- Push to `github.com/<user>/code-compendium-26` (private repo)
- Daily commits going forward; `git ftp push` for one-command deploys (later)

### SOON · next 2–4 weeks

**S1. Master Batch tracker (Notion integration)**
- Operator creates Notion DB "Master Batches" with: batch ID, mixes×shakers, target qty, packed qty, status, owner, ship date
- Share DB with Cowork Notion MCP integration
- I build a Notion → batch-board renderer (scaffold exists in `05-03 SFIB Ops Dashboard/PLAN.md`)
- New page: `wildfag.com/batches.html` — open batches, sub-batches cut, assembler leaderboard

**S2. Real SLA tracking**
- Fetch `sfinbloom.art/shipping-return-policy` → parse handling time + carrier promise
- Compute per-order: days_open vs SLA threshold
- Late-orders queue surfaces in Monday Morning + a dedicated `late-orders.html`
- Signal: which orders need customer-service follow-up *today*

**S3. Push the SQ8- pricing to the live store**
- Single-row dry-run already passed (BAY-CBD-2OZ)
- Full 144-row push: `wildfag-local/`-style audit page reviewed, then SQ admin → Import → upload
- After: re-export, drop into `sq-import-audit.html` to confirm zero diff vs intended state
- Decision pending: do we push at the operator's chosen time (current live prices are below formula on 4 of 4 mapped shakers, so this raises prices)

**S4. Per-mix cover-weeks override**
- Currently `purchasing.html` uses one cover-weeks setting for all mixes
- Add per-mix override: e.g. NE/MW/SE = 6 weeks (top sellers, more buffer), specialty = 3 weeks
- Stored in `inputs/policy/cover-weeks.json`

### LATER · next 1–3 months

**L1. Tracking number → live ETA**
- Operator pastes tracking number into incoming-shipments.csv
- Daily script polls carrier API (USPS / UPS / FedEx) for updated ETA
- Falls back to the manual `expected_arrival` if no tracking known
- Dashboards update automatically without operator touch

**L2. Forecasting layer**
- Ingest 4+ weeks of order data (we currently have 2 months of sample)
- Compute: lb/wk velocity, weeks-of-cover, projected stockout date
- Seasonal lift modeling (May–Aug peak)
- Reorder trigger: `weeks_cover < lead_time_days/7 + safety_buffer` → flag amber even if currently above min

**L3. Throughput model from Clockify + ShipStation**
- Days-to-pack = orders_per_day ÷ avg_pack_time (Clockify)
- Days-to-ship = packs_per_day ÷ shipstation_throughput
- Live "pulse" — combined with reorder ETA → customer-service can give real ETAs
- Customer-facing impact: order page can quote "ships in 2 days" instead of "1–3 weeks"

**L4. Bag tier (v3.12) launch**
- Reformulate bag-tier COGS with real costs (see N2)
- Lock retail prices
- Generate 64 new SQ8-B-* SKUs in cogs-matrix
- Update `recipe-matrix.html`, `pricing-table.html` to surface bag prices
- Push to SQ as part of a coordinated launch announcement

**L5. Cloudflare Access (AI agent + team)**
- Replaces basic auth with team-managed access
- Service tokens for AI / scripts to fetch live pages
- Free tier covers up to 50 users
- Lets me actually see how the live site renders (currently I work from operator screenshots)

### PARKED / discoverable

- `seed-distributor.html` — old idea, mostly subsumed by `purchasing.html` (same math, different UI)
- `pricing-lock-v2.html` live-prices toggle — `pricing-table.html` does this better
- ShipStation API integration (currently CSV-drop)
- SquareSpace API integration (currently CSV-drop)
- Markdown wrapper for `*.md` files served from wildfag.com
- Multi-channel SKU bookkeeping (only matters if SFIB ever sells same SKU on Amazon/wholesale at different prices)

---

## 4 · Known gaps in current state

| Gap | Impact | Workaround |
|---|---|---|
| Bag-tier COGS is rough | Margin estimates on 4oz/8oz/1lb bags are unreliable | Numbers labeled "est. gross" in dashboards; operator instinct overrides |
| SLA threshold hardcoded to 3 business days | Late-order count may be off vs. real shipping promise | Operator can mentally adjust until policy is fetched |
| Order CSV is from one historical export | Velocity numbers reflect Mar 7 – May 3 only | Re-export weekly, drop into `reference/`, re-run `orders-to-flow.py` |
| 12 unmapped order rows in flow-anomalies.txt | Tiny revenue blind spot | Add to variant_key.csv as legacy SKUs surface |
| Margin uses formula COGS, not historical cost-at-time-of-sale | Historical orders shipped under different supplier prices than current | Use as estimate; refine when L1 (real cost-batch table) lands |
| `index.html` still says "password-gated" / "wildfag-local" in tagline | Cosmetic — page is gated, but copy reads stale | Single-line edit when noticed |

---

## 5 · The systems map (where data flows)

```
SUPPLIERS                         SHIPSTATION                    SQUARESPACE
   │                                  │                              │
   ▼                                  ▼                              ▼
pcs-invoices.csv                 orders.csv (export)         products.csv (export)
am-invoices.eml (parsed)         ↓                                  ↓
incoming-shipments.csv      orders-to-flow.py             sq-import-audit.html
   │                                  │                              │
   └──────────┬───────────────────────┤                              │
              │                       │                              │
              ▼                       ▼                              ▼
       cogs-matrix.csv          flow-data.json             squarespace-import-shakers.csv
       (locked formula)         (timeseries data)          (144-row SQ8 import)
              │                       │                              │
              └──┬────────────────────┴──────────┬───────────────────┘
                 │                               │
                 ▼                               ▼
        recipe-matrix.html              monday-morning.html
        pricing-table.html              purchasing.html
        sfib-matrix.html                inventory-flow.html
        pricing-lock-v2.html            inventory-dashboard.html
                 │
                 └────────►  wildfag.com  (deploy via Transmit)
```

---

## 6 · Operator's daily ritual (what we're aiming for)

```
☀ 8 am Monday
1. Open wildfag.com/monday-morning.html
   → see week's top sellers + critical alerts
2. Open wildfag.com/purchasing.html
   → see "buy today" total at top, hit suppliers for any non-zero amounts
3. Open Notion → Master Batches → mark this week's planned batches
   → those flow through to wildfag.com/batches.html for the team
4. Done before coffee finishes brewing
```

Currently we're at step 2 (purchasing live today). Step 3 needs the Notion DB. Step 1 needs SLA tuning.

---

## 7 · Hand-off checklist for any future helper

If someone (AI or human) is picking this up cold:

1. Read `COMPENDIUM.md` for folder layout
2. Read THIS file for project state
3. Spot-check `cogs-matrix.csv` to see locked formula values
4. Spot-check `variant_key.csv` to see SKU mapping
5. Open one of the live dashboards to see the render
6. Run `scripts/orders-to-flow.py` to confirm pipeline still works against fresh CSVs
7. Don't fabricate product copy. Don't bulk-import without dry-runs. Don't put PII files in git.

---

*This brief replaces the implicit chat-context spaghetti. Update it whenever a major decision lands; keep it short.*
