@neuroverseos/nv-sim 0.1.7 → 0.1.9

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.
package/README.md CHANGED
@@ -2,68 +2,54 @@
2
2
 
3
3
  **Change the rules. See why the system changed.**
4
4
 
5
- NV-SIM doesn't predict outcomes — it shows how systems change when you change the rules.
6
-
7
- Define a world. Set the constraints. Run the agents. Then change one rule and watch the entire system reorganize. Not in theory. You see exactly which agents shifted, what patterns emerged, and why the outcome changed.
8
-
9
- It feels a lot like a Prime Radiant — except instead of psychohistory, you're running controlled behavioral experiments on complex systems.
10
-
11
5
  ```bash
12
6
  npx @neuroverseos/nv-sim visualize
13
7
  ```
14
8
 
15
- ## What This Actually Is
16
-
17
- Most simulation tools answer: *"What will happen?"*
9
+ ## The Problem With Agentic Simulation Today
18
10
 
19
- NV-SIM answers: *"What changes when I change the rules?"*
11
+ You build a multi-agent system. You run it. You get metrics — loss curves, reward signals, completion rates. Something goes wrong, or something goes right, and you ask the only question that matters:
20
12
 
21
- You're not forecasting. You're experimenting. You change a constraint — no panic selling, cap leverage at 3x, close a shipping lane — and the system shows you:
13
+ *Why did the agents do that?*
22
14
 
23
- - **How agents reorganize** (80% shifted from panic selling to coordinated holding)
24
- - **What patterns emerge** (panic suppression, stability shift)
25
- - **What the system became** (volatility dropped 21%, cascade avoided)
15
+ Nobody can tell you. The metrics say *what* happened. The logs say *when* it happened. But nothing tells you *why agents changed their behavior* — which rule caused it, which agents shifted first, what strategy they abandoned, and what they replaced it with.
26
16
 
27
- ```
28
- Rule changed
29
- → Behavior shifted
30
- → Pattern emerged
31
- → System outcome changed
32
- ```
17
+ So you rerun. You tweak. You guess. You stare at dashboards full of numbers that describe the system but never explain it.
33
18
 
34
- That's the loop. Every time.
19
+ That's the gap.
35
20
 
36
- ## This Is a Runtime, Not Just a Simulator
21
+ ## What NV-SIM Gives You That Nothing Else Does
37
22
 
38
- NV-SIM runs in two modes:
23
+ NV-SIM doesn't predict outcomes. It shows you **why agents behaved the way they did** — and what happens when you change the rules.
39
24
 
40
- - **Simulate**explore how systems behave under different rules
41
- - **Act** — govern real agents, real workflows, and real decisions
25
+ You change one constraint block panic selling, cap leverage at 3x, close a shipping lane — and the system shows you:
42
26
 
43
- The interface is the same. The difference is where the behavior comes from.
27
+ - **Before After proof**: "80% of agents shifted from panic selling to coordinated holding"
28
+ - **Emergent patterns**: "Panic suppression appeared — not programmed, not predicted"
29
+ - **Causal chains**: "Agents became more cautious after early aggressive attempts failed"
30
+ - **Quantified outcomes**: "Volatility dropped 21%, cascade avoided"
44
31
 
45
32
  ```
46
- Simulate → internal swarm engine
47
- Act external systems (agents, APIs, frameworks like OpenClaw)
33
+ Rule changed
34
+ Agents shifted strategy
35
+ → New patterns emerged
36
+ → System outcome changed
37
+ → You know exactly why
48
38
  ```
49
39
 
50
- In both cases:
40
+ This is behavioral evidence, not metrics. You don't get a number — you get a story you can trace, verify, and share.
51
41
 
52
- ```
53
- Action → Governance → Decision → Behavioral Shift → System Outcome
54
- ```
42
+ ### For researchers
55
43
 
56
- You're not switching tools. You're switching the source of reality.
44
+ You get **controlled behavioral experiments** on complex systems. Same agents, different rules, measured side by side. The output isn't a chart it's proof of what changed and why.
57
45
 
58
- That's what makes this a runtime.
46
+ ### For developers
59
47
 
60
- The same world file can:
48
+ You get **runtime governance** for any agent system. One HTTP call between "agent decides" and "agent acts." Your agents become observable, auditable, and controllable — without rewriting your framework.
61
49
 
62
- - simulate a crisis
63
- - govern a live system
64
- - produce comparable outcomes across both
50
+ ### For both
65
51
 
