paracosm 0.7.407 → 0.7.409

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +77 -38
  2. package/dist/cli/pair-runner.d.ts +17 -0
  3. package/dist/cli/pair-runner.d.ts.map +1 -1
  4. package/dist/cli/pair-runner.js +81 -0
  5. package/dist/cli/pair-runner.js.map +1 -1
  6. package/dist/cli/server-app.d.ts.map +1 -1
  7. package/dist/cli/server-app.js +47 -6
  8. package/dist/cli/server-app.js.map +1 -1
  9. package/dist/cli/sim-config.d.ts +23 -0
  10. package/dist/cli/sim-config.d.ts.map +1 -1
  11. package/dist/cli/sim-config.js +10 -1
  12. package/dist/cli/sim-config.js.map +1 -1
  13. package/dist/engine/compiler/scenario-fixture.d.ts +6 -4
  14. package/dist/engine/compiler/scenario-fixture.d.ts.map +1 -1
  15. package/dist/engine/compiler/scenario-fixture.js +21 -0
  16. package/dist/engine/compiler/scenario-fixture.js.map +1 -1
  17. package/dist/engine/compiler/state-shape-block.d.ts +7 -11
  18. package/dist/engine/compiler/state-shape-block.d.ts.map +1 -1
  19. package/dist/engine/compiler/state-shape-block.js +14 -15
  20. package/dist/engine/compiler/state-shape-block.js.map +1 -1
  21. package/dist/engine/compiler/validate.d.ts.map +1 -1
  22. package/dist/engine/compiler/validate.js +2 -0
  23. package/dist/engine/compiler/validate.js.map +1 -1
  24. package/dist/engine/core/kernel.d.ts +38 -0
  25. package/dist/engine/core/kernel.d.ts.map +1 -1
  26. package/dist/engine/core/kernel.js +142 -11
  27. package/dist/engine/core/kernel.js.map +1 -1
  28. package/dist/engine/core/rng.d.ts +10 -2
  29. package/dist/engine/core/rng.d.ts.map +1 -1
  30. package/dist/engine/core/rng.js +20 -6
  31. package/dist/engine/core/rng.js.map +1 -1
  32. package/dist/engine/core/snapshot.d.ts +53 -0
  33. package/dist/engine/core/snapshot.d.ts.map +1 -0
  34. package/dist/engine/core/snapshot.js +6 -0
  35. package/dist/engine/core/snapshot.js.map +1 -0
  36. package/dist/engine/core/state.d.ts +14 -0
  37. package/dist/engine/core/state.d.ts.map +1 -1
  38. package/dist/engine/schema/artifact.d.ts +4 -0
  39. package/dist/engine/schema/artifact.d.ts.map +1 -1
  40. package/dist/engine/schema/primitives.d.ts +4 -0
  41. package/dist/engine/schema/primitives.d.ts.map +1 -1
  42. package/dist/engine/schema/primitives.js +13 -0
  43. package/dist/engine/schema/primitives.js.map +1 -1
  44. package/dist/engine/schema/stream.d.ts +2 -0
  45. package/dist/engine/schema/stream.d.ts.map +1 -1
  46. package/dist/engine/schema/stream.js +14 -0
  47. package/dist/engine/schema/stream.js.map +1 -1
  48. package/dist/runtime/agent-memory.d.ts +1 -1
  49. package/dist/runtime/agent-memory.d.ts.map +1 -1
  50. package/dist/runtime/agent-memory.js +4 -2
  51. package/dist/runtime/agent-memory.js.map +1 -1
  52. package/dist/runtime/agent-reactions.d.ts +6 -1
  53. package/dist/runtime/agent-reactions.d.ts.map +1 -1
  54. package/dist/runtime/agent-reactions.js +3 -1
  55. package/dist/runtime/agent-reactions.js.map +1 -1
  56. package/dist/runtime/build-artifact.d.ts +27 -2
  57. package/dist/runtime/build-artifact.d.ts.map +1 -1
  58. package/dist/runtime/build-artifact.js +26 -3
  59. package/dist/runtime/build-artifact.js.map +1 -1
  60. package/dist/runtime/chat-agents.d.ts +9 -1
  61. package/dist/runtime/chat-agents.d.ts.map +1 -1
  62. package/dist/runtime/chat-agents.js +13 -3
  63. package/dist/runtime/chat-agents.js.map +1 -1
  64. package/dist/runtime/contracts.d.ts +25 -7
  65. package/dist/runtime/contracts.d.ts.map +1 -1
  66. package/dist/runtime/orchestrator.d.ts +27 -0
  67. package/dist/runtime/orchestrator.d.ts.map +1 -1
  68. package/dist/runtime/orchestrator.js +90 -28
  69. package/dist/runtime/orchestrator.js.map +1 -1
  70. package/dist/runtime/reaction-step.d.ts +8 -0
  71. package/dist/runtime/reaction-step.d.ts.map +1 -1
  72. package/dist/runtime/reaction-step.js +1 -0
  73. package/dist/runtime/reaction-step.js.map +1 -1
  74. package/dist/runtime/world-model/index.d.ts +261 -0
  75. package/dist/runtime/world-model/index.d.ts.map +1 -0
  76. package/dist/runtime/world-model/index.js +285 -0
  77. package/dist/runtime/world-model/index.js.map +1 -0
  78. package/package.json +15 -2
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <h1 align="center">PARACOSM</h1>
6
6
 
7
7
  <p align="center">
8
- <em>AI Agent Swarm Simulation Engine</em>
8
+ <em>The structured world model for AI agents. Reproducible counterfactual simulations from JSON.</em>
9
9
  </p>
