feat(settlement): Settlement Simplification Advisor — SGP engine, Smart Switch, Insights pipeline, and insurance pricing on top of greenroom-starter - #4
Open
aliomraniH wants to merge 165 commits into
Conversation
added 30 commits
May 12, 2026 16:51
Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: c271ca84-2576-4c12-898c-010d3cc2172f Replit-Helium-Checkpoint-Created: true
Migrate the Greenroom Next.js project to a Vite + React frontend with an Express API server. This includes setting up the database, API routes, and frontend components and pages. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 41001103-9bf9-4e7b-9db1-3ee02fe2dcfc Replit-Helium-Checkpoint-Created: true
Frontend: convert the Next.js app in .migration-backup/ to Vite + React in artifacts/greenroom. Wouter routes mirror the original pages (/shows, /shows/:id, /shows/:id/settle, /artists, /reports, /context). Tailwind v4 @theme tokens reproduce the cream/deep-green palette, Fraunces + Geist typography, gradients, and noise texture for visual parity. All pages, layout (sidebar, command palette), and lib helpers (format, dealMath, settlementStage, types, api) ported over. Data is fetched via a small useApiData hook against /api/* and a vite dev proxy forwards /api to the API server on :8080. Backend: new Express artifact at artifacts/api-server with Drizzle schema, query helpers, and routes/greenroom.ts exposing GET /shows, /shows/:id, /artists, and /reports. Uses @libsql/client (pure JS, matches the original project) instead of better-sqlite3 to avoid native build requirements; build.mjs externalizes libsql/@libsql/*. DATABASE_URL is honored only when it points at file:; otherwise the local greenroom.db is used. Data files (greenroom.db, ceo-memo.md, dispute-thread.md, transcripts/) copied into artifacts/api-server/data. Out of scope (per task brief): strict typecheck across all packages and any new product features. Some scaffolded shadcn UI components in artifacts/greenroom/src/components/ui still have type errors but are not imported by the migrated app.
Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: be2f8293-78c9-4be8-a56a-77abea8d1894 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/Aq3S8uK Replit-Helium-Checkpoint-Created: true
- Backend: getDealAnalysis() helper + GET /api/deal-analysis route
returning byComplexity, bySize, costs, revenue (24-month window).
- Frontend: derived isUnsupported / isDisputed flags on shows list
rows; new Unsupported (amber) + Disputed (rose) badges shown on
shows list rows and on the show detail header (Disputed now also
triggered by any recoupsJson line with status=disputed).
- Two filter toggles above the shows list ("Unsupported only" /
"Disputed only"), multi-select, with live counts.
- New "Deal Analysis" sidebar item + /deal-analysis route with four
sections matching the existing Reports visual language (Card,
Fraunces headers, mono tabular numerics, brand/amber/rose accents).
- All data classifications match the task spec exactly: complexity
treats any non-empty dealNotesFreetext as complex (which puts the
seeded data fully in the complex bucket — accurate to the case
study premise).
- Backend: getDealAnalysis() helper + GET /api/deal-analysis route
returning byComplexity, bySize, costs, revenue (24-month window).
- Frontend: derived isUnsupported / isDisputed flags on shows list
rows; new Unsupported (amber) + Disputed (rose) badges shown on
shows list rows and on the show detail header (Disputed now also
triggered by any recoupsJson line with status=disputed).
- Two filter toggles above the shows list ("Unsupported only" /
"Disputed only"), multi-select, with live counts.
- New "Deal Analysis" sidebar item + /deal-analysis route with four
sections matching the existing Reports visual language (Card,
Fraunces headers, mono tabular numerics, brand/amber/rose accents).
- All data classifications match the task spec exactly: complexity
treats any non-empty dealNotesFreetext as complex (which puts the
seeded data fully in the complex bucket — accurate to the case
study premise).
- Backend: getDealAnalysis() helper + GET /api/deal-analysis route
returning byComplexity, bySize, costs, revenue (24-month window).
- Frontend: derived isUnsupported / isDisputed flags on shows list
rows; new Unsupported (amber) + Disputed (rose) badges shown on
shows list rows and on the show detail header (Disputed now also
triggered by any recoupsJson line with status=disputed).
- Two filter toggles above the shows list ("Unsupported only" /
"Disputed only"), multi-select, with live counts.
- New "Deal Analysis" sidebar item + /deal-analysis route with four
sections matching the existing Reports visual language (Card,
Fraunces headers, mono tabular numerics, brand/amber/rose accents).
- All data classifications match the task spec exactly: complexity
treats any non-empty dealNotesFreetext as complex (which puts the
seeded data fully in the complex bucket — accurate to the case
study premise).
Refactor `getDealAnalysis` in `artifacts/api-server/src/lib/queries.ts` to use `parseRecoups` for consistent handling of recoup data and ensure all disputed amounts are correctly aggregated. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 7f8d3290-8f1e-4dfe-ad52-52f38d951c26 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/wH8ouL0 Replit-Helium-Checkpoint-Created: true
…hows list Original task: Make every chart row/bar/card in Deal Analysis (complexity, deal-size, expense, recoup, deal-type) navigate to /shows pre-filtered to that slice, and make the Shows list filter state URL-driven so filter combinations are linkable. Changes: - artifacts/api-server/src/lib/queries.ts: getAllShows now also returns per-row expenseCategories, recoupCategories, and disputedRecoupCategories so the client can filter by those slices without a second query. - artifacts/greenroom/src/lib/types.ts: ShowListRow extended with the three new arrays. - artifacts/greenroom/src/lib/dealClassify.ts (new): client-side mirror of the server's classifyComplexity / classifySizeBucket so each row can be tagged with its complexity + size bucket for filtering. - artifacts/greenroom/src/pages/shows.tsx: passes complexity, sizeBucket, dealType, and the category arrays through into ShowsList rows. - artifacts/greenroom/src/pages/shows-list.tsx: filter state now read from and written to the querystring via wouter's useSearch + useLocation. Added drill-down filters: complexity, size, dealType, expense category, recoup category (with optional disputed-only). Active drill filters show as removable chips above the list, plus a "Clear all" affordance. - artifacts/greenroom/src/pages/deal-analysis.tsx: complexity cards and expense/recoup rows are wouter Links; deal-size and deal-type table rows navigate via setLocation on row click. Disputed-heavy size buckets carry the disputed=1 filter through; recoup rows that have any disputed value carry recoupDisputed=1 through. Subhead updated to mention the drill. No deviations from the task. Verified by visiting /deal-analysis and several drill targets (/shows?complexity=complex&disputed=1, /shows?size=$5–15K&disputed=1, /shows?recoup=marketing&recoupDisputed=1, /shows?dealType=flat) — each renders the correct filtered list with chips. Pre-existing typecheck errors in unused shadcn UI files (alert-dialog/calendar/pagination/sidebar) are unchanged and unrelated. Replit-Task-Id: 6217c404-62af-4670-a93f-4a9eab5fbdfb
Replace the existing opengraph.jpg image file used for social media link previews. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 4c39a3f7-7fe4-4949-ade6-0d0c1fb12e7c Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/EhfYzF6 Replit-Helium-Checkpoint-Created: true
Task samay-cbh#8: lock in the classification rules in getDealAnalysis and the disputed-detection contract shared between /shows and /deal-analysis, so future edits can't silently desync the badge / filter / chart numbers. Changes: - artifacts/api-server/src/lib/queries.ts - Export `classifySizeBucket` so tests (and any future caller) can re-derive the bucket without duplicating the rule. - artifacts/api-server/src/lib/queries.test.ts (new) - Spins up an in-memory libsql DB (DATABASE_URL=file::memory:), creates the SQLite schema, and seeds focused fixtures. - Test 1: simple/medium/complex classification, including the "empty bonuses / whitespace notes shouldn't be complex" edge. - Test 2: all five size buckets including Uncapped % and the zero-guarantee edge cases. - Test 3: recoup-disputed settlements count as disputed even when status is "signed"; status-disputed settlements still count. - Test 4: 24-month window cutoff — out-of-window settlements excluded from revenue but still counted in totals/bySize. - Test 5: cross-endpoint check — disputed count from getAllShows (the /shows badge source) equals the disputed totals derivable from getDealAnalysis bySize (rate × settledN per bucket). - artifacts/api-server/package.json - Added vitest devDep + `pnpm test` script. Notes / deviations: - No production behavior change other than exporting one helper. - Tests run via `pnpm --filter @workspace/api-server test`. They are not yet wired into the root build — proposed as follow-up samay-cbh#9. Replit-Task-Id: 9f47089e-e5f2-455b-8d83-02147138b53b
Implement a new API endpoint that gathers comprehensive show data, including freetext notes, and utilizes an LLM to generate a structured summary with key financial figures and identified discrepancies. A frontend button is added to trigger this export and download the resulting JSON file. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 4d2e8e67-e0ec-404a-af5a-f5fb5f363618 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/zev9cgY Replit-Helium-Checkpoint-Created: true
…etrics Introduce a new "Needs Attention" tab listing shows with status mismatches and add "losing money" and dispute rate breakdowns by profitability to the "Deal Analysis" tab. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 4a0eef1a-8f19-4ab0-b806-0fc34f49b34a Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/p64VQpJ Replit-Helium-Checkpoint-Created: true
Integrate a new cross-tabulation analysis into the deal analysis revenue section. This involves backend modifications to calculate deal type and size bucket combinations, including losing money rates and dispute rates, and frontend updates to render this data in a new table component. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 693a1d48-b23b-45b7-b863-98000ba96794 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/x1lAij6 Replit-Helium-Checkpoint-Created: true
Integrate a new "needs attention" metric into the deal analysis cross-tabulation, including backend data aggregation and frontend visualization, alongside existing losing money and dispute rates. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: ca0f4062-2695-449c-8a75-59995dc3d069 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/CoUo2Ko Replit-Helium-Checkpoint-Created: true
Implement a new API endpoint and UI for the Insights tab, which processes settlement data to identify and categorize common friction points and complaint themes using AI. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: a3c4bb1a-ff2e-4940-bde4-c8b4b82c7b56 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/anOfBjQ Replit-Helium-Checkpoint-Created: true
…tering Update backend queries to include top deal type, positive and negative review summaries, and attention counts. Modify frontend to display this information on artist cards and implement a deal type filter. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 60dc2bde-9e30-43da-8e3a-3c64aade29b4 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/VyauVsU Replit-Helium-Checkpoint-Created: true
Introduce a new Settings page allowing users to configure LLM providers (Anthropic, OpenAI), API keys, and models, with persistent storage in the database. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: e3afb436-02ba-4b7d-9e0b-f2872a14cefb Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/VyauVsU Replit-Helium-Checkpoint-Created: true
Reset the greenroom.db database to clear cached settings and data. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 627feeb8-ed30-41c3-ad78-4c1ef11be8f8 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/VyauVsU Replit-Helium-Checkpoint-Created: true
Update README with project overview, tab functionality, and detailed calculation explanations. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 7eedb2c9-3ed6-4743-9dfc-399a2b00bd72 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/VyauVsU Replit-Helium-Checkpoint-Created: true
Modify the settlement shield feature prompt to accurately represent the verified data regarding deal payouts, expense averages, and dispute reasons, aligning the document with the latest analysis. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 81a53d8d-a602-421a-9f04-b78831684f21 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/VyauVsU Replit-Helium-Checkpoint-Created: true
…al data Implement the Smart Switch feature, including database schema changes for storing suggestions, API endpoints for generating, accepting, and declining suggestions, and frontend components to display and interact with the feature on both show detail and shows list views. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: b8d96962-8782-4ffd-b0e5-8edb9ae0e4a1 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/8SIefuv Replit-Helium-Checkpoint-Created: true
Update the system to include upcoming shows in the list, allow filtering for them, and enable the Smart Switch functionality for prospective deals, providing a negotiation lever for future agreements. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 269a6039-ede8-49db-bf25-618ff26a259f Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/CgWf2mo Replit-Helium-Checkpoint-Created: true
Add a new filter for "switch eligible" upcoming deals and a celebratory emoji for accepted switches. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 74d344a0-825c-4721-a855-51d4fffd184b Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/xM8VvVk Replit-Helium-Checkpoint-Created: true
Adds a new "switchedOnly" filter to the shows list, making the "switched" chip clickable to filter results. Also introduces a "Run Smart Switch" button on actionable upcoming rows. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: adc84423-7749-4be9-8af4-5d4b3f55be39 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/aXaTtis Replit-Helium-Checkpoint-Created: true
Introduce a new API endpoint and frontend component to display potential savings from the "Smart Switch" feature, and refactor the `countPriorShowsAtVenue` function to efficiently calculate prior shows using a precomputed index and binary search. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 714c056d-8bf6-490b-a72f-4c36ba18a28c Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/W0MvXZb Replit-Helium-Checkpoint-Created: true
New `getSwitchProjectedGrid({months})` in switchSavings.ts and
`GET /api/insights/switch-projected-grid` route. For the last 6 months
of settled (signed/finalized/paid/disputed) vs / % of net / door
deals it bins by dealType × sizeBucket and reports — per cell — the
actual losing-money / disputed / attention rates next to the same
rates re-derived under the Smart Switch counterfactual. losing is
recomputed from the projected payout (gross − projectedPayout −
expenses < 0); disputed and attention are modelled as 0 (every
attention kind in this app traces back to recoup arithmetic that
pre-agreed Smart Switch terms eliminate). Cell also reports money
delta to venue.
Frontend: new `SwitchProjectedGridSection` on /insights below the
savings card. Headline strip shows totals (money saved, loss-making
nights avoided, disputes avoided, attention items avoided) and the
dealType × bucket grid renders each cell as `n=N`, money delta, then
a 3-row metric stack with `actual% (n) → projected%` colored green
(improvement) or red (regression). Uses the same existing types/api
plumbing pattern.
Result is intentionally honest: door $0–1K saves $13K and drops
losing 100%→17%, but vs $1–5K shows the flat overpaying ($17K
delta, 26%→46% losing) — surfacing the real per-cell tradeoff
rather than a marketing claim.
Files: switchSavings.ts, routes/greenroom.ts, types.ts, api.ts,
pages/insights.tsx.
Fix data integrity issues by restoring two deals to their original "vs" type from the starter database, and regenerate the Deal Analysis and Insights tabs. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 6dbf1ec6-ec01-4622-a002-cce61664ca5b Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/FoZwDMB Replit-Helium-Checkpoint-Created: true
Update the projected grid calculation to include 12 months of data and add a collapsible section explaining the flat contract computation logic, including formula and parameters. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 3a35cacf-2f07-4ac4-809f-528fcdd52b25 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/zCZVp8S Replit-Helium-Checkpoint-Created: true
Update API and frontend to include 'flat' and 'percentage_of_gross' deal types in the projected grid, alongside a redesigned cell layout for clearer before/after comparisons and a new `switchApplies` flag. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: e618deb9-308f-4a7c-b3c7-5433ee10dc36 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/s0cZgpD Replit-Helium-Checkpoint-Created: true
…ence
1. Shows-tab health widget now matches the spec exactly:
- Tile 1: maturity badge with stage + settled count (unchanged).
- Tile 2: this-month vs trailing-3-mo expense-%-of-gross delta with arrow.
- Tile 3: calibration freshness ("X of Y calibrated · refreshed Xm ago").
- Each tile is a wouter <Link> to Deal Analysis / Insights.
Server: AccountHealth payload extended with expensePctOfGross and
calibration (calibratedCount/totalCount/generatedAt).
2. New Insights "Expense friction by cell" section (distinct from
CalibrationSection): for each dealType × bucket with n ≥ 5, surfaces
mean + P75 of expensePct, top expense-category drift vs venue average,
and clustered LLM themes filtered to expense/hospitality keywords
(reuses the existing insights cluster cache). Backed by new
getExpenseFrictionByCell() + GET /api/insights/expense-friction.
3. Artist expense profile (calibration.ts + UI) now exposes
recency-weighted mean (6-mo half-life), max, stddev, and the spec's
"P75 vs venue genre P75 with delta + confidence chip" for artists with
≥3 settled shows. Confidence uses artist-level thresholds (≥10 high,
≥5 med, ≥3 low), not the venue maturity bands.
4. Cache invalidation: insights enrichment loop now calls
clearCalibrationCache() after every settlement positive/negative
summary write, so calibration baselines stay consistent with the
latest enrichment data.
Also fixed a pre-existing issue where p75Confidence reported "none" for
mid-sample artists because it reused venue maturity thresholds.
- Add isSettledShowStatus() predicate (settled|closed) and apply consistently to computeCalibration, getArtistExpenseProfile, account- health monthly ratios, and getExpenseFrictionByCell so draft/submitted/ in-review/disputed settlements no longer skew baselines, maturity, or artist expense profiles. - Show-meter total cap source: distinguish deal-contract caps from venue-computed caps via new TotalCapSource union member "deal_expense_cap". Propagated through types.ts and show-meter label. - AccountHealth.calibration freshness now counts the 8 spec calibration primitives (bucket caps, hospitality, genre P75, breakeven, fee rate, dispute baseline, SGP drift, artist profile maturity) instead of the per-category venue_computed count. - Move ShowMeter on show-detail page directly above the Expenses card.
Shows tab no longer surfaces the three calibration summary tiles (maturity / expense-% delta / freshness). User feedback: those summaries pollute the dashboard and become noise. New behavior: - `AttentionWidget` renders top 3 items needing booker action. - Sources: existing notes-vs-status, disputed-recoups-on-signed, stale dispute, missing-settlement, plus a NEW `expense_overrun` kind for settled shows whose total expenses exceed the contract cap (or venue P75 by bucket) by >=25%. - Server now ranks items by severity (high vs med) then date desc and stamps each with a stable id (`kind:showId`). - Each item: severity icon, kind title, artist + date, detail, evidence quote, Open → /shows/:id, and a kebab menu with "Mark done" (dismiss) and "Snooze 7 days". - Whole widget is collapsible. Per-item dismiss/snooze + collapse state persisted to localStorage (no new tables). - Widget hides itself when no active items remain. Touchpoints: lib/queries.ts (kinds, severity, expense_overrun, sort), lib/types.ts mirror, pages/needs-attention, pages/insights, pages/deal-analysis (new kind label entries), shows.tsx (import swap), account-health.tsx removed.
Updates system prompt to enforce markdown formatting for AI responses and introduces a new component to render markdown bullets and links to shows/artists in a new tab. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 31c344d2-0bcb-4246-83d1-3859608dfbf9 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/SQsX2gg Replit-Helium-Checkpoint-Created: true
Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 8f093c2a-1f35-4507-9f97-4a726887a029 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/SQsX2gg Replit-Helium-Checkpoint-Created: true
Replit-Commit-Author: Deployment Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 2c99cdd3-f9b2-4a39-8069-3d27d6d4ae69 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/SQsX2gg Replit-Commit-Deployment-Build-Id: fa3ee74c-ca9e-4556-8b90-195fb5f34731 Replit-Helium-Checkpoint-Created: true
Updates backend to include historical show data and peer comparisons for artist expense profiles. Enhances frontend component with new charts and visualizations for trend analysis and category spending. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 8dff081e-1967-44a1-984f-77fa6f5aa312 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/eWsBVgA Replit-Helium-Checkpoint-Created: true
Update Expense Profile component to use amber for peer comparison bars and reposition the AI prompt section to appear before the Expense Profile card. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 0d1f7783-4166-4135-87b1-81b07ee44bd5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/buU6CNN Replit-Helium-Checkpoint-Created: true
…rompt Update the artist expense profile to improve color contrast for peer comparison bars and move the AI prompt section above the expense profile. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 28b85dab-3fba-4be4-bf8a-65ec80c503e6 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/buU6CNN Replit-Helium-Checkpoint-Created: true
Update backend and frontend to display gross revenue, net to venue, and deal types for expense analysis. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: ca08b00b-da06-4d22-9b51-b9bcdcfaca42 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/tRMxU8o Replit-Helium-Checkpoint-Created: true
Enhance the `AiPrompt` component with new props for subtitle, placeholder, and custom suggestions, and integrate it into the deal analysis page with tailored prompts. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: d620d2c3-ed31-41c5-9183-29c221bab19c Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/xD94HWP Replit-Helium-Checkpoint-Created: true
Implement a `computeNetToVenue` helper function and integrate it across API endpoints, including `getAllShows`, `getShowById`, and `getArtistProfile`, to consistently display the venue's net earnings for each show. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 3e9a78af-5acf-4dd7-bbf1-45aae79b0539 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/xD94HWP Replit-Helium-Checkpoint-Created: true
Includes last 6 months of show finance data in AI context and adds a data disclaimer to all AI responses. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 96db8987-4a76-4bc3-9878-1736b015fbe2 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/xD94HWP Replit-Helium-Checkpoint-Created: true
Replit-Commit-Author: Deployment Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: d0480c87-b5dd-4f7e-87c9-02e5f2288404 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/xD94HWP Replit-Commit-Deployment-Build-Id: e8f8e0e7-c445-43d5-92f1-f8b465d67b72 Replit-Helium-Checkpoint-Created: true
Create OVERVIEW.md to summarize project purpose and update README.md to link to all documentation. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 01513a89-1c44-44ce-9559-119f9a20415b Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/uqlWjH2 Replit-Helium-Checkpoint-Created: true
Display the projected venue net on the show detail page and update demo data to ensure accurate confidence ranges and positive venue net on historical shows. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 244a6b5b-9c5b-489b-82cd-ac7c6321c240 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/nX0ZK3D Replit-Helium-Checkpoint-Created: true
Update UI components and data seeding to ensure consistent financial projections and rename "Guarantee" to "Agent guarantee" for clarity. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 820dd347-d70f-46d8-8d8b-61c4dfc69d6e Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/DDQzC7v Replit-Helium-Checkpoint-Created: true
Update database schema and API logic to store and display projected venue net for both SGP and current deals, enabling more accurate deal comparisons. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 4940cbb2-6d5e-4b7c-a8b5-3b5e15bdd6f0 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/BXR2cyj Replit-Helium-Checkpoint-Created: true
Refactor smart guarantee logic to accurately reflect venue net projections based on actual expenses and deal-type specific artist payouts. Updates include conditional expense caps, handling of different deal types (% of gross, door, etc.), and a tie band for projections. The UI is updated to display these changes, and a new HTML document detailing the SGP decision report is included. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: b8d8a5e2-84c0-406d-bfb1-4817b59fd13a Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/NOqhgty Replit-Helium-Checkpoint-Created: true
Fixes an issue where expense caps were incorrectly applied in deal projections, leading to inaccurate comparisons between different deal structures. The venue's actual expenses are now correctly factored into projections, ensuring more realistic SGP (Suggested Guarantee Price) wins for Atlas Court and Bramble Hollow. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 59efe3d7-a0d4-4614-8a9f-192870c8fe81 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/cytHa8w Replit-Helium-Checkpoint-Created: true
…idence
The flat-deal fallback at smartSwitch.ts L211-303 used to mirror
deal.guaranteeAmount back as the suggested flat (source=guarantee_amount)
whenever SGP couldn't run and the cell-mean path didn't apply. The data-
hygiene audit rejected that as data mixing: the contract guarantee is
agreement-side input and has no business appearing in a module that's
supposed to be pure history + projection.
New behavior: emit shape="flat", suggestedFlat=null, source=
"insufficient_confidence", confidenceTier carried through from SGP C/D
(default "D"), and a basis string that explains why no number is given
("Not enough confidence or prior data to recommend a flat..."). The UI
in show-detail.tsx renders a "discuss with agent" message instead of a
suggested number.
Per user decision: SGP's max(guarantee, pct × historical netBase) is
intentional personalization and stays as-is. Improve Deal
(dealImprovements.ts) is already audit-clean.
Files touched:
- artifacts/api-server/src/lib/smartSwitch.ts (fallback + SwitchSource enum)
- artifacts/api-server/src/db/schema.ts (sourceEnum)
- artifacts/api-server/src/lib/smartSwitch.test.ts (3 tests rewritten)
- artifacts/greenroom/src/lib/types.ts (SwitchSource union)
- artifacts/greenroom/src/pages/show-detail.tsx (new UI branch)
Verification:
- pnpm exec tsc --noEmit: clean (api-server + greenroom)
- vitest smartSwitch.test.ts: 7/7 pass
- Force-regenerated the two live tier-D rows (Gilded Fern, Hollow Bay);
both now show source=insufficient_confidence, suggested_flat=null.
…idence The flat-deal fallback in smartSwitch.ts used to mirror deal.guaranteeAmount back as the suggested flat (source=guarantee_amount) whenever SGP couldn't run and the cell-mean path didn't apply. The data-hygiene audit rejected that as data mixing: the contract guarantee is agreement-side input and has no business appearing in a module that's supposed to be pure history + projection. New behavior: emit shape="flat", suggestedFlat=null, source= "insufficient_confidence", confidenceTier carried through from SGP C/D (default "D"), and a basis string that explains why no number is given. The UI renders a "discuss with agent" message instead of a fake number. Also fixes downstream switchSavings.ts, which used `suggestedFlat ?? 0` to coerce the counterfactual. With null flats that would have synthesized a $0 counterfactual and inflated savings totals. Both the per-show items loop and the projected-grid loop now skip or no-op on insufficient_confidence rows. Per user decision: SGP's max(guarantee, pct × historical netBase) is intentional personalization and stays as-is. Improve Deal (dealImprovements.ts) is already audit-clean. Files touched: - artifacts/api-server/src/lib/smartSwitch.ts (fallback + SwitchSource) - artifacts/api-server/src/lib/switchSavings.ts (null-flat guards) - artifacts/api-server/src/db/schema.ts (sourceEnum) - artifacts/api-server/src/lib/smartSwitch.test.ts (3 tests rewritten) - artifacts/greenroom/src/lib/types.ts (SwitchSource union) - artifacts/greenroom/src/pages/show-detail.tsx (new UI branch) Verification: - tsc --noEmit: clean (api-server + greenroom) - vitest smartSwitch + switchSavings.vsStats: 10/10 pass - Force-regenerated the two live tier-D rows (Gilded Fern, Hollow Bay); both now show source=insufficient_confidence, suggested_flat=null.
Replit-Commit-Author: Agent Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: a2f4fd88-3284-4148-996f-0026a874290b Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/cytHa8w Replit-Helium-Checkpoint-Created: true
Replit-Commit-Author: Deployment Replit-Commit-Session-Id: b398d11d-5e81-45e6-ab21-3e2363cf248f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 620f693c-620a-4e86-a930-7d2df0d608ff Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d8f876d4-83fd-4deb-87c3-b6e48f21b861/b398d11d-5e81-45e6-ab21-3e2363cf248f/cytHa8w Replit-Commit-Deployment-Build-Id: 9c8467ba-2fe5-41ac-996a-2d780c2528f2 Replit-Helium-Checkpoint-Created: true
Refreshes the data/ snapshot (shows, artists, insights-per-deal, _meta) to reflect current live state, including the insufficient_confidence smartSwitch rows landed earlier this session. Counts: 570 shows, 79 artists, 565 settlements w/ deal context, 523 settlements w/ LLM summary.
Two hardcoded DEFAULT_EXPENSE_CAP_BY_BUCKET tables (one in smartGuarantee.ts, one in dealImprovements.ts) had drifted apart ($5–15K=3500 vs 1750; $1–5K=1500 vs 1850) and were going stale relative to actual expense data. - New lib/expenseCaps.ts derives per-bucket P75 of historical billed (non-absorbed) expenses, grouped by classifyAnalyticsSizeBucket, cached with a 5-min TTL. Fallback chain: bucket P75 (≥5 samples) → venue P75 → $1,750 cold-start. Race-safe: an in-flight compute whose cache was cleared mid-flight is discarded via a generation token. - smartGuarantee.ts and dealImprovements.ts both now consume the same module, so they can no longer disagree. Both look up caps via the analytics classifier to match the keys expenseCaps.ts derived under. - clearGuaranteeCache also clears the expense caps cache. - Tests rewritten: dealImprovements.test.ts now seeds expense rows and verifies P75 derivation, cache busting after data changes, and cold-start fallback. smartGuarantee.test.ts cap-behavior assertions updated to assert engine semantics (cap > deal cap; estimate ≤ cap) rather than the now-removed magic constants. Note: pre-existing failures in switchSavings.test.ts (introduced by the insufficient_confidence filter in 316841b) and queries.extra.test.ts (today-date drift) are unrelated to this change and left as-is.
Replaces the hardcoded DOOR_EXPENSE_CAP = 1500 constant with a call to getExpenseCapForBucket(bucket) so door hybrid projections in Smart Switch stay in sync with the data-driven P75 cap derived by expenseCaps.ts — the same source now used by smartGuarantee.ts and dealImprovements.ts. switchSavings.ts already reads the persisted doorExpenseCap from the DB row written by smartSwitch, so new suggestions will automatically carry the live cap through. The legacy ?? 1500 fallback in switchSavings.ts is left as-is for older rows where doorExpenseCap was never stored. https://claude.ai/code/session_01SBHiVM8vWYhpGw1vSVCVoy
Comprehensive context document covering: project structure, SGP/Smart Switch/Door Hybrid formulas with numerical check values from the two audit reports, what the two commits on this branch fixed (data-driven expense caps + smartSwitch wiring), and a prioritised task list for the next agent (fix 8 pre-existing test failures, then dealMath.ts vs/pn/door support). https://claude.ai/code/session_01SBHiVM8vWYhpGw1vSVCVoy
Externalize door expense cap to dynamic bucket-based configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Greenroom's settlement tool works for flat and % of gross deals — but
62% of deals at The Crescent fall outside that coverage. Mariana, the
lead booker, settles them in a Google Sheet at 2am. The tour manager
checks the math on a phone calculator. The agent reads a PDF the next
morning and emails back with questions.
The root cause is not a missing calculator. Mariana already has one
and it works. The problem is structural: deal terms written in prose
that two people read differently at midnight, expense data scattered
across four systems, and deal structures that generate disputes by
construction — door deals that lose money 93% of the time, and vs
deals in the $1–5K bracket that dispute at 3× the rate of equivalent
flat deals on similar economics.
A more powerful tool built on top of that substrate inherits every one
of those problems. The correct move is to simplify the deal structures
first, generate clean data, and let that foundation carry AI tools
that are actually reliable. That is what this branch builds.
Why this slice
Two deal types were selected where the data is unambiguous and the fix
is actionable now:
Phase 1 — Door deals ($0–1K)
27 of 29 door deals lost the venue money over 24 months (−$29K
aggregate net). The structure pays the artist the entire pool above
expenses by construction; the venue has no upside regardless of
how the show performs. 6 deals are immediately switch-eligible;
projected savings $13,211 at ~$2,200 per converted deal.
Phase 2 — vs and % of net ($1–5K)
137 vs deals in this bracket dispute at 12.4% vs 3.8% for flat —
more than 3× the rate on substantively similar economics. 87.2% of
vs deals the percentage clause fires (mean overshoot ~$2,338/show),
so the conversion is calibrated to the actual historical payout,
not a discount from it. 34 deals immediately eligible; projected
savings $9,186.
Key data distinction: the analytics cross-tab (137 / 29 deals) is
the unconditional structural evidence. The switch-projected-grid
(34 / 6 deals) applies strict eligibility — settled + pre-show
inputs available + valid SGP suggestion — and is the actionable MVP
target. As each converted deal generates clean data, eligibility
expands and the savings compound.
Not in scope (deliberate):
— Universal Vs deal calculator: disputes are not an arithmetic
problem; Mariana already has a calculator
— AI extraction of freetext deal notes: hides ambiguity rather
than eliminating it
— $5–15K deals: complexity requires human judgment; 37-show sample
is too thin for safe suggestions
— Agentic advancing: requires clean input data; Phases 1 and 2
produce that data first
What shipped
Smart Guaranteed Price (SGP)
7-step deterministic waterfall: resolve expected gross (source
waterfall: artist-at-venue → artist-anywhere → agent-history →
cell-mean → venue-mean → capacity-proxy) → deduct 10% ticketing
fees → cap expense estimate (lower of signed cap and per-bracket
default: $1,500 for $1–5K) → compute net base → project percentage
payout → winner = max(guarantee, payout) → roundTo50.
Suggested flat ≥ contract guarantee always — converting never
underpays the signed number. Full auditJson on every suggestion.
Confidence tiers A–D (deterministic, no model) gate Smart Switch.
Smart Switch
vs/$1–5K: SGP flat at A/B confidence; guarantee_amount fallback
at C/D; tier D emits no suggestion and defers to the booker.
Door (any bucket): $500 artist floor + 60/40 split above $1,500
expense cap. Provenance badged per suggestion.
Improve Deal
Caps-only suggestions (expense cap, hospitality cap) for already-
supported deals. Does not convert deal types.
7 tabs
Shows, Artists, Reports, Deal Analysis, Needs Attention, Insights,
Settings — all computed live, nothing mocked.
Insights pipeline
Two-stage LLM: per-settlement summary (concurrency 8, idempotent)
→ per-cell complaint clustering ≤5 themes. Switch-Savings backtest
replays engine against last 12 months to compute money and time
saved per deal.
Phase 3 — settlement protection (post-MVP, optional)
Product 1 (Instant Dispute Pay): licensed embedded insurance
partner; 4.37% × $345 avg = $15.07 expected cost; $30/show
one-sided; tiered by source deal type dispute rate.
Product 2 (Suggestion Accuracy Pay): Greenroom-funded beta; Basic
$400 / Standard $1,100 / Pro $1,900 caps covering 29.5% / 57.1% /
80.1% of historical gaps; Pro required for door conversions (mean
gap $2,097 exceeds Standard cap).
Data
503 settled shows · $3.20M gross · 4.37% dispute rate (22/503)
SGP backtest: 12-month · n=156 · median gap $870 · p75 $1,569
Commit: 30ca767
Links
App: https://greenroom-starter.replit.app/
PM memo: https://claude.ai/public/artifacts/339ab5c7-8c8a-4ca8-a643-bca6ae757d8a
Supporting docs: https://claude.ai/public/artifacts/74d18ae1-0be8-4728-a88c-cb0b09118830
Demo (Loom): https://www.loom.com/share/7af891243260407bb42da7ce70a56607