# Brain Dump Template — R94.14 Standard

Adopted from Mike's 2026-05-22 spec (R94.14). Use this for all entity brain dumps in `/entity-context.html`. Structured entries extract ~98% accurately into the JSON `extracted_facts` shape vs ~85% for free-form prose.

The template is the canonical input shape. The extractor (Claude Haiku 4.5 via `/api/entity/:type/:id/notes` POST) reads section headings to drive structured JSON output. Both structured and free-form inputs return the same JSON shape — structured just yields richer, more accurate fields.

## When to use the template

- **ALWAYS** for major customers, vendors, and items (top 50 of each).
- **ALWAYS** when you have time to fill ≥ 5 fields.
- OK to skip when you have only one fact and the entity isn't critical (a one-liner free-form note still extracts cleanly).

## The template

```markdown
# Account Name

## General
- Type: Customer / Vendor / Both
- Who they are to us:
- Relationship summary:
- What we do together:
- Priority / importance:
- Status: Active / Inactive / Prospect / On hold
- Notes:

## Contacts
| Name | Role | Email | Phone | Notes |
|------|------|-------|-------|-------|
|      | Account contact | | | |
|      | Finance/AP/AR | | | |
|      | Operations | | | |

## Finance
- Payment terms:
- Billing method:
- Credit limit:
- Tax status:
- Typical invoice timing:
- Outstanding issues:
- Finance notes:
- (Do not include: bank account numbers, SSNs, full tax IDs, passwords, or private payment credentials.)

## Items They Buy / Sell
| Item | SKU / Internal ID | Buy/Sell | Current Source | Price | Frequency | Notes |
|------|-------------------|----------|----------------|-------|-----------|-------|
|      |                   | Buy / Sell |              |       |           |       |

## Operational Details
- Ordering process:
- Delivery / shipping process:
- Special requirements:
- Packaging requirements:
- Lead times:
- Common problems:
- Escalation path:

## Chatbot-Friendly Facts
- Short summary:
- Key facts the chatbot should know:
- Common questions and answers:
- Last verified:
- Source of truth: Invoice / ERP / Email / Contract / Spreadsheet / Manual note
```

## Field guidance

### General
- **Type** — Customer / Vendor / Both. Drives chat behavior (e.g. price lookups vs cost lookups).
- **Who they are to us** — one sentence the bot uses when introducing the entity.
- **Relationship summary** — when did we start, current health, watch items.
- **What we do together** — what flows between us (orders, deliveries, programs).
- **Priority / importance** — `high` / `medium` / `low`. Drives escalation behavior.
- **Status** — `Active` / `Inactive` / `Prospect` / `On hold`. The bot will refuse to take new-order actions on inactive accounts.

### Contacts
Roles to fill in priority order:
1. **Account contact** — primary relationship owner on their side.
2. **Finance / AP / AR** — who pays invoices (customer) or sends invoices (vendor).
3. **Operations** — day-to-day order placement / receiving.

Leave email/phone blank if not at-hand. Bot doesn't fabricate.

### Finance
- **Payment terms** — `Net 30`, `Net 60`, `End-of-month`, `Due on receipt`, etc.
- **Billing method** — `Email invoice`, `EDI`, `Paper`, `Portal`.
- **Credit limit** — dollar amount or `TBD` if unconfirmed.
- **Tax status** — `Tax-exempt` (with reason) or `Taxable`.
- **Typical invoice timing** — `Monthly close`, `Per shipment`, etc.
- **Outstanding issues** — open AR aging concerns, disputed invoices, payment patterns.
- **Finance notes** — anything the AR/AP team should know on the next interaction.

**NEVER include**: bank account numbers, SSNs, full tax IDs, passwords, credit card numbers. The extractor will redact and flag.

### Items They Buy / Sell
One row per item. Direction = `Buy` (we buy from this vendor) or `Sell` (we sell to this customer). Item entity-page goes the opposite way (sourcing + selling).

Use real SKUs (e.g. `RS7245`) — they cross-link to `/item/<code>`.

### Operational Details
- **Ordering process** — how orders arrive (email PO, portal, phone, EDI).
- **Delivery / shipping process** — frequency, day preferences, freight terms.
- **Special requirements** — kosher, halal, organic, temperature, dock hours, etc.
- **Packaging requirements** — case-pack, palletization, labeling.
- **Lead times** — standard, rush, blackout dates.
- **Common problems** — recurring issues so the bot can preempt.
- **Escalation path** — who owns it on our side + who to call on their side when things break.

### Chatbot-Friendly Facts (the goldmine)

This section is what the bot reads FIRST. Make it dense + correct. The other sections are reference; this section is the bot's working memory.

- **Short summary** — one sentence the bot uses verbatim when introducing the entity. ~15-25 words.
- **Key facts** — 3-5 bullets the bot weaves into answers. Use NAME + NUMBER patterns (e.g. "Tony Belman is primary contact" + "DSO trending 45+ days").
- **Common questions and answers** — pre-canned Q+A pairs the bot can pattern-match against new queries. Example: `Q: What does Driscoll pay for X? → A: Check pricing_master + recent invoice.`
- **Last verified** — date in `YYYY-MM-DD`. Bot will warn user if data > 90 days old.
- **Source of truth** — where to look when in doubt: `Invoice` / `ERP` / `Email` / `Contract` / `Spreadsheet` / `Manual note`. Drives bot's citation behavior.

