Add canonical facts system and factor component library#4
Open
Conversation
- Copy canonical fact YAML files (anthropic, openai, sam-altman, jaan-tallinn) to apps/longterm-next/src/data/facts/ - Create facts.ts module with self-contained YAML loading, numeric parsing, expression evaluation, and computed fact resolution (ported from build-data.mjs) - Update data/index.ts to load facts from local YAML files instead of database.json, making longterm-next fully self-sufficient for canonical facts - Port 5 missing Factor components: FactorKeyDebates, FactorRatings, FactorScope, FactorRelatedContent, FactorRelationshipDiagram (with FullModelDiagram) - Register all new Factor components in mdx-components.tsx and remove from stubs - Add fact-consistency validation test to detect hardcoded values that should use the <F> component - Update Facts Dashboard page to reference new local file location https://claude.ai/code/session_019sD1zo6gTDKeJCWc7Rz7u5
Remove "use client" directive from FactorRelationshipDiagram since it imports fs-based parameter-graph-data functions. The component only computes a Mermaid chart string (no hooks/state/browser APIs) and passes it to MermaidDiagram, which is the actual client component. https://claude.ai/code/session_019sD1zo6gTDKeJCWc7Rz7u5
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a comprehensive canonical facts system for the longterm-next application, along with a new library of reusable factor-related MDX components. The facts system reads from YAML files, parses numeric values, and evaluates computed expressions at build time. The new components enable rich, data-driven content in MDX pages.
Key Changes
Canonical Facts System (
src/data/facts.ts)src/data/facts/*.yamlfiles instead of being synced from the database{anthropic.valuation} * {jaan-tallinn.anthropic-ownership})fsFact Data Files
anthropic.yaml: Valuation, revenue, margins, team compositionopenai.yaml: Investment, valuation, revenue, model performance metricssam-altman.yaml: Net worth, investments, company metricsjaan-tallinn.yaml: Ownership stakes with computed values based on Anthropic valuationNew Factor Components
Six new MDX-compatible components for displaying structured factor data:
FactorKeyDebates: Displays key debates/disagreements from YAML with topic and core questionsFactorRatings: Shows 0-100 scores for changeability, x-risk impact, trajectory impact, and uncertainty with interpretationsFactorScope: Renders scope definitions with includes/excludes sectionsFactorRelatedContent: Links to related risks, responses, models, and cruxesFactorRelationshipDiagram: Mermaid-based flowchart showing factor relationships (incoming/outgoing/both directions)FullModelDiagram: Complete model visualization showing all factors, scenarios, and outcomesFactorStatusBadge: Status indicator component (stub)All components support both direct data props and dynamic lookup via
nodeId+subItemLabel.Integration Updates
mdxComponents.tsto register new components and remove stubs forFactorRelationshipDiagramandFullModelDiagramsrc/data/index.tsto load facts from YAML files instead of databaseTesting
fact-consistencytest rule that validates hardcoded fact values in content against canonical facts<F>component for fact referencesImplementation Details
eval()) supporting+,-,*,/, parentheses, and fact referencesFiles Modified
apps/longterm-next/src/app/internal/facts/page.tsxapps/longterm-next/src/components/mdx-components.tsxapps/longterm-next/src/data/index.tsapps/longterm-next/src/lib/__tests__/validate-content.test.tsFiles Added
apps/longterm-next/src/data/facts.ts(445 lines)apps/longterm-next/src/components/wiki/FactorKeyDebates.tsxapps/longterm-next/src/components/wiki/FactorRatings.tsxhttps://claude.ai/code/session_019sD1zo6gTDKeJCWc7Rz7u5