66
- Design the rules once. Run them anywhere.
52
+ You get something that didn't exist before: **rule-to-behavior causation**. Not correlation. Not post-hoc analysis. Direct, traceable proof that changing rule X caused agents to shift from behavior A to behavior B.
67
53
 
68
54
  ## The Demo Moment
69
55
 
@@ -78,12 +64,17 @@ system: unstable
78
64
 
79
65
  **After:**
80
66
  ```
81
- 80% of agents adapted
67
+ Market stabilized as agents shifted toward safer positions
82
68
 
83
69
  panic_sell → hold
84
70
  panic_sell → hold
85
71
  panic_sell → hold
86
72
 
73
+ 80% of agents shifted from aggressive to conservative strategies
74
+ Uncertainty dropped 34% as agents moved from exploration to caution
75
+
76
+ WHY: Agents became more cautious after early attempts failed
77
+
87
78
  Pattern: coordinated_holding
88
79
  Pattern: panic_suppression
89
80
 
@@ -91,123 +82,222 @@ system: unstable
91
82
  cascade: avoided
92
83
  ```
93
84
 
94
- You didn't predict this. You caused it — by changing one rule — and watched the system tell you why.
85
+ You didn't predict this. You caused it — by changing one rule — and the system told you exactly why.
86
+
87
+ ## What This Actually Is
88
+
89
+ Most simulation tools answer: *"What will happen?"*
90
+
91
+ NV-SIM answers: *"What changes when I change the rules — and why?"*
92
+
93
+ You're not forecasting. You're running controlled behavioral experiments. Every simulation produces:
94
+
95
+ | What You Get | What It Proves |
96
+ |---|---|
97
+ | **Outcome statement** | System state + dominant agent behavior in one sentence |
98
+ | **Behavioral shifts** | Before → after for every agent group, with percentages |
99
+ | **Causal explanation** | Why agents changed — in their experience, not system jargon |
100
+ | **Confidence rating** | How strong the evidence is, how much risk remains |
101
+ | **Full audit trail** | Every decision, every rule, every adaptation — append-only |
102
+
103
+ The output is designed to be specific, narrative, and shareable. Not "40% adjusted actions" — but "40% shifted from aggressive to conservative strategies after early attempts failed."
104
+
105
+ ## Design the Rules Once. Run Them Anywhere.
106
+
107
+ NV-SIM is a runtime, not just a simulator. It runs in two modes:
108
+
109
+ - **Simulate** — explore how agents behave under different rules
110
+ - **Act** — govern real agents, real workflows, real decisions in production
111
+
112
+ The interface is the same. The difference is where the agents come from.
113
+
114
+ ```
115
+ Simulate → internal swarm engine (built-in agents, instant results)
116
+ Act → your system (any framework, any language, one HTTP call)
117
+ ```
118
+
119
+ The same world file can simulate a crisis, govern a live system, and produce comparable outcomes across both. This means the experiments you run in simulation directly translate to the rules you deploy in production.
95
120
 
96
121
  ## Behavioral Analysis — The Proof Layer
97
122
 
98
- Blocking actions is easy. The hard part is proving what changed and why. NV-SIM doesn't just count blocked actions — it tracks how agents actually reorganized.
123
+ Blocking actions is easy. The hard part is proving what changed and why. NV-SIM doesn't just count actions — it tracks how agents actually reorganized.
99
124
 
100
125
  Every simulation produces behavioral evidence:
101
126
 
102
- - **Action classification** — each agent action is categorized as aggressive, defensive, cautious, cooperative, opportunistic, or neutral
103
- - **Agent trajectories** — traces each agent's behavior across rounds, showing when and how they shifted
104
- - **Behavioral shifts** — detects the moment agents change strategy in response to governance
127
+ - **Action classification** — each agent action categorized as aggressive, defensive, cautious, cooperative, opportunistic, or neutral
128
+ - **Agent trajectories** — each agent's behavior traced across rounds, showing when and how they shifted
129
+ - **Behavioral shifts** — the exact moment agents changed strategy, with before after
105
130
  - **Cross-run comparison** — same agents under different rules, measured side by side
106
131
 
107
132
  ```
108
133
  BEHAVIORAL ANALYSIS
109
134
 
110
- Action Distribution (governed):
135
+ Action Distribution:
111
136
  aggressive: 12% (was 67%)
112
137
  cooperative: 41% (was 8%)
113
138
  cautious: 31% (was 11%)
114
139
  defensive: 16% (was 14%)
115
140
 
116
141
  Shifts Detected:
117
- → 80% of aggressive agents shifted to cooperative after round 3
142
+ → 80% shifted from aggressive to cooperative after round 3
118
143
  → Panic selling replaced by coordinated holding
119
144
  → New pattern: quality_competition (not present in baseline)
120
145
 
121
146
  Trajectory: agent_hedge_fund_1
122
- Round 1: aggressive → Round 2: aggressive → Round 3: [BLOCK] → Round 4: cautious → Round 5: cooperative
147
+ Round 1: aggressive → Round 2: aggressive → Round 3: [shifted] → Round 4: cautious → Round 5: cooperative
123
148
  ```
