@elizaos/prompts 2.0.0-alpha.113 → 2.0.0-alpha.115

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.
@@ -10,6 +10,36 @@ These prompts use Handlebars-style template syntax:
10
10
 
11
11
  from __future__ import annotations
12
12
 
13
+ ADD_CONTACT_TEMPLATE = """task: Extract contact information to add to the rolodex.
14
+
15
+ context:
16
+ {{providers}}
17
+
18
+ recent_messages:
19
+ {{recentMessages}}
20
+
21
+ current_message:
22
+ {{message}}
23
+
24
+ instructions[5]:
25
+ - identify the contact name being added
26
+ - include entityId only if it is explicitly known from context
27
+ - return categories as a comma-separated list
28
+ - include notes, timezone, and language only when clearly present
29
+ - include a short reason for why this contact should be saved
30
+
31
+ output:
32
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
33
+
34
+ Example:
35
+ contactName: Jane Doe
36
+ entityId:
37
+ categories: vip,colleague
38
+ notes: Met at the design summit
39
+ timezone: America/New_York
40
+ language: English
41
+ reason: Important collaborator to remember"""
42
+
13
43
  AUTONOMY_CONTINUOUS_CONTINUE_TEMPLATE = """Your job: reflect on context, decide what you want to do next, and act if appropriate.
14
44
  - Use available actions/tools when they can advance the goal.
15
45
  - Use thinking to think about and plan what you want to do.
@@ -84,36 +114,30 @@ CHOOSE_OPTION_TEMPLATE = """# Task: Choose an option from the available choices.
84
114
  Analyze the options and select the most appropriate one based on the current context.
85
115
  Provide your reasoning and the selected option ID.
86
116
 
87
- Respond using XML format like this:
88
- <response>
89
- <thought>Your reasoning for the selection</thought>
90
- <selected_id>The ID of the selected option</selected_id>
91
- </response>
117
+ Respond using TOON like this:
118
+ thought: Your reasoning for the selection
119
+ selected_id: The ID of the selected option
92
120
 
93
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
121
+ IMPORTANT: Your response must ONLY contain the TOON document above."""
94
122
 
95
- IMAGE_DESCRIPTION_TEMPLATE = """<task>Analyze the provided image and generate a comprehensive description with multiple levels of detail.</task>
123
+ IMAGE_DESCRIPTION_TEMPLATE = """Task: Analyze the provided image and generate a comprehensive description with multiple levels of detail.
96
124
 
97
- <instructions>
125
+ Instructions:
98
126
  Carefully examine the image and provide:
99
127
  1. A concise, descriptive title that captures the main subject or scene
100
128
  2. A brief summary description (1-2 sentences) highlighting the key elements
101
129
  3. An extensive, detailed description that covers all visible elements, composition, lighting, colors, mood, and any other relevant details
102
130
 
103
131
  Be objective and descriptive. Focus on what you can actually see in the image rather than making assumptions about context or meaning.
104
- </instructions>
105
132
 
106
- <output>
133
+ Output:
107
134
 
108
- Respond using XML format like this:
109
- <response>
110
- <title>A concise, descriptive title for the image</title>
111
- <description>A brief 1-2 sentence summary of the key elements in the image</description>
112
- <text>An extensive, detailed description covering all visible elements, composition, lighting, colors, mood, setting, objects, people, activities, and any other relevant details you can observe in the image</text>
113
- </response>
135
+ Respond using TOON like this:
136
+ title: A concise, descriptive title for the image
137
+ description: A brief 1-2 sentence summary of the key elements in the image
138
+ text: An extensive, detailed description covering all visible elements, composition, lighting, colors, mood, setting, objects, people, activities, and any other relevant details you can observe in the image
114
139
 
115
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.
116
- </output>"""
140
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any text, thinking, or reasoning before or after it."""
117
141
 
118
142
  IMAGE_GENERATION_TEMPLATE = """# Task: Generate an image prompt for {{agentName}}.
119
143
 
@@ -126,13 +150,11 @@ The prompt should be specific, descriptive, and suitable for AI image generation
126
150
  # Recent conversation:
127
151
  {{recentMessages}}
128
152
 
129
- Respond using XML format like this:
130
- <response>
131
- <thought>Your reasoning for the image prompt</thought>
132
- <prompt>Detailed image generation prompt</prompt>
133
- </response>
153
+ Respond using TOON like this:
154
+ thought: Your reasoning for the image prompt
155
+ prompt: Detailed image generation prompt
134
156
 