10
10
 
11
11
  <p align="center">
@@ -25,15 +25,54 @@
25
25
 
26
26
  ---
27
27
 
28
- ## What Is Paracosm
28
+ ## What paracosm is
29
29
 
30
- Define a world as JSON. Assign AI leaders with distinct personalities. Watch their decisions compound into divergent outcomes from identical starting conditions.
30
+ A JSON file describes a world. A leader with a HEXACO personality profile runs it. A deterministic kernel drives state, time, and randomness. An LLM generates events, specialist analyses, and the leader's decisions. Specialists can forge new computational tools at runtime inside a V8 sandbox; an LLM judge approves each forge before it enters the decision pipeline. The kernel applies consequences. Personality traits drift. One turn ends, the next begins.
31
31
 
32
- Leaders are top-down decision makers. They can be colony commanders, CEOs, generals, ship captains, department heads, AI systems, governing councils, or any entity that receives information, evaluates options, and makes choices that shape the world. The simulation doesn't care what they represent. It cares how they decide.
32
+ **Same seed. Different leader. Different world.**
33
33
 
34
- Each turn: a Event Director generates events based on the world's current state. Department agents analyze the situation and forge computational tools at runtime. Leaders decide. A deterministic kernel applies consequences. Personality traits drift from experience. The world evolves.
34
+ Two runs against an identical seed, starting from the same JSON, produce measurably divergent trajectories when you swap one variable: the leader's personality. The kernel's side is reproducible. The divergence comes from the LLM stages reading HEXACO profiles and deciding differently. That structural contrast is the product.
35
35
 