## Anti-patterns

Hard rules — violating these poisons the bot's training data:

- **NO PII** — no SSNs, no full tax IDs, no bank account numbers, no passwords. The extractor will return the field as `[REDACTED]` and flag in `operational.common_problems`.
- **NO fabrication** — if you don't know payment terms, leave the field blank. The bot would rather say "unknown" than guess.
- **NO marketing tone** — facts only. "Long-term customer" is fine; "valued strategic partner" is selling, not training.
- **NO security/audit details** — don't dump infra, secrets, or audit-log content into entity notes. Use `docs/SECURITY_*.md` for that.
- **NO Markdown headers inside field values** — confuses the extractor. Use prose, not `## subheadings` inside a field.
- **NO stale data without flagging it** — if a price is from 2024, write `(verify — last seen 2024)` not just the price.

## Examples

### Customer example — Driscoll Foods

```markdown
# Driscoll Foods

## General
- Type: Customer
- Who they are to us: Long-term wholesale customer, one of our oldest active accounts
- Relationship summary: Customer since 2019. Stable, predictable orders. Watch AR aging.
- What we do together: Weekly+ deliveries; primary SKUs include kosher kids program items.
- Priority / importance: HIGH — established account, long relationship, ongoing AR concern
- Status: Active
- Notes:

## Contacts
| Name | Role | Email | Phone | Notes |
|------|------|-------|-------|-------|
| Tony Belman | Head of Food Service Operations | | | Primary contact for orders + relationship |
| (Greg Antico) | (pricing interference watch) | | | Monitor — see operational notes |

## Finance
- Payment terms: End-of-month
- Billing method: Email invoice
- Credit limit: TBD (verify in NS)
- Tax status: Active
- Typical invoice timing: Monthly close
- Outstanding issues: DSO trending 45+ days (creeping past 60 recently)
- Finance notes: Sales touch recommended if aging hits 60+

## Items They Buy
| Item | SKU | Buy/Sell | Current Source | Price | Frequency | Notes |
|------|-----|----------|----------------|-------|-----------|-------|
| Chicken kids program | RS9310W | Sell | (kosher vendor) | TBD | Weekly | KOSHER SENSITIVE |
| Egg salad kids | RS7245 | Sell | (kosher vendor) | TBD | Weekly | KOSHER SENSITIVE — kids program |

## Operational Details
- Ordering process: Standard weekly cycle
- Delivery / shipping process: Friday delivery PREFERRED
- Special requirements: Kosher compliance on SKU RS9310W + RS7245
- Packaging: Standard cases
- Lead times: Standard
- Common problems: Spec change requests get nervous reaction — flag any substitutions
- Escalation path: Mike Levine (account owner) → Tony Belman

## Chatbot-Friendly Facts
- Short summary: Established kosher-sensitive wholesale customer since 2019; Tony Belman primary contact; Friday delivery; watch AR aging.
- Key facts the chatbot should know:
  - KOSHER SENSITIVE on RS9310W + RS7245 (kids program)
  - Friday delivery preference
  - Tony Belman is primary contact
  - DSO trending 45+ days — flag if 60+
  - Greg Antico interference watch on pricing decisions
- Common questions and answers:
  - Q: What does Driscoll pay for [item]? → Check pricing_master + recent invoice
  - Q: How is Driscoll doing? → AR aging + DSO trend + last delivery date
  - Q: Can we substitute X on RS9310W? → NO — kosher sensitivity; needs Mike approval
- Last verified: 2026-05-22
- Source of truth: ERP (NetSuite) + Invoice history + Manual notes from Mike
```

### Vendor example — Bongards Creameries

