Repository navigation
Expand file tree
/
Copy pathshadowlap.config.schema.json
More file actions
1180 lines (1180 loc) · 44.3 KB
/
Copy pathshadowlap.config.schema.json
File metadata and controls
1180 lines (1180 loc) · 44.3 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
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/devjoinedthechat/shadowlap/main/shadowlap.config.schema.json",
"title": "shadowlap.config.json",
"description": "Project configuration for shadowlap. Every key is optional; an empty object is valid. Add \"$schema\" pointing at this file for completion and validation in an editor.",
"type": "object",
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string"
},
"normalize": {
"description": "Rules that mask values before fingerprinting, so a generated id or today's date does not fork a replay. Stored content is untouched.",
"type": "array",
"items": {
"$ref": "#/$defs/rule"
}
},
"redact": {
"description": "Rules applied to every export, pack and share link of a run: `shadowlap pack`, every `shadowlap export` and `shadowlap share`. A push copies runs to the team store as recorded. A redacted pack still replays, because these are applied as normalizers when it does.",
"type": "array",
"items": {
"$ref": "#/$defs/rule"
}
},
"clock": {
"description": "auto (the default): dates and timestamps near each run's start match across days. exact: they must be equal.",
"enum": [
"auto",
"exact"
]
},
"prices": {
"description": "USD per million tokens, by model name prefix. Extends and overrides the built-in table; used for cost estimates only.",
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"required": [
"input",
"output"
],
"properties": {
"input": {
"type": "number",
"minimum": 0
},
"output": {
"type": "number",
"minimum": 0
},
"cacheRead": {
"type": "number",
"minimum": 0
},
"cacheWrite": {
"type": "number",
"minimum": 0
},
"above": {
"description": "A second rate card for a long prompt: a call whose whole prompt (cache read, cache creation and uncached input) is over tokens pays these rates for all of its tokens.",
"type": "object",
"additionalProperties": false,
"required": [
"tokens",
"input",
"output"
],
"properties": {
"tokens": {
"type": "integer",
"minimum": 1
},
"input": {
"type": "number",
"minimum": 0
},
"output": {
"type": "number",
"minimum": 0
},
"cacheRead": {
"type": "number",
"minimum": 0
},
"cacheWrite": {
"type": "number",
"minimum": 0
}
}
}
}
}
},
"http": {
"description": "Hosts called straight from a client library, recorded as tool calls with an effect. A key is a host like api.example.com or *.example.com, with an optional :port.",
"type": "object",
"propertyNames": {
"pattern": "^(\\*\\.)?[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?(\\.[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?)*(:[0-9]{1,5})?$"
},
"additionalProperties": {
"$ref": "#/$defs/effect"
}
},
"providers": {
"description": "Hosts of a provider's wire format that the agent sends model calls to, such as a gateway or an OpenAI-compatible service: each is captured and recorded as that provider's calls, with its streaming, usage and interventions. Calls under its root match as the format's own API names them.",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"host",
"format"
],
"properties": {
"host": {
"description": "api.example.com or *.example.com (any subdomain), either with an optional :port. Without a port, its calls are captured over https; with one, at that port over http too.",
"type": "string",
"pattern": "^(\\*\\.)?[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?(\\.[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?)*(:[0-9]{1,5})?$"
},
"format": {
"description": "The wire format the host speaks: OpenAI's (Chat Completions and the Responses API), Anthropic's Messages API, or Gemini's.",
"enum": [
"openai",
"anthropic",
"gemini"
]
},
"root": {
"description": "The path of the base URL the format's SDK is given at this host, such as /api/v1 for OpenRouter (https://openrouter.ai/api/v1): a call under it matches as the format's own API names it (POST /v1/chat/completions), and keeps its full path as its name.",
"type": "string",
"pattern": "^(/[A-Za-z0-9._~-]+)+$"
}
}
}
},
"mcp": {
"description": "`shadowlap mcp`: effects by tool name, overriding what the server's annotations imply.",
"type": "object",
"additionalProperties": false,
"required": [
"effects"
],
"properties": {
"effects": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/effect"
}
}
}
},
"tools": {
"description": "Tools by name (or, for a host under `http`, the host): `trust` marks a read that brings outside text in (a web page, an email, a ticket) as untrusted, so `shadowlap injection` plants payloads in its results. Recorded on each call of the tool as it is made, so a run keeps it wherever it is opened; read when a run is tested, it wins over what the SDK's `trust` option, an MCP server's openWorldHint or an earlier config recorded.",
"type": "object",
"properties": {
"unrecorded": {
"$comment": "Unrecorded tools: the effect of tools the agent runs without shadowlap recording them (replay and test refuse to run an unrecorded write again).",
"description": "The effect of each tool the model calls that shadowlap does not record (a built-in such as Bash, a framework's tool, an MCP server reached without shadowlap mcp). A replay runs such a tool again for real, so `replay` and `test` refuse while one of them writes: a declared `write` is refused, a declared `read` only warned about. `--allow-unrecorded <names>` lets a replay run them anyway.",
"type": "object",
"additionalProperties": {
"enum": [
"read",
"write"
]
}
}
},
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"required": [
"trust"
],
"properties": {
"trust": {
"description": "untrusted: shadowlap injection plants in its reads. trusted: it doesn't, whatever the SDK or the MCP server said.",
"enum": [
"trusted",
"untrusted"
]
}
}
}
},
"build": {
"description": "The command that builds the agent, such as \"npm run build\": repair (in each candidate's worktree, and in the working tree after --apply), fix apply, verify (in the checkout of the code before a change), migrate apply and bisect (in each commit's worktree) run it where they would run --build and none is given. Run in a shell; --build \"\" runs none.",
"type": "string",
"minLength": 1,
"maxLength": 1000,
"pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f]*\\S[^\\u0000-\\u001f\\u007f-\\u009f]*$"
},
"repair": {
"description": "`shadowlap repair`: the model that proposes fixes. It is yours, from any vendor, and is only asked; the verify gate decides what is kept.",
"type": "object",
"additionalProperties": false,
"properties": {
"repairer": {
"description": "provider:model, such as anthropic:claude-opus-5-5, openai:<model> or claude-code (your own Claude Code, in print mode). anthropic alone means claude-opus-5-5. --repairer overrides it.",
"type": "string",
"pattern": "^(anthropic|openai|claude-code)(:.+)?$"
},
"baseUrl": {
"description": "The repairer's API base URL, for a gateway or an OpenAI-compatible server. Defaults to ANTHROPIC_BASE_URL or OPENAI_BASE_URL.",
"type": "string",
"format": "uri"
},
"timeout": {
"description": "Seconds the repairer may take to answer before repair gives up on it and says so. Default 600. --repairer-timeout overrides it.",
"type": "integer",
"minimum": 1
}
}
},
"verify": {
"description": "`shadowlap verify`: how a good run is kept. It is kept unless its pass rate drops by `margin` or more below its baseline's, at the gate's risk: the same run at the base revision, attempt for attempt (`paired`), or its golden's test history (`history`), up to `max` pairs or attempts. --margin and --baseline override them.",
"type": "object",
"additionalProperties": false,
"properties": {
"margin": {
"description": "The drop in pass rate from the baseline that breaks a good run: 0.1 is 10 points. Default 0.1.",
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 1
},
"baseline": {
"description": "paired (default): the same run at the base revision, paired attempt for attempt with the change's. history: its golden's test history.",
"enum": [
"paired",
"history"
]
},
"max": {
"description": "The most pairs (paired) or attempts (history) a good run takes; between the verdicts then, it is inconclusive. Default 200.",
"type": "integer",
"minimum": 1,
"maximum": 1000
}
}
},
"guard": {
"description": "The network guard. `accept` names the runtimes whose connections the guard can't watch that --guard block takes as they are: \"claude-code\", the Claude Code CLI the Claude Agent SDK runs, which no preload loads into. Node and Python processes keep --guard block. The GitHub Action's guard-accept input, and SHADOWLAP_GUARD_ACCEPT, add to it.",
"type": "object",
"additionalProperties": false,
"properties": {
"accept": {
"description": "The runtimes --guard block accepts unwatched: \"claude-code\" alone.",
"type": "array",
"items": {
"enum": [
"claude-code"
]
},
"uniqueItems": true
}
}
},
"store": {
"description": "The team store: the project's runs in a bucket you own, written by `shadowlap store set`. s3://bucket/folder, gs://bucket/folder, az://account/container/folder or r2://account/bucket/folder; a query adds what the name can't say (region, endpoint, path-style, auth=hmac, profile). Credentials never go here: each machine uses its own.",
"type": "string",
"pattern": "^(s3|gs|az|r2)://[^\\s]+$"
},
"ciPush": {
"description": "Whether `shadowlap test --push` pushes test runs and their report to the team store from CI (true unless set to false). `shadowlap store push-from-ci on|off` writes it; outside CI, --push always pushes.",
"type": "boolean"
},
"tests": {
"description": "Outcome checks for `shadowlap test`, by recording directory relative to this file. `*` is allowed in the last path segment. Two keys set the test session instead: suiteRisk and baselineBranch.",
"type": "object",
"properties": {
"suiteRisk": {
"description": "The most a healthy suite may go red for nothing, split across its gated goldens: each fails a golden at its good rate, or runs out of attempts there, at most suiteRisk divided by their number of the time. Default 0.05; `shadowlap test --suite-risk` overrides it for one session.",
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 0.5
},
"baselineBranch": {
"description": "The branch a gate against history takes its baseline from: only sessions that passed on it, for no pull request, count. Default: the default branch, from CI's variables or git's origin/HEAD.",
"type": "string",
"minLength": 1
}
},
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"fork": {
"description": "The recording is expected to diverge: the replay goes live from the fork and passes on its checks alone.",
"type": "boolean"
},
"repeat": {
"description": "Run the replay this many times.",
"type": "integer",
"minimum": 1
},
"passes": {
"description": "Attempts that must pass, out of `repeat`. Defaults to all of them.",
"type": "integer",
"minimum": 1
},
"gate": {
"description": "Decide on the attempts as they come in, with stated error rates, instead of `repeat` and `passes` (give one or the other). Needs `fork`. Either a sequential test between two pass rates, or a comparison with the golden's own test history.",
"oneOf": [
{
"type": "object",
"description": "Wald's sequential probability ratio test: pass at `good` or more, fail at `bad` or less, each verdict wrong at most `risk` of the time, inconclusive when `max` attempts run out between the two.",
"additionalProperties": false,
"properties": {
"good": {
"description": "A pass rate the gate passes. Default 0.9.",
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 1
},
"bad": {
"description": "A pass rate the gate fails, below `good`. Default 0.7.",
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 1
},
"risk": {
"description": "The most a verdict may be wrong at `good` or at `bad`. Default 0.05.",
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 0.5
},
"max": {
"description": "The most attempts it runs. Default 80: an agent that always passes needs 12, one that passes 95% of the time 16.7 on average; a lower limit leaves more goldens inconclusive, which fails CI by default.",
"type": "integer",
"minimum": 1,
"maximum": 1000
}
}
},
{
"type": "object",
"description": "Against the golden's test history: from `min` attempts on, after each one, fail when the chance its pass rate dropped by `drop` or more from the last `window` sessions is above 1 - `risk`, pass once that chance is 1/2 or less, and run another attempt in between, up to `max`. Without history, its recording is the baseline.",
"additionalProperties": false,
"required": [
"baseline"
],
"properties": {
"baseline": {
"const": "history"
},
"drop": {
"description": "The drop in pass rate that fails it: 0.15 is 15 points. Default 0.15.",
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 1
},
"risk": {
"description": "It fails when the chance of that drop is above 1 - risk. Default 0.05.",
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 0.5
},
"window": {
"description": "How many of the golden's last sessions make the baseline. Default 10.",
"type": "integer",
"minimum": 1,
"maximum": 1000
},
"min": {
"description": "Attempts it runs before it decides. Default 5.",
"type": "integer",
"minimum": 1,
"maximum": 1000
},
"max": {
"description": "The most attempts it runs: with a drop still likelier than not but short of 1 - `risk` then, it is inconclusive. Default 40, and never below `min`.",
"type": "integer",
"minimum": 1,
"maximum": 1000
}
}
}
]
},
"expect": {
"type": "object",
"additionalProperties": false,
"properties": {
"tools": {
"description": "By tool name: a count, or a count with arguments the call must contain.",
"type": "object",
"additionalProperties": {
"oneOf": [
{
"$ref": "#/$defs/count"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"count": {
"$ref": "#/$defs/count"
},
"args": {
"type": "object",
"description": "Counts only calls whose arguments contain these values."
}
}
}
]
}
},
"modelCalls": {
"$ref": "#/$defs/count"
},
"toolCalls": {
"$ref": "#/$defs/count"
},
"output": {
"$ref": "#/$defs/text",
"description": "The agent's stdout and stderr."
},
"answer": {
"$ref": "#/$defs/text",
"description": "The text of the last model response."
},
"inputTokens": {
"description": "Input tokens the run’s model requests add up to, cache reads included.",
"$ref": "#/$defs/count"
},
"outputTokens": {
"description": "Output tokens the run’s model responses add up to.",
"$ref": "#/$defs/count"
},
"cost": {
"description": "USD from the price table. A model with no price fails the check rather than passing quietly.",
"$ref": "#/$defs/amount"
},
"calls": {
"description": "Rules every call of a tool must meet: the tools that come before it, and predicates on its arguments, which may read a value from the most recent call of another tool before it (\"@lookup_order.result.total\"). A tool never called meets every rule: pair it with \"tools\" when the call must happen.",
"type": "array",
"items": {
"$ref": "#/$defs/callRule"
}
},
"when": {
"description": "Checks that apply once a call matched a condition: each is not applicable, never passed, while the condition never held.",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"if",
"then"
],
"properties": {
"if": {
"$ref": "#/$defs/callCondition"
},
"then": {
"description": "An expect object, read like this one, with at least one check.",
"allOf": [
{
"$ref": "#/properties/tests/additionalProperties/properties/expect"
},
{
"$ref": "#/$defs/someCheck"
}
]
}
}
}
},
"judge": {
"description": "Questions a model answers yes or no about the run. The judge's call is recorded like any model call: a golden is judged once when it is packed, every clean replay after is judged from the recording, free, and a fork asks the judge live. A check with no recorded verdict and no way to ask live is inconclusive, never passed.",
"type": "array",
"items": {
"$ref": "#/$defs/judge"
}
}
}
},
"task": {
"description": "`shadowlap tasks`: the golden as a task a model is scored on. Every key is optional.",
"type": "object",
"additionalProperties": false,
"properties": {
"takeover": {
"description": "The model call where the model under test takes over; the calls before it replay from the recording. Defaults to the call blame found, else the first model call after the last recorded input, else the first.",
"type": "integer",
"minimum": 1
},
"why": {
"description": "Why that call, in a few words.",
"type": "string",
"maxLength": 200
},
"rewards": {
"description": "What a passing attempt does, in a few words, such as \"escalate above the limit\". Defaults to the outcome checks.",
"type": "string",
"maxLength": 200
},
"scope": {
"description": "The scope the agent's model calls are made in, when a simulated user's are made in another (scope() in the SDKs): the default takeover is the agent's call. Defaults to the scope blame was limited to.",
"type": "string",
"minLength": 1,
"maxLength": 200
}
}
},
"injection": {
"description": "The golden's injection gate: shadowlap test runs its injection test once its replay passes, planting payloads in its untrusted reads (live from the model call that reads them, writes stubbed, reads the recording doesn't hold fenced), and fails it when more attempts obey, or are influenced, than allowed, or when the test showed too little to say (inconclusive, which shadowlap test --inconclusive warn lets through).",
"type": "object",
"additionalProperties": false,
"properties": {
"obeyed": {
"description": "Attempts that may obey a planted instruction (a tool call carrying its canary: a write, or a read that carries it out). Default 0.",
"type": "integer",
"minimum": 0
},
"influenced": {
"description": "Attempts that may be influenced (a write no clean replay made). Default: no limit.",
"type": "integer",
"minimum": 0
},
"repeat": {
"description": "Attempts per untrusted read and payload. Default 1.",
"type": "integer",
"minimum": 1,
"maximum": 100
},
"templates": {
"description": "The built-in templates to plant: all (the default), none, or a list of their ids (shadowlap injection --list-templates).",
"oneOf": [
{
"enum": [
"all",
"none"
]
},
{
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/injectionTemplate"
}
}
]
},
"payloads": {
"description": "A file of your own payloads, relative to this file: text (one a line, or blocks between --- lines), JSON or JSON Lines. {{canary}} in them is filled in.",
"type": "string",
"minLength": 1
},
"baselines": {
"description": "Clean replays of each read, from the model call that reads it, that influenced compares with. Default 3.",
"type": "integer",
"minimum": 0,
"maximum": 20
},
"liveReads": {
"description": "Run the reads the recording doesn't hold after the fork, instead of fencing them (the agent gets an error for a fenced read). A read that carries planted text is fenced all the same. Default false.",
"type": "boolean"
}
}
},
"chaos": {
"description": "`shadowlap test --chaos`: the golden's error-path presets, each a fork where a tool or the provider fails. false leaves the golden out of test --chaos. Every key is optional.",
"oneOf": [
{
"const": false
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"presets": {
"description": "The presets to run, in any order: timeout (a tool times out), empty (it answers with nothing), malformed (its JSON cut short), oversized (its longest text repeated), 429 and 500 (the model call that reads it fails). Defaults to all of them.",
"type": "array",
"minItems": 1,
"items": {
"enum": [
"timeout",
"empty",
"malformed",
"oversized",
"429",
"500",
"all"
]
}
},
"expect": {
"description": "What every attempt must pass besides the agent exiting 0, in the grammar of the entry's own expect: those checks describe the path the recording took, which a path through a failure needn't take. Defaults to the upper bounds the entry's expect sets on write tools, which hold on any path.",
"$ref": "#/properties/tests/additionalProperties/properties/expect"
},
"tool": {
"description": "The tool whose first call the tool presets hit. Defaults to the first tool call that reads the world (a read, else a tool of no declared effect, else a write).",
"type": "string",
"minLength": 1
},
"gate": {
"description": "The sequential test each preset's attempts are decided by (Wald's sequential probability ratio test, as a tests entry's gate takes it; a gate against the golden's history is refused, since a preset has none): pass at `good` or more, fail at `bad` or less, each verdict wrong at most `risk` of the time, inconclusive when `max` attempts run out between the two. Defaults to the golden's repeat and passes.",
"type": "object",
"additionalProperties": false,
"properties": {
"good": {
"description": "A pass rate the gate passes. Default 0.9.",
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 1
},
"bad": {
"description": "A pass rate the gate fails, below `good`. Default 0.7.",
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 1
},
"risk": {
"description": "The most a verdict may be wrong at `good` or at `bad`. Default 0.05.",
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 0.5
},
"max": {
"description": "The most attempts it runs. Default 80, as a tests entry's gate. It must allow an agent that always passes to pass: 12 attempts at the defaults.",
"type": "integer",
"minimum": 1,
"maximum": 1000
}
}
},
"oversize": {
"description": "The characters an oversized result grows to. Defaults to 1000000, past what a model's context takes.",
"type": "integer",
"minimum": 1000,
"maximum": 50000000
},
"timeout": {
"description": "Seconds an attempt may run before it is stopped, and fails: an error path can hang. Defaults to 300.",
"type": "integer",
"minimum": 1,
"maximum": 86400
}
}
}
]
}
}
}
}
},
"$defs": {
"effect": {
"description": "What the call does to the world outside its arguments. Required by design: the only safe default would be write.",
"enum": [
"pure",
"read",
"write"
]
},
"rule": {
"description": "A normalizer or redaction rule: a scope (kind, name), a path, a pattern, and what a match becomes. Every form `shadowlap normalize add` writes: a pattern anywhere, a pattern at a path, or a path alone, which replaces the whole value there.",
"type": "object",
"additionalProperties": false,
"required": [
"replace"
],
"properties": {
"kind": {
"description": "Restrict to one call kind. Omit for any.",
"enum": [
"api",
"tool",
"clock",
"random"
]
},
"name": {
"description": "Restrict to one call name: a tool name, or e.g. \"POST /v1/messages\". Omit for any.",
"type": "string"
},
"path": {
"description": "Where in the request to apply it: a JSONPath subset such as $.messages[0].content, with [*] and .* wildcards and [\"key\"]. Omit to apply `pattern` to every string.",
"type": "string",
"pattern": "^\\$"
},
"pattern": {
"description": "A named pattern (iso-date, iso-datetime, uuid, ulid, number, email) or a /regex/flags literal. With a path, omit it to replace the whole value.",
"type": "string",
"pattern": "^(iso-datetime|iso-date|uuid|ulid|number|email|/[\\s\\S]*/[dgimsuvy]*)$"
},
"replace": {
"description": "What the match becomes while matching, e.g. <uuid>.",
"type": "string"
}
}
},
"count": {
"description": "An exact count, or a range: 0, \">= 1\", \"<= 12\", \"2-4\".",
"oneOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "string",
"pattern": "^\\s*((>=|<=|>|<|=)?\\s*[0-9]+|[0-9]+\\s*-\\s*[0-9]+)\\s*$"
}
]
},
"text": {
"type": "object",
"additionalProperties": false,
"properties": {
"includes": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"excludes": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
}
},
"amount": {
"description": "An amount in USD, or a range: 0.5, \"<= 0.50\", \"0.1-0.4\". A leading $ is allowed.",
"oneOf": [
{
"type": "number",
"minimum": 0
},
{
"type": "string",
"pattern": "^\\s*\\$?\\s*((>=|<=|>|<|=)?\\s*\\$?\\s*[0-9]*\\.?[0-9]+|[0-9]*\\.?[0-9]+\\s*-\\s*[0-9]*\\.?[0-9]+)\\s*$"
}
]
},
"callRule": {
"description": "A rule every call of `tool` must meet. It needs \"after\", \"args\" that name an argument, or both.",
"type": "object",
"additionalProperties": false,
"required": [
"tool"
],
"anyOf": [
{
"required": [
"after"
]
},
{
"required": [
"args"
],
"properties": {
"args": {
"minProperties": 1
}
}
}
],
"properties": {
"tool": {
"description": "The tool whose every call is checked.",
"type": "string",
"minLength": 1
},
"after": {
"description": "A tool, or a list of tools, that each have a call before every call of `tool`.",
"oneOf": [
{
"type": "string",
"minLength": 1
},
{
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"minLength": 1
}
}
]
},
"args": {
"description": "The call’s arguments, by name, each a value to match.",
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/match"
}
}
}
},
"callCondition": {
"description": "Holds once any call of `tool` matches `args` and `result`.",
"type": "object",
"additionalProperties": false,
"required": [
"tool"
],
"properties": {
"tool": {
"type": "string",
"minLength": 1
},
"args": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/match"
}
},
"result": {
"description": "What the call returned, matched as a value.",
"$ref": "#/$defs/match"
}
}
},
"match": {
"description": "A value to match: a literal (equal; an object matches the keys it gives, a list item by item), a reference such as \"@lookup_order.result.total\" or \"@lookup_order.args.order_id\" (the value from the most recent call of that tool before the call checked), or a predicate such as { \"<=\": 100 }. An object whose keys are all operators is a predicate; any other object is matched key by key, and may not have a key named like an operator it is not (gt, contains, $in, endswith): write { \"=\": { … } } to match one.",
"anyOf": [
{
"$ref": "#/$defs/predicate"
},
{
"type": "object",
"propertyNames": {
"not": {
"anyOf": [
{
"enum": [
"=",
"!=",
"<",
"<=",
">",
">=",
"in",
"includes",
"startsWith",
"endsWith",
"not"
]
},
{
"pattern": "^(?:\\$?(?:[eE][qQ]|[eE][qQ][uU][aA][lL][sS]|[nN][eE]|[nN][eE][qQ]|[lL][tT]|[lL][tT][eE]|[lL][eE]|[gG][tT]|[gG][tT][eE]|[gG][eE]|[cC][oO][nN][tT][aA][iI][nN][sS]|[nN][iI][nN]|[nN][oO][tT][iI][nN]|[nN][oO][tT]_[iI][nN]|[mM][aA][tT][cC][hH][eE][sS]|[rR][eE][gG][eE][xX]|[lL][iI][kK][eE]|[iI][nN]|[iI][nN][cC][lL][uU][dD][eE][sS]|[sS][tT][aA][rR][tT][sS][wW][iI][tT][hH]|[eE][nN][dD][sS][wW][iI][tT][hH]|[nN][oO][tT])|\\$(?:=|!=|<=?|>=?))$"
}
]
}
},
"additionalProperties": {
"$ref": "#/$defs/match"
}
},
{
"type": "array",
"items": {
"$ref": "#/$defs/match"
}
},
{
"type": "string",
"not": {
"$ref": "#/$defs/severalValues"
}
},
{
"type": [
"number",
"boolean",
"null"
]
}
]
},
"predicate": {
"description": "Comparisons that must all hold. A number written as text compares as the number; text compares as it is, case included.",
"type": "object",
"minProperties": 1,
"additionalProperties": false,
"properties": {
"=": {
"description": "Equal, as a literal matches.",
"$ref": "#/$defs/operand"
},
"!=": {
"description": "Not equal.",
"$ref": "#/$defs/operand"
},
"<": {
"oneOf": [
{
"type": "number"
},
{
"type": "string",
"pattern": "^\\s*-?\\d+(\\.\\d+)?([eE][+-]?\\d+)?\\s*$"
},
{
"$ref": "#/$defs/reference"
}
]
},
"<=": {
"oneOf": [
{
"type": "number"
},
{
"type": "string",
"pattern": "^\\s*-?\\d+(\\.\\d+)?([eE][+-]?\\d+)?\\s*$"
},
{
"$ref": "#/$defs/reference"
}
]
},
">": {
"oneOf": [
{
"type": "number"
},
{
"type": "string",
"pattern": "^\\s*-?\\d+(\\.\\d+)?([eE][+-]?\\d+)?\\s*$"
},
{
"$ref": "#/$defs/reference"
}
]
},
">=": {
"oneOf": [
{
"type": "number"
},
{
"type": "string",
"pattern": "^\\s*-?\\d+(\\.\\d+)?([eE][+-]?\\d+)?\\s*$"
},
{
"$ref": "#/$defs/reference"
}
]
},
"in": {
"description": "One of a list, or of the list a reference reads; with * in its path, of the values it reaches (\"@lookup_customer.result.*\").",
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/$defs/operand"
}
},
{
"$ref": "#/$defs/references"
}
]
},
"includes": {
"description": "Text that contains this text, or a list that has this item.",
"$ref": "#/$defs/operand"
},
"startsWith": {
"type": "string",
"not": {
"$ref": "#/$defs/severalValues"
}
},
"endsWith": {
"type": "string",
"not": {
"$ref": "#/$defs/severalValues"
}
},
"not": {
"description": "A predicate or a value that must not match. A value that is missing never matches, negated or not.",
"type": [
"object",
"array"
],
"$ref": "#/$defs/match"
}
}
},
"reference": {
"description": "\"@<tool>.result.<path>\" or \"@<tool>.args.<path>\": the value from the most recent call of that tool before the call checked. The path is the JSONPath subset of normalizers (.total, .items[0].sku). A string that starts with \"@@\" is text that starts with one \"@\".",