Digital-twin medicine
Model a patient or clinical workflow as a SubjectConfig; replay an intervention with a different physician HEXACO profile and see the divergence on outcome metrics. The paracosm/digital-twin subpath is the canonical entry.
PARACOSM
Type a scenario in plain English. Paracosm runs it from one shared start and changes one thing between the timelines, such as a leader's personality or an event at a past turn. An AI event director writes each timeline's unscripted crises from what has happened in it so far, so you can compare where each one ends up and why.
Run a what-ifA free run, about 3½ minutesnpm install paracosm
A saved run
REPLAY
A replay of a finished run. No model is called.
Same world, three actors — see how each one's traits drive identical state to different futures. Seven entry points, one engine: brief, JSON contract, granular client, fork-and-replay counterfactuals, pluggable trait models, HTTP, CLI. Every path returns the same Zod-validated RunArtifact.
A world model is software that represents how some slice of reality changes over time. AI agents need them to test decisions before making them: rehearse the move, watch what unfolds, decide whether to commit.
The phrase has been overloaded since 2024. Older lineages do most of the work: Dreamer and MuZero learn dynamics in latent space; MuJoCo, Brax, and Isaac Sim simulate physics deterministically. Both have been the substrate for robotics research for years. Newer entrants (Sora, Genie 3, Marble) generate pixels — a "world simulator" framing the older lineage rejects (LeCun: pixel generation here is "not only wasteful, it's doomed to failure"). Paracosm sits in the structured / LLM lineage: typed JSON state, deterministic kernel, LLM reasoning lane on top. The output is a RunArtifact: each turn's metrics, decisions, specialist analyses, citations, forged tools. Pixels are what humans watch. State is what agents reason inside.
Surveyed in the ACM CSUR 2025 world-model survey and the robotics-focused World Model for Robot Learning survey, which is explicit that the resurgence comes from model-based RL plus physics simulation, not pixel generation. Critique: Xing 2025. LLM-world-model implementation anchor: Yang et al, 2026 — evaluates LLM-based world models through policy verification, action proposal, and policy planning.
Paracosm is a structured, LLM-driven, counterfactual world simulator. It compiles a prompt, document, or URL into a typed scenario, runs it through a deterministic seeded kernel coupled with an LLM reasoning surface, and emits one universal Zod-validated RunArtifact across turn-loop civ sims, batch-trajectory digital twins, and batch-point forecasts. The category is named in Xing 2025, catalogued in the ACM CSUR 2025 survey, and given counterfactual semantics by Kirfel et al, 2025.
wm.replay(artifact) re-runs each between-turn step from the state a saved run started it from, with no model call, and checks the state the run saved after it.ScenarioPackages through a compile pass. A grounding step then runs entity-derived web search across Serper and Tavily in parallel, dedupes citations by URL, and attaches them to the scenario before any actor is generated. Every commander decision and specialist note in the run can cite a real source.shelter_priority_score, supply_shortage_severity_score, hurricane_after_action_assessment.wm.forkFromArtifact(trunk, atTurn).simulate(altLeader) branches a counterfactual from any captured turn.Inspired by the long arc of world-model research — Ha & Schmidhuber's World Models (2018) dream-state agents, the deterministic-microworld tradition behind Sugarscape and Schelling, the agent-based modeling lineage from Conway and Wolfram, and the structured-prompting trajectory traced by Kirfel et al's counterfactual world simulation models. Where prior work used hand-coded rules, learned latents, or unstructured emergence, paracosm uses an LLM as the world's reasoning surface and a typed kernel as its mutable spine — the result is a deterministic, replayable, citation-grounded simulator that fits both research and product use.
Full taxonomy mapping with adjacent-category citations lives at docs/positioning/world-model-mapping.md.
A ScenarioPackage is a JSON file. It declares departments, metrics, crisis templates, progression rules, and milestone events; the engine reads the package, populates the world, and runs the simulation. All seven below are JSON files in the repository's scenarios/ folder; the npm package exports two of them, Mars Genesis and Lunar Outpost, as marsScenario and lunarScenario. Switching scenarios takes no engine code changes. Compile your own from a brief, URL, or seed prompt with compileScenario().
paracosm/digital-twin: subject + intervention configs feed the same kernel, and the artifact carries the per-timepoint chart so a different physician HEXACO profile produces a measurably different trajectory.
Any domain where testing decisions before making them reduces risk: digital-twin medicine, corporate strategy, policy simulation, wargaming, game design, alignment red-teaming. The engine is domain-agnostic; the scenario contract names the world.
Model a patient or clinical workflow as a SubjectConfig; replay an intervention with a different physician HEXACO profile and see the divergence on outcome metrics. The paracosm/digital-twin subpath is the canonical entry.
Run M&A scenarios, market-entry plays, or workforce-reduction contingencies against multiple leadership profiles. Different CEO personalities, same starting conditions, measurable trajectory differences.
Model a policy rollout (tax change, healthcare reform, regulation) as the intervention; agencies and citizens as the population. Replay any past run to check kernel determinism after a code change.
Defense and intelligence: explore how different commander profiles produce divergent crises and divergent responses from identical starting conditions. The deterministic kernel anchors replay; the LLM Event Director reads each leader's HEXACO + accumulated state, so the events themselves diverge from turn 1.
Generate procedural NPC civilizations and emergent narratives. Forge tools at runtime so departments compute their own balance calculators in a QuickJS WebAssembly sandbox.
Pressure-test agent behavior under leader profiles that emphasize specific HEXACO traits. Reproducible by construction; replay to verify the same prompt and seed yields the same trajectory.
Paracosm is open source and its dashboard is live. Try a run in the browser, install the package from npm, or read the API references.
Open the hosted demo at paracosm.agentos.sh/sim, give it a brief, a URL or a PDF, and watch each actor's run play out turn by turn. It asks for no account. On the host's API keys a run is capped in size and each IP address has a daily limit; your own OpenAI or Anthropic key, added in Settings, lifts both.
ESM for Node 22 or newer, under Apache-2.0. Import run, runMany or WorldModel and call them with your own OpenAI or Anthropic key. Its CLI is included, and npx paracosm dashboard serves this dashboard from your machine at http://localhost:3456.
The API reference covers the package's six entry points: paracosm and its compiler, schema, swarm, digital-twin and core subpaths. The HTTP API reference documents the dashboard server's /api/v1 routes with their request and response shapes and status codes. The Cookbook walks through the SDK with input and output JSON captured from real runs.
Paracosm is built by Frame.dev. Sister projects: AgentOS (the agent runtime paracosm runs on) and Wilds.ai (AI-NPC game worlds).
For teachers: run a simulation yourself and show it to your class, or share its replay link. A replay only plays back a finished run, and sends nothing new to an AI model.
Private deployment, custom scenarios, government and defense engagements, investment inquiries.
[email protected]All four are TypeScript/Python agent frameworks shipping on npm or PyPI. They overlap on "multi-agent orchestration" but diverge sharply on what they treat as the core abstraction: a chat graph (CrewAI, AutoGen), a state graph (LangGraph), or a deterministic structured world model (paracosm).
| Capability | paracosm | AutoGen | CrewAI | LangGraph |
|---|---|---|---|---|
| Core abstraction | Structured world model with seeded kernel + per-turn state | Multi-agent chat orchestration | Role-based agent crew with sequential or hierarchical tasks | State graph of agent nodes with explicit edges |
| Determinism | Seeded kernel: the same roster and the same dice at a fixed seed (Mulberry32); model calls are not deterministic | None — LLM non-determinism throughout | None — LLM non-determinism throughout | Partial — graph control flow is deterministic, agent calls are not |
| Counterfactual replay | wm.forkFromArtifact(artifact, turn) branches from any captured turn; wm.replay(artifact) re-runs each between-turn step and checks the state saved after it |
Not supported | Not supported | Not supported (rerun the graph from scratch) |
| Fork at past state | wm.forkFromArtifact(artifact, atTurn) |
Not supported | Not supported | Time-travel via persistent checkpoints (langgraph-checkpoint) |
| Personality model | HEXACO (humans) + ai-agent + pluggable trait registry | Per-agent system prompt only | Per-agent role + goal + backstory text | Per-agent system prompt only |
| Runtime tool forging | Yes — tool generation sandboxed in QuickJS WebAssembly, judge-validated | Function-calling only — predefined tools | Function-calling only — predefined tools | Function-calling only — predefined tools |
| Universal output contract | Zod-validated RunArtifact across all simulation modes |
Per-agent message log, no unified schema | Task outputs in agent-specific shape | Final state object (graph-defined) |
| Digital-twin pattern | First-class wm.intervene({ subject, intervention, actor }) |
Not supported (no subject/intervention primitive) | Not supported | Not supported (build it yourself with state nodes) |
| Compile from prose | WorldModel.fromPrompt — brief or URL → typed scenario |
Not supported (hand-author agents + graph) | Not supported (hand-author crew + tasks) | Not supported (hand-author state graph) |
| License | Apache-2.0 | MIT | MIT | MIT |
| Language | TypeScript (Node 22+, Bun, Deno) | Python · .NET | Python | Python · TypeScript |
Everything you'd want to know about the engine, the kernel, the trait models, and the research it builds on. Click any question to expand.
npm install paracosm, Apache-2.0). You define or ground a world as a ScenarioPackage: departments, metrics, crisis templates, progression hooks. Paracosm runs a scenario as timelines from the same seed, roster and dice. An LLM event director writes each timeline’s unscripted crises from what happens in it, and you can compare outcomes after changing one thing, such as who leads or an event at a past turn. The npm package exports two scenarios, Mars Genesis and Lunar Outpost, and the repository's scenarios/ folder holds five more; you can compile new ones from a JSON draft, prompt, brief, or URL.
RunArtifact.
wm.replay(artifact) re-runs each between-turn step from the state the run started it from, without calling a model, and compares the result under canonical JSON with the state the run saved right after that step, before the turn's decisions; matches=false names the first divergence path. A run saved before the turn loop kept those snapshots gets an error saying replay cannot verify it, never a match or a mismatch; the FAQ says what replay proves. wm.forkFromArtifact(trunk, atTurn).simulate(altLeader) branches a counterfactual from any captured turn, the CWSM pattern.
WorldModel.replay(), canonicalJson, firstDivergence in paracosm/runtime/world-model.eval, Function, require, dynamic import, process, child_process or destructive fs.* calls, and paracosm grants forged code no network, file or crypto access. An LLM judge reviews the output against the specialist's stated intent — match approves, mismatch rejects. Approved tools land in a discoverable registry that subsequent turns and other actors pull from. Reuse via call_forged_tool costs tens of tokens; fresh forges cost full LLM tokens for proposal + body + scaffolding + judge. After turn three, most decisions invoke a previously-forged tool and total run cost flattens.
EmergentCapabilityEngine + EmergentJudge + ForgeToolMetaTool; the forged code runs in AgentOS's QuickJSExecutor behind paracosm's limits (forged-code-executor.ts), a WebAssembly instance of its own for each call.TraitModel registry with two built-ins: hexaco (Ashton-Lee six-axis human personality) and ai-agent (six axes for AI-system leaders: exploration, verification-rigor, deference, risk-tolerance, transparency, instruction-following). Each model declares its axes, drift table, and prompt cues. Custom models register in a single call: traitModelRegistry.register({...}). The same agent under two different leaders, on the same seed, becomes a measurably different entity by turn 12.
paracosm/engine/traitsWebSearchService fans out to Firecrawl, Tavily, Serper, and Brave in parallel; results pass through semantic dedup, RRF fusion, and Cohere Rerank v3.5 for neural relevance scoring. The resulting KnowledgeBundle ingests into an AgentOS sqlite-backed memory store. Every department analysis can recall semantically and cite the same sources you fed in. The orchestrator guarantees provenance: when the LLM omits citations, the research packet is auto-attached so the report always carries the sources the agent saw. Compile cost is roughly $0.10 and caches to disk by seed signature.
paracosm compile --seed-text / --seed-url · Library: compileScenario() / WorldModel.fromPrompt() in paracosm/engine/compiler · Reranker: Cohere Rerank v3.5SimulationKernel, SeededRng, ScenarioPackage types, Effect/Metric registries (~71 source files, TypeScript, Mulberry32, Apache-2.0). Runtime layer orchestrates simulations via 6 scenario hooks: Orchestrator, Director, Departments, Batch Runner, scenario-agnostic via progression and prompt hooks (~43 files, AgentOS, generateText(), SSE). CLI layer serves the dashboard, batch runner, and HTTP server (~30 files plus the React/Vite/Tailwind dashboard). The engine never imports from runtime; the runtime never imports from CLI. Underlying it all: @framers/agentos — agent() API, EmergentCapabilityEngine, EmergentJudge, ForgeToolMetaTool, AgentMemory.
paracosm/digital-twin subpath is the curated entry: supply a SubjectConfig + InterventionConfig, get the same Zod-validated RunArtifact shape with artifact.subject and artifact.intervention populated for traceability. artifact.trajectory.timepoints[t].worldSnapshot carries per-timepoint metrics (e.g. HbA1c, weight, BMI for a clinical scenario; engagement, churn, ARPU for a product scenario). The kernel is domain-agnostic — the scenario contract names the world. Worked examples: Maria Chen, T2D, 12-week semaglutide protocol for clinical, SaaS mid-tier pricing introduction for product, Coastal congestion-pricing pilot for policy.
DigitalTwin.fromJson(scenarioJson).intervene({ subject, intervention, actor }) · Live route: POST /api/quickstart/simulate-intervention · Counterfactual semantics: Kirfel et al, AI & Ethics (2025); AXIS interrogation framework: arXiv 2505.17801 (May 2025).docs/COOKBOOK.md. One run threads through seven public surfaces: prompt-to-world, quickstart parallel leaders (runMany), branch at turn N (wm.forkFromArtifact), kernel replay (wm.replay), HTTP /simulate endpoint, digital-twin intervene(), batch dispatch (runBatch). Every JSON committed. Plus scripts/cookbook-e2e.ts in the repo runs the full pipeline against your scenario / leader profiles / seed and captures live fingerprints + per-metric deltas.
runSimulation and WorldModel.simulate; WorldModel.quickstart and the compile command default to Anthropic. The default OpenAI models for runSimulation and WorldModel.simulate are GPT-5.4 for the departments, GPT-4o for the commander, GPT-5.4 mini for the Event Director and the tool judge, and GPT-5.4 nano for agent reactions; the dashboard's model picker keeps those but sets the commander to GPT-5.4 mini. On Anthropic, Claude Sonnet 4.6 for the departments and Claude Haiku 4.5 for every other role. The hosted demo, on the host's keys, runs GPT-5.4 mini for the commander, the departments, the tool judge and the verdict, and GPT-5.4 nano for the Event Director and agent reactions. Each role (commander, departments, director, judge, agent reactions) is configurable independently. Cost presets quality and economy bundle sensible defaults; per-role overrides win. Paracosm auto-detects which API key is present in env and falls back between providers. Mini models are available for cost iteration but produce lower-quality structured output and trip the judge more often.
economy and a few dollars under quality. Compile-from-seed adds ~$0.10 (cached to disk by seed signature). Tool reuse after turn three is the largest cost lever. Anthropic's prompt cache TTL hits the shared system prefix from turn 2 onward (10× input-cost reduction); OpenAI auto-caches any prompt over 1024 tokens. A run's cost field reports its spend in US dollars and its number of model calls; the cost breakdown on each streamed event carries the tokens, the prompt-cache reads and writes, and the USD the cache saved, per stage.
ScenarioPackage in TypeScript with custom hooks for progression, crisis generation, milestones, and politics — full control. (2) Write a scenario JSON draft and run it through compileScenario() — zero-code authoring, $0.10 per compile, caches to disk. (3) Pass a brief, paper, or URL to WorldModel.fromPrompt() and let an LLM draft the JSON contract first — the path the live demo uses. All three produce the same canonical ScenarioPackage and route through the same runtime. An Antarctic station, a submarine crew, a corporate org, a generation ship: different world contract, same engine, different future.
This page, the dashboard at /sim and the API docs use up to three tools to understand which pages people visit and where they get stuck. The count runs before you answer. A bar at the bottom of the page offers Reject all, Choose and Accept all. Analytics choices, in the footer of every page, opens the same choices again, and this browser keeps your answer for each purpose.
_ga and _ga_*, tell visitors and their visits apart. Google signals and ad personalization are off for this site. Turning it off removes its cookies from this site in your browser._clck and _clsk plus Microsoft's own, recognize a returning browser and connect the pages of one visit. Turning it off removes _clck and _clsk from this site in your browser.Viewing the Run screen, opening a leader’s full prompt, pressing Start, a run opening or failing to start, seeing the daily limit and choosing a replay or Settings at that limit each send an event. Plausible counts these actions while count is on. Google Analytics 4 measures them with your permission. Microsoft Clarity marks them by name when you allow recording.
On this page, pressing Run a what-if, Demo or the replay’s link to the demo, copying the install line, the saved run starting by itself or reaching its verdict, and playing, pausing or stepping it each send an event. Plausible counts these actions while count is on. Google Analytics 4 measures them with your permission. Microsoft Clarity marks them by name when you allow recording. Switching between the light and dark looks sends an event to Plausible and Google Analytics 4 alone.
Opening How it works, switching between the two leaders and choosing a section also send events to Plausible while count is on and to Google Analytics 4 with your permission. The event fields carry only fixed choices and ranges for the number of leaders. The count also sends the User-Agent and IP address described above.
If your browser sends a privacy signal, Global Privacy Control or Do Not Track, these pages show no bar and run none of the three tools, the count included. Analytics choices then says so in place of the choices.
Strictly necessary, and always on: the dashboard sets two cookies of its own. paracosm_scenario is set when you pick a scenario or start a run in a scenario other than the one you picked. It holds only that scenario's id and lasts 30 days, so the dashboard reopens on your pick. paracosm_visitor holds a random id this server gives your browser the first time you open the dashboard. It lasts 30 days and identifies your browser to this server alone.
To run a simulation, we send its prompts to OpenAI or Anthropic, depending on the model used. This includes any orders you write for a leader and, in a Digital Twin run, the subject and the change you describe. A Digital Twin run is not saved for replay. Our server holds its events, which can repeat what you typed, until you start another run or clear it, or until nobody has read or watched it for 30 minutes. Until then anyone who has that run's key can read them.
Our server saves finished runs for replay. A saved run includes the scenario, its leaders, the sequence of turns, decisions and results. It can also hold the brief you started from. Your visitor cookie lets this browser list your saved runs. Everyone can also see runs our team has pinned.
Anyone with a replay link can watch that run and see what it shows, including any orders you wrote that appear in the replay. For your own unpinned run, the original brief is visible only to your browser.
We keep your saved replay until ten newer runs are saved for your browser. The demo has room for 50 unpinned replays in total, so a replay can be removed sooner. Team runs that we pin stay outside these limits.
This browser keeps a separate history of runs on this device. Clearing this site's data in your browser removes that local history. Saved replays on our server follow the limits above.
To apply its usage limits, the server keeps your IP address with a count of your requests: runs, Digital Twin runs included, compiles, chat messages, run imports and other Quickstart requests such as generating leaders, grounding a scenario or reading a page. It counts full prompt reads separately by IP address in memory for one minute. It counts a compile on your own model key too when that compile uses this site's web search or reads a page through it. Each count ends at the next UTC midnight, or at the next UTC hour for chat. The server deletes ended counts from memory at its hourly cleanup and then updates its saved copy. It also clears ended counts from the saved copy when it starts. It holds your address to limit simultaneous runs on your own model key and open live views, until the run is dropped or the view closes.
If you add API keys, we use them for the runs and chats you start. This tab keeps them until it closes or you select Forget my keys. Our server holds them in memory while in use and for up to 30 minutes afterward, then drops them. Each key is sent only to the provider it belongs to.
Paracosm is for a general audience. It is not directed to children under 13, and we do not knowingly collect personal information from them. If you believe a child under 13 has used it, write to [email protected] and we will delete what we hold.
A copy of Paracosm you install from npm or run from the repository loads none of these tools. Questions about this site's data go to [email protected].
If you add your own API key, you confirm it is yours and that your provider's terms let you use it here.
Under 18? You need a parent's or guardian's permission to use this. Not for children under 13.