124
149
 
125
- The governance isn't the insight. The behavioral shift is the insight. You changed a rule, and the system tells you exactly who changed, when they changed, and what they changed to.
150
+ The behavioral shift is the insight. You changed a rule, and the system tells you exactly who changed, when they changed, and what they changed to.
126
151
 
127
152
  ## Audit Trail — Full Evidence Chain
128
153
 
129
- Every governance decision is recorded in an append-only audit log. Every rule firing, every agent action, every verdict — persistent and queryable.
154
+ Every decision is recorded in an append-only audit log. Every rule, every agent action, every adaptation — persistent and queryable.
130
155
 
131
156
  ```
132
157
  AUDIT TRAIL (session: 2026-03-18T14:22:00)
133
158
 
134
- [GOVERNANCE] agent_hedge_fund_1 → panic_sell → BLOCK
159
+ agent_hedge_fund_1 → attempted panic_sell → blocked
135
160
  rule: no_panic_selling (invariant)
136
161
  evidence: action matches blocked pattern during high volatility
137
162
 
138
- [AGENT] agent_hedge_fund_1 → hold
163
+ agent_hedge_fund_1 → shifted to hold
139
164
  adapted: true (shifted from aggressive to defensive)
140
165
 
141
- [BEHAVIORAL_SHIFT] agent_hedge_fund_1
166
+ BEHAVIORAL SHIFT: agent_hedge_fund_1
142
167
  before: aggressive | after: cautious
143
- trigger: governance block at round 3
168
+ trigger: early aggressive attempts failed at round 3
169
+ ```
170
+
171
+ Stored as JSONL — one JSON object per line, human-readable, pipeable through `jq`. No cloud, no deletion. Complete evidence chain.
172
+
173
+ ## Start Here — Define Your World
174
+
175
+ NV-SIM ships with two template worlds. But the real power is **making your own**.
176
+
177
+ ### Option 1: Start from a template
178
+
179
+ ```bash
180
+ npx @neuroverseos/nv-sim visualize # Pick a template, adjust, run
144
181
  ```
145
182
 
146
- Stored as JSONL one JSON object per line, human-readable, pipeable through `jq`. No cloud, no deletion. Complete evidence for governance accountability.
183
+ ### Option 2: Write your rules, we build the world
147
184
 
148
- ## Worlds Where the Power Lives
185
+ Create a text file with your rules in plain English:
149
186
 
150
- Integration is one line. The world file controls everything.
187
+ ```
188
+ # my-rules.txt
189
+ Limit any agent to 15% of total posts per round
190
+ Block coordinated posting from 3+ agents
191
+ Dampen sentiment shifts larger than 0.3 per round
192
+ Require source attribution for factual claims
193
+ ```
151
194
 
152
- The `world` you pass to `/api/evaluate` determines how actions are judged. Change the world, change the outcome.
195
+ Then generate a full governed world from it:
153
196
 
197
+ ```bash
198
+ npx @neuroverseos/nv-sim world-from-doc my-rules.txt --output my-world.json
154
199
  ```
155
- verdict = evaluate(actor="agent_1", action="panic_sell", world="trading")
156
- ^^^^^^^^
157
- this controls everything
200
+
201
+ This doesn't just parse your rules — it generates a complete governed world: state variables, gates, invariants, thesis, and agent types. The same structure as the built-in templates. Your world is equal to ours.
202
+
203
+ ### Option 3: Upload a .nv world file
204
+
205
+ ```bash
206
+ npx @neuroverseos/nv-sim serve --world my-world.json
158
207
  ```
159
208
 
160
- ### Built-in Worlds
209
+ Load any saved world file directly into the runtime.
210
+
211
+ ## Two Template Worlds
161
212
 
