Plane: ops SQLite (operations.db) · public Pages bake · agent API
Artifacts: public/registry/limit-raises.json · portal /portal/limits/ ·
ops-summary limitChanges Secrets: none for board bake; agent read paths
use existing serve-public / Pages auth where wired
Detect sportsbook account limit changes, enrich with multi-factor context (handle, CLV, risk inverted), seal digests, and connect each row to partner/downline hierarchy, sportsbook behavior, state licenses, geo profiles, ZIP-prefix clusters, and regulatory audit counts.
operations.db
partner_account_limits · limit_raise_context · (optional) limit_predictions
│
├── AccountLimitsRepository # detect / seed / recent changes
├── PartnerAnalyticsRepository # capture context · multi-factor score · seal
├── LimitRaiseReport # Bun.inspect.table + inspect.custom
├── predictLimitRaise # forecast next raise
│
├── tools/ops-check-limits.ts # ops:limits:check · :demo · :multi · :alerts
├── tools/capture-raise-context.ts # ops:limits:capture
├── tools/ops-limit-predict.ts # ops:limits:predict
├── tools/seed-limit-patterns.ts # multi-partner/downline/state/ZIP fixture
├── exportLimitRaisesSnapshot # ops:snapshot → /registry/limit-raises.json
│
├── Local: serve-public agent handlers (live SQLite)
└── Pages: GET /api/agents/v1/limits/raises → ASSETS snapshot (read-only)
DB home: operations.db (not partner.db). Wire AccountLimitsRepository
/ analytics against the ops connection used by ops:snapshot and serve-public.
# 1. Demo seed + multi-factor tables (CLI)
bun run ops:limits:demo
# ≡ ops-check-limits --force-seed --multi → LimitRaiseReport inspect tables
# Connected fixture: 3 partners · 5 downline nodes · 5 books · MA/NJ · 5 ZIP clusters
bun tools/seed-limit-patterns.ts --force --bake
# 2. Check / capture / predict
bun run ops:limits:check --partner partner-42 --multi
bun run ops:limits:capture --inspect
bun run ops:limits:predict --partner partner-42 --inspect
# 3. Bake registry + portal companion (48h window, capture missing context)
bun run ops:snapshot # writes public/registry/limit-raises.json
# 4. Local portal
bun run serve:public:hot # open /portal/limits/ · /registry/limit-raises.json
# Agent (local live SQLite):
# GET /api/agents/v1/limits/raises?node_id=partner-42&hours=24
# GET /api/agents/v1/limits/raises?node_id=partner-42&format=table
# GET /api/limits/summary?format=table
| Layer | Path | Role |
|---|---|---|
| Schema / detect | lib/account-limits-repo.ts |
partner_account_limits · detectRaises · CLV/line enrich · seedAccountLimitsDemo · queryRecentLimitChanges · alert formatters |
| Multi-factor | lib/operations/partner-analytics-repo.ts |
limit_raise_context · computeMultiFactorScore · seal proofs · exportLimitRaisesSnapshot · captureAllMissingRaiseContexts |
| Connected patterns | lib/operations/limit-patterns.ts |
deterministic partner/downline seed · book/state/ZIP aggregates · hierarchy/geo/license/proof audit coverage |
| CLI report | lib/operations/limit-raise-report.ts |
LimitRaiseReport · LIMIT_*_TABLE_PROPERTIES · Bun.inspect.table + [Bun.inspect.custom] · deep Uint8Array digests |
| Agent HTTP | lib/operations/limit-raise-agent-api.ts |
raises / record / summary / analyze / predictions · ?format=table\|text\|inspect on raises+summary |
| Prediction | lib/prediction/limit-prediction.ts |
predictLimitRaise · backfill · cycle |
| Predict report | lib/prediction/limit-prediction-report.ts |
forecast inspect.table / inspect.custom |
| CLI — check | tools/ops-check-limits.ts |
ops:limits:check · :all · :clv · :multi · :demo · :alerts |
| CLI — capture | tools/capture-raise-context.ts |
ops:limits:capture · optional --inspect |
| CLI — predict | tools/ops-limit-predict.ts |
ops:limits:predict · :predict:json · --inspect |
| CLI — analyze | tools/ops-limit-analyze.ts |
ops:limits:analyze · :analyze:json |
| CLI — connected seed | tools/seed-limit-patterns.ts |
--force replaces only limit-demo-* rows · --bake writes the limit registry snapshot |
| Bake | exportLimitRaisesSnapshot (analytics) · tools/ops-snapshot.ts |
companion bake → public/registry/limit-raises.json |
| Portal UI | public/portal/limits/index.html |
board · filters · multi-factor score badges · 48h · summary/registry fallbacks |
| Pages edge | functions/api/agents/v1/limits/raises.ts · …/record.ts · functions/api/limits/summary.ts |
snapshot GET · record 503 stub · summary aggregate |
| Route SSOT | lib/http/public-routes.ts |
/portal/limits/ · registry · raises · record · summary · analyze · predictions |
| Weave | lib/http/portal-weave.ts |
surface · artifact · scripts (ops:limits:* · seed-limit-patterns) |
| Ops summary | lib/operations/ops-summary.ts |
limitChanges[] card slice from ops DB |
| Barrel | lib/operations/index.ts |
all limit agent handlers + report properties + analytics helpers |
| Tests | tests/account-limits-repo.test.ts · analytics-multifactor.test.ts · limit-raise-report.test.ts · limit-raise-agent-api.test.ts · limit-patterns*.test.ts · limit-prediction-report.test.ts |
schema · score · inspect · agent · Pages · predict |
| Script | Tool / behavior |
|---|---|
bun run ops:limits:check |
Freshness / changes (default table) |
bun run ops:limits:check:all |
All nodes |
bun run ops:limits:check:clv |
CLV-enriched |
bun run ops:limits:check:multi |
Multi-factor + context |
bun run ops:limits:demo |
Force-seed demo + multi report |
bun run ops:limits:capture |
Capture missing raise context rows |
bun run ops:limits:alerts |
Deep alerts / channel publish path |
bun run ops:limits:predict |
Forecast next raise (CLI) |
bun run ops:limits:predict:json |
Forecast JSON only |
bun run ops:limits:analyze |
Granular book/sport/market breakdown |
bun run ops:limits:analyze:json |
Analyze JSON only |
bun run ops:limits:seed-patterns |
Connected multi-partner seed + registry bake (seed-limit-patterns --force --bake) |
bun run ops:snapshot |
Bakes limit-raises.json (capture + 48h) |
bun --console-depth=6 run ops:limits:demo # deeper nested digests
bun run ops:limits:check --partner partner-42 --multi --inspect
bun run ops:limits:predict --partner partner-42 --inspect
| Surface | Path | Mode |
|---|---|---|
| Portal board | /portal/limits/ |
Static HTML; prefers live summary / registry |
| Registry bake | /registry/limit-raises.json |
ops-snapshot companion (48h · multi-factor) |
| Ops summary | ops-summary.limitChanges |
Live SQLite when baking summary |
| Agent raises | GET /api/agents/v1/limits/raises?node_id=&hours= |
Local: SQLite · Pages: snapshot |
| Agent table | same + ?format=table\|text\|inspect |
LimitRaiseReport text/plain (local + Pages) |
| Record | POST /api/agents/v1/limits/record |
Local write · Pages 503 stub |
| Public summary | GET /api/limits/summary · ?format=table |
Local SQLite · Pages snapshot aggregate |
| Analyze | GET /api/limits/analyze |
Local only |
| Predictions | GET\|POST /api/limits/predictions |
Local only |
| Condition | Response / behavior | Fix |
|---|---|---|
Missing node_id on raises |
400 + example URL | pass node_id |
Bad hours |
400 (local + Pages) | positive number ≤ 30d |
Snapshot missing / empty byNode (Pages) |
503 + bake links | ops:snapshot or seed-limit-patterns --force --bake |
| Record on Pages | 503 mutations not available | local serve-public |
| Invalid JSON / fields on record | 400 | required fields + finite max_wager |
| SQLite / schema errors on GET | 500 + demo hint | ops:limits:demo |
| No changes in window | 200 empty / table hint | seed or widen hours |
LimitRaiseReport)console.log(report) → multi-section layout via [Bun.inspect.custom].
Explicit columns:
| Section | Properties const | Columns |
|---|---|---|
| Raises | LIMIT_RAISE_TABLE_PROPERTIES |
node · book · sport · market · type · prev · new · dir · score · line5m · when |
| Drivers | LIMIT_FACTOR_TABLE_PROPERTIES |
limit_id · factor · weight_score · rank |
| CLV | LIMIT_CLV_TABLE_PROPERTIES |
limit_id · player · tier · delta |
| Context | LIMIT_CONTEXT_TABLE_PROPERTIES |
limit_id · metric · value |
| Proofs | LIMIT_PROOF_TABLE_PROPERTIES |
limit_id · algorithm · digest_hex · digest_bytes · signed · valid |
Idempotency of Bun.inspect.table is proven in tableProof() / tests (same
pattern as RouteProbeReport).
Positive weights; risk metrics inverted via ranges (high violations /
chargebacks / volatility lower score). SSOT: MULTI_FACTOR_WEIGHTS /
MULTI_FACTOR_RANGES in partner-analytics-repo.
| Factor | Weight | Notes |
|---|---|---|
total_handle_7d |
0.20 | Volume |
avg_clv_7d |
0.15 | Closing-line value |
violation_count_30d |
0.12 | inverted risk |
chargeback_count_30d |
0.12 | inverted risk |
kyc_pass_rate |
0.10 | |
partner_profit_30d |
0.10 | |
market_volatility_index |
0.08 | inverted risk |
sportsbook_share |
0.05 | |
top_tier_player_count |
0.04 | |
active_players_7d |
0.04 |
ops-snapshot.md — companion bake owner for
limit-raises.jsonops-loop-throughput.md — outbox / alert enqueue
after recordcompliance-portal.md — sibling portal board patternpublic-plane.md — portal static / registry plane