135
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
157
+ IMPORTANT: Your response must ONLY contain the TOON document above."""
136
158
 
137
159
  MESSAGE_HANDLER_TEMPLATE = """task: Generate dialog and actions for {{agentName}}.
138
160
 
@@ -146,8 +168,8 @@ rules[8]:
146
168
  - use IGNORE or STOP only by themselves
147
169
  - include providers only when needed
148
170
  - use provider_hints from context when present instead of restating the same rules
149
- - if an action needs inputs, include a <params> block with the required fields
150
- - if a required param is unknown, ask for clarification in <text>
171
+ - if an action needs inputs, include them under params keyed by action name
172
+ - if a required param is unknown, ask for clarification in text
151
173
 
152
174
  control_actions:
153
175
  - STOP means the task is done and the agent should end the run without executing more actions
@@ -155,35 +177,27 @@ control_actions:
155
177
 
156
178
  fields[5]{name,meaning}:
157
179
  - thought | short plan
158
- - actions | ordered XML <action> elements
159
- - providers | comma-separated provider names, or empty
180
+ - actions | ordered array of action names
181
+ - providers | array of provider names, or empty
160
182
  - text | next message for {{agentName}}
161
183
  - simple | true or false
184
+ - params | optional object keyed by action name containing required inputs
162
185
 
163
186
  formatting:
164
187
  - wrap multi-line code in fenced code blocks
165
188
  - use inline backticks for short code identifiers
166
189
 
167
- <output>
168
- XML only. Return exactly one <response> block. No prose before or after it. No <think>.
190
+ output:
191
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
169
192
 
170
193
  Example:
171
- <response>
172
- <thought>Reply briefly. No extra providers needed.</thought>
173
- <actions>
174
- <action>
175
- <name>REPLY</name>
176
- </action>
177
- </actions>
178
- <providers></providers>
179
- <text>Your message here</text>
180
- <simple>true</simple>
181
- </response>
182
- </output>"""
183
-
184
- MULTI_STEP_DECISION_TEMPLATE = """<task>
185
- Determine the next step the assistant should take in this conversation to help the user reach their goal.
186
- </task>
194
+ thought: Reply briefly. No extra providers needed.
195
+ actions[1]: REPLY
196
+ providers[0]:
197
+ text: Your message here
198
+ simple: true"""
199
+
200
+ MULTI_STEP_DECISION_TEMPLATE = """Determine the next step the assistant should take in this conversation to help the user reach their goal.
187
201
 
188
202
  {{recentMessages}}
189
203
 
@@ -209,27 +223,21 @@ These are the actions or data provider calls that have already been used in this
209
223
 
210
224
  {{actionResults}}
211
225
 
212
- <keys>
226
+ keys:
213
227
  "thought" Clearly explain your reasoning for the selected providers and/or action, and how this step contributes to resolving the user's request.
214
228
  "action" Name of the action to execute after providers return (can be empty if no action is needed).
215
229
  "providers" List of provider names to call in this step (can be empty if none are needed).
216
230
  "isFinish" Set to true only if the task is fully complete.
217
- </keys>
218
231
 
219
232
  ⚠️ IMPORTANT: Do **not** mark the task as `isFinish: true` immediately after calling an action. Wait for the action to complete before deciding the task is finished.
220
233
 
221
- <output>
222
- <response>
223
- <thought>Your thought here</thought>
224
- <action>ACTION</action>
225
- <providers>PROVIDER1,PROVIDER2</providers>
226
- <isFinish>true | false</isFinish>
227
- </response>
228
- </output>"""
234
+ output:
235
+ thought: Your thought here
236
+ action: ACTION
237
+ providers[2]: PROVIDER1,PROVIDER2
238
+ isFinish: false"""
229
239
 
230
- MULTI_STEP_SUMMARY_TEMPLATE = """<task>
231
- Summarize what the assistant has done so far and provide a final response to the user based on the completed steps.
232
- </task>
240
+ MULTI_STEP_SUMMARY_TEMPLATE = """Summarize what the assistant has done so far and provide a final response to the user based on the completed steps.
233
241
 
234
242
  # Context Information
235
243
  {{bio}}
@@ -257,13 +265,10 @@ Here are the actions taken by the assistant to fulfill the request:
257
265
 