36
- Same seed, same starting conditions, different leaders, different civilizations.
36
+ Paracosm is a **structured world model** in the sense of [Xing 2025](https://arxiv.org/abs/2507.05169) and the [ACM CSUR 2025 world-model survey](https://dl.acm.org/doi/full/10.1145/3746449): a simulator for *actionable possibilities*, not a video generator. It is also a **counterfactual world simulation model** ([Kirfel et al, 2025](https://link.springer.com/article/10.1007/s43681-025-00718-4)): a substrate for replaying an event with one variable changed and surfacing the effect. Full taxonomy mapping in [`docs/positioning/world-model-mapping.md`](docs/positioning/world-model-mapping.md).
37
+
38
+ ### Not these things
39
+
40
+ - **Not a generative visual world model.** Sora, Genie 3, and World Labs Marble produce pixels or 3D scenes. Paracosm produces a structured `RunArtifact`: metrics, decisions, specialist notes, citations, forged tool summaries.
41
+ - **Not a JEPA-style predictive-representation model.** LeCun's AMI Labs trains neural representations from sensor streams. Paracosm composes a kernel with an LLM reasoner; no training pipeline.
42
+ - **Not a multi-agent task orchestration framework.** LangGraph, AutoGen, CrewAI, OpenAI Agents SDK, Google ADK all build agentic workflows that execute real tasks. Paracosm is a simulation; nothing leaves the run.
43
+ - **Not a bottom-up swarm intelligence simulator.** MiroFish and OASIS simulate thousands to a million emergent agents for aggregate prediction. Paracosm is top-down (one leader decides), runs ~100 agents by design, and outputs a deterministic trajectory plus divergence across leaders.
44
+ - **Not a generative-agents library.** Stanford Generative Agents (Smallville) and Google DeepMind Concordia build emergent social simulacra in open-ended sandboxes. Paracosm ships a deterministic turn loop, personality drift, runtime tool forging, and a universal result schema.
45
+
46
+ Leaders can be colony commanders, CEOs, generals, ship captains, department heads, AI systems, governing councils, or any entity that receives information, evaluates options, and makes choices that shape the world. The simulation does not care what they represent. It cares how they decide.
47
+
48
+ ### Counterfactual simulations with `WorldModel.fork()`
49
+
50
+ The CWSM positioning is operationalized through `WorldModel.fork()`: run a simulation with snapshots enabled, then branch at any past turn with a different leader or seed, and compare.
51
+
52
+ ```typescript
53
+ import { WorldModel } from 'paracosm/world-model';
54
+ import worldJson from './my-world.json' with { type: 'json' };
55
+
56
+ const wm = await WorldModel.fromJson(worldJson);
57
+
58
+ // Run the trunk with per-turn snapshots captured.
59
+ const trunk = await wm.simulate(visionaryLeader, {
60
+ maxTurns: 6, seed: 42, captureSnapshots: true,
61
+ });
62
+
63
+ // Branch at turn 3 with a different leader. No re-compute of turns 1-3;
64
+ // the forked kernel resumes from the captured state.
65
+ const branch = await (await wm.forkFromArtifact(trunk, 3)).simulate(
66
+ pragmatistLeader,
67
+ { maxTurns: 3, seed: 42 },
68
+ );
69
+
70
+ console.log(trunk.metadata.runId); // parent run-id
71
+ console.log(branch.metadata.forkedFrom); // { parentRunId, atTurn: 3 }
72
+ console.log(trunk.fingerprint, branch.fingerprint); // divergent futures from the same turn-3 state
73
+ ```
74
+
75
+ The kernel round-trips through `JSON.stringify`, so snapshots persist to disk cleanly for later replay or audit. `captureSnapshots` defaults to `false` to keep normal artifacts lean; set it when you want fork capability.
37
76
 
38
77
  ## Quickstart
39
78
 
@@ -41,7 +80,7 @@ Same seed, same starting conditions, different leaders, different civilizations.
41
80
  npm install paracosm # also works: pnpm add paracosm / bun add paracosm
42
81
  ```
43
82
 
44
- Paracosm ships as pure ESM with subpath exports (`paracosm/compiler`, `paracosm/runtime`, `paracosm/mars`, `paracosm/lunar`, `paracosm/core`, `paracosm/schema`). Node 20+, Bun 1.x, and any TypeScript runner with ESM + import-attributes support (`tsx`, `ts-node --esm`) resolve them out of the box. If `import ... from 'paracosm/compiler'` fails with a module-not-found error, the dependency was never installed in that project `cd` into the right directory and run one of the commands above.
83
+ Paracosm ships as pure ESM with subpath exports (`paracosm/compiler`, `paracosm/runtime`, `paracosm/mars`, `paracosm/lunar`, `paracosm/core`, `paracosm/schema`). Node 20+, Bun 1.x, and any TypeScript runner with ESM + import-attributes support (`tsx`, `ts-node --esm`) resolve them out of the box. If `import ... from 'paracosm/compiler'` fails with a module-not-found error, the dependency was never installed in that project. `cd` into the right directory and run one of the commands above.
45
84
 
46
85
  ### 1. Define your world
47
86
 
@@ -52,7 +91,7 @@ Every scenario declares its own vocabulary via `labels.populationNoun`
52
91
  user-facing copy renders.
53
92
 
54
93
  If you omit `labels`, Paracosm falls back to `"colonists"` /
55
- `"colony"` defaults that read fine across most domains but usually
94
+ `"colony"`. Defaults that read fine across most domains but usually
56
95
  feel sharper when you pick your own. "Colony" is the default because
57
96
  it's narratively richer than a neutral "group" / "unit" while still
58
97
  translating to Mars habitats, medieval holds, corporate teams, or any
@@ -94,7 +133,7 @@ bounded collective under a leader's decisions.
94
133
  }
95
134
  ```
96
135
 
97
- > **Terminology `labels.populationNoun` + `settlementNoun` + `timeUnitNoun`**
136
+ > **Terminology: `labels.populationNoun` + `settlementNoun` + `timeUnitNoun`**
98
137
  >
99
138
  > The engine defaults to **`colonists` / `colony` / `tick`** when a scenario omits these
100
139
  > fields, but every scenario can and should override them. The dashboard uses the overridden
@@ -114,9 +153,9 @@ bounded collective under a leader's decisions.
114
153
  > `populationNoun` is the **plural** form; the dashboard derives the singular (`colonists` →
115
154
  > `colonist`) and capitalised variants automatically. `settlementNoun` is **singular** (`colony`,
116
155
  > not `colonies`). `timeUnitNoun` is **singular** and pairs with `timeUnitNounPlural` for
117
- > grammatical display; both are optional and fall back to `tick` / `ticks`. Paracosm the engine
118
- > is an "AI agent swarm" at the meta layer; what it simulates inside each run is scenario-
119
- > flavoured via these fields.
156
+ > grammatical display; both are optional and fall back to `tick` / `ticks`. Paracosm itself
157
+ > is a structured world model at the meta layer; what it simulates inside each run is
158
+ > scenario-flavoured via these fields.
120
159
 
121
160
  ### 2. Compile and run
122
161
 
@@ -165,7 +204,7 @@ const results = await Promise.all(
165
204
  seed: 42,
166
205
  // costPreset: 'economy', // uncomment for ~5-10× cheaper iteration on OpenAI
167
206
  // Every event carries a universal `e.data.summary` one-liner the
168
- // runtime populates for you prints cleanly for all 17 event
207
+ // runtime populates for you; prints cleanly for all 17 event
169
208
  // types without guessing which fields exist where.
170
209
  //
171
210
  // For full intellisense on per-event data, narrow via e.type:
@@ -195,7 +234,7 @@ Each call to `runSimulation` takes one leader. Run one, two, or twenty. The dash
195
234
 
196
235
  ### The universal result contract
197
236
 
198
- Every simulation returns a `RunArtifact` one universal Zod-validated shape exported from `paracosm/schema`. The same shape covers civilization sims (turn-loop), digital-twin simulations (batch-trajectory), and one-shot forecasts (batch-point).
237
+ Every simulation returns a `RunArtifact`: one universal Zod-validated shape exported from `paracosm/schema`. The same shape covers civilization sims (turn-loop), digital-twin simulations (batch-trajectory), and one-shot forecasts (batch-point).
199
238
 
200
239
  ```typescript
201
240
  import { RunArtifactSchema, type RunArtifact } from 'paracosm/schema';
@@ -290,7 +329,7 @@ cp node_modules/paracosm/config/leaders.example.json leaders.json
290
329
  mkdir -p config && cp node_modules/paracosm/config/leaders.example.json config/leaders.json
291
330
  ```
292
331
 
293
- Then edit the HEXACO sliders and `instructions` fields to describe your own leaders the simulation picks up the file on the next run.
332
+ Then edit the HEXACO sliders and `instructions` fields to describe your own leaders. The simulation picks up the file on the next run.
294
333
 
295
334
  ## Scenario Compiler
296
335
 
@@ -326,7 +365,7 @@ const scenario = await compileScenario(worldJson, {
326
365
  });
327
366
  ```
328
367
 
329
- Cache hits show up as `cached` in the progress callback. First-run cost is roughly $0.10; cached re-runs are free. If neither `OPENAI_API_KEY` nor `ANTHROPIC_API_KEY` is set, the compiler throws `ProviderKeyMissingError` before making any calls see [Error handling](#error-handling).
368
+ Cache hits show up as `cached` in the progress callback. First-run cost is roughly $0.10; cached re-runs are free. If neither `OPENAI_API_KEY` nor `ANTHROPIC_API_KEY` is set, the compiler throws `ProviderKeyMissingError` before making any calls. See [Error handling](#error-handling).
330
369
 
331
370
  ## Cost Envelope
332
371
 
@@ -337,7 +376,7 @@ Running a simulation calls real LLM APIs against your key. Paracosm assigns a di
337
376
  | **`quality`** (default) | `gpt-5.4` / `claude-sonnet-4-6` | `gpt-5.4-mini` / `claude-haiku-4-5-20251001` | `gpt-5.4-nano` / `claude-haiku-4-5-20251001` | **~$1-3** | **~$3-7** |
338
377
  | **`economy`** | `gpt-4o` / `claude-sonnet-4-6` | `gpt-5.4-nano` / `claude-haiku-4-5-20251001` | `gpt-5.4-nano` / `claude-haiku-4-5-20251001` | **~$0.20-0.60** | ~$3-5 |
339
378
 
340
- Numbers assume 6 turns, 5 departments, 100 agents, up to 3 events per turn. An 8-turn run on OpenAI `quality` tends to land at ~$1.50-2.00 per leader the call budget is ~10/turn (1 director + ~5 dept + 1 commander + ~3 reaction batches + 0-2 forges + 0-1 judge), and departments on flagship carry most of the cost.
379
+ Numbers assume 6 turns, 5 departments, 100 agents, up to 3 events per turn. An 8-turn run on OpenAI `quality` tends to land at ~$1.50-2.00 per leader. The call budget is ~10/turn (1 director + ~5 dept + 1 commander + ~3 reaction batches + 0-2 forges + 0-1 judge), and departments on flagship carry most of the cost.
341
380
 
342
381
  Pick the preset explicitly for quick iteration:
343
382
 
@@ -353,13 +392,13 @@ const output = await runSimulation(leader, [], {
353
392
 
354
393
  Forge approval rate drops roughly 10-20pp on `economy` because the mid-tier department model occasionally violates structured-output schemas the judge rejects. Use `'economy'` for iteration / CI / debugging; use `'quality'` (default) for publishable or production runs.
355
394
 
356
- Explicit `models` entries always win over the preset so you can mix and match `{ costPreset: 'economy', models: { departments: 'gpt-5.4' } }` gives you cheap everything except departments. Override any single role: `{ models: { judge: 'gpt-5.4' } }` pays for stricter forge review without raising every other tier.
395
+ Explicit `models` entries always win over the preset so you can mix and match. `{ costPreset: 'economy', models: { departments: 'gpt-5.4' } }` gives you cheap everything except departments. Override any single role: `{ models: { judge: 'gpt-5.4' } }` pays for stricter forge review without raising every other tier.
357
396
 
358
397
  The orchestrator's `runSimulation()` returns a `cost` field with token counts, LLM call counts, and USD spend aggregated from every tracked call (director, departments, commander, judge, agent reactions). The dashboard StatsBar shows this live.
359
398
 
360
399
  ### Prompt caching
361
400
 
362
- Every LLM call site on both providers routes its stable system prefix through a `cacheBreakpoint: true` block (director instructions, department prompts, reaction batches, compile-time hook generators). On Anthropic, turn 2+ of every run serves the shared prefix from the provider's prompt cache at 0.1× input cost. On OpenAI, any prompt ≥ 1024 tokens auto-caches. The `cost.caches` field reports read / creation tokens and USD saved per run, and `/retry-stats` rolls the numbers up across the last 100 runs so you can verify the cache is actually hitting. No configuration required the `system: Array<{ text; cacheBreakpoint }>` shape is built into the validated-call wrappers in `src/engine/compiler/llm-invocations/` and `src/runtime/llm-invocations/`.
401
+ Every LLM call site on both providers routes its stable system prefix through a `cacheBreakpoint: true` block (director instructions, department prompts, reaction batches, compile-time hook generators). On Anthropic, turn 2+ of every run serves the shared prefix from the provider's prompt cache at 0.1× input cost. On OpenAI, any prompt ≥ 1024 tokens auto-caches. The `cost.caches` field reports read / creation tokens and USD saved per run, and `/retry-stats` rolls the numbers up across the last 100 runs so you can verify the cache is actually hitting. No configuration required. The `system: Array<{ text; cacheBreakpoint }>` shape is built into the validated-call wrappers in `src/engine/compiler/llm-invocations/` and `src/runtime/llm-invocations/`.
363
402
 
364
403
  ## Programmatic API
365
404
 
@@ -373,7 +412,7 @@ Everything the dashboard does is also available as library calls. The exports fa
373
412
  | `paracosm/core` | Kernel state types (`Agent`, `WorldState`, `HexacoProfile`, …) |
374
413
  | `paracosm/mars`, `paracosm/lunar` | Pre-built `ScenarioPackage` constants to use or fork |
375
414
 
376
- ### Client global defaults + env-var config
415
+ ### Client: global defaults + env-var config
377
416
 
378
417
  `createParacosmClient` pins `provider`, `costPreset`, per-role `models`, and compile-time options once, then hands back `runSimulation` / `runBatch` / `compileScenario` methods that inherit those defaults. Per-call overrides still win, merged at the per-role level so `models: { departments: 'gpt-5.4' }` at the client and `models: { judge: 'gpt-5.4' }` at the call combine to pin both roles instead of one replacing the other.
379
418
 
@@ -416,7 +455,7 @@ Env vars feed the same defaults and are read once at `createParacosmClient` cons
416
455
  | `PARACOSM_COMPILER_PROVIDER` | `compilerProvider` | `openai` / `anthropic` |
417
456
  | `PARACOSM_COMPILER_MODEL` | `compilerModel` | any provider-valid model id |
418
457
 
419
- Invalid values (typos, unknown providers) are silently ignored so bad env state can't crash boot the client falls back to the next layer. Empty or whitespace-only env values are treated as unset.
458
+ Invalid values (typos, unknown providers) are silently ignored so bad env state can't crash boot. The client falls back to the next layer. Empty or whitespace-only env values are treated as unset.
420
459
 
421
460
  ```bash
422
461
  # Zero-code config for hosting / CI:
@@ -431,9 +470,9 @@ PARACOSM_MODEL_DEPARTMENTS=claude-sonnet-4-6 \
431
470
  const client = createParacosmClient(); // no args, pulls from env
432
471
  ```
433
472
 
434
- Direct `runSimulation(...)` / `runBatch(...)` / `compileScenario(...)` calls without a client are still fully supported the client is purely additive for multi-run workflows.
473
+ Direct `runSimulation(...)` / `runBatch(...)` / `compileScenario(...)` calls without a client are still fully supported. The client is purely additive for multi-run workflows.
435
474
 
436
- ### Batch runner N scenarios × M leaders
475
+ ### Batch runner: N scenarios × M leaders
437
476
 
438
477
  ```typescript
439
478
  import { runBatch } from 'paracosm/runtime';
@@ -441,7 +480,7 @@ import { marsScenario, lunarScenario } from 'paracosm';
441
480
 
442
481
  const manifest = await runBatch({
443
482
  scenarios: [marsScenario, lunarScenario],
444
- leaders, // LeaderConfig[] same shape as runSimulation
483
+ leaders, // LeaderConfig[], same shape as runSimulation
445
484
  turns: 6,
446
485
  seed: 950,
447
486
  maxConcurrency: 2, // how many sims to run in parallel
@@ -504,7 +543,7 @@ import { runSimulation, ProviderKeyMissingError } from 'paracosm';
504
543
  try {
505
544
  const output = await runSimulation(leader, [], { scenario, maxTurns: 8, seed: 42 });
506
545
  if (output.providerError) {
507
- // Terminal provider failure (invalid key, quota exhausted) the run
546
+ // Terminal provider failure (invalid key, quota exhausted). The run
508
547
  // aborted mid-way. turnArtifacts / finalState are partial.
509
548
  console.error(output.providerError.kind, // 'auth' | 'quota' | 'rate_limit' | 'network' | 'unknown'
510
549
  output.providerError.provider,
@@ -524,7 +563,7 @@ The resolver inspects `process.env` once up front, so a missing key fails loudly
524
563
 
525
564
  ### Where run output lands
526
565
 
527
- Every finished run writes a JSON snapshot to `<cwd>/output/v3-<archetype>-<timestamp>.json` the same payload `runSimulation` returns, persisted so you can diff runs, reload them into the dashboard, or feed them into downstream tooling. Set `PARACOSM_OUTPUT_DIR` to redirect (absolute path, or relative to cwd). The directory is created on first write if it doesn't exist.
566
+ Every finished run writes a JSON snapshot to `<cwd>/output/v3-<archetype>-<timestamp>.json`: the same payload `runSimulation` returns, persisted so you can diff runs, reload them into the dashboard, or feed them into downstream tooling. Set `PARACOSM_OUTPUT_DIR` to redirect (absolute path, or relative to cwd). The directory is created on first write if it doesn't exist.
528
567
 
529
568
  ```bash
530
569
  # Default: ./output/v3-the-pragmatist-2026-04-21T16-02-41-550Z.json
@@ -550,14 +589,14 @@ npx paracosm compile scenarios/lunar.json \
550
589
 
551
590
  Pipeline:
552
591
 
553
- 1. **Extract** LLM reads the seed, returns `topics`, `facts`, `searchQueries`, `crisisCategories`.
554
- 2. **Search** AgentOS `WebSearchService` queries Firecrawl, Tavily, Serper, and Brave in parallel. Results pass through semantic dedup, RRF fusion, and (with `COHERE_API_KEY`) Cohere `rerank-v3.5` neural reranking.
555
- 3. **Assemble** extracted facts plus search hits become a `KnowledgeBundle` with `topics[].canonicalFacts[]` and `categoryMapping`.
556
- 4. **Ingest** at runtime, `initResearchMemory` writes every citation into an AgentOS `AgentMemory.sqlite()` store keyed by topic tags.
557
- 5. **Recall** for each event, `recallResearch(query, keywords)` runs semantic recall over the memory store. Live web search fills in when memory is sparse.
558
- 6. **Inject** citations land in each department's prompt under `RESEARCH:` as `[claim](url)` markdown links.
559
- 7. **Surface** department reports return `citations[]`. The orchestrator guarantees provenance: when the LLM omits citations, the research packet is auto-attached so the report always carries the same sources the agent saw.
560
- 8. **Render** the dashboard "Reports" tab renders citations as clickable links with optional DOIs.
592
+ 1. **Extract.** LLM reads the seed, returns `topics`, `facts`, `searchQueries`, `crisisCategories`.
593
+ 2. **Search.** AgentOS `WebSearchService` queries Firecrawl, Tavily, Serper, and Brave in parallel. Results pass through semantic dedup, RRF fusion, and (with `COHERE_API_KEY`) Cohere `rerank-v3.5` neural reranking.
594
+ 3. **Assemble.** Extracted facts plus search hits become a `KnowledgeBundle` with `topics[].canonicalFacts[]` and `categoryMapping`.
595
+ 4. **Ingest.** At runtime, `initResearchMemory` writes every citation into an AgentOS `AgentMemory.sqlite()` store keyed by topic tags.
596
+ 5. **Recall.** For each event, `recallResearch(query, keywords)` runs semantic recall over the memory store. Live web search fills in when memory is sparse.
597
+ 6. **Inject.** Citations land in each department's prompt under `RESEARCH:` as `[claim](url)` markdown links.
598
+ 7. **Surface.** Department reports return `citations[]`. The orchestrator guarantees provenance: when the LLM omits citations, the research packet is auto-attached so the report always carries the same sources the agent saw.
599
+ 8. **Render.** The dashboard "Reports" tab renders citations as clickable links with optional DOIs.
561
600
 
562
601
  The Event Director also receives the bundle's `topics` and `categories`, so its `researchKeywords` and `category` fields stay grounded in entries that actually exist in your knowledge bundle.
563
602
 
@@ -575,7 +614,7 @@ Both are included as `paracosm/mars` and `paracosm/lunar` exports. Use them as r
575
614
  The engine is time-unit agnostic. `setup.defaultStartTime` and `setup.defaultTimePerTurn` are plain numbers; whether they mean years, quarters, hours, or ticks is decided by your `labels.timeUnitNoun` pair. The kernel, hooks, and dashboard labels pick that up consistently. Four worked shapes:
576
615
 
577
616
  ```jsonc
578
- // A) Corporate strategy quarterly cadence over 3 years
617
+ // A) Corporate strategy: quarterly cadence over 3 years
579
618
  {
580
619
  "id": "corp-strategy",
581
620
  "labels": {
@@ -588,7 +627,7 @@ The engine is time-unit agnostic. `setup.defaultStartTime` and `setup.defaultTim
588
627
  "setup": { "defaultTurns": 12, "defaultStartTime": 1, "defaultTimePerTurn": 1, "defaultPopulation": 40 }
589
628
  }
590
629
 
591
- // B) Submarine patrol daily cadence over six months
630
+ // B) Submarine patrol: daily cadence over six months
592
631
  {
593
632
  "id": "submarine-daily",
594
633
  "labels": {
@@ -601,7 +640,7 @@ The engine is time-unit agnostic. `setup.defaultStartTime` and `setup.defaultTim
601
640
  "setup": { "defaultTurns": 24, "defaultStartTime": 1, "defaultTimePerTurn": 7, "defaultPopulation": 60 }
602
641
  }
603
642
 
604
- // C) Benchmark arena abstract tick cadence
643
+ // C) Benchmark arena: abstract tick cadence
605
644
  {
606
645
  "id": "arena-session",
607
646
  "labels": {
@@ -614,7 +653,7 @@ The engine is time-unit agnostic. `setup.defaultStartTime` and `setup.defaultTim
614
653
  "setup": { "defaultTurns": 50, "defaultStartTime": 0, "defaultTimePerTurn": 1, "defaultPopulation": 8 }
615
654
  }
616
655
 
617
- // D) Mars Genesis year cadence (the built-in reference)
656
+ // D) Mars Genesis: year cadence (the built-in reference)
618
657
  {
619
658
  "id": "mars-genesis",
620
659
  "labels": {
@@ -20,4 +20,21 @@ signal?: AbortSignal,
20
20
  * falling back to Mars while the page title shows the custom name.
21
21
  */
22
22
  scenario?: ScenarioPackage): Promise<void>;
23
+ /**
24
+ * Single-leader fork dispatch (Spec 2B). When `/setup` receives a
25
+ * config with `forkFrom` set, the server branches here instead of
26
+ * `runPairSimulations`. The fork inherits the parent's kernel state
27
+ * + PRNG from the embedded per-turn snapshot, swaps in the supplied
28
+ * override leader, and runs from `atTurn + 1` to `config.turns`.
29
+ *
30
+ * No verdict generation at the end: verdicts compare two leaders
31
+ * against each other, but forks compare against their parent in the
32
+ * dashboard Branches tab, not against a second live branch.
33
+ *
34
+ * Consumes `simConfig.forkFrom.parentArtifact` verbatim from the
35
+ * client. Server-side validation (scenario match, embedded
36
+ * snapshots, single-leader guard) happened in the `/setup` handler
37
+ * before this function is reached.
38
+ */
39
+ export declare function runForkSimulation(simConfig: NormalizedSimulationConfig, broadcast: BroadcastFn, signal?: AbortSignal, scenario?: ScenarioPackage): Promise<void>;
23
40
  //# sourceMappingURL=pair-runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pair-runner.d.ts","sourceRoot":"","sources":["../../src/cli/pair-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAIzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;AAyBjE,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,0BAA0B,EACrC,SAAS,EAAE,WAAW;AACtB;;;;;;;GAOG;AACH,MAAM,CAAC,EAAE,WAAW;AACpB;;;;;;;GAOG;AACH,QAAQ,GAAE,eAA8B,GACvC,OAAO,CAAC,IAAI,CAAC,CA2Lf"}
1
+ {"version":3,"file":"pair-runner.d.ts","sourceRoot":"","sources":["../../src/cli/pair-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAIzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;AAyBjE,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,0BAA0B,EACrC,SAAS,EAAE,WAAW;AACtB;;;;;;;GAOG;AACH,MAAM,CAAC,EAAE,WAAW;AACpB;;;;;;;GAOG;AACH,QAAQ,GAAE,eAA8B,GACvC,OAAO,CAAC,IAAI,CAAC,CA2Lf;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,0BAA0B,EACrC,SAAS,EAAE,WAAW,EACtB,MAAM,CAAC,EAAE,WAAW,EACpB,QAAQ,GAAE,eAA8B,GACvC,OAAO,CAAC,IAAI,CAAC,CA8Ef"}
@@ -222,4 +222,85 @@ Then fill out:
222
222
  }
223
223
  broadcast('complete', { timestamp: new Date().toISOString() });
224
224
  }
225
+ /**
226
+ * Single-leader fork dispatch (Spec 2B). When `/setup` receives a
227
+ * config with `forkFrom` set, the server branches here instead of
228
+ * `runPairSimulations`. The fork inherits the parent's kernel state
229
+ * + PRNG from the embedded per-turn snapshot, swaps in the supplied
230
+ * override leader, and runs from `atTurn + 1` to `config.turns`.
231
+ *
232
+ * No verdict generation at the end: verdicts compare two leaders
233
+ * against each other, but forks compare against their parent in the
234
+ * dashboard Branches tab, not against a second live branch.
235
+ *
236
+ * Consumes `simConfig.forkFrom.parentArtifact` verbatim from the
237
+ * client. Server-side validation (scenario match, embedded
238
+ * snapshots, single-leader guard) happened in the `/setup` handler
239
+ * before this function is reached.
240
+ */
241
+ export async function runForkSimulation(simConfig, broadcast, signal, scenario = marsScenario) {
242
+ if (!simConfig.forkFrom) {
243
+ throw new Error('runForkSimulation called without simConfig.forkFrom set');
244
+ }
245
+ if (simConfig.leaders.length !== 1) {
246
+ throw new Error(`runForkSimulation requires exactly 1 leader, got ${simConfig.leaders.length}`);
247
+ }
248
+ const leader = simConfig.leaders[0];
249
+ const { turns, seed, startTime, liveSearch, customEvents } = simConfig;
250
+ broadcast('status', { phase: 'starting', maxTurns: turns, customEvents, fork: true });
251
+ const { WorldModel } = await import('../runtime/world-model/index.js');
252
+ const wm = WorldModel.fromScenario(scenario);
253
+ const forkedWm = await wm.forkFromArtifact(simConfig.forkFrom.parentArtifact, simConfig.forkFrom.atTurn);
254
+ broadcast('status', {
255
+ phase: 'fork-running',
256
+ leader: {
257
+ name: leader.name,
258
+ archetype: leader.archetype,
259
+ unit: leader.unit,
260
+ hexaco: leader.hexaco,
261
+ },
262
+ parentRunId: simConfig.forkFrom.parentArtifact.metadata.runId,
263
+ atTurn: simConfig.forkFrom.atTurn,
264
+ });
265
+ console.log(` Fork: ${leader.name} resuming from turn ${simConfig.forkFrom.atTurn} of ` +
266
+ `parent ${simConfig.forkFrom.parentArtifact.metadata.runId}\n`);
267
+ const onEvent = (event) => broadcast('sim', event);
268
+ try {
269
+ const result = await forkedWm.simulate(leader, {
270
+ maxTurns: turns,
271
+ seed,
272
+ startTime,
273
+ timePerTurn: simConfig.timePerTurn,
274
+ liveSearch,
275
+ activeDepartments: simConfig.activeDepartments,
276
+ onEvent,
277
+ customEvents,
278
+ provider: simConfig.provider,
279
+ models: simConfig.models,
280
+ economics: simConfig.economics,
281
+ initialPopulation: simConfig.initialPopulation,
282
+ startingResources: simConfig.startingResources,
283
+ startingPolitics: simConfig.startingPolitics,
284
+ execution: simConfig.execution,
285
+ signal,
286
+ captureSnapshots: true,
287
+ }, simConfig.keyPersonnel ?? DEFAULT_KEY_PERSONNEL);
288
+ broadcast('result', {
289
+ leader: leader.archetype.toLowerCase().replace(/\s+/g, '-'),
290
+ summary: {
291
+ population: result.finalState?.metrics?.population,
292
+ morale: result.finalState?.metrics?.morale,
293
+ toolsForged: result.forgedTools?.length ?? 0,
294
+ citations: result.citations?.length ?? 0,
295
+ },
296
+ fingerprint: result.fingerprint ?? null,
297
+ forkedFrom: result.metadata.forkedFrom,
298
+ });
299
+ }
300
+ catch (err) {
301
+ broadcast('sim_error', { leader: leader.archetype, error: String(err) });
302
+ throw err;
303
+ }
304
+ broadcast('complete', { timestamp: new Date().toISOString(), fork: true });
305
+ }
225
306
  //# sourceMappingURL=pair-runner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pair-runner.js","sourceRoot":"","sources":["../../src/cli/pair-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAmC,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAM9D,SAAS,mBAAmB,CAC1B,QAAgC,EAChC,SAAmC;IAEnC,QAAQ,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAC/B,KAAK,MAAM;YACT,OAAO,IAAI,CAAC;QACd,KAAK,OAAO;YACV,OAAO,QAAQ,KAAK,WAAW;gBAC7B,CAAC,CAAC,2BAA2B;gBAC7B,CAAC,CAAC,cAAc,CAAC;QACrB,KAAK,UAAU;YACb,OAAO,QAAQ,KAAK,WAAW;gBAC7B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AE,CAAC,MAAM,EAAE,0BAA0B,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrJ,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxG,eAAe,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACxH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;OAWG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,MAAM,WAAW,UAAW,SAAQ,MAAM;IACxC,eAAe,EAAE,CAAC,MAAM,EAAE,0BAA0B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,UAAU,CA0yDlF"}
@@ -3,7 +3,7 @@ import { readFileSync, writeFileSync, existsSync, readdirSync, statSync, unlinkS
3
3
  import { resolve, dirname } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { normalizeSimulationConfig, applyDemoCaps } from './sim-config.js';
6
- import { runPairSimulations } from './pair-runner.js';
6
+ import { runPairSimulations, runForkSimulation } from './pair-runner.js';
7
7
  import { marsScenario } from '../engine/mars/index.js';
8
8
  import { lunarScenario } from '../engine/lunar/index.js';
9
9
  import { describeCustomScenarioSource, isRunnableScenarioPackage, loadDiskCustomScenarios, } from './custom-scenarios.js';
@@ -1024,7 +1024,7 @@ export function createMarsServer(options = {}) {
1024
1024
  radiation: colonist?.radiation,
1025
1025
  };
1026
1026
  // Extract simulation memories for this colonist
1027
- const memories = extractColonistMemories(agentId, simEvents);
1027
+ const memories = extractColonistMemories(agentId, simEvents, activeScenario.labels?.timeUnitNoun);
1028
1028
  // Extract the full agent roster from the latest systems_snapshot so
1029
1029
  // the chat agent knows who else exists. Without this, the agent
1030
1030
  // confabulates fake bios for any name the user invents.
@@ -1413,12 +1413,46 @@ export function createMarsServer(options = {}) {
1413
1413
  else if (hasUserKeys) {
1414
1414
  console.log(` [rate-limit] Bypassed — user provided API keys`);
1415
1415
  }
1416
- if (!config.leaders || config.leaders.length < 2) {
1416
+ // Fork setups take exactly one leader (the override for the
1417
+ // forked branch). Regular setups take exactly two. Spec 2B.
1418
+ const isForkSetup = !!config.forkFrom;
1419
+ if (isForkSetup) {
1420
+ if (!config.leaders || config.leaders.length !== 1) {
1421
+ res.writeHead(400, { 'Content-Type': 'application/json' });
1422
+ res.end(JSON.stringify({ error: 'Fork setup requires exactly one leader.' }));
1423
+ return;
1424
+ }
1425
+ }
1426
+ else if (!config.leaders || config.leaders.length < 2) {
1417
1427
  res.writeHead(400, { 'Content-Type': 'application/json' });
1418
1428
  res.end(JSON.stringify({ error: 'Two leaders required' }));
1419
1429
  return;
1420
1430
  }
1421
1431
  simConfig = normalizeSimulationConfig(config);
1432
+ // Spec 2B: validate fork preconditions against the supplied
1433
+ // parent artifact before spinning up the orchestrator.
1434
+ if (simConfig.forkFrom) {
1435
+ const { parentArtifact } = simConfig.forkFrom;
1436
+ const parentScenarioId = parentArtifact?.metadata?.scenario?.id;
1437
+ if (parentScenarioId !== activeScenario.id) {
1438
+ res.writeHead(400, { 'Content-Type': 'application/json' });
1439
+ res.end(JSON.stringify({
1440
+ error: `Fork parent scenario '${parentScenarioId}' does not match active scenario '${activeScenario.id}'. Cross-scenario forks are not supported.`,
1441
+ }));
1442
+ return;
1443
+ }
1444
+ const snapshots = parentArtifact?.scenarioExtensions?.kernelSnapshotsPerTurn;
1445
+ if (!Array.isArray(snapshots) || snapshots.length === 0) {
1446
+ res.writeHead(400, { 'Content-Type': 'application/json' });
1447
+ res.end(JSON.stringify({
1448
+ error: 'Fork parent has no embedded kernel snapshots. Re-run the parent simulation with `captureSnapshots: true` to enable forking.',
1449
+ }));
1450
+ return;
1451
+ }
1452
+ // Force captureSnapshots on for forked children so they are
1453
+ // themselves forkable.
1454
+ simConfig.captureSnapshots = true;
1455
+ }
1422
1456
  // Demo-mode enforcement: clamp only when the run bills against
1423
1457
  // the host's provider keys AND the server is in hosted-demo
1424
1458
  // mode. On local dev (PARACOSM_HOSTED_DEMO unset) env keys
@@ -1824,10 +1858,17 @@ export function createMarsServer(options = {}) {
1824
1858
  try {
1825
1859
  // Thread the currently-active scenario through to the pair
1826
1860
  // runner. Without this the runner defaults to Mars regardless
1827
- // of which scenario the user compiled the page title would
1861
+ // of which scenario the user compiled, so the page title would
1828
1862
  // show the custom name but the simulation would run Mars
1829
- // hooks + content.
1830
- await startSimulations(config, broadcast, controller.signal, activeScenario);
1863
+ // hooks + content. Fork path (Spec 2B) dispatches to
1864
+ // runForkSimulation instead of the pair runner when the
1865
+ // config carries a forkFrom reference.
1866
+ if (config.forkFrom) {
1867
+ await runForkSimulation(config, broadcast, controller.signal, activeScenario);
1868
+ }
1869
+ else {
1870
+ await startSimulations(config, broadcast, controller.signal, activeScenario);
1871
+ }
1831
1872
  }
1832
1873
  finally {
1833
1874
  disarmDisconnectWatchdog();