7 Commits
Author SHA1 Message Date
Cato 4269a4376a Connect research processes and sourced company relationships to the map (#422) 2026-12-02 03:56:44 +01:00
Cato 4ba37120a3 Explore an entity’s connections and evidence (#421)
* Explore entity connections and their evidence from profiles

* Open the connection map on the entire entity registry

* Give connections stable identities and expose all registry kinds
2026-12-01 18:02:29 +01: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 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 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