162
- | World | Domain | What You Can Change |
163
- |-------|--------|---------------------|
164
- | `trading` | Financial markets | Leverage ratio, liquidity index, volatility, circuit breakers |
165
- | `strait_of_hormuz` | Geopolitical energy | Oil supply disruption, military escalation, diplomatic channels |
166
- | `gas_price_spike` | Economic energy | Gas price, consumer sentiment, EV demand, grid capacity |
167
- | `ai_regulation_crisis` | Tech regulation | AI regulation impact on markets and sector alignment |
213
+ NV-SIM ships with two complete governed worlds. These are templates — starting points for your own experiments.
214
+
215
+ ### `social_simulation` Multi-Agent Social Simulation
216
+
217
+ For anyone running agent-based social simulations (MiroFish, OASIS, or custom). Governs the dynamics that break realism regardless of topic.
218
+
219
+ | State Variable | What It Controls |
220
+ |---|---|
221
+ | Opinion Diversity (0-100) | How spread out are opinions? Low = echo chamber |
222
+ | Influence Concentration (0-100) | Gini coefficient of agent influence. High = monopoly |
223
+ | Sentiment Polarity (0-100) | How extreme is overall sentiment? High = spiral |
224
+ | Echo Chamber Strength | none → forming → established → dominant |
225
+ | Active Agent % (0-100) | What % of agents participate per round |
226
+ | Viral Amplification Threshold | How many interactions before amplification kicks in |
227
+
228
+ **Default rules:**
229
+ - Limit any agent to 15% of total posts per round
230
+ - Dampen sentiment shifts > 0.3 per round
231
+ - Block coordinated posting (same content from 3+ agents)
232
+ - Require source attribution for factual claims
233
+ - Monitor opinion diversity — alert below 30
234
+
235
+ **Circuit breakers:** Echo Chamber Collapse (diversity < 20), Influence Monopoly (concentration > 70), Sentiment Spiral (polarity > 80)
236
+
237
+ ### `science_research` — Governed Research Pipeline
238
+
239
+ For AI-assisted research workflows (ScienceClaw, autonomous discovery agents). Governs scientific rigor at every stage.
240
+
241
+ | State Variable | What It Controls |
242
+ |---|---|
243
+ | Verified Sources (0-50) | How many peer-reviewed sources have been found |
244
+ | Confidence Level (0-1) | How confident is the current hypothesis |
245
+ | Hypothesis Validated | Has the hypothesis been confirmed by multiple sources |
246
+ | Peer Review Status | none → submitted → reviewed → approved |
247
+ | Publication Readiness % | How close to publication-ready |
248
+
249
+ **Default rules:**
250
+ - Literature search must return 2+ peer-reviewed sources before analysis
251
+ - Claims must cite specific sources — unsupported assertions blocked
252
+ - Publication requires confidence > 0.7 and validated hypothesis
253
+ - Cross-referencing must compare 3+ independent sources
254
+ - Recommendations must include uncertainty language when confidence < 0.9
255
+
256
+ **Circuit breakers:** Insufficient Evidence, Premature Publication, Low Confidence Alert
168
257
 
169
258
  ### Same Agents, Different Rules
170
259
 
171
260
  ```bash
172
- npx @neuroverseos/nv-sim worlds trading strait_of_hormuz
261
+ npx @neuroverseos/nv-sim worlds social_simulation science_research
173
262
  ```
174
263
 
175
264
  Same agents. Different rules. Different outcomes. That's the experiment.
176
265
 
177
266
  ## Narrative Shocks
178
267
 
179
- Inject events into running simulations. Watch them propagate differently through different agents — a bank collapse hits retail investors and algorithmic traders in completely different ways.
268
+ Inject events into running simulations. Different agents react differently to the same event.
180
269
 
181
270
  ```bash
182
- npx @neuroverseos/nv-sim compare --inject tanker_explosion@3,sanctions@5
271
+ npx @neuroverseos/nv-sim compare --inject viral_misinfo@3,algorithm_change@5
183
272
  ```
184
273
 
185
274
  The `@` syntax sets when the event hits. Events have severity, propagation speed, and directional impact.
186
275
 
276
+ ### Social simulation events
277
+ `viral_misinfo`, `influencer_stance_change`, `algorithm_change`, `external_news_event`, `coordinated_campaign`, `whistleblower_post`
278
+
279
+ ### Research events
280
+ `search_literature`, `analyze_findings`, `cross_reference`, `unsupported_claim`, `hypothesis_validated`, `publish_result`
281
+
187
282
  ## Named Scenarios
188
283
 
189
- Pre-built crisis sequences — a world + ordered narrative events:
284
+ Pre-built sequences — a world + ordered narrative events:
190
285
 