258
266
  - Review the execution trace and last reasoning step carefully
259
267
 
260
- - Your final output MUST be in this XML format:
261
- <output>
262
- <response>
263
- <thought>Your thought here</thought>
264
- <text>Your final message to the user</text>
265
- </response>
266
- </output>"""
268
+ - Your final output MUST be TOON in this format:
269
+ output:
270
+ thought: Your thought here
271
+ text: Your final message to the user"""
267
272
 
268
273
  OPTION_EXTRACTION_TEMPLATE = """# Task: Extract selected task and option from user message
269
274
 
@@ -280,17 +285,13 @@ OPTION_EXTRACTION_TEMPLATE = """# Task: Extract selected task and option from us
280
285
  4. If no clear selection is made, return null for both fields
281
286
 
282
287
 
283
- Return in XML format:
284
- <response>
285
- <taskId>string_or_null</taskId>
286
- <selectedOption>OPTION_NAME_or_null</selectedOption>
287
- </response>
288
+ Return in TOON format:
289
+ taskId: string_or_null
290
+ selectedOption: OPTION_NAME_or_null
288
291
 
289
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>."""
292
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any text, thinking, or reasoning before or after it."""
290
293
 
291
- POST_ACTION_DECISION_TEMPLATE = """<task>
292
- Continue helping the user after reviewing the latest action results.
293
- </task>
294
+ POST_ACTION_DECISION_TEMPLATE = """Continue helping the user after reviewing the latest action results.
294
295
 
295
296
  context:
296
297
  {{providers}}
@@ -308,50 +309,37 @@ rules[9]:
308
309
  - use IGNORE or STOP only by themselves
309
310
  - include providers only when needed
310
311
  - use provider_hints from context when present instead of restating the same rules
311
- - if an action needs inputs, include a <params> block with the required fields
312
- - if a required param is unknown, ask for clarification in <text>
312
+ - if an action needs inputs, include them under params keyed by action name
313
+ - if a required param is unknown, ask for clarification in text
313
314
  - if the task is complete, either reply to the user or use STOP to end the run
314
315
  - STOP is a terminal control action even if it is not listed in available actions
315
316
 
316
- <output>
317
- XML only. Return exactly one <response> block. No prose before or after it. No <think>.
318
-
319
- <response>
320
- <thought>Your thought here</thought>
321
- <actions>
322
- <action>
323
- <name>ACTION</name>
324
- </action>
325
- </actions>
326
- <providers></providers>
327
- <text>Your message here</text>
328
- <simple>true</simple>
329
- </response>
330
- </output>"""
317
+ output:
318
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
319
+
320
+ thought: Your thought here
321
+ actions[1]: ACTION
322
+ providers[0]:
323
+ text: Your message here
324
+ simple: true"""
331
325
 
