Skip to content
Longterm Wiki
Updated 2026-04-08HistoryData
Page StatusDocumentation
Edited 4 days ago631 words
Content1/13
SummaryScheduleEntityEdit historyOverview
Tables1/ ~3Diagrams0Int. links1/ ~5Ext. links0/ ~3Footnotes5/ ~2References0/ ~2Quotes0Accuracy0

CLI Reference

This page is auto-generated from the --help output of every crux CLI command. Run pnpm crux sys docs reference to regenerate.

Command Groups

GroupShortcutDescription
wikiwWiki content — MDX pages, validation, fixes, citations
factbasefbFactBase — structured facts with temporal data & provenance
tablebasetbTableBase — PG entities, people, orgs, grants, imports
ghghGitHub — issues, PRs, CI, epics, releases
systemsysSystem — agents, jobs, sessions, health, audits
queryQuery wiki-server DB (search, entity, facts, related, risk, stats)
contextAssemble research bundles (for-page, for-issue, for-entity, for-topic)

wiki (w)

Wiki content — MDX pages, validation, fixes, citations

content

Content Domain - Page management

Commands:
  improve        Improve an existing page with AI assistance
  iterate        Iteratively improve a page until quality stabilizes
  create         Create a new page with research pipeline
  regrade        Re-grade content quality ratings
  grade          Grade pages by template compliance
  grade-content  Grade content quality with AI (3-step pipeline)
  polish         Post-improvement cleanup and polish
  review         Adversarial review — find gaps in a page (~$0.50/page)
  suggest-links  Suggest relatedEntries cross-links for entities
  strip-scores   Strip scoring fields from MDX frontmatter (assessment migration)

Options:
  --tier=<t>        Quality tier: budget/standard/premium (create), polish/standard/deep (improve)
  --engine=v2       Use agent orchestrator instead of fixed pipeline (improve, create)
  --directions=<d>  Specific improvement directions (improve)
  --output=<path>   Output file path (create)
  --batch=<n>       Batch size (regrade, grade-content)
  --model=<m>       Model to use (grade-content)
  --skip-warnings   Skip Steps 1-2, just rate (grade-content)
  --warnings-only   Run Steps 1-2 only, skip rating (grade-content)
  --unscored        Only process pages without a quality score (grade-content)
  --api-direct      Use Anthropic API directly instead of Claude CLI (create)
  --type=<t>        Page type: internal-reference (create, V1 only) / entity type filter (suggest-links)
  --grep=<pattern>  Codebase grep pattern, repeatable (create --type=internal-reference, V1 only)
  --files=<glob>    File glob to include, repeatable (create --type=internal-reference, V1 only)
  --entity=<id>     Analyze specific entity (suggest-links)
  --min-score=<n>   Minimum suggestion score, default 2 (suggest-links)
  --dry-run         Preview without changes
  --apply           Apply changes (suggest-links, improve)
  --skip-session-log  Skip auto-posting session log to wiki-server after improve --apply
  --skip-citation-gate  Allow --apply even if citation audit fails (default: gate ON) (improve)
  --skip-citation-audit  Skip citation audit phase (improve)
  --citation-audit-model Override LLM model for citation checking (improve)
  --batch=id1,id2     Batch mode: comma-separated page IDs (improve, requires --engine=v2)
  --batch-file=f.txt  Batch mode: file with page IDs (improve, requires --engine=v2)
  --batch-budget=N    Stop batch when cumulative cost exceeds $N (improve)
  --page-timeout=N    Per-page timeout in seconds, default 900 (improve batch)
  --resume            Resume interrupted batch from batch-state.json (improve)
  --report-file=f.md  Write batch summary report to file (improve)
  --no-save-artifacts Skip saving intermediate artifacts to wiki-server DB (improve)
  --gap-analysis      Run claims gap analysis: inject missing verified facts as structured directions (improve)
  --dry-run           Preview batch without API calls: shows tier, cost estimates, skip reasons
  --output=plan.json  Write dry-run plan to JSON file (use with --dry-run)
  --limit=N           Max pages to preview in dry-run without --batch (default: 20)
  --openrouter        Route Claude calls through OpenRouter (improve; when Anthropic credits depleted)
  --verbose         Detailed output

Examples:
  crux w content improve far-ai --tier deep --directions "add recent papers"
  crux w content improve anthropic --engine=v2 --tier standard --apply
  crux w content create "SecureBio" --tier standard
  crux w content create "Page Creator" --type=internal-reference --grep="runPipeline" --files="crux/authoring/creator/*.ts"
  crux w content review anthropic                     # review single page
  crux w content review --batch --limit=20            # review lowest-quality pages
  crux w content regrade --batch 10
  crux w content grade
  crux w content grade-content --page my-page --warnings-only
  crux w content grade-content --page my-page --apply
  crux w content polish
  crux w content suggest-links --type=organization
  crux w content suggest-links --type=organization --min-score=3 --apply
  crux w content improve --batch=anthropic,miri,far-ai --engine=v2 --tier=standard --apply
  crux w content improve --batch-file=pages.txt --engine=v2 --batch-budget=500 --apply
  crux w content improve --engine=v2 --dry-run --limit=10            # preview 10 pages (no API calls)
  crux w content improve --batch=anthropic,miri --engine=v2 --dry-run  # preview specific pages
  crux w content improve --engine=v2 --dry-run --output=batch-plan.json  # save plan to file
  crux w content iterate anthropic --apply                              # iterate until quality stabilizes
  crux w content iterate anthropic --max-rounds=5 --tier=deep --apply   # deep iteration, up to 5 rounds
  crux w content iterate --pages=anthropic,miri,far-ai --apply          # iterate multiple pages

fix

Fix Domain - Auto-fix operations

Commands:
  all            Run all auto-fixers
  entity-links   Convert markdown links to EntityLink
  cross-links    Add EntityLinks to plain text entity mentions
  broken-links   Fix broken internal links
  markdown       Fix markdown formatting (lists, bold labels)
  escaping       Fix escaping issues (dollars, comparisons, tildes)
  dollars        Escape dollar signs for LaTeX
  comparisons    Escape comparison operators
  frontmatter    Fix frontmatter issues (unquoted dates)
  imports        Add missing component imports to MDX files
  orphaned-footnotes Remove orphaned footnote definitions (no matching reference)
  related-pages  Remove redundant manual Related Pages / See Also sections
  frontmatter-order Reorder frontmatter fields to canonical order (identity first, volatile last)

Options:
  --dry-run       Preview changes without applying
  --ci            JSON output for CI pipelines

Examples:
  crux w fix                          Run all auto-fixers
  crux w fix --dry-run                Preview all fixes
  crux w fix entity-links             Convert markdown links to EntityLink
  crux w fix escaping                 Fix all escaping issues
  crux w fix markdown                 Fix markdown formatting
  crux w fix related-pages            Remove redundant Related Pages sections
  crux w fix orphaned-footnotes       Remove orphaned footnote definitions
  crux w fix frontmatter-order        Reorder frontmatter fields to canonical order
  crux w fix dollars                  Escape dollar signs only

validate

Validate Domain - Run validation checks

Commands:
  daily          Run daily validation suite (local + server checks with unified report)
  unified        Run unified rule engine
  compile        Check MDX compilation (smoke-test for rendering errors)
  links          Check internal link resolution
  entity-links   Check EntityLink usage and conversion candidates
  consistency    Cross-page consistency checks
  data           Entity data integrity
  refs           EntityLink and DataInfoBox references
  quality        Content quality ratings (advisory)
  schema         YAML schema validation
  financials     Financial data staleness and consistency
  numeric-consistency Cross-page numeric claim consistency checker — flag contradictory facts about the same entity
  drizzle-journal Verify all migration SQL files are registered in Drizzle journal
  gate           CI-blocking checks (pre-push gate)
  hallucination-risk Hallucination risk assessment report
  entity-refs    Check entity reference integrity across KB records
  yaml-entity-refs Check YAML entity cross-references (relatedEntries, developer, affiliation)
  directory-pages Audit directory page data for display issues
  cross-entity   Cross-entity consistency (bidirectional refs, affiliation coherence)
  cross-check    Cross-check people roles between YAML entities and FactBase (advisory)
  temporal       Temporal invariant validation (date validity, ordering, consistency)
  cross-base     Cross-base consistency (WikiBase pages match TableBase entities, FactBase coverage)
  orphan-entities Detect PG entity records without YAML source (ghost entities)
  soft-fks       Check that soft FK fields in PG tables resolve to entities (advisory, requires wiki-server)
  pg-temporal    PG temporal consistency (startDate < endDate, date range validation)
  controlled-vocab Validate controlled vocabulary fields (entityType, relationship, orgType, etc.)
  numeric-ranges Validate low <= high for paired range columns (requires wiki-server)
  resource-refs  Validate resource authorEntityIds and publicationId references (advisory)
  display-names  Detect raw machine IDs in entity display fields (titles)
  display-formatting Detect serialization bugs and unescaped MDX in entity data
  dot-position   Check that SourcingDot / RecordStatusDots are never the first column
  to-rdjsonl     Convert unified --ci JSON to Reviewdog rdjsonl (reads stdin)

Options:
  --ci            JSON output for CI pipelines
  --fix           Auto-fix issues (where supported)
  --rules=a,b     Run specific rules (unified only)
  --quick         Fast mode (compile only)
  --list          List available rules (unified only)
  --scope=content Content-only gate: skip build-data/tests/typechecks (gate only)

Examples:
  crux w validate                           Run CI-blocking gate checks
  crux w validate gate                      Run CI-blocking checks (with triage)
  crux w validate gate --full               Include full Next.js build
  crux w validate gate --no-triage          Skip LLM triage, run all checks
  crux w validate gate --no-cache           Force re-run even if stamp matches HEAD
  crux w validate gate --full-gate          Force all checks (implies --no-triage, --no-cache)
  crux w validate gate --scope=content      Content-only checks (~15s vs ~5min)
  crux w validate compile --quick           Quick compile check
  crux w validate unified --rules=dollar-signs,markdown-lists
  crux w validate unified --fix             Auto-fix unified rule issues
  crux w validate entity-links --fix        Convert markdown links to EntityLink
  crux w validate entity-refs              Check KB record entity references
  crux w validate entity-refs --threshold=90  Fail if link rate < 90%
  crux w validate daily                      Daily validation suite (local + server)
  crux w validate daily --local-only         Skip server-dependent checks
  crux w validate directory-pages            Audit directory page data quality
  crux w validate directory-pages --type=person  Check one entity type

citations

Citations Domain - Verify, archive, and report on citation health

Commands:
  verify           Verify and archive citation URLs for a page
  status           Show citation checking status
  report           Summary report of citation checking across all pages
  extract-quotes   Extract supporting quotes from cited sources
  quote-report     Report on quote extraction and sourcing coverage
  verify-quotes    Re-verify stored quotes against fresh source content
  check-accuracy   Check if wiki claims accurately represent cited sources
  normalize-footnotes Report/fix inconsistent footnote formats across pages
  export-dashboard Export accuracy data as YAML for the internal dashboard
  backfill-resource-ids Backfill resource_id for existing citation quotes
  fix-inaccuracies Fix flagged citation inaccuracies using LLM-generated corrections
  audit            Full pipeline: extract quotes, check accuracy, fix issues for one page
  audit-check      Independent post-hoc check: check claims against source content
  content-coverage Show citation content coverage stats (PostgreSQL)
  register-resources Auto-create resource YAML entries for unregistered footnote URLs