191
286
  ```bash
192
- npx @neuroverseos/nv-sim scenario taiwan_crisis
193
- npx @neuroverseos/nv-sim scenario bank_run --compare
287
+ npx @neuroverseos/nv-sim scenario echo_chamber
288
+ npx @neuroverseos/nv-sim scenario research_pipeline
194
289
  npx @neuroverseos/nv-sim scenarios # list all
195
290
  ```
196
291
 
197
- | Scenario | Events | What It Tests |
198
- |----------|--------|---------------|
199
- | `taiwan_crisis` | 4 | Military escalation + sanctions + shipping disruption |
200
- | `hormuz_blockade` | 3 | Tanker attack escalates to full shipping disruption |
201
- | `bank_run` | 4 | Bank insolvency triggers contagion cascade |
202
- | `flash_cascade` | 3 | Algorithmic failure chain reaction |
203
- | `oil_shock` | 4 | Tanker attack + sanctions compound crisis |
204
- | `energy_transition_shock` | 3 | Grid failure during rapid transition |
205
- | `election_shock` | 4 | Political shock cascades into markets |
206
- | `ai_crackdown` | 3 | Overnight AI regulation triggers panic |
207
- | `perfect_storm` | 6 | Geopolitical + financial + energy convergence |
208
- | `black_swan` | 5 | Extreme low-probability events in succession |
292
+ | Scenario | World | Events | What It Tests |
293
+ |----------|-------|--------|---------------|
294
+ | `echo_chamber` | social_simulation | 3 | Opinion diversity collapses into self-reinforcing groups |
295
+ | `influence_monopoly` | social_simulation | 3 | Small group dominates discourse |
296
+ | `sentiment_spiral` | social_simulation | 4 | Negativity feeds on itself until unrealistic |
297
+ | `platform_shock` | social_simulation | 3 | Algorithm change reshapes engagement overnight |
298
+ | `research_pipeline` | science_research | 6 | Full research workflow with governance at each step |
209
299
 
210
- The `--compare` flag runs the same scenario across multiple worlds — which rule environment is more resilient?
300
+ The `--compare` flag runs the same scenario across both worlds — which rule environment is more resilient?
211
301
 
212
302
  ## Interactive Control Platform
213
303
 
@@ -221,68 +311,68 @@ This opens a control surface where you can:
221
311
  - Adjust state variables with auto-generated controls
222
312
  - Inject narrative events at specific rounds
223
313
  - Load crisis scenarios with one click
224
- - Watch the **System Shift card** — not a log of what happened, but a story of what the system became
314
+ - Watch the **Outcome Panel** — not a log of what happened, but a story of what the system became and why
225
315
  - Save any experiment as a reusable variant
226
316
 
227
- ### The System Shift Card
317
+ ### The Outcome Panel
228
318
 
229
- When rules reshape behavior, you don't get a log. You get this:
319
+ When rules reshape behavior, you don't get a dashboard of metrics. You get this:
230
320
 
231
321
  ```
232
- SYSTEM SHIFT
322
+ OUTCOME
233
323
 
234
- No panic selling allowed
235
- 437 actions reshaped out of 1,247 total
324
+ Market stabilized as agents shifted toward safer positions
236
325
 
237
- Rule Behavioral Shift What Emerged → System Outcome
326
+ Confidence: Strong | Evidence: Solid | Risk: Low
238
327
 
239
- ┌─ Behavioral Shift ─────────────────┐
240
- │ 80%
241
- adaptation across 1,247 agents
242
- BLOCK: hold (312 agents)
243
- MODIFY: sell_slowly (87 agents)
244
- └────────────────────────────────────┘
328
+ ┌─ What Agents Did ────────────────┐
329
+ │ 80% shifted from aggressive to
330
+ conservative strategies
331
+ 12% reduced position size after
332
+ initial attempts failed
333
+ │ 8% maintained original strategy │
334
+ └──────────────────────────────────┘
245
335
 
246
- ┌─ What Emerged ─────────────────────┐
247
- Coordinated Holding │
248
- Panic Suppression
249
- └────────────────────────────────────┘
336
+ ┌─ Why This Happened ──────────────┐
337
+ Early aggressive attempts failed,│
338
+ forcing agents to rethink.
339
+ │ Uncertainty dropped as agents │
340
+ │ stopped experimenting. │
341
+ └──────────────────────────────────┘
250
342
 
251
- ┌─ System Outcome ───────────────────┐
252
- Volatility 47% → 26%
253
- Stability 58% → 79%
254
- │ Cascade Avoided │
255
- └────────────────────────────────────┘
343
+ ┌─ What Emerged ───────────────────┐
344
+ Coordinated Holding
345
+ Panic Suppression
346
+ └──────────────────────────────────┘
256
347
 
257
- ┌─ What Actually Happened ───────────┐
258
- No panic selling allowed. 437 of
259
- 1,247 agents reorganized — most
260
- shifted to hold. Volatility
261
- │ dropped 21%. │
262
- └────────────────────────────────────┘
348
+ ┌─ System Outcome ─────────────────┐
349
+ Volatility 47% 26%
350
+ Stability 58% 79%
351
+ Cascade Avoided
352
+ └──────────────────────────────────┘
263
353
 
264
- ▶ View raw detail
354
+ ▶ View audit trail
265
355
  ```
