@reallyartificial/grain 0.2.0

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.
@@ -0,0 +1,1186 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentspec.dev/v1/schema.json",
4
+ "title": "AgentSpec",
5
+ "description": "A universal, structured data format for describing AI agents — quantified personality, typed behavior rules, channel-aware communication, and bounded self-modification.",
6
+ "type": "object",
7
+ "required": [
8
+ "specVersion",
9
+ "id",
10
+ "version",
11
+ "meta"
12
+ ],
13
+ "additionalProperties": false,
14
+ "properties": {
15
+ "$schema": {
16
+ "type": "string",
17
+ "description": "JSON Schema reference for editor autocomplete"
18
+ },
19
+ "specVersion": {
20
+ "const": "1.0",
21
+ "description": "Schema version for forward compatibility"
22
+ },
23
+ "id": {
24
+ "type": "string",
25
+ "pattern": "^[a-z0-9-]+$",
26
+ "description": "Unique identifier (kebab-case, like npm package names)"
27
+ },
28
+ "version": {
29
+ "type": "string",
30
+ "pattern": "^\\d+\\.\\d+\\.\\d+",
31
+ "description": "Semver version of this agent definition"
32
+ },
33
+ "extends": {
34
+ "oneOf": [
35
+ { "type": "string" },
36
+ {
37
+ "type": "object",
38
+ "required": ["id", "version"],
39
+ "properties": {
40
+ "id": { "type": "string" },
41
+ "version": { "type": "string" }
42
+ },
43
+ "additionalProperties": false
44
+ }
45
+ ],
46
+ "description": "Inherit from another AgentSpec (like class inheritance)"
47
+ },
48
+ "meta": { "$ref": "#/$defs/AgentMeta" },
49
+ "identity": { "$ref": "#/$defs/AgentIdentity" },
50
+ "voice": { "$ref": "#/$defs/AgentVoice" },
51
+ "cognition": { "$ref": "#/$defs/AgentCognition" },
52
+ "capabilities": { "$ref": "#/$defs/AgentCapabilities" },
53
+ "behavior": { "$ref": "#/$defs/AgentBehavior" },
54
+ "memory": { "$ref": "#/$defs/AgentMemory" },
55
+ "communication": { "$ref": "#/$defs/AgentCommunication" },
56
+ "adaptation": { "$ref": "#/$defs/AgentAdaptation" },
57
+ "observability": { "$ref": "#/$defs/AgentObservability" }
58
+ },
59
+ "$defs": {
60
+ "UnitFloat": {
61
+ "type": "number",
62
+ "minimum": 0,
63
+ "maximum": 1,
64
+ "description": "A float between 0 and 1 (inclusive)",
65
+ "x-prompt-hint": "Used for quantified personality and threshold parameters"
66
+ },
67
+
68
+ "AgentMeta": {
69
+ "type": "object",
70
+ "required": ["name", "description"],
71
+ "additionalProperties": false,
72
+ "properties": {
73
+ "name": { "type": "string", "description": "Human-readable agent name" },
74
+ "description": { "type": "string", "description": "What this agent does" },
75
+ "author": { "type": "string" },
76
+ "license": { "type": "string" },
77
+ "tags": {
78
+ "type": "array",
79
+ "items": { "type": "string" }
80
+ },
81
+ "url": { "type": "string", "description": "URL to agent's documentation or homepage" },
82
+ "model": { "$ref": "#/$defs/ModelPreference" }
83
+ }
84
+ },
85
+
86
+ "ModelPreference": {
87
+ "type": "object",
88
+ "required": ["minimumTier"],
89
+ "additionalProperties": false,
90
+ "properties": {
91
+ "minimumTier": {
92
+ "type": "string",
93
+ "enum": ["small", "medium", "large", "frontier"],
94
+ "description": "Minimum capability tier required"
95
+ },
96
+ "preferredProvider": { "type": "string", "description": "Preferred provider (informational, not binding)" },
97
+ "preferredModel": { "type": "string", "description": "Preferred model ID" },
98
+ "minimumContext": { "type": "integer", "minimum": 0, "description": "Required context window size in tokens" },
99
+ "requiresToolCalling": { "type": "boolean", "description": "Whether the agent requires tool/function calling" },
100
+ "requiresMultimodal": { "type": "boolean", "description": "Whether the agent requires vision/multimodal" }
101
+ }
102
+ },
103
+
104
+ "AgentIdentity": {
105
+ "type": "object",
106
+ "required": ["name", "role", "purpose", "expertise"],
107
+ "additionalProperties": false,
108
+ "properties": {
109
+ "name": { "type": "string", "description": "The agent's name as used in conversation" },
110
+ "role": { "type": "string", "description": "One-line role description (e.g., 'Senior DevOps Engineer')" },
111
+ "purpose": {
112
+ "type": "object",
113
+ "required": ["primary"],
114
+ "additionalProperties": false,
115
+ "properties": {
116
+ "primary": { "type": "string", "description": "Core purpose — what this agent exists to do" },
117
+ "secondary": {
118
+ "type": "array",
119
+ "items": { "type": "string" },
120
+ "description": "Additional objectives"
121
+ }
122
+ }
123
+ },
124
+ "expertise": {
125
+ "type": "array",
126
+ "items": { "$ref": "#/$defs/DomainExpertise" },
127
+ "description": "Domain expertise areas with proficiency levels"
128
+ },
129
+ "relationships": {
130
+ "type": "array",
131
+ "items": { "$ref": "#/$defs/AgentRelationship" },
132
+ "description": "Relationships to other agents or roles"
133
+ }
134
+ }
135
+ },
136
+
137
+ "DomainExpertise": {
138
+ "type": "object",
139
+ "required": ["domain", "proficiency"],
140
+ "additionalProperties": false,
141
+ "properties": {
142
+ "domain": { "type": "string" },
143
+ "proficiency": {
144
+ "$ref": "#/$defs/UnitFloat",
145
+ "description": "0 = awareness, 0.5 = working knowledge, 1 = deep expertise",
146
+ "x-prompt-hint": "Used to filter which domains appear as 'deep expertise' in prompts (threshold: 0.7)"
147
+ },
148
+ "subtopics": {
149
+ "type": "array",
150
+ "items": { "type": "string" }
151
+ }
152
+ }
153
+ },
154
+
155
+ "AgentRelationship": {
156
+ "type": "object",
157
+ "required": ["target", "type"],
158
+ "additionalProperties": false,
159
+ "properties": {
160
+ "target": { "type": "string", "description": "ID or role of the related agent" },
161
+ "type": {
162
+ "type": "string",
163
+ "enum": ["reports-to", "delegates-to", "collaborates-with", "supervises", "escalates-to"]
164
+ },
165
+ "permissions": {
166
+ "type": "array",
167
+ "items": {
168
+ "type": "string",
169
+ "enum": ["read", "write", "execute", "delegate"]
170
+ }
171
+ }
172
+ }
173
+ },
174
+
175
+ "AgentVoice": {
176
+ "type": "object",
177
+ "required": ["personality", "language"],
178
+ "additionalProperties": false,
179
+ "properties": {
180
+ "personality": { "$ref": "#/$defs/PersonalityVector" },
181
+ "language": { "$ref": "#/$defs/LanguageStyle" },
182
+ "channelOverrides": {
183
+ "type": "object",
184
+ "additionalProperties": { "$ref": "#/$defs/VoiceOverride" },
185
+ "description": "Channel-specific overrides (Slack gets emoji, email gets formal, etc.)"
186
+ }
187
+ }
188
+ },
189
+
190
+ "PersonalityVector": {
191
+ "type": "object",
192
+ "required": ["formality", "warmth", "humor", "assertiveness", "verbosity", "confidence", "concreteness", "urgency"],
193
+ "additionalProperties": false,
194
+ "description": "8-dimension personality model. All values are 0-1 floats.",
195
+ "x-prompt-hint": "Each dimension maps to natural language directives via threshold rules (see SPECIFICATION.md)",
196
+ "properties": {
197
+ "formality": {
198
+ "$ref": "#/$defs/UnitFloat",
199
+ "description": "0 = casual/informal, 1 = highly formal",
200
+ "x-prompt-hint": ">0.7: formal tone | <0.3: casual tone | else: balanced"
201
+ },
202
+ "warmth": {
203
+ "$ref": "#/$defs/UnitFloat",
204
+ "description": "0 = cold/clinical, 1 = warm/empathetic",
205
+ "x-prompt-hint": ">0.7: warm and empathetic | <0.3: direct and clinical"
206
+ },
207
+ "humor": {
208
+ "$ref": "#/$defs/UnitFloat",
209
+ "description": "0 = dead serious, 1 = playful/witty",
210
+ "x-prompt-hint": ">0.7: use humor | <0.2: stay serious"
211
+ },
212
+ "assertiveness": {
213
+ "$ref": "#/$defs/UnitFloat",
214
+ "description": "0 = passive/reactive, 1 = proactive/assertive",
215
+ "x-prompt-hint": ">0.7: proactive recommendations | <0.3: reactive, wait for direction"
216
+ },
217
+ "verbosity": {
218
+ "$ref": "#/$defs/UnitFloat",
219
+ "description": "0 = brief/terse, 1 = detailed/verbose",
220
+ "x-prompt-hint": ">0.7: detailed explanations | <0.3: brief, no fluff"
221
+ },
222
+ "confidence": {
223
+ "$ref": "#/$defs/UnitFloat",
224
+ "description": "0 = cautious/hedging, 1 = bold/decisive",
225
+ "x-prompt-hint": ">0.7: decisive, no hedging | <0.3: communicate uncertainty openly"
226
+ },
227
+ "concreteness": {
228
+ "$ref": "#/$defs/UnitFloat",
229
+ "description": "0 = abstract/theoretical, 1 = concrete/practical",
230
+ "x-prompt-hint": ">0.7: concrete examples and actionable steps | <0.3: focus on concepts and frameworks"
231
+ },
232
+ "urgency": {
233
+ "$ref": "#/$defs/UnitFloat",
234
+ "description": "0 = patient/thorough, 1 = urgent/action-oriented",
235
+ "x-prompt-hint": ">0.7: prioritize action over perfection | <0.3: quality over speed"
236
+ }
237
+ }
238
+ },
239
+
240
+ "LanguageStyle": {
241
+ "type": "object",
242
+ "required": ["locale", "sentenceLength", "jargonLevel", "emojiUsage", "structure", "usesAnalogies", "addressing"],
243
+ "additionalProperties": false,
244
+ "properties": {
245
+ "locale": { "type": "string", "description": "Primary language (BCP 47 tag, e.g., 'en-US')" },
246
+ "sentenceLength": {
247
+ "type": "string",
248
+ "enum": ["short", "medium", "long"],
249
+ "x-prompt-hint": "short: punchy sentences | long: flowing explanations"
250
+ },
251
+ "jargonLevel": {
252
+ "type": "string",
253
+ "enum": ["none", "moderate", "heavy"],
254
+ "x-prompt-hint": "none: plain language | heavy: domain-specific terminology"
255
+ },
256
+ "emojiUsage": {
257
+ "type": "string",
258
+ "enum": ["never", "sparingly", "frequently"],
259
+ "x-prompt-hint": "frequently: add emoji for personality | never: no emoji"
260
+ },
261
+ "structure": {
262
+ "type": "string",
263
+ "enum": ["prose", "bullets", "mixed"],
264
+ "x-prompt-hint": "bullets: prefer lists | prose: flowing paragraphs"
265
+ },
266
+ "usesAnalogies": {
267
+ "type": "boolean",
268
+ "description": "Whether to use analogies and metaphors",
269
+ "x-prompt-hint": "true: use analogies to explain complex ideas"
270
+ },
271
+ "addressing": {
272
+ "type": "string",
273
+ "enum": ["first-person", "third-person", "neutral"]
274
+ }
275
+ }
276
+ },
277
+
278
+ "VoiceOverride": {
279
+ "type": "object",
280
+ "additionalProperties": false,
281
+ "description": "Partial override of PersonalityVector and LanguageStyle fields for a specific channel",
282
+ "properties": {
283
+ "formality": { "$ref": "#/$defs/UnitFloat" },
284
+ "warmth": { "$ref": "#/$defs/UnitFloat" },
285
+ "humor": { "$ref": "#/$defs/UnitFloat" },
286
+ "assertiveness": { "$ref": "#/$defs/UnitFloat" },
287
+ "verbosity": { "$ref": "#/$defs/UnitFloat" },
288
+ "confidence": { "$ref": "#/$defs/UnitFloat" },
289
+ "concreteness": { "$ref": "#/$defs/UnitFloat" },
290
+ "urgency": { "$ref": "#/$defs/UnitFloat" },
291
+ "locale": { "type": "string" },
292
+ "sentenceLength": { "type": "string", "enum": ["short", "medium", "long"] },
293
+ "jargonLevel": { "type": "string", "enum": ["none", "moderate", "heavy"] },
294
+ "emojiUsage": { "type": "string", "enum": ["never", "sparingly", "frequently"] },
295
+ "structure": { "type": "string", "enum": ["prose", "bullets", "mixed"] },
296
+ "usesAnalogies": { "type": "boolean" },
297
+ "addressing": { "type": "string", "enum": ["first-person", "third-person", "neutral"] }
298
+ }
299
+ },
300
+
301
+ "AgentCognition": {
302
+ "type": "object",
303
+ "required": ["reasoningStyle", "decisionMaking", "uncertainty", "taskStrategy"],
304
+ "additionalProperties": false,
305
+ "properties": {
306
+ "reasoningStyle": { "$ref": "#/$defs/ReasoningStyle" },
307
+ "decisionMaking": { "$ref": "#/$defs/DecisionMaking" },
308
+ "uncertainty": { "$ref": "#/$defs/UncertaintyHandling" },
309
+ "taskStrategy": { "$ref": "#/$defs/TaskStrategy" }
310
+ }
311
+ },
312
+
313
+ "ReasoningStyle": {
314
+ "type": "object",
315
+ "required": ["primary", "showReasoning", "analysisDepth", "multiPerspective"],
316
+ "additionalProperties": false,
317
+ "properties": {
318
+ "primary": {
319
+ "type": "string",
320
+ "enum": ["analytical", "creative", "systematic", "intuitive", "socratic"]
321
+ },
322
+ "showReasoning": {
323
+ "type": "boolean",
324
+ "x-prompt-hint": "true: show reasoning process step by step"
325
+ },
326
+ "analysisDepth": {
327
+ "type": "string",
328
+ "enum": ["surface", "moderate", "deep", "exhaustive"],
329
+ "x-prompt-hint": "deep/exhaustive: analyze problems deeply before responding"
330
+ },
331
+ "multiPerspective": {
332
+ "type": "boolean",
333
+ "x-prompt-hint": "true: consider multiple perspectives before concluding"
334
+ }
335
+ }
336
+ },
337
+
338
+ "DecisionMaking": {
339
+ "type": "object",
340
+ "required": ["speed", "evidenceThreshold", "reversibilityPreference", "autonomy"],
341
+ "additionalProperties": false,
342
+ "properties": {
343
+ "speed": {
344
+ "$ref": "#/$defs/UnitFloat",
345
+ "description": "0 = deliberate, 1 = snap decisions"
346
+ },
347
+ "evidenceThreshold": {
348
+ "$ref": "#/$defs/UnitFloat",
349
+ "description": "0 = little evidence needed, 1 = extensive evidence required"
350
+ },
351
+ "reversibilityPreference": {
352
+ "type": "string",
353
+ "enum": ["prefer-reversible", "neutral", "bias-to-action"]
354
+ },
355
+ "autonomy": {
356
+ "type": "string",
357
+ "enum": ["always-ask", "ask-for-major", "decide-unless-ambiguous", "fully-autonomous"],
358
+ "x-prompt-hint": "fully-autonomous: make decisions independently | always-ask: confirm before acting"
359
+ }
360
+ }
361
+ },
362
+
363
+ "UncertaintyHandling": {
364
+ "type": "object",
365
+ "required": ["lowConfidenceAction", "confidenceFloor", "communicateUncertainty", "conflictResolution"],
366
+ "additionalProperties": false,
367
+ "properties": {
368
+ "lowConfidenceAction": {
369
+ "type": "string",
370
+ "enum": ["ask", "hedge", "state-assumption", "refuse"],
371
+ "x-prompt-hint": "ask: ask for clarification when confidence is low"
372
+ },
373
+ "confidenceFloor": {
374
+ "$ref": "#/$defs/UnitFloat",
375
+ "description": "Confidence threshold below which lowConfidenceAction triggers",
376
+ "x-prompt-hint": "Rendered as percentage in prompts (e.g., 0.4 → 40%)"
377
+ },
378
+ "communicateUncertainty": {
379
+ "type": "boolean",
380
+ "x-prompt-hint": "true: explicitly state confidence level when uncertain"
381
+ },
382
+ "conflictResolution": {
383
+ "type": "string",
384
+ "enum": ["ask-user", "use-most-recent", "use-most-authoritative", "present-both"]
385
+ }
386
+ }
387
+ },
388
+
389
+ "TaskStrategy": {
390
+ "type": "object",
391
+ "required": ["decomposition", "maxParallelism", "checkpointing", "blockingStrategy"],
392
+ "additionalProperties": false,
393
+ "properties": {
394
+ "decomposition": {
395
+ "type": "string",
396
+ "enum": ["top-down", "bottom-up", "iterative"]
397
+ },
398
+ "maxParallelism": {
399
+ "type": "integer",
400
+ "minimum": 1
401
+ },
402
+ "checkpointing": { "type": "boolean" },
403
+ "blockingStrategy": {
404
+ "type": "string",
405
+ "enum": ["wait", "skip-and-return", "find-alternative", "escalate"]
406
+ }
407
+ }
408
+ },
409
+
410
+ "AgentCapabilities": {
411
+ "type": "object",
412
+ "additionalProperties": false,
413
+ "properties": {
414
+ "tools": {
415
+ "type": "array",
416
+ "items": { "$ref": "#/$defs/ToolCapability" }
417
+ },
418
+ "skills": {
419
+ "type": "array",
420
+ "items": { "$ref": "#/$defs/SkillDefinition" }
421
+ },
422
+ "knowledge": {
423
+ "type": "array",
424
+ "items": { "$ref": "#/$defs/KnowledgeSource" }
425
+ },
426
+ "outputFormats": {
427
+ "type": "array",
428
+ "items": { "$ref": "#/$defs/OutputFormat" }
429
+ }
430
+ }
431
+ },
432
+
433
+ "ToolCapability": {
434
+ "type": "object",
435
+ "required": ["id", "usage"],
436
+ "additionalProperties": false,
437
+ "properties": {
438
+ "id": { "type": "string", "description": "Tool identifier (matches runtime tool registry)" },
439
+ "usage": { "type": "string", "description": "When to use this tool" },
440
+ "requiresConfirmation": { "type": "boolean" },
441
+ "rateLimit": {
442
+ "type": "object",
443
+ "required": ["max", "per"],
444
+ "additionalProperties": false,
445
+ "properties": {
446
+ "max": { "type": "integer", "minimum": 1 },
447
+ "per": { "type": "string", "enum": ["message", "conversation", "hour"] }
448
+ }
449
+ }
450
+ }
451
+ },
452
+
453
+ "SkillDefinition": {
454
+ "type": "object",
455
+ "required": ["name", "description"],
456
+ "additionalProperties": false,
457
+ "properties": {
458
+ "name": { "type": "string" },
459
+ "description": { "type": "string" },
460
+ "requiredTools": {
461
+ "type": "array",
462
+ "items": { "type": "string" }
463
+ },
464
+ "steps": {
465
+ "type": "array",
466
+ "items": { "type": "string" }
467
+ },
468
+ "successCriteria": {
469
+ "type": "array",
470
+ "items": { "type": "string" }
471
+ }
472
+ }
473
+ },
474
+
475
+ "KnowledgeSource": {
476
+ "type": "object",
477
+ "required": ["id", "type", "domain"],
478
+ "additionalProperties": false,
479
+ "properties": {
480
+ "id": { "type": "string" },
481
+ "type": {
482
+ "type": "string",
483
+ "enum": ["embedded", "retrieval", "api", "file-system", "database"]
484
+ },
485
+ "domain": { "type": "string" },
486
+ "freshness": {
487
+ "type": "string",
488
+ "enum": ["static", "daily", "real-time"]
489
+ },
490
+ "priority": { "type": "integer" }
491
+ }
492
+ },
493
+
494
+ "OutputFormat": {
495
+ "type": "object",
496
+ "required": ["format"],
497
+ "additionalProperties": false,
498
+ "properties": {
499
+ "format": { "type": "string", "description": "MIME type or format identifier" },
500
+ "condition": { "type": "string" }
501
+ }
502
+ },
503
+
504
+ "AgentBehavior": {
505
+ "type": "object",
506
+ "required": ["rules", "boundaries"],
507
+ "additionalProperties": false,
508
+ "properties": {
509
+ "rules": {
510
+ "type": "array",
511
+ "items": { "$ref": "#/$defs/BehaviorRule" }
512
+ },
513
+ "boundaries": {
514
+ "type": "array",
515
+ "items": { "$ref": "#/$defs/Boundary" }
516
+ },
517
+ "triggers": {
518
+ "type": "array",
519
+ "items": { "$ref": "#/$defs/BehaviorTrigger" }
520
+ },
521
+ "escalation": { "$ref": "#/$defs/EscalationPolicy" }
522
+ }
523
+ },
524
+
525
+ "BehaviorRule": {
526
+ "type": "object",
527
+ "required": ["id", "condition", "action"],
528
+ "additionalProperties": false,
529
+ "properties": {
530
+ "id": { "type": "string", "description": "Unique rule identifier" },
531
+ "condition": { "$ref": "#/$defs/RuleCondition" },
532
+ "action": { "$ref": "#/$defs/RuleAction" },
533
+ "priority": { "type": "integer", "description": "Higher wins when rules conflict" },
534
+ "overridable": { "type": "boolean" }
535
+ }
536
+ },
537
+
538
+ "RuleCondition": {
539
+ "oneOf": [
540
+ {
541
+ "type": "object",
542
+ "required": ["type"],
543
+ "additionalProperties": false,
544
+ "properties": {
545
+ "type": { "const": "always" }
546
+ }
547
+ },
548
+ {
549
+ "type": "object",
550
+ "required": ["type", "topics"],
551
+ "additionalProperties": false,
552
+ "properties": {
553
+ "type": { "const": "when-topic" },
554
+ "topics": { "type": "array", "items": { "type": "string" } }
555
+ }
556
+ },
557
+ {
558
+ "type": "object",
559
+ "required": ["type", "sentiment"],
560
+ "additionalProperties": false,
561
+ "properties": {
562
+ "type": { "const": "when-sentiment" },
563
+ "sentiment": { "type": "string", "enum": ["positive", "negative", "neutral", "frustrated"] }
564
+ }
565
+ },
566
+ {
567
+ "type": "object",
568
+ "required": ["type", "context"],
569
+ "additionalProperties": false,
570
+ "properties": {
571
+ "type": { "const": "when-context" },
572
+ "context": { "type": "string" }
573
+ }
574
+ },
575
+ {
576
+ "type": "object",
577
+ "required": ["type", "roles"],
578
+ "additionalProperties": false,
579
+ "properties": {
580
+ "type": { "const": "when-user-role" },
581
+ "roles": { "type": "array", "items": { "type": "string" } }
582
+ }
583
+ },
584
+ {
585
+ "type": "object",
586
+ "required": ["type", "capability"],
587
+ "additionalProperties": false,
588
+ "properties": {
589
+ "type": { "const": "when-capability-missing" },
590
+ "capability": { "type": "string" }
591
+ }
592
+ },
593
+ {
594
+ "type": "object",
595
+ "required": ["type", "threshold"],
596
+ "additionalProperties": false,
597
+ "properties": {
598
+ "type": { "const": "when-confidence-below" },
599
+ "threshold": { "$ref": "#/$defs/UnitFloat" }
600
+ }
601
+ },
602
+ {
603
+ "type": "object",
604
+ "required": ["type", "operator", "conditions"],
605
+ "additionalProperties": false,
606
+ "properties": {
607
+ "type": { "const": "compound" },
608
+ "operator": { "type": "string", "enum": ["and", "or"] },
609
+ "conditions": {
610
+ "type": "array",
611
+ "items": { "$ref": "#/$defs/RuleCondition" }
612
+ }
613
+ }
614
+ }
615
+ ]
616
+ },
617
+
618
+ "RuleAction": {
619
+ "oneOf": [
620
+ {
621
+ "type": "object",
622
+ "required": ["type", "style"],
623
+ "additionalProperties": false,
624
+ "properties": {
625
+ "type": { "const": "respond-with-style" },
626
+ "style": {
627
+ "type": "object",
628
+ "additionalProperties": false,
629
+ "properties": {
630
+ "formality": { "$ref": "#/$defs/UnitFloat" },
631
+ "warmth": { "$ref": "#/$defs/UnitFloat" },
632
+ "humor": { "$ref": "#/$defs/UnitFloat" },
633
+ "assertiveness": { "$ref": "#/$defs/UnitFloat" },
634
+ "verbosity": { "$ref": "#/$defs/UnitFloat" },
635
+ "confidence": { "$ref": "#/$defs/UnitFloat" },
636
+ "concreteness": { "$ref": "#/$defs/UnitFloat" },
637
+ "urgency": { "$ref": "#/$defs/UnitFloat" }
638
+ }
639
+ }
640
+ }
641
+ },
642
+ {
643
+ "type": "object",
644
+ "required": ["type", "tool"],
645
+ "additionalProperties": false,
646
+ "properties": {
647
+ "type": { "const": "use-tool" },
648
+ "tool": { "type": "string" },
649
+ "params": { "type": "object" }
650
+ }
651
+ },
652
+ {
653
+ "type": "object",
654
+ "required": ["type", "target", "reason"],
655
+ "additionalProperties": false,
656
+ "properties": {
657
+ "type": { "const": "escalate" },
658
+ "target": { "type": "string" },
659
+ "reason": { "type": "string" }
660
+ }
661
+ },
662
+ {
663
+ "type": "object",
664
+ "required": ["type", "message"],
665
+ "additionalProperties": false,
666
+ "properties": {
667
+ "type": { "const": "refuse" },
668
+ "message": { "type": "string" }
669
+ }
670
+ },
671
+ {
672
+ "type": "object",
673
+ "required": ["type", "target"],
674
+ "additionalProperties": false,
675
+ "properties": {
676
+ "type": { "const": "redirect" },
677
+ "target": { "type": "string" }
678
+ }
679
+ },
680
+ {
681
+ "type": "object",
682
+ "required": ["type", "depth"],
683
+ "additionalProperties": false,
684
+ "properties": {
685
+ "type": { "const": "adjust-depth" },
686
+ "depth": { "type": "string", "enum": ["surface", "moderate", "deep"] }
687
+ }
688
+ },
689
+ {
690
+ "type": "object",
691
+ "required": ["type"],
692
+ "additionalProperties": false,
693
+ "properties": {
694
+ "type": { "const": "require-confirmation" }
695
+ }
696
+ },
697
+ {
698
+ "type": "object",
699
+ "required": ["type", "event", "level"],
700
+ "additionalProperties": false,
701
+ "properties": {
702
+ "type": { "const": "log-event" },
703
+ "event": { "type": "string" },
704
+ "level": { "type": "string", "enum": ["info", "warn", "error"] }
705
+ }
706
+ },
707
+ {
708
+ "type": "object",
709
+ "required": ["type", "handler"],
710
+ "additionalProperties": false,
711
+ "properties": {
712
+ "type": { "const": "custom" },
713
+ "handler": { "type": "string" },
714
+ "params": { "type": "object" }
715
+ }
716
+ }
717
+ ]
718
+ },
719
+
720
+ "Boundary": {
721
+ "type": "object",
722
+ "required": ["description", "category", "enforcement", "onViolation"],
723
+ "additionalProperties": false,
724
+ "properties": {
725
+ "description": { "type": "string" },
726
+ "category": {
727
+ "type": "string",
728
+ "enum": ["content", "action", "data", "scope", "safety"]
729
+ },
730
+ "enforcement": {
731
+ "type": "string",
732
+ "enum": ["hard", "soft"]
733
+ },
734
+ "onViolation": {
735
+ "type": "string",
736
+ "enum": ["refuse", "warn", "redirect", "escalate"]
737
+ },
738
+ "message": { "type": "string", "description": "Message shown when boundary is triggered" }
739
+ }
740
+ },
741
+
742
+ "BehaviorTrigger": {
743
+ "type": "object",
744
+ "required": ["event", "action"],
745
+ "additionalProperties": false,
746
+ "properties": {
747
+ "event": { "$ref": "#/$defs/TriggerEvent" },
748
+ "action": { "$ref": "#/$defs/RuleAction" },
749
+ "cooldown": { "type": "integer", "minimum": 0, "description": "Cooldown in seconds" }
750
+ }
751
+ },
752
+
753
+ "TriggerEvent": {
754
+ "oneOf": [
755
+ {
756
+ "type": "object",
757
+ "required": ["type", "keywords"],
758
+ "additionalProperties": false,
759
+ "properties": {
760
+ "type": { "const": "keyword" },
761
+ "keywords": { "type": "array", "items": { "type": "string" } }
762
+ }
763
+ },
764
+ {
765
+ "type": "object",
766
+ "required": ["type", "intents"],
767
+ "additionalProperties": false,
768
+ "properties": {
769
+ "type": { "const": "intent" },
770
+ "intents": { "type": "array", "items": { "type": "string" } }
771
+ }
772
+ },
773
+ {
774
+ "type": "object",
775
+ "required": ["type", "durationSeconds"],
776
+ "additionalProperties": false,
777
+ "properties": {
778
+ "type": { "const": "silence" },
779
+ "durationSeconds": { "type": "integer", "minimum": 0 }
780
+ }
781
+ },
782
+ {
783
+ "type": "object",
784
+ "required": ["type"],
785
+ "additionalProperties": false,
786
+ "properties": {
787
+ "type": { "const": "error" },
788
+ "errorType": { "type": "string" }
789
+ }
790
+ },
791
+ {
792
+ "type": "object",
793
+ "required": ["type", "metric", "operator", "value"],
794
+ "additionalProperties": false,
795
+ "properties": {
796
+ "type": { "const": "threshold" },
797
+ "metric": { "type": "string" },
798
+ "operator": { "type": "string", "enum": ["gt", "lt", "eq"] },
799
+ "value": { "type": "number" }
800
+ }
801
+ },
802
+ {
803
+ "type": "object",
804
+ "required": ["type", "cron"],
805
+ "additionalProperties": false,
806
+ "properties": {
807
+ "type": { "const": "schedule" },
808
+ "cron": { "type": "string" }
809
+ }
810
+ }
811
+ ]
812
+ },
813
+
814
+ "EscalationPolicy": {
815
+ "type": "object",
816
+ "required": ["conditions", "defaultTarget", "handoffStrategy"],
817
+ "additionalProperties": false,
818
+ "properties": {
819
+ "conditions": {
820
+ "type": "array",
821
+ "items": { "$ref": "#/$defs/EscalationCondition" }
822
+ },
823
+ "defaultTarget": { "type": "string" },
824
+ "handoffStrategy": {
825
+ "type": "string",
826
+ "enum": ["full-transcript", "summary", "structured-handoff"]
827
+ },
828
+ "maxRetries": { "type": "integer", "minimum": 0 }
829
+ }
830
+ },
831
+
832
+ "EscalationCondition": {
833
+ "type": "object",
834
+ "required": ["trigger"],
835
+ "additionalProperties": false,
836
+ "properties": {
837
+ "trigger": {
838
+ "type": "string",
839
+ "enum": ["confidence-low", "user-frustrated", "out-of-scope", "safety-concern", "repeated-failure", "explicit-request"]
840
+ },
841
+ "threshold": { "$ref": "#/$defs/UnitFloat" },
842
+ "target": { "type": "string" }
843
+ }
844
+ },
845
+
846
+ "AgentMemory": {
847
+ "type": "object",
848
+ "required": ["retention", "contextStrategy"],
849
+ "additionalProperties": false,
850
+ "properties": {
851
+ "retention": {
852
+ "type": "array",
853
+ "items": { "$ref": "#/$defs/RetentionPolicy" }
854
+ },
855
+ "contextStrategy": { "$ref": "#/$defs/ContextStrategy" },
856
+ "persistentState": {
857
+ "type": "array",
858
+ "items": { "$ref": "#/$defs/StateSchema" }
859
+ }
860
+ }
861
+ },
862
+
863
+ "RetentionPolicy": {
864
+ "type": "object",
865
+ "required": ["category", "duration"],
866
+ "additionalProperties": false,
867
+ "properties": {
868
+ "category": {
869
+ "type": "string",
870
+ "enum": ["user-preferences", "conversation-history", "task-state", "learned-patterns", "corrections", "facts"]
871
+ },
872
+ "duration": {
873
+ "type": "string",
874
+ "enum": ["conversation", "session", "days", "permanent"]
875
+ },
876
+ "days": { "type": "integer", "minimum": 1, "description": "Number of days (when duration = 'days')" },
877
+ "maxItems": { "type": "integer", "minimum": 1 },
878
+ "priority": { "type": "integer", "description": "Higher = keep longer under memory pressure" }
879
+ }
880
+ },
881
+
882
+ "ContextStrategy": {
883
+ "type": "object",
884
+ "required": ["overflow", "prioritize", "autoSummarize"],
885
+ "additionalProperties": false,
886
+ "properties": {
887
+ "overflow": {
888
+ "type": "string",
889
+ "enum": ["summarize", "sliding-window", "smart-select", "truncate"]
890
+ },
891
+ "prioritize": {
892
+ "type": "array",
893
+ "items": {
894
+ "type": "string",
895
+ "enum": ["recent", "user-stated", "task-relevant", "corrections"]
896
+ }
897
+ },
898
+ "autoSummarize": { "type": "boolean" }
899
+ }
900
+ },
901
+
902
+ "StateSchema": {
903
+ "type": "object",
904
+ "required": ["key", "type", "description", "agentWritable"],
905
+ "additionalProperties": false,
906
+ "properties": {
907
+ "key": { "type": "string" },
908
+ "type": {
909
+ "type": "string",
910
+ "enum": ["string", "number", "boolean", "array", "object"]
911
+ },
912
+ "description": { "type": "string" },
913
+ "defaultValue": {},
914
+ "agentWritable": { "type": "boolean" }
915
+ }
916
+ },
917
+
918
+ "AgentCommunication": {
919
+ "type": "object",
920
+ "required": ["channels", "input", "output"],
921
+ "additionalProperties": false,
922
+ "properties": {
923
+ "channels": {
924
+ "type": "array",
925
+ "items": { "$ref": "#/$defs/ChannelConfig" }
926
+ },
927
+ "input": { "$ref": "#/$defs/InputProcessing" },
928
+ "output": { "$ref": "#/$defs/OutputProcessing" },
929
+ "interAgent": { "$ref": "#/$defs/InterAgentConfig" }
930
+ }
931
+ },
932
+
933
+ "ChannelConfig": {
934
+ "type": "object",
935
+ "required": ["channel", "enabled"],
936
+ "additionalProperties": false,
937
+ "properties": {
938
+ "channel": { "type": "string", "description": "Channel identifier (e.g., 'slack', 'email', 'api', 'voice')" },
939
+ "enabled": { "type": "boolean" },
940
+ "voiceOverrides": { "$ref": "#/$defs/VoiceOverride" },
941
+ "constraints": {
942
+ "type": "object",
943
+ "additionalProperties": false,
944
+ "properties": {
945
+ "maxLength": { "type": "integer", "minimum": 1 },
946
+ "supportsMarkdown": { "type": "boolean" },
947
+ "supportsImages": { "type": "boolean" },
948
+ "supportsButtons": { "type": "boolean" }
949
+ }
950
+ }
951
+ }
952
+ },
953
+
954
+ "InputProcessing": {
955
+ "type": "object",
956
+ "required": ["languages", "typoTolerance", "ambiguityResolution", "modalities"],
957
+ "additionalProperties": false,
958
+ "properties": {
959
+ "languages": {
960
+ "type": "array",
961
+ "items": { "type": "string" }
962
+ },
963
+ "typoTolerance": { "type": "boolean" },
964
+ "ambiguityResolution": {
965
+ "type": "string",
966
+ "enum": ["ask", "best-guess", "ask-if-high-stakes"]
967
+ },
968
+ "modalities": {
969
+ "type": "array",
970
+ "items": {
971
+ "type": "string",
972
+ "enum": ["text", "image", "audio", "file"]
973
+ }
974
+ }
975
+ }
976
+ },
977
+
978
+ "OutputProcessing": {
979
+ "type": "object",
980
+ "required": ["defaultFormat", "citations", "structuredOutput"],
981
+ "additionalProperties": false,
982
+ "properties": {
983
+ "defaultFormat": {
984
+ "type": "string",
985
+ "enum": ["text", "markdown", "html", "json"]
986
+ },
987
+ "citations": {
988
+ "type": "string",
989
+ "enum": ["always", "when-available", "never"]
990
+ },
991
+ "maxLength": {
992
+ "type": "object",
993
+ "required": ["value", "unit"],
994
+ "additionalProperties": false,
995
+ "properties": {
996
+ "value": { "type": "integer", "minimum": 1 },
997
+ "unit": { "type": "string", "enum": ["tokens", "characters"] }
998
+ }
999
+ },
1000
+ "structuredOutput": { "type": "boolean" }
1001
+ }
1002
+ },
1003
+
1004
+ "InterAgentConfig": {
1005
+ "type": "object",
1006
+ "required": ["protocols", "exposedCapabilities", "requestableCapabilities"],
1007
+ "additionalProperties": false,
1008
+ "properties": {
1009
+ "protocols": {
1010
+ "type": "array",
1011
+ "items": {
1012
+ "type": "string",
1013
+ "enum": ["a2a", "mcp", "custom"]
1014
+ }
1015
+ },
1016
+ "exposedCapabilities": {
1017
+ "type": "array",
1018
+ "items": { "type": "string" }
1019
+ },
1020
+ "requestableCapabilities": {
1021
+ "type": "array",
1022
+ "items": { "type": "string" }
1023
+ },
1024
+ "auth": {
1025
+ "type": "string",
1026
+ "enum": ["none", "token", "mutual-tls", "oauth"]
1027
+ }
1028
+ }
1029
+ },
1030
+
1031
+ "AgentAdaptation": {
1032
+ "type": "object",
1033
+ "required": ["enabled"],
1034
+ "additionalProperties": false,
1035
+ "properties": {
1036
+ "enabled": { "type": "boolean" },
1037
+ "driftBounds": {
1038
+ "type": "array",
1039
+ "items": { "$ref": "#/$defs/DriftBound" }
1040
+ },
1041
+ "learning": { "$ref": "#/$defs/LearningConfig" },
1042
+ "feedback": { "$ref": "#/$defs/FeedbackConfig" }
1043
+ }
1044
+ },
1045
+
1046
+ "DriftBound": {
1047
+ "type": "object",
1048
+ "required": ["parameter", "maxDrift", "driftRate", "resetsPerConversation"],
1049
+ "additionalProperties": false,
1050
+ "properties": {
1051
+ "parameter": { "type": "string", "description": "Path to the parameter (e.g., 'voice.personality.formality')" },
1052
+ "maxDrift": {
1053
+ "$ref": "#/$defs/UnitFloat",
1054
+ "description": "Maximum drift from original value"
1055
+ },
1056
+ "driftRate": {
1057
+ "type": "string",
1058
+ "enum": ["immediate", "gradual", "slow"]
1059
+ },
1060
+ "resetsPerConversation": { "type": "boolean" }
1061
+ }
1062
+ },
1063
+
1064
+ "LearningConfig": {
1065
+ "type": "object",
1066
+ "required": ["sources", "minSamples", "requiresApproval"],
1067
+ "additionalProperties": false,
1068
+ "properties": {
1069
+ "sources": {
1070
+ "type": "array",
1071
+ "items": {
1072
+ "type": "string",
1073
+ "enum": ["user-feedback", "task-outcomes", "corrections", "examples"]
1074
+ }
1075
+ },
1076
+ "minSamples": { "type": "integer", "minimum": 1 },
1077
+ "requiresApproval": { "type": "boolean" }
1078
+ }
1079
+ },
1080
+
1081
+ "FeedbackConfig": {
1082
+ "type": "object",
1083
+ "required": ["collection", "application", "conflictResolution"],
1084
+ "additionalProperties": false,
1085
+ "properties": {
1086
+ "collection": {
1087
+ "type": "string",
1088
+ "enum": ["explicit-ask", "implicit-signals", "both"]
1089
+ },
1090
+ "application": {
1091
+ "type": "string",
1092
+ "enum": ["immediate", "batched", "manual-review"]
1093
+ },
1094
+ "conflictResolution": {
1095
+ "type": "string",
1096
+ "enum": ["latest-wins", "majority-wins", "ask-user"]
1097
+ }
1098
+ }
1099
+ },
1100
+
1101
+ "AgentObservability": {
1102
+ "type": "object",
1103
+ "required": ["logging", "metrics", "successCriteria"],
1104
+ "additionalProperties": false,
1105
+ "properties": {
1106
+ "logging": { "$ref": "#/$defs/LoggingConfig" },
1107
+ "metrics": {
1108
+ "type": "array",
1109
+ "items": { "$ref": "#/$defs/MetricDefinition" }
1110
+ },
1111
+ "successCriteria": {
1112
+ "type": "array",
1113
+ "items": { "$ref": "#/$defs/SuccessCriterion" }
1114
+ }
1115
+ }
1116
+ },
1117
+
1118
+ "LoggingConfig": {
1119
+ "type": "object",
1120
+ "required": ["level", "alwaysLog", "conversationLogging", "piiHandling"],
1121
+ "additionalProperties": false,
1122
+ "properties": {
1123
+ "level": {
1124
+ "type": "string",
1125
+ "enum": ["debug", "info", "warn", "error"]
1126
+ },
1127
+ "alwaysLog": {
1128
+ "type": "array",
1129
+ "items": {
1130
+ "type": "string",
1131
+ "enum": ["tool-use", "escalation", "boundary-hit", "error", "rule-fired"]
1132
+ }
1133
+ },
1134
+ "conversationLogging": {
1135
+ "type": "string",
1136
+ "enum": ["full", "summary", "none"]
1137
+ },
1138
+ "piiHandling": {
1139
+ "type": "string",
1140
+ "enum": ["redact", "hash", "allow"]
1141
+ }
1142
+ }
1143
+ },
1144
+
1145
+ "MetricDefinition": {
1146
+ "type": "object",
1147
+ "required": ["name", "description", "type", "event"],
1148
+ "additionalProperties": false,
1149
+ "properties": {
1150
+ "name": { "type": "string" },
1151
+ "description": { "type": "string" },
1152
+ "type": {
1153
+ "type": "string",
1154
+ "enum": ["counter", "gauge", "histogram", "rate"]
1155
+ },
1156
+ "event": { "type": "string" }
1157
+ }
1158
+ },
1159
+
1160
+ "SuccessCriterion": {
1161
+ "type": "object",
1162
+ "required": ["description", "metric", "target"],
1163
+ "additionalProperties": false,
1164
+ "properties": {
1165
+ "description": { "type": "string" },
1166
+ "metric": { "type": "string" },
1167
+ "target": {
1168
+ "type": "object",
1169
+ "required": ["operator", "value"],
1170
+ "additionalProperties": false,
1171
+ "properties": {
1172
+ "operator": {
1173
+ "type": "string",
1174
+ "enum": ["gt", "lt", "eq", "gte", "lte"]
1175
+ },
1176
+ "value": { "type": "number" }
1177
+ }
1178
+ },
1179
+ "window": {
1180
+ "type": "string",
1181
+ "enum": ["per-conversation", "per-day", "per-week"]
1182
+ }
1183
+ }
1184
+ }
1185
+ }
1186
+ }