5.2 KiB
Substrata
Open-source research on the physical chokepoints behind faster technological
progress. Live at https://substrata.orangecat.ch (beta). README.md has the
product and the shape of the corpus; this file is for agents working in the repo.
Run it
Node >= 20 and pnpm (packageManager in package.json). pnpm install, then
pnpm run dev for the Next.js dev server, or pnpm run build and
pnpm run start. Database-backed routes need DATABASE_URL; the pure corpus
pages and the tests do not.
Verify
pnpm run verify is the whole gate: format check, type-check, lint,
file-input check and pnpm run test (node --test over test/*.test.ts).
Run a single file with node --import tsx --test test/<name>.test.ts.
Data-quality criteria and their ratchet: config/substrata-quality.ts,
lib/quality/, test/quality.test.ts; the live view is /data/quality.
Repo layout
config/the research corpus and site as data (the source of truth).research/committed research files (series, listings, USGS tables, relations).lib/joins, stores and engines;lib/entitiesidentity,lib/graphthe sourced relation graph,lib/relationsdirectory joins,lib/qualitychecks.app/Next.js routes, includingapp/api/cron/*(called by box timers).components/UI;test/the suite;scripts/research, quality and DB tools (scripts/db/*.sqlmigrations);deploy/systemd/timer units;docs/design and operations notes.
Deploys
Open a non-draft pull request. The fleet forge check (forge/verify) verifies
it on its merge result and merges it. The push to main triggers
.github/workflows/deploy.yml: apply pending DB scripts and timer units, then
the shared self-host pipeline in bitbaum/loki builds, swaps and health-checks
on the box (see README.md, "Deployment"; docs/operations/data-layer.md).
Do not merge by hand.
Org rules
Read bitbaum/fleet AGENTS.md, SHARED.md and the registers it names before
inventing a host, a name, a page or a shared behaviour. Do not copy their facts
into this file.
- Packages first. If a
@bitbaum/*package (orbip-kit,limitkit,threadkit,ai-forms) already does it, use it and fix a defect in the package, not in this app. Every chat is@bitbaum/chatkit, every search box@bitbaum/searchkit, every chart@bitbaum/chartkit, accounts@bitbaum/accountkit, model calls@bitbaum/ai-kit. Review this product'spackage-plan.jsonbefore building anything. When a second product needs what one product built (a map, a globe, a calculator), extract it into a package before writing the second copy. - The experience belongs to the package. Anywhere a person types words
there is a microphone (
@bitbaum/chatkit:Composer,DictationField); articles are@bitbaum/writingkit/react, comments are chatkit'sCommentThread, header, menu, tab bar and footer are@bitbaum/sitekit. Apps own brand, words and backend, not the behaviour or the layout. If a component cannot do what the product needs, extend the package in the same session (fleetAGENTS.md, "The experience belongs to the package"). - A gap is a task, not an answer. Never end the work, or a reply, at "not supported" or "not available". When a source cannot be read or a case does not fit the model, find another way (another format or publisher, the official tool measured, the model extended) and do it. What truly cannot be done yet is tracked with its plan, never presented as a limit of the product.
- Every page leads to an action. What a reader learns, they can act on from the same screen: file, pay, apply, compare, ask, contact.
- One shape per kind. Things of the same kind look the same and sit in the
same place (fleet
AGENTS.md, "One shape per kind"). - Finished work ships by itself. Open a non-draft pull request; the fleet
forge merge check (
forge/verify) is the only merge path. Never merge by hand, through the merge API, with--autoor with an admin bypass, and never force-push a shared branch. - Nothing made up. A fact on a page or in a doc needs a source that was opened; where there is none, the line is removed or softened. A gap is filled with sourced data, never with a guess.
- Bitcoin orange is for Bitcoin and top-of-funnel actions only.
- No model identifier in anything pushed to a repository.
- Before you finish, run
node <fleet>/scripts/ci/docs-truth-audit.mjs --dir .: the same check the sweep runs on every pull request.
This is NOT the Next.js you know
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in node_modules/next/dist/docs/ (resolved from this file's directory; in monorepos the next package may not be visible from the repo root) before writing any code. Heed deprecation notices.
This block is written and re-added by next dev — verify at node_modules/next/dist/server/lib/generate-agent-files.js. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.