127 Commits
Author SHA1 Message Date
CatoandClaude a19fc22318 fix(layout): header actions never wrap; stack scenario tables on narrow widths (#423)
Co-authored-by: Claude <noreply@anthropic.com>
2026-12-02 06:00:45 +01:00
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
Cato 7019f55f04 Start sourced dependency research from profiles and chains (#419) 2026-12-01 17:16:55 +01:00
Cato ada0b68888 Make market access and Greenland resources actionable (#420) 2026-12-01 16:36:28 +01:00
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
050c2eceed Globe: callouts on @bitbaum/geo-kit 0.5.0 labels (#356)
The figures at the countries are the renderer's own labels (box, leader,
dot), placed, thinned, kept steady and faded by the package like every
map's names; the hand-written placement loop goes.


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

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cato <cato@orangecat.ch>
2026-11-28 22:31:52 +01:00
CatoandClaude Opus 5.5 72cfa71b26 Every prose field gets chatkit's microphone (DictationField) (#410)
* Every prose field gets chatkit's microphone (DictationField via TextBox)

The desk settings, sweep settings, lead review form and X-ray holdings box
now use one app wrapper, components/forms/TextBox, around chatkit's
DictationField with the microphone on the app's own /api/transcribe.

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

* Changelog: a microphone in every prose field

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 20:14:18 +01:00
CatoandClaude 116e9537d0 feat(comments): page discussion is chatkit's CommentThread (#387)
* feat(comments): page discussion is chatkit's CommentThread

The discussion under notes, learn, resources and profile pages was a
hand-rolled list and a bare <textarea> with no microphone. The fleet rule
is that comments are chatkit's CommentThread and that anywhere a person
types words there is a microphone, so:

- Bump @bitbaum/chatkit ^0.22.1 -> ^0.25.0 (CommentThread arrived in 0.23).
  Ask (ResearchChat, AskBox) type-checks and renders unchanged.
- PageDiscussion renders CommentThread: the box is chatkit's Composer with
  the microphone (/api/transcribe), Enter-to-send, and a refused post keeps
  the draft. Posting still goes to /api/comments, where threadkit's
  canWrite decides who may write; a signed-out reader (from /api/me) sees
  "Sign in to comment" linking to sign-in and back to the page instead of
  a box that only fails on submit. Dates keep the YYYY-MM-DD form and
  authors keep "Reader" / "Substrata". Fact-check stays Substrata's and
  re-mounts the thread with its new comment.
- Drop the CSS the package now owns (.page-comments, .comment-meta,
  .comment-form); bind PageDiscussion under the chat block of
  package-plan.json; note it in docs/IMPLEMENTATION-PLAN.md.

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

* fix(comments): a refused comment says why, and no sign-in link where sign-in is off

The route's refusals (too short, the hourly limit, sign in) are thrown as
chatkit's CommentRefused, so the thread shows them instead of a generic
"try again" that would fail the same way forever; a comment under the
route's 3-character floor is refused before it is sent. The sign-in link
shows only once /api/me says sign-in exists on this deployment.

Needs @bitbaum/chatkit 0.28.0 (CommentRefused); the bump follows.

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

* chore(deps): @bitbaum/chatkit ^0.28.0 (CommentRefused)

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 12:48:41 +01:00
CatoandClaude 6c5f235de8 feat(contribute): a microphone in the contribution boxes (chatkit Composer) (#384)
* feat(contribute): chatkit Composer with microphone for contribution boxes

"Know something, or want us to look?" (Inquire, on bottleneck pages,
empty states and the world panel) and "Send evidence" beside Ask
(ContributeForm) were bare textareas: no microphone, and a different send
from Ask. The fleet rule is that anywhere a person types words there is a
microphone, and the experience belongs to the package, so both now use
chatkit's Composer with the same /api/transcribe voice leg as Ask.

- Enter sends, Shift+Enter breaks the line, as in Ask.
- useContribution.send answers Composer's onSend: a message under 10
  characters, a missing consent tick (Send evidence) or a failed request
  is said in the box and returns false, so the draft is kept.
- ContributeForm is no longer a <form>, so nothing submits twice; the
  optional reply email and credit name stay.
- Inquire reuses useContribution instead of its own copy of the POST.
- The .inquire-form textarea style is dropped: the composer keeps its own look.
- package-plan.json binds Composer in both files.

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

* fix(contribute): say the length cap before sending, and start each box clean

Composer has no maxLength, so the inbox's 12,000-character cap is now
checked before the request and said in words. Opening or closing a
contribution box clears an earlier refusal, so it never shows over a new
draft.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 09:06:25 +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 c59cd1dc11 refactor(palette): search as you type through searchkit's useSearchAsYouType (#380)
The command palette hand-rolled its own debounce, abort and stale-answer
drop. @bitbaum/searchkit/react's useSearchAsYouType does exactly that, and
the org rule is that a package capability is used, not re-implemented. The
local useSearch is gone; the palette keeps its cache (an earlier query
answers without a request), its keyboard behaviour and its rows.

What the reader sees: the last research results stay on screen while a
newer query loads instead of blanking out, the "All N results" count only
shows for the query actually answered, and a failed research search now
says so on the last row instead of failing silently.

package-plan.json binds CommandPalette.tsx to useSearchAsYouType under the
search block; README describes the new behaviour.

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 08:40:56 +01:00
Cato a46565435a fix(shell): hide mobile tab bar on auth pages (#377) 2026-11-12 07:32:53 +01:00
CatoandClaude 6f39b94eec refactor(shell): the footer is sitekit's SiteFooter (#374)
The footer was hand-written markup and CSS in the app. It is now the
package's application footer: sitekit owns the layout, link targets and
spacing; Substrata supplies the note, the links and the freshness line.
The local footer-nav CSS is removed; sitekit's variables are mapped to
the design tokens.

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 06:43:07 +01:00
CatoandClaude fa73bb626b fix(chat): the reader is told when the web search brought nothing back (#372)
Seen on production: every question showed "Searching the web for …" in
its steps and then an answer with no web page and no word about it. The
search outcome was known to the prompt only, so saying it was left to
the model, which did not.

The outcome of the answer's web searches (found, nothing, or could not
be reached) is now recorded by the search itself and carried on the
answer. When no page came back, a line under the answer says which of
the two it was. An outage is never told as "found nothing".

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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 06:15:56 +01:00
CatoandClaude 0b6ec077a3 fix(nav): /portal reaches the desk, and the desk is linked for every reader (#366)
/portal returned 404. The member portal is the desk at /account, so
/portal, /portal/* and /desk now redirect there (temporary, so a portal
page of its own can take the address back).

The top bar's Desk link and the palette's Desk row were shown only to a
signed-in reader, so nobody without a session could find it. Signed out,
/account already says what the desk is and offers sign-in; both now show
for everyone.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 05:05:07 +01:00
CatoandClaude Opus 5.5 70258beed0 feat(globe): Substrata's globe on the fleet's one renderer, @bitbaum/geo-kit/map (#306)
* wip(globe): Substrata's globe on @bitbaum/geo-kit/map (lockfile follows the 0.3.0 release)

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

* feat(globe): Substrata's globe on the fleet's one renderer, @bitbaum/geo-kit/map

The world globe moves onto @bitbaum/geo-kit/map 0.3.0, the renderer that was
extracted from it and that Solon's commune map already draws with. Seven
modules go (cull, trace, motion, pick, input, loop, control); globe-geo and
globe-paint keep only Substrata's side (countries keyed by ISO code, the
tokens, the hatch, the layer's fills); the sites, routes, figures and pulse
stay Substrata's, drawn over the Earth through the renderer's `over` hook and
given the first say on a tap or hover through `pickFirst`. The renderer's
wiring is its own file (globe-renderer.ts), so Globe.tsx stays under its
300-line ceiling. The globe's geometry tests now live in geo-kit; the ones
here test Substrata's side.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-30 23:35:59 +01:00
CatoandClaude Opus 5.5 c5d7c99d77 feat(auth): Substrata accounts on @bitbaum/accountkit, not only OrangeCat (#294)
* 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>
2026-10-29 11:57:03 +01:00
CatoandClaude Opus 5.5 f4ee258bc8 refactor(ask): chatkit 0.19 — send handle, initial message, Retry keeps pictures; three answer fixes (#264)
* refactor(ask): chatkit 0.19 — send handle and initial message, thrown turn failures

Delete lib/chat/drive-composer.ts and useAutoAsk.ts, which typed into
chatkit's composer and pressed Send. /chat?q= is ChatApp's deepLinkParam
(sent at once, as before), the home box's ?send= handoff is its
initialMessage, and "Check this" goes through the ref's send with
newChat. The transport throws ChatTurnError instead of returning a failed
message, so the bubble keeps the server's words and Retry re-sends the
pictures.

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

* fix(ask): an attributed claim is Reported when the source only shows it was said

"Confirmed" over "Gartner estimates a $4.9T gap [W2]" told the reader
the gap was real when the page showed only that Gartner said so. The
writer is told the difference, and code downgrades an attributed
claim's Confirmed to Reported when its source line names the speaker or
reports a saying. Partly and Not found are unchanged.

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

* fix(ask): never cut a markdown link in two when dropping sentences

A link whose title held a full stop was split at it; when a guard dropped
the first half the reader saw "…IaaS… ](https://x.com/…))" in the
Reasoning. withoutMaterialFigures, withoutSentencesHolding and
uncitedForecasts split with a bare regex; default-deny masked links
itself. All four now split through lib/chat-agent/sentences.ts, which
masks links (URLs with one level of parentheses included) while
splitting.

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

* fix(ask): a web chip only on a sentence its page supports

The opening of a screenshot answer ended its generic analysis in [W1],
drawn as a finance.yahoo.com chip, and the page (a stock quote) said
nothing of the kind. Before default deny, a [W#] now stays only on a
sentence that carries a figure the cited passage prints or a name it
gives; otherwise the marker comes off and the sentence is judged as
uncited.

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

* fix(ask): the panel's chat list is a drawer at every width

ChatApp's rail follows the window (64rem), so in the ~30rem panel on a
desktop the list took half the panel and left the answer a 12rem column.
The panel passes railQuery="not all"; /chat keeps the rail.

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

* docs(changelog): the answer fixes and the panel's chat list

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 21:44:15 +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 a88a29e447 feat(company): prices for the whole universe, a name check on every new line, and a list of what is not known (#271)
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>
2026-10-27 15:50:37 +01:00
CatoandClaude Sonnet 5.5 8604900ad2 fix(nav): the section strip no longer scrolls the page back under the finger (#267)
* fix(nav): the section strip no longer scrolls the page back under the finger

SectionNav kept the marked entry visible with scrollIntoView, which scrolls
every ancestor including the page. On the sticky phone strip it threw the
page back ~70px each time the marked section changed, so a swipe fought the
finger. The strip now moves by its own scrollLeft.

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

* docs(changelog): the page no longer fights the finger (#267)

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:34:09 +01:00
CatoandClaude Opus 5.5 f5a3619f02 feat(company): quote first, a clean price line, and no Ask pill over a figure (#265)
* feat(company): quote first on a listed company; Ask pill never covers a figure

- A listed company reads like a quote page: name, quote, then the share
  price's range row and chart. Its role in the chain (the lede, the five
  tiles at a glance, why it is graded so, where the role is cited, and the
  update news) moves below Key statistics as "Role in the chain"
  (section id chain-role; `role` is already the "What this holds up"
  module). Unlisted, identified and stub companies are unchanged.
- From 768px the page column keeps a right gutter as wide as the floating
  Ask pill, which sat on NVIDIA's "Largest fall from a peak" at 1440px.
- On a phone the floating pill is hidden again: Ask is the top-bar button
  there. The rule was lost in the chatkit move (#140), leaving two Asks and
  the pill over the same figure at 390px.
- docs/design/company-page.md follows the new order and the rule.

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

* feat(company): a year of closes is a clean line with a light fill

chartkit 0.3.0 (LineChart markers + area): the price chart passes
markers="auto" and area, so a range of more than 60 closes draws no dot
per close (about 120 beads on 1Y before); each close still shows its
value on hover and keyboard focus, and the table holds them all. Short
ranges (1M) keep their dots.

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 14:17:31 +01:00
CatoandClaude Opus 5.5 6e5bbf3483 feat(markets): a company page that reads like a markets product (#259)
* 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>
2026-10-27 13:43:25 +01:00
CatoandClaude ac8056fd77 refactor(ask): chatkit ChatApp for the panel and /chat (#262)
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>
2026-10-27 12:35:27 +01:00
CatoandClaude 0dc40c2530 feat(ask): attach screenshots, read them, check their claims (#260)
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>
2026-10-27 10:36:52 +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 3ed7dff5ed feat(universe): a written rule for which companies are in — and the first 461 identified companies (#250)
* 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>
2026-10-25 12:54:53 +01:00
c4f7f50435 Re-check the stale data honestly, monthly, without a laptop; rank the Ask evals on a fixed day (#247)
* 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>
2026-10-25 12:23:32 +01:00
CatoandClaude Opus 5.5 8e85c7e7b4 feat(ask): search and read the web up front for open-world questions (#244)
* feat(ask): search and read the web up front for open-world questions

The owner read the recent chats: the Ask behaved like a search over the
corpus, not like a language model that researches. Asked for Kazatomprom's
2026 guidance it opened with "The Substrata corpus does not track..." and
never gave the figure; asked how competitors' share prices moved this month
it said Substrata "does not record" equity moves, with web leads unused.

- route.ts: a pure router decides per question whether the web is needed
  (news, prices, guidance, what someone said, competitors, people,
  explanations, and by default anything but questions about Substrata
  itself or off-topic chat). runPlan searches it in parallel with the
  corpus lookups; "this month"/"today" become dated queries.
- Pages are read, not snippets: top four in parallel, PDFs as text via
  unpdf behind readPage's SSRF checks, the matching passages verbatim with
  the page's date.
- Prompt: answer first and directly from corpus rows, [W#] passages and
  marked general knowledge; figures only from a row or a dated passage;
  never open with what the corpus lacks.
- Guards: a figure cited [W#] must be in that passage (sent back once,
  then dropped); marked background survives default deny without figures
  or link claims; corpus-gap openings move to the end and "Unchecked web
  results" headings go. Corpus table guards unchanged.
- UI: [W#] renders as a chatkit source chip linked to the page with its
  site and date; "Web pages read · not checked by Substrata" under it;
  "Reading <domain>…" steps while it works.
- Evals and tests for the router, page reading (fake fetch), the PDF
  path, the web-figure guard, answer-first, and the six new questions.

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

* docs(ask): record the open-web Ask policy and why

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 18:49:23 +02:00
CatoandClaude e7959fb3d9 feat(ask): tables not walls, reviewed entity aliases, and the graph as chat tools (#222)
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>
2026-10-24 08:29:39 +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 9d54efe06d fix(ask): units copied as the table gives them, one composer on panel and /chat, the widget steps aside (#215)
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>
2026-10-23 13:43:18 +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 366d3edb30 feat(ask): the Ask panel scrolls, expands to /chat, and answers draw charts (#213)
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>
2026-10-23 13:00:25 +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 Fable 5.1 7352762258 feat(ask): starter questions drawn from every facet of the corpus, rotating daily (#205)
* feat(ask): starter questions drawn from every facet of the corpus, rotating daily

The home page and /chat offered the same three typed questions to every
reader every day, one of them about one country, and said nothing about
how many kinds of thing the corpus holds — companies, rules, science,
talent, capital, materials, events. Now every starter is generated per
facet from the corpus (lib/starter-facets.ts), never typed; four tiles
never share a facet; the set rotates with the date; /chat's empty screen
and the dock draw their own four with a different seed, excluding the
home's; and every question names a thing the site has a page for
(test/starters.test.ts). The typed list in config/substrata-chat.ts is
only the fallback for a corpus with nothing to draw from and names no
entity. lib/home-asks.ts stays client-safe (the Ask box imports it), so
homeAsks moved next to starters().

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

* fix(ask): no tile label is ever clipped; short templates per facet

A label cut with an ellipsis ("What does United States' 2024 export…")
says nothing, which is the complaint the starters exist to answer. Now a
candidate whose label exceeds LABEL_MAX is passed over, never clipped:
the hash picks among the rows that fit, and a facet with nothing that
fits is skipped for that seed (talent today: its one bottleneck is 49
characters). Each facet has a short template so most entities fit —
"What does Chile hold?", "US 2024 export control: what changes?" (short
jurisdiction + year + kind, never the filing title; subject first because
"What does the China 2023 export control change?" is 47 and only the
tariff fitted), "How close is hybrid bonding?", "What could EIB move?",
"What eases EUV projection optics?", "Dysprosium metal: what changed?".
Jurisdictions and capital providers carry a `short` where the name does
not fit a tile. Materials are those a tracked bottleneck depends on, so
oil does not lead the front page. Tested over sixty days of seeds.

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:14:36 +02:00
CatoandClaude Fable 5.1 9e05b121b1 feat(chartkit): the fleet's chart package, adopted for series (#206)
* feat(chartkit): the fleet's chart package

@bitbaum/chartkit 0.1.0 in packages/chartkit, a standalone package the
fleet creates a repo from (registers/package-repos.json). Seven charts —
LineChart, BarChart, ShareBars, Sparkline, Meter, Timeline, StatTiles —
rendered on the server as SVG + HTML with text in rem, a visually hidden
table behind each, colours only from --ck-* tokens, labels that truncate
instead of clipping and events that take a second lane instead of
overprinting. findChartDefects (@bitbaum/chartkit/audit) measures that in
a real browser; test/browser.mjs runs it over the demo at 320, 390 and
1280 in light and dark, after proving it fails on a broken figure.

Same conventions as chatkit: tsc to dist/ (committed), node --test for
the arithmetic and the server render, Playwright for layout, one verify.

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

* feat(series): draw the series chart with chartkit

The hand-rolled line chart (components/series/SeriesChart.tsx,
lib/series-chart.ts, ~130 lines of series.css) is replaced by
@bitbaum/chartkit's LineChart and Sparkline, consumed by path
(workspace:*) until the package has its own repo. SeriesChart.tsx is now
only the join between a Series and the package's contract; the geometry
test moved with the geometry. Chart tokens map to Substrata's ink, line
and status colours next to the chatkit mapping. The app's lint and tsc
stop at packages/, which verify themselves; root verify runs the
package's, and CI installs Chromium for its browser audit and checks the
committed dist against the source.

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 10:48:04 +02:00
CatoandClaude Sonnet 5.5 408d9d77f1 feat(home): the homepage, rebuilt ask-first (#204)
* 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>
2026-10-22 23:02:26 +02:00
CatoandClaude 757d1b3a1d feat(chat): the answer feedback loop — thumbs, transcript export, nightly review (#198)
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>
2026-10-22 19:02:13 +02:00
CatoandClaude ef733b2bae feat(chat): make /chat the fleet's whole-screen chat (chatkit ChatScreen) (#195)
/chat now renders through chatkit's ChatScreen with fill="viewport", as
Loki and Solon do: the conversation is the whole display, a see-through
header floats at the top with a frosted way back to the site and the
page's name, and the composer floats at the bottom and rides above a phone
keyboard. ChatScreen measures the header and the composer and pads the
thread, so the last line of an answer always rests above the composer.

Below 768px the site's top bar and tab bar step aside so the conversation
has the whole phone; from 768px the top bar stays and the screen takes the
height under it. The shell column never scrolls on /chat (the thread is
the one scroller). The hand-rolled viewport maths, sticky composer and
`.shell:has(.companion-page)` locks in ask.css are gone; what remains is
the shell around the screen and Substrata's own parts (empty state, model
control, "Send evidence", key panel), which now sit with the composer in
the dock in one shape. The floating dock (AskDock) keeps its compact
column, scoped to `.companion.is-compact`.

Copy · Listen · Share appear under every answer (`share` on ChatThread).
The CTA and the "Send evidence" link now meet the 44px target.

ai-kit ^1.20.1 → ^1.21.0 (lockfile refreshed).


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 08:43:29 +02:00
Cato 9269dae833 fix(chat): add CTA after headline, label input before voice, and collapse model list (#194) 2026-10-22 01:17:03 +02:00
Cato d0d8a04514 fix(chat): anchor composer to bottom and lock viewport scroll (#193)
- Make .ask-empty flex: 1 and overflow-y: auto so starters do not push the composer off-screen
- Anchor .ck-composer-wrap with position: sticky and bottom: 0
- Suppress site footer on /chat and lock .shell.is-chat height to visual viewport with overflow: hidden
- Update useViewportHeight on /chat to sync with documentElement
- Add automated tests in test/chat-scroll.test.ts verifying anchoring, scrollability, and shell locking
2026-10-22 01:07:58 +02:00
CatoandClaude Opus 5.5 f0a80823d8 One slip still finds it: searchkit in every search box (#179)
* feat(search): match with @bitbaum/searchkit; forgive a slip in every search box

Site search was the one box in the fleet with typo tolerance, and it carried
its own copies of what searchkit now does once for everyone: folding, an
edit distance, the typo budget, prefix lookup, highlight offsets and snippet
cutting. Those now come from the package. What stays is what is genuinely
this corpus's: the TF-IDF ranking over long documents with type weights and
phrase bonuses (search/score.ts), the narrow plural rule, the stop words, and
"a real word is never corrected".

A full swap to createSearch's tie-break ranking was tried against the golden
pairs and lost two: "gallium ch" put Chalco first (a two-letter prefix that
covers a one-word title outranks an exact rare word) and "quartz" put a
company above the quartz bottleneck (no term frequency). So searchkit decides
which words a typed word could mean (candidates) and where to mark them;
the ranking stays here.

Small gains in the engine: a slip in the word still being typed ("photres")
and in a word the corpus has only as the start of others ("canno" -> Canon)
now find it; marks use original offsets, so accented words are marked where
they stand. Real words are still never corrected, so result counts for them
are unchanged.

The other boxes had no tolerance at all and now share the package: the globe's
country finder and the palette's page list (search + marks), and the filter
boxes on Exposure, Data series and the desk (lib/text-filter.ts: membership
only, every word required, the table's own order kept). One slip in a country
or page name used to return nothing 96-97% of the time; success@1 is now
0.989 for both. Careers keeps its SQL substring, with a comment saying why.

Tests: generated typo suites (typoCases + evaluate) over company and country
names in site search, every country name in the finder, and every page label
in the palette, plus hand-picked slips and the existing golden pairs.

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

* chore(deps): add @bitbaum/searchkit, pinned to orangecat a868c0a9

The fleet's one search package, installed from orangecat by commit
(packages/searchkit). It ships compiled dist/, so no transpile step.

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

* docs(changelog): link the search entry to #179

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 10:18:54 -07:00
CatoandClaude 01e42b7dca feat(atlas): a chain reads as a page on a phone — no sheet, one row of tabs (#178)
The owner, from a phone: the slide-out wastes space. It did — a grip and a
3 x 2 tab grid took a quarter of the screen, the chain's name and the diagram
were out of view once it opened, it scrolled inside a page that also scrolled,
the figure boxes repeated the sentence above them, the floating buttons sat on
the text, and "Full evidence / On the globe" repeated under every tab.

- ChainReader replaces the AtlasSheet in the chains view. Below 1024px it is
  the page: the summary, the two ways out once, the route as a tappable strip
  (phones; RouteStrip), the makers in one line (MakersLine), the tabs pinned
  under the top bar, the reading at full width, padded clear of the floating
  buttons. 768-1023px shows the diagram with the reading under it; from
  1024px it is the floating panel as before.
- One row of underlined tabs, all six in view from 360px to 1440px.
- Figures are one row of numbers, value first; money's is one word.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 09:54:32 -07:00
CatoandClaude Opus 5.5 4f15398ffe feat(atlas): a named map, clearer chain headings, 12px floor, and three new globe shadings (#177)
* feat(atlas): a named map, clearer chain headings, 12px floor, and three new globe shadings

- The page heading reads "Global Resource Map – Location, Production, and
  Supply-Chain Connections" (still visually hidden over the full-bleed canvas).
- Chain diagram: column headings ("Goes into it", "Holds up") are larger and
  bold; the "Made by" list heading inside the card is lighter.
- Every atlas label below 12px now uses --text-label (12px); globe labels 12px.
- The sidebar's Explore heading carries a subtitle, "Interactive map,
  bottlenecks, policy" (config/site-nav.ts).
- The legend's Production/Reserves switch becomes a "Shade the globe by"
  picker: Production volumes, Reserves, Historical trend (one-year change in
  the same USGS table) and Risk heat-map (OECD export restrictions recorded).
  Trade flows and Environmental impact zones are listed as not yet available:
  no sourced country data for either is on file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(changelog): atlas shadings and headings (#177)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 06:58:41 -07: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 c9b421d54f feat(atlas): producer sites on the globe, and every chain as a route you can follow (#175)
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>
2026-10-12 05:11:11 -07:00
CatoandClaude 0f0648048f feat(atlas): the globe says where, flies there, and every chain says what you can do (#174)
From the owner (2026-10-12): Substrata should feel like an analyst's
instrument — more motion, a country zoom that is beautiful, maps that show
where a resource comes from and who makes it — and the research has to be
actionable, with the action depending on who is reading.

Globe
- Callouts: a painted resource labels its top producers on the globe itself
  ("Australia · 32%", "Chile · 19%"), largest first, at most eight, faded
  toward the limb. mapLayer() returns them; the name comes from the map.
- Picking a resource turns the globe to its largest producer. Lithium used
  to open on Europe with Australia and Chile on the far side.
- A ring opens from a picked country as the globe flies to it.
- globe-marks.ts holds the annotations (globe-paint.ts stays under 300
  lines); label colours come from the tokens via readPalette.
- Fix: the frame loop's cleanup cancelled a pending frame but kept its
  handle, so a remount (React's development double-mount) left the globe
  blank forever. The cleanup now forgets the handle.

Chains
- "What you can do" on every chain, one row per audience the site already
  names (config/audiences.ts): equity investors get the listed holders and
  tickers on file and the stop scenario; commodity traders the raw material
  on the globe and the rules that touch it; industry teams the relief
  pipeline with its best readiness and whether money is the constraint; job
  seekers the roles filed under the bottleneck; learners the dossier. Built
  from the data in app/atlas/chain-actions.ts; a row with nothing behind it
  is not shown; "Not investment advice" beside it.

docs/DESIGN.md writes the direction down: the register (precise, calm,
sourced; not neon), motion only where it answers a question, who comes back
and why, and the next five steps (producer points, chain arcs on the globe,
a reader setting, sourced AI briefs, a dark atlas).

Tests: chain-actions (new), globe callouts; full suite 506/506, tsc, eslint,
prettier clean. Checked rendered at 390 and 1440: lithium, copper, the
flight to Chile, the EUV actions.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 04:09:08 -07:00
CatoandClaude a86450c25d feat(atlas): the chain as a diagram you can read — makers in place, lines that flow, the story in plain words (#173)
The chains view read as "a little bit confusing" (owner, 2026-10-12): four
columns in a row with an arrow between each, "made by" sitting between the
thing and what it holds up as if it were a stage, and a click on ASML that
left the map for /markets/asml. There was no sentence anywhere saying what
the chain means.

- Layout: needs on the left, the bottleneck in the middle with its makers
  feeding DOWN into it (makers are who build it, not a stage after it),
  what it holds up on the right. Part suppliers are drawn lighter than the
  maker of the thing; each card carries its role and country; the
  bottleneck shows its severity as twelve ticks.
- Lines: from 768px the arrows give way to curves drawn between the actual
  cards (ChainLinks.tsx, measured from the DOM), with a dash that runs from
  input to output; a hovered or focused card lights its line. Still for
  prefers-reduced-motion. Phones keep the stacked order with a verb on each
  arrow (goes into · builds · holds up).
- Makers stay on the map: ?maker=<slug> opens the maker in the atlas panel
  — role on this chain, the directory's one-line judgement, scarcity,
  layer, evidence, source — with Back to the chain and Full profile.
- The story: app/atlas/chain-story.ts turns the same rows into sentences —
  one lede ("ASML (Netherlands) builds EUV lithography scanners; it cannot
  be made without … ; stop it and leading-edge foundry capacity stops with
  it") in the panel head, then What it is · Who makes it · What it needs ·
  What it holds up · How hard it binds · Rules and ways around. Templates
  over the data, so it cannot claim more than the sources do.
- AtlasChainPanel.tsx takes the panel out of AtlasChain.tsx (300-line
  ceiling).

test/chain-story.test.ts pins the sentences, the in-atlas hrefs, the
builder-vs-supplier split and the maker panel's reads. Checked at 390,
834 and 1440: no horizontal overflow, six lines drawn on the EUV chain.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 03:31:04 -07:00