266
356
 
267
- We don't show you what every agent did. We show you what the system became.
357
+ Every line is specific. Every line is shareable. No system jargon.
268
358
 
269
359
  ### World Variants
270
360
 
271
361
  Save any experiment as a named variant:
272
362
 
273
363
  ```
274
- Adjust rules → Inject events → Run → See the shift → Save as variant
364
+ Adjust rules → Inject events → Run → See what changed → Save as variant
275
365
  ```
276
366
 
277
367
  Variants capture the base world, state overrides, narrative events, and results. Store them in git. Share them. Replay them. This turns experiments into assets.
278
368
 
279
- ## Governance Runtime — Run It For Your Own System
369
+ ## Governance Runtime — Plug Into Your Own System
280
370
 
281
371
  ```bash
282
372
  npx @neuroverseos/nv-sim serve
283
373
  ```
284
374
 
285
- This starts a local governance server. Any simulator, agent framework, or application can POST actions and get governance decisions back.
375
+ This starts a local server. Any simulator, agent framework, or application can POST actions and get decisions back.
286
376
 
287
377
  ```
288
378
  Endpoint: http://localhost:3456/api/evaluate
@@ -297,16 +387,16 @@ Additional endpoints:
297
387
 
298
388
  | Endpoint | What It Does |
299
389
  |----------|-------------|
300
- | `POST /api/evaluate` | Submit an action for governance |
390
+ | `POST /api/evaluate` | Submit an action for evaluation |
301
391
  | `GET /api/session` | Current session stats |
302
- | `GET /api/session/report` | Full governance report |
392
+ | `GET /api/session/report` | Full session report |
303
393
  | `POST /api/session/reset` | Reset session state |
304
394
  | `POST /api/session/save` | Save session as experiment |
305
- | `GET /api/events` | SSE stream of governance events |
395
+ | `GET /api/events` | SSE stream of live events |
306
396
 
307
397
  ### Works With Anything
308
398
 
309
- If your system has actions, you can govern it. One API call.
399
+ If your system has actions, you can govern them. One API call.
310
400
 
311
401
  ```
312
402
  Agent decides → POST /api/evaluate → verdict → agent adapts
@@ -376,72 +466,9 @@ If your system can make an HTTP request, it can be governed.
376
466
 
377
467
  Most systems generate behavior. This one shapes it.
378
468
 
379
- See [INTEGRATION.md](./INTEGRATION.md) for the full API contract and decision types.
380
-
381
- ## AI Providers — Bring Your Own Model
382
-
383
- AI is optional. AI is governed. AI is pluggable.
384
-
385
- NV-SIM works without any AI — the deterministic engine runs on math, not tokens. But when you bring your own model, AI becomes a governed actor inside the system — subject to the same rules as every other agent.
469
+ See [INTEGRATION.md](./INTEGRATION.md) for the full API contract, framework guides, and decision types.
386
470
 