332
326
  POST_CREATION_TEMPLATE = """# Task: Create a post in the voice and style and perspective of {{agentName}} @{{xUserName}}.
333
327
 
334
328
  Example task outputs:
335
329
  1. A post about the importance of AI in our lives
336
- <response>
337
- <thought>I am thinking about writing a post about the importance of AI in our lives</thought>
338
- <post>AI is changing the world and it is important to understand how it works</post>
339
- <imagePrompt>A futuristic cityscape with flying cars and people using AI to do things</imagePrompt>
340
- </response>
330
+ thought: I am thinking about writing a post about the importance of AI in our lives
331
+ post: AI is changing the world and it is important to understand how it works
332
+ imagePrompt: A futuristic cityscape with flying cars and people using AI to do things
341
333
 
342
334
  2. A post about dogs
343
- <response>
344
- <thought>I am thinking about writing a post about dogs</thought>
345
- <post>Dogs are man's best friend and they are loyal and loving</post>
346
- <imagePrompt>A dog playing with a ball in a park</imagePrompt>
347
- </response>
335
+ thought: I am thinking about writing a post about dogs
336
+ post: Dogs are man's best friend and they are loyal and loving
337
+ imagePrompt: A dog playing with a ball in a park
348
338
 
349
339
  3. A post about finding a new job
350
- <response>
351
- <thought>Getting a job is hard, I bet there's a good post in that</thought>
352
- <post>Just keep going!</post>
353
- <imagePrompt>A person looking at a computer screen with a job search website</imagePrompt>
354
- </response>
340
+ thought: Getting a job is hard, I bet there's a good post in that
341
+ post: Just keep going!
342
+ imagePrompt: A person looking at a computer screen with a job search website
355
343
 
356
344
  {{providers}}
357
345
 
@@ -359,19 +347,17 @@ Write a post that is {{adjective}} about {{topic}} (without mentioning {{topic}}
359
347
  Your response should be 1, 2, or 3 sentences (choose the length at random).
360
348
  Your response should not contain any questions. Brief, concise statements only. The total character count MUST be less than 280. No emojis. Use \\n\\n (double spaces) between statements if there are multiple statements in your response.
361
349
 
362
- Your output should be formatted in XML like this:
363
- <response>
364
- <thought>Your thought here</thought>
365
- <post>Your post text here</post>
366
- <imagePrompt>Optional image prompt here</imagePrompt>
367
- </response>
350
+ Your output should be formatted as TOON like this:
351
+ thought: Your thought here
352
+ post: Your post text here
353
+ imagePrompt: Optional image prompt here
368
354
 
369
355
  The "post" field should be the post you want to send. Do not including any thinking or internal reflection in the "post" field.
370
356
  The "imagePrompt" field is optional and should be a prompt for an image that is relevant to the post. It should be a single sentence that captures the essence of the post. ONLY USE THIS FIELD if it makes sense that the post would benefit from an image.
371
357
  The "thought" field should be a short description of what the agent is thinking about before responding, including a brief justification for the response. Includate an explanation how the post is relevant to the topic but unique and different than other posts.
372
358
 
373
359
 
374
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>."""
360
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any text, thinking, or reasoning before or after it."""
375
361
 
376
362
  REFLECTION_EVALUATOR_TEMPLATE = """# Task: Generate Agent Reflection, Extract Facts and Relationships
377
363
 
@@ -405,29 +391,14 @@ Message Sender: {{senderName}} (ID: {{senderId}})
405
391
  - Relationships are one-direction, so a friendship would be two entity relationships where each entity is both the source and the target of the other.
406
392
 
407
393
 
408
- Generate a response in the following format:
409
- <response>
410
- <thought>a self-reflective thought on the conversation</thought>
411
- <facts>
412
- <fact>
413
- <claim>factual statement</claim>
414
- <type>fact|opinion|status</type>
415
- <in_bio>false</in_bio>
416
- <already_known>false</already_known>
417
- </fact>
418
- <!-- Add more facts as needed -->
419
- </facts>
420
- <relationships>
421
- <relationship>
422
- <sourceEntityId>entity_initiating_interaction</sourceEntityId>
423
- <targetEntityId>entity_being_interacted_with</targetEntityId>
424
- <tags>group_interaction,voice_interaction,dm_interaction,additional_tag1,additional_tag2</tags>
425
- </relationship>
426
- <!-- Add more relationships as needed -->
427
- </relationships>
428
- </response>
429
-
430
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>."""
394
+ Generate a response in the following TOON format:
395
+ thought: a self-reflective thought on the conversation
396
+ facts[1]{claim,type,in_bio,already_known}:
397
+ "factual statement",fact,false,false
398
+ relationships[1]{sourceEntityId,targetEntityId,tags}:
399
+ entity_initiating_interaction,entity_being_interacted_with,"group_interaction,voice_interaction,dm_interaction,additional_tag1,additional_tag2"
400
+
401
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any text, thinking, or reasoning before or after it."""
431
402
 
432
403
  REFLECTION_TEMPLATE = """# Task: Reflect on recent agent behavior and interactions.
433
404
 
@@ -443,16 +414,35 @@ Analyze the agent's recent behavior and interactions. Consider:
443
414
  3. Were any mistakes made?
444
415
  4. What could be improved?
445
416
 
446
- Respond using XML format like this:
447
- <response>
448
- <thought>Your detailed analysis</thought>
449
- <quality_score>Score 0-100 for overall quality</quality_score>
450
- <strengths>What went well</strengths>
451
- <improvements>What could be improved</improvements>
452
- <learnings>Key takeaways for future interactions</learnings>
453
- </response>
417
+ Respond using TOON like this:
418
+ thought: Your detailed analysis
419
+ quality_score: Score 0-100 for overall quality
420
+ strengths: What went well
421
+ improvements: What could be improved
422
+ learnings: Key takeaways for future interactions
454
423
 
455
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
424
+ IMPORTANT: Your response must ONLY contain the TOON document above."""
425
+
426
+ REMOVE_CONTACT_TEMPLATE = """task: Extract the contact removal request.
427
+
428
+ context:
429
+ {{providers}}
430
+
431
+ current_message:
432
+ {{message}}
433
+
434
+ instructions[4]:
435
+ - identify the contact name to remove
436
+ - set confirmed to yes only when the user explicitly confirms removal
437
+ - set confirmed to no when confirmation is absent or ambiguous
438
+ - return only the requested contact
439
+
440
+ output:
441
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
442
+
443
+ Example:
444
+ contactName: Jane Doe
445
+ confirmed: yes"""
456
446
 
457
447
  REPLY_TEMPLATE = """# Task: Generate dialog for the character {{agentName}}.
458
448
 
@@ -469,15 +459,104 @@ IMPORTANT CODE BLOCK FORMATTING RULES:
469
459
  - This ensures the user sees clearly formatted and copyable code when relevant.
470
460
 
471
461
  Do NOT include any thinking, reasoning, or <think> sections in your response.
472
- Go directly to the XML response format without any preamble or explanation.
462
+ Go directly to the TOON response format without any preamble or explanation.
463
+
464
+ Respond using TOON like this:
465
+ thought: Your thought here
466
+ text: Your message here
467
+
468
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any text, thinking, or reasoning before or after it."""
469
+
470
+ SCHEDULE_FOLLOW_UP_TEMPLATE = """task: Extract follow-up scheduling information from the request.
471
+
472
+ context:
473
+ {{providers}}
474
+
475
+ current_message:
476
+ {{message}}
477
+
478
+ current_datetime:
479
+ {{currentDateTime}}
480
+
481
+ instructions[5]:
482
+ - identify who to follow up with
483
+ - include entityId only when it is explicitly known
484
+ - convert requested timing into an ISO datetime in scheduledAt
485
+ - normalize priority to high, medium, or low
486
+ - include message only when the user asked for a specific note or reminder text
487
+
488
+ output:
489
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
490
+
491
+ Example:
492
+ contactName: Jane Doe
493
+ entityId:
494
+ scheduledAt: 2026-04-06T14:00:00.000Z
495
+ reason: Check in on the proposal
496
+ priority: medium
497
+ message: Send the latest deck before the call"""
498
+
499
+ SEARCH_CONTACTS_TEMPLATE = """task: Extract contact search criteria from the request.
500
+
501
+ context:
502
+ {{providers}}
503
+
504
+ current_message:
505
+ {{message}}
506
+
507
+ instructions[5]:
508
+ - return categories as a comma-separated list when the user filters by category
509
+ - return tags as a comma-separated list when the user filters by tags
510
+ - return searchTerm for any name or free-text lookup
511
+ - set intent to count when the user only wants a count, otherwise list
512
+ - omit fields that are not clearly requested
513
+
514
+ output:
515
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
516
+
517
+ Example:
518
+ categories: vip,colleague
519
+ searchTerm: Jane
520
+ tags: ai,design
521
+ intent: list"""
522
+
523
+ SHOULD_FOLLOW_ROOM_TEMPLATE = """task: Decide whether {{agentName}} should follow this room.
524
+
525
+ context:
526
+ {{providers}}
527
+
528
+ current_message:
529
+ {{message}}
530
+
531
+ instructions[3]:
532
+ - return true only when the user is clearly asking {{agentName}} to follow, join, listen to, or stay engaged in this room
533
+ - return false when the request is ambiguous or unrelated
534
+ - prefer false when uncertain
535
+
536
+ output:
537
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
538
+
539
+ Example:
540
+ decision: true"""
541
+
542
+ SHOULD_MUTE_ROOM_TEMPLATE = """task: Decide whether {{agentName}} should mute this room.
543
+
544
+ context:
545
+ {{providers}}
473
546
 
474
- Respond using XML format like this:
475
- <response>
476
- <thought>Your thought here</thought>
477
- <text>Your message here</text>
478
- </response>
547
+ current_message:
548
+ {{message}}
479
549
 
480
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>."""
550
+ instructions[3]:
551
+ - return true only when the user is clearly asking {{agentName}} to mute, silence, or ignore this room
552
+ - return false when the request is ambiguous or unrelated
553
+ - prefer false when uncertain
554
+
555
+ output:
556
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
557
+
558
+ Example:
559
+ decision: true"""
481
560
 
482
561
  SHOULD_RESPOND_TEMPLATE = """task: Decide whether {{agentName}} should respond, ignore, or stop.
483
562
 
@@ -492,20 +571,131 @@ rules[6]:
492
571
  - talking to someone else -> IGNORE
493
572
  - if unsure, prefer IGNORE over hallucinating relevance
494
573
 
574
+ available_contexts:
575
+ {{availableContexts}}
576
+
577
+ context_routing:
578
+ - primaryContext: choose one context from available_contexts, or "general" if none apply
579
+ - secondaryContexts: optional comma-separated list of additional relevant contexts
580
+ - evidenceTurnIds: optional comma-separated list of message IDs supporting the decision
581
+
582
+ decision_note:
583
+ - talking TO {{agentName}} means name mention, reply chain, or direct continuation
584
+ - talking ABOUT {{agentName}} is not enough
585
+
586
+ output:
587
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
588
+
589
+ Example:
590
+ name: {{agentName}}
591
+ reasoning: Direct mention and clear follow-up.
592
+ action: RESPOND
593
+ primaryContext: general
594
+ secondaryContexts:
595
+ evidenceTurnIds:"""
596
+
597
+ SHOULD_RESPOND_WITH_CONTEXT_TEMPLATE = """task: Decide whether {{agentName}} should respond and which domain context applies.
598
+
599
+ context:
600
+ {{providers}}
601
+
602
+ available_contexts:
603
+ {{availableContexts}}
604
+
605
+ rules[6]:
606
+ - direct mention of {{agentName}} -> RESPOND
607
+ - different assistant name -> IGNORE
608
+ - continuing an active thread with {{agentName}} -> RESPOND
609
+ - request to stop or be quiet -> STOP
610
+ - talking to someone else -> IGNORE
611
+ - if unsure, prefer IGNORE over hallucinating relevance
612
+
613
+ context_routing:
614
+ - primaryContext: the single best-matching domain from available_contexts
615
+ - secondaryContexts: zero or more additional domains that are relevant
616
+ - action intent does not only come from the last message; consider the full recent conversation
617
+ - if no specific domain applies, use "general"
618
+
495
619
  decision_note:
496
620
  - talking TO {{agentName}} means name mention, reply chain, or direct continuation
497
621
  - talking ABOUT {{agentName}} is not enough
622
+ - context routing always applies, even for IGNORE/STOP decisions
623
+
624
+ output:
625
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
626
+
627
+ Example:
628
+ name: {{agentName}}
629
+ reasoning: Direct mention asking about token balance.
630
+ action: RESPOND
631
+ primaryContext: wallet
632
+ secondaryContexts: []"""
633
+
634
+ SHOULD_UNFOLLOW_ROOM_TEMPLATE = """task: Decide whether {{agentName}} should unfollow this room.
635
+
636
+ context:
637
+ {{providers}}
638
+
639
+ current_message:
640
+ {{message}}
641
+
642
+ instructions[3]:
643
+ - return true only when the user is clearly asking {{agentName}} to stop following or leave this room
644
+ - return false when the request is ambiguous or unrelated
645
+ - prefer false when uncertain
646
+
647
+ output:
648
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
649
+
650
+ Example:
651
+ decision: true"""
652
+
653
+ SHOULD_UNMUTE_ROOM_TEMPLATE = """task: Decide whether {{agentName}} should unmute this room.
654
+
655
+ context:
656
+ {{providers}}
657
+
658
+ current_message:
659
+ {{message}}
660
+
661
+ instructions[3]:
662
+ - return true only when the user is clearly asking {{agentName}} to unmute or resume listening to this room
663
+ - return false when the request is ambiguous or unrelated
664
+ - prefer false when uncertain
665
+
666
+ output:
667
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
668
+
669
+ Example:
670
+ decision: true"""
671
+
672
+ UPDATE_CONTACT_TEMPLATE = """task: Extract contact updates from the request.
673
+
674
+ context:
675
+ {{providers}}
676
+
677
+ current_message:
678
+ {{message}}
679
+
680
+ instructions[6]:
681
+ - identify the contact name to update
682
+ - set operation to replace unless the user clearly says to add_to or remove_from
683
+ - return categories and tags as comma-separated lists
684
+ - return preferences and customFields as comma-separated key:value pairs
685
+ - include notes only when explicitly requested
686
+ - omit fields that are not being changed
498
687
 
499
- <output>
500
- XML only. Return exactly one <response> block. No prose before or after it. No <think>.
688
+ output:
689
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
501
690
 
502
691
  Example:
503
- <response>
504
- <name>{{agentName}}</name>
505
- <reasoning>Direct mention and clear follow-up.</reasoning>
506
- <action>RESPOND | IGNORE | STOP</action>
507
- </response>
508
- </output>"""
692
+ contactName: Jane Doe
693
+ operation: add_to
694
+ categories: vip
695
+ tags: ai,friend
696
+ preferences: timezone:America/New_York,language:English
697
+ customFields: company:Acme,title:Designer
698
+ notes: Prefers async communication"""
509
699
 
510
700
  UPDATE_ENTITY_TEMPLATE = """# Task: Update entity information.
511
701
 
@@ -518,19 +708,13 @@ UPDATE_ENTITY_TEMPLATE = """# Task: Update entity information.
518
708
  Based on the request, determine what information about the entity should be updated.
519
709
  Only update fields that the user has explicitly requested to change.
520
710
 
521
- Respond using XML format like this:
522
- <response>
523
- <thought>Your reasoning for the entity update</thought>
524
- <entity_id>The entity ID to update</entity_id>
525
- <updates>
526
- <field>
527
- <name>field_name</name>
528
- <value>new_value</value>
529
- </field>
530
- </updates>
531
- </response>
711
+ Respond using TOON like this:
712
+ thought: Your reasoning for the entity update
713
+ entity_id: The entity ID to update
714
+ updates[1]{name,value}:
715
+ field_name,new_value
532
716
 
533
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
717
+ IMPORTANT: Your response must ONLY contain the TOON document above."""
534
718
 
535
719
  UPDATE_SETTINGS_TEMPLATE = """# Task: Update settings based on the request.
536
720
 
@@ -543,22 +727,17 @@ UPDATE_SETTINGS_TEMPLATE = """# Task: Update settings based on the request.
543
727
  Based on the request, determine which settings to update.
544
728
  Only update settings that the user has explicitly requested.
545
729
 
546
- Respond using XML format like this:
547
- <response>
548
- <thought>Your reasoning for the settings changes</thought>
549
- <updates>
550
- <update>
551
- <key>setting_key</key>
552
- <value>new_value</value>
553
- </update>
554
- </updates>
555
- </response>
730
+ Respond using TOON like this:
731
+ thought: Your reasoning for the settings changes
732
+ updates[1]{key,value}:
733
+ setting_key,new_value
556
734
 
557
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
735
+ IMPORTANT: Your response must ONLY contain the TOON document above."""
558
736
 
559
737
  BOOLEAN_FOOTER = "Respond with only a YES or a NO."
560
738
 
561
739
  __all__ = [
740
+ "ADD_CONTACT_TEMPLATE",
562
741
  "AUTONOMY_CONTINUOUS_CONTINUE_TEMPLATE",
563
742
  "AUTONOMY_CONTINUOUS_FIRST_TEMPLATE",
564
743
  "AUTONOMY_TASK_CONTINUE_TEMPLATE",
@@ -574,8 +753,17 @@ __all__ = [
574
753
  "POST_CREATION_TEMPLATE",
575
754
  "REFLECTION_EVALUATOR_TEMPLATE",
576
755
  "REFLECTION_TEMPLATE",
756
+ "REMOVE_CONTACT_TEMPLATE",
577
757
  "REPLY_TEMPLATE",
758
+ "SCHEDULE_FOLLOW_UP_TEMPLATE",
759
+ "SEARCH_CONTACTS_TEMPLATE",
760
+ "SHOULD_FOLLOW_ROOM_TEMPLATE",
761
+ "SHOULD_MUTE_ROOM_TEMPLATE",
578
762
  "SHOULD_RESPOND_TEMPLATE",
763
+ "SHOULD_RESPOND_WITH_CONTEXT_TEMPLATE",
764
+ "SHOULD_UNFOLLOW_ROOM_TEMPLATE",
765
+ "SHOULD_UNMUTE_ROOM_TEMPLATE",
766
+ "UPDATE_CONTACT_TEMPLATE",
579
767
  "UPDATE_ENTITY_TEMPLATE",
580
768
  "UPDATE_SETTINGS_TEMPLATE",
581
769
  "BOOLEAN_FOOTER",