docs/ECONOMIC-INTELLIGENCE-HANDOFF.md
Economic intelligence — maintainer and agent handoff
Last verified implementation: 2026-10-26. This guide describes the real local app, not a proposed preview. Recheck current source and tests before building on it. Product-wide visual rules live in DESIGN.md; service contracts remain in BLACKROCK.md.
Intent and authorization
The user chose Economic Intelligence as the product's memorable purpose, then requested “FULL ON PRODUCTION” instead of a separate clickable preview. Implemented in apps/rs-palantir in the existing checkout. This did not authorize a new deployment, gameplay mission or credential/harness connection. No GitCafe push or remote release was performed for this implementation.
Preserve the existing Frosted + functional dither components. Shopify's predictable navigation and trading apps' dense research tables informed the flow. Keep both mode names and logos: RS-BLACKROCK for markets and economic intelligence, RS-PALANTIR for the world, swarms and Command. Do not remove older tools to simplify the menu.
Read these files first
| Responsibility | Source |
|---|---|
| Shared shell, routing, mode return, assistant and world handoffs | src/main.tsx |
| Stable route keys, seven groups, preferred landing validation | src/blackrock/navigation.ts |
| Lazy-load boundary retained across mode switches | src/blackrock/LazyBlackrockWorkspace.tsx |
| Search, watches, selection/trail, dossiers, settings, world/swarm callbacks | src/blackrock/BlackrockWorkspace.tsx |
| Navigation components and original bank/API/report tools | src/blackrock/ResearchTools.tsx |
| Economy fetch/job lifecycle, period/basket controls, detailed evidence | src/blackrock/EconomyOverview.tsx |
| Four home questions and item research-leads table | src/blackrock/IntelligenceBrief.tsx |
| Stable eligible-first lead ranking | src/blackrock/intelligence-model.ts |
| Exchange order sides, controls, saved-view UI, exact table | src/blackrock/MarketBoard.tsx |
| Saved-view validation and storage schema | src/blackrock/exchange-views.ts |
| Loaded-row numeric filters, columns and safe CSV export | src/blackrock/exchange-desk-model.ts |
| Market pagination, paused reads and refresh behavior | src/blackrock/useMarketFeed.ts |
| Layout, rail, responsive dossier and home cards | src/blackrock/intelligence-flow.css |
| Existing chart marks, tooltip conventions and dither policy | src/blackrock/DitherChart.tsx, DITHER.md |
| Research assistant context and draft preparation | src/assistant/AssistantPanel.tsx, ASSISTANT.md |
Selected saved-swarm handoff (groupRequest) | src/swarms/SwarmWorkspace.tsx |
Navigation and research flow
| Primary destination | Routes preserved |
|---|---|
| Intelligence | #economy |
| Exchange | #market, #opportunities, #charts |
| Watchlists | #watchlists |
| Bank holdings | #holders |
| Players & fleet | #fleet |
| Production | #production, #economics |
| Research & data | #reports, #tools |
Entry without a URL query/hash uses the validated browser landing preference, otherwise Intelligence. Explicit route and ?follow= / ?cx= camera entry behavior is handled in navigation.ts and main.tsx. Teams & data edits the landing preference.
Typical session: Intelligence → Steel bar → Holders → player dossier → Open in World → Back to research → Steel bar breadcrumb. Item tabs are Overview, Orders, Charts, Holders, Production and History. Orders are aggregate quote evidence, not a list of attributed individual offers. Compare prepares an assistant prompt; there is not yet a standalone comparison matrix.
The shell retains the world/research components across mode changes. Do not replace this with full-page navigation or remount a renderer merely to switch modes. The workspace retains selection, trail and scroll in memory; item tab changes are copied into the selected entity so a breadcrumb restores the correct tab. This is not a promise that a full browser reload restores an unsaved research session. Explicit navigation to a research section currently clears selection/search; switching modes preserves research context.
Desktop dossiers occupy the main work area with one optional assistant panel, avoiding multiple competing inspectors. Navigation collapses on desktop and becomes a labeled selector at narrow workspace widths. Wide tables scroll within their own containers.
Search combines local item/player results and matching existing saved swarms, not inferred or newly created groups. Saved-swarm results are capped at 20 with total-count disclosure. Selecting one sets swarmRequest in the shell; groupRequest selects that group's ID in the mounted Palantir swarm workspace. Research membership never grants ownership or gameplay control.
Data contracts and important traps
- Home price evidence comes from the existing economy service.
EconomyOverviewretains the envelope, its delivery freshness and job state. Its snapshot schema isshared/economy.ts. - Home demand reads
/api/blackrock/v1/research/overview?sort=buyValue&days=7&offset=0. The top listed buy value is a current order snapshot with its own source timestamp. It is not the completed-period price-basket comparison and not executed demand. api()insrc/blackrock/api.tsunwraps envelopes only whenschemaVersion === 1. The swarm group endpoint/api/swarms/v1/groups?q=...&limit=20instead returns{data:{groups,total},asOf,source,coverage,nextCursor,error}. The workspace explicitly readsswarmSearch.data.data. Flattening this incorrectly silently produces a false zero-result UI.- Eligible goods rank ahead of excluded/thin goods, then by absolute price movement with stable item-ID ties. This is a research shortlist, not a buy recommendation.
- Keep fixed-basket movement separate from economy-wide inflation; net GP issuance and complete money stock are unknown.
- Orders may be canceled. Aggregate quantity/value spans price levels; best bid/ask does not establish executable depth.
- Public bank previews are partial. Holders are not identified buyers or sellers. Definition GP is not resale value. Keep friendlies/allies distinct from explicitly owned bots.
- Preparing an assistant question is not sending it. Source age, current entity/tab and coverage belong in context. Never auto-send a prompt when a user merely selects a row.
- Keep the existing coordinated read budgets, caching and collection cadence. This frontend pass adds no scheduler, gameplay action or extra upstream world feed.
Persistence
| Key / state | Meaning |
|---|---|
rs-blackrock:landing | Validated preferred Blackrock entry section |
rs-blackrock:nav-collapsed | Desktop rail preference |
rs-blackrock:exchange-views-v1 | Up to 20 browser-local named views |
rs-blackrock:exchange-density | Existing table density preference |
rs-blackrock:market-visits | Existing browser-local item-visit timestamps |
| Watches, targets, notes, ownership | Existing service storage; not moved into saved-view preferences |
| Selection/trail and resume refs | Mounted component memory; not a persisted global session |
A saved Exchange view contains query, order side, source ranking, period, category/numeric filters, loaded-row sorting, hidden columns and density. Same name replaces the existing saved view. Removing a saved view leaves the current table unchanged. Storage failures are shown; malformed records are bounded/validated by readExchangeViews. Do not replace service-backed watches or ownership with browser-local data.
Frosted, CSS and accessibility lessons
- Installed package is
@whop/react/components; use the existing theme and Radix tokens. No new component library or font loader is necessary. - This installed Frosted version requires
Table.Root > Table.Table > Table.Header / Table.Body. Root is adiv, not the semantic table. Omitting the inner table breaks table semantics and sizing. - Frosted
Cardadds.fui-CardInner. Flex sizing and bottom-aligned actions must account for that wrapper. .br-economyneeds aminmax(0,1fr)grid track. A table's minimum content width otherwise expands the entire phone workspace instead of scrolling only the table.- Keep distinct refs for global research search and the retained, potentially hidden Exchange search. Ctrl/Cmd+K must focus the visible input.
- Keep
[hidden]rules effective. Detailed economy charts mount only when expanded; don't measure responsive charts inside a hidden container. - Respect reduced motion; no continuous dither animation was added. Whole-app light mode remains out of scope.
Continue safely and verify
Run from apps/rs-palantir:
| 1 | pnpm run check |
This runs TypeScript, app tests and a production Vite build. The existing Bun server serves dist; source changes need a build to appear on port 5197. Reuse a running listener. See DEPLOYMENT.md before starting or restarting the service; pnpm run start:blackrock enables the existing collector and is not merely a frontend preview.
Focused regressions:
| 1 | bun test src/blackrock/intelligence-model.test.ts src/blackrock/navigation.test.ts |
Browser checks after flow changes:
- Open Intelligence, search an item, change its tab, inspect a holder, open Palantir and return. Verify tab/query/scroll and viewer continuity.
- Visit Exchange, change side/search/filters/density/columns/period, save/apply a view, reload and reapply it. Remove test-only views afterward.
- Search a known saved swarm and verify the selected group opens; separately test empty/error results.
- Check desktop and 390px phone widths, with assistant open/closed and reduced motion. Assert page/workspace overflow is contained and tables remain semantic.
- After visiting Exchange and returning to Intelligence, check Ctrl/Cmd+K targets the visible search. Prepare assistant drafts without sending billable questions or gameplay commands merely for layout QA.
Recorded validation: 460 tests passed, 0 failed, app TypeScript/build passed; final envelope correction also passed TypeScript/build and live saved-swarm handoff verification. Treat these as dated receipts, not proof of future edits. Validation and screenshots.
At implementation time the app tree was untracked amid unrelated checkout changes. Check current status before editing; use scoped changes and preserve unrelated work. Do not broad-stage, reset or clean the repository. User workflow is Cursor origin / GitCafe, not GitHub; inspect current remotes before release work.
Useful next increments (not implemented promises)
Bank research now has its own primary Bank holdings (#holders) destination. See Bank holdings desk for identity scopes, filtered totals, retained search state, source limits, tests, and the planned owned-bank snapshot/materials/allocation tools. #fleet remains separately reachable. The desk uses the existing /research/bank and /fleet APIs, not full private inventories.
- Persist full research sessions or cross-device saved views only with a versioned state model and migration plan.
- Add a true multi-item comparison workspace; current Compare is a prepared assistant question.
- Add deeper keyboard navigation and automated browser journey tests at the routing/state seams above.
- Improve large frontend chunk sizes without remounting the live renderer or eagerly loading charts.
- Add broader economy baskets only with explicit eligibility, weighting and source/coverage methodology; do not relabel the six-good basket as global inflation.
Bank goals continuation — 2026-10-27
The approved bank workflow now includes local saved searches, exact-item goal drafts with proposed owned-account contributions, desktop inline previews and phone sheets. Read BANK-HOLDINGS.md before extending it. Main seams: BankHoldings.tsx, BankGoalPlanner.tsx, BankHolderPreview.tsx, bank-plans.ts; shared target save is wired by BlackrockWorkspace.tsx. Public previews remain partial, bank-save times unknown, and every allocation needs verification. Local drafts and service-backed accumulation targets are distinct. No transfers or gameplay sessions are executed.
The shared top dock now includes LivePopulation: global online players from the world roster, visible across research and world routes. See DITHER.md for /api/population, poll reuse, source-age semantics and reduced-motion behavior. Do not derive this count from filtered players or friendly/owned identities.
Public distribution setup
The standalone public application now uses shared #settings navigation for local RS-SDK folder discovery and API/CLI/MCP instructions. See LOCAL-PROJECT-SETTINGS.md for server/frontend seams, persistence and the intentional divergence from private roster integrations.