387
- ### How AI fits in
388
-
389
- AI plays two governed roles:
390
-
391
- | Role | What It Does | Constraints |
392
- |------|-------------|-------------|
393
- | `ai_translator` | Converts unstructured input into normalized events | Must output valid schema, no invention of events, must include confidence |
394
- | `ai_analyst` | Generates reports from simulation traces | Must reference trace data, must include blocked actions, no unverifiable claims |
395
-
396
- Both roles go through `/api/evaluate` like any other actor. The AI doesn't control the system — the system controls the AI.
397
-
398
- ### Supported providers
399
-
400
- NV-SIM auto-detects the best available provider from your environment:
401
-
402
- | Provider | Env Var | What It Connects To |
403
- |----------|---------|---------------------|
404
- | Anthropic (Claude) | `ANTHROPIC_API_KEY` | Claude Sonnet, Opus, Haiku |
405
- | OpenAI | `OPENAI_API_KEY` | GPT-4, GPT-4o, o1 |
406
- | Groq | `GROQ_API_KEY` | Llama 3 70B |
407
- | Together | `TOGETHER_API_KEY` | Llama, Mixtral |
408
- | Mistral | `MISTRAL_API_KEY` | Mistral Large |
409
- | Deepseek | `DEEPSEEK_API_KEY` | Deepseek Chat |
410
- | Fireworks | `FIREWORKS_API_KEY` | Llama, custom models |
411
- | Ollama | `OLLAMA_BASE_URL` | Any local model |
412
- | Local LLM | `LOCAL_LLM_URL` | LM Studio, vLLM, llama.cpp |
413
- | (none) | — | Deterministic fallback (no AI, no cost) |
414
-
415
- Set the env var and run. No configuration files. No provider lock-in.
416
-
417
- Any endpoint that speaks the OpenAI chat completions format (`POST /v1/chat/completions`) works out of the box.
418
-
419
- ## Quick Start
420
-
421
- ```bash
422
- # See it
423
- npx @neuroverseos/nv-sim visualize
424
-
425
- # Compare governed vs ungoverned
426
- npx @neuroverseos/nv-sim compare
427
-
428
- # Run a crisis
429
- npx @neuroverseos/nv-sim scenario taiwan_crisis
430
-
431
- # Same crisis, different worlds — which rules hold?
432
- npx @neuroverseos/nv-sim scenario bank_run --compare
433
-
434
- # Inject shocks
435
- npx @neuroverseos/nv-sim compare --inject tanker_explosion@3,sanctions@5
436
-
437
- # Stress test (500 randomized runs)
438
- npx @neuroverseos/nv-sim chaos --runs 500
439
-
440
- # Run local governance runtime for your own simulator
441
- npx @neuroverseos/nv-sim serve
442
- ```
443
-
444
- ## Policy Enforcement — The Product Loop
471
+ ## Policy Enforcement The Experiment Loop
445
472
 
446
473
  Write rules in plain English. Run the same scenario. See what changes. Adjust and repeat.
447
474
 
@@ -472,13 +499,13 @@ Slow down algorithmic trading when contagion spreads
472
499
  npx nv-sim enforce trading my-rules.txt
473
500
  ```
474
501
 
475
- The engine parses your plain English into governance rules, runs the scenario, and shows what changed.
502
+ The engine parses your plain English into rules, runs the scenario, and shows what changed — with before → after behavioral proof.
476
503
 
477
504
  ### Step 4: Change a rule. Run again.
478
505
 
479
506
  Remove "Limit leverage to 5x". Run again. Did stability drop? That rule was load-bearing.
480
507
 
481
- Add "Require transparency for all large trades". Run again. Did effectiveness improve?
508
+ Add "Require transparency for all large trades". Run again. Did agents shift strategy?
482
509
 
483
510
  The report tracks every change:
484
511
 
@@ -494,11 +521,12 @@ DIVERGENCE ANALYSIS
494
521
  Effectiveness trend: 11% → 32%
495
522
 
496
523
  KEY INSIGHT
497
- Enforcement gates are the key differentiator. Rules alone: 11%. Rules + gates: 32%.
524
+ Removing the leverage cap caused agents to take larger positions but the
525
+ panic selling block forced them to hold through volatility instead of exiting.
526
+ Net effect: more risk-taking, but more stability.
498
527
 
499
528
  TRY THIS EXPERIMENT
500
- Remove this rule and see what happens:
501
- Remove "Block panic selling during high volatility" from your rules file, then run again.
529
+ Remove "Block panic selling during high volatility" from your rules file, then run again.
502
530
  If stability drops, that rule was load-bearing. If nothing changes, it was noise.
503
531
  ```
504
532
 
@@ -534,6 +562,69 @@ npx nv-sim enforce trading --output=report.json # Save as JSON
534
562
 
535
563
  For full control over gates, state variables, and thesis, use JSON world files. See `examples/worlds/` for templates. Enforce accepts both `.txt` and `.json` — mix and match.
536
564
 
565
+ ## AI Providers — Bring Your Own Model
566
+
567
+ AI is optional. AI is governed. AI is pluggable.
568
+
569
+ NV-SIM works without any AI — the deterministic engine runs on math, not tokens. But when you bring your own model, AI becomes a governed actor inside the system — subject to the same rules as every other agent.
570
+
571
+ ### How AI fits in
572
+
573
+ AI plays two governed roles:
574
+
575
+ | Role | What It Does | Constraints |
576
+ |------|-------------|-------------|
577
+ | `ai_translator` | Converts unstructured input into normalized events | Must output valid schema, no invention of events, must include confidence |
578
+ | `ai_analyst` | Generates reports from simulation traces | Must reference trace data, must include blocked actions, no unverifiable claims |
579
+
580
+ Both roles go through `/api/evaluate` like any other actor. The AI doesn't control the system — the system controls the AI.
581
+
582
+ ### Supported providers
583
+
584
+ NV-SIM auto-detects the best available provider from your environment:
585
+
586
+ | Provider | Env Var | What It Connects To |
587
+ |----------|---------|---------------------|
588
+ | Anthropic (Claude) | `ANTHROPIC_API_KEY` | Claude Sonnet, Opus, Haiku |
589
+ | OpenAI | `OPENAI_API_KEY` | GPT-4, GPT-4o, o1 |
590
+ | Groq | `GROQ_API_KEY` | Llama 3 70B |
591
+ | Together | `TOGETHER_API_KEY` | Llama, Mixtral |
592
+ | Mistral | `MISTRAL_API_KEY` | Mistral Large |
593
+ | Deepseek | `DEEPSEEK_API_KEY` | Deepseek Chat |
594
+ | Fireworks | `FIREWORKS_API_KEY` | Llama, custom models |
595
+ | Ollama | `OLLAMA_BASE_URL` | Any local model |
596
+ | Local LLM | `LOCAL_LLM_URL` | LM Studio, vLLM, llama.cpp |
597
+ | (none) | — | Deterministic fallback (no AI, no cost) |
598
+
599
+ Set the env var and run. No configuration files. No provider lock-in.
600
+
601
+ Any endpoint that speaks the OpenAI chat completions format (`POST /v1/chat/completions`) works out of the box.
602
+
603
+ ## Quick Start
604
+
605
+ ```bash
606
+ # See it
607
+ npx @neuroverseos/nv-sim visualize
608
+
609
+ # Compare governed vs ungoverned
610
+ npx @neuroverseos/nv-sim compare
611
+
612
+ # Run a crisis
613
+ npx @neuroverseos/nv-sim scenario taiwan_crisis
614
+
615
+ # Same crisis, different worlds — which rules hold?
616
+ npx @neuroverseos/nv-sim scenario bank_run --compare
617
+
618
+ # Inject shocks
619
+ npx @neuroverseos/nv-sim compare --inject tanker_explosion@3,sanctions@5
620
+
621
+ # Stress test (500 randomized runs)
622
+ npx @neuroverseos/nv-sim chaos --runs 500
623
+
624
+ # Run local governance runtime for your own simulator
625
+ npx @neuroverseos/nv-sim serve
626
+ ```
627
+
537
628
  ## Commands
538
629
 
539
630
  | Command | What It Does |
@@ -560,11 +651,11 @@ event → narrative propagation → belief shift → agent action → governance
560
651
 
561
652
  Five forces shape every simulation:
562
653
 
563
- 1. **Agent behavior** — traders, voters, regulators, media
564
- 2. **World rules** — leverage caps, circuit breakers, chokepoints
565
- 3. **Narrative events** — information shocks that propagate through the system
566
- 4. **Perception propagation** — different agents react differently to the same event
567
- 5. **Behavioral analysis** — tracks how agents reorganize under governance, producing the evidence that rules actually changed the system
654
+ 1. **Agent behavior** — traders, voters, regulators, media — each with different risk profiles and strategies
655
+ 2. **World rules** — leverage caps, circuit breakers, chokepoints — the constraints that shape what agents can do
656
+ 3. **Narrative events** — information shocks that propagate through the system at different speeds
657
+ 4. **Perception propagation** — different agents react differently to the same event based on their role and exposure
658
+ 5. **Behavioral analysis** — tracks how agents reorganize, producing the before → after evidence that proves rules actually changed the system
568
659
 
569
660
  This lets you ask compound questions:
570
661
 
@@ -579,13 +670,13 @@ That combination produces very different outcomes than any single factor alone.
579
670
 
580
671
  nv-sim engine ← world rules + narrative injection + swarm simulation
581
672
 
582
- behavioral analysis ← shift detection, trajectory tracking, cross-run comparison
673
+ behavioral analysis ← before→after shift detection, trajectory tracking, cross-run comparison
583
674
 
584
675
  audit trail ← append-only evidence chain (JSONL)
585
676
 
586
677
  nv-sim CLI ← scenarios, comparison, chaos testing, governance runtime
587
678
 
588
- control platform ← interactive browser UI + System Shift card
679
+ control platform ← interactive browser UI + outcome panels
589
680
 
590
681
  AI providers (optional) ← BYOM: Anthropic, OpenAI, Groq, local LLMs, or none
591
682