Inspiration
Popular alternate history media, such as AlternateHistoryHub, RealLifeLore, and Kurzgesagt, demonstrates that exploring counterfactuals helps people understand why historical decisions mattered. Standard historical articles and textbooks, however, present history as static lists of dates and facts, making it difficult to explore causal relationships.
Chronicle was built to make historical text interactive while keeping it grounded in evidence. It allows users to modify key decisions, simulate plausible historical divergence, and analyze outcomes using explicit confidence bounds, system-level impact analysis, and source citations.
What It Does
Chronicle turns static historical articles into interactive causal models.
- Curated Records & Live Import: Includes over 100 pre-loaded, sourced historical records (such as the Cuban Missile Crisis, Chernobyl, Apollo 13, and the Fall of the Berlin Wall) and features a live Wikipedia importer.
- Structured Context: Every record provides a concise briefing, the full source text, a contextual overview (actors, timeline, key terms), and an evidence pack.
- Decision Anchoring & Editing: Key decision points are anchored directly to specific passages. Users can modify predefined hinge points or rewrite arbitrary passages. Edits are evaluated and classified (Historically Supported, Historically Plausible, Weak Historical Evidence, or Highly Speculative) with visual diffs.
- Counterfactual Synthesis Engine: Simulating an edit initiates a staged process (validation, world-state reconstruction, causal propagation, cross-system analysis, confidence calibration, and timeline construction) that streams a bounded consequence graph across horizons ranging from Immediate to Modern Day.
- Evidence & Confidence Tracking: Each node in the consequence graph includes a confidence score, evidence references, affected domains (political, economic, military, social, diplomatic, scientific), explicit assumptions, and alternative outcomes. Confidence naturally decays further along the branch, and generation halts when evidence becomes insufficient.
- Divergence Comparison: The original factual record remains visible alongside the conditional branch, allowing users to inspect individual nodes, follow geographical impacts on a map, and monitor confidence trends over time.
How We Built It
Chronicle was built using Next.js 16 (App Router), React 19, TypeScript, and Tailwind CSS, backed by a server-authoritative API architecture.
Built with Codex and GPT-5.6. We built Chronicle with Codex and GPT-5.6 throughout. GPT-5.6 is the reasoning engine described below: it generates the consequence graphs under a strict schema and may only cite the evidence it is handed. Codex did most of the actual construction. It scaffolded the Next.js architecture and wrote the article reader, the Wikipedia parser, the synthesis engine, and the safety pipeline, and we iterated on the design and the API integration with it screen by screen. We also used Codex beyond writing code: it ran security passes over the repository (threat modeling, an ownership map of the codebase, and a framework-specific best-practices review), and a separate reliability pass that made thumbnail fetching cacheable and bounded, gave imported decisions content-derived IDs so a selection cannot point at the wrong decision, capped the in-memory caches, and hardened the HTML parser against malformed markup. It ran several of these as parallel subagents for design, review, and implementation. Where it helped most was as a reviewer of its own output, not just as a generator.
System Architecture & Safety Pipeline. All state-changing requests pass through a server-side pipeline enforcing security checks, rate limits, and JSON schema validation before interacting with the LLM layer.
Reasoning Engine. The counterfactual engine constructs structured prompts containing the historical text, the user's edited premise, evidence labels, and strict behavioral constraints. Prompts instruct the model to reason across multiple domains (political, economic, military, diplomatic), use cautious language, limit node outputs to bounded sets, and cite only provided evidence labels. The API streams NDJSON responses to render the synthesis process node-by-node.
Validation & Citation Verification. Before returning data to the client, the server validates structural correctness (verifying graph acyclicity, node IDs, and temporal sequencing) and checks that all generated citations match the input evidence pack. Unverified citations are discarded. If validation fails, the pipeline falls back to deterministic pre-reviewed branches to prevent invalid outputs.
Content Parsing & Article Readiness. A custom streaming HTML parser extracts clean main-article prose from live Wikipedia pages, stripping navigation, infoboxes, hatnotes, and edit chrome while generating stable IDs for paragraph-level anchor targeting. Imported articles pass through a Historical Readiness Score assessing topic scope, citation density, and structural integrity before enabling simulation.
Security & Cost Control.
- Prompt Isolation: User edits and scraped text are passed strictly as structured data to prevent prompt injection.
- Content Moderation: Edit premises pass through moderation checks tailored to allow historical study (for example, conflict or geopolitical crisis) while blocking abuse.
- Authentication & Rate Limiting: Features HMAC-signed validation grants, double-submit CSRF tokens, origin verification, and a Redis-compatible rate limiter with atomic counters and an in-memory fallback.
Challenges We Ran Into
- Enforcing Model Restraint: Preventing the model from generating overly speculative narratives required strict prompt constraints, automated citation validation, and decaying confidence bounds.
- Handling Arbitrary Web Markup: Parsing diverse and inconsistent Wikipedia HTML reliably required a robust streaming parser to prevent layout issues or memory overuse on large articles.
- Prompt Injection Risks: Third-party articles and user inputs could contain adversarial instructions, requiring complete isolation between input data and model system prompts.
- System Resilience: Ensuring the application gracefully falls back to deterministic paths if API calls experience latency or stream interruptions.
Accomplishments
- Developed a counterfactual synthesis engine that visualizes dynamic historical branching while enforcing strict citation rules and confidence decay.
- Implemented a production-grade safety layer including prompt isolation, HMAC session tokens, SSRF-hardened fetching, and validation-before-repair passes.
- Created an end-to-end Wikipedia parser and readiness scoring engine capable of ingesting arbitrary articles for counterfactual analysis.
What We Learned
- Making confidence bounds explicit and halting generation when evidence thins out is essential for maintaining analytical credibility in AI tools.
- Treating all external web content and user inputs as untrusted data from the ground up simplifies system security architecture.
- Using Codex in distinct roles, such as threat modeling, code review, and reliability hardening, produced noticeably better results than treating it as a plain code generator.
What's Next for Chronicle
- Classroom Mode: Tools for educators to assign record sets, track student counterfactual arguments, and host structured group analysis.
- Dynamic Shelf Seeding: Automatically identifying trending historical queries to populate the pre-loaded library based on search interest.
- Multi-Source Integration: Expanding beyond Wikipedia to ingest primary source archives and multi-perspective historical documents.
- Branch Comparison & Socratic Mode: Allowing side-by-side evaluation of multiple counterfactual branches and interactive interrogation of specific output nodes.
Built With
- codex
- eslint
- framer-motion
- gpt-5.6
- ndjson
- next.js
- openai
- openrouter
- playwright
- react
- tailwindcss
- typescript
- vitest
- wikipedia
Log in or sign up for Devpost to join the conversation.