Options:
  --all             Process all pages with citations
  --limit=N         Limit number of pages to process (with --all)
  --concurrency=N   Process N pages in parallel (default: 1)
  --dry-run         Show what would be processed without running
  --recheck         Re-process already-handled pages
  --refetch         Re-fetch source URLs (verify-quotes only)
  --broken          Show only broken citations/quotes
  --content-verify  (verify only) Also check if source content supports each claim
  --json            JSON output
  --ci              JSON output for CI pipelines

Examples:
  crux w citations verify existential-risk                    Verify one page
  crux w citations verify existential-risk --content-verify  Also check claim support
  crux w citations verify --all --limit=20                   Verify top 20 pages
  crux w citations status existential-risk           Show sourcing results
  crux w citations report                            Summary across all pages
  crux w citations report --broken                   List all broken citations
  crux w citations extract-quotes existential-risk   Extract quotes for a page
  crux w citations extract-quotes --all --limit=10   Batch extract quotes
  crux w citations quote-report                      Quote coverage stats
  crux w citations quote-report --broken             Show drifted/broken quotes
  crux w citations verify-quotes existential-risk    Re-verify stored quotes
  crux w citations check-accuracy existential-risk   Check claim accuracy vs sources
  crux w citations check-accuracy --all              Batch accuracy check
  crux w citations normalize-footnotes                Report footnote format issues
  crux w citations normalize-footnotes --fix          Auto-fix to [Title](URL) format
  crux w citations normalize-footnotes --fix <id>     Fix one page
  crux w citations export-dashboard                  Export data for web dashboard (prefers PG)
  crux w citations export-dashboard --local-only     Force local data only (skip wiki-server)
  crux w citations backfill-resource-ids               Backfill resource_id for existing quotes
  crux w citations backfill-resource-ids --dry-run    Preview matches without writing
  crux w citations fix-inaccuracies                   Dry-run fix proposals for all flagged
  crux w citations fix-inaccuracies --apply           Apply fixes to pages
  crux w citations fix-inaccuracies <id>              Fix one page
  crux w citations fix-inaccuracies --max-score=0.5   Only worst citations
  crux w citations audit existential-risk             Full audit pipeline for one page
  crux w citations audit existential-risk --apply     Audit and auto-fix one page
  crux w citations audit-check existential-risk       Independent check (no DB, no fixes)
  crux w citations audit-check existential-risk --no-fetch  Use cached sources only
  crux w citations audit-check existential-risk --threshold=0.9  Require 90% verified
  crux w citations audit-check existential-risk --model=google/gemini-flash-lite  Use a different model
  crux w citations audit-check existential-risk --delay=500  Slow down between LLM calls

footnotes

Footnotes Domain — Migration tools for claim reference footnote markers

Commands:
  migrate-cr     Migrate [^1] markers to [^2] or [^3]

Options:
  --apply         Write changes to MDX files (default: dry-run)
  --page=<id>     Only process a specific page (by slug)
  --ci            JSON output
  --offline       Skip wiki-server; convert all [^cr-] to [^rc-] (no KB matching)

How it works:
  1. Scans all MDX files for [^1] inline references
  2. Fetches claim reference data from the wiki-server (/api/references/all)
     (skipped in --offline mode)
  3. For each page, loads KB facts from packages/factbase/data/things/{entityId}.yaml
  4. Tries to match claims to KB facts by source URL
  5. If KB match found: converts [^1] to [^kb-{factId}]
  6. If no match: converts [^1] to [^3] (plain citation ref)

The command is idempotent — running it twice won't double-convert.

Examples:
  crux w footnotes migrate-cr                  Preview all changes (dry run)
  crux w footnotes migrate-cr --page=anthropic Preview changes for one page
  crux w footnotes migrate-cr --apply          Apply changes to all files
  crux w footnotes migrate-cr --apply --offline Apply without wiki-server
  crux w footnotes migrate-cr --ci             JSON output for scripting

generate

Generate Domain - Content generation

Commands:
  yaml             Generate YAML from MDX files
  summaries        Generate summaries with AI
  diagrams         Generate diagrams from entity data
  schema-diagrams  Generate schema diagrams
  schema-docs      Generate documentation from schema

Options:
  --type=<t>         Entity type: articles, sources (summaries)
  --batch=<n>        Batch size (summaries)
  --concurrency=<n>  Parallel calls (summaries)
  --model=<m>        Model: haiku, sonnet, opus (summaries)
  --resummary        Re-summarize changed items (summaries)
  --id=<id>          Specific entity ID (summaries)
  --output=<path>    Output path (yaml)
  --dry-run          Preview without changes
  --verbose          Detailed output

Examples:
  crux w generate yaml content/docs/risks/
  crux w generate summaries --batch 50 --model haiku
  crux w generate diagrams
  crux w generate schema-docs

visual

Visual Domain - Diagram, chart & model management

Commands:
  create         AI-generate a visual for a page (mermaid, squiggle, cause-effect, comparison)
  review         Render and review visuals with playwright + AI quality check
  audit          Audit visual coverage across wiki pages
  improve        Improve existing visuals with AI assistance
  embed          Embed a reusable visual into a page by data reference

Visual Types:
  mermaid         Mermaid flowcharts, pie, timeline, quadrant, etc.
  squiggle        Squiggle probability distributions and models
  cause-effect    CauseEffectGraph interactive causal diagrams
  comparison      ComparisonTable side-by-side tables
  disagreement    DisagreementMap position comparison cards

Options:
  --type=<t>       Visual type (mermaid, squiggle, cause-effect, comparison, disagreement)
  --directions=<d> Specific instructions for generation or improvement
  --output=<path>  Output file path (defaults to .claude/temp/visual/)
  --model=<m>      Model: haiku, sonnet (default: sonnet)
  --screenshot     Take playwright screenshot during review
  --fix            Auto-apply suggested fixes during review
  --min-words=<n>  Minimum word count for audit coverage (default: 500)
  --format=<f>     Audit output format: table, json (default: table)
  --dry-run        Preview without writing files
  --apply          Write changes directly to page
  --verbose        Detailed output

Examples:
  crux w visual create existential-risk --type mermaid
  crux w visual create compute-governance --type squiggle --directions "model compute growth"
  crux w visual review alignment-problem --screenshot
  crux w visual audit --min-words=800
  crux w visual improve existential-risk --directions "simplify the flowchart"
  crux w visual embed existential-risk --visual ai-risk-taxonomy

enrich

Enrich Domain - Standalone enrichment tools for wiki content

Commands:
  entity-links   Insert <EntityLink> tags for entity mentions
  fact-refs      Wrap canonical numbers with <F> fact-ref tags

Options (entity-links):
  --apply           Write EntityLink insertions to MDX file
  --all             Scan all knowledge-base pages
  --limit=N         Limit pages when using --all
  --json            JSON output (one object per page)

Options (fact-refs):
  --apply           Write <F> tag insertions to MDX file
  --all             Scan all knowledge-base pages
  --limit=N         Limit pages when using --all
  --json            JSON output (one object per page)

All tools are idempotent — running twice on the same page produces no extra changes.

Examples:
  crux w enrich entity-links openai                 Preview EntityLinks for openai.mdx
  crux w enrich entity-links openai --apply         Insert EntityLinks into openai.mdx
  crux w enrich entity-links --all --limit=10       Preview for top 10 pages
  crux w enrich entity-links --all --apply          Apply EntityLinks across wiki

  crux w enrich fact-refs anthropic                 Preview <F> tags for anthropic.mdx
  crux w enrich fact-refs anthropic --apply         Insert <F> tags into anthropic.mdx
  crux w enrich fact-refs --all --limit=10 --apply  Apply <F> tags across 10 pages

Note: References are now auto-generated at build time (build-data.mjs → pageResources).
The 'crux w enrich references' command has been removed.

importance

Importance Domain - Ranking-based importance scoring

Two ranking dimensions:
  readership (default) — How important is this page for readers?
  research             — How much value would deeper investigation yield?

Rankings are ordered lists of page IDs (most important first).
Scores (0-100) are derived from position and written to frontmatter.

Commands:
  show       Show current importance rankings
  sync       Derive 0-100 scores from rankings and write to frontmatter
  rank       Use LLM to place page(s) in the ranking via comparison
  seed       Bootstrap ranking from existing importance scores
  rerank     Sort pages by importance using LLM judgment

Workflow:
  1. crux w importance rerank --all --apply                       # Readership ranking
  2. crux w importance rerank --dimension=research --all --apply  # Research ranking
  3. crux w importance show --top=30                              # Review readership
  4. crux w importance show --dimension=research --top=30         # Review research
  5. crux w importance sync --apply                               # Write both to frontmatter

Files:
  data/importance-ranking.yaml   Readership ranking
  data/research-ranking.yaml     Research importance ranking

Options:
  --dimension=<d>   Ranking dimension: readership (default) or research
  --top=<n>         Show top N pages (show)
  --unranked        Also list unranked pages (show)
  --batch=<n>       Rank N unranked pages (rank)
  --sample=<n>      Test with N diverse pages (rerank)
  --all             Rerank all pages (rerank)
  --verify          Fix local inversions in existing ranking (rerank)
  --model=<m>       Model: haiku (default) or sonnet (rerank)
  --apply           Write changes

Examples:
  crux w importance show --top=20
  crux w importance show --dimension=research --top=20
  crux w importance rerank --sample=20
  crux w importance rerank --dimension=research --sample=20
  crux w importance rerank --all --apply
  crux w importance rerank --verify --apply
  crux w importance sync --apply

updates

Updates Domain - Schedule-aware wiki page update system

Uses update_frequency (days) in page frontmatter to prioritize which
pages need refreshing, combining staleness with readerImportance scoring.

  Priority = staleness × (readerImportance / 100)
  Staleness = days_since_last_edit / update_frequency

Commands:
  list                 Show pages due for update, ranked by priority (default)
  run                  Run content improve on top-priority pages
  triage               Check overdue pages for new developments (~$0.08/page)
  stats                Show update frequency coverage statistics

Options:
  --limit=N            Number of results for list (default: 10)
  --overdue            Only show overdue pages (staleness >= 1.0)
  --count=N            Number of pages to improve/triage (default: 1 for run, 5 for triage)
  --tier=<tier>        Improvement tier: polish, standard, deep (default: standard)
  --no-triage          Skip news-check triage (triage is ON by default for run)
  --dry-run            Preview what run would do without executing
  --json               Output as JSON
  --ci                 JSON output for CI pipelines

Frontmatter fields:
  update_frequency: 7     # Desired update interval in days
  lastEdited: "2026-01-15"  # Last edit date (used for staleness)
  readerImportance: 85      # Reader importance (0-100, used as weight)

Cost-aware updating:
  The triage system checks for new developments before committing to
  an expensive update. For each page it runs a cheap news check (~$0.08)
  using web search + SCRY, then recommends: skip, polish, standard, or deep.

  This can save significantly when many overdue pages have no real news.
  Example: 10 pages at standard = ~$65. With triage, if 6 have no news,
  cost drops to ~$26 + $0.80 triage = ~$27.

