About This Wiki
The Longterm Wiki is a strategic intelligence platform for AI safety prioritization. It serves as a decision-support tool for funders, researchers, and policymakers asking: "Where should the next marginal dollar or researcher-hour go?"
This page documents the technical side—how the wiki is built, how content is organized, and how to contribute.
For strategic vision and goals, see:
- Vision Document — Full 2-person-year scope, architecture, milestones
- Similar Projects Analysis — Lessons from Arbital, Stampy, MIT Risk Repository, and others
Content Architecture
Major Sections
| Section | Purpose | Examples |
|---|---|---|
| Knowledge Base | Core content on risks, interventions, organizations, people | Deceptive Alignment, AI Safety Institutes |
| Models | Analytical frameworks for understanding dynamics | Risk models, cascade models, governance models |
| Project | Public-facing documentation about LongtermWiki itself | Vision, strategy, similar projects |
| Internal | Contributor documentation, style guides, technical reference | This page, style guides, automation tools |
Content Volume
The wiki contains approximately:
- ~700 MDX pages across all sections
- Hundreds of structured data entities (organizations, people, AI models, legislation, grants, projects)
- Analytical model pages with causal diagrams
Page Types and Templates
The wiki uses a two-level classification system.
Page Types (Validation Behavior)
| Type | Quality Scored? | Use Case |
|---|---|---|
content | Yes | All substantive knowledge base pages (default) |
stub | No | Redirects, brief profiles, placeholders |
documentation | No | Style guides, internal docs (like this page) |
overview | No (auto) | Index pages for navigation |
Page Templates (Structure)
Templates determine expected structure and applicable style guide:
| Template | Style Guide |
|---|---|
knowledge-base-risk | Knowledge Base Style Guide |
knowledge-base-response | Knowledge Base Style Guide |
knowledge-base-model | Model Style Guide |
For complete details, see Page Type System.
Quality System
Rating Dimensions
Content pages are scored on six dimensions (0-10 scale, harsh—7+ is exceptional):
| Dimension | What It Measures |
|---|---|
| Focus | Does it answer the title's promise? |
| Novelty | Value beyond obvious sources |
| Rigor | Evidence quality and precision |
| Completeness | Thorough coverage of claimed topic |
| Concreteness | Specific vs. abstract recommendations |
| Actionability | Can readers make different decisions? |
These combine into an overall quality score (0-100).
Quality Pipeline
Quality must only be set through the grading pipeline, never manually:
# Improve a specific page (includes grading)
pnpm crux w improve <page-id> --tier=standard --apply
For grading criteria and workflows, see Content Quality.
Data Layer
Three Bases
The wiki is organized around three complementary data layers:
| Base | What it stores | Where it lives |
|---|---|---|
| TableBase | Typed relational records (entities, grants, publications, etc.) | data/entities/*.yaml and PG-primary tables |
| FactBase | Structured triples with temporal data and provenance | packages/factbase/data/fb-entities/*.yaml |
| WikiBase | Long-form prose MDX articles | content/docs/**/*.mdx |
YAML and MDX are the source of truth; Postgres (via the wiki-server) keeps read mirrors for querying.
Structured Data Sources
Legacy YAML catalogs live under data/:
| File or directory | Contents |
|---|---|
data/entities/*.yaml | Lightweight entity catalog (orgs, people, concepts, projects) |
data/experts.yaml | AI safety researchers and their positions on cruxes |
data/organizations.yaml | Labs, research orgs, funders |
data/estimates.yaml | Probability distributions for key variables |
data/publications.yaml | Research papers and reports |
data/external-links.yaml | Curated resource database |
Generated Data
Running pnpm build-data:content (or pnpm build, which runs it first) compiles YAML + MDX into:
| Output | Purpose |
|---|---|
database.json | All entities + page metadata merged for build-time use |
factbase-data.json | Compiled FactBase triples with provenance |
The Next.js app reads these JSON artifacts directly at build time—content pages make zero runtime API calls.
Data-Aware Components
React components pull from the generated JSON to display structured information. For example, EntityLink provides stable cross-references, <FBF> and <Calc> render FactBase facts, and DataInfoBox displays entity profiles.
For database details and component usage, see Content Database.
Cross-Linking System
Entity Links
The wiki uses stable ID-based linking that survives path reorganization:
The <EntityLink id="E274" name="scheming">scheming</EntityLink> risk relates to
<EntityLink id="E93" name="deceptive-alignment">deceptive alignment</EntityLink>.
Benefits:
- Automatic title lookup from database
- Entity type icons
- Backlink tracking
- Link validity checked by the gate
Post-Edit Linking Check
After creating or editing a page, verify cross-linking with the validation gate:
pnpm crux w validate gate --scope=content --fix
This runs link integrity, EntityLink resolution, and related checks in ~15 seconds.
Visualizations
Mermaid Diagrams
Flowcharts, sequences, and graphs for static illustrations:
Diagram (loading…)
flowchart LR
A[Training] --> B[Alignment Techniques]
B --> C{Robust?}
C -->|Yes| D[Safe AI]
C -->|No| E[Misalignment Risk]See Mermaid Diagrams for guidelines.
Cause-Effect Graphs
Interactive causal diagrams using ReactFlow for complex causal models:
<CauseEffectGraph
initialNodes={graphNodes}
initialEdges={graphEdges}
selectedNodeId="current-factor"
/>
Features: zoom, pan, minimap, node highlighting, path tracing, entity linking.
See Cause-Effect Diagrams for schema and examples.
Automation Tools
Unified CLI
All tools are accessible via the crux CLI, organized into groups by data layer:
pnpm crux --help # Full CLI reference
pnpm crux w --help # Wiki (content) commands
pnpm crux fb --help # FactBase commands
pnpm crux tb --help # TableBase commands
pnpm crux linear --help # Linear issue tracker
pnpm crux gh --help # GitHub (PRs, CI, deploy tasks)
pnpm crux sys --help # System / agent tools
Common Workflows
| Task | Command |
|---|---|
| Create a new page | pnpm crux w create "Title" --tier=standard |
| Improve an existing page | pnpm crux w improve <id> --tier=standard --apply |
| Pre-push validation gate | pnpm crux w validate gate --fix |
| Fast content-only gate | pnpm crux w validate gate --scope=content --fix |
| Fix escaping issues | pnpm crux w fix escaping |
| Fix markdown issues | pnpm crux w fix markdown |
| Full-text search | pnpm crux query search "topic" |
| Rebuild content JSON | pnpm build-data:content |
Validation Rules
The gate check runs 50+ validators in parallel. CI-blocking rules include:
| Validator | What It Checks |
|---|---|
mdx-compile | MDX syntax and compilation |
frontmatter-schema | YAML frontmatter validity |
dollar-signs | LaTeX escaping (\$100 not $100) |
comparison-operators | JSX escaping (\<100ms not <100ms) |
entity-links | All EntityLink references resolve |
wiki-id-integrity | Page wikiIds are unique and well-formed |
factbase-entity-ids | FactBase ↔ TableBase entity ID consistency |
kb-entity-slugs | FactBase refs have matching entity registry entries |
For complete tool reference, see Automation Tools.
Technical Stack
Core Technologies
| Layer | Technology |
|---|---|
| Framework | Next.js 15 with App Router |
| Components | React 19 + next-mdx-remote |
| Styling | Tailwind CSS v4 + shadcn/ui |
| Type Safety | TypeScript + Zod schemas |
| Graphs | ReactFlow (XYFlow) + Dagre layout |
| Diagrams | Mermaid 11 |
| Math | KaTeX |
| Search | PostgreSQL full-text search (wiki-server) |
| CLI | Crux (custom multi-domain CLI) |
| Data | YAML sources + FactBase → JSON build artifacts |
| Package manager | pnpm workspaces |
Project Structure
longterm-wiki/
├── apps/
│ ├── web/ # Next.js 15 frontend (longterm-next)
│ │ ├── src/
│ │ │ ├── app/ # App Router pages and API routes
│ │ │ ├── components/ # React components (wiki/, ui/, ...)
│ │ │ ├── data/ # Data-layer modules (tablebase, factbase)
│ │ │ └── lib/ # Shared utilities
│ │ └── scripts/
│ │ ├── build-data.mjs # Data compilation pipeline
│ │ └── assign-ids.mjs # Wiki ID allocation
│ ├── wiki-server/ # Hono API server (Postgres, Drizzle ORM)
│ ├── discord-bot/ # Discord integration
│ └── groundskeeper/ # Background maintenance jobs
├── packages/
│ ├── factbase/ # FactBase types, YAML loading, serialization
│ │ └── data/fb-entities/ # FactBase entity YAML (authoritative)
│ └── id-utils/ # Stable ID helpers (sid_ prefix)
├── content/
│ └── docs/ # ~700 MDX pages
│ ├── knowledge-base/ # Risks, responses, organizations, people
│ ├── project/ # Public project documentation
│ └── internal/ # Contributor docs and style guides
├── data/
│ ├── entities/ # Lightweight entity YAML catalog
│ ├── *.yaml # Legacy YAML data sources
│ └── schema.ts # Shared data schema
└── crux/ # Crux CLI + 50+ validators
├── commands/ # CLI command handlers (w, fb, tb, linear, ...)
├── validate/ # Validators (gate, data, daily)
└── crux.mjs # CLI entry point
Key Configuration Files
| File | Purpose |
|---|---|
package.json | Workspace root: dependencies, scripts |
pnpm-workspace.yaml | Workspace package list |
apps/web/next.config.ts | Next.js configuration |
apps/wiki-server/drizzle.config.ts | Drizzle ORM schema config |
crux/lib/rules/frontmatter-schema.ts | MDX frontmatter Zod schema |
data/schema.ts | Legacy YAML entity schema (Zod) |
Development Workflow
Getting Started
# Install dependencies (pnpm is required)
pnpm install
# First-time setup: install + build data
pnpm setup:quick
# Start development server on port 3001
pnpm dev
# Build for production
pnpm build
After Editing Content
# After editing any page, clean up formatting
pnpm crux w fix escaping
pnpm crux w fix markdown
# Run the pre-push gate (CI-blocking checks)
pnpm crux w validate gate --fix
# For content-only edits, use the faster content scope (~15s)
pnpm crux w validate gate --scope=content --fix
Creating New Content
- New pages: use the Crux content pipeline —
pnpm crux w create "Title" --tier=standard— rather than writing MDX by hand. It handles frontmatter, IDs, citations, and EntityLink validation. - New entities: add a YAML file to
data/entities/(lightweight) or allocate a wiki entity ID withpnpm crux tb ids allocate <slug>for entities that deserve their own page. - New components: add to
apps/web/src/components/wiki/and reference via the@components/wikipath alias.
For content generation workflows, see Research Reports.
Related Documentation
Project & Strategy
- Vision Document — 2-person-year scope, architecture, milestones
- Similar Projects — Lessons from Arbital, Stampy, MIT Risk Repository
- Strategy Brainstorm — Failure modes and strategic options
Style Guides
- Knowledge Base Style Guide — For risk and response pages
- Model Style Guide — For analytical model pages
- Stub Style Guide — For minimal reference pages
Technical Documentation
- System Architecture — Data flow, pipelines, design decisions
- Page Type System — Complete classification reference
- Rating System — Quality scoring system
- Content Database — Storage architecture (PostgreSQL, caching, YAML)
- Automation Tools — All scripts and workflows
- Cause-Effect Diagrams — Graph schema and examples
- Mermaid Diagrams — Diagram guidelines
- Documentation Maintenance — Keeping docs updated