```markdown
# Bongards Creameries

## General
- Type: Vendor
- Who they are to us: Primary cheese supplier for CME-indexed barrel cheddar
- Relationship summary: Long-term vendor relationship; pricing follows CME trailing-week formula + 35% moisture adjustment.
- What we do together: Weekly cheese purchases; we bill some customers off Bongards pricing.
- Priority / importance: HIGH — pricing-formula vendor affects downstream customer pricing
- Status: Active
- Notes: Pricing follows ADR-012 pricing pipeline (CME trailing-week + 35% moisture).

## Contacts
| Name | Role | Email | Phone | Notes |
|------|------|-------|-------|-------|
|      | Account contact | | | |
|      | Finance/AP | | | |
|      | Operations | | | |

## Finance
- Payment terms: Net 30
- Billing method: Email invoice
- Credit limit: N/A (we pay them)
- Tax status: Standard
- Typical invoice timing: Per shipment
- Outstanding issues: None current
- Finance notes: Match invoice to PO before approval — pricing formula must reconcile to CME index of shipment week.

## Items They Sell To Us
| Item | SKU | Buy/Sell | Current Source | Price | Frequency | Notes |
|------|-----|----------|----------------|-------|-----------|-------|
| Barrel cheddar | (TBD) | Buy | Bongards | CME trailing-week + 35% moisture | Weekly | Pricing formula — see ADR-012 |

## Operational Details
- Ordering process: Standard PO via email
- Delivery / shipping process: Refrigerated truck; standard lead time
- Special requirements: Temperature monitoring on receipt
- Packaging: Bulk barrels
- Lead times: ~5-7 days
- Common problems: Pricing reconciliation — CME index slippage if shipment week mis-tagged
- Escalation path: Mike Levine

## Chatbot-Friendly Facts
- Short summary: Primary CME-indexed barrel cheddar vendor; pricing = CME trailing-week + 35% moisture; reconcile invoice to PO shipment week.
- Key facts the chatbot should know:
  - Pricing formula: CME trailing-week + 35% moisture (ADR-012)
  - Reconcile per shipment-week CME index
  - Refrigerated delivery required
- Common questions and answers:
  - Q: What did we pay Bongards for X week? → Check vendor_bill + CME index for that week
  - Q: Is Bongards pricing right? → Compare invoice to CME index trailing week + 35% moisture
- Last verified: 2026-05-22
- Source of truth: Vendor bill + ADR-012 pricing pipeline + CME index history
```

### Item example — RS7245 (egg salad kids)

```markdown
# RS7245

## General
- Type: Item
- What it is: Egg salad portion, kids-program pack
- Why we carry it: Driscoll kids program SKU — kosher-sensitive
- Volume / importance: HIGH — recurring weekly volume on Driscoll
- Status: Active
- Notes: KOSHER SENSITIVE — never substitute without Mike approval.

## Sourcing
| Vendor | SKU at vendor | Current Cost | Lead time | Pack/Size | Notes |
|--------|---------------|--------------|-----------|-----------|-------|
| (kosher vendor) | TBD | TBD | Standard | Per case | Kosher certification required on every lot |

## Selling
| Customer | Their SKU | Current Price | Frequency | Notes |
|----------|-----------|---------------|-----------|-------|
| Driscoll Foods | RS7245 | TBD | Weekly | Friday delivery; kids program |

## Specs & Compliance
- Pack size / case count: TBD
- Storage temp: Refrigerated
- Shelf life: TBD
- Allergens: Egg
- Certifications: KOSHER (mandatory)
- Spec document on file: TBD — needs verification
- Substitution allowed: NO

## Operational Details
- Standard ordering pattern: Weekly per Driscoll cycle
- Lead time from order: Standard
- Common problems: Kosher cert lapse on lot — verify every shipment
- Substitute SKUs (if any): NONE — kosher sensitivity blocks substitution

## Chatbot-Friendly Facts
- Short summary: Egg salad kids-program SKU; KOSHER SENSITIVE; primary customer Driscoll; never substitute.
- Key facts the chatbot should know:
  - KOSHER certification required on every lot
  - Primary customer: Driscoll Foods (weekly)
  - Substitution NOT allowed — Mike must approve any change
  - Pair SKU: RS9310W (chicken kids program)
- Common questions and answers:
  - Q: Can we substitute RS7245? → NO — kosher sensitivity; Mike approval required.
  - Q: Who buys RS7245? → Driscoll Foods, weekly, kids program.
  - Q: What's our cost? → Check vendor_costs_active + most-recent vendor_bill
- Last verified: 2026-05-22
- Source of truth: Item master + Driscoll spec sheet + Mike's manual notes
```

## Cross-references

- **Chat surface** — `get_entity_context` tool (R94.13) reads `extracted_facts` from the active `entity_notes` row. The Chatbot-Friendly Facts section feeds the bot's primary read path.
- **Training entries** — when seeding `decision_corpus` (via `training.html`), reference `Chatbot-Friendly Facts.source_of_truth` for the `source_evidence` field. See `training.html` → 📚 Cross-reference tab.
- **Entity pages** — `/customer/<slug>`, `/vendor/<slug>`, `/item/<code>` Pages Functions render the same data live.
- **Migration / schema** — `entity_notes` table (migration 059). Versioning via `superseded_by`; a new brain dump replaces the prior active row.

## Implementation

- **UI** — `entity-context.html` adds "📋 Use Template (Customer/Vendor/Item)" buttons above the brain-dump textarea.
- **Extractor** — `POST /api/entity/:type/:id/notes` calls Claude Haiku 4.5 with the R94.14 extraction prompt (`src/index.ts` ~line 14905) that detects structured input and extracts per section.
- **Storage** — `entity_notes.extracted_facts` (JSON column). Shape additive: legacy free-form dumps still populate `primary_contact` / `payment_terms` / `preferences` / etc.; structured dumps additionally populate `general` / `contacts` / `finance` / `items` / `operational` / `chatbot_friendly`.

## Versioning

R94.14 spec is **the** standard. Future variants (R94.x) extend the shape additively — older rows keep working. Any breaking schema change requires an ADR in `data/decisions.json`.
