17 Commits
Author SHA1 Message Date
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
CatoandClaude Opus 5.5 3cf5c26f49 feat(data): quality criteria, automated checks and /data/quality; fix what they found (#116)
* 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>
2026-09-26 00:23:09 -07:00
CatoandClaude Opus 5.5 379215bca8 feat(review): unreviewed sweep leads expire after 30 days at read time (#113)
A lead nobody decides on within LEAD_EXPIRY_DAYS (30) is expired: kept in
research_sweep_candidates, never deleted or rewritten, but out of the review
queue and its freshness age. The review queue is judged on OPEN leads only —
late past 7 days (a slow reviewer, reported), stale past 31 (only a broken
expiry or queue can get there, so it still 503s).

- lib/lead-expiry.ts: the constant, the pure leadState rule and the SQL
  predicates it must agree with; method `lead-expiry` documents it
- /review, /data, /data/freshness count expired leads and link to the new
  /data/freshness/expired list
- desk and company pages label an expired lead "expired, never reviewed";
  the reader's leadMaxAgeDays window is unchanged; Ask says EXPIRED
- test/lead-expiry.test.ts: boundary, SQL/JS agreement, open-only queue and
  freshness, expired retrievable + no DELETE; each mutation-proven

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

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

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

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

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

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

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 08:39:07 -07:00
CatoandClaude Opus 5.5 82d8d5d07c feat(resources): USGS world production and reserves per country, and a choropleth API for the map (#105)
research/usgs-mcs.json is read from the Mineral Commodity Summaries 2026
chapter tables (19 commodities, public domain) by scripts/research/usgs-mcs.py,
which reads word coordinates so superscript footnotes and "e" markers are
kept as markers, not glued to numbers. The script refuses to write a file
whose country rows do not add up to the USGS world total.

lib/resources/choropleth.ts is the map's API: value, share, rank, status and
USGS notes per ISO code for a resource's production or reserves, with unit,
year and source. A country USGS does not list is absent, not zero; a withheld
figure is not a number; no share of a "more than" total.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 04:06:42 -07:00
CatoandClaude Opus 5.5 5d6955a69d feat: reader views, a freshness page that breaks the build on stale data, shared page header (#96)
- /for/{equities,commodities,industry,jobs,learning}: one view per reader,
  composed from existing screens (X-ray, exposure, filings, series, events,
  scenarios, science pipeline, careers, learning paths); homepage opens the
  five doors straight under the hero; header gains a 'For you' group
- /data/freshness + /api/health/freshness: every feed's last good run, last
  failure and cadence from research_*_runs, every committed dataset's checked
  date against a declared maximum age, and the review queue; footer badge
- test/freshness.test.ts fails the build when a committed dataset is stale
- PageHeader shared by careers, exposure, freshness and the reader views
- Ask dock: key panel no longer pushes the conversation out at 390 px
- 'rails' -> 'bottlenecks' in desk, settings, X-ray and Ask copy

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 16:16:13 -07:00
CatoandClaude Opus 5.5 03309d4713 feat(series): dated, sourced number series per bottleneck — key numbers, claims, /data/series, CSV, desk alerts (#92)
* feat(series): dated, sourced number series per bottleneck, with key numbers, claims, CSV and desk alerts

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

* fix(series): keep desk.ts and the desk page under the size ceiling; showSeries optional like showScience

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

* refactor(methods): series methods in their own file, like graph and science

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 15:12:37 -07:00
CatoandClaude Opus 5.5 319da42e0a feat(ai): readers first — background jobs draw from a capped, reserved slice of the free budget (#93)
ai-kit 1.13.0 classBudget: drafting may spend <=25% of the day and never below
a 50% floor kept for Ask (env-tunable); spend recorded per class per UTC day
(research_ai_spend) and shown on /data#ai-budget with its method.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 15:02:28 -07:00
CatoandClaude Opus 5.5 303350b1e3 feat(careers): open roles from public job boards, skills and training per bottleneck (#91)
* feat(careers): open roles from public job boards, skills and training paths per bottleneck

- research/job-boards.json: all 138 directory companies' careers pages and ATS,
  each checked on the company's own site; 6 on public Greenhouse/Ashby APIs are
  read daily (ASM, MetOx, Anthropic, OpenAI, xAI, CoreWeave), the rest linked.
- research_jobs (scripts/db/011-jobs.sql) + POST /api/cron/jobs: daily fetch,
  filed under role family, seniority, bottlenecks and skills by published rules.
- /careers: filters (bottleneck, family, company, country, seniority, remote),
  which bottlenecks are hiring most; /careers/[slug] per bottleneck;
  /careers/paths (O*NET 31.0 + ESCO records, posting skill counts, 56 checked
  learning paths); /careers/companies; hiring section on company pages.
- Desk: follow companies/role families for jobs; new postings are a desk source.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

* feat(careers): chain roles by default, sidebar hiring board, tighter filing rules

Software and business postings are filed under bottlenecks by title only (AI
labs' boilerplate named foundries and grid interconnection); the board defaults
to roles in the chain with a scope switch; the hiring counts sit beside the
list; learning paths come before the occupational record.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

* refactor(desk): relative dates in lib/when.ts, job rows loaded in lib/desk-jobs.ts

Keeps lib/desk.ts and the desk page under the 300-line ceiling with the job
and science sources both on the desk.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

---------

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 14:47:53 -07:00
CatoandClaude Opus 5.5 5090682caa feat: portfolio X-ray and scenarios over a sourced dependency layer (#88)
* feat(graph): sourced dependency layer, portfolio x-ray and scenario logic

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

* feat(xray,scenarios): portfolio x-ray and what-if pages over the sourced graph

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

* fix(scenarios): readable share URLs, output share on direct hits, contain table overflow on phones

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 14:12:25 -07:00
CatoandClaude Opus 5.5 f4278f89fa feat(science): the science pipeline — stages, live paper/grant feeds, who is doing it (#87)
* feat(science): pipeline feeds — stage model, OpenAlex/arXiv/NSF/OpenAIRE/DOE parsers, store

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

* feat(science): /science/pipeline views, bottleneck section, desk source, cron route

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

* feat(science): institution stats, stage re-read on refetch, tighter lab wording

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 13:48:53 -07:00
CatoandClaude Opus 5.5 ff66ed6918 feat(review): AI-drafted events from sweep leads, one-click review, accept path to git (#85)
* feat(review): AI-drafted events from sweep leads, one-click review, accept path to git

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

* feat(review): pace drafting on per-minute limits, mark the quote in context, document the accept path

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

* chore(db): number the drafts migration 010 — 007 is taken by two parallel branches

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

---------

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

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

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

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

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

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

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

---------

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

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

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

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

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

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

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

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

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

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

---------

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

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

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

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

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

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 02:05:07 -07:00
CatoandClaude Opus 5.5 cdf4568ab5 feat(portal): Figure — a number that links its source or explains its computation (#76)
Adds components/portal/Figure.tsx (sourced | computed | estimate), a method
registry in lib/methods.ts rendered as anchors on /data, and uses it for the
/data header counts. Native popover, no client JS.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 01:36:42 -07:00