Skip to content

Commit 63bb531

Browse files
committed
docs: update paracosm integration surface
1 parent 525506b commit 63bb531

1 file changed

Lines changed: 32 additions & 20 deletions

File tree

docs/PARACOSM.md

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ npm install paracosm
4040
```
4141

4242
```typescript
43-
import { marsScenario } from 'paracosm/mars';
44-
import { runSimulation } from 'paracosm/runtime';
43+
import { WorldModel, marsScenario } from 'paracosm';
4544

4645
const aria = {
4746
name: 'Aria Chen',
@@ -54,8 +53,9 @@ const aria = {
5453
instructions: '',
5554
};
5655

57-
const result = await runSimulation(aria, [], {
58-
scenario: marsScenario,
56+
const result = await WorldModel.fromScenario(marsScenario).simulate({
57+
actor: aria,
58+
keyPersonnel: [],
5959
maxTurns: 6,
6060
seed: 950,
6161
onEvent: e => console.log(e.type, e.data?.title),
@@ -69,17 +69,21 @@ Or run the hosted demo at [paracosm.agentos.sh/sim](https://paracosm.agentos.sh/
6969

7070
## The universal result contract
7171

72-
Every `runSimulation()` call returns a Zod-validated `RunArtifact` exported from the `paracosm/schema` subpath. One shape covers three simulation modes, discriminated on `metadata.mode`:
72+
Every `WorldModel.simulate()` call returns a Zod-validated `RunArtifact` exported from the `paracosm/schema` subpath. One shape covers three simulation modes, discriminated on `metadata.mode`:
7373

7474
- `turn-loop`: civilization sims (paracosm's built-in mode). Populates `trajectory.timepoints[]` and `decisions[]` with per-turn specialist notes.
7575
- `batch-trajectory`: digital-twin simulations. Labeled timepoints over a horizon, populated by external LangGraph-style executors.
7676
- `batch-point`: one-shot forecasts. Overview and risk flags only, no trajectory.
7777

7878
```typescript
7979
import { RunArtifactSchema, type RunArtifact } from 'paracosm/schema';
80-
import { runSimulation } from 'paracosm/runtime';
80+
import { WorldModel } from 'paracosm';
8181

82-
const artifact: RunArtifact = await runSimulation(leader, [], opts);
82+
const artifact: RunArtifact = await WorldModel.fromScenario(scenario).simulate({
83+
actor: leader,
84+
keyPersonnel: [],
85+
...opts,
86+
});
8387
const parsed = RunArtifactSchema.parse(artifact); // optional runtime validation
8488

8589
switch (artifact.metadata.mode) {
@@ -120,7 +124,11 @@ const intervention = InterventionConfigSchema.parse({
120124
adherenceProfile: { expected: 0.7 },
121125
});
122126

123-
const artifact = await runSimulation(leader, [], { scenario, subject, intervention });
127+
const artifact = await WorldModel.fromScenario(scenario).intervene({
128+
actor: leader,
129+
subject,
130+
intervention,
131+
});
124132
```
125133

126134
Turn-loop mode stashes both verbatim without semantic consumption; external batch-trajectory executors populate them from their own flow.
@@ -238,11 +246,15 @@ Users who want more runs paste their own OpenAI or Anthropic key. The dashboard'
238246

239247
```typescript
240248
import type { ScenarioPackage, Agent, HexacoProfile } from 'paracosm';
241-
import type { ActorConfig } from 'paracosm/runtime';
242-
import { SimulationKernel, SeededRng } from 'paracosm';
243-
import { marsScenario } from 'paracosm/mars';
244-
import { lunarScenario } from 'paracosm/lunar';
245-
import { runSimulation, runBatch } from 'paracosm/runtime';
249+
import type { ActorConfig } from 'paracosm';
250+
import {
251+
WorldModel,
252+
run,
253+
runMany,
254+
marsScenario,
255+
lunarScenario,
256+
} from 'paracosm';
257+
import { SimulationKernel, SeededRng } from 'paracosm/core';
246258
import { compileScenario } from 'paracosm/compiler';
247259
import {
248260
RunArtifactSchema,
@@ -258,13 +270,13 @@ import {
258270

259271
Full type reference is auto-generated from source at [/paracosm](/paracosm). The core types:
260272

261-
- [`ScenarioPackage`](/paracosm/engine/interfaces/ScenarioPackage): domain-agnostic scenario bundle
262-
- `ActorConfig`: commander identity plus HEXACO profile (or pluggable `traitProfile`); imported via `paracosm/runtime`
263-
- [`HexacoProfile`](/paracosm/engine/interfaces/HexacoProfile): six-axis personality vector
264-
- [`SimulationKernel`](/paracosm/engine/classes/SimulationKernel): deterministic state machine
265-
- [`runSimulation`](/paracosm/runtime/functions/runSimulation): single-leader turn loop, returns `Promise<RunArtifact>`
266-
- [`runBatch`](/paracosm/runtime/functions/runBatch): parallel multi-scenario runner
267-
- [`compileScenario`](/paracosm/engine/compiler/functions/compileScenario): turns a scenario draft plus optional source grounding into a runnable `ScenarioPackage`
273+
- [`ScenarioPackage`](/paracosm/paracosm/interfaces/ScenarioPackage): domain-agnostic scenario bundle
274+
- `ActorConfig`: commander identity plus HEXACO profile (or pluggable `traitProfile`); imported from `paracosm`
275+
- [`HexacoProfile`](/paracosm/paracosm/core/interfaces/HexacoProfile): six-axis personality vector
276+
- [`SimulationKernel`](/paracosm/paracosm/core/classes/SimulationKernel): deterministic state machine
277+
- `WorldModel.simulate`: single-actor turn loop, returns `Promise<RunArtifact>`
278+
- `run` / `runMany`: prompt, URL, or precompiled scenario quickstarts from the root export
279+
- [`compileScenario`](/paracosm/paracosm/compiler/functions/compileScenario): turns a scenario draft plus optional source grounding into a runnable `ScenarioPackage`
268280

269281
## HTTP + SSE server
270282

0 commit comments

Comments
 (0)