* feat(research): runs record what their search backends did, and /api/health/web says it now
The event sweep and producer sourcing failed for a day on production with
nothing on /data/freshness but "no search reached a search backend".
- Each sweep and sourcing run records its search backends' outcome in
ai-kit's own words (search_note, e.g. "searxng unreachable"); migration
018 adds the column. /data/freshness shows it beside a failing run.
- /api/health/web searches once for a fixed phrase and reports which
backends are configured (names only) and what each did. One probe per
ten minutes, shared by concurrent callers.
- docs/operations/auto-updates.md: what runs, when, what it needs, where
it leaves a trace, and what to do when a run is failing.
Claude-Session: https://claude.ai/code/session_019MDtmuvTGrpo3VChP3skH8
* fix(data-layer): read double-quoted identifiers in migrations
declaredObjects read `CREATE TABLE IF NOT EXISTS "users"` as a table named
"if", so 017-accounts.sql looked incomplete on any database that predates
the ledger: it would be re-run, and the ownership hand-over would miss its
real tables. CI's real-Postgres test caught it once 017 stopped being the
newest file ("must be owner of table accounts").
Tables, indexes, ALTER TABLE targets and added columns may now be quoted.
Claude-Session: https://claude.ai/code/session_019MDtmuvTGrpo3VChP3skH8
---------
Co-authored-by: Claude <noreply@anthropic.com>
Substrata created its account runtime with `mail: { configured: false }`, so
the sign-in link, "Forgot your password?" and address confirmation could
never appear, and a forgotten password had no way back.
- lib/auth.ts sends account mail through AccountKit's `createAuthMailer`
(mail-kit, the fleet's RESEND_API_KEY). Without a key the options stay
hidden, as before; confirming an address is never a wall.
- The sign-in, sign-up and account pages pass `mailConfigured()` to
`signInMethods`, and a reset link that lands on /sign-in is no longer
redirected away for a signed-in reader.
- The account journey first asserts every way in the env switches on:
password and passkey always, the link only with mail, "Continue with
OrangeCat" and the shared sign-in button with their clients. CI sets
synthetic, unreachable OIDC clients so both buttons are checked.
- @bitbaum/mail-kit is a direct dependency (AccountKit's optional peer).
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9
Co-authored-by: Claude <noreply@anthropic.com>
First deploy after #276 (run 40594377157): prices finished in 12.5 minutes (715 listings, 835008 points, 23 expected gaps), then the 30-minute facts pass ran into the 40-minute limit, the child was killed, exit 1, so the backfill was not recorded and every deploy would repeat it. Facts now stop at 15 minutes; the daily timer takes the rest.
A new `account` job in browser-smoke.yml runs scripts/ux/account-journey.mjs
in Chromium against the production build and a PostgreSQL built from
scripts/db/*.sql: sign up with email and password (mail is off, so the
account signs in at once), see the account menu, sign out, have a wrong
password refused, sign back in, and a foreign origin gets 403.
The fleet's shared journey assumes account mail, which Substrata does not
send, so this drives Substrata's own screens.
lib/auth.ts now also trusts AUTH_URL as an origin, so the journey passes
with better-auth's origin check on (NODE_ENV=test and TEST stay unset). On
the box, lib/request-guards.ts already reads AUTH_URL as the public origin.
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9
Co-authored-by: Claude <noreply@anthropic.com>
* feat(auth): Substrata accounts on @bitbaum/accountkit, not only OrangeCat
Readers can create an account with an email and a password or a passkey,
and turn on two-step codes. Continue with OrangeCat stays one way in.
next-auth and lib/identity.ts are gone; /api/auth serves AccountKit's
runtime, and /sign-in, /sign-up and the account panel in
/account/settings are its shared screens in Substrata's look.
Desks, follows, saved AI keys and SUBSTRATA_REVIEWER_ACTOR_IDS stay keyed on
the OrangeCat actor id: legacyIdentityProvider keeps it for anyone whose
first way in was OrangeCat. The six account tables are
scripts/db/017-accounts.sql, additive and re-runnable, applied by the deploy.
Rebuilds the stale draft #184 on current main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9
* test(data-layer): the pre-ledger case names the newest migration, not 016
Adding 017-accounts.sql made the test treat 016 as one of the files that
predate the ledger; it now asks for whatever file is newest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9
---------
Co-authored-by: Claude <noreply@anthropic.com>
* feat(deploy): the deploy applies migrations, installs timers and runs the one-time price backfill
Before the release goes live, deploy.yml now applies pending scripts/db/*.sql
(one transaction each, recorded in public.schema_migrations, first run checks
existing objects before baselining) and installs deploy/systemd units. A failure
stops the deploy with the live release untouched. After the release, the price
backfill runs once and is recorded in public.schema_oneshots.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* docs: name no migration file that does not exist
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>
* feat(registry): seed labs, robotics, supply chain and frontier areas; chat tools read the registry
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* feat(registry): seed 443 labs, robotics, supply-chain and frontier companies; company:refresh; chat tools read the registry
Each new entry has what it is (Wikipedia lead sentence, quoted), identity from
Wikidata (HQ, country, ticker, CIK, LEI, website) and a gap list. Wikidata items
with several headquarters leave the field a gap. 115 migrated companies gain a
cited description through their own Wikidata English sitelink.
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>
One JSON file per company in registry/companies, one per area in registry/areas,
validated on load (no cite, no value). The registry is the list; the old filter
is a proposer. The 793 admitted companies are migrated with identical output.
pnpm run company:add resolves identity from Wikipedia and Wikidata. /areas and
/areas/[slug] are new.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
* feat(markets): a directory of every company in the universe, and an honest count of what each page can show
/markets/directory filters the universe by theme, country, tier and page kind
and searches by name, ticker or theme through searchkit; one column of rows on
a phone, sixty at a time. /data/companies now counts what each page can show
(quote and SEC filings, quote only, identity only) from identifiers alone, and
lists every company considered and out with the test it failed.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* fix(markets): the directory's Show more is a 44px target
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>
The first wave admitted 594 companies from 731 candidates. This wave reads
22 issuer holdings files (was 14) and 20 SEC industry codes (was 6), adds the
twelfth theme (defence & aerospace) and lets a 20-F or 40-F filer, which
states no 10-K cover float, clear the revenue floor on its own tagged annual
revenue in US dollars (no rate is ever invented).
793 admitted (tier A 133, tier B 660) from 1,013 candidates; 220 considered
and not admitted. Funds read and dropped because their subject is not a
theme (KOMP, XME, PAVE, HYDR, CTEC, RNRG, QCLN, FAN) are named in the ADR.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
The daily run kept prices and filings for the 28 hand-checked seed lines only;
every other company page read its source live, per request. It now walks the
seed first, then every admitted universe line the price source serves, stalest
first, within its time.
A ticker can be another company's on another exchange, so a line that is not
a seed line is stored and drawn only if the source's own name for the symbol
agrees with the company's; a mismatch is refused with both names. More venue
codes are read (Sao Paulo, Madrid, Milan, Stockholm, Oslo, Warsaw, Johannesburg,
Singapore, Shanghai/Shenzhen by symbol, TSX then TSX Venture).
Each company page gets 'What we do not know yet': every gap with its reason,
the documents that would fill it and a work-queue task, and a 'Why it is here'
sentence built only from the rows that admit it.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
* feat(markets): a company page that reads like a markets product
The owner, 2026-10-25: "I don't see any beautiful charts on stock
performance … think Bloomberg, think Yahoo Finance", and on NVIDIA's
holders, "'other' is 87%. We have a vague idea of what that means."
Every company page now carries one market frame, in one order, whatever
the company is (docs/design/company-page.md): a header quote (ticker,
exchange, currency, last close, 1-day change, date, "delayed end-of-day ·
Yahoo Finance"), then share price, key statistics, revenue and net income
by year, who owns it, how it does business, and peers. A section with no
data stays and says what source would fill it, with a Send-evidence link.
- Share price: a line chart with one row of six equal range cells
(1M·3M·6M·YTD·1Y·5Y), the page's only client island. Every range is
computed on the server, along with its return, span and largest fall,
the 52-week range, a returns table and the 50/200-day averages
(prices/compute.ts).
- Key statistics: eight equal cells. Market value is computed only where
close × cover shares is the value; otherwise "Not computed" with the
reason. Each annual figure shows its fiscal year, growth and filing.
- Financials: chartkit's new ColumnChart (0.2.0) for five fiscal years
from XBRL, plus rows with growth and margin computed in code.
- Who owns it: holders from 13G/13D/proxy. The remainder is labelled
"Others, each below 5%" in the legend (chartkit's new ShareBars
otherLabel) and explained in its row. A company with no listing shows
the owners the relation graph states.
- How it does business: customers, suppliers, competitors (always), and
stakes, sites and partners from lib/graph, one row anatomy. An empty
group names the filings that would fill it, and points to the quoted
dependency rows where they exist.
- Peers: the same chain step (tier A) or the same theme (tier B), with
last close, 1Y return and a sparkline.
Tier B companies get prices, financials and holders: lib/market-data/company.ts
joins a slug to a listing. It tries the seed first, then the universe
ticker on a venue the price source serves. New venues (US composite,
London, Hong Kong, Korea, Taiwan, Toronto, SIX) are added to Yahoo's
suffixes. Ambiguous venue codes are not guessed. Sections stream in their
own Suspense boundaries, with reads deduplicated per request, so a slow
price source never delays the header. Ask charts link "Open <Company>" to
the page, and the holders bar in answers carries the remainder label.
Verified: pnpm run verify; pnpm run build; test/company-page.test.ts;
scripts/ux/company-layout.mjs at 320/390/768/1440 on NVIDIA, Oklo,
SpaceX, NAC Kazatomprom and a stub, against live Yahoo and SEC.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* docs(design): the header's quote lives in price-view.ts
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>
The Ask panel and /chat were Substrata's own assembly of chatkit's pieces
(ChatScreen, Composer, ChatThread) with no chat list, no New chat and no
reload. They are now chatkit 0.18's ChatApp, the same app Heidi, Loki and
OrangeCat move onto: Chats drawer (a rail on a wide screen) with search,
rename and delete, New chat, temporary chat, titles, the queue, Stop and
the open chat reopened on reload. Chats are kept on the reader's device
(localConversationStore); no server conversations, no migration.
Substrata keeps only its own parts: the transport (askTransport: /api/chat
with pictures, the stream into turn.update, the evidence on the message,
the server's own words on a failed turn), chartkit renderers, AnswerFooter,
the key and "Send evidence" under the composer, one composer configuration
shared with the home box. Panel and /chat share the store and the open
chat, so Expand is only a bigger frame (lib/ask-thread.ts goes). A message
from elsewhere (Check this, ?q=, the home box's ?send= with its pictures)
opens a new chat and is sent through the composer, since ChatApp has no
send handle yet (lib/chat/drive-composer.ts says so).
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
The owner could not ask Substrata about a screenshot of a post: every
composer passed attach={false}, and /api/chat took no pictures.
- One composer (AskComposer) on the home box, the Ask panel and /chat:
Camera / Photos / Files, paste and drop, pictures shrunk to 1024px in
the browser (Heidi's limits), text files inlined, a message queued while
a turn runs, the draft shared between surfaces.
- /api/chat validates pictures (strict data URLs, three at most, 1.5 MB,
never stored or logged) and attached text, with a larger body cap.
- A turn that brings material is a claim check: one read call returns the
visible text and checkable claims as JSON (claims whose numbers the
material never printed are dropped), each claim is searched and, for a
seed company, priced; the answer is bottom line first, one status per
claim with a citation or "Not found", reasoning labelled, and no figure
only the material gives repeated as fact. Every existing guard runs.
- No model that can see: one sentence (paste the text, or add a key);
nothing is guessed.
- The home box hands its message and attachments to /chat (?send=).
Tests: claim-check (fixture, fake vision model, fake web), handoff, image
validation; two eval rows; ask-layout picks a picture into /chat's box.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
* 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>
The owner, 2026-10-25: asked about future demand for neon, the Ask read six
pages and answered with one US table. Analytical questions (outlooks,
forecasts, what-ifs, comparisons of impact, "when could X be commercial") are
now routed to a research mode:
- route.ts classifies `analysis`; loop.ts hands those to research.ts
- research-plan.ts: one model call writes 3-6 sub-questions with a query each,
validated in code (listed corpus tools, their own arguments); a code plan by
question kind when the call fails or times out (7 s)
- research-read.ts: every sub-question searched in parallel through lookUp
(SSRF-safe readPage, PDFs), one 15 s deadline, passages kept round-robin,
one URL once, two per site, primary/trade/analyst before farms, as [W#]
- research-shape.ts: bottom line first, then What is established, What drives
it, Scenarios, What would change this, Confidence and gaps, Sources (from
the citations); uncited forecasts dropped; unanswered sub-questions said by
code and filed through gaps.ts
- scenario-calc.ts: the model names cited inputs and cases, code checks every
input against its passage, computes low/base/high with the formula shown and
draws a line chart through the chat_ui chart block
- default deny holds reasoning sections to the labelled-background rule
- api/chat: "Reading <site>…" now reaches the reader (onRead was dropped);
analysis answers get more output room
- tests with fakes for the five owner questions; ask-evals rows; a script to
ask them live after deploy (scripts/ux/ask-live.ts)
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
* docs(universe): the company-universe methodology — three tests, tiers, evidence
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* feat(universe): admit companies by a written rule — theme, materiality, identity, each cited
A company is in when cited sources place it in a frontier-technology theme,
show it clears a size floor, and identify it in a registry. admit() applies
the rule from config/universe-themes.ts; whyCompany() answers for any name
(in, out with the failed test, considered, named, or queued as a GapTask);
company_membership lets the Ask answer it; /data/companies prints the rule
from the same config. Tier B companies are a derived entity source with an
'Identified, not profiled' page; a stub the universe identifies is promoted
in place. Adapters: issuer fund holdings (ARK, Global X, First Trust,
Defiance, State Street), SEC EDGAR tickers/public float/SIC, GLEIF and
Wikidata by ISIN, Wikidata industry classes; tested on recorded responses.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* data(universe): first wave — 461 tier B companies from 14 funds, EDGAR, GLEIF, Wikidata
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>
* fix(index): rank the Ask evals on a fixed day, and hand every producer the build's now
buildChunks(now) keyed its memo by now's day but called the event and quality
producers without it, so a caller pinning now still got today's recency and
today's date-dependent quality findings. On 2026-10-25 the lapsed 30-day
series re-read added 139 quote-checked-recently findings to the index and one
pushed science:high-na-euv to sixth for 'How ready is high-NA EUV
technology?'. Reproduced at 8e85c7e, 71978bd and 2fd9194 with the clock
pinned: every one passes on 2026-10-24 and fails on 2026-10-25 (before #242
the row that fell out was jobs-niger instead). No commit introduced it.
The evals test ranking, not the calendar; staleness has its own gates.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* feat(research): --write dates only what a re-check actually found
check-series.ts --write sets checkedOn on a series only when every point's
quote was re-read in that run and found; misses and unreachable pages keep
their last real date. check-job-boards.ts re-opens each careers page and
re-dates only records that still hold; the file's own date is the oldest
record's. Both are named as the refresh in config/substrata-freshness.ts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* data: re-read 2026-10-25 — 128 of 139 series, 109 of 138 job-board records
check-series.ts --write: 535 of 574 quotes found, 0 missing, 39 unreachable
from the sandbox (31 www.asml.com press releases now 301 to investor.asml.com,
which answers 403; 8 data.bls.gov 503). The 11 series behind them keep
2026-09-24. check-job-boards.ts --write: 109 records held, 29 not confirmed
(kept at 2026-09-24).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* data: listings re-searched 2026-10-25 (SEC tickers + OpenFIGI, all 138)
pnpm run research:listings, full mode (not --revalidate, which re-applies the
rule to stored rows without searching): every OpenFIGI search answered. Two
rows moved: Air Liquide's SEC OTC line (AIQUF) is no longer in the SEC ticker
table; Fanuc now has one (FANUF, CIK 1446596). The 7 private rows come from
config/substrata-listing-overrides.ts, as the script defines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* ci(data): a monthly re-check that commits only what it re-read and found
.github/workflows/recheck-data.yml runs check-series --write, check-claims
--write and check-job-boards --write (and the ~70-minute listings re-search
on the schedule or when asked), then commits to the dispatched branch or
opens a bot/recheck-data-<date> PR. Token: FLEET_PAT, else GITHUB_TOKEN, as
in auto-merge.yml; a GITHUB_TOKEN push triggers no CI, so the PAT is preferred.
check-claims.ts dates research/claims.json only when every claim's sentence
still reads in its file and every series it cites was re-read and found
today, and prints the latest values beside each claim for the reviewer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* data: three dead ASML source URLs point at the same releases as filed with the SEC
The 2019-Q4, 2020 annual and 2024-Q2 press releases on www.asml.com now 301
to ASML's generic press-release index. The same releases are exhibits to
ASML's Form 6-K filings (0000937966-20-000003, -21-000003, -24-000019);
all seven quotes were re-read there and found. One quote is shortened to a
verbatim span of the same sentence: the filed HTML splits 'at' across a tag
('a t'), so the sentence's opening cannot be matched mechanically.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* ci(data): run the re-check once on this branch (temporary push trigger)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* data: re-check 2026-10-25 (scheduled re-read)
Dates moved only for what was re-read and found in this run; see the workflow summary for every row that was not.
* fix(quality): a word split across two style runs reads as one word
SEC filings print some words as two font runs ('EU</font><font …>V'), and the
reader turned every tag into a space, so 'EUV' read 'EU V' and a quote copied
from the rendered page missed. Only a letter-run-letter split is joined; a
footnote run ('billion</font><font>2') and every other tag stay a space.
Full re-read before/after: no quote that was found is lost.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* data: ASML points the runner cannot open, re-sourced to the same releases on SEC EDGAR
investor.asml.com answers 403 to GitHub's runners as well as to the sandbox.
Sixteen points whose page could not be opened from either now cite the same
press release as filed with the SEC (Form 6-K); each quote was re-read there
and found. The 2020-Q4 bookings quote is back to its full sentence (the page
reader now joins 'a t'). SICC: the quotes carried the old reader's split
('S iC'); they now read 'SiC', as the page does, and are found.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* feat(research): job boards re-checked in a browser, and absences re-checked too
A careers page whose served HTML lacks the system's mark is drawn in Chromium
(the workspace's Playwright); failing that, the tenant the evidence names
must still answer as that system. A record saying something is NOT there
holds while it still is not (no careers link, site still down, hosts named
still not answering). The workflow installs Chromium for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* data: re-check 2026-10-25 (scheduled re-read)
Dates moved only for what was re-read and found in this run; see the workflow summary for every row that was not.
* data: job boards — every site the evidence names may show the system; 4 more held
Run from the sandbox with Chromium on the 11 records the runner could not
confirm: chalco, openai, supermicro and ase-technology… held where a site the
record names still shows its system; 7 stay at 2026-09-24 (listed in the PR).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* ci(data): drop the one-off push trigger; schedule and dispatch only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* feat(freshness): rows tried and not confirmed are a visible, expiring exception
A re-check that cannot confirm a row (a source that refuses our servers, a
page that changed) now records it in the dataset file's 'unconfirmed' list
with the reason and the day it was tried — written by check-series and
check-job-boards --write, never by hand; a row confirmed later leaves it.
The gate counts a listed row as tried on that day: the dataset is judged by
the oldest of each row's own check or recorded try, so an entry expires like
any date and next month's run must try again. A dataset with listed rows is
never 'fresh' (it reads 'late' and is under Needs attention), and
/data/freshness and /api/health/freshness name every row with its reason.
Tests: a row neither dated nor listed fails, an expired entry fails, a
listing for another row covers nothing, and the table renders the list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* data: record the rows no re-check could confirm on 2026-10-25
check-series --write lists us-employment-semiconductor-related-device-
manufacturing (data.bls.gov answered 503 to the sandbox and to GitHub's
runner; BLS refuses datacenter addresses). check-job-boards --write lists
air-products, umc (403), tanaka-kikinzoku (504), baosteel-gases,
element-six and yaskawa. nippon-steel was re-opened: its recruit page's
yelloop.jp link is an alumni network; /recruit/hq/ still links its axol
entry (job.axol.jp/bx/s/nipponsteel_27), so the evidence names that page
and the record held.
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>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* 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>
- config/candidates/relations.json: the nine Comtrade ships_to rows from
the kz pilot (#231) regenerated through the adapter from the same URLs and
replaced in place: quote from "reporterCode" through "netWgt", commodity
text, note, locator and ids. Same flows, same weights, same grades; the
migration refused any row whose flow changed.
- run-task: a stored flow is matched by (from, type, to, asOf, HS code), not
only by id, so a commodity-text change can never re-propose it.
- config/candidates/events.json: submittedBy.model "not recorded" ->
"unrecorded"; nothing else changed.
- Tests: no old id and no flow twice in the sidecar; a stored flow is
skipped under new commodity text; write tests use flows main does not hold.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
- submittedBy.model: the schema asks for "unrecorded" (adapters write
"deterministic-adapter"); no text asks for a model id; old values still parse.
- Comtrade: the quote spans "reporterCode" through "netWgt", so reporter,
partner and weight stand in one literal span (adapter records may run to
800 chars; hand quotes stay at 400). volume.commodity names what HS 284410
covers, and a new optional relation `note` says the weight is the
compound's mass, not uranium content.
- run-task: leads are held back on --write and in rows.json unless
--include-leads; the dry run prints why each row is a lead; rows already
in the corpus or sidecar are skipped; the run ends with a plain-text list
(rows written, rows skipped with reasons) to paste into a PR.
- prompts/data-entry.md: all of the above, plus what to do when a box
cannot be filled honestly.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
- 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>
* fix(graph): a flow's commodity is part of its relation id
Uranium and refined copper from Kazakhstan to China in the same year are two
relations, but the id was from|type|to|asOf, so the second was skipped as a
duplicate. One rule now (lib/graph/id.ts) is shared by the graph validator and
the candidate path; ids without a stated commodity are unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* style: prettier on run-task
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>
Adapters turn free public registries and filings into candidate relation
rows with their quotes cut from the fetched text. They never write curated
data, never guess an identity and never infer.
- add.ts reads PDFs (unpdf 1.8.1, pinned): page-by-page text, the quote
check forgives line breaks and line-end hyphenation only, and prints the
page it found the quote on. Same exit codes.
- lib/sources: an explicit host allow-list with agent strings, pacing, 429
back-off and a .tmp cache; adapters for UN Comtrade (public preview, no
key), SEC EDGAR, GLEIF, Wikidata (lead unless a second source agrees) and
Kazatomprom's IR PDFs. One gate (finalise) drops any row whose quote is
not in the fetched text; every row carries provenance.
- scripts/research/run-task.ts: a dossier task in, the adapters that serve
its box in dry run, each row marked whether it fills the box; --write goes
through add.ts.
- Candidate rows may carry source.locator and provenance.
- prompts/data-entry.md: the adapter workflow a data agent follows first.
- Tests on recorded real responses only (test/fixtures/sources).
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
Asked live on 2026-10-24 which companies mine uranium in Kazakhstan and who
owns them, the Ask answered correctly from the USGS 2023 yearbook but pasted
the cell as one paragraph of sixteen ventures and one of sixteen places; the
graph split Kazatomprom in two; and no tool read the graph at all.
- Tables: producers_in builds an answer table in code from its rows
(operator | owners as printed | commodity | location | capacity | year),
one row per venture of a "Companies:" cell, every cell verbatim; a place
list or capacity printed once for many rows is a shared note, never
divided. registry.ts routes a result's `table` to the answer, not the
model; the model is told not to paste. Drawn under the prose
(AnswerTables): a table where wide, cards where narrow (container query),
eight rows then "Show all", long places folded.
- Entity aliases: config/entity-aliases.ts holds reviewed pairs only
(NAC Kazatomp JSC, UraniumOne Inc., Glencore), each with the rows that
justify it; lib/graph/alias-match.ts proposes by named rules and
`pnpm run research:alias-candidates` prints proposals with evidence.
research/usgs-relations.json regenerated.
- related_to and how_connected over lib/graph: rows with share, grade,
counted flag, source quote (the venture's part of a long cell, verbatim)
and reading kind; leads listed apart and never counted. Planned first for
who owns / shareholders / holds stakes / partners / how connected; the
ladder counts related_to owners as covering the owners link.
- Six no-wall evals (Inkai, Kazatomprom, Cameco, Sumitomo, Collahuasi,
Gazprom) with graded verbatim quotes; check:ask-layout draws the table at
320/390/1440.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
lib/graph: store + read API (relationsFrom/To, neighbours, pathsBetween,
relationEvidence, graphNode), a validator that throws on any relation without
a source, quote and date and enforces each grade's promise (corroborated needs
two sources, derived its chain and rule, a lead is never counted).
Edges from data already held:
- USGS Minerals Yearbook facility cells parsed conservatively into operates/owns
(shares only where printed); scripts/research/build-usgs-relations.ts writes
research/usgs-relations.json with a report of every string left unparsed.
- Ownership holders (stated with a share, lead without) and facility operators.
Candidate path: config/candidates/relations.json folded in through
config/substrata-relations.ts; add.ts accepts the `relations` facet with the
same gates and exit codes. Relation chunks in the retrieval index.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
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>
Hidden made the owner's widget fall back to a bar across the top of the page,
a different widget from the one on every other page. The edge tab keeps the
same live-status handle everywhere, and still stays off the reply row. The
Ask layout check models the tab and passes.
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx
Co-authored-by: Claude <noreply@anthropic.com>
* feat(entry): the data-entry contract — candidate rows a cheaper model may add, validated at the gate (#211)
PR 5 of docs/architecture/2026-10-23-knowledge-system.md §3.
- lib/entry/candidate.ts: candidate types derived from each config row
(CandidateOf<Row>), and the folds that merge a sidecar row into its config
list flagged `evidence: 'candidate'`. No runtime config import, so config
modules include it without a cycle.
- lib/entry/schemas.ts (+ vocab.ts, shape.ts): one Zod schema per facet, each
`satisfies z.ZodType<…Candidate>`, refs resolved through resolveIn / the
config's closed lists; events reuse lib/event-rules eventProblems.
- config/candidates/<facet>.json: eight empty sidecars, merged into COVERAGE,
EVENTS, ENDOWMENTS, FACILITIES, INSTRUMENTS, SCIENCE, OWNERSHIP and the
corpus series the way substrata-events-accepted.json is merged into EVENTS.
- A candidate producer reads "Candidate source", never "Sourced"
(verificationFor takes the row's evidence), and coverage progress does not
count it.
- scripts/research/add.ts <facet> <json|-> [--dry-run] [--branch] [--schema]:
exit 2 schema, 3 unreachable, 4 quote absent (verbatimIn), 5 duplicate;
appends sorted, idempotent; --branch commits on data/<facet>-<key>.
- test/candidates.test.ts: every sidecar row passes its schema, is
`candidate`, has url + asOf <= today; the gate exits 4 / appends sorted /
exits 5 against a local HTTP server.
- prompts/data-entry.md: the §3.4 prompt, how to run it, the printed shapes.
- NODE_TYPE_LABEL moves to config/substrata.ts and the ownership labels to
config/substrata-ownership-labels.ts (both re-exported) to keep the two
config files under their size ceilings.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 329dd587d8)
* feat(index): the corpus as retrievable chunks, and the ask-evals that name the failures (#212)
* feat(index): the corpus as retrievable chunks, and the ask-evals that name the failures
PR 2 and PR 3 of docs/architecture/2026-10-23-knowledge-system.md §7.
- test/ask-evals.json: 20 questions (bottleneck, company, country, material,
policy, science, capital, events, jobs, three off-topic), including
niger-uranium with mustNotLead oil/natural gas and its quality gap.
test/ask-evals.test.ts checks them against planLookups and the in-process
retriever, no model, no DB; rows waiting on PR 1 / PR 6 are skipped with
a printed count.
- lib/index/: Chunk type, ids, hashes, splitter; one producer per facet
(entity, event, series, policy, science, restriction, quantity, ranking,
quality); buildChunks(); retrieve() with the ADR's hybrid score minus
vectors, reusing scoreDocuments. Evidence labels map to the closed set in
one function, typed against config/substrata-evidence.
- search_corpus runs on retrieve(), so chat sees events, series, policy,
restrictions, quantities, rankings and findings as rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* perf(index): warm the chunk index at server start, off the request path
buildChunks() costs ~5 s cold; without this the first reader to Ask after a
deploy paid for it inside search_corpus. instrumentation.ts register() (nodejs
runtime only) loads lib/index/warm and schedules the build on a later
event-loop turn without awaiting it; a failure only logs, and the index then
builds lazily as before.
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>
(cherry picked from commit edcf6eeee7)
* chore: restore #211 and #212, removed by #213's squash-merge
The Ask panel branch (#213) was cut before the data-entry contract (#211)
and the search index (#212) merged; its squash-merge wrote main back to
its own copy of those files and deleted both features (60 files: lib/entry,
lib/index, config/candidates, prompts/data-entry.md, scripts/research/add.ts,
instrumentation.ts, test/ask-evals*). The two commits above re-apply them
onto current main by cherry-pick; both applied without conflicts, and
format, type-check, lint and 660 tests pass (4 pending evals skipped).
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>
Live on 2026-10-23, asked who produces gallium, the answer said Russia
made "6 kt". USGS reports 6,000 kg (6 t), so that was a thousandfold
overstatement.
- resource_production rows carry `display`, the quantity exactly as the
table prints it ("6,000 kg (estimated)"), and no second spelling. The
"(= 6 t)" reading added on 2026-10-02 is gone: it was the "6" the model
re-unitted. Series rows (find_numbers, key_numbers) carry `display` too.
- Prompt honesty rule: copy a quantity's `display` verbatim; never
convert or abbreviate a unit, never rebuild one from value_number.
- grounding.ts unitMismatches: an answer quantity whose digits match a
row's in another unit of the same family ("6 kt" vs "6,000 kg") is
flagged and handled exactly like an unsupported figure (sent back once,
else its sentence is dropped). The unit test uses the live answer.
- One composer on the panel and on /chat: no "Ask a question" kicker, no
paperclip on either. /api/chat takes a question of at most 4,000
characters and no files; an attachment was pasted text that a long file
pushed into a refusal.
- The Loki launcher steps aside while the Ask sheet is open and on /chat
via the widget's host directive data-fc-place="hidden" on the rendered
region. Not Loki.hide()/show(): those write the visitor's own stored
"hide on this site" and would overwrite it.
- check:ask-layout: nothing but the sheet's UI over the reply row, the
launcher back on close and absent on /chat, and /chat's composer has
the panel's controls and no kicker.
- @bitbaum/chatkit ^0.15.1: a heading written over the reply row is not
drawn ("Quick follow-up options").
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
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>
The owner's phone (2026-10-23, /atlas, Ask Substrata over a bottleneck): the
answer could not be scrolled, there was no way to expand it, "Quick replies"
was a heading over nothing, "3 records read" a stray line, and the composer
carried "Model: Auto" and a paperclip.
- The panel is chatkit's ChatScreen in a sheet (AskPanel): on a phone a
bottom sheet to 92% of the visual viewport with a grip; from 768px a
right-hand panel. One title row: Ask Substrata · Expand · Close.
- Expand hands the whole thread to /chat (lib/ask-thread.ts); the URL
carries only an id and the conversation id continues.
- Suggested replies are chatkit's reply row (nothing drawn when empty);
records read are the thought row above the answer ("Read 3 records").
- Composer: microphone and send; the key chip only with a BYOK key.
- Charts in answers (chatkit 0.15): chart blocks drawn by chartkit
(LineChart, BarChart, ShareBars, Timeline, StatTiles) on every chat
surface; chartable tools return page links and plain numbers.
- --ck-page mapped to the surface token: unmapped, the dark theme drew
light text on chatkit's near-white page.
- check:ask-layout (scripts/ux/ask-layout.mjs): 320/390/1440, light and
dark — the thread scrolls, no sideways overflow, 44px targets, no cut
words, Expand lands on /chat with the same turns.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
PR 5 of docs/architecture/2026-10-23-knowledge-system.md §3.
- lib/entry/candidate.ts: candidate types derived from each config row
(CandidateOf<Row>), and the folds that merge a sidecar row into its config
list flagged `evidence: 'candidate'`. No runtime config import, so config
modules include it without a cycle.
- lib/entry/schemas.ts (+ vocab.ts, shape.ts): one Zod schema per facet, each
`satisfies z.ZodType<…Candidate>`, refs resolved through resolveIn / the
config's closed lists; events reuse lib/event-rules eventProblems.
- config/candidates/<facet>.json: eight empty sidecars, merged into COVERAGE,
EVENTS, ENDOWMENTS, FACILITIES, INSTRUMENTS, SCIENCE, OWNERSHIP and the
corpus series the way substrata-events-accepted.json is merged into EVENTS.
- A candidate producer reads "Candidate source", never "Sourced"
(verificationFor takes the row's evidence), and coverage progress does not
count it.
- scripts/research/add.ts <facet> <json|-> [--dry-run] [--branch] [--schema]:
exit 2 schema, 3 unreachable, 4 quote absent (verbatimIn), 5 duplicate;
appends sorted, idempotent; --branch commits on data/<facet>-<key>.
- test/candidates.test.ts: every sidecar row passes its schema, is
`candidate`, has url + asOf <= today; the gate exits 4 / appends sorted /
exits 5 against a local HTTP server.
- prompts/data-entry.md: the §3.4 prompt, how to run it, the printed shapes.
- NODE_TYPE_LABEL moves to config/substrata.ts and the ownership labels to
config/substrata-ownership-labels.ts (both re-exported) to keep the two
config files under their size ceilings.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
* 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>
The inline Range check in scripts/ux/home-layout.mjs was a copy of
findBrokenWords, written while 0.14.2 was unpublished. The export is now
the one check every product runs, so the copy goes.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
* feat(home): the homepage, rebuilt ask-first
The hero is the Ask box (chatkit composer plus four questions, one built from
the worst bottleneck); sending opens /chat with the question started. Worst
right now is one row component with a fixed gauge column; what changed falls
back to the sweep's unchecked finds or is absent, never an empty box; the
numbers are four equal linked cells; doors share one anatomy; the footer is
calm. The page is served from a 60 second cache: the shell learns its reader
from /api/me in the browser instead of reading the session while rendering.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
* fix(home): centred column, aligned worst rows, broken-word scan
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>
Substrata was the product whose Ask answered "nothing in our database" with
no way forward, and nobody knew until the owner said so. From here every
turn is in the loop:
- chatkit 0.14: thumbs under every answer (ChatThread onFeedback); a thumb
down asks why. POST /api/chat/feedback (zod, same-origin, rate limited)
keeps it in chat_feedback.
- chat_turns: /api/chat logs the question and, when the loop ends, the
answer with the status and tool labels the reader watched, the page it was
asked from and whether it failed. Ids are random uuids the browser mints
per thread and per answer; no reader, no IP, no key.
- GET /api/chat/review-export: bearer CHAT_REVIEW_TOKEN (constant-time; 401
otherwise, 503 while unset), {product, scope, transcripts} in chatkit's
ChatTranscript shape — at most 50 conversations since `since`, 30 turns
each, 4,000 characters a turn, with their feedback. The scope is built
from the system prompt's role line and the tool registry, never typed
twice.
- scripts/db/015-chat-review.sql, .env.example, docs/INFRASTRUCTURE.md
"Chat review", test/chat-review.test.ts.
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE
Co-authored-by: Claude <noreply@anthropic.com>
Producers on the globe
- research/producer-places.json places 997 of the 1,167 facility locations in
the USGS Minerals Yearbook tables, in 37 countries, from GeoNames (CC BY 4.0),
matched offline by scripts/research/geocode-producers.py.
- Each point states its precision (the facility, the nearest town, or only
the province) and the GeoNames entry it came from. A named province must
hold the point, "N km north of X" is applied as an offset, and a bare name
with distant namesakes is left out rather than guessed.
- test/producer-sites.test.ts fails if a dot lands inside another country.
The quality page measures the same through lib/quality/checks-places.ts.
- The globe draws sites as dots, or rings when only the province is known.
A click flies in close and opens the site's facilities, capacity and both
sources in the panel.
Chains as routes
- app/atlas/chain-route.ts is the one route model: every step two levels up
and down, numbered in the order material moves, each placed where it is made.
- The diagram (AtlasChain) now reads left to right through every step, with
makers inside the bottleneck's card. This fixes the connector that ran
through the part suppliers' cards.
- "On the globe" lays the same route over the Earth: one lifted arc per hop,
a light running input to output, and labels numbered like the panel's list.
The globe's input wiring moves to globe-control.ts; sites and routes are
painted by globe-overlay.ts.
Claude-Session: https://claude.ai/code/session_013Xssd1hFZCUSxqjACjoVBB
Co-authored-by: Claude <noreply@anthropic.com>
Refuses until substrata.ch and www resolve to the box (Let's Encrypt
rate-limits failed validations). Then: Caddy serves substrata.ch, www and
substrata.orangecat.ch 308 to it with the path kept; health checked;
AUTH_URL switched; restart; old-link redirect checked. Backs up and
restores on a failed caddy validate. The Caddy block was validated against
a copy of the box's live config (and a broken block fails that check).
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
USGS overrides the table's default unit per commodity in an unheaded
column; the extractor dropped it, so China's largest gallium plant read
'capacity 150' under a table unit of thousand metric tons (150,000 t for
a ~900 t/yr metal). Each row now carries its unit (ditto and wrapped
cells resolved); 1,486 rows, none missing or cut off.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(atlas): the world view is a globe
George (2026-09-26): 'instead of an ugly map with randomly different
colored countries, we can have an actual globe.'
- Orthographic globe on Canvas 2D with d3-geo (already the map stack):
lit sphere, atmosphere, limb shade, crisp borders drawn as one mesh.
Drag with inertia, wheel/pinch zoom, keyboard turn/zoom/open; a click
turns the country to face the reader. Idle turn only with nothing
picked, never under prefers-reduced-motion. Drawn only when moving.
- Lazy: next/dynamic, no SSR; the canvas box is held so nothing shifts.
- Facing a country uses its mainland (largest pieces to 75% of area) and
spherical centroid/distance, so Russia, the US and Fiji (antimeridian)
and France (Guiana) frame right; flights take the short great circle.
- Colour only for a quantity: the default view and presence-only
resources (uranium, quartz, neon, boron) are plain land with a 'no
quantity to shade' note; withheld stays hatched; accent for selection.
- Antarctica drawn as unlisted land (a globe needs a south pole).
- Split by job: globe-geo, -motion, -pick, -paint, -loop, -input.
- Tests (mutation-checked): focus/zoom for ru/us/fj/fr/no, date-line
flight, drag, coast, picking incl. far side, share bins, neutral
layers, hatched withheld.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(atlas): the globe paints only what moves and what faces you
- While a finger is down or the globe is turning, paint a coarse copy of
the world (every third arc vertex, thinned in the topology so borders
stay shared); the frame after it stops is full detail.
- Cull every country and border line whose cap is beyond the horizon
(half the world at rest, most of it zoomed in); tested so nothing with
a vertex on screen is ever culled.
- Atmosphere, lit sphere and limb shade do not turn with the Earth:
render them once per disc and blit, instead of three full-disc
gradients a frame. precision(0): 50m needs no adaptive resampling.
- Drop d3-zoom/-selection/-transition (the flat map's), and guard
setPointerCapture for untrusted pointers.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(atlas): paint the globe from unit vectors, not d3's stream
d3's projection stream spends several sin/cos per vertex per frame
(rotate, clip, project). Every vertex is now a unit vector packed once
at load, and a frame is three dot products per vertex against the view's
basis — the same orthographic projection (tested against d3), ~35x less
geometry work per frame. Vertices behind the globe are pulled onto the
limb for fills; lines break there. Picking stays on d3.
Also: a country is framed at 60% of the disc, not 72%, so it keeps its
neighbours in view.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- The render sweep, run over the tool pages, flagged 14px breadcrumb links
(15 hand-written copies, now class "crumbs" with inline padding: 44px
target, same line), 40px reader tabs, and the careers sidebar ending under
the Ask button at 1440.
- A list pasted into the X-ray before hydration sat in the box with the
button grey; the client now adopts it on mount (found by scripts/ux).
- scripts/ux/reports/after.* and compare.md: 11/20 -> 20/20 task runs
passing against production, dead ends 6 -> 1 (the early-paste case above).
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(ux): task flows with step and time budgets; production baseline
Ten top tasks across five audiences, each with a success criterion, a step
budget (clicks, keystrokes, choices and screens of scrolling) and a
time-to-first-answer budget, driven at 390 and 1440. Plus a dead-end check:
every empty or error state must offer the next action.
Baseline against production: 9 of 20 task runs pass; 3 of 5 empty/error
states are dead ends.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(tools): answer first, one header, one empty state, no dead ends
Measured by scripts/ux (baseline in the previous commit), then fixed worst first:
- X-ray: names the biggest single-source risk, the country most weight rests
on alone, and the most-shared bottleneck first (lib/xray/headline.ts,
ranking only); scrolls the answer into view; Ctrl/Cmd+Enter runs; a list
nobody could read offers the sample instead of a blank report; shared
PageHeader; privacy note folded to one line; placeholder no longer looks
like a filled portfolio.
- Scenarios: result first, picker folded under it; presets before the form;
a Copy link button instead of a printed URL; an unreadable ?at says so.
- Careers: regions (Europe, North America, …) in the place filter, so
"process engineers in Europe" is one choice, not thirty; results before
the hiring sidebar on a phone.
- Data series: shared PageHeader and filter bar (auto-applies), search reads
the bottleneck name, 40 rows then Show more (all 145 made a 1 MB page).
- Science pipeline: PageHeader with the counts in one line; jump links to
what the feeds collected.
- Bottleneck pages: a signed-out reader sees Follow (sign in, come back)
instead of nothing.
- Update news now: Try again on failure; a next step when nothing is new.
- Shared: Empty takes an action (desk, exposure, careers, series, pipeline,
x-ray, reader views); a real not-found page with ways on; filter bars show
one loading state; CopyLink; desk settings use PageHeader.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(data): correct what the quality checks and a 36-row source sample found
- listings: 8 pinned home lines stored a composite FIGI that OpenFIGI cannot
resolve (openfigi.com/id 404, ID_BB_GLOBAL mapping empty); pinnedLine now
keeps the exchange line's own FIGI (TSMC, UMC, GlobalWafers, ASE, SMIC,
Rio Tinto, NKT, TSMC Advanced Packaging)
- sanctions: all 49 EU amendment dates were a day early (Brussels-midnight
stamps read in UTC); 4 OFAC programmes had empty titles (menu link parsed first)
- usgs-producers: wrapped workbook cells were split into bogus facilities
(64 fragments -> 5); Chile's copper table had lost Escondida, Spence, Sierra
Gorda and 12 more rows behind a 'Continued' commodity cell
- events/dependencies: 7 paraphrased quotes replaced with the source's
verbatim text; SK Siltron event names its directory company
- series: 18 Cameco points get the date their MD&A states
- directory: Shin-Etsu Handotai source 404 replaced; Fangyuan careers URL
(domain does not resolve) set to null as its evidence already said
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(data): written quality criteria per dataset, automated checks, /data/quality
- config/substrata-quality.ts: 15 datasets x 6 criteria (completeness,
correctness, provenance, freshness, link health, consistency); each a rule or
'na' with a reason; freshness reuses config/substrata-freshness.ts
- lib/quality: pure checks (USGS world sums, quote states the value, names
resolve, cross-dataset agreement with USGS) run in verify with a failure-count
ratchet (test/quality.test.ts); network checks (links with 3 tries and a
blocked/broken distinction, quotes on page, SEC ticker file, OpenFIGI mapping,
USGS values on the chapter PDF) run on a rotation via /api/cron/quality
- migration 014: research_quality_checks + research_quality_runs (trend)
- /data/quality: scores, counts, trend and every failing row with its source
and a prefilled correction issue; linked from /data, footer, palette
- check-series.ts shares the reader (CDATA and ' ,' fixes found by the sample)
- pnpm run quality [-- --network | --all | --json out.json]; no AI anywhere
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* 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>
* wip(resources): country panel data — OECD restrictions, sanctions, EIA energy, USGS producers
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(atlas): country panel with measured resources, producers, restrictions, sanctions and ranked peers
Replaces "Similar geologies" (first eight countries sharing any directory
resource, so Russia's peer was Timor-Leste) with "Peers on <resource>":
the other leading producers by the same USGS/EIA column. Per resource the
panel now shows production (latest and prior year, change), world rank and
share, reserves and reserves-to-production, USGS Minerals Yearbook
producers, corpus producer rows, OECD export restrictions, sanctions
measures that name the resource, and USGS/corpus statements — or "not
recorded". Adds /resources/[slug] (world ranking, HHI, CSV, restrictions by
country) and computed country headlines in place of directory blurbs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(figure): a figure's explanation is its description, defined once per page — never inline text
Method rules render once (FigureDefinitions, hidden) and every figure points at
them with aria-describedby; sources and estimates get a hidden per-figure
description. The atlas' 'Coverage by stage' carried the same sentence 18x in
copy-paste and screen-reader passes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* wip(atlas): full-bleed canvas, floating bar, sheet panel, 50m vector map
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* wip(atlas): USGS choropleth, sheet-aware framing
* wip(atlas): height-based sheet, legend polish
* feat(atlas): one canvas, one bar, one panel — 50m vector map painted by USGS data, chains as a flow
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>