26 Commits
Author SHA1 Message Date
CatoandClaude 76b5c6e8dc fix(links): a link does not preload its target (#418)
Next preloads every link that scrolls into view, and these pages are drawn on
request. Measured in a browser on 2026-11-29: one visit to the home page made
27 preload requests to the server. Solon, built the same way, made 91 to 778
a visit and stopped answering under a handful of readers (solon#643).

components/link.tsx wraps next/link with prefetch={false}; all 167 files that
imported next/link import it instead, and ESLint (no-restricted-imports)
keeps a bare next/link from coming back.

pnpm run verify passes (format, types, lint, 1,144 tests).


Claude-Session: https://claude.ai/code/session_019MDtmvTCDbJAYNKQpNyKzz

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-29 17:25:02 +01:00
CatoandClaude 2f465e24e3 refactor(charts): draw severity, quality trend and output shares with chartkit (#383)
* refactor(charts): draw severity, quality trend and output shares with chartkit

Three charts were still drawn by hand in this app while @bitbaum/chartkit
already ships them, against the packages-first rule (every chart is
chartkit, so a fix made once reaches every product):

- SeverityBar (components/portal/Status.tsx) now draws its 0-12 bar with
  chartkit's Meter (showValue off: the number beside it still opens the
  severity method). The bar gains a meter role with its value and max.
- The quality run-history Trend (components/quality/Trend.tsx) is
  chartkit's LineChart: axis from 80% (or lower) to 100%, dated ticks,
  every run's value on hover/focus and in the hidden table. The caption
  keeps the old accessible sentence. The hand-drawn SVG's CSS is removed
  from app/styles/quality.css.
- Per-country share-of-world-output bars in the quantities profile
  module are chartkit Meters (neutral tone, stretched to the row in
  app/styles/places.css), with the same "per cent of the published world
  total" label.

package-plan.json binds the three files under the charts block.

Claude-Session: https://claude.ai/code/session_019MDtmuvTGrpo3VChP3skH8

* fix(quality): the trend draws each day's latest run

The quality run fires every six hours and chartkit places a point by its
date, so four runs a day stacked on one x. The trend now keeps one point
per day, that day's latest run, and its caption says so.

Claude-Session: https://claude.ai/code/session_019MDtmuvTGrpo3VChP3skH8

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:59:17 +01:00
CatoandClaude Sonnet 5.5 cc7fcb4f1f Company page: what constrains it, what it constrains, and no more "holds 0 of 33" (slice 2) (#270)
* feat(markets): what constrains a company, what it constrains, and a lede that never says holds 0

Two sections in the market frame of every company kind, a lede and two tiles
read from the exposure model; the old dependency module now serves bottleneck
pages only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* style: prettier

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 15:51:29 +01:00
CatoandClaude Opus 5.5 73dd498f49 feat(market-data): share prices, SEC fundamentals and filing-based holders, with Ask tools and charts (#249)
* feat(market-data): share prices, SEC fundamentals and filing-based holders, with Ask tools and charts

Prices: daily split-adjusted closes from Yahoo Finance's chart endpoint (query1,
then query2), stored in research_price_points by /api/cron/prices, read by
priceHistory(ticker, range) with a live fallback; returns, 52-week extremes,
drawdown and moving averages computed in code. Stooq (browser challenge),
Nasdaq (browser agent only) and Alpha Vantage (unadjusted free closes) were
tested and rejected; the reasons and the licence position are in
lib/market-data/prices/chain.ts.

Fundamentals: SEC XBRL company facts per CIK — revenue, margins, R&D, capex,
cash, assets, debt, shares — each point with form, accession and filing link;
a typed "unavailable" with the reason for companies the SEC holds nothing for.

Holders: the proxy's ownership table, structured Schedules 13G/13D filed since
(issuer checked, 0% amendments honoured) and recent Forms 4, with the rest as a
typed remainder that says what it is — never a bare "Other 87%". The company
page's ownership view and share bar carry the same remainder.

Ask: price_history, fundamentals and holders tools; a price question plans
price_history and the answer draws a line chart built in code (answer charts
routed like answer tables); four ask-evals rows.

Keyed by ticker in lib/market-data/identity.ts with a committed seed
(config/market-seed.ts) as the seam for the company universe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* fix(market-data): fundamentals lists newest first so a length cut keeps the latest years

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 08:47:33 +01:00
CatoandClaude Opus 5.5 2d0eb1d6aa feat(entities): stub companies from the relation graph, and a lab entity kind (#235)
* feat(entities): stub companies from the relation graph, and a lab entity kind

Stub companies: every minted company:<slug> node a stated or corroborated
relation touches (1,188 today; NAC Kazatomprom JSC, JV Inkai LLP, Uranium One
Inc.) becomes an entity built from the graph at load, with evidence "stub", a
page on the existing /markets/[slug] route that lists only the relations
naming it (grade, quote, source), and the note that no profile is held.
Rendered on demand, so the static page count is unchanged. The graph's
producers resolve against the directory only (resolveInDirectory), so the
stubs never change the graph they come from. Search and retrieval rank stubs
at 0.6 and leave word rarity to full-weight documents, so profiled rankings
do not move. Events and relations may name a stub; ownership and facility
operator fields stay directory-only. Reviewed aliases redirect to the
canonical page.

Labs: a closed-set `lab` kind (allowEmpty until the pilot fills it), the
labs candidate facet with schema and add.ts gate, a /labs/[slug] profile
(what it works on, where and how to join, stated funders from finances
relations), the lab dossier on lab:<id> with research fronts kept as their
own science kind, and the country people_labs box counting lab rows. Seeds
no lab data. Person is not added: the ADR pins it for office and board
holders, not lab staff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* test(stubs): assert the summary's invariants, not its tail

Main now carries the pilot's Kazatomprom relations, so its stub summary
names a second source and the shipments. The test keeps what must hold:
the yearbook leads, the stakes and the shipments are named.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-24 10:51:06 +02:00
CatoandClaude eb608f891d fix(coverage): bounded headline, a flag on the row behind an implausible ratio, locations one per line (#228)
- The row's value is "≥100%" when named capacity covers the national figure
  (capacity can exceed output), the percentage only below it; the exact ratio
  stays in the opened working and in coverage_of.
- Above 3× the national figure, the row names the printed figure that
  dominates (Canada nickel: Lac des Iles; China cobalt: Jinchuan) as a
  source-table question. No figure is altered or excluded.
- A "Locations:" cell is a collapsed "Locations (N)" list, one place per line;
  operators are a separate short line.


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-24 09:33:33 +02:00
CatoandClaude 59ccaa532c feat(coverage): mass-balance coverage ratio, inference rules, and "How complete is this picture" (#227)
- lib/coverage: capacity cells read without guessing (NA, estimates, per-material
  parts, two-figure cells left unreadable), exact unit factors only, basis
  matching per national series, a group capacity counted once.
- coverageFor/coverageOf: named capacity / national production (USGS MCS, WNA),
  with every row, both sources and the arithmetic, or the reason it cannot be
  computed; rows with a named operator, operators with a stated owner, flows.
- Three inference rules (co-ownership, same-parent, registry-bridge) write
  derived/lead proposals to research/derived-relations.json; the store holds
  them apart in `proposals`, never walked, counted or indexed.
- Country pages: "How complete is this picture" under the dossier; chat tool
  coverage_of(country, resource?).


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-24 09:26:12 +02:00
CatoandClaude a61d4d0e73 feat(dossier): the dossier standard, computed completeness and the gap work queue (#220)
Every country, company, resource and lab is filled against fixed boxes, each
full/thin/empty by one written rule over the rows that exist (only stated and
corroborated rows count). lib/dossier holds the boxes with named thresholds,
allowed sources and a worked example; compute.ts derives each box from config,
research/*.json and the candidate files; tasks.ts and scripts/research/gaps.ts
emit one GapTask per empty or thin box with a prompt-ready instruction, ordered
by demand then the owner's country list. Seams: RelationCounter for the graph,
recordDemand for the answer ladder. Shown on /data/quality (priority countries)
and on every /world/<iso2> page. GapTask.entity widens to SubjectId so a
resource's boxes can be tasks.


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-24 07:49:50 +02:00
CatoandClaude d6ce2d3347 feat(places): material profiles with charts and grouped restrictions; a country page; Niger leads with uranium (#214)
Material page (/resources/[slug]), one anatomy for every resource: at-a-glance
tiles (world production and year, top producer and share, HHI with its method,
exporters restricting it), production by country as a chartkit BarChart over
the ranking table, reserves vs production as two ShareBars, year-over-year,
the bottlenecks it holds up, export restrictions grouped by measure kind with
counts, then each country as a <details> row (count and newest date in the
summary; the top five open on desktop, all closed on a phone), events, sources.

Country page (/world/[iso2]) through EntityProfile with country modules:
header with roles as one scrolling row, at-a-glance tiles, what it produces
as bars of world share (drawn against the whole world, so 1.6% looks like
1.6%), companies, rules, restrictions, events, related, discussion.
/world?country=xx redirects there; the country entity links there.

The Niger rule: a headline or a produces chart never leads with a share under
1% or a rank past 10th; those go under "Also produces, small shares". A
measured uranium table (World Nuclear Association, fetched by
scripts/research/wna-uranium.py into research/wna-uranium.json, joined like
EIA) makes Niger read uranium first, 8th in the world.

chartkit BarChart gains `max`, the value a full bar stands for.
check:places-layout measures the four pages at 320/390/1440, light and dark,
with chatkit's broken-word audit and chartkit's chart audit.


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-23 13:03:36 +02:00
CatoandClaude Fable 5.1 d096d9ee59 feat(markets): company profiles — at a glance, ownership, charts, section menu (#208)
* wip: company profiles — at a glance, ownership, charts, section menu

* feat(markets): company profiles — at a glance, ownership, charts, section menu

Opening ASML, GE Vernova or Sibelco now reads in one order on every
company: header with five StatTiles at a glance (bottlenecks held, hardest
binding, directory grade, listing, events) → what it holds, each row the
front page's board-row with a chartkit Meter linking to the assessment →
ownership and investors (new config/substrata-ownership.ts, 25 companies,
every holder with the document and as-of date it was read from; a share
nobody read off a document is null and reads as a lead; ShareBars for the
sourced ones) → numbers it reports (series filed under the company, as
LineCharts and sparkline rows) → what has happened (events that name it,
events on what it holds and its SEC filings on one Timeline, then the lists)
→ unread leads (three, then "All n") → what could loosen its grip → ways to
take part → hiring → others at the same step → what it connects to →
sources → discussion. The section menu is the existing SectionNav (a
strip under the top bar on a phone, a rail from 1280px), built from the
headings. Charts are @bitbaum/chartkit's; the page keeps only its placement.

Ask gets an `ownership` tool ("who owns X"), with the same rows.

Gates: test/ownership.test.ts (sources, as-of dates, sums ≤ 100, status
agrees with the listing record, the tool answers for listed / private /
unknown), module order in test/profile.test.ts, and
scripts/ux/profile-layout.mjs (`check:profile-layout`): three companies at
320/390/1440 light and dark — no sideways scroll, every target 44px, five
tiles of one shape, meters in one x, the menu lists only real sections, no
word cut mid-letter.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-23 11:23:48 +02:00
CatoandClaude 25bb2a16d1 feat(atlas): every chain read six ways — markets, research, money, people, policy (#176)
The chain panel gains six tabs (?lens=): Overview, Markets, Research, Money,
People, Policy. Each lens is built from records only (app/atlas/lenses/) and
shares one shape: what it means in sentences, the figures that carry it, the
records behind it, and the page that holds all of it, naming the reader it
serves most.

- Overview: why it binds (the research claim), the grade that ships, the four
  severity tests in words (labels now shared from config/substrata-assessment),
  the analyst's rationale, and dated events.
- Markets: listed makers by ticker, what a stop reaches (the scenario engine's
  own propagation), exposed companies listed first, and key numbers.
- Research: ways around it by readiness, substitutes kept apart, the claims
  the numbers back, and whether its papers are watched.
- Money: whether money is the constraint, funders with a mandate, and what
  each kind of capital will and will not fund.
- People: the work it needs, the registers' names for it, where to train, and
  where its makers hire.
- Policy: rules that touch it, export restrictions on its raw material (the
  maker's own country first), and sanctions over where it is made.

The tabs are links: shareable, script-free, a 3 x 2 grid that never hides a
tab, and the chosen lens rides along as the reader walks the chain. The
separate "What you can do" block is folded into the lenses. Countries read
"the Netherlands" in prose.


Claude-Session: https://claude.ai/code/session_013Xssd1hFZCUSxqjACjoVBB

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 06:34:47 -07:00
CatoandClaude Opus 5.5 03e7478fb8 feat(science): every science page says who and what its bottleneck touches (#162)
Visitor feedback on /science/synthetic-crucible-quartz asked which companies
would be affected, where the research and labs are, and how the entry joins
policy, capital and markets — on every such page, not one.

A new profile module, `around`, registered once for the science kind: for each
bottleneck an entry would relieve, it reads that bottleneck's joins from the
relation registry (the same source as the bottleneck page) and groups them —
companies that make it, what depends on it, other science aimed at it, rules,
funders, where it comes from, what it holds up — each with its join evidence,
plus a link to the science pipeline for the labs and research. Companies,
markets, science, policy and capital are always asked; a gap reads as "not on
record yet" instead of a missing section.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 08:52:10 -07:00
CatoandClaude Opus 5.5 6c32aa5931 refactor(research): one queue per engine; fix(ask): usable model picker on phones (#111)
* refactor(research): one queue per engine — the database, not committed worklists

The event sweep and producer sourcing each had two queues: a committed file
from the old hand-run CLI (research/events.json, research/evidence.json) and
the database queue the box timers fill. /api/events read the file and reported
a sweep from 2026-09-15 while the real one runs hourly, and the freshness gate
would have failed the build around 2026-10-16.

- /api/events reads freshness() from research_sweep_candidates (force-dynamic),
  with sweep.readable=false instead of a fake answer when the DB is down.
- Bottleneck pages read open research_source_candidates live
  (ProducersTable + openCandidatesFor); null -> "could not be read", never
  "nothing found". The corpus now says sourced/unverified only; found pages
  never change a row's state, the export or the search index.
- Removed EVENT_WORKLIST/candidatesAwaiting, EVIDENCE/evidenceFor, both JSON
  files, both CLIs, the weekly research-sweep workflow and their npm scripts.
  Unreviewed rows were copied into the DB first (25 sweep leads, 2 source
  pages; the rest were present or belonged to rows since sourced).
- Freshness: dropped the two file datasets; new test fails when a committed
  research/*.json has no DATASETS row or a declared file is gone; a test fails
  if either worklist file comes back.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(ask): model picker gets a labelled button on narrow composers

At 390px the free-model select was squeezed to "A…", at 320px to a bare
chevron. Below a 28rem composer width (a container query, so the dock counts
too) the bar shows Dictate, Attach, "Model <name> ▾", Ask; the button opens
the picker full width underneath together with "Use your own AI key instead".
Wide composers are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 08:39:07 -07:00
CatoandClaude Opus 5.5 e4467e2a46 feat: dependency rows as graph edges, 26 sourced rows, pinned home listings, series min-move (#94)
* feat(graph): dependency rows are graph edges — profiles, /api/graph and Ask read them

Each row in config/substrata-dependencies.ts becomes a depends-on or
sells-into relation carrying its source and verbatim sentence. Company and
bottleneck profiles get a 'What it rests on' section; /api/graph edges carry
quote and scope; Ask gains trace_dependencies (upstream/downstream walk, one
quoted sentence per hop) and get_company/get_bottleneck list the rows.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(dependencies): 26 sourced rows for hyperscalers, labs, equipment makers, Marvell and the grid queue

Microsoft, Google, AWS, CoreWeave, OpenAI, Anthropic and Marvell rest on
foundry/HBM/grid/transformers/turbines/switchgear; KLA, Tokyo Electron, ASM
International and Canon sell into foundry, memory and packaging; grid
interconnection needs switchgear (LBNL). Each row: fetched URL, verbatim
sentence, scope. Gaps rewritten with what was looked for and why it fails.
get_bottleneck lists dependencies by name so producers stay in budget.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(listings): pinned home lines where OpenFIGI truncates names — 2330 TT, RIO LN and 7 more

A pin is ticker + exchange + the exact OpenFIGI name, read by hand off the
mapping API; the generator accepts it only while all three match. The strict
matcher is unchanged. Re-ran research:listings for the nine slugs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(series): 3% minimum move before tightens/loosens; merge the duplicate transformer lead-time series

Moves under MIN_MOVE_PCT show their sign and read 'flat' (method documented).
NIAC's 2021/2024 Wood Mackenzie points join the headline power transformer
series. A test makes the next single-point split a reviewed decision. CSV
export split into lib/series-csv.ts (300-line cap).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 16:02:40 -07:00
CatoandClaude Opus 5.5 fc1c8f8be0 feat: exposure screen, tickers from SEC + OpenFIGI, SEC filings on the desk (#84)
* feat(exposure): listings from SEC+OpenFIGI, exposure screen + CSV, EDGAR filings fetch

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(exposure): strict listing matcher with regressions; filings on the desk; tickers on company and bottleneck pages

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(exposure): listings data for all 138 directory companies

96 listed (13 via a parent), 7 private, 35 no listing found. Every ticker
carries its OpenFIGI or SEC source; matches were reviewed by hand, and the
three false matches the first rule made are now regression tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 11:59:07 -07:00
CatoandClaude Opus 5.5 cfaf05a10c refactor: split the god files by job, and globals.css by feature (#83)
Every code file the size ratchet grandfathered is now under its 300-line
ceiling, split by what it does rather than by line count:

- lib/search.ts -> entry + lib/search/{text,corpus,build,expand,score,snippets}
- lib/chat-tools.ts -> lib/chat-tools/ (one module per tool family + registry)
- lib/chat-agent.ts -> lib/chat-agent/{loop,parse,turn,prompt,stream-gate}
- lib/chat.ts -> lib/chat/{types,retrieve,models,answer}
- ResearchChat.tsx -> components/portal/chat/ (thread, turn, composer,
  BYOK panel, contribute form, hooks)
- SearchBox.tsx -> components/portal/search/ (popover, page form, shared)
- profile modules, lib/bottlenecks.ts, lib/participants.ts -> build/board
  and module-family files beside them
- app/page.tsx, app/markets/[slug]/page.tsx, app/policy/page.tsx -> section
  components in private _home/_sections folders

globals.css (2379 -> 664 lines) keeps tokens, base and site chrome; the
feature blocks moved to app/styles/*.css, imported from the root layout in
the order they had inside globals.css so the cascade is unchanged.
Screenshots of /, /search?q=asml, /markets/asml, the EUV bottleneck, /chat,
/notes, /atlas, /policy and /talent at 390/820/1440px are pixel-identical
to main.

The config/ corpus files stay grandfathered as data; the logic that was in
them moved to lib/ (coverage-progress.ts, participants.ts, geo.ts).

Also: the desk's "Open on" select said "Last all time"; and
INFRASTRUCTURE.md now records the hourly :17 sweep timer, the everyHours
setting that decides whether a run is due, and that 005-desk.sql is applied.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 11:22:12 -07:00
CatoandClaude Opus 5.5 609595e6a5 fix(portal): every number on the public pages opens to its source, rule or estimate (#80)
* fix(portal): every number on the public pages opens to its source, rule or estimate

Sweeps the public pages onto <Figure>: severity, readiness, counts, shares,
reserves, HHI, relief times, loop periods, capital sizes, roadmap progress.
Fixes numbers that were wrong: About said 80 rows were unchecked (2 are), Join
said 92 maker rows about half unverified (90, 10), per-jurisdiction policy
counted both-ways rules as speeding. Softens claims the data does not back
(five companies make all wafers, single largest funder, every term linked).
Adds a ratchet on bare numbers in page copy and bans 'analyst' voice.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(figures): baseline the two scale definitions in the company profile module

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 02:17:26 -07:00
CatoandClaude Opus 5.5 43f189ca5b feat(markets): company profiles that say what the company holds and why it matters (#78)
* feat(markets): company profiles join what the company holds, and say why it matters

Chokepoints that are machines, processes or capacity (EUV scanners, leading-edge
foundry, HBM, transformers, reduction drives...) had no maker rows at all: the
participant join read only the materials file, so 55 of 101 directory
companies - ASML included - rendered "No covered material is mapped".

- coverage: chokepoints carry `holders` (directory names + make/part/operate);
  the citation is the holder's directory row, not a copy
- participants: one join over BOTTLENECKS for both kinds; 55 -> 33 empty rows,
  the remaining 33 hold no tracked bottleneck (tool makers, systems, buyers)
- company page: derived lede and fact tiles (bottlenecks held, hardest binding
  linked to its assessment with the 4-part sum, grade, events); chokepoint list
  with binding scores, other makers / part suppliers, evidence; events plus
  events on what it holds; unread sweep leads; science + substitutes; same-step
  peers; a sources list. Empty sections and the boilerplate blocks are gone,
  disclaimers are one line.
- header no longer says "Nothing on this row is sourced" when the directory row
  cites a source
- tests: every producer/holder that is a company joins; ASML is the sole
  recorded EUV maker; a part supplier is never a second source

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(markets): every figure on a company page is a Figure — counts link their method, scores open their judgement

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 02:05:07 -07:00
CatoandClaude Opus 5 bcb116d622 feat(science): relief for the two worst rows, and stop the prompt claiming no tools (#67)
A review of coverage found the sharpest gap on the site: of 33 bottlenecks, 17
have no candidate relief at all — and that includes BOTH 12/12 rows, EUV
lithography scanners and EUV projection optics. The site named the worst things
in the way and then said "no candidate relief has been written up for this one
yet". Naming a problem and having nothing to say about moving it is half a
research service.

Two entries, both sourced to the people making the claim.

Nanoimprint lithography answers both EUV rows, because it is the one
commercialised route that patterns at leading-edge dimensions without a scanner:
Canon says the transfer "does not go through an optical mechanism", so the
mirror stack only one company can polish is not in the path. Readiness 6, not
higher — the FPA-1200NZ2C is real and shipped, at 14 nm minimum linewidth
equivalent to a 5 nm node, but to a research institute rather than a volume line,
and a stamp touching the wafer fails differently from light.

Amorphous metal cores answer grain-oriented electrical steel, and are the
clearest case yet for the substitution nuance added last week: readiness 9, in
production for two decades, and still only a partial answer. ABB reports about
70 percent lower no-load losses, and also that lower saturation forces a larger
core cross-section, larger coils and a larger footprint — fine on a distribution
transformer, not on the grid-scale units the queue is actually for. The entry
says which half it relieves.

Also: the assistant's system prompt still ended "You have no tools", which
stopped being true the moment web lookup was enabled on the box. It now says
what is actually the case, and only when it is.


Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 04:27:51 -07:00
CatoandClaude Opus 5 bb2b7f391c Five more materials with figures, and the actual places named (#66)
* feat(data): five more materials, and every figure says which step it counts

Tin, lithium and the two rare-earth magnet feeds now carry USGS figures, which
takes the corpus from two quantified materials to six. But adding them plainly
would have argued against the research, so the schema grew first.

USGS publishes MINE production. Most bottlenecks here are downstream of a mine,
and the corpus says so itself: its thesis on tin is that "tin metal is not
scarce; tin at seven nines, qualified for an EUV source, is — the chokepoint is
the upgrading step, not the mine". Dropping 300,000 tonnes of mined tin onto
that page with no qualifier would tell a reader the opposite of what the row
says. Same for lithium, where the constraint is conversion to battery-grade
chemicals, and worse for the rare earths, where the published figure counts ALL
of them as oxide equivalent while the bottleneck is one separated element.

So every figure now carries `stage` and `describes`. The section leads with what
the number counts before it shows the number — "tin content, mined, not the
EUV-grade refining the bottleneck is about" — and each share reads "of mined
world output" rather than implying it is the whole story. A figure that answers
a different question than the page asks is worse than no figure, because it
looks like an answer.

The gate caught the directory fault twice more on its own: Burma and Zimbabwe
were both missing while USGS records Burma as the third-largest tin producer and
a significant rare-earth source, and Zimbabwe as a fast-growing lithium miner.
Both are tracked bottlenecks. They are in now.

Deliberately not added: silicon. USGS covers ferrosilicon and silicon metal,
which is neither electronic-grade polysilicon nor prime wafers, and no caveat
makes that figure informative about either.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

* feat(facilities): name the actual places, and prove a new kind is still one file

"Produced only as a by-product of a few natural gas fields with unusual
composition" named none of them. That was the most load-bearing sentence on the
helium page and the one a reader could do least with — a mystery where the
research should be. The assistant could only answer "not in your data" when
asked which fields, which was correct and useless.

Three are named now, each because a source names it: Cliffside Field near
Amarillo, which USGS reports separately at 13 million m3 withdrawn in 2024
against 50 million m3 of reserves; LaBarge in Wyoming, which ExxonMobil
documents on its own site; and the Orenburg plant, which Gazprom documents on
its own. Coverage is partial and the page says so — a named gap beats an unnamed
assertion, and it is the same rule every other row here follows.

`facility` is the second kind added since adapters became one file each, and it
cost exactly that: one adapter, one links entry, one route. Identity, search,
retrieval, the relation web, a profile with discussion and the path to the loops
all came free, which is what the refactor was for.

Places join the web rather than sitting in a list: `located-in` the country,
`operated-by` the firm, `supplies` the material — so LaBarge now connects
ExxonMobil to helium through a place, and the company page reaches it from the
other end.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 23:38:11 -07:00
CatoandClaude Opus 5 9f9464ca63 feat(data): numbers with a year and a source, and the difference between a law and a schedule (#65)
The corpus could say a material was concentrated and could not say how
concentrated. Severity was a 0-12 judgement and everything around it was prose,
so the first question anyone asks — how much, where, how much is left — had no
answer on the page.

Helium and gallium now have real figures, from USGS Mineral Commodity Summaries
2025, a public-domain source, read and quoted rather than summarised. Helium:
United States 68 million m3 and 37.8% of world output, Qatar 64, Russia 17,
Algeria 11, against a published world total of 180. Gallium: China 750,000 kg of
760,000, which is 98.7%.

Every figure carries the year it is FOR, the basis it was arrived at, and its
source. A number without a year is a lie with a decimal point, and an estimate
rendered as a measurement is the failure this project exists to avoid, so
`basis` is on every row and is shown on the page.

Nothing derived is stored. Share, Herfindahl concentration and
reserves-to-production are functions of the rows, so they cannot drift from the
figures they claim to summarise — the mistake this codebase has already made
twice, with entity ids and with relation labels. Concentration is worth the
trouble: gallium comes out at 0.97 and helium at 0.28, which is the arithmetic
companion to "how few suppliers qualify" and can be argued with.

Absences are kept as absences. USGS does not publish gallium reserves, because
it is a byproduct of bauxite and zinc processing, so the field is missing and
says why — a zero would assert something false. Qatar's helium reserves are
recorded by USGS as "Large" rather than a number, and the page says that.

And substitution stops being a 0-3 score. An alternative existing is not the
same as it being available, and the reasons differ in kind: helium below 4 K is
blocked by PHYSICS — USGS states plainly that nothing substitutes for it — while
gallium outside China is blocked by capacity and price, which is a schedule.
Germany, Hungary and Kazakhstan all produced gallium and stopped, in 2016, 2015
and 2013; the plants were not destroyed by physics but closed on price. Today
both of those read as a 3.

The new gate found the directory fault in miniature: Algeria was missing from
the country directory entirely while holding the second-largest recorded helium
reserve and producing 11 million m3 a year. Timor-Leste's oil was in it. Algeria
is in now, and Qatar is finally linked to the helium it supplies a third of.


Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 09:39:08 -07:00
CatoandClaude Opus 5 b8bea17976 A kind is one file, loops become entities, and the assistant knows what you are reading (#63)
* feat(entities): a kind is one file now, and the loops stop being a dead end

Two changes that only make sense together.

The nine entity adapters lived in one growing module. The corpus is about to
grow sideways — people in public roles, parties, lobbies, think tanks,
laboratories, more of the capital world — and each of those is a new KIND of
thing rather than more of an existing one. They are one file each now, in
`lib/entities/sources/`, registered in one place. A test holds the claim: every
declared kind has exactly one source, and every source a declared kind.

Then the kind that was already implied by the data: the loops. A loop — design,
build, measure — is what the whole corpus is about, since the site's claim is
that technology improves at the speed of the slowest turn. They were the only
thing in the model with no page: not linkable, not searchable, not discussable,
and a dead end in the web. They are entities now, with `/loops/<id>`, and they
cost one adapter file, because everything else came free — identity, retrieval,
the relation web, a profile with discussion, and the path to and from them.

`gates` joins bottleneck to loop, 50 of them, so the web now answers "why does
this matter" and not only "what is next to this". Read from the loop's end the
same relations answer what is in its way, worst first, because the slowest gate
sets the pace.

Loop rows say what they are: the project's own model, not a measurement.

Also new: a test that every entity's href resolves to a route the app actually
serves. A new kind whose href points nowhere is otherwise invisible until a
reader clicks it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

* feat(profile,chat): competitors, news that reaches the page, and an assistant that knows what you are reading

Three faults found by reading the site as a reader rather than as its author.

**The assistant did not know what page you were on.** Asking "what are the other
fields" on the ExxonMobil profile returned "Not in your data", because the
question was answered against the whole corpus. The dock already knew the path
and threw it away: `topic=""` went to the chat, and `topic` was only ever used
by the contribution form. The path now reaches retrieval, the entity under the
reader is seeded ahead of any keyword match along with its neighbours, and the
system prompt says which record "it" and "they" should resolve against. The path
is validated as a local path and length-bounded, because it reaches retrieval.

**A profile asserted concentration and did not show the other makers.** "One
company on earth builds them" is exactly the kind of claim this site exists to
substantiate, and a reader could not check it. "Who else makes it" derives the
other producers of the same material from the relation layer, each with the
evidence of its own row — so ExxonMobil now names QatarEnergy, Gazprom, Air
Liquide and Linde, and says which of those rows are sourced and which are
candidates. It says plainly that this is coverage and not a market: "the only
producer" and "the only producer we have sourced" are different claims and only
the second one is ours.

**News could not reach a company through what it makes.** A timeline only holds
events that name the organisation, so ExxonMobil read "nothing recorded" while
the helium shortage its own product suffered sat one page away. Those events are
listed now, labelled as being about a material it makes rather than about it.

Also: docs/DATA-MODEL.md, written after reviewing what the corpus says when read
cold. It records the three faults with numbers — 30 of 51 country rows connect
to no bottleneck at all — and the direction out: production and reserves with a
year, a basis and a source; named facilities so "a few fields" names them;
derived reads (share, per capita, concentration, reserves-to-production) that
are computed and never stored; and strategic chokepoints, because the model
knows where things are made and nothing about how they move.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 08:42:45 -07:00
CatoandClaude Opus 5 bdf9a2988b perf(engine): index the corpus, and give every entity a path to the KPI (#62)
Two halves of the same idea: the web is about to get much bigger, so the
lookups have to be cheap, and the reason for holding it at all has to be
visible from any node in it.

**Indexing.** Measured before touching anything: `allEntities()` cost 22ms per
call, and every lookup called it and then linear-scanned the result, so a single
entity lookup cost 19ms. At 268 entities that is invisible; at ten times that it
is fatal, because the cost is the rebuild multiplied by the scan and grows with
the square of the corpus while feeling fine right up until it does not.

The corpus is derived from static config and cannot change within a process, so
it is built once and served from maps: by id, by kind, and by name-or-alias.
Relations are materialised by endpoint, both directions together — which is also
what makes the single declaration safe, since the forward and inverse readings
are produced from the same relation and cannot diverge.

`allEntities()` x200: 4,422ms to 0ms. 13,400 entity lookups: 43ms, from what
would have been about four minutes. A test guards the structure (identity, not
equality, proves it is built once) rather than a stopwatch reading, with bounds
set to catch a return to linear scanning — orders of magnitude, not drift. A
second test asserts the fast path answers exactly what the slow one did.

**The KPI spine.** The site's model is loops: design, build, measure, turned as
fast as the slowest thing in the way allows. So the question worth asking of any
company, rule, mandate or country is not "is it important" but "which loop does
it hold up, and through what". That is a traversal — entity, to the bottlenecks
it is joined to, to the loops those gate — and it is affordable precisely
because of the indexing above.

"What this holds up" replaces the bottleneck-only "Which loops wait on it": the
traversal is identical for every kind, so it is one module rather than one per
kind. Each row carries the evidence of the join it travelled, because the
strength of "this firm holds up that loop" is the strength of its weakest hop.

What it must never do, and a test holds: severity is a dated judgement on a 0-12
scale, and judgements are not added together. A composite reads as a measurement
of the world and is not one, so a loop reports the WORST single judgement — the
test asserts that figure always equals one of its gates.


Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 06:57:53 -07:00
CatoandClaude Opus 5 375a2448f8 The web as a schema, and the seams for eight languages (#61)
* feat(relations): the web becomes a schema, and every join says how well it is evidenced

Substrata's claim is that these constraints are connected — a firm makes a
material, a rule governs it, a mandate could fund relief. The joins are the
product, so they now get the same discipline as the rows.

Relations were free strings built ad hoc per kind, and that cost three things.

`makes` and `produced by` were the same fact declared twice, in two directions,
with nothing making them agree. A relation is declared once now and read from
both ends, so they cannot drift.

A policy instrument was emitted with `kind: 'capital'`, so rules rendered as
capital on a country dossier. Instruments are policy entities, and a test holds
that.

And no edge carried evidence at all, so an unverified lead and a sourced finding
rendered as the same line — the one thing this site exists to keep apart. Every
relation now states how well THE JOIN is stood up, which is not how well either
end is: a sourced company and a sourced material can still be connected by
nothing but a directory guess, and it says so.

335 relations across seven kinds. `governed-by` is new: which rules govern a
bottleneck was not in the graph at all.

`lib/graph.ts` keeps its shape and becomes an adapter, so /api/graph, the
country dossier, chat retrieval and the profile module inherit the fixes. Labels
come from the entity registry, so a country is its name rather than its ISO
code, and the graph route stops carrying a hand-copied kind list that had
already fallen a kind behind.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

* feat(i18n): open the seams for eight languages, without faking a single translation

The expensive part of shipping in eight languages is not translating. It is
discovering afterwards that the code assumed one — strings welded into
components, dates built by hand, a layout that only goes left to right. Those
assumptions are cheap to remove now and painful to remove at scale, so they are
removed now. No translation is invented in the process.

The content divides into three kinds that cannot share a mechanism.

**Interface strings** are keyed, in `lib/i18n/messages.ts`. English is the
source and defines the key set, so a missing key is a type error rather than a
blank on a page. Every other locale is deliberately partial: a missing string
falls back to English, and `gapsIn()` and `coverageOf()` report exactly what
fell back. A fallback nobody can measure is how a half-translated product ships
without anyone finding out. All twenty profile-module titles and the evidence
vocabulary are migrated, and a test fails the build if a module writes a title
into the component — a string welded into a component is one no translator can
reach. Proved by mutation.

**Research prose** — about 5,500 words — is Substrata's own writing, so it is
translatable, and a translation is a claim like any other: it carries who made
it and when. `readProse()` reports whether the text is really in the language
asked for. A machine translation may exist as a draft and may never count as
checked, because prose that reads fluently but was never verified is
indistinguishable, to a reader, from prose that was.

**Quotations** — about 1,000 words — are never translated. The entire
evidentiary value of a quote is that these are the words the source published;
a translated mandate sentence presented as the EIB's own would be invented
evidence. `Quotation` has no translations field, so the type enforces it rather
than a convention.

Also: `lang` and `dir` on the document, so Arabic flips the layout and not just
the text, and locale-aware date and number formatting, because the corpus stores
ISO dates for storage reasons and no reader wants to read one.

Not done, and deliberately not faked: no translations exist, every non-English
locale reports 0%, and there is no /de/ routing — that is cheap to add once
strings are external and pointless before translations exist, since it would
ship seven locales silently serving English. docs/LOCALIZATION.md records the
rules and what is left.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 06:07:52 -07:00
CatoandClaude Opus 5 13f829bcf2 Every entity page is modules, on one shared order (#60)
* refactor(profile): every entity page is modules now, on one shared order

Bottleneck 539 to 136, science 157 to 96, capital 169 to 100. With the company
page, four entity pages went from 1,179 lines to 487, and what they lost was
markup that existed three or four times.

`importance` is now one scale across every kind rather than a per-page order, so
profiles read the same way whatever you are looking at: what it is, how it is
judged, who is involved, what governs it, what would change it, what has
happened, what it connects to, then the discussion. A test asserts discussion is
always last and that timeline and connections precede it.

Two duplicates collapsed into one module each:

The company page called it "Timeline" and the bottleneck page "What has
happened", with two implementations of the same list of the same events. One
module, one title — a reader moving between profiles should not have to learn
that two headings mean the same thing.

Connections was repeating whole sections. On a bottleneck it listed the seven
makers already in "Who makes it" and both funders already in "Who could fund
relief", directly below them. It now hides relations that have a section of
their own, per kind, and renders nothing when nothing is left — which is what
happens on GOES. `connectionsFor` is exported so that rule is testable rather
than a promise.

Two modules were also styled from a different vocabulary: `.research-card-grid`
set its headings at 1.5rem, LARGER than the section heading above them, and
`.research-prose` brought its own margins and line height. Inside a profile that
reads as a different product. Both now use the same utilities as every other
module, and a test fails the build if a module reaches for those families again.

Also fixed: connections was ordered at 40, so it rendered between "Rules that
govern it" and "What would remove it" instead of near the end.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

* fix(desk,home): stop the desk dropping follows, and stop the homepage repeating itself

Three things a first-time and a returning reader hit immediately.

**The desk silently un-followed companies.** Saving it rebuilt the whole
preference record from the form, and the form carried a checkbox per company
rendered at page load. Follow a company from its page in another tab, then save
the desk, and that follow was gone. Companies are now read back and preserved;
the form owns technologies and the individual/organisation flag only.

**The company picker was 140 checkboxes.** It was also the only way to stop
following one. Following belongs next to the thing being followed — the button
already exists on every company page — so the wall is gone and the Following
card carries the unfollow.

**Signed out, the desk was a headline, a button and 600px of nothing.** It now
says what an account is actually for, in three lines, all true of what exists
today: follow a technology or a company, a desk filtered to what you follow, and
writing in discussions. It also says plainly that the research needs no account,
because it does not.

**The homepage repeated its own navigation.** Nine chips under the hero,
duplicating the nine links in the header directly above them. On a phone that
was a full screen of identical boxes before any research. Removing them puts the
checkable-chain figure — the thing that shows what this site is — above the fold.

Caught while looking at the result: the new desk copy said "or the list below",
describing the list this same change removed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 02:07:33 -07:00
CatoandClaude Opus 5 c6cdd59003 The company page becomes modules (#59)
* refactor(profile): the company page becomes modules, and numbering stops being hand-kept

314 lines to 155. What it makes, where this matters, what could change its
position, the questions the profile does not answer, and the timeline were five
hand-written sections; they are modules now. The page keeps what is genuinely
its own — the identity header, the follow button, the evidence callout — and
asks the registry for the rest.

What this buys, concretely: offering any of these on another kind is a change to
`appliesTo` rather than a second copy of the markup, a section that has nothing
to say leaves no trace instead of rendering an empty shell, and the order is a
number on a module rather than its position in a file.

Section numbers are derived from render order now. They used to come from a
`next()` counter kept by hand, so inserting a section meant renumbering the rest
and a conditional section could leave a gap in the sequence.

`load` may return undefined as well as null — the lookup helpers naturally
return undefined, and forcing every one of them to normalise was noise that
would eventually be got wrong.

Two things the tests now hold: a company profile still carries all five of its
original sections in reading order, and company modules do not leak onto kinds
with no such data — asking `products` about a country must not throw or invent a
row.

Caught by looking at the rendered page: the replaceability footnote had drifted
to the very bottom, below the discussion, explaining a grade shown six sections
earlier. It sits with the grade now.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

* chore: drop the import the module split left behind

Splitting the registry out of shared.tsx left defineModule and AnyProfileModule
imported but unused. CI warned; lint is silent now.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 01:03:25 -07:00