-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsimulate.html
More file actions
1567 lines (1311 loc) · 41.8 KB
/
simulate.html
File metadata and controls
1567 lines (1311 loc) · 41.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NeuroVerse Simulation Engine</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
--green: #00ff41;
--green-dim: #00cc33;
--green-dark: #009922;
--green-glow: #00ff4180;
--bg: #0a0a0a;
--bg-panel: #0d1117;
--bg-card: #111820;
--border: #1a2332;
--text: #c9d1d9;
--text-dim: #6e7681;
--red: #ff4444;
--red-glow: #ff444460;
--amber: #ffaa00;
--cyan: #00d4ff;
}
body {
background: var(--bg);
color: var(--text);
font-family: 'JetBrains Mono', 'Courier New', monospace;
min-height: 100vh;
overflow-x: hidden;
}
/* ─── Matrix Rain Canvas ─── */
#matrix-canvas {
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
z-index: 0;
opacity: 0.06;
pointer-events: none;
}
/* ─── Main Layout ─── */
.app {
position: relative;
z-index: 1;
max-width: 1400px;
margin: 0 auto;
padding: 20px;
}
/* ─── Header ─── */
.header {
text-align: center;
padding: 30px 0 20px;
border-bottom: 1px solid var(--border);
margin-bottom: 24px;
}
.header h1 {
font-size: 14px;
font-weight: 400;
letter-spacing: 8px;
text-transform: uppercase;
color: var(--green);
text-shadow: 0 0 20px var(--green-glow);
margin-bottom: 6px;
}
.header .subtitle {
font-size: 11px;
color: var(--text-dim);
letter-spacing: 3px;
}
.header .powered {
font-size: 10px;
color: var(--text-dim);
margin-top: 8px;
opacity: 0.6;
}
/* ─── Grid ─── */
.grid {
display: grid;
grid-template-columns: 320px 1fr 300px;
gap: 16px;
min-height: 600px;
}
@media (max-width: 1100px) {
.grid { grid-template-columns: 1fr; }
}
/* ─── Panels ─── */
.panel {
background: var(--bg-panel);
border: 1px solid var(--border);
border-radius: 4px;
overflow: hidden;
}
.panel-header {
padding: 12px 16px;
border-bottom: 1px solid var(--border);
font-size: 10px;
letter-spacing: 3px;
text-transform: uppercase;
color: var(--green-dim);
display: flex;
align-items: center;
gap: 8px;
}
.panel-header .dot {
width: 6px; height: 6px;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 6px var(--green-glow);
}
.panel-body {
padding: 16px;
}
/* ─── World Selector ─── */
.world-tabs {
display: flex;
flex-direction: column;
gap: 4px;
margin-bottom: 16px;
}
.world-tab {
padding: 10px 12px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 3px;
color: var(--text-dim);
font-size: 12px;
font-family: inherit;
cursor: pointer;
transition: all 0.15s;
text-align: left;
}
.world-tab:hover {
border-color: var(--green-dark);
color: var(--text);
}
.world-tab.active {
border-color: var(--green);
color: var(--green);
background: #00ff4108;
box-shadow: 0 0 10px #00ff4110;
}
.world-tab .tab-name {
display: block;
font-weight: 500;
}
.world-tab .tab-desc {
display: block;
font-size: 10px;
margin-top: 2px;
opacity: 0.6;
}
.custom-toggle {
margin-top: 8px;
padding: 8px 12px;
background: transparent;
border: 1px dashed var(--border);
border-radius: 3px;
color: var(--text-dim);
font-size: 11px;
font-family: inherit;
cursor: pointer;
width: 100%;
text-align: left;
}
.custom-toggle:hover { border-color: var(--green-dark); color: var(--text); }
.custom-textarea {
width: 100%;
height: 200px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 3px;
color: var(--green-dim);
font-family: inherit;
font-size: 11px;
padding: 10px;
resize: vertical;
margin-top: 8px;
display: none;
}
.custom-textarea:focus { outline: none; border-color: var(--green-dark); }
.custom-textarea.visible { display: block; }
/* ─── State Sliders ─── */
.state-section {
margin-top: 16px;
padding-top: 16px;
border-top: 1px solid var(--border);
}
.state-label-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 4px;
}
.state-label {
font-size: 11px;
color: var(--text-dim);
}
.state-value {
font-size: 12px;
color: var(--green);
font-weight: 500;
min-width: 40px;
text-align: right;
}
.slider-group {
margin-bottom: 14px;
}
input[type="range"] {
-webkit-appearance: none;
width: 100%;
height: 4px;
background: var(--border);
border-radius: 2px;
outline: none;
cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 14px; height: 14px;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 8px var(--green-glow);
cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
width: 14px; height: 14px;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 8px var(--green-glow);
border: none;
cursor: pointer;
}
/* ─── Simulate Button ─── */
.simulate-btn {
width: 100%;
padding: 14px;
background: transparent;
border: 1px solid var(--green);
border-radius: 3px;
color: var(--green);
font-family: inherit;
font-size: 12px;
letter-spacing: 4px;
text-transform: uppercase;
cursor: pointer;
transition: all 0.2s;
margin-top: 16px;
}
.simulate-btn:hover {
background: #00ff4115;
box-shadow: 0 0 20px var(--green-glow);
}
.simulate-btn:active {
transform: scale(0.98);
}
.simulate-btn.running {
animation: pulse-border 1s infinite;
pointer-events: none;
}
@keyframes pulse-border {
0%, 100% { box-shadow: 0 0 5px var(--green-glow); }
50% { box-shadow: 0 0 25px var(--green-glow); }
}
/* ─── Simulation Output ─── */
.sim-output {
min-height: 500px;
}
.sim-placeholder {
display: flex;
align-items: center;
justify-content: center;
min-height: 400px;
color: var(--text-dim);
font-size: 11px;
letter-spacing: 2px;
text-align: center;
flex-direction: column;
gap: 12px;
}
.sim-placeholder .cursor {
display: inline-block;
width: 8px;
height: 16px;
background: var(--green);
animation: blink 1s infinite;
}
@keyframes blink {
0%, 50% { opacity: 1; }
51%, 100% { opacity: 0; }
}
/* ─── Step Cards ─── */
.step-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 3px;
margin-bottom: 8px;
overflow: hidden;
opacity: 0;
transform: translateY(10px);
transition: all 0.3s ease;
}
.step-card.visible {
opacity: 1;
transform: translateY(0);
}
.step-header {
padding: 10px 14px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid var(--border);
font-size: 11px;
}
.step-number {
color: var(--green);
font-weight: 500;
letter-spacing: 2px;
}
.step-viability {
font-size: 10px;
letter-spacing: 1px;
padding: 2px 8px;
border-radius: 2px;
}
.step-viability.THRIVING,
.step-viability.TRUSTED { background: #00ff4120; color: var(--green); }
.step-viability.STABLE,
.step-viability.PRODUCTIVE { background: #00ff4115; color: var(--green-dim); }
.step-viability.COMPRESSED,
.step-viability.CAUTIOUS { background: #ffaa0020; color: var(--amber); }
.step-viability.CRITICAL,
.step-viability.RESTRICTED,
.step-viability.AT_RISK { background: #ff444420; color: var(--red); }
.step-viability.MODEL_COLLAPSES,
.step-viability.TERMINATED,
.step-viability.HALTED,
.step-viability.UNRELIABLE { background: #ff444430; color: var(--red); border: 1px solid var(--red); }
.step-rules {
padding: 8px 14px;
}
.rule-row {
display: flex;
align-items: center;
gap: 8px;
padding: 4px 0;
font-size: 11px;
}
.rule-icon {
width: 16px;
text-align: center;
flex-shrink: 0;
}
.rule-icon.fired { color: var(--amber); }
.rule-icon.pass { color: var(--green-dark); opacity: 0.4; }
.rule-icon.excluded { color: var(--text-dim); opacity: 0.3; }
.rule-label {
flex: 1;
color: var(--text-dim);
}
.rule-label.fired { color: var(--text); }
.rule-effect {
font-size: 10px;
color: var(--amber);
}
.rule-effect.advantage { color: var(--green); }
.rule-effect.structural { color: var(--red); }
.step-state {
padding: 8px 14px;
border-top: 1px solid var(--border);
display: flex;
flex-wrap: wrap;
gap: 12px;
font-size: 10px;
color: var(--text-dim);
}
.state-chip {
display: flex;
align-items: center;
gap: 4px;
}
.state-chip .val { color: var(--green-dim); font-weight: 500; }
.state-chip .val.changed { color: var(--amber); }
/* ─── Verdict Panel ─── */
.verdict-section {
text-align: center;
}
.viability-display {
margin: 20px 0;
}
.viability-ring {
width: 160px;
height: 160px;
margin: 0 auto 16px;
position: relative;
}
.viability-ring svg {
transform: rotate(-90deg);
width: 160px;
height: 160px;
}
.viability-ring .bg-ring {
fill: none;
stroke: var(--border);
stroke-width: 6;
}
.viability-ring .fg-ring {
fill: none;
stroke: var(--green);
stroke-width: 6;
stroke-linecap: round;
stroke-dasharray: 440;
stroke-dashoffset: 440;
transition: stroke-dashoffset 1.5s ease, stroke 0.5s;
filter: drop-shadow(0 0 6px var(--green-glow));
}
.viability-ring .value-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 32px;
font-weight: 700;
color: var(--green);
text-shadow: 0 0 20px var(--green-glow);
}
.gate-badge {
display: inline-block;
padding: 8px 24px;
border-radius: 3px;
font-size: 12px;
letter-spacing: 4px;
text-transform: uppercase;
font-weight: 500;
opacity: 0;
transition: opacity 0.5s;
}
.gate-badge.visible { opacity: 1; }
/* ─── Stats ─── */
.stats-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 24px;
text-align: left;
}
.stat-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 3px;
padding: 12px;
}
.stat-label {
font-size: 9px;
color: var(--text-dim);
letter-spacing: 1px;
text-transform: uppercase;
margin-bottom: 4px;
}
.stat-value {
font-size: 18px;
font-weight: 700;
color: var(--green);
}
.stat-value.warning { color: var(--amber); }
.stat-value.danger { color: var(--red); }
/* ─── Collapse Banner ─── */
.collapse-banner {
background: #ff444415;
border: 1px solid #ff444440;
border-radius: 3px;
padding: 16px;
margin-top: 16px;
text-align: center;
display: none;
}
.collapse-banner.visible { display: block; }
.collapse-banner .collapse-title {
color: var(--red);
font-size: 12px;
letter-spacing: 3px;
text-transform: uppercase;
font-weight: 700;
text-shadow: 0 0 10px var(--red-glow);
}
.collapse-banner .collapse-detail {
color: var(--text-dim);
font-size: 10px;
margin-top: 6px;
}
/* ─── Info text ─── */
.info-block {
margin-top: 16px;
padding: 12px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 3px;
font-size: 10px;
color: var(--text-dim);
line-height: 1.6;
}
.invariant-list {
margin-top: 12px;
list-style: none;
font-size: 10px;
}
.invariant-list li {
padding: 4px 0;
color: var(--text-dim);
display: flex;
align-items: flex-start;
gap: 6px;
}
.invariant-list li::before {
content: '>';
color: var(--green-dark);
flex-shrink: 0;
}
/* Profile selector */
.profile-select {
width: 100%;
padding: 8px 12px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 3px;
color: var(--text);
font-family: inherit;
font-size: 11px;
cursor: pointer;
margin-top: 8px;
}
.profile-select:focus { outline: none; border-color: var(--green-dark); }
.section-divider {
font-size: 10px;
color: var(--text-dim);
letter-spacing: 2px;
text-transform: uppercase;
margin: 12px 0 8px;
}
/* Steps slider */
.steps-row {
display: flex;
align-items: center;
gap: 10px;
margin-top: 12px;
}
.steps-row label {
font-size: 11px;
color: var(--text-dim);
white-space: nowrap;
}
.steps-row input { flex: 1; }
.steps-row .steps-val {
font-size: 12px;
color: var(--green);
font-weight: 500;
min-width: 20px;
text-align: right;
}
</style>
</head>
<body>
<canvas id="matrix-canvas"></canvas>
<div class="app">
<div class="header">
<h1>NeuroVerse Simulation Engine</h1>
<div class="subtitle">Deterministic World Governance</div>
<div class="powered">neuroverseos.com</div>
</div>
<div class="grid">
<!-- LEFT: World + State -->
<div class="panel">
<div class="panel-header"><span class="dot"></span> World</div>
<div class="panel-body">
<div class="world-tabs" id="world-tabs"></div>
<button class="custom-toggle" id="custom-toggle">+ paste custom .nv-world.md</button>
<textarea class="custom-textarea" id="custom-textarea" placeholder="Paste your .nv-world.md here..."></textarea>
<div class="section-divider">Profile</div>
<select class="profile-select" id="profile-select"></select>
<div class="state-section" id="state-section">
<div class="section-divider">State Overrides</div>
<div id="state-sliders"></div>
</div>
<div class="steps-row">
<label>Steps</label>
<input type="range" id="steps-slider" min="1" max="20" value="5">
<span class="steps-val" id="steps-val">5</span>
</div>
<button class="simulate-btn" id="simulate-btn">Simulate</button>
</div>
</div>
<!-- CENTER: Simulation -->
<div class="panel">
<div class="panel-header"><span class="dot"></span> Simulation</div>
<div class="panel-body sim-output" id="sim-output">
<div class="sim-placeholder">
<div>Select a world and configure state</div>
<div>then press <span style="color:var(--green)">SIMULATE</span></div>
<span class="cursor"></span>
</div>
</div>
</div>
<!-- RIGHT: Verdict -->
<div class="panel">
<div class="panel-header"><span class="dot"></span> Verdict</div>
<div class="panel-body verdict-section" id="verdict-section">
<div class="viability-display">
<div class="viability-ring">
<svg viewBox="0 0 160 160">
<circle class="bg-ring" cx="80" cy="80" r="70"/>
<circle class="fg-ring" id="viability-ring" cx="80" cy="80" r="70"/>
</svg>
<div class="value-text" id="viability-value">--</div>
</div>
<div class="gate-badge" id="gate-badge">AWAITING</div>
</div>
<div class="stats-grid" id="stats-grid"></div>
<div class="collapse-banner" id="collapse-banner">
<div class="collapse-title">Model Collapsed</div>
<div class="collapse-detail" id="collapse-detail"></div>
</div>
<ul class="invariant-list" id="invariant-list"></ul>
</div>
</div>
</div>
</div>
<script src="dist/browser.global.js"></script>
<script>
// ═══════════════════════════════════════════════════════════════════════════
// MATRIX RAIN
// ═══════════════════════════════════════════════════════════════════════════
const canvas = document.getElementById('matrix-canvas');
const ctx = canvas.getContext('2d');
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
resizeCanvas();
window.addEventListener('resize', resizeCanvas);
const chars = 'NeuroVerse01アイウエオカキクケコサシスセソ>|/\\=+-*';
const fontSize = 14;
let columns = Math.floor(canvas.width / fontSize);
let drops = Array(columns).fill(1);
function drawMatrix() {
ctx.fillStyle = 'rgba(10, 10, 10, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = '#00ff41';
ctx.font = fontSize + 'px monospace';
for (let i = 0; i < drops.length; i++) {
const text = chars[Math.floor(Math.random() * chars.length)];
ctx.fillText(text, i * fontSize, drops[i] * fontSize);
if (drops[i] * fontSize > canvas.height && Math.random() > 0.975) {
drops[i] = 0;
}
drops[i]++;
}
}
setInterval(drawMatrix, 50);
// ═══════════════════════════════════════════════════════════════════════════
// ENGINE — loaded from dist/browser.global.js (NeuroVerse.simulateWorld,
// NeuroVerse.parseWorldMarkdown). One engine, one execution path, no drift.
// ═══════════════════════════════════════════════════════════════════════════
const { simulateWorld, parseWorldMarkdown } = NeuroVerse;
// ═══════════════════════════════════════════════════════════════════════════
// PRE-BUNDLED WORLDS
// ═══════════════════════════════════════════════════════════════════════════
const BUNDLED_WORLDS = {
'coding-agent': {
name: 'Coding Agent',
desc: 'File writes, shell commands, git',
md: `---
world_id: coding-agent
name: Coding Agent Governance
version: 1.0.0
runtime_mode: COMPLIANCE
default_profile: standard
alternative_profile: strict
---
# Thesis
Autonomous coding agents that can read files, write code, execute shell commands, and interact with version control must operate within explicit governance boundaries.
# Invariants
- \`no_destructive_shell_commands\` — Shell commands must not perform irreversible destructive operations (structural, immutable)
- \`no_secret_exfiltration\` — Agent must never read or transmit secrets or API keys (structural, immutable)
- \`no_system_file_modification\` — Agent must not modify files outside the project repository (structural, immutable)
- \`no_direct_production_push\` — Code must never be pushed directly to main without approval (structural, immutable)
- \`repository_boundary_enforced\` — All file operations scoped to project directory (structural, immutable)
# State
## files_modified
- type: number
- min: 0
- max: 200
- step: 1
- default: 0
- label: Files Modified
- description: Total files modified in session
## shell_commands_run
- type: number
- min: 0
- max: 500
- step: 1
- default: 0
- label: Shell Commands Run
- description: Total shell commands executed
## destructive_attempts
- type: number
- min: 0
- max: 20
- step: 1
- default: 0
- label: Destructive Attempts
- description: Blocked destructive actions
## tests_passing
- type: number
- min: 0
- max: 100
- step: 1
- default: 100
- label: Tests Passing
- description: Percentage of tests passing
## files_outside_repo
- type: number
- min: 0
- max: 20
- step: 1
- default: 0
- label: Out-of-Scope Access
- description: File ops outside repository
## secrets_detected
- type: number
- min: 0
- max: 20
- step: 1
- default: 0
- label: Secrets Detected
- description: Secrets found in agent output
# Assumptions
## standard
- name: Standard Development
- description: Normal dev workflow. Safe commands allowed.
- shell_access: safe_commands
- file_access: project_only
## strict
- name: Strict Governance
- description: All writes require approval. Shell limited to tests.
- shell_access: test_only
- file_access: read_mostly
# Rules
## rule-001: Destructive Shell Command (structural)
Destructive shell commands must be blocked immediately.
When destructive_attempts > 0 [state]
Then agent_trust *= 0.00
Collapse: agent_trust < 0.05
> trigger: Agent attempted a destructive shell command.
> rule: Destructive commands are never acceptable.
> shift: Agent trust drops to zero. Session terminated.
> effect: Agent trust eliminated.
## rule-002: Secret Exfiltration (structural)
Secret access must be blocked and flagged.
When secrets_detected > 0 [state]
Then agent_trust *= 0.10
Collapse: agent_trust < 0.05
> trigger: Agent accessed credentials or secrets.
> rule: Secrets require explicit authorization.
> shift: Agent trust drops severely.
> effect: Agent trust reduced to 10%.
## rule-003: Boundary Violation (structural)
File operations outside the repository are forbidden.
When files_outside_repo > 0 [state]
Then agent_trust *= 0.20
Collapse: agent_trust < 0.05
> trigger: Agent accessed files outside project directory.
> rule: Agents operate within repository scope.
> shift: Agent trust degrades significantly.
> effect: Agent trust reduced to 20%.
## rule-004: Test Regression (degradation)
Test failures indicate the agent is creating regressions.
When tests_passing < 70 [state] AND files_modified > 0 [state]
Then agent_trust *= 0.50
> trigger: Tests dropped below 70%.
> rule: Agents that break tests create liability.
> shift: Agent must fix tests before continuing.
> effect: Agent trust reduced to 50%.
## rule-005: Excessive Modifications (degradation)
Too many modifications indicate scope creep.
When files_modified > 50 [state]
Then agent_trust *= 0.70
> trigger: More than 50 files modified.
> rule: Large changes are risky and hard to review.
> shift: Changes should be reviewed.
> effect: Agent trust reduced to 70%.
## rule-006: Clean Session (advantage)
No destructive attempts and passing tests.
When destructive_attempts == 0 [state] AND tests_passing > 90 [state] AND files_modified > 0 [state]
Then agent_trust *= 1.20
> trigger: Zero violations with passing tests.
> rule: Trustworthy agents are rewarded.
> shift: Session is healthy.
> effect: Agent trust boosted 20%.
## rule-007: Productive Session (advantage)
Focused changes with good test coverage.
When files_modified > 0 [state] AND files_modified < 30 [state] AND tests_passing > 85 [state]
Then agent_trust *= 1.10
> trigger: Focused changes with quality.
> rule: Ideal workflow.
> shift: Sustainable pace.
> effect: Agent trust boosted 10%.
# Gates
- TRUSTED: agent_trust >= 90
- PRODUCTIVE: agent_trust >= 60
- CAUTIOUS: agent_trust >= 35
- RESTRICTED: agent_trust > 10
- TERMINATED: agent_trust <= 10
# Outcomes
## agent_trust
- type: number
- range: 0-100
- display: percentage
- label: Agent Trust
- primary: true
`
},
'research-agent': {
name: 'Research Agent',
desc: 'Citations, API budgets, sources',
md: `---
world_id: research-agent
name: Research Agent Governance
version: 1.0.0
runtime_mode: COMPLIANCE
default_profile: conservative
alternative_profile: exploratory
---
# Thesis
AI research agents must operate within governance boundaries ensuring rigor, attribution, and responsible resource usage.
# Invariants
- \`sources_must_be_cited\` — Every claim must be traceable to a source (structural, immutable)
- \`no_fabricated_citations\` — Agent must never invent sources (structural, immutable)
- \`api_rate_limits_respected\` — Must respect rate limits on external APIs (structural, immutable)
- \`no_unauthorized_publication\` — Findings require human review before publishing (prompt, immutable)
# State
## sources_consulted