mirror of
https://github.com/bitbaum/substrata.git
synced 2026-12-04 05:47:59 +01:00
main
32
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8c1107fb9a |
chore(ci): one check per change — remove the merge sweep, check on PRs only (#413)
Removes the fleet auto-merge sweep caller (and wake chain where present); checks run on pull requests only, not again after merging; a deploy that waited for CI on main now deploys on push. The forge merge check (forge/verify) verifies each PR on its merge result and merges it. Signed-off-by: Cato <41178744+catomean@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
bf1f73e259 |
feat(auth): account mail on, so the sign-in link and recovery appear (#322)
Substrata created its account runtime with `mail: { configured: false }`, so
the sign-in link, "Forgot your password?" and address confirmation could
never appear, and a forgotten password had no way back.
- lib/auth.ts sends account mail through AccountKit's `createAuthMailer`
(mail-kit, the fleet's RESEND_API_KEY). Without a key the options stay
hidden, as before; confirming an address is never a wall.
- The sign-in, sign-up and account pages pass `mailConfigured()` to
`signInMethods`, and a reset link that lands on /sign-in is no longer
redirected away for a signed-in reader.
- The account journey first asserts every way in the env switches on:
password and passkey always, the link only with mail, "Continue with
OrangeCat" and the shared sign-in button with their clients. CI sets
synthetic, unreachable OIDC clients so both buttons are checked.
- @bitbaum/mail-kit is a direct dependency (AccountKit's optional peer).
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9
Co-authored-by: Claude <noreply@anthropic.com>
|
||
|
|
9ca43d25db |
ci(accounts): a browser journey proves an account can be made and used (#301)
A new `account` job in browser-smoke.yml runs scripts/ux/account-journey.mjs in Chromium against the production build and a PostgreSQL built from scripts/db/*.sql: sign up with email and password (mail is off, so the account signs in at once), see the account menu, sign out, have a wrong password refused, sign back in, and a foreign origin gets 403. The fleet's shared journey assumes account mail, which Substrata does not send, so this drives Substrata's own screens. lib/auth.ts now also trusts AUTH_URL as an origin, so the journey passes with better-auth's origin check on (NODE_ENV=test and TEST stay unset). On the box, lib/request-guards.ts already reads AUTH_URL as the public origin. Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9 Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
ad9fb7932c |
feat(deploy): the deploy applies migrations, installs timers, runs the price backfill once (#276)
* feat(deploy): the deploy applies migrations, installs timers and runs the one-time price backfill Before the release goes live, deploy.yml now applies pending scripts/db/*.sql (one transaction each, recorded in public.schema_migrations, first run checks existing objects before baselining) and installs deploy/systemd units. A failure stops the deploy with the live release untouched. After the release, the price backfill runs once and is recorded in public.schema_oneshots. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE * docs: name no migration file that does not exist Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
2507e3bc59 | fix(ci): install app browser smoke dependency (#252) | ||
|
|
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 |
||
|
|
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> |
||
|
|
6eab9fc318 |
fix(ask): no dead-end answers — an empty lookup opens the web, never a wall (#197)
Seen live (2026-10-22): a question the corpus had little on was planned, looked up, found nothing, and the model was then capped at one round and told to write — so it wrote "not in our data" and stopped, with the web tool never within reach. And production ran with no search backend at all, so the model was told it had no web tool. - loop.ts: a planned lookup that came back empty (no rows, only a note or an error — `lookupIsEmpty`) keeps the tools on offer and leaves two rounds, so web_search is reachable; "some", not "every": one found record must not close the door on the part that was not found. - prompt.ts: with an empty lookup the model is told the gap is the corpus's, never the answer — call web_search when it has it, give the widely established background marked "Outside the corpus —" when it does not, and in both cases say what the corpus holds nearby and that the reader can send evidence. The honesty rule says the same: "not in the corpus" alone is a dead end. - share-search-backend.yml: copies the SearXNG/Brave/Tavily settings from Causius's runtime env on the box into Substrata's and redeploys, the way Causius copies its model keys from Heidi. .env.example names them. - tests: empty results are recognised; a jobs question whose lookup finds nothing keeps web_search on offer; the prompt turns the gap into a search or marked background, never a wall. Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
e2d4d51610 |
fix(ask): Camera / Photos / Files on a phone — chatkit 0.4.1 (#158)
Substrata was on chatkit 0.2.1, whose paperclip opened Android's capture-app chooser with no file browser. 0.4.1 opens a Camera / Photos / Files sheet on touch screens. `check:file-inputs` joins `verify`, and Dependabot groups @bitbaum/* releases into one PR. Pinned to the merged 0.4.1 commit until it is on npm (trusted publisher not configured yet); then it becomes ^0.4.1. Claude-Session: https://claude.ai/code/session_01BWXjqiHm8jFta4FXuc7Tck Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
4bdf827736 |
fix(chat): retrieval quality — word-boundary scoring, IDF weighting, relevance floor (#73)
* docs: the concept — one corpus, five latencies, and who actually pays Strategy SSOT for where the research goes and who it is for. The three questions it answers: - Why the nearest comparable product (sell-side equity research) is beatable: its unit of analysis is a ticker while the unit of causation is a node, coverage follows market capitalisation rather than causal weight, the horizon is a quarter against constraints that clear on a decade, sector silos cut across every interesting chain, and nothing it publishes can be scored. - The idea to build around: a constraint is visible in five record systems at five different latencies — science (5-15y), funding (2-7y), talent (1-5y), policy (0-3y), market (0-1y). Equity research reads the bottom row. Reading the top rows years earlier, and showing the working, is the whole product claim. It needs one schema change: every observation typed by layer and carrying both dates, so lead time becomes a measured property of the corpus rather than a boast. - Who pays, ranked by fit rather than cheque size. Procurement and supply assurance first, because they are the only customer who corrects the map instead of only reading it. Also records the rule that keeps a holistic map from becoming a general database: every row must traverse to a bottleneck and through it to a loop, enforced as a build gate rather than as editorial taste. The corpus has already failed this once — 30 of 51 country rows connected to nothing. No code or corpus changes; everything described is unbuilt and the document says so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C9tLC1kS4qNVdRxcHuPZ5c * feat(chat): bring your own frontier key, and a web-lookup gate that lied Two changes to the assistant, one a real bug fix and one a new feature. FIX: `webLookupEnabled()` checked SEARXNG_URL only, while `webSearch()` itself walks three backends (SearXNG, then Brave, then Tavily). A box configured with just a Brave or Tavily key had a fully working lookup behind a gate reporting it off — the system prompt told the model "You have no tools", the outside-corpus escape hatch never opened, and the one env var that would have fixed it was the one this function forgot to read. Now checks all three, with a regression test. FEATURE: a reader can now supply their own API key (OpenAI, Anthropic, or OpenRouter — a fixed list, never a free-form base URL, because this server makes the outbound call on their behalf and an arbitrary URL there is SSRF with their bearer token attached) and get answered by a genuine frontier model instead of the free tier's small, rationed chain: - `lib/byok-shared.ts` — types, the closed vendor list, and validation, with no server-only dependency, so the client settings panel can import it without pulling `@bitbaum/ai-kit` into the browser bundle. - `lib/byok.ts` — `completeByok()`. OpenAI and OpenRouter go through ai-kit's `complete()` with a one-link ephemeral chain (never `process.env`); Anthropic's Messages API isn't the OpenAI shape everything else in ai-kit speaks, so it's called directly. - `lib/byok-store.ts` — the reader's own browser is where the key lives between requests, guarded against private-mode/blocked-storage failures. It is never sent anywhere but this component's own request and never touches this project's servers between requests. - `lib/chat.ts` — one `runCompletion` closure now backs all three completion call sites (initial answer, outside-corpus fallback, grounding repair), fed by either the free chain or `completeByok`. BYOK gets a larger token budget and longer timeout — the free tier's ceiling exists to ration a shared pool that does not apply to a reader's own paid key — and the system prompt names the model running and tells it to use more of its own judgement in BACKGROUND, while the citation rules (a finding is a numbered row, nothing else is [F#] or [W#]) stay identical regardless of which model is answering. Works even with zero free providers configured. - `app/api/chat/route.ts` — validates `byok` if present, skips the free-chain `isOfferedModel` gate (irrelevant to a vendor-native model id), and surfaces a `ByokError` message to the reader directly ("your key was rejected") rather than the generic "temporarily unavailable" wall, since that failure is the vendor talking to them, not this deployment breaking. - `components/portal/ResearchChat.tsx` — a "Frontier key" control next to the model picker opens a small panel (provider, key, model id); once set it replaces the free-model select with a pill naming what is answering, and the empty-state copy says so too. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C9tLC1kS4qNVdRxcHuPZ5c * feat(coverage): 16 producer rows sourced, 2 removed for being wrong A pass over the 31 unverified producer leads still open in the coverage universe, cross-referenced against `research/evidence.json`'s candidate pages (20 leads already had a candidate excerpt on file, waiting for someone to read it and decide) plus fresh web research for the rest and for the ones whose only stored evidence was too weak to stand behind. PROMOTED TO SOURCED (16), each read and cited against a specific source: - Sibanye-Stillwater and Impala Platinum — ruthenium, mining role. The Sibanye row cites their own SEC trading-statement filing, which reports actual ruthenium ounces produced (258koz, 2025) — about as primary as a production claim gets. - Ferrotec — quartz, own site. - Chalco, East Hope Group, Zhuhai Fangyuan, 5N Plus — gallium, refining. The first of these was on file as "Chinalco", which turned out to be the wrong entity: Chalco (Aluminum Corporation of China Limited) is the listed subsidiary that actually runs the alumina refineries gallium comes off; Chinalco is its unlisted state-owned parent. Renamed, with both names kept as aliases since trade press uses both for the same business — and the evidence file's own row renamed to match, since a test holds every evidence row to a producer that still exists. - Chemours, Syensqo, AGC, Engineered Fluids — two-phase dielectric immersion coolant, refining/conversion. - AMSC — REBCO tape, conversion. - QatarEnergy and Linde — liquid helium. Off-take from Qatar's Ras Laffan Helium 2 (the world's largest liquefaction train) splits Air Liquide 50% / Linde 30% / Iwatani the remainder, per the same source for both. - China Northern Rare Earth and Shenghe Resources — Nd-Pr metal, refining. Shenghe's dysprosium row stays unverified: the evidence found supports their Nd-Pr business specifically, not dysprosium, and a citation that does not name the actual claim is not a citation. REMOVED, not promoted (2) — the research found the row was no longer true, and a wrong row is worse than an absent one: - REC Silicon, electronic-grade polysilicon. Butte, Montana stopped polysilicon production in Feb 2024; Moses Lake shut down Dec 2024 and stayed closed through the Feb 2026 restart decision; the company now says it has "completely discontinued the production of polysilicon" — Butte makes only silane gas today. - 3M, two-phase dielectric immersion coolant. 3M announced in Dec 2022 it would exit all PFAS manufacturing by end of 2025, and did: Novec and Fluorinert stopped shipping (last order date 31 March 2025). Left as an inline, sourced note rather than forced into the EVENTS/PARTICIPANTS schemas, which are their own curated exercises this pass didn't attempt. LEFT ALONE ON PURPOSE (not promoted): Baosteel Gases (every source is a syndicated press-release aggregator repeating the same sentence — no primary trace); Nyrstar (Trafigura's own release says they are CONSIDERING a gallium project at Port Pirie, not running one — an aspiration is not a role). `sourced()` gained an optional `aliases` param, matching `lead()`, for the Chalco/Chinalco rename. Coverage: 63/94 (67%) sourced before this pass, 79/92 (86%) after. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C9tLC1kS4qNVdRxcHuPZ5c * feat(research): the producer-sourcing engine runs on a timer too, two ways The event sweep already outgrew being a CLI-only tool: it has a shared judgement module (`lib/sweep.ts`), a scheduled route (`POST /api/cron/sweep`), a Postgres review queue, and a `/review` page a human reads. Producer sourcing (`pnpm research:source`) was still stuck where the sweep started — a script a person has to remember to run. This closes that gap by extending the exact pattern that already proved itself, rather than inventing a second one, plus a fully independent second leg that needs no box access at all. WHAT MOVED - `lib/source.ts` — the query, the domain ranking and the excerpt-match judgement, extracted from `scripts/research/source-producers.ts` so the CLI and the timer cannot quietly stop agreeing about what counts as a candidate. `scripts/research/source-producers.ts` now imports it and keeps only what is genuinely its own: argument parsing, the evidence FILE, and the blindness-streak guard. SCHEDULED, BOX-DRIVEN (needs manual setup, documented in docs/INFRASTRUCTURE.md and docs/IMPLEMENTATION-PLAN.md): - `lib/source-store.ts` — `runScheduledSourcing()` examines a few least-recently-checked unsourced rows per call and files candidates into `research_source_candidates`, never into the coverage file: a running server has no working tree to commit a promotion into, same reasoning `lib/sweep-store.ts` already documents for events. - `scripts/db/004-source-sweep.sql` — the queue, mirroring `003-sweep.sql`'s shape. Apply via `scripts/provision-service.py`; the generic deploy workflow does not do this automatically. - `app/api/cron/source/route.ts` — `CRON_SECRET`-gated, same as `app/api/cron/sweep`. Needs registering in whatever schedule `/opt/_appcron/run.sh` already drives the sweep on. - `/review` gains a third feed: candidates from producer sourcing, decided the same way as event leads — accepting marks a candidate worth promoting, it does not write `sourced()` anywhere. That stays a person reading the excerpt and editing `config/substrata-coverage.ts`. SCHEDULED, GITHUB-ACTIONS-DRIVEN (works today once a secret is added, no box access needed): - `.github/workflows/research-sweep.yml` — runs `research:source` and `research:sweep` weekly against a Brave or Tavily key (`BRAVE_SEARCH_API_KEY` / `TAVILY_API_KEY` — ai-kit's `webSearch()` already falls through to these when SearXNG, loopback-only on bitbaum, isn't reachable) and opens a DRAFT PR with whatever lands in `research/evidence.json` / `research/events.json`. Skips cleanly with an `::notice::` until a secret exists. Draft on purpose: the fleet's auto-merge sweep leaves drafts alone, so nothing merges until a person has actually read the rows. Never touches `config/`. Tests: `test/source.test.ts` covers the pure judgement in `lib/source.ts` (normalise, nameStem, query building, own-domain detection, the window-match rule) the same way `test/sweep.test.ts` already covers `lib/sweep.ts`. `test/sweep.test.ts` gains one more assertion: the new cron route is gated the same way the old one is. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C9tLC1kS4qNVdRxcHuPZ5c * feat(participants): source 54 of 101 directory entries (equipment through deployment) Every row in `substrata-participants.ts` started `source: null` — unlike the producer coverage universe, this directory had no sourcing helper at all, so nothing in it could ever read as verified. Added `s()` alongside `p()`, mirroring `sourced()`/`lead()` in `substrata-coverage.ts`, and used it to cite every entry across five layers: equipment (12, e.g. ASML, Carl Zeiss SMT, Trumpf, Applied Materials — each checked against the company's own product page), fabrication (6: TSMC, Samsung Foundry, Intel Foundry, SMIC, GlobalFoundries, UMC), packaging (6: TSMC Advanced Packaging's CoWoS, ASE, Amkor, and the three HBM makers), systems (7: NVIDIA, AMD, Broadcom, Marvell, Vertiv, Arista, Supermicro), energy (8: transformer, turbine, HV cable and grid-equipment makers), actuation (7: the precision-drive duopoly, the robot makers, Renishaw), and deployment (8: the hyperscalers, the three frontier labs named in the directory, and CoreWeave). Every citation was checked against a live fetch or search of the source itself before being added — a company's own product/technology page where one exists and answers the claim, trade press or a filing where it does not (Sibanye-Stillwater's own SEC production-update filing for its ruthenium row, Data Center Frontier for xAI's Colossus). Names, layers and roles are what is claimed sourced; the scarcity grade stays a judgement, exactly as `s()`'s own comment says. 46 rows remain unverified: extraction, refining and conversion layers — left for a follow-up pass rather than rushed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C9tLC1kS4qNVdRxcHuPZ5c * feat(participants): source extraction and refining layers (27 more) Continues the pass started for equipment through deployment. 81 of 101 rows now carry a source. Extraction (12): The Quartz Corp and Sibelco's own Spruce Pine pages, Sibanye-Stillwater's SEC filing and Impala Platinum reused from the earlier producer-coverage pass, Nornickel, MP Materials' own Mountain Pass page, Lynas's own about page, and the three tin miners plus QatarEnergy/ExxonMobil reused from `substrata-coverage.ts` — same companies, same claims, no reason to re-derive a citation already found. Refining (15): the three merchant polysilicon refiners plus OCI, the PGM refiners (Heraeus, Johnson Matthey, Umicore), the gas majors, and `Chinalco` renamed to `Chalco` here too — same entity correction as the coverage file: Chalco (Aluminum Corporation of China Limited) is the listed subsidiary that actually runs the gallium-yielding alumina refineries. 20 rows remain: the conversion layer. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C9tLC1kS4qNVdRxcHuPZ5c * feat(participants): source the conversion layer — all 101 directory rows now sourced Completes the pass: every row in `substrata-participants.ts` now carries a primary source, up from zero at the start of it. Conversion (19): the prime-wafer makers, the fused-quartz specialists, the wide-bandgap and diamond materials firms, the REBCO tape makers, the two rare-earth magnet-alloy specialists (Neo Performance Materials, Less Common Metals — the only two genuinely new searches in this batch; the other 17 reused citations already found and checked in `substrata-coverage.ts` for the same companies), and the electrical-steel and solder makers. `p()`, the unverified-lead helper, is now unused — every row calls `s()`. Kept rather than deleted (the file's own header says a new participant starts as a lead), with an eslint-disable and a comment saying why, dated, so the next person to touch this file knows the state was checked, not missed. Coverage summary for this whole pass: 101/101 participants sourced, against 0/101 at the start. Two entity-name corrections carried over from the producer-coverage pass (Chinalco → Chalco, in both refining and extraction) for consistency across the two files. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C9tLC1kS4qNVdRxcHuPZ5c * refactor(byok): use Anthropic's own SDK instead of a hand-rolled client Decision on "should this use a package": yes, for exactly one of the two vendor calls in `lib/byok.ts`, and deliberately no for the other — the two are not the same situation. WHY THE OPENAI-COMPATIBLE PATH STAYS AS IS `completeOpenAiCompatible` (OpenAI and OpenRouter) already goes through `@bitbaum/ai-kit`'s `complete()`, which exists specifically to be the one client for every vendor that speaks the OpenAI chat-completions shape. Adding the `openai` npm package here would mean two clients for the same wire format in one file, and it's the fleet's own documented lesson (ai-kit's `complete.ts` header) that duplicated hand-rolled clients are the failure mode, not the fix. No change. WHY THE ANTHROPIC PATH DOES NOT Anthropic's Messages API isn't the shape ai-kit speaks, so this file hand-rolled a hand-rolled `fetch` call: manual AbortController/timeout racing, manual JSON error-body parsing, manual status-code-to-message mapping. That is precisely the "conventions differ because nothing ever offered to own them" pattern ai-kit's own header describes for the fleet at large — just scoped to one vendor instead of eight. Anthropic publishes the thing that owns it: `@anthropic-ai/sdk` gives typed errors (`AuthenticationError`, `NotFoundError`, `RateLimitError`, `APIConnectionTimeoutError`) that already distinguish exactly the failures this file was hand-classifying by status code, and a `timeout` + `signal` pair on the request options that race correctly against each other (verified by reading `client.js`: the external signal is wired into the same internal AbortController the timeout arms, not left to fight it). Swapping in the SDK deletes the hand-rolled error mapping in favour of five `instanceof` checks and removes the manual AbortController plumbing entirely. `maxRetries: 0`, deliberately: this is one link, not a chain the caller can fall through, so a failure should reach the reader immediately rather than being silently retried inside a budget the caller already timed. Verified against the real Anthropic API with a syntactically-valid but invalid key: the SDK's `AuthenticationError` maps to the same "Anthropic rejected that key." message the hand-rolled version produced, confirming the swap is behaviour-preserving where it matters — what the reader sees on the four error paths (bad key, unknown model, rate limit, timeout) is unchanged; only how this file gets there is simpler. Lockfile note for whoever next touches `pnpm-lock.yaml` by hand: this sandbox cannot fetch `bitbaum/listkit`'s git-hosted tarball (its own CI can), so the new `@anthropic-ai/sdk` entries here were generated against a temporary local git-protocol substitution for that one dependency, then merged back byte-for-byte against the committed `listkit` resolution — verified with `pnpm install --frozen-lockfile` reporting "Lockfile is up to date, resolution step is skipped" before failing on the same pre-existing, sandbox-only `listkit` fetch this repo already had. `git diff pnpm-lock.yaml` is pure addition; the three `listkit` lines are untouched. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C9tLC1kS4qNVdRxcHuPZ5c * fix(chat): retrieval quality — word-boundary scoring, IDF weighting, relevance floor The assistant answered a "biggest robotics bottleneck" question with a thin, wrong "ABB Robotics" citation, "not in your data" for the actual chokepoints, and a source list dominated by unrelated development banks and country directory rows. Root causes, all in the retrieval path rather than the model or prompt: - searchResearch()/chatContext() scored raw substring hits with a flat title/body bonus and no notion of how common a word is across the corpus, so boilerplate connector text ("Bottlenecks its mandate could fund relief for: …", repeated on every capital and country row) systematically outscored real, specific content. - Actuation-layer companies (Harmonic Drive Systems, Nabtesco, FANUC, Yaskawa, Renishaw, KUKA) derived their searchable topics only from a COVERAGE materials join they don't have, so they carried empty topics and were unreachable by any query — and the same join gap meant their already-sourced directory citation (person.source) was never surfaced, so their pages read "unverified" when a real source existed. - Bottleneck entities never used the word "bottleneck"/"chokepoint" in their own retrieval text, while capital/country boilerplate used it constantly. Fixes: word-boundary tokenization with document-frequency weighting in research-index.ts (rare words score more than ubiquitous ones); participants.ts now also derives technologies/industries and a directory source from a participant's own chain layer, not only the coverage join; boilerplate connector phrases reworded to drop the generic "bottleneck(s)" wording while keeping the specific cross-referenced names; a minimum relevance floor in chatContext so a single coincidental common-word match no longer fills the citation list; an expanded stopword list for generic superlatives/category nouns ("biggest", "companies") that discriminate nothing in this corpus. Added a regression test reproducing the reported query and pinning that the known noise (European Investment Bank, DOE Loan Programs Office, KfW) is excluded and an actual robotics/actuation record is retrieved. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C9tLC1kS4qNVdRxcHuPZ5c --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
ecca727058 | feat: build checkable research atlas and Substrata companion (#43) | ||
|
|
a51371cb38 |
fix(ci): stop re-arming publish.yml — this repo has no such workflow (#36)
`rearm_workflows` listed `publish.yml`, but this repo has no such workflow (only `ci.yml` and `deploy.yml`). After every sweep merge the sweep dispatched a workflow that does not exist and logged "could not dispatch publish.yml" — harmless, since the sweep does not fail on a dispatch error, but a wrong line in the one file that says how this repo ships. `deploy.yml` is already covered by `deploy_workflow` (the reconciler), so re-arming is only `ci.yml`. Behaviour otherwise unchanged. Verified with actionlint 1.7.12. Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8 Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
687abef748 |
feat(research): commission the substrate-of-recursion programme, research engine, JSON map and correction intake (#31)
* feat(research): commission the substrate-of-recursion programme, research engine, JSON map and correction intake A research programme file with layers, open questions and falsifiers, cross-referenced to the coverage universe by test. An engine that searches the fleet's SearXNG through ai-kit for a source behind each unverified producer row and files candidates, never findings, into a committed evidence file. /api/health and /api/map so agents consume the map as data. Prefilled public-issue links so a wrong row is one click to report. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2 * fix(research): search on the material's trade name, match name and material in one window Each listing now carries the term the trade uses, so the engine asks for "Yunnan Tin" tin rather than "Yunnan Tin" high-purity. A page is a candidate only where the company name and a material term share a window, and that window is the excerpt filed. Also replaces a stray NUL in the row key with a shared evidenceKey helper. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2 * chore(research): exempt the engine-written evidence file from prettier; summarise the all-materials layer Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2 * research: first engine run — 59 of 92 producer rows have a candidate source Every unverified row examined through the fleet's SearXNG. 59 rows carry at least one page naming the company alongside the material (131 pages filed with excerpts), 33 found nothing usable, 0 could not look. Nothing is promoted: every row still reads unverified or candidate until an analyst attaches the source. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2 --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
2f51d2e5cd |
chore: rename FleetCrown to Loki (#30)
The product was renamed on 2026-09-14: bitbaum/loki, loki.orangecat.ch, LOKI_* env keys, loki-* units. This repo referenced the old name in 6 files changed, 10 insertions(+), 10 deletions(-). Email addresses at the old sending domain stay until the new domain is verified in Resend. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
feab11f140 |
chore(deps): bump actions/cache from 4 to 6 (#28)
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 6. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v4...v6) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
48cfce2582 |
fix(ci): a commit must not cancel another commit's run (#27)
The concurrency group was keyed by branch with cancel-in-progress, so a newer merge cancels an older commit's CI — and every deploy path keys off that run. One that waits for CI to pass on the commit finds a cancelled run and stops. One chained on workflow_run sees conclusion=cancelled and skips. auto-merge also re-arms CI with a dispatch, and under one group-per-branch that dispatch cancels the push run for the SAME commit. Measured across the fleet on 2026-09-11: 28 of 39 ci.yml files had this shape. It broke two repos that day, in the two ways it can break. fleetcrown failed silently — Deploy skipped, four merges sat on main with every check green and nothing red while the box served the previous build, each needing a hand-dispatched deploy. hirnli failed loudly, erroring at its wait-for-CI step, which is the better outcome because somebody sees it. Keying main per commit lets both runs finish, so whatever the deploy path looks for is there. Branch behaviour is unchanged: the newest push is still the only one that matters there. The templates this was copied from are fixed in bitbaum/fleet#53, which also adds a ci-strands-commits rule to the hygiene audit so the remaining repos are found by a sweep rather than by an outage. Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
419251f8fb |
ci(auto-merge): correct the reason this repo passes a PAT (#26)
The comment added a few hours ago says GITHUB_TOKEN cannot merge a PR that touches .github/workflows. That is contradicted by this fleet's own history: github-actions[bot] merged datacat#253 and ai-kit#42 today, and both change a workflow file. I asserted it from the reusable workflow's docstring without checking, then found the counter-evidence while looking for something else. Two stalled PRs were offered as proof and neither survives either. ai-kit#11 opened 2026-08-29 and this repo's sweep was not added until 2026-09-04, so for most of that PR's life nothing was sweeping at all. aoz-housing#122 is still unexplained — I merged it before diagnosing it, which destroyed the evidence. The THROUGHPUT reason is unaffected and is why the line stays. A dispatch made with GITHUB_TOKEN triggers no workflows — the same rule the deploy reconciler exists for — so after a merge the re-armed CI run's completion fires no workflow_run and nothing wakes the sweep for the next PR. It waits for the cron, which GitHub throttles: fleetcrown's sweeps land 50-65 minutes apart against a */10 schedule. A PAT-created dispatch does emit workflow_run. The wrong claim is recorded in the file rather than quietly deleted, so the next reader does not re-derive it from the same docstring I did. No behaviour change: an undefined secret still resolves to empty and the reusable workflow still falls back to github.token. Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
51af85ccac |
ci(auto-merge): hand the sweep a PAT so workflow PRs stop stalling (#25)
GITHUB_TOKEN cannot merge a PR that touches .github/workflows. The sweep tries, the merge API refuses, it logs "leaving for the next sweep", and repeats — while still exiting 0. So the failure is invisible: every run reports success and the PR simply never merges. That is not hypothetical. ai-kit #11 (bump actions/checkout) sat green, CLEAN and MERGEABLE for nine days; aoz-housing #122 (bump actions/upload-artifact) for nine more. Both had to be merged by hand today. Every Dependabot `github_actions` bump in the fleet is in this class, permanently. A PAT fixes a second thing that costs more: THROUGHPUT. A dispatch made with GITHUB_TOKEN emits no workflow_run, so after each merge nothing wakes the sweep to take the next PR — it waits for the cron, and GitHub throttles scheduled workflows to roughly hourly regardless of what the cron says. Observed in fleetcrown: sweeps ~50-65 minutes apart against a */10 schedule. A PAT-created dispatch does emit workflow_run, so the queue drains at CI speed instead. The reusable workflow has always supported this — GH_TOKEN is `secrets.token || github.token`. This just passes it. SAFE BEFORE THE SECRET EXISTS: an undefined secret resolves to empty, and the fallback picks github.token. So this changes nothing until FLEET_PAT is created as an organisation secret, and needs no second pass afterwards. Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
e98364c644 |
ci: cache Next's build output so CI stops recompiling from scratch (#24)
Next keeps its compiler output in .next/cache and nothing restored it here, so every CI run recompiled the whole app — and the deploy then compiled it again. Measured across the fleet on 2026-09-07: of eight repos, exactly one cached this in CI. 14 repos built cold; ten adopted the step today, and this is one of the four that a mechanical sweep correctly declined — the install step here is a bare `- run: pnpm install --frozen-lockfile` with no name, so the anchor missed it. Read, then patched, rather than widened until it matched something. Keyed on the lockfile so a dependency change invalidates it. The bare restore-key is last on purpose: a stale cache still beats no cache, and Next validates its own entries rather than trusting them. Claude-Session: https://claude.ai/code/session_01G2LBioUzJP4oBL9LeH9qAe Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
4d13ff93a1 |
ci: auto-merge sweep reconciles deployment — sweep merges were stranding commits (#22)
A sweep merge is a GITHUB_TOKEN push, which fires no push workflows: main went green and nothing deployed (proven today — the consumer-swap merges needed hand-dispatched deploys). deploy_workflow tells the canonical sweep to compare main tip vs the last successful deploy run and dispatch deploy.yml when they differ, same as solon/orangecat already do. Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
910f52bbcc |
chore(deps): sitekit from git tag to npm release @bitbaum/sitekit@^0.3.0 (#21)
Same alias pattern as camille: sitekit -> npm:@bitbaum/sitekit@^0.3.0, zero source edits. Drops the codeload allowBuilds entry and exempts the fresh package from the minimum-release-age window. Also formats .github/workflows/auto-merge.yml (quote style) — it predated format:check locally and CI never runs prettier, so the repo's verify gate was red on a pristine checkout. Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
fe40b62bab |
chore(ci): adopt the fleet auto-merge sweep — green PRs merge themselves (#20)
This repo had no auto-merge workflow; green PRs waited for a human. Thin caller of bitbaum/fleet auto-merge-sweep.yml, same as the libs. Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
26813a8b05 |
chore: pnpm — the fleet has one package manager (#17)
* chore: pnpm — the fleet has one package manager Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn * fix(lint): declare espree — pnpm does not hoist phantom deps --------- Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
2c086ecb42 |
chore(deps): currency sweep — eslint 10, @types/node 26, CI actions v7 (#13)
- eslint ^9 -> ^10, eslint-config-next 16.2.4 -> ^16.3.1 (peer for eslint 10) - @types/node ^26; assert.equal's message overload tightened, so the schema test's conditional message becomes an explicit assert.fail branch - eslint.config.mjs gains the fleet's two proven ESLint-10 workarounds (pin settings.react.version; espree for plain .js/.mjs) — same as evig - CI: actions/checkout and setup-node v4 -> v7; node-version untouched Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
2258af9a3a |
chore: add a formatter (#11)
* chore: add a formatter, matching the style this repo already writes singleQuote=true was chosen by counting this repo's own imports, not by fleet decree. The fleet is genuinely split and the two repos that already had a .prettierrc disagreed with each other, so there was no standard to restore. Quote style does not cross repo boundaries; having a gate does. Markdown is ignored for now — prettier rewraps prose, which would bury the real diff. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * style: format with prettier (9 files) Mechanical. No behaviour change. This SHA is listed in .git-blame-ignore-revs so `git blame` skips it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * chore: teach git blame to skip the reformat Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
734d5d2b3f |
chore: add a dependency watcher (#2)
23 of 30 repos in the fleet had none. The symptom looks like neglect and is not: aoz-housing had 100 commits in August, features landing daily, and was still on Next 14 / React 18 / Tailwind 3 — because nothing ever OPENED the upgrade PR. Version drift here is the absence of a mechanism. npm directory: /. Minor and patch grouped so the sweep spends one cycle on them; majors stay separate because they deserve reading. Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
26ef06ea9e |
refactor: adopt sitekit as the site model and renderer (#1)
* chore(ci): GitHub owner catomean -> bitbaum * refactor: adopt sitekit — the site model and renderers now come from the shared package Substrata becomes sitekit's reference consumer, per orangecat ADR-0003. - config/site-content.ts re-exports the types and helpers from sitekit and keeps only the wiring that says which pages this site has; the local copy of the section union and all of components/ are deleted (-577 lines of renderer that now improve every generated site when fixed once). - The chrome takes next/link through sitekit's Link seam, and the canonical host moves into the chrome spec. - globals.css gains @source for the package dist so Tailwind emits the semantic classes the renderers use. Tokens stay 100% local — that is the contract: uniform system, divergent aesthetics. - verify's test gate is real for the first time: 'jest --passWithNoTests' referenced a jest that was never installed, so the gate was a no-op on every fresh install. Replaced with tsx --test and an actual test that validates the ENTIRE site content against the sitekit schema — a schema change that would break this site now fails in CI here. Verified: type-check, lint, 3/3 tests, full production build (10 static pages), semantic classes present in emitted CSS. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZCNYHwjEeqxNpYCUk6Yna --------- Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
51c2a943cb |
ci: pin Node via .nvmrc so CI and deploy cannot disagree
The deploy warned: no .nvmrc, building on Node 20 — if CI uses a different major, commit one both can read. Two pipelines guessing independently is a difference that shows up as 'works in CI, breaks on the box'. One file, both read it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
ac4130cc97 |
ci: give this site the CI it has been deploying without
fleetcrown's ci-gate.sh treats 'CI green' and 'no CI at all' identically — both exit 0 and let the deploy through. Sane default for a repo that has not set CI up, and it meant this site shipped to production on every push completely unverified while looking exactly like one that had passed. Adds the same bundle npm run verify runs locally: type-check, lint, build. One definition of verified. Also adds eslint.config.mjs. ESLint 9 without a flat config exits non-zero with a migration notice, so the first CI run would have been red for reasons having nothing to do with the code — and a red first run is how a team learns to ignore CI. Config matches the fleet's other Next 16 apps rather than being invented here. Verified locally: 0 lint problems, 0 type errors, build green. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
0a05de0a8b | chore(ci): GitHub owner maonakamoto -> catomean | ||
|
|
ee83c6dfb7 |
feat: Substrata, as its own firm
Substrata was built inside OrangeCat as a group profile rendered by OrangeCat's application. That was the wrong shape: a site living in another product's codebase can never be handed to anyone, and it inherited that product's header, analytics and Organization schema — the live page told crawlers it was a different company. Every other site in this studio is its own repository from birth. This is that, for Substrata: its own app, its own deployment, its own design system. The design is deliberately nothing like OrangeCat's. It previously rendered in OrangeCat's palette, OrangeCat's orange and OrangeCat's Space Grotesk, which made a research firm look like a skin of a Bitcoin platform. It now sets its headlines in a serif, because that is what research houses do, and takes a mineral accent rather than an orange one. No webfont fetch, no analytics, no third-party script, no widget — everything that renders here is Substrata's. The research came across unchanged: 15 chokepoint materials, 92 producer rows, 102 organisations across 10 chain layers, 14 non-material chokepoints, and 6 claims each carrying a falsifier. It was always standalone config; only the wrapper was wrong. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |