@neuroverseos/nv-sim 0.1.4 → 0.1.5
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 +346 -68
- package/dist/adapters/mirofish.js +461 -0
- package/dist/adapters/scienceclaw.js +750 -0
- package/dist/assets/index-B64NuIXu.css +1 -0
- package/dist/assets/index-DbzSnYxr.js +532 -0
- package/dist/assets/{reportEngine-BfteK4MN.js → reportEngine-DKWTrP6-.js} +1 -1
- package/dist/components/ConstraintsPanel.js +11 -0
- package/dist/components/StakeholderBuilder.js +32 -0
- package/dist/components/ui/badge.js +24 -0
- package/dist/components/ui/button.js +70 -0
- package/dist/components/ui/card.js +57 -0
- package/dist/components/ui/input.js +44 -0
- package/dist/components/ui/label.js +45 -0
- package/dist/components/ui/select.js +70 -0
- package/dist/engine/aiProvider.js +427 -2
- package/dist/engine/auditTrace.js +352 -0
- package/dist/engine/behavioralAnalysis.js +605 -0
- package/dist/engine/cli.js +1087 -13
- package/dist/engine/dynamicsGovernance.js +588 -0
- package/dist/engine/fullGovernedLoop.js +367 -0
- package/dist/engine/governedSimulation.js +77 -6
- package/dist/engine/index.js +41 -1
- package/dist/engine/liveVisualizer.js +2787 -360
- package/dist/engine/metrics/science.metrics.js +335 -0
- package/dist/engine/narrativeInjection.js +55 -0
- package/dist/engine/policyEnforcement.js +1611 -0
- package/dist/engine/policyEngine.js +799 -0
- package/dist/engine/primeRadiant.js +540 -0
- package/dist/engine/scenarioCapsule.js +56 -0
- package/dist/engine/scenarioComparison.js +463 -0
- package/dist/engine/scenarioLibrary.js +17 -0
- package/dist/engine/swarmSimulation.js +54 -1
- package/dist/engine/worldComparison.js +164 -0
- package/dist/engine/worldStorage.js +232 -0
- package/dist/index.html +2 -2
- package/dist/lib/reasoningEngine.js +290 -0
- package/dist/lib/simulationAdapter.js +686 -0
- package/dist/lib/swarmParser.js +291 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/utils.js +8 -0
- package/dist/runtime/govern.js +473 -0
- package/dist/runtime/index.js +75 -0
- package/dist/runtime/types.js +11 -0
- package/package.json +5 -2
- package/dist/assets/index-DHKd4rcV.js +0 -338
- package/dist/assets/index-SyyA3z3U.css +0 -1
- package/dist/assets/swarmSimulation-DHDqjfMa.js +0 -1
package/README.md
CHANGED
|
@@ -2,36 +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 they 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
|
-
##
|
|
9
|
+
## The Problem With Agentic Simulation Today
|
|
16
10
|
|
|
17
|
-
|
|
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:
|
|
12
|
+
|
|
13
|
+
*Why did the agents do that?*
|
|
14
|
+
|
|
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.
|
|
16
|
+
|
|
17
|
+
So you rerun. You tweak. You guess. You stare at dashboards full of numbers that describe the system but never explain it.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
That's the gap.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## What NV-SIM Gives You That Nothing Else Does
|
|
22
22
|
|
|
23
|
-
- **
|
|
24
|
-
|
|
25
|
-
|
|
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.
|
|
24
|
+
|
|
25
|
+
You change one constraint — block panic selling, cap leverage at 3x, close a shipping lane — and the system shows you:
|
|
26
|
+
|
|
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"
|
|
26
31
|
|
|
27
32
|
```
|
|
28
33
|
Rule changed
|
|
29
|
-
→
|
|
30
|
-
→
|
|
34
|
+
→ Agents shifted strategy
|
|
35
|
+
→ New patterns emerged
|
|
31
36
|
→ System outcome changed
|
|
37
|
+
→ You know exactly why
|
|
32
38
|
```
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
This is behavioral evidence, not metrics. You don't get a number — you get a story you can trace, verify, and share.
|
|
41
|
+
|
|
42
|
+
### For researchers
|
|
43
|
+
|
|
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.
|
|
45
|
+
|
|
46
|
+
### For developers
|
|
47
|
+
|
|
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.
|
|
49
|
+
|
|
50
|
+
### For both
|
|
51
|
+
|
|
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.
|
|
35
53
|
|
|
36
54
|
## The Demo Moment
|
|
37
55
|
|
|
@@ -46,12 +64,17 @@ system: unstable
|
|
|
46
64
|
|
|
47
65
|
**After:**
|
|
48
66
|
```
|
|
49
|
-
|
|
67
|
+
Market stabilized as agents shifted toward safer positions
|
|
50
68
|
|
|
51
69
|
panic_sell → hold
|
|
52
70
|
panic_sell → hold
|
|
53
71
|
panic_sell → hold
|
|
54
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
|
+
|
|
55
78
|
Pattern: coordinated_holding
|
|
56
79
|
Pattern: panic_suppression
|
|
57
80
|
|
|
@@ -59,13 +82,97 @@ system: unstable
|
|
|
59
82
|
cascade: avoided
|
|
60
83
|
```
|
|
61
84
|
|
|
62
|
-
You didn't predict this. You caused it — by changing one rule — and
|
|
85
|
+
You didn't predict this. You caused it — by changing one rule — and the system told you exactly why.
|
|
63
86
|
|
|
64
|
-
##
|
|
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.
|
|
120
|
+
|
|
121
|
+
## Behavioral Analysis — The Proof Layer
|
|
122
|
+
|
|
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.
|
|
124
|
+
|
|
125
|
+
Every simulation produces behavioral evidence:
|
|
126
|
+
|
|
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
|
|
130
|
+
- **Cross-run comparison** — same agents under different rules, measured side by side
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
BEHAVIORAL ANALYSIS
|
|
134
|
+
|
|
135
|
+
Action Distribution:
|
|
136
|
+
aggressive: 12% (was 67%)
|
|
137
|
+
cooperative: 41% (was 8%)
|
|
138
|
+
cautious: 31% (was 11%)
|
|
139
|
+
defensive: 16% (was 14%)
|
|
140
|
+
|
|
141
|
+
Shifts Detected:
|
|
142
|
+
→ 80% shifted from aggressive to cooperative after round 3
|
|
143
|
+
→ Panic selling replaced by coordinated holding
|
|
144
|
+
→ New pattern: quality_competition (not present in baseline)
|
|
145
|
+
|
|
146
|
+
Trajectory: agent_hedge_fund_1
|
|
147
|
+
Round 1: aggressive → Round 2: aggressive → Round 3: [shifted] → Round 4: cautious → Round 5: cooperative
|
|
148
|
+
```
|
|
149
|
+
|
|
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.
|
|
65
151
|
|
|
66
|
-
|
|
152
|
+
## Audit Trail — Full Evidence Chain
|
|
67
153
|
|
|
68
|
-
|
|
154
|
+
Every decision is recorded in an append-only audit log. Every rule, every agent action, every adaptation — persistent and queryable.
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
AUDIT TRAIL (session: 2026-03-18T14:22:00)
|
|
158
|
+
|
|
159
|
+
agent_hedge_fund_1 → attempted panic_sell → blocked
|
|
160
|
+
rule: no_panic_selling (invariant)
|
|
161
|
+
evidence: action matches blocked pattern during high volatility
|
|
162
|
+
|
|
163
|
+
agent_hedge_fund_1 → shifted to hold
|
|
164
|
+
adapted: true (shifted from aggressive to defensive)
|
|
165
|
+
|
|
166
|
+
BEHAVIORAL SHIFT: agent_hedge_fund_1
|
|
167
|
+
before: aggressive | after: cautious
|
|
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
|
+
## Worlds — Where the Power Lives
|
|
174
|
+
|
|
175
|
+
The `world` you pass controls everything. Change the world, change the outcome.
|
|
69
176
|
|
|
70
177
|
```
|
|
71
178
|
verdict = evaluate(actor="agent_1", action="panic_sell", world="trading")
|
|
@@ -137,64 +244,92 @@ This opens a control surface where you can:
|
|
|
137
244
|
- Adjust state variables with auto-generated controls
|
|
138
245
|
- Inject narrative events at specific rounds
|
|
139
246
|
- Load crisis scenarios with one click
|
|
140
|
-
- Watch the **
|
|
247
|
+
- Watch the **Outcome Panel** — not a log of what happened, but a story of what the system became and why
|
|
141
248
|
- Save any experiment as a reusable variant
|
|
142
249
|
|
|
143
|
-
### The
|
|
250
|
+
### The Outcome Panel
|
|
144
251
|
|
|
145
|
-
When rules reshape behavior, you don't get a
|
|
252
|
+
When rules reshape behavior, you don't get a dashboard of metrics. You get this:
|
|
146
253
|
|
|
147
254
|
```
|
|
148
|
-
◆
|
|
255
|
+
◆ OUTCOME
|
|
256
|
+
|
|
257
|
+
Market stabilized as agents shifted toward safer positions
|
|
258
|
+
|
|
259
|
+
Confidence: Strong | Evidence: Solid | Risk: Low
|
|
260
|
+
|
|
261
|
+
┌─ What Agents Did ────────────────┐
|
|
262
|
+
│ 80% shifted from aggressive to │
|
|
263
|
+
│ conservative strategies │
|
|
264
|
+
│ 12% reduced position size after │
|
|
265
|
+
│ initial attempts failed │
|
|
266
|
+
│ 8% maintained original strategy │
|
|
267
|
+
└──────────────────────────────────┘
|
|
268
|
+
|
|
269
|
+
┌─ Why This Happened ──────────────┐
|
|
270
|
+
│ Early aggressive attempts failed,│
|
|
271
|
+
│ forcing agents to rethink. │
|
|
272
|
+
│ Uncertainty dropped as agents │
|
|
273
|
+
│ stopped experimenting. │
|
|
274
|
+
└──────────────────────────────────┘
|
|
275
|
+
|
|
276
|
+
┌─ What Emerged ───────────────────┐
|
|
277
|
+
│ Coordinated Holding │
|
|
278
|
+
│ Panic Suppression │
|
|
279
|
+
└──────────────────────────────────┘
|
|
280
|
+
|
|
281
|
+
┌─ System Outcome ─────────────────┐
|
|
282
|
+
│ Volatility 47% → 26% │
|
|
283
|
+
│ Stability 58% → 79% │
|
|
284
|
+
│ Cascade Avoided │
|
|
285
|
+
└──────────────────────────────────┘
|
|
286
|
+
|
|
287
|
+
▶ View audit trail
|
|
288
|
+
```
|
|
149
289
|
|
|
150
|
-
|
|
151
|
-
437 actions reshaped out of 1,247 total
|
|
290
|
+
Every line is specific. Every line is shareable. No system jargon.
|
|
152
291
|
|
|
153
|
-
|
|
292
|
+
### World Variants
|
|
154
293
|
|
|
155
|
-
|
|
156
|
-
│ 80% │
|
|
157
|
-
│ adaptation across 1,247 agents │
|
|
158
|
-
│ → BLOCK: hold (312 agents) │
|
|
159
|
-
│ → MODIFY: sell_slowly (87 agents) │
|
|
160
|
-
└────────────────────────────────────┘
|
|
294
|
+
Save any experiment as a named variant:
|
|
161
295
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
└────────────────────────────────────┘
|
|
296
|
+
```
|
|
297
|
+
Adjust rules → Inject events → Run → See what changed → Save as variant
|
|
298
|
+
```
|
|
166
299
|
|
|
167
|
-
|
|
168
|
-
│ Volatility 47% → 26% │
|
|
169
|
-
│ Stability 58% → 79% │
|
|
170
|
-
│ Cascade Avoided │
|
|
171
|
-
└────────────────────────────────────┘
|
|
300
|
+
Variants capture the base world, state overrides, narrative events, and results. Store them in git. Share them. Replay them. This turns experiments into assets.
|
|
172
301
|
|
|
173
|
-
|
|
174
|
-
│ No panic selling allowed. 437 of │
|
|
175
|
-
│ 1,247 agents reorganized — most │
|
|
176
|
-
│ shifted to hold. Volatility │
|
|
177
|
-
│ dropped 21%. │
|
|
178
|
-
└────────────────────────────────────┘
|
|
302
|
+
## Governance Runtime — Plug Into Your Own System
|
|
179
303
|
|
|
180
|
-
|
|
304
|
+
```bash
|
|
305
|
+
npx @neuroverseos/nv-sim serve
|
|
181
306
|
```
|
|
182
307
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
### World Variants
|
|
186
|
-
|
|
187
|
-
Save any experiment as a named variant:
|
|
308
|
+
This starts a local server. Any simulator, agent framework, or application can POST actions and get decisions back.
|
|
188
309
|
|
|
189
310
|
```
|
|
190
|
-
|
|
311
|
+
Endpoint: http://localhost:3456/api/evaluate
|
|
312
|
+
Method: POST
|
|
313
|
+
Contract: { actor, action, payload?, state?, world? }
|
|
314
|
+
Response: { decision: ALLOW|BLOCK|MODIFY, reason, evidence }
|
|
191
315
|
```
|
|
192
316
|
|
|
193
|
-
|
|
317
|
+
Your agents call localhost. The world file decides what's allowed. No cloud. No cost.
|
|
318
|
+
|
|
319
|
+
Additional endpoints:
|
|
320
|
+
|
|
321
|
+
| Endpoint | What It Does |
|
|
322
|
+
|----------|-------------|
|
|
323
|
+
| `POST /api/evaluate` | Submit an action for evaluation |
|
|
324
|
+
| `GET /api/session` | Current session stats |
|
|
325
|
+
| `GET /api/session/report` | Full session report |
|
|
326
|
+
| `POST /api/session/reset` | Reset session state |
|
|
327
|
+
| `POST /api/session/save` | Save session as experiment |
|
|
328
|
+
| `GET /api/events` | SSE stream of live events |
|
|
194
329
|
|
|
195
|
-
|
|
330
|
+
### Works With Anything
|
|
196
331
|
|
|
197
|
-
If your system has actions, you can govern
|
|
332
|
+
If your system has actions, you can govern them. One API call.
|
|
198
333
|
|
|
199
334
|
```
|
|
200
335
|
Agent decides → POST /api/evaluate → verdict → agent adapts
|
|
@@ -264,7 +399,139 @@ If your system can make an HTTP request, it can be governed.
|
|
|
264
399
|
|
|
265
400
|
Most systems generate behavior. This one shapes it.
|
|
266
401
|
|
|
267
|
-
See [INTEGRATION.md](./INTEGRATION.md) for the full API contract and decision types.
|
|
402
|
+
See [INTEGRATION.md](./INTEGRATION.md) for the full API contract, framework guides, and decision types.
|
|
403
|
+
|
|
404
|
+
## Policy Enforcement — The Experiment Loop
|
|
405
|
+
|
|
406
|
+
Write rules in plain English. Run the same scenario. See what changes. Adjust and repeat.
|
|
407
|
+
|
|
408
|
+
### Step 1: See it work (zero config)
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
npx nv-sim enforce
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
Runs three iterations automatically: no rules → light rules → full rules. You see divergence immediately.
|
|
415
|
+
|
|
416
|
+
### Step 2: Write your own rules
|
|
417
|
+
|
|
418
|
+
Create a text file. That's it.
|
|
419
|
+
|
|
420
|
+
```
|
|
421
|
+
# my-rules.txt
|
|
422
|
+
|
|
423
|
+
Block panic selling during high volatility
|
|
424
|
+
Limit leverage to 5x
|
|
425
|
+
Maintain minimum liquidity floor
|
|
426
|
+
Slow down algorithmic trading when contagion spreads
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### Step 3: Run it
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
npx nv-sim enforce trading my-rules.txt
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
The engine parses your plain English into rules, runs the scenario, and shows what changed — with before → after behavioral proof.
|
|
436
|
+
|
|
437
|
+
### Step 4: Change a rule. Run again.
|
|
438
|
+
|
|
439
|
+
Remove "Limit leverage to 5x". Run again. Did stability drop? That rule was load-bearing.
|
|
440
|
+
|
|
441
|
+
Add "Require transparency for all large trades". Run again. Did agents shift strategy?
|
|
442
|
+
|
|
443
|
+
The report tracks every change:
|
|
444
|
+
|
|
445
|
+
```
|
|
446
|
+
RULE CHANGES
|
|
447
|
+
Run 2:
|
|
448
|
+
+ Block panic selling during high volatility
|
|
449
|
+
+ Slow down algorithmic trading when contagion spreads
|
|
450
|
+
- Limit leverage to 5x
|
|
451
|
+
|
|
452
|
+
DIVERGENCE ANALYSIS
|
|
453
|
+
Stability trend: 79% → 98%
|
|
454
|
+
Effectiveness trend: 11% → 32%
|
|
455
|
+
|
|
456
|
+
KEY INSIGHT
|
|
457
|
+
Removing the leverage cap caused agents to take larger positions — but the
|
|
458
|
+
panic selling block forced them to hold through volatility instead of exiting.
|
|
459
|
+
Net effect: more risk-taking, but more stability.
|
|
460
|
+
|
|
461
|
+
TRY THIS EXPERIMENT
|
|
462
|
+
Remove "Block panic selling during high volatility" from your rules file, then run again.
|
|
463
|
+
If stability drops, that rule was load-bearing. If nothing changes, it was noise.
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### Step 5: Compare two rule sets side by side
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
npx nv-sim enforce trading light-rules.txt strict-rules.txt
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### Rule patterns
|
|
473
|
+
|
|
474
|
+
The engine understands these patterns in plain English:
|
|
475
|
+
|
|
476
|
+
| Pattern | What it does | Example |
|
|
477
|
+
|---------|-------------|---------|
|
|
478
|
+
| `Block X` | Hard suppression of matching actions | `Block panic selling` |
|
|
479
|
+
| `Limit X` / `Cap X` | Caps extreme positions | `Limit leverage to 5x` |
|
|
480
|
+
| `Slow X` / `Dampen X` | Reduces large movements | `Slow down algorithmic trading` |
|
|
481
|
+
| `Maintain X` / `Floor X` | Enforces minimum thresholds | `Maintain minimum liquidity` |
|
|
482
|
+
| `Rebalance X` | Pulls extremes toward equilibrium | `Rebalance correlated positions` |
|
|
483
|
+
| `Require X` | Enforceable structural constraint | `Require transparency for large trades` |
|
|
484
|
+
| `Monitor X` | Generates a circuit breaker gate | `Monitor contagion spread` |
|
|
485
|
+
|
|
486
|
+
### Other scenarios
|
|
487
|
+
|
|
488
|
+
```bash
|
|
489
|
+
npx nv-sim enforce strait_of_hormuz my-rules.txt # Same rules, different scenario
|
|
490
|
+
npx nv-sim enforce ai_regulation_crisis # Default progressive run
|
|
491
|
+
npx nv-sim enforce trading --output=report.json # Save as JSON
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### Advanced: JSON world files
|
|
495
|
+
|
|
496
|
+
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.
|
|
497
|
+
|
|
498
|
+
## AI Providers — Bring Your Own Model
|
|
499
|
+
|
|
500
|
+
AI is optional. AI is governed. AI is pluggable.
|
|
501
|
+
|
|
502
|
+
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.
|
|
503
|
+
|
|
504
|
+
### How AI fits in
|
|
505
|
+
|
|
506
|
+
AI plays two governed roles:
|
|
507
|
+
|
|
508
|
+
| Role | What It Does | Constraints |
|
|
509
|
+
|------|-------------|-------------|
|
|
510
|
+
| `ai_translator` | Converts unstructured input into normalized events | Must output valid schema, no invention of events, must include confidence |
|
|
511
|
+
| `ai_analyst` | Generates reports from simulation traces | Must reference trace data, must include blocked actions, no unverifiable claims |
|
|
512
|
+
|
|
513
|
+
Both roles go through `/api/evaluate` like any other actor. The AI doesn't control the system — the system controls the AI.
|
|
514
|
+
|
|
515
|
+
### Supported providers
|
|
516
|
+
|
|
517
|
+
NV-SIM auto-detects the best available provider from your environment:
|
|
518
|
+
|
|
519
|
+
| Provider | Env Var | What It Connects To |
|
|
520
|
+
|----------|---------|---------------------|
|
|
521
|
+
| Anthropic (Claude) | `ANTHROPIC_API_KEY` | Claude Sonnet, Opus, Haiku |
|
|
522
|
+
| OpenAI | `OPENAI_API_KEY` | GPT-4, GPT-4o, o1 |
|
|
523
|
+
| Groq | `GROQ_API_KEY` | Llama 3 70B |
|
|
524
|
+
| Together | `TOGETHER_API_KEY` | Llama, Mixtral |
|
|
525
|
+
| Mistral | `MISTRAL_API_KEY` | Mistral Large |
|
|
526
|
+
| Deepseek | `DEEPSEEK_API_KEY` | Deepseek Chat |
|
|
527
|
+
| Fireworks | `FIREWORKS_API_KEY` | Llama, custom models |
|
|
528
|
+
| Ollama | `OLLAMA_BASE_URL` | Any local model |
|
|
529
|
+
| Local LLM | `LOCAL_LLM_URL` | LM Studio, vLLM, llama.cpp |
|
|
530
|
+
| (none) | — | Deterministic fallback (no AI, no cost) |
|
|
531
|
+
|
|
532
|
+
Set the env var and run. No configuration files. No provider lock-in.
|
|
533
|
+
|
|
534
|
+
Any endpoint that speaks the OpenAI chat completions format (`POST /v1/chat/completions`) works out of the box.
|
|
268
535
|
|
|
269
536
|
## Quick Start
|
|
270
537
|
|
|
@@ -295,6 +562,7 @@ npx @neuroverseos/nv-sim serve
|
|
|
295
562
|
|
|
296
563
|
| Command | What It Does |
|
|
297
564
|
|---------|-------------|
|
|
565
|
+
| `nv-sim enforce [preset]` | Policy enforcement lab — iterative rule testing |
|
|
298
566
|
| `nv-sim visualize` | Interactive control platform |
|
|
299
567
|
| `nv-sim compare [preset]` | Baseline vs governed simulation |
|
|
300
568
|
| `nv-sim compare --inject event@round,...` | With narrative shocks |
|
|
@@ -304,21 +572,23 @@ npx @neuroverseos/nv-sim serve
|
|
|
304
572
|
| `nv-sim worlds <a> <b>` | Compare two rule environments |
|
|
305
573
|
| `nv-sim chaos [preset] --runs N` | Stress test across randomized scenarios |
|
|
306
574
|
| `nv-sim serve --port N` | Local governance runtime for any simulator |
|
|
575
|
+
| `nv-sim run <simulator>` | Connect external simulator to governance |
|
|
307
576
|
| `nv-sim analyze <file>` | Analyze simulation from file or stdin |
|
|
308
577
|
| `nv-sim presets` | List available world presets |
|
|
309
578
|
|
|
310
579
|
## How It Works
|
|
311
580
|
|
|
312
581
|
```
|
|
313
|
-
event → narrative propagation → belief shift → agent action → governance → outcome
|
|
582
|
+
event → narrative propagation → belief shift → agent action → governance → behavioral analysis → outcome
|
|
314
583
|
```
|
|
315
584
|
|
|
316
|
-
|
|
585
|
+
Five forces shape every simulation:
|
|
317
586
|
|
|
318
|
-
1. **Agent behavior** — traders, voters, regulators, media
|
|
319
|
-
2. **World rules** — leverage caps, circuit breakers, chokepoints
|
|
320
|
-
3. **Narrative events** — information shocks that propagate through the system
|
|
321
|
-
4. **Perception propagation** — different agents react differently to the same event
|
|
587
|
+
1. **Agent behavior** — traders, voters, regulators, media — each with different risk profiles and strategies
|
|
588
|
+
2. **World rules** — leverage caps, circuit breakers, chokepoints — the constraints that shape what agents can do
|
|
589
|
+
3. **Narrative events** — information shocks that propagate through the system at different speeds
|
|
590
|
+
4. **Perception propagation** — different agents react differently to the same event based on their role and exposure
|
|
591
|
+
5. **Behavioral analysis** — tracks how agents reorganize, producing the before → after evidence that proves rules actually changed the system
|
|
322
592
|
|
|
323
593
|
This lets you ask compound questions:
|
|
324
594
|
|
|
@@ -333,15 +603,23 @@ That combination produces very different outcomes than any single factor alone.
|
|
|
333
603
|
↓
|
|
334
604
|
nv-sim engine ← world rules + narrative injection + swarm simulation
|
|
335
605
|
↓
|
|
336
|
-
|
|
606
|
+
behavioral analysis ← before→after shift detection, trajectory tracking, cross-run comparison
|
|
607
|
+
↓
|
|
608
|
+
audit trail ← append-only evidence chain (JSONL)
|
|
337
609
|
↓
|
|
338
|
-
|
|
610
|
+
nv-sim CLI ← scenarios, comparison, chaos testing, governance runtime
|
|
611
|
+
↓
|
|
612
|
+
control platform ← interactive browser UI + outcome panels
|
|
613
|
+
↓
|
|
614
|
+
AI providers (optional) ← BYOM: Anthropic, OpenAI, Groq, local LLMs, or none
|
|
339
615
|
↓
|
|
340
616
|
world variants ← saved experiments as shareable assets
|
|
341
617
|
```
|
|
342
618
|
|
|
343
619
|
Everything runs locally. NV-SIM uses [`@neuroverseos/governance`](https://www.npmjs.com/package/@neuroverseos/governance) for deterministic guard evaluation — no LLM, no cloud, no cost. Your agents call `localhost`, and the world file decides what's allowed.
|
|
344
620
|
|
|
621
|
+
AI is optional. When present, it's governed — subject to the same rules as any other actor in the system.
|
|
622
|
+
|
|
345
623
|
## License
|
|
346
624
|
|
|
347
625
|
Apache 2.0
|