Examples:
  crux w updates list                       Show top 10 update priorities
  crux w updates list --overdue --limit=20  All overdue pages
  crux w updates triage --count=10          Preview triage for top 10 overdue
  crux w updates run --count=5              Run with triage (default)
  crux w updates run --count=3 --no-triage --tier=polish  Skip triage, force polish
  crux w updates run --dry-run              Preview without executing
  crux w updates stats                      Show coverage stats

auto-update

Auto-Update Domain — News-driven wiki update system

Fetches news from configured RSS feeds, newsletters, and web searches,
then routes relevant items to wiki pages for automatic improvement.

Pipeline: fetch sources → build digest → route to pages → execute updates

Commands:
  plan                 Show what would be updated (default)
  run                  Execute the full auto-update pipeline
  run-ci               Full CI orchestration: branch, pipeline, validate, review, commit, PR
  submit               Submit as background jobs (parallel via job queue)
  digest               Fetch sources and show news digest only
  sources              List configured news sources
  history [count]      Show past auto-update runs
  audit-gate           Run citation audit gate on changed pages (CI)
  verify-citations     Verify citation URLs for specific pages (CI)
  risk-scores          Compute hallucination risk for specific pages (CI)
  content-checks       Check for truncation + dangling footnotes (CI)
  pr-body              Build PR body from run report + summaries (CI)

Options:
  --budget=N           Max dollars to spend per run (default: 50)
  --count=N            Max pages to update per run (default: 10)
  --sources=a,b,c      Only fetch these source IDs
  --batch              Use Anthropic Batch API for improve phase (50% cost reduction)
  --dry-run            Run pipeline but skip page improvements
  --skip-fetch         Skip RSS fetch (CI smoke test — verifies code paths only)
  --check              (sources only) Test all RSS/Atom source URLs for reachability
  --diff               (audit-gate) Auto-detect changed pages from git diff
  --apply              (audit-gate) Auto-fix inaccurate citations
  --base=BRANCH        (audit-gate) Base branch for diff (default: main)
  --from-report=PATH   (verify-citations, risk-scores) Extract page IDs from run report
  --report=PATH        (pr-body) Path to run report YAML
  --date=YYYY-MM-DD    (pr-body) Date string for PR title (default: today)
  --citations=MD       (pr-body) Citation summary markdown to include
  --risk=MD            (pr-body) Risk summary markdown to include
  --verbose            Show detailed progress
  --json               Output as JSON
  --ci                 JSON output for CI pipelines

Pipeline stages:
  1. Fetch:   Pull new items from RSS/Atom feeds and web searches
  2. Digest:  Deduplicate, classify relevance, extract topics (~$0.02-0.05)
  3. Route:   Map news items to wiki pages via entity matching + LLM (~$0.05-0.15)
  4. Execute: Run page improvements via crux w content improve (~$2-12/page)
  5. Validate: Run validation gate (escaping, schema, frontmatter)
  6. Report:  Save run report to data/auto-update/runs/

Cost model:
  Triage/routing overhead: ~$0.15-0.25 per run
  Per-page improvement: polish ~$2.50, standard ~$6.50, deep ~$12.50
  With --batch (50% off): polish ~$1.25, standard ~$3.25, deep ~$6.25
  With prompt caching (auto): ~15-25% input token savings on sequential runs
  Typical daily run (5 pages): ~$15-35 (sequential), ~$7-18 (batch)

Source configuration:
  Edit data/auto-update/sources.yaml to add/remove/configure news sources.
  Supported types: rss, atom, web-search

Examples:
  crux w auto-update plan                          Preview what would be updated
  crux w auto-update run --budget=30               Run with $30 budget
  crux w auto-update run --count=3 --verbose       Update 3 pages with details
  crux w auto-update digest --sources=openai-blog  Check one source
  crux w auto-update sources                       List all sources
  crux w auto-update sources --check               Test all source URLs for reachability
  crux w auto-update history                       Show recent runs
  crux w auto-update run --dry-run                 Full pipeline without executing
  crux w auto-update run --batch --budget=30       Run with Batch API (50% cheaper)
  crux w auto-update audit-gate --diff --apply     Audit changed pages and fix issues
  crux w auto-update audit-gate existential-risk   Audit a specific page
  crux w auto-update submit --budget=30            Submit as parallel background jobs
  crux w auto-update submit --dry-run              Preview job plan without creating jobs
  crux w auto-update run-ci --budget=30 --count=5  Full CI pipeline (used by GitHub Actions)

analyze

Analyze Domain - Analysis and reporting

Commands:
  all          Run all analysis checks (health report)
  links        Analyze cross-reference coverage
  entity-links Analyze linking for a specific entity
  quality      Content quality ratings
  scan         Scan content for statistics

Options:
  --json          JSON output
  --brief         Summary only (all)
  --orphans       Show poorly-linked pages (links)
  --top-linked    Show most linked pages (links)
  --page=<id>     Analyze specific page (links)
  --stats         Show statistics (scan)

Examples:
  crux w analyze                         Full health report
  crux w analyze --brief                 Summary only
  crux w analyze links --orphans         Find orphaned pages
  crux w analyze links --top-linked      Find most linked pages
  crux w analyze entity-links sam-altman Check linking for an entity

pages

Pages Domain — Page-level analysis and prioritization

Commands:
  next-action   Show pages ranked by "Next Best Action" priority score (default)

The NBA score combines:
  - importance = max(readerImportance, researchImportance) / 100
  - qualityDeficit = 1 - quality/100
  - stalenessFactor = 1 + min(daysSinceUpdate/365, 1.0)
  - hallucinationRiskFactor = 1 + (high: 0.5, medium: 0.25, low: 0)

  priority = importance * qualityDeficit * stalenessFactor * hallucinationRiskFactor

Options:
  --type=<entityType>   Filter to specific entity type (e.g. person, organization)
  --limit=N             Number of results (default: 20)
  --all                 Include pages with 0 importance scores
  --ci                  JSON output

Examples:
  crux w pages                                  # Top 20 pages needing attention
  crux w pages next-action --type=person        # Top person pages
  crux w pages next-action --limit=50           # Top 50
  crux w pages next-action --ci                 # JSON output

resources

Resources Domain - External resource management

Commands:
  list               List pages with unconverted links
  show               Show unconverted links in a file
  process            Convert links to <R> components
  create             Create a resource entry from URL
  metadata           Extract metadata (arxiv|forum|scholar|web|all|stats)
  rebuild-citations  Rebuild cited_by relationships
  validate           Validate resources (all|arxiv)
  refresh-titles     Fetch real page titles and fix bad ones
  classify-stance    Classify resource stance via LLM (--page=<slug>)

Discovery:
  discover-forums   Bulk import posts from LW/EAF/AF (free GraphQL API)

Publication Mapping:
  map-publications  Match resource domains to publications.yaml (--apply --top=N)

Enrichment:
  enrich-papers     Enrich papers via Semantic Scholar API (→ resource_papers)
  enrich-crossref   Enrich papers via Crossref API (fills S2 gaps, no key needed)
  enrich-forums     Enrich forum posts via LW/AF/EAF GraphQL (→ resource_forum_posts)
  fetch-all         Fetch all resource URLs and extract meta tags
  fetch-wayback     Retry failed URLs via Wayback Machine (archive.org)
  archive-pdfs      Archive PDF files to DigitalOcean Spaces
  enrich-rand-dates Fill missing dates for RAND resources (scrapes meta tags)
  enrich-free       Run all free enrichment (papers + forums + fetch)
  fix               Validate + auto-fix title/author mismatches (--apply to write)
  classify          LLM classification via Anthropic Batch API (Haiku, ~$15)
  deep-enrich       LLM deep enrichment via Anthropic Batch API (Sonnet, ~$100)

Options:
  --limit=<n>       Limit results
  --batch=<n>       Batch size (metadata/fetch-all)
  --apply           Apply changes (process)
  --dry-run         Preview without changes
  --json            JSON output
  --verbose         Verbose output
  --concurrency=<n> Concurrency for fetch-all (default 5)
  --batch-id=<id>   Batch ID for classify/deep-enrich status/poll/download

Examples:
  crux resources list --limit 20
  crux resources show bioweapons
  crux resources process bioweapons --apply
  crux resources create "https://arxiv.org/abs/..."
  crux resources metadata arxiv --batch 50
  crux resources validate all
  crux resources classify-stance --page=sb-1047 --apply
  crux resources enrich-papers --limit 100 --verbose
  crux resources enrich-crossref --limit 50 --verbose --dry-run
  crux resources enrich-forums --limit 200
  crux resources fetch-all --batch 50 --concurrency 5
  crux resources classify submit --dry-run
  crux resources deep-enrich submit --limit 1000
  crux resources discover-forums --karma=30 --forums=lw,eaf,af
  crux resources discover-forums --karma=50 --after=2020-01-01 --apply

Check-Links Domain - External URL health checking

Usage:
  crux w check-links                         Check all URLs across all sources
  crux w check-links --source=resources      Only check data/resources/*.yaml
  crux w check-links --source=external       Only check data/external-links.yaml
  crux w check-links --source=content        Only check MDX content URLs
  crux w check-links --report                Generate JSON report
  crux w check-links --fix                   Suggest archive.org replacements

Options:
  --source=<type>   Filter by source: resources, external, content, all (default: all)
  --report          Generate JSON report to .cache/link-check-report.json
  --fix             Query archive.org for dead links and suggest replacements
  --limit=<n>       Limit number of URLs to check (for testing)
  --verbose         Show detailed per-URL output
  --clear-cache     Clear the link check cache before running

Examples:
  crux w check-links --limit=100             Quick test with 100 URLs
  crux w check-links --source=resources --report --fix
  crux w check-links --verbose               Detailed output for all checks

qa-sweep

QA Sweep — Adversarial quality assurance with result persistence

Commands:
  run             Full sweep: recent changes + all checks (default)
  recent          Show recent PRs and changed files only
  checks          Run automated checks only (fast)
  diff            Compare the latest two saved sweep results

Options:
  --save          Save results to .claude/sweep-results/ after the sweep
  --compare       Run sweep, save results, then diff against previous run
  --json          JSON output for scripting

Result persistence:
  Results are stored in .claude/sweep-results/ (gitignored).
  Each run creates a timestamped JSON file plus latest.json.

Automated checks:
  - Duplicate wikiIds across YAML + MDX
  - References to deleted/merged entities
  - NEEDS CITATION markers in content
  - TODO markers in content
  - Wrong domain references (longterm.wiki, longtermwiki.org)
  - Content gate validation (full mode only)
  - Test suite status (full mode only)

Usage with Claude Code:
  /qa-sweep                Run full adversarial audit (crux checks + LLM agents)
  /loop 24h /qa-sweep      Schedule daily runs using your subscription

Examples:
  crux w qa-sweep                       Full report
  crux w qa-sweep --save                Full report + save results
  crux w qa-sweep --compare             Full report + save + show diff vs previous
  crux w qa-sweep checks --save         Fast checks + save
  crux w qa-sweep diff                  Show what changed since last saved run
  crux w qa-sweep diff --json           JSON diff output for CI
  crux w qa-sweep checks --json         JSON output for CI
  crux w qa-sweep recent                What changed recently

qa-checks

QA Checks — Coverage tracking for QA sweeps

Commands:
  queue              Show staleness-ordered page queue (default)
  coverage           Per-directory coverage stats
  record             Record a single check result
  list               List recent checks

Options:
  --directory=X      Filter by directory name
  --limit=N          Max results (default: 20 for queue, 50 for list)
  --url=URL          Page URL to record (for record command)
  --result=RESULT    Check result: clean | issues_found | error | 404
  --thing-id=ID      Thing ID to associate (optional)
  --sweep-id=ID      Sweep ID to group checks (optional)
  --check-type=TYPE  Check type: index | detail | cross-consistency
  --depth=DEPTH      Sweep depth: quick | standard | deep | exhaustive
  --json             JSON output for scripting

Examples:
  crux qa-checks queue                          Show next pages to check
  crux qa-checks queue --directory=organizations --limit=10
  crux qa-checks coverage                       Coverage stats per directory
  crux qa-checks record --url=/organizations/anthropic --result=clean
  crux qa-checks list --sweep-id=sweep-2026-03-19-abc

evals

crux w evals — Hallucination detection evals & adversarial agents

Commands:
  run       Run an eval suite
  hunt      Run an adversarial agent on specific pages
  scan      Batch-scan pages with hunting agents (produces triage manifest)
  inject    Inject errors into a page (for manual inspection)

Batch Scan (Phase 0 triage):
  crux w evals scan                                          Scan high-risk pages (no LLM, free)
  crux w evals scan --pages=all --no-llm --limit=200         Scan top 200 pages
  crux w evals scan --pages=zero-citations --verbose         Scan pages with no citations
  crux w evals scan --agents=reference-sniffer,cross-ref     Multiple agents
  crux w evals scan --pages=anthropic,miri,openai            Scan specific pages
  crux w evals scan --json                                   Machine-readable output

Eval Suites:
  crux w evals run --suite=injection [--pages=id1,id2] [--verbose] [--expensive]
  crux w evals run --suite=fake-entity [--verbose]
  crux w evals run --suite=cross-ref [--limit=100]

Adversarial Agents:
  crux w evals hunt --agent=reference-sniffer --page=<id> [--no-llm]
  crux w evals hunt --agent=description-auditor --page=<id> [--no-llm]
  crux w evals hunt --agent=cross-ref [--limit=100]

Inject Errors:
  crux w evals inject <page-id> [--count=2] [--categories=wrong-number,exaggeration]
  crux w evals inject <page-id> --output=/tmp/corrupted.mdx

Scan Options:
  --agents=A,B       Agents: reference-sniffer, description-auditor, cross-ref (default: reference-sniffer)
  --pages=FILTER     Page filter: all, high-risk (default), zero-citations, or comma-separated IDs
  --limit=N          Max pages to scan
  --no-llm           Skip LLM checks (free, fast — use for initial triage)
  --output=PATH      Manifest output path (default: .claude/temp/scan-manifest.json)
  --json             JSON output (full manifest)
  --verbose          Progress output

Other Options:
  --suite=NAME       Eval suite: injection, fake-entity, cross-ref
  --agent=NAME       Agent: reference-sniffer, description-auditor, cross-ref
  --page=ID          Target page ID
  --pages=ID,ID      Comma-separated page IDs
  --limit=N          Max pages for cross-ref scan
  --count=N          Errors per category for injection
  --categories=A,B   Error categories: wrong-number, fabricated-claim, exaggeration, fabricated-citation, missing-nuance
  --no-llm           Skip LLM-based checks (cheaper, faster)
  --expensive        Include expensive detectors (citation-auditor with network)
  --verbose          Detailed output
  --output=PATH      Write corrupted content to file

grokipedia

Grokipedia Domain - Match wiki pages to Grokipedia articles

Commands:
  match           Find matching Grokipedia articles for wiki pages (default)

Options:
  --apply         Write matches to external-links.yaml (default: dry run)
  --verbose       Show slug details for each match

Examples:
  crux w grokipedia match              Preview matches (dry run)
  crux w grokipedia match --apply      Find and write matches
  crux w grokipedia match --verbose    Show detailed slug info

extract-structured-data

Extract Structured Data from Wiki Pages

Extracts structured data from wiki page prose for any entity type and
optionally writes to the YAML entity data layer after sourcing
against footnote sources.

Supported entity types:
  person         education, roles, publications, researchFocus, birthYear
  organization   foundedYear, headquarters, funding, keyPersonnel, products, parentOrg
  ai-model       releaseDate, developer, parameterCount, contextWindow, capabilities,
                 benchmarkScores, pricing
  policy         introducedDate, status, jurisdiction, sponsor, provisions, stakeholders
  (default)      description, keyFacts, relatedEntities

Commands:
  extract (default)   Extract structured data from an entity's wiki page

Options:
  --dry-run            Print extracted data as JSON, don't write anything (default behavior)
  --apply              Write verified claims to the appropriate YAML entity file
  --verify             Verify claims against footnote source URLs before writing
  --budget=<N>         Maximum LLM spend in dollars (default: 5)
  --entity-type=<T>    Process all entities of this type in batch mode (e.g., person, organization)
  --limit=<N>          Max entities to process in batch mode (default: 10)
  --json               Output results as JSON

Examples:
  pnpm crux w extract-structured-data dan-hendrycks
  pnpm crux w extract-structured-data dan-hendrycks --verify
  pnpm crux w extract-structured-data dan-hendrycks --verify --apply
  pnpm crux w extract-structured-data E89 --dry-run
  pnpm crux w extract-structured-data --entity-type=person --budget=20 --limit=5
  pnpm crux w extract-structured-data --entity-type=organization --limit=10
  pnpm crux w extract-structured-data --entity-type=ai-model --limit=5

verify-consistency

Unified Consistency Check — run all consistency checks with a combined report

Usage:
  crux w verify-consistency                     Run all consistency checks
  crux w verify-consistency --type=cross-entity Just cross-entity checks
  crux w verify-consistency --type=prose        Just prose/terminology consistency
  crux w verify-consistency --type=numeric      Just numeric consistency
  crux w verify-consistency --ci                JSON output for CI
  crux w verify-consistency --verbose           Show all issues including info-level

Check Types:
  cross-entity   Bidirectional relationships (person<->org, model<->org, etc.)
  prose          Probability estimates, terminology, causal claims across pages
  numeric        Contradictory numeric claims about the same entity

Options:
  --type=TYPE    Run only one check type (cross-entity, prose, numeric)
  --ci           JSON output
  --verbose      Show info-level items (not just warnings/errors)

Exit Codes:
  0 = No actionable issues (info items and advisory numeric contradictions don't block)
  1 = Warnings or errors found

sourcing-wiki-pages

Wiki Page Source-Check — verify prose claims in wiki pages against their cited sources

Usage:
  crux w sourcing-wiki-pages [options]             Check top pages by importance
  crux w sourcing-wiki-pages --page=anthropic      Check a specific page
  crux w sourcing-wiki-pages --dry-run             Preview what would be checked

Options:
  --limit=N               Max number of pages to process (default: 10)
  --budget=N              Max dollars to spend on LLM calls (default: 5.0)
  --page=<slug>           Process a single specific page
  --min-importance=N      Minimum readerImportance threshold
  --dry-run               Show what would be processed without running
  --ci                    JSON output for CI pipelines

For each page, the command:
  1. Extracts factual claims from MDX content using LLM
  2. Matches claims to footnote citations
  3. Cross-references claims against FactBase data
  4. Detects stale temporal references
  5. For sourced claims: fetches the source URL and verifies the claim via LLM
  6. Stores results in the wiki-server sourcing system

Record type: wiki-page
Record IDs: page slugs (e.g., "anthropic", "openai")
Field names: fn:<N> for sourced claims, _unfootnoted:<hash>, _cross-ref:<factId>, _stale:<hash>

factbase (fb)

FactBase — structured facts with temporal data & provenance

factbase

KB Domain -- Knowledge Base readability, authoring, and migration tools

Commands:
  show <entity-id>      Show a single entity with all data, resolving stableIds
  list [--type=X]       List all entities with name, type, stableId, and fact count
  lookup <stableId>     Look up an entity by its stableId
  validate              Run all KB validation checks
  properties [--type=X] List all property definitions with usage counts
  search <query>        Search entities by name, ID, or alias
  coverage [--type=X]   Show entity coverage against required/recommended properties
  fact <fact-id>        Show a single fact with full metadata
  stale [days]          List facts older than N days (default: 180)
  needs-update <id>     Show missing and stale data for an entity
  add-fact <entity> <property> <value>   Add a fact to an entity YAML file
  import-990 <entity> [--ein=X]         Import IRS Form 990 data from ProPublica
  import-990 --discover <query>         Search ProPublica by org name
  migrate <slug>        Migrate entity from old system to KB [--dry-run] [--stub-old]
  sync-sources          Sync KB fact source URLs to wiki-server as Resources
  sourcing          Check KB facts against source URLs using LLM
  migrate-entities [--dry-run]  Transform YAML files from thing: to entity: format
  migrate-entities-status       Show migration status (files in each format)

Options:
  --type=X              Filter list/search/coverage by entity type (e.g. organization, person)
  --limit=N             Limit number of results
  --ci                  JSON output (sync-sources: dry-run, lists URLs only)
  --errors-only         Show only errors (validate)
  --rule=X              Filter by rule name (validate)
  --entity=X            (sourcing) Check all facts for one entity
  --fact=X              (sourcing) Check a single fact by ID
  --dry-run             Preview changes without writing (sourcing, import-990)
  --ein=XXXXXXXXX       (import-990) Specify EIN directly
  --force               (import-990, add-fact) Overwrite existing facts
  --asOf=YYYY-MM        (add-fact) Temporal anchor date
  --source=URL          (add-fact) Source URL
  --notes=TEXT           (add-fact) Free-text annotation
  --currency=USD         (add-fact) ISO 4217 currency code

Examples:
  crux fb show anthropic              Show Anthropic with all facts and items
  crux fb list --type=person          List only person entities
  crux fb search anthropic            Find entities matching "anthropic"
  crux fb fact f_dW5cR9mJ8q           Show fact details
  crux fb stale 90                    Facts older than 90 days
  crux fb needs-update anthropic      What's missing for Anthropic
  crux fb coverage --type=organization Organizations property coverage
  crux fb add-fact anthropic revenue 5e9 --asOf=2025-06 --source=https://example.com
  crux fb import-990 cais --dry-run   Preview 990 data for CAIS
  crux fb import-990 givewell --ein=208625442  Import GiveWell 990 data
  crux fb import-990 --discover "Machine Intelligence Research"  Search ProPublica
  crux fb sync-sources                Sync source URLs to wiki-server resources
  crux fb sourcing --entity=anthropic   Check Anthropic facts against sources
  crux fb sourcing --dry-run --limit=5  Preview 5 facts that would be checked

wikidata-enrich

Wikidata Enrichment — Enrich FactBase entities with Wikidata SPARQL data

Usage:
  crux fb wikidata-enrich [options]

Options:
  --dry-run         Preview discovered facts without writing to YAML files
  --limit=N         Process at most N entities (useful for testing)
  --entity=<slug>   Process a single entity by slug (e.g., --entity=anthropic)
  --type=<type>     Only process entities of a given type (e.g., --type=organization)

Wikidata Properties Queried:
  P571   Founded date        → founded-date
  P159   Headquarters        → headquarters
  P17    Country             → country
  P856   Official website    → website
  P169   CEO/director        → ceo
  P1128  Number of employees → headcount
  P2139  Revenue             → revenue
  P749   Parent organization → parent-organization
  P112   Founded by          → founded-by-name
  P1454  Legal form          → legal-structure
  -      Wikipedia URL       → wikipedia-url

Notes:
  - Rate-limited to ~1 request/second to respect Wikidata's API guidelines
  - Only adds NEW facts — never overwrites existing data
  - Uses Wikidata search API for name matching, then SPARQL for structured data
  - Fact IDs are auto-generated 10-char alphanumeric strings

Examples:
  crux fb wikidata-enrich --dry-run --limit=5         Preview 5 entities
  crux fb wikidata-enrich --entity=anthropic           Enrich a single entity
  crux fb wikidata-enrich --type=organization          Enrich all organizations
  crux fb wikidata-enrich --dry-run                    Preview all entities

tablebase (tb)

TableBase — PG entities, people, orgs, grants, imports

tablebase

TableBase Domain — Structured data enrichment via LLM agents

Commands:
  scan           Show per-table completeness scores
  gaps           Ranked list of missing data (enrichment targets)
  next-task      Output the single highest-impact task
  improve        Run LLM agent to enrich data for one task
  mark-done      Mark a task as completed (excluded from future picks)
  loop           Autonomous multi-task enrichment loop
  resolve        Resolve entity name to stableId (for Claude Code skill)
  create-entity  Create a new entity (person, org, etc.) with allocated ID
  submit         Submit records to a table (for Claude Code skill)
  existing       Query existing records for an entity (for Claude Code skill)
  sourcing-records Batch sourcing records using deterministic checks + Batch API
  source-discover      Find better sources for records with unverifiable verdicts
  sync-careers   Sync FactBase career data to the personnel table
  normalize-ids [--apply]  Fix slug-based entity IDs in personnel/grant records

  Backfill (consolidated from backfill-* domains):
  backfill-grantee-ids [--dry-run]       Link grants to grantee entity stableIds
  backfill-program-ids [--dry-run]       Link grants to funding programs
  backfill-stable-ids [--dry-run]        Push KB stableIds to wiki-server entity_ids
  backfill-yaml-stable-ids [--dry-run]   Insert stableIds into entity YAML files

  Import (consolidated from import-* domains):
  import-grants               Analyze grant import stats (default)
  import-grants-sync          Import grants to wiki-server
  import-grants-dedup         Remove cross-source duplicates
  import-grants-download      Download grant data files
  import-divisions            List known organizational divisions (default)
  import-divisions-sync       Sync divisions to wiki-server
  import-funding-programs     List known funding programs (default)
  import-funding-programs-sync  Sync programs to wiki-server

  Data Sources:
  data-sources                Show data source help
  data-sources-list           List all registered data sources
  data-sources-show <id>      Show details + snapshot history
  data-sources-snapshot <id>  Capture a new snapshot (--all for all sources)
  data-sources-health         Check mapping validity, staleness

  Website Sources:
  website-sources             Show website source help
  website-sources-list        List all registered website sources
  website-sources-show <id>   Show source details with pages
  website-sources-fetch <id>  Fetch pages and store snapshots (--all for all sources)

  Market data:
  markets-discover <entity>   Discover prediction market questions via LLM agent
  markets-fetch [entity]      Fetch latest snapshots from platform APIs (Metaculus, etc.)

Options:
  --table=<name>            Filter scan to specific table; required for submit/existing
  --top=N, --limit=N        Number of gaps to show (default: 20)
  --task-type=<type>        Filter by task type
  --entity-type=<type>      Filter by entity type (organization, ai-model)
  --format=prompt|json      Output format for next-task
  --dry-run                 Run agent without writing to database
  --max=N                   Max tasks for loop (default: 5)
  --budget=N                Budget limit in USD for loop (default: 30)
  --model=<name>            LLM model: haiku, sonnet, opus, or auto (tier by task type)
  --records-file=<path>     JSON file for submit command
  --skip-sourcing       Skip sourcing before submit (for testing)
  --apply                   For source-discover: also link discovered resources to records
  --ci                      JSON output

Modes:
  API mode:          crux tb tablebase improve / loop (uses ANTHROPIC_API_KEY, ~$1-2/task)
  Subscription mode: /tablebase-enrich skill in Claude Code ($0, uses subscription)

Task Types:
  grant-grantee-backfill     Link grants to grantee entities
  personnel-enrichment       Add key personnel for organizations
  funding-round-research     Add funding round data for companies
  investment-linking         Add investment records
  benchmark-result-fill      Add benchmark scores for AI models
  source-discovery           Find better sources for unverifiable records

Examples:
  crux tb tablebase scan                                   # Overview of all tables
  crux tb tablebase gaps --top=10                          # Top 10 enrichment targets
  crux tb tablebase gaps --task-type=personnel-enrichment  # Personnel gaps only
  crux tb tablebase next-task --format=json                # JSON for scripting
  crux tb tablebase improve abc123def --dry-run            # Test run without writing
  crux tb tablebase loop --max=3 --budget=10               # 3-task loop with $10 cap
  crux tb tablebase loop --model=auto --max=20             # Auto-tier: haiku for simple, sonnet for complex
  crux tb tablebase loop --model=haiku --task-type=benchmark-result-fill  # All-haiku for benchmarks
  crux tb tablebase sourcing-records --table=personnel --source=deterministic  # Fast structural checks
  crux tb tablebase sourcing-records --table=personnel --source=batch --limit=100  # LLM check 100 records
  crux tb tablebase sourcing-records --table=personnel --source=all   # Full sourcing
  crux tb tablebase source-discover anthropic --dry-run       # Preview source suggestions for Anthropic
  crux tb tablebase source-discover --limit=5 --budget=5     # Discover sources for top 5 entities
  crux tb tablebase source-discover anthropic --apply        # Discover + link sources to records
  crux tb tablebase normalize-ids                            # Dry-run: show slug-based IDs
  crux tb tablebase normalize-ids --apply                    # Fix slug-based IDs
  crux tb tablebase resolve "OpenAI"                       # Resolve name → stableId
  crux tb tablebase resolve "OpenAI" --ci                  # JSON output
  crux tb tablebase existing A4XoubikkQ --table=personnel  # Show existing records
  echo '[{...}]' | crux tb tablebase submit --table=personnel  # Submit records via pipe
  echo '[{...}]' | crux tb tablebase submit --table=personnel --skip-sourcing  # Submit without sourcing
  crux tb tablebase mark-done abc123def                    # Exclude from future runs
  crux tb tablebase sync-careers                           # Populate personnel table from FactBase
  crux tb tablebase sync-careers --dry-run                 # Preview extraction without writing

matrix

Matrix Domain — Entity matrix analysis and improvement targeting

Commands:
  scores      Show content dimension scores per entity type
  pages       List pages ranked by improvement potential
  next-task   Output the highest-impact improvement task (create or improve)
  mark-done   Mark a page as improved (excluded from future picks)

Options:
  --type=<entityType>     Filter to specific entity type
  --dimension=<dim>       content, coverage, quality, all (default: content)
  --sort=<key>            gap (default), score, pages, quality, coverage
  --limit=N               Number of pages (default: 20)
  --min-words=N           Minimum word count filter
  --include-stubs         Include stub pages (< 100 words)
  --exclude=<file>        Exclusion list file (default: .matrix-improved.txt)
  --weights=<w>           quality:30,coverage:25,citations:20,freshness:15,pages:10
  --threshold=N           Only pages below this quality/coverage score
  --format=prompt|json|ids Output format
  --ci                    JSON output

Examples:
  crux tb matrix                                    # Entity type scorecard
  crux tb matrix scores --weights=quality:50,coverage:50  # Custom weights
  crux tb matrix pages --include-stubs              # Show stub pages too
  crux tb matrix pages --format=ids --limit=10      # IDs for batch piping
  crux tb matrix next-task                          # Prompt for next improve task
  crux tb matrix next-task --include-stubs          # Include stub pages (create tasks)
  crux tb matrix next-task --type=person            # Only person pages
  crux tb matrix mark-done E357                     # Exclude from future picks

entity

Entity Domain — Entity ID management tools

Commands:
  rename <old-id> <new-id>   Safely rename an entity ID across all files

Options:
  --apply       Write changes to disk (default: dry-run preview)
  --verbose     Show each matching line and its replacement
  --dry-run     Preview mode (default)

Why "rename" instead of find-replace:
  Plain string replace of "E6" also matches "E64", "E60", etc.
  This command uses word-boundary regex (\b) to match only exact IDs.

Examples:
  crux tb entity rename E6 ai-control              Preview changes
  crux tb entity rename E6 ai-control --apply      Apply changes
  crux tb entity rename old-slug new-slug --apply  Rename a slug

ids

IDs Domain — Entity ID allocation and lookup

Commands:
  allocate <slug>   Allocate a wiki ID (E##) for a slug from the wiki-server
  check <slug>      Check if a slug has an ID allocated
  list              List all allocated IDs

Options:
  --description="..."   Description when allocating (allocate only)
  --limit=N             Number of results (list only, default: 50)
  --offset=N            Pagination offset (list only, default: 0)
  --ci                  JSON output

Why use this:
  Entity wiki IDs (E42, E886, etc.) are allocated by the wiki-server
  using a PostgreSQL sequence to guarantee uniqueness. Never manually
  invent an ID — always allocate from the server. This prevents ID
  conflicts when multiple agents work concurrently.

  The validate gate also runs assign-ids.mjs automatically, but
  allocating early is better: it prevents the window where two agents
  might both create entities without IDs and get conflicting assignments.

Examples:
  crux tb ids allocate anthropic                    # Get or create ID
  crux tb ids allocate new-org --description="..."  # With description
  crux tb ids check anthropic                       # Look up existing ID
  crux tb ids list --limit=100                      # Browse all IDs

people

People — Person entity discovery and data tools

Commands:
  discover             Find people across data sources who are not in people.yaml (default)
  create               Generate YAML entity stubs for discovered candidates
  enrich               Enrich person KB entities with data from external sources
  import-key-persons   Extract key-persons from KB YAML and sync to PG
  suggest-links        Detect unlinked person mentions in MDX pages

Discover/Create Options:
  --min-appearances=N   Only show people in N+ data sources (default: 1 for discover, 2 for create)
  --json                JSON output
  --ci                  JSON output (alias for --json)

Enrich Options:
  --source=wikidata     Data source (currently only wikidata is supported)
  --dry-run             Preview what would be added without writing
  --apply               Actually write new facts to YAML files
  --entity=<slug>       Process a single entity (for testing)
  --limit=N             Limit number of entities to process
  --ci                  JSON output

Data Sources Scanned (discover):
  1. data/experts.yaml — expert entries not in people.yaml
  2. data/organizations.yaml — keyPeople references
  3. data/entities/*.yaml — relatedEntries with type: person
  4. packages/factbase/data/things/ — KB things with type: person
  5. data/literature.yaml — paper authors

Scoring:
  expert = 5pts, kb-thing = 4pts, org-keyPeople = 4pts,
  entity-relatedEntries = 3pts, literature-author = 2pts

Enrich Details:
  Only adds facts that don't already exist — never overwrites.
  Requires high-confidence Wikidata matching (name + description relevance check).
  Currently extracts: born-year (P569), education (P69)

Options (import-key-persons):
  --sync           Actually sync to wiki-server PG
  --dry-run        Preview sync without writing
  --verbose        Show per-org details

Examples:
  crux tb people discover                     # List all candidates
  crux tb people discover --min-appearances=2 # Only people in 2+ sources
  crux tb people discover --json              # JSON output
  crux tb people create                       # Generate YAML stubs (min 2 appearances)
  crux tb people create --min-appearances=1   # Include single-mention candidates
  crux tb people enrich --source=wikidata --dry-run
  crux tb people enrich --source=wikidata --apply
  crux tb people enrich --source=wikidata --entity=dario-amodei --dry-run
  crux tb people import-key-persons              # Preview extracted key-persons
  crux tb people import-key-persons --verbose    # Show per-org details
  crux tb people import-key-persons --sync       # Sync to wiki-server PG
  crux tb people import-key-persons --sync --dry-run   # Preview sync (no writes)
  crux tb people suggest-links                  # Preview unlinked person mentions
  crux tb people suggest-links --verbose        # Show all mentions (linked and unlinked)
  crux tb people suggest-links --apply          # Wrap first occurrence in EntityLink

Suggest-Links Options:
  --apply          Wrap the first unlinked occurrence of each person in EntityLink
  --verbose        Show all mentions including already-linked ones

orgs

Orgs — Organization entity data tools

Commands:
  enrich               Enrich organization KB entities with data from external sources

Enrich Options:
  --source=wikidata     Data source (currently only wikidata is supported)
  --dry-run             Preview what would be added without writing
  --apply               Actually write new facts to YAML files
  --entity=<slug>       Process a single entity (for testing)
  --limit=N             Limit number of entities to process
  --ci                  JSON output

Properties extracted from Wikidata:
  P571  inception       -> founded-date
  P159  headquarters    -> headquarters
  P1128 employees       -> headcount
  P856  official website -> website
  P112  founded by      -> (logged as note; ref-type needs entity ID matching)
  P749  parent org      -> description (when no description exists)

Examples:
  crux tb orgs enrich --source=wikidata --dry-run
  crux tb orgs enrich --source=wikidata --apply
  crux tb orgs enrich --source=wikidata --entity=anthropic --dry-run
  crux tb orgs enrich --source=wikidata --limit=10 --dry-run

sourcing

Commands: stats

legislation

Legislation — Policy stakeholder sourcing

Commands:
  verify-stakeholders     Populate sourcing evidence for stakeholder positions

Options:
  --policy=<id>          Only verify stakeholders for this policy (e.g. california-sb1047)
  --dry-run              Preview what would be created without writing
  --verbose              Show detailed progress for each stakeholder
  --ci                   Output JSON summary

Examples:
  crux tb legislation verify-stakeholders --policy=california-sb1047
  crux tb legislation verify-stakeholders --dry-run --verbose
  crux tb legislation verify-stakeholders --ci

benchmarks

Benchmarks — ingest benchmark data from external sources.

Commands:
  ingest-epoch     Ingest Epoch AI benchmark scores into wiki-server

Options (ingest-epoch):
  --apply           Sync results to wiki-server (default: dry-run)
  --force-download  Re-download data even if cached
  --data-dir=PATH   Use local extracted CSV directory instead of downloading
  --benchmark=SLUG  Only process specific benchmark(s), comma-separated
  --batch-size=N    Batch size for wiki-server sync (default: 100)

Examples:
  pnpm crux tb benchmarks ingest-epoch                     # Dry-run preview
  pnpm crux tb benchmarks ingest-epoch --apply              # Sync to wiki-server
  pnpm crux tb benchmarks ingest-epoch --benchmark=mmlu     # Single benchmark
  pnpm crux tb benchmarks ingest-epoch --force-download     # Refresh cached data
  pnpm crux tb benchmarks ingest-epoch --data-dir=/tmp/epoch_benchmarks

gh (gh)

GitHub — issues, PRs, CI, epics, releases

issues

Issues Domain - Track Claude Code work on GitHub issues

Commands:
  list                List open issues ranked by priority (default)
  next                Show the single next issue to pick up
  search <query>      Search existing issues before filing a new one
  create <title>      Create a new GitHub issue (supports structured template)
  comment <N> <msg>   Post a comment on an existing issue
  update-body <N>     Update an issue body using structured template args
  update-title <N>    Update an issue title
  lint [N]            Check issue formatting (all issues, or single by number)
  start <N>           Signal start: post comment + add `agent:working` label
  done <N>            Signal completion: post comment + remove label
  cleanup             Detect stale agent:working labels + potential duplicates
  close <N>           Close an issue with optional comment

Options (list/next):
  --limit=N           Max issues to show in list (default: 30)
  --scores            Show score breakdown + formatting warnings per issue
  --json              JSON output

Options (search):
  --closed            Also search closed issues (via GitHub search API)
  --threshold=N       Minimum match score 0-1 (default: 0.35)
  --json              JSON output with match details

Options (comment):
  --body-file=<path>  Comment body from file (safe — avoids shell expansion)

Options (create):
  --label=X,Y         Comma-separated labels to apply
  --body="..."        Raw freeform body (bypasses --model/--criteria requirement)
  --body-file=<path>  Body from file (safe — avoids shell expansion of backticks/dollars)
  --problem="..."     Problem/background description (## Problem section)
  --problem-file=<path>  Problem from file (safe — avoids shell expansion)
  --fix="..."         Proposed fix or approach (## Proposed Fix section)
  --depends=N,M       Comma-separated dependent issue numbers
  --criteria="a|b|c"  Pipe-separated acceptance criteria items (REQUIRED)
  --model=haiku|sonnet|opus  Recommended model for this issue (REQUIRED)
  --cost="~$2-4"      Estimated AI cost
  --draft             Skip --model/--criteria validation (for WIP issues)

Options (update-title):
  --title="..."       New title for the issue (REQUIRED)

Options (update-body):
  --body-file=<path>  Set raw body directly (no merge — use for rich multi-section bodies)
  --problem="..."     Problem/background description (## Problem section)
  --problem-file=<path>  Problem from file (safe — avoids shell expansion)
  --fix="..."         Proposed fix or approach (## Proposed Fix section)
  --depends=N,M       Comma-separated dependent issue numbers
  --criteria="a|b|c"  Pipe-separated acceptance criteria items
  --model=haiku|sonnet|opus  Recommended model for this issue
  --cost="~$2-4"      Estimated AI cost

Options (done):
  --pr=URL            PR URL to include in the completion comment

Options (close):
  --reason="..."      Closing comment
  --duplicate=N       Close as duplicate of issue N

Options (cleanup):
  --fix               Auto-remove stale agent:working labels

Issue Formatting Standard:
  Well-formatted issues should have:
    1. ## Problem / ## Summary section (or long freeform body)
    2. ## Acceptance Criteria section or - [ ] checkboxes
    3. Recommended model: **Haiku/Sonnet/Opus** in ## Recommended Model section,
       or [haiku/sonnet/opus] suffix in the issue title
  Check compliance with: crux gh issues lint [N]

Scoring (weighted):
  Issues are ranked by a composite score combining:
    • Priority label: P0=1000, P1=500, P2=200, P3=100, unlabeled=50
    • Bug bonus: +50 for issues labeled 'bug', 'defect', 'regression', etc.
    • Claude-ready bonus: +50% for issues labeled 'claude-ready'
    • Effort adjustment: ±20 for effort:low / effort:high labels
    • Recency bonus: +15 if updated within 7 days
    • Age bonus: +1/month since creation (capped at +10)
  Blocked issues (labels: blocked/waiting/needs-info, or body text) are
  shown separately and excluded from the queue.

Examples:
  crux gh issues                        List all open issues
  crux gh issues --scores               List with score breakdowns + formatting warnings
  crux gh issues next                   Show next issue to pick up
  crux gh issues search "MDX escaping"  Check if issue exists before filing
  crux gh issues search "broken build" --closed   Also search closed issues
  crux gh issues comment 42 "Found another instance in gate.ts:142"
  crux gh issues lint                   Check all issues for formatting problems
  crux gh issues lint 239               Check single issue #239
  crux gh issues create "Add validation rule for X" --label=tooling \
    --problem="X is not validated..." --model=haiku \
    --criteria="Validation added|Tests pass|CI green" --cost="<$1"
  # For bodies with backticks/dollars/parens, use --problem-file or --body-file:
  crux gh issues create "Title" --problem-file=/tmp/problem.md --model=sonnet --criteria="a|b"
  crux gh issues update-body 239 --problem-file=/tmp/problem.md --model=sonnet --criteria="a|b"
  crux gh issues update-body 239 --body-file=/tmp/full-body.md  # Set raw body (no merge)
  crux gh issues start 239              Announce start (blocks if another agent is active)
  crux gh issues start 239 --force      Override conflict check
  crux gh issues done 239 --pr=https://github.com/.../pull/42
  crux gh issues cleanup                Check for stale labels and duplicates
  crux gh issues cleanup --fix          Auto-remove stale agent:working labels
  crux gh issues close 42 --duplicate=10
  crux gh issues close 42 --reason="Already done in PR #100"

Slash command:
  /next-issue    Claude Code command for the full "pick up next issue" workflow

pr

PR Domain — GitHub Pull Request utilities

Commands:
  create                        Create a draft PR for the current branch (corruption-safe).
  ready [--pr=N]                Mark PR as ready (validates eligibility, removes draft status).
  detect                        Detect open PR for current branch (returns URL + number).
  check <N>                     Check a single PR for issues and merge eligibility.
  check --all                   Check all open PRs, ranked by issue priority score.
  overlaps                      Detect file-level overlaps across open PRs.
  fix-body [--pr=N]             Detect and repair literal \n in the current branch's PR body.
  rebase-all                    Rebase all open non-draft PRs onto main (used by CI).
  validate-test-plan [--pr=N]   Check that the PR's test plan section is complete.
  resolve-conflicts             Find and resolve all open PRs with merge conflicts.

Options (create):
  --title="..."       Required. PR title.
  --body="..."        PR body (inline — avoid for multi-line bodies; use --body-file or stdin).
  --body-file=<path>  PR body from file (safe for markdown with backticks).
  --base=main         Base branch (default: main).
  --no-draft          Create as ready PR (default: draft).
  --allow-empty-body  Allow creating PR without a description (not recommended).
  --skip-test-plan    Skip test plan validation (not recommended).
  (stdin)             If --body and --body-file are absent and stdin is a pipe, body is read from stdin.

Options (ready):
  --pr=N              Target a specific PR number instead of auto-detecting.
  --force             Skip eligibility checks and mark as ready anyway.

Options (detect):
  --ci                JSON output.

Options (fix-body / validate-test-plan):
  --pr=N              Target a specific PR number instead of auto-detecting.
  --json              JSON output (validate-test-plan only).

Options (rebase-all):
  --verbose           Show detailed progress for each PR.

Options (resolve-conflicts):
  --verbose           Show detailed output.

Examples:
  # Multi-line body via heredoc (recommended — avoids sh/dash heredoc issues):
  pnpm crux gh pr create --title="Add feature X" <<'EOF'
  ## Summary
  - Added X

  ## Test plan
  - [x] Ran unit tests
  EOF

  # Multi-line body via file (also recommended):
  pnpm crux gh pr create --title="Add feature X" --body-file=/tmp/pr-body.md

  # Short single-line body inline:
  pnpm crux gh pr create --title="Fix typo" --body="Fix typo in docs"

  pnpm crux gh pr detect                    # Check if PR exists for this branch
  pnpm crux gh pr detect --ci               # JSON output for scripts
  pnpm crux gh pr fix-body                  # Fix PR for current branch
  pnpm crux gh pr fix-body --pr=42          # Fix a specific PR
  pnpm crux gh pr validate-test-plan        # Check test plan on current PR
  pnpm crux gh pr validate-test-plan --pr=42 --json  # Check specific PR (JSON)
  pnpm crux gh pr rebase-all                 # Rebase all open PRs onto main
  pnpm crux gh pr rebase-all --verbose       # With detailed output
  pnpm crux gh pr check 1837                # Check single PR for issues
  pnpm crux gh pr check --all               # Check all open PRs, ranked
  pnpm crux gh pr check --all --json        # Machine-readable output
  pnpm crux gh pr overlaps                  # Detect file overlaps across PRs
  pnpm crux gh pr overlaps --json           # Machine-readable output
  pnpm crux gh pr resolve-conflicts         # Resolve all conflicted PRs
  pnpm crux gh pr resolve-conflicts --verbose  # With detailed output

ci

CI Domain - GitHub CI status and monitoring

Commands:
  status                 Check GitHub CI check-run status
  pause-actions          Pause all automated GitHub Actions workflows
  resume-actions         Resume all automated GitHub Actions workflows
  main-status            Check if main branch CI is passing or failing.

Options:
  --wait          Poll every 30s until all checks complete
  --sha=<sha>     Check a specific commit (default: HEAD)
  --ci            JSON output
  --json          JSON output (main-status)

Examples:
  crux gh ci status                  Show current CI status
  crux gh ci status --wait           Poll until all checks complete
  crux gh ci status --sha=abc123     Check a specific commit
  crux gh ci main-status             Is main branch CI green or red?
  crux gh ci main-status --json      Machine-readable output
  crux gh ci pause-actions            Pause all automated workflows
  crux gh ci resume-actions           Resume all automated workflows

epic

Epic Management (via GitHub Discussions)

Manage multi-issue epics as living documents. Each epic is a GitHub Discussion
with a structured body (task list, decisions, blockers) and a comment timeline
of agent activity.

Usage:
  crux gh epic                                  List open epics
  crux gh epic list                             Same as above
  crux gh epic create <title> [--pin]           Create a new epic discussion
  crux gh epic view <N>                         View epic body + recent comments
  crux gh epic comment <N> <message>            Post a status update comment
  crux gh epic update <N> --body-file=<path>    Replace the epic body
  crux gh epic link <N> --issue=M               Link an issue to the epic
  crux gh epic unlink <N> --issue=M             Unlink an issue from the epic
  crux gh epic status <N>                       Progress bar + linked issue status
  crux gh epic close <N> [--reason=outdated]    Close a completed epic
  crux gh epic categories                       List discussion categories

Options:
  --body=<text>          Inline body text
  --body-file=<path>     Read body from file (safer for markdown)
  --pin                  Pin the discussion to the repository index (create only)
  --issue=<N>            Issue number (for link/unlink)
  --reason=<reason>      Close reason: resolved (default) or outdated
  --ci                   JSON output

Examples:
  crux gh epic create "Auth System Overhaul" --pin
  crux gh epic link 42 --issue=123
  crux gh epic comment 42 "Starting work on OAuth provider support"
  crux gh epic status 42

Workflow:
  1. Create an epic:     crux gh epic create "Project Name" --pin
  2. Link issues to it:  crux gh epic link <epic> --issue=<N>
  3. Track progress:     crux gh epic status <epic>
  4. Post updates:       crux gh epic comment <epic> "Status update..."
  5. Close when done:    crux gh epic close <epic>

release

Release Domain — Production release management

Commands:
  create                Create or update a release PR (main → production).

Options (create):
  --dry-run             Preview what would happen without creating/updating the PR.
  --ci                  JSON output for CI pipelines.

The release PR includes:
  - Standardized title: "release: YYYY-MM-DD" (or "#2" for same-day re-releases)
  - Auto-generated changelog grouped by conventional commit type
  - Divergence warning if production has hotfix commits not on main
  - Idempotent: updates existing open release PR instead of creating duplicates

Examples:
  pnpm crux gh release create               # Create or update release PR
  pnpm crux gh release create --dry-run     # Preview without creating

deploy-tasks

Deploy Tasks — Track post-deploy check tasks

Commands:
  detect                Detect deploy tasks from current branch diff.
  pending               Find unchecked deploy tasks from recently merged PRs.
  inject                Inject deploy tasks section into a PR description.
  verify                Run embedded verify commands for unchecked deploy tasks.

Options (detect):
  --base=<ref>          Base ref for diff (default: origin/main).
  --ci                  JSON output.

Options (pending):
  --days=N              Lookback window in days (default: 14).
  --ci                  JSON output.

Options (inject):
  --pr=N                Update PR #N's description (otherwise prints to stdout).
  --base=<ref>          Base ref for diff (default: origin/main).

Options (verify):
  --days=N              Lookback window in days (default: 14).
  --timeout=N           Per-command timeout in milliseconds (default: 30000).
  --dry-run             Print commands without executing them.
  --ci                  JSON output.

Environment for verify:
  Tasks may reference shell variables like $DATABASE_URL, $WIKI_SERVER_URL.
  Set these in the calling shell — verify inherits the parent environment.

Examples:
  pnpm crux gh deploy-tasks detect                # Show tasks for current branch
  pnpm crux gh deploy-tasks pending               # Show unchecked tasks from recent PRs
  pnpm crux gh deploy-tasks inject --pr=3270      # Add tasks section to PR #3270
  pnpm crux gh deploy-tasks verify                # Run verify commands for pending tasks
  pnpm crux gh deploy-tasks verify --dry-run      # Show what would run

system (sys)

System — agents, jobs, sessions, health, audits

agents

Agents Domain — Live agent coordination

Track active Claude Code agents to prevent duplicate work and detect conflicts.

Commands:
  register    Register this agent with the coordination server
  status      Show all active agents and detect conflicts (default)
  update      Update agent state (step, files, status)
  heartbeat   Send a heartbeat to prove the agent is alive
  complete    Mark agent as completed (by ID)
  close       Close current session — auto-discovers agent, marks DB completed, cleans up local files
  sweep       Mark stale agents (no heartbeat for N minutes)

Options:
  --task="..."     Task description (register)
  --branch=X       Git branch (register, update)
  --issue=N        GitHub issue number (register, update)
  --model=X        Claude model (register)
  --step="..."     Current step description (update)
  --status=X       Filter or set: active | completed | errored | stale
  --pr=N           PR number (update, complete)
  --files=a,b,c    Comma-separated files touched (update)
  --reason="..."   Close reason (close)
  --timeout=30     Stale timeout in minutes (sweep)
  --json           JSON output
  --ci             CI-compatible output

Examples:
  crux sys agents register --task="Fix escaping bug" --branch=claude/fix-escaping --issue=42
  crux sys agents status
  crux sys agents update 7 --step="Running tests" --files=src/app.ts,src/lib/utils.ts
  crux sys agents heartbeat 7
  crux sys agents complete 7 --pr=123
  crux sys agents close                    # Close current session (auto-discovers agent)
  crux sys agents close --reason="shipped" # Close with a reason
  crux sys agents sweep --timeout=60

agent-checklist

Agent Checklist — simplified session workflow tracking

Commands:
  init <task>      Generate a checklist (default)
  check <id>...    Check off items by ID
  verify           Auto-run verifiable items
  status           Show progress
  complete         Validate all items checked
  snapshot         Output checks: YAML for session log
  pre-push-check   Auto-verify + warn (called by pre-push hook)

Options:
  --type=TYPE      content | infrastructure | bugfix | refactor | commands
  --issue=N        Auto-detect type from GitHub issue labels
  --na             Mark items as N/A [~] (requires --reason)
  --reason=TEXT    Explanation for N/A
  --ci             JSON output

Examples:
  crux sys agent-checklist init "Add feature" --type=infrastructure
  crux sys agent-checklist init --issue=42
  crux sys agent-checklist check tests-written security
  crux sys agent-checklist check --na fix-escaping --reason "no MDX changes"
  crux sys agent-checklist verify

agent-workspace

Agent Workspace — Local multi-agent directory management

Manages the lw/ directory structure for running multiple Claude Code agents
in parallel, each with its own clone and port configuration.

Directory layout:
  lw/
    .env.base       Shared API keys (single source of truth)
    main/           Primary working copy
    a1/ ... a10/    Agent slots (independent clones)

Commands:
  setup <N>         Initialize agent slot N (clone + .env + .agent-slot)
  sync-env          Regenerate .env for all slots from .env.base
  list              Show all slots with branch, PR, and port info (default)
  clean [N]         Show idle slots; use --force to remove them
  open <N>          Open a tmux window at slot N (--claude to launch claude)
  refresh           Pull latest main in idle slots (on main, clean)
  fix-tabs          Rename tmux tabs to match actual slot + branch

Port assignments (deterministic from slot number):
  Agent N → Next.js on port (3010+N), wiki-server on port (3110+N)
  e.g. slot 1 → 3011/3111, slot 10 → 3020/3120

Options:
  --force    Force re-init (setup) or actually delete (clean)
  --json     JSON output (list)

Examples:
  crux sys agent-workspace setup 3           Create agent slot a3
  crux sys agent-workspace sync-env          Regenerate .env for all slots
  crux sys agent-workspace list              Show all slots and their status
  crux sys agent-workspace clean --force     Remove idle slots (on main, no changes)

jobs

Jobs Domain - Background job queue management

Commands:
  list            List recent jobs (default)
  create <type>   Create a new job
  status <id>     Show single job details
  cancel <id>     Cancel a pending/claimed job
  retry <id>      Reset a failed job to pending
  sweep           Trigger stale job cleanup
  ping            Create a ping job and wait for completion (smoke test)
  stats           Show aggregate job statistics
  batch           Create a batch of content jobs with auto batch-commit
  worker          Run the job worker locally
  types           List registered job handler types
  enqueue-resource-ingest    Bulk-enqueue resource-ingest jobs for unfetched resources
  enqueue-resource-reingest  Enqueue re-ingest jobs for stale resources (by content_lifecycle)

Options:
  --status=X      Filter by status (pending, claimed, running, completed, failed, cancelled)
  --type=X        Filter by job type
  --limit=N       Max jobs to show in list (default: 50)
  --params='{}'   JSON parameters for job creation
  --priority=N    Job priority (higher = more urgent, default: 0)
  --max-retries=N Max retry attempts (default: 3)
  --json          JSON output

Batch Options:
  --tier=X        Tier for content jobs (polish/standard/deep or budget/standard/premium)
  --batch-id=X    Custom batch identifier
  --pr-title=X    Custom PR title for batch commit
  --directions=X  Improvement directions (for batch improve)

Worker Options:
  --max-jobs=N    Max jobs to process (default: 1)
  --poll          Keep polling for new jobs
  --poll-interval=N  Polling interval in ms (default: 30000)
  --verbose       Verbose output

Job Types:
  ping              Smoke test (echoes worker info)
  page-improve      Run content improve pipeline on a page
  page-create       Run content create pipeline for a new page
  batch-commit      Collect completed job results and create a PR
  auto-update-digest  Run news digest and create page-improve jobs
  citation-verify   Verify citations on a page

Examples:
  crux sys jobs                                     List recent jobs
  crux sys jobs list --status=failed                List failed jobs
  crux sys jobs create page-improve --params='{"pageId":"ai-safety","tier":"polish"}'
                                                Create a page improve job
  crux sys jobs batch improve ai-safety miri --tier=polish
                                                Batch improve two pages
  crux sys jobs batch create "New Topic" "Another" --tier=budget
                                                Batch create two pages
  crux sys jobs create auto-update-digest --params='{"budget":30,"maxPages":5}'
                                                Trigger auto-update via jobs
  crux sys jobs worker --type=page-improve --verbose
                                                Run worker locally for page-improve jobs
  crux sys jobs types                               List registered job types
  crux sys jobs stats                               Show job statistics

Enqueue Resource-Ingest Options:
  --dry-run       Show what would be enqueued without creating jobs
  --limit=N       Max resources to enqueue (default: all)

Examples:
  crux sys jobs enqueue-resource-ingest --dry-run    Preview unfetched resources
  crux sys jobs enqueue-resource-ingest              Enqueue all unfetched
  crux sys jobs enqueue-resource-ingest --limit=500  Enqueue first 500

Enqueue Resource Re-ingest Options:
  --dry-run       Show what would be re-ingested without creating jobs
  --limit=N       Max resources to re-ingest (default: all)

  Staleness thresholds (by content_lifecycle):
    ephemeral: 7 days    evergreen: 30 days
    versioned: 90 days   immutable: skip
    (unset):   60 days

Examples:
  crux sys jobs enqueue-resource-reingest --dry-run  Preview stale resources
  crux sys jobs enqueue-resource-reingest            Enqueue all stale
  crux sys jobs enqueue-resource-reingest --limit=100  Enqueue first 100 stale

sessions

Sessions Domain — Create and manage agent session log YAML files

Commands:
  write <title> [options]   Scaffold a session YAML in .claude/sessions/

Options:
  --title=<text>            Session title (alternative to positional arg)
  --summary=<text>          Short summary of what was done
  --model=<name>            Model used (e.g. claude-sonnet-4-6)
  --duration=<text>         Approximate duration (e.g. "~30min")
  --cost=<text>             Approximate cost (e.g. "~$1.50")
  --pr=<url|number>         PR URL or number
  --pages=<id1,id2,...>     Comma-separated wiki page IDs edited
  --sync                    Also sync to wiki-server after writing
  --output=<path>           Custom output path (default: .claude/sessions/<date>_<branch>.yaml)

Examples:
  pnpm crux sys sessions write "Fix citation parser bug"
  pnpm crux sys sessions write "Add dark mode" --model=claude-sonnet-4-6 --duration="~45min"
  pnpm crux sys sessions write "Update AI timelines page" --pages=ai-timelines,ai-forecasting --sync

health

Health Domain — System wellness checks

Commands:
  check           Run all wellness checks (default)

Options:
  --check=<name>  Run only a specific check:
                    server       Server & DB health
                    api          API smoke tests
                    actions      GitHub Actions workflow health
                    frontend     Public frontend availability
                    freshness    Data freshness
                    job-queue    Job queue health
                    pr-quality   PR & issue quality
  --json          JSON output (all results as structured data)
  --report        Aggregate markdown report to stdout
  --auto-issue    Manage GitHub wellness issue (create/update/close)
  --cleanup-labels Auto-remove stale working labels (>8 hours)

Environment:
  LONGTERMWIKI_SERVER_URL        Wiki-server URL (required for most checks)
  LONGTERMWIKI_SERVER_API_KEY    API key for authenticated endpoints
  GITHUB_TOKEN                   GitHub token (required for actions, pr-quality checks)
  WIKI_PUBLIC_URL                Public wiki URL (optional, enables frontend check)

Examples:
  crux sys health                    Run all wellness checks
  crux sys health --check=server     Check server & DB only
  crux sys health --check=actions    Check GitHub Actions workflows only
  crux sys health --check=job-queue  Check job queue health
  crux sys health --json             JSON output for scripting
  crux sys health --report           Full markdown report
  crux sys health --report --auto-issue --cleanup-labels   CI mode (full report + issue management)

audits

Audits Domain — System-level behavioral checking

Track ongoing properties we expect to be true about the system,
plus one-time post-merge check items tied to specific PRs.

Commands:
  list              Show all audit items (default), highlight overdue
  check <id>        Record a check result (with auto-recorded history)
  add "desc"        Add a new audit item via CLI (no manual YAML editing)
  run-auto          Run automated/hybrid checks, show output
  report            Full report for maintenance sweep

Options (list):
  --pending         Only show overdue / never-checked items
  --overdue         Same as --pending
  --category=X      Filter by category (infrastructure, process, feature-health, data-pipeline)
  --strict          Exit non-zero if any items are overdue
  --json            JSON output

Options (check):
  --pass            Mark the check as passing
  --fail            Mark the check as failing
  --notes="..."     Add notes about the check result
  --checked-by="X"  Who checked (agent session ID or "manual") [default: manual]
  --status=X        For post-merge items: verified, failed, wontfix

Options (add):
  --type=X          ongoing or post_merge (required)
  --pr=N            PR number
  --verify="..."    How to verify
  --check="cmd"     check_command for automated checks
  --interval=X      Frequency: daily, weekly, biweekly, monthly [default: weekly]
  --category=X      Category [default: infrastructure]
  --deadline=DATE   Deadline for post_merge [default: 14 days from now]

Registry file: .claude/audits.yaml (checked into git)

Examples:
  crux sys audits                                     # List all, highlight overdue
  crux sys audits list --overdue                      # Only overdue items
  crux sys audits list --strict                       # Exit 1 if overdue items exist
  crux sys audits check groundskeeper-health --pass   # Record a passing check
  crux sys audits add "Verify X works" --type=post_merge --pr=3257
  crux sys audits add "Check Y weekly" --type=ongoing --interval=weekly
  crux sys audits run-auto                            # Run automated checks
  crux sys audits report                              # Summary for maintenance

quality

Data Quality Domain — Track data coverage and sourcing metrics

Commands:
  snapshot        Capture a new data quality snapshot
  history         List recent snapshots (default: last 10)
  latest          Show the most recent snapshot (default command)

Options:
  --json          JSON output
  --limit=N       Number of history entries to show (default: 10)

Examples:
  crux sys quality snapshot           Capture a new snapshot
  crux sys quality history            Show recent snapshots
  crux sys quality latest             Show the latest snapshot
  crux sys quality --json             Latest snapshot as JSON

Cross-cutting commands

These are not part of any group — invoke directly as pnpm crux <command>.

query

Query Domain - Query the wiki-server database

Uses the PostgreSQL database via wiki-server. Faster and more powerful
than grepping YAML files. Requires LONGTERMWIKI_SERVER_URL.

Commands:
  search <query>               Full-text search across all pages (ranked)
  entity <id>                  Structured entity data
  facts <entity-id>            Numeric facts for an entity
  related <page-id>            Related pages via graph query
  backlinks <page-id>          Pages that link here
  page <page-id>               Full page metadata
  recent-changes               Recent session page changes (default: last 7 days)
  recent-edits                 Recent edit log entries (default: last 7 days)
  citations <page-id>          Citation health for a page
  citations --broken           Wiki-wide broken citations
  risk [page-id]               Hallucination risk scores
  stats                        Wiki-wide statistics (default)
  blocks <page-id>             Section structure from block-level IR
  blocks --entity=<id>         Sections referencing a given entity
  blocks --component=<type>    Pages using a component (squiggle, mermaid, etc.)
  blocks --uncited             Sections with >50 words and no citations

Options:
  --json                       Machine-readable JSON output
  --limit=N                    Number of results (default varies by command)
  --days=N                     Days to look back for recent-changes/recent-edits (default: 7)
  --measure=X                  Filter facts by measure name
  --level=high|medium|low      Filter risk by level
  --broken                     Show broken citations (for citations command)
  --summary                    Show LLM summary (for page command)
  --min-words=N                Min word count for --uncited filter (default: 50)

Examples:
  crux query search "compute governance"
  crux query search "MIRI funding" --limit=5
  crux query entity anthropic
  crux query entity anthropic --json
  crux query facts anthropic
  crux query facts openai --measure=employees
  crux query related scheming
  crux query backlinks rlhf
  crux query page scheming
  crux query recent-changes --days=7
  crux query recent-edits --days=3 --limit=50
  crux query citations scheming
  crux query citations --broken --limit=10
  crux query risk scheming
  crux query risk --level=high --limit=20
  crux query stats
  crux query blocks anthropic
  crux query blocks --entity=anthropic
  crux query blocks --component=squiggle
  crux query blocks --uncited --min-words=100

context

Context Domain - Assemble research bundles for Claude Code sessions

Eliminates the 5-15 manual tool calls needed to gather background context
at the start of a session. Each command queries the wiki-server and GitHub
to produce a single structured markdown file.

Commands:
  for-issue <N>         Context bundle for GitHub issue N
  for-page <page-id>    Context bundle for a wiki page
  for-entity <id>       Context bundle for an entity
  for-topic "topic"     Context bundle for a free-text topic

Options:
  --output=<path>       Output file path (default: .claude/wip-context.md)
  --print               Write to stdout instead of a file
  --json                Machine-readable JSON output (implies stdout)
  --ci                  Alias for --json (CI-friendly machine-readable output)
  --limit=N             Max search results for for-topic (default: 10, max: 20)

Notes:
  - for-page, for-entity, for-topic require LONGTERMWIKI_SERVER_URL
  - for-issue requires GITHUB_TOKEN and optionally LONGTERMWIKI_SERVER_URL
  - All commands degrade gracefully when the wiki-server is unavailable

Output includes:
  for-issue:   Issue body, related wiki pages, related entities
  for-page:    Page metadata + LLM summary, related pages, backlinks, citations
  for-entity:  Entity profile, key facts, related entities, pages mentioning it
  for-topic:   Top matching pages (ranked), related entities

Examples:
  crux context for-issue 580
  crux context for-issue 580 --output=my-context.md
  crux context for-page scheming
  crux context for-page deceptive-alignment --print
  crux context for-entity anthropic
  crux context for-entity openai --output=openai-context.md
  crux context for-topic "AI safety compute governance"
  crux context for-topic "RLHF alignment tax" --limit=15