@elizaos/prompts 2.0.0-alpha.40 → 2.0.0-alpha.401

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.
Files changed (41) hide show
  1. package/dist/python/prompts.py +828 -244
  2. package/dist/rust/prompts.rs +809 -245
  3. package/dist/typescript/index.d.ts +40 -0
  4. package/dist/typescript/index.ts +846 -242
  5. package/package.json +6 -7
  6. package/prompts/add_contact.txt +29 -0
  7. package/prompts/choose_option.txt +4 -7
  8. package/prompts/extract_secret_operation.txt +20 -0
  9. package/prompts/extract_secret_request.txt +16 -0
  10. package/prompts/extract_secrets.txt +17 -0
  11. package/prompts/image_description.txt +8 -15
  12. package/prompts/image_generation.txt +4 -7
  13. package/prompts/initial_summarization.txt +28 -0
  14. package/prompts/long_term_extraction.txt +128 -0
  15. package/prompts/message_classifier.txt +37 -0
  16. package/prompts/message_handler.txt +44 -70
  17. package/prompts/multi_step_decision.txt +6 -18
  18. package/prompts/multi_step_summary.txt +4 -10
  19. package/prompts/option_extraction.txt +4 -9
  20. package/prompts/post_action_decision.txt +35 -0
  21. package/prompts/post_creation.txt +14 -25
  22. package/prompts/reflection.txt +8 -11
  23. package/prompts/reflection_evaluator.txt +37 -32
  24. package/prompts/remove_contact.txt +20 -0
  25. package/prompts/reply.txt +5 -8
  26. package/prompts/schedule_follow_up.txt +28 -0
  27. package/prompts/search_contacts.txt +23 -0
  28. package/prompts/should_follow_room.txt +18 -0
  29. package/prompts/should_mute_room.txt +18 -0
  30. package/prompts/should_respond.txt +37 -37
  31. package/prompts/should_respond_with_context.txt +41 -0
  32. package/prompts/should_unfollow_room.txt +18 -0
  33. package/prompts/should_unmute_room.txt +18 -0
  34. package/prompts/think.txt +25 -0
  35. package/prompts/update_contact.txt +27 -0
  36. package/prompts/update_entity.txt +6 -13
  37. package/prompts/update_role.txt +29 -0
  38. package/prompts/update_settings.txt +5 -12
  39. package/prompts/update_summarization.txt +30 -0
  40. package/scripts/generate-action-docs.js +18 -1
  41. package/scripts/generate-plugin-action-spec.js +1 -0
@@ -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 relationships.
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,38 +114,86 @@ 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
120
+
121
+ IMPORTANT: Your response must ONLY contain the TOON document above."""
122
+
123
+ EXTRACT_SECRET_OPERATION_TEMPLATE = """You are helping manage secrets for an AI agent.
124
+
125
+ Determine what operation the user wants to perform:
126
+ - get: Retrieve a secret value
127
+ - set: Store a new secret
128
+ - delete: Remove a secret
129
+ - list: Show all available secrets (without values)
130
+ - check: Check if a secret exists
131
+
132
+ Common patterns:
133
+ - "What is my OpenAI key?" -> operation: get, key: OPENAI_API_KEY
134
+ - "Do I have a Discord token set?" -> operation: check, key: DISCORD_BOT_TOKEN
135
+ - "Show me my secrets" -> operation: list
136
+ - "Delete my old API key" -> operation: delete
137
+ - "Remove TWITTER_API_KEY" -> operation: delete, key: TWITTER_API_KEY
138
+ - "Set my key to sk-..." -> operation: set, key: <infer>, value: sk-...
139
+
140
+ {{recentMessages}}
141
+
142
+ Extract the operation, key (if applicable), value (if applicable), and level from the user's message."""
143
+
144
+ EXTRACT_SECRET_REQUEST_TEMPLATE = """You are helping an AI agent request a missing secret.
145
+ Determine what secret the agent needs and why based on the recent conversation.
146
+
147
+ Common patterns:
148
+ - "I need an API key for OpenAI" -> key: OPENAI_API_KEY
149
+ - "Missing TWITTER_TOKEN" -> key: TWITTER_TOKEN
150
+ - "I cannot proceed without a Discord token" -> key: DISCORD_TOKEN
92
151
 
93
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
152
+ Recent Messages:
153
+ {{recentMessages}}
154
+
155
+ Output JSON with:
156
+ - key: The name of the secret needed (e.g. OPENAI_API_KEY)
157
+ - reason: Why it is needed (optional)
158
+
159
+ If no specific secret is requested, return null json."""
160
+
161
+ EXTRACT_SECRETS_TEMPLATE = """You are extracting secret/configuration values from the user's message.
162
+
163
+ The user wants to set one or more secrets. Extract:
164
+ 1. The secret key (should be UPPERCASE_WITH_UNDERSCORES format)
165
+ 2. The secret value
166
+ 3. Optional description
167
+ 4. Secret type (api_key, secret, credential, url, or config)
94
168
 
95
- IMAGE_DESCRIPTION_TEMPLATE = """<task>Analyze the provided image and generate a comprehensive description with multiple levels of detail.</task>
169
+ Common patterns:
170
+ - "Set my OpenAI key to sk-..." -> key: OPENAI_API_KEY, value: sk-...
171
+ - "My Anthropic API key is sk-ant-..." -> key: ANTHROPIC_API_KEY, value: sk-ant-...
172
+ - "Use this Discord token: ..." -> key: DISCORD_BOT_TOKEN, value: ...
173
+ - "Set DATABASE_URL to postgres://..." -> key: DATABASE_URL, value: postgres://...
96
174
 
97
- <instructions>
175
+ {{recentMessages}}
176
+
177
+ Extract the secrets from the user's message. If the key name isn't explicitly specified, infer an appropriate UPPERCASE_WITH_UNDERSCORES name based on the context."""
178
+
179
+ IMAGE_DESCRIPTION_TEMPLATE = """Task: Analyze the provided image and generate a comprehensive description with multiple levels of detail.
180
+
181
+ Instructions:
98
182
  Carefully examine the image and provide:
99
183
  1. A concise, descriptive title that captures the main subject or scene
100
184
  2. A brief summary description (1-2 sentences) highlighting the key elements
101
185
  3. An extensive, detailed description that covers all visible elements, composition, lighting, colors, mood, and any other relevant details
102
186
 
103
187
  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
188
 
106
- <output>
107
- Do NOT include any thinking, reasoning, or <think> sections in your response.
108
- Go directly to the XML response format without any preamble or explanation.
189
+ Output:
109
190
 
110
- Respond using XML format like this:
111
- <response>
112
- <title>A concise, descriptive title for the image</title>
113
- <description>A brief 1-2 sentence summary of the key elements in the image</description>
114
- <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>
115
- </response>
191
+ Respond using TOON like this:
192
+ title: A concise, descriptive title for the image
193
+ description: A brief 1-2 sentence summary of the key elements in the image
194
+ 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
116
195
 
117
- 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>.
118
- </output>"""
196
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any text, thinking, or reasoning before or after it."""
119
197
 
120
198
  IMAGE_GENERATION_TEMPLATE = """# Task: Generate an image prompt for {{agentName}}.
121
199
 
@@ -128,87 +206,259 @@ The prompt should be specific, descriptive, and suitable for AI image generation
128
206
  # Recent conversation:
129
207
  {{recentMessages}}
130
208
 
131
- Respond using XML format like this:
132
- <response>
133
- <thought>Your reasoning for the image prompt</thought>
134
- <prompt>Detailed image generation prompt</prompt>
135
- </response>
209
+ Respond using TOON like this:
210
+ thought: Your reasoning for the image prompt
211
+ prompt: Detailed image generation prompt
136
212
 
137
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
213
+ IMPORTANT: Your response must ONLY contain the TOON document above."""
138
214
 
139
- MESSAGE_HANDLER_TEMPLATE = """<task>Generate dialog and actions for the character {{agentName}}.</task>
215
+ INITIAL_SUMMARIZATION_TEMPLATE = """# Task: Summarize Conversation
140
216
 
141
- <providers>
142
- {{providers}}
143
- </providers>
144
-
145
- <instructions>
146
- Write a thought and plan for {{agentName}} and decide what actions to take.
147
-
148
- IMPORTANT ACTION ORDERING RULES:
149
- - Actions are executed in the ORDER you list them - the order MATTERS!
150
- - REPLY should come FIRST to acknowledge the user's request before executing other actions
151
- - Common patterns:
152
- - For requests requiring tool use: REPLY,CALL_MCP_TOOL (acknowledge first, then gather info)
153
- - For task execution: REPLY,SEND_MESSAGE or REPLY,EVM_SWAP_TOKENS (acknowledge first, then do the task)
154
- - For multi-step operations: REPLY,ACTION1,ACTION2 (acknowledge first, then complete all steps)
155
- - REPLY is used to acknowledge and inform the user about what you're going to do
156
- - Follow-up actions execute the actual tasks after acknowledgment
157
- - Use IGNORE only when you should not respond at all
158
- - If you use IGNORE, do not include any other actions. IGNORE should be used alone when you should not respond or take any actions.
159
-
160
- IMPORTANT ACTION PARAMETERS:
161
- - Some actions accept input parameters that you should extract from the conversation
162
- - When an action has parameters listed in its description, include a <params> block for that action
163
- - Extract parameter values from the user's message and conversation context
164
- - Required parameters MUST be provided; optional parameters can be omitted if not mentioned
165
- - If you cannot determine a required parameter value, ask the user for clarification in your <text>
217
+ You are analyzing a conversation to create a concise summary that captures the key points, topics, and important details.
166
218
 
167
- IMPORTANT CODE BLOCK FORMATTING RULES:
168
- - If {{agentName}} includes code examples, snippets, or multi-line code in the response, ALWAYS wrap the code with ``` fenced code blocks (specify the language if known, e.g., ```python).
169
- - ONLY use fenced code blocks for actual code. Do NOT wrap non-code text, instructions, or single words in fenced code blocks.
170
- - If including inline code (short single words or function names), use single backticks (`) as appropriate.
171
- - This ensures the user sees clearly formatted and copyable code when relevant.
219
+ # Recent Messages
220
+ {{recentMessages}}
172
221
 
173
- First, think about what you want to do next and plan your actions. Then, write the next message and include the actions you plan to take.
174
- </instructions>
222
+ # Instructions
223
+ Generate a summary that:
224
+ 1. Captures the main topics discussed
225
+ 2. Highlights key information shared
226
+ 3. Notes any decisions made or questions asked
227
+ 4. Maintains context for future reference
228
+ 5. Is concise but comprehensive
175
229
 
176
- <keys>
177
- "thought" should be a short description of what the agent is thinking about and planning.
178
- "actions" should be a comma-separated list of the actions {{agentName}} plans to take based on the thought, IN THE ORDER THEY SHOULD BE EXECUTED (if none, use IGNORE, if simply responding with text, use REPLY)
179
- "text" should be the text of the next message for {{agentName}} which they will send to the conversation.
180
- "params" (optional) should contain action parameters when actions require input. Format as nested XML with action name as wrapper.
181
- </keys>
230
+ **IMPORTANT**: Keep the summary under 2500 tokens. Be comprehensive but concise.
231
+
232
+ Also extract:
233
+ - **Topics**: List of main topics discussed (comma-separated)
234
+ - **Key Points**: Important facts or decisions (bullet points)
235
+
236
+ Respond in TOON:
237
+ text: Your comprehensive summary here
238
+ topics[0]: topic1
239
+ topics[1]: topic2
240
+ topics[2]: topic3
241
+ keyPoints[0]: First key point
242
+ keyPoints[1]: Second key point"""
243
+
244
+ LONG_TERM_EXTRACTION_TEMPLATE = """# Task: Extract Long-Term Memory (Strict Criteria)
245
+
246
+ You are analyzing a conversation to extract ONLY the most critical, persistent information about the user using cognitive science memory categories.
182
247
 
183
- <output>
184
- Do NOT include any thinking, reasoning, or <think> sections in your response.
185
- Go directly to the XML response format without any preamble or explanation.
248
+ # Recent Messages
249
+ {{recentMessages}}
250
+
251
+ # Current Long-Term Memories
252
+ {{existingMemories}}
253
+
254
+ # Memory Categories (Based on Cognitive Science)
255
+
256
+ ## 1. EPISODIC Memory
257
+ Personal experiences and specific events with temporal/spatial context.
258
+ **Examples:**
259
+ - "User completed migration project from MongoDB to PostgreSQL in Q2 2024"
260
+ - "User encountered authentication bug in production on March 15th"
261
+ - "User had a negative experience with Docker networking in previous job"
262
+
263
+ **Requirements:**
264
+ - Must include WHO did WHAT, WHEN/WHERE
265
+ - Must be a specific, concrete event (not a pattern)
266
+ - Must have significant impact or relevance to future work
267
+
268
+ ## 2. SEMANTIC Memory
269
+ General facts, concepts, knowledge, and established truths about the user.
270
+ **Examples:**
271
+ - "User is a senior backend engineer with 8 years experience"
272
+ - "User specializes in distributed systems and microservices architecture"
273
+ - "User's primary programming language is TypeScript"
274
+ - "User works at Acme Corp as technical lead"
275
+
276
+ **Requirements:**
277
+ - Must be factual, timeless information
278
+ - Must be explicitly stated or demonstrated conclusively
279
+ - No speculation or inference from single instances
280
+ - Core identity, expertise, or knowledge only
281
+
282
+ ## 3. PROCEDURAL Memory
283
+ Skills, workflows, methodologies, and how-to knowledge.
284
+ **Examples:**
285
+ - "User follows strict TDD workflow: write tests first, then implementation"
286
+ - "User prefers git rebase over merge to maintain linear history"
287
+ - "User's debugging process: check logs → reproduce locally → binary search"
288
+ - "User always writes JSDoc comments before implementing functions"
289
+
290
+ **Requirements:**
291
+ - Must describe HOW user does something
292
+ - Must be a repeated, consistent pattern (seen 3+ times or explicitly stated as standard practice)
293
+ - Must be a workflow, methodology, or skill application
294
+ - Not one-off preferences
295
+
296
+ # ULTRA-STRICT EXTRACTION CRITERIA
297
+
298
+ ## DO EXTRACT (Only These):
299
+
300
+ **EPISODIC:**
301
+ - Significant completed projects or milestones
302
+ - Important bugs, incidents, or problems encountered
303
+ - Major decisions made with lasting impact
304
+ - Formative experiences that shape future work
305
+
306
+ **SEMANTIC:**
307
+ - Professional identity (role, title, company)
308
+ - Core expertise and specializations (stated explicitly or demonstrated conclusively)
309
+ - Primary languages, frameworks, or tools (not exploratory use)
310
+ - Established facts about their work context
311
+
312
+ **PROCEDURAL:**
313
+ - Consistent workflows demonstrated 3+ times or explicitly stated
314
+ - Standard practices user always follows
315
+ - Methodology preferences with clear rationale
316
+ - Debugging, testing, or development processes
317
+
318
+ ## NEVER EXTRACT:
319
+
320
+ - **One-time requests or tasks** (e.g., "can you generate an image", "help me debug this")
321
+ - **Casual conversations** without lasting significance
322
+ - **Exploratory questions** (e.g., "how does X work?")
323
+ - **Temporary context** (current bug, today's task)
324
+ - **Preferences from single occurrence** (e.g., user asked for code once)
325
+ - **Social pleasantries** (thank you, greetings)
326
+ - **Testing or experimentation** (trying out a feature)
327
+ - **Common patterns everyone has** (likes clear explanations)
328
+ - **Situational information** (working on feature X today)
329
+ - **Opinions without persistence** (single complaint, isolated praise)
330
+ - **General knowledge** (not specific to user)
331
+
332
+ # Quality Gates (ALL Must Pass)
333
+
334
+ 1. **Significance Test**: Will this matter in 3+ months?
335
+ 2. **Specificity Test**: Is this concrete and actionable?
336
+ 3. **Evidence Test**: Is there strong evidence (3+ instances OR explicit self-identification)?
337
+ 4. **Uniqueness Test**: Is this specific to THIS user (not generic)?
338
+ 5. **Confidence Test**: Confidence must be >= 0.85 (be VERY conservative)
339
+ 6. **Non-Redundancy Test**: Does this add NEW information not in existing memories?
340
+
341
+ # Confidence Scoring (Be Conservative)
342
+
343
+ - **0.95-1.0**: User explicitly stated as core identity/practice AND demonstrated multiple times
344
+ - **0.85-0.94**: User explicitly stated OR consistently demonstrated 5+ times
345
+ - **0.75-0.84**: Strong pattern (3-4 instances) with supporting context
346
+ - **Below 0.75**: DO NOT EXTRACT (insufficient evidence)
347
+
348
+ # Critical Instructions
349
+
350
+ 1. **Default to NOT extracting** - When in doubt, skip it
351
+ 2. **Require overwhelming evidence** - One or two mentions is NOT enough
352
+ 3. **Focus on what's PERSISTENT** - Not what's temporary or situational
353
+ 4. **Verify against existing memories** - Don't duplicate or contradict
354
+ 5. **Maximum 2-3 extractions per run** - Quality over quantity
355
+
356
+ **If there are no qualifying facts (which is common), return no memories entries.**
357
+
358
+ # Response Format
359
+
360
+ memories[0]:
361
+ category: semantic
362
+ content: User is a senior TypeScript developer with 8 years of backend experience
363
+ confidence: 0.95
364
+ memories[1]:
365
+ category: procedural
366
+ content: User follows TDD workflow: writes tests before implementation, runs tests after each change
367
+ confidence: 0.88
368
+ memories[2]:
369
+ category: episodic
370
+ content: User led database migration from MongoDB to PostgreSQL for payment system in Q2 2024
371
+ confidence: 0.92"""
372
+
373
+ MESSAGE_CLASSIFIER_TEMPLATE = """Analyze this user request and classify it for planning purposes:
374
+
375
+ "{{text}}"
376
+
377
+ Classify the request across these dimensions:
378
+
379
+ 1. COMPLEXITY LEVEL:
380
+ - simple: Direct actions that don't require planning
381
+ - medium: Multi-step tasks requiring coordination
382
+ - complex: Strategic initiatives with multiple stakeholders
383
+ - enterprise: Large-scale transformations with full complexity
384
+
385
+ 2. PLANNING TYPE:
386
+ - direct_action: Single action, no planning needed
387
+ - sequential_planning: Multiple steps in sequence
388
+ - strategic_planning: Complex coordination with stakeholders
389
+
390
+ 3. REQUIRED CAPABILITIES:
391
+ - List specific capabilities needed (analysis, communication, project_management, etc.)
392
+
393
+ 4. STAKEHOLDERS:
394
+ - List types of people/groups involved
395
+
396
+ 5. CONSTRAINTS:
397
+ - List limitations or requirements mentioned
398
+
399
+ 6. DEPENDENCIES:
400
+ - List dependencies between tasks or external factors
401
+
402
+ Respond in this exact format:
403
+ COMPLEXITY: [simple|medium|complex|enterprise]
404
+ PLANNING: [direct_action|sequential_planning|strategic_planning]
405
+ CAPABILITIES: [comma-separated list]
406
+ STAKEHOLDERS: [comma-separated list]
407
+ CONSTRAINTS: [comma-separated list]
408
+ DEPENDENCIES: [comma-separated list]
409
+ CONFIDENCE: [0.0-1.0]"""
410
+
411
+ MESSAGE_HANDLER_TEMPLATE = """task: Generate dialog and actions for {{agentName}}.
412
+
413
+ context:
414
+ {{providers}}
186
415
 
187
- Respond using XML format like this:
416
+ rules[11]:
417
+ - think briefly, then respond
418
+ - always include a <thought> field, even for direct replies
419
+ - actions execute in listed order
420
+ - if replying without another grounded state/action query, REPLY goes first
421
+ - use IGNORE or STOP only by themselves
422
+ - include providers only when needed
423
+ - use provider_hints from context when present instead of restating the same rules
424
+ - if an action needs inputs, include them inside that action's <params> block
425
+ - if a required param is unknown, ask for clarification in text
426
+ - for live status questions or remaining-work queries, do not answer from recent conversation alone; call the relevant action/provider to refresh state, and do not pair it with a speculative REPLY that guesses the result
427
+ - when an action will fetch the state and produce the final grounded answer, do not add REPLY just to say "checking", "let me look", or similar filler; use the action alone and leave text empty
428
+ - for LifeOps create requests with a clear defaultable habit or natural window, such as drinking water, stretch breaks during the day, weekday-after-lunch Invisalign checks, or brushing when waking up and before bed, call LIFE instead of asking for exact clock times unless the user explicitly asks for precise scheduling
429
+
430
+ control_actions:
431
+ - STOP means the task is done and the agent should end the run without executing more actions
432
+ - STOP is a terminal control action even if it is not listed in available actions
433
+
434
+ fields[5]{name,meaning}:
435
+ - thought | short plan
436
+ - actions | ordered <action> entries inside <actions>
437
+ - providers | array of provider names, or empty
438
+ - text | next message for {{agentName}}
439
+ - simple | true or false
440
+
441
+ formatting:
442
+ - wrap multi-line code in fenced code blocks
443
+ - use inline backticks for short code identifiers
444
+
445
+ output:
446
+ XML only. Return exactly one <response>...</response> document. No prose before or after it. No <think>.
447
+
448
+ Example:
188
449
  <response>
189
- <thought>Your thought here</thought>
190
- <actions>ACTION1,ACTION2</actions>
191
- <text>Your response text here</text>
192
- <params>
193
- <ACTION1>
194
- <paramName1>value1</paramName1>
195
- <paramName2>value2</paramName2>
196
- </ACTION1>
197
- <ACTION2>
198
- <paramName1>value1</paramName1>
199
- </ACTION2>
200
- </params>
201
- </response>
202
-
203
- The <params> block is optional - only include when actions require input parameters.
204
- If an action has no parameters or you're only using REPLY/IGNORE, omit <params> entirely.
205
-
206
- 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>.
207
- </output>"""
208
-
209
- MULTI_STEP_DECISION_TEMPLATE = """<task>
210
- Determine the next step the assistant should take in this conversation to help the user reach their goal.
211
- </task>
450
+ <thought>Reply briefly. No extra providers needed.</thought>
451
+ <actions>
452
+ <action>
453
+ <name>REPLY</name>
454
+ </action>
455
+ </actions>
456
+ <providers></providers>
457
+ <text>Your message here</text>
458
+ <simple>true</simple>
459
+ </response>"""
460
+
461
+ MULTI_STEP_DECISION_TEMPLATE = """Determine the next step the assistant should take in this conversation to help the user reach their goal.
212
462
 
213
463
  {{recentMessages}}
214
464
 
@@ -234,33 +484,21 @@ These are the actions or data provider calls that have already been used in this
234
484
 
235
485
  {{actionResults}}
236
486
 
237
- <keys>
487
+ keys:
238
488
  "thought" Clearly explain your reasoning for the selected providers and/or action, and how this step contributes to resolving the user's request.
239
489
  "action" Name of the action to execute after providers return (can be empty if no action is needed).
240
490
  "providers" List of provider names to call in this step (can be empty if none are needed).
241
- "params" Optional XML parameters for the selected action. Use nested XML only when the action needs input.
242
491
  "isFinish" Set to true only if the task is fully complete.
243
- </keys>
244
492
 
245
493
  ⚠️ 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.
246
494
 
247
- <output>
248
- <response>
249
- <thought>Your thought here</thought>
250
- <action>ACTION</action>
251
- <providers>PROVIDER1,PROVIDER2</providers>
252
- <params>
253
- <ACTION>
254
- <paramName>value</paramName>
255
- </ACTION>
256
- </params>
257
- <isFinish>true | false</isFinish>
258
- </response>
259
- </output>"""
260
-
261
- MULTI_STEP_SUMMARY_TEMPLATE = """<task>
262
- Summarize what the assistant has done so far and provide a final response to the user based on the completed steps.
263
- </task>
495
+ output:
496
+ thought: Your thought here
497
+ action: ACTION
498
+ providers[2]: PROVIDER1,PROVIDER2
499
+ isFinish: false"""
500
+
501
+ 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.
264
502
 
265
503
  # Context Information
266
504
  {{bio}}
@@ -288,13 +526,10 @@ Here are the actions taken by the assistant to fulfill the request:
288
526
 
289
527
  - Review the execution trace and last reasoning step carefully
290
528
 
291
- - Your final output MUST be in this XML format:
292
- <output>
293
- <response>
294
- <thought>Your thought here</thought>
295
- <text>Your final message to the user</text>
296
- </response>
297
- </output>"""
529
+ - Your final output MUST be TOON in this format:
530
+ output:
531
+ thought: Your thought here
532
+ text: Your final message to the user"""
298
533
 
299
534
  OPTION_EXTRACTION_TEMPLATE = """# Task: Extract selected task and option from user message
300
535
 
@@ -310,40 +545,66 @@ OPTION_EXTRACTION_TEMPLATE = """# Task: Extract selected task and option from us
310
545
  3. Return the task ID (shortened UUID) and selected option name exactly as listed above
311
546
  4. If no clear selection is made, return null for both fields
312
547
 
313
- Do NOT include any thinking, reasoning, or <think> sections in your response.
314
- Go directly to the XML response format without any preamble or explanation.
315
548
 
316
- Return in XML format:
317
- <response>
318
- <taskId>string_or_null</taskId>
319
- <selectedOption>OPTION_NAME_or_null</selectedOption>
320
- </response>
549
+ Return in TOON format:
550
+ taskId: string_or_null
551
+ selectedOption: OPTION_NAME_or_null
552
+
553
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any text, thinking, or reasoning before or after it."""
321
554
 
322
- 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>."""
555
+ POST_ACTION_DECISION_TEMPLATE = """Continue helping the user after reviewing the latest action results.
556
+
557
+ context:
558
+ {{providers}}
559
+
560
+ recent conversation:
561
+ {{recentMessages}}
562
+
563
+ recent action results:
564
+ {{actionResults}}
565
+
566
+ latest reflection task status:
567
+ {{taskCompletionStatus}}
568
+
569
+ rules[10]:
570
+ - think briefly, then continue the task from the latest action results
571
+ - actions execute in listed order
572
+ - if replying, REPLY goes first
573
+ - use IGNORE or STOP only by themselves
574
+ - include providers only when needed
575
+ - use provider_hints from context when present instead of restating the same rules
576
+ - if an action needs inputs, include them under params keyed by action name
577
+ - if a required param is unknown, ask for clarification in text
578
+ - if reflection says the task is incomplete, keep working or explain the concrete follow-up you still need
579
+ - if the task is complete, either reply to the user or use STOP to end the run
580
+ - STOP is a terminal control action even if it is not listed in available actions
581
+
582
+ output:
583
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
584
+
585
+ thought: Your thought here
586
+ actions[1]: ACTION
587
+ providers[0]:
588
+ text: Your message here
589
+ simple: true"""
323
590
 
324
591
  POST_CREATION_TEMPLATE = """# Task: Create a post in the voice and style and perspective of {{agentName}} @{{xUserName}}.
325
592
 
326
593
  Example task outputs:
327
594
  1. A post about the importance of AI in our lives
328
- <response>
329
- <thought>I am thinking about writing a post about the importance of AI in our lives</thought>
330
- <post>AI is changing the world and it is important to understand how it works</post>
331
- <imagePrompt>A futuristic cityscape with flying cars and people using AI to do things</imagePrompt>
332
- </response>
595
+ thought: I am thinking about writing a post about the importance of AI in our lives
596
+ post: AI is changing the world and it is important to understand how it works
597
+ imagePrompt: A futuristic cityscape with flying cars and people using AI to do things
333
598
 
334
599
  2. A post about dogs
335
- <response>
336
- <thought>I am thinking about writing a post about dogs</thought>
337
- <post>Dogs are man's best friend and they are loyal and loving</post>
338
- <imagePrompt>A dog playing with a ball in a park</imagePrompt>
339
- </response>
600
+ thought: I am thinking about writing a post about dogs
601
+ post: Dogs are man's best friend and they are loyal and loving
602
+ imagePrompt: A dog playing with a ball in a park
340
603
 
341
604
  3. A post about finding a new job
342
- <response>
343
- <thought>Getting a job is hard, I bet there's a good post in that</thought>
344
- <post>Just keep going!</post>
345
- <imagePrompt>A person looking at a computer screen with a job search website</imagePrompt>
346
- </response>
605
+ thought: Getting a job is hard, I bet there's a good post in that
606
+ post: Just keep going!
607
+ imagePrompt: A person looking at a computer screen with a job search website
347
608
 
348
609
  {{providers}}
349
610
 
@@ -351,21 +612,17 @@ Write a post that is {{adjective}} about {{topic}} (without mentioning {{topic}}
351
612
  Your response should be 1, 2, or 3 sentences (choose the length at random).
352
613
  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.
353
614
 
354
- Your output should be formatted in XML like this:
355
- <response>
356
- <thought>Your thought here</thought>
357
- <post>Your post text here</post>
358
- <imagePrompt>Optional image prompt here</imagePrompt>
359
- </response>
615
+ Your output should be formatted as TOON like this:
616
+ thought: Your thought here
617
+ post: Your post text here
618
+ imagePrompt: Optional image prompt here
360
619
 
361
620
  The "post" field should be the post you want to send. Do not including any thinking or internal reflection in the "post" field.
362
621
  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.
363
622
  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.
364
623
 
365
- Do NOT include any thinking, reasoning, or <think> sections in your response.
366
- Go directly to the XML response format without any preamble or explanation.
367
624
 
368
- 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>."""
625
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any text, thinking, or reasoning before or after it."""
369
626
 
370
627
  REFLECTION_EVALUATOR_TEMPLATE = """# Task: Generate Agent Reflection, Extract Facts and Relationships
371
628
 
@@ -390,40 +647,49 @@ Message Sender: {{senderName}} (ID: {{senderId}})
390
647
  # Known Facts:
391
648
  {{knownFacts}}
392
649
 
650
+ # Latest Action Results:
651
+ {{actionResults}}
652
+
393
653
  # Instructions:
394
654
  1. Generate a self-reflective thought on the conversation about your performance and interaction quality.
395
- 2. Extract new facts from the conversation.
655
+ 2. Extract only durable new facts from the conversation.
656
+ - Prefer facts about the current user/sender that will still matter in a week: identity, stable preferences, recurring collaborators, durable setup, long-term projects, or ongoing constraints.
657
+ - Do NOT extract temporary status updates, current debugging/work items, one-off session metrics, isolated praise/complaints, or facts that are only true right now.
658
+ - If a fact would feel stale, irrelevant, or surprising to store a week from now, skip it.
659
+ - When in doubt, omit the fact.
396
660
  3. Identify and describe relationships between entities.
397
661
  - The sourceEntityId is the UUID of the entity initiating the interaction.
398
662
  - The targetEntityId is the UUID of the entity being interacted with.
399
663
  - 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.
400
-
401
- Do NOT include any thinking, reasoning, or <think> sections in your response.
402
- Go directly to the XML response format without any preamble or explanation.
403
-
404
- Generate a response in the following format:
405
- <response>
406
- <thought>a self-reflective thought on the conversation</thought>
407
- <facts>
408
- <fact>
409
- <claim>factual statement</claim>
410
- <type>fact|opinion|status</type>
411
- <in_bio>false</in_bio>
412
- <already_known>false</already_known>
413
- </fact>
414
- <!-- Add more facts as needed -->
415
- </facts>
416
- <relationships>
417
- <relationship>
418
- <sourceEntityId>entity_initiating_interaction</sourceEntityId>
419
- <targetEntityId>entity_being_interacted_with</targetEntityId>
420
- <tags>group_interaction,voice_interaction,dm_interaction,additional_tag1,additional_tag2</tags>
421
- </relationship>
422
- <!-- Add more relationships as needed -->
423
- </relationships>
424
- </response>
425
-
426
- 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>."""
664
+ 4. It is normal to return no facts when nothing durable was learned.
665
+ 5. Always decide whether the user's task or request is actually complete right now.
666
+ - Set `task_completed: true` only if the user no longer needs additional action or follow-up from you in this turn.
667
+ - If you asked a clarifying question, an action failed, work is still pending, or you only partially completed the request, set `task_completed: false`.
668
+ 6. Always include a short `task_completion_reason` grounded in the conversation and action results.
669
+
670
+ Output:
671
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
672
+ Do not output JSON, XML, Markdown fences, or commentary.
673
+ Use indexed TOON fields exactly like this:
674
+ thought: "a self-reflective thought on the conversation"
675
+ task_completed: false
676
+ task_completion_reason: "The request is still incomplete because the needed action has not happened yet."
677
+ facts[0]:
678
+ claim: durable factual statement
679
+ type: fact
680
+ in_bio: false
681
+ already_known: false
682
+ relationships[0]:
683
+ sourceEntityId: entity_initiating_interaction
684
+ targetEntityId: entity_being_interacted_with
685
+ tags[0]: dm_interaction
686
+
687
+ For additional entries, increment the index: facts[1], relationships[1], tags[1], etc.
688
+ Always include `task_completed` and `task_completion_reason`.
689
+ If there are no durable new facts, omit all facts[...] entries.
690
+ If there are no relationships, omit all relationships[...] entries.
691
+
692
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any text, thinking, or reasoning before or after it."""
427
693
 
428
694
  REFLECTION_TEMPLATE = """# Task: Reflect on recent agent behavior and interactions.
429
695
 
@@ -439,16 +705,35 @@ Analyze the agent's recent behavior and interactions. Consider:
439
705
  3. Were any mistakes made?
440
706
  4. What could be improved?
441
707
 
442
- Respond using XML format like this:
443
- <response>
444
- <thought>Your detailed analysis</thought>
445
- <quality_score>Score 0-100 for overall quality</quality_score>
446
- <strengths>What went well</strengths>
447
- <improvements>What could be improved</improvements>
448
- <learnings>Key takeaways for future interactions</learnings>
449
- </response>
708
+ Respond using TOON like this:
709
+ thought: Your detailed analysis
710
+ quality_score: Score 0-100 for overall quality
711
+ strengths: What went well
712
+ improvements: What could be improved
713
+ learnings: Key takeaways for future interactions
714
+
715
+ IMPORTANT: Your response must ONLY contain the TOON document above."""
716
+
717
+ REMOVE_CONTACT_TEMPLATE = """task: Extract the contact removal request.
718
+
719
+ context:
720
+ {{providers}}
721
+
722
+ current_message:
723
+ {{message}}
724
+
725
+ instructions[4]:
726
+ - identify the contact name to remove
727
+ - set confirmed to yes only when the user explicitly confirms removal
728
+ - set confirmed to no when confirmation is absent or ambiguous
729
+ - return only the requested contact
730
+
731
+ output:
732
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
450
733
 
451
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
734
+ Example:
735
+ contactName: Jane Doe
736
+ confirmed: yes"""
452
737
 
453
738
  REPLY_TEMPLATE = """# Task: Generate dialog for the character {{agentName}}.
454
739
 
@@ -465,49 +750,279 @@ IMPORTANT CODE BLOCK FORMATTING RULES:
465
750
  - This ensures the user sees clearly formatted and copyable code when relevant.
466
751
 
467
752
  Do NOT include any thinking, reasoning, or <think> sections in your response.
468
- Go directly to the XML response format without any preamble or explanation.
753
+ Go directly to the TOON response format without any preamble or explanation.
469
754
 
470
- Respond using XML format like this:
471
- <response>
472
- <thought>Your thought here</thought>
473
- <text>Your message here</text>
474
- </response>
755
+ Respond using TOON like this:
756
+ thought: Your thought here
757
+ text: Your message here
475
758
 
476
- 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>."""
759
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any text, thinking, or reasoning before or after it."""
477
760
 
478
- SHOULD_RESPOND_TEMPLATE = """<task>Decide on behalf of {{agentName}} whether they should respond to the message, ignore it or stop the conversation.</task>
761
+ SCHEDULE_FOLLOW_UP_TEMPLATE = """task: Extract follow-up scheduling information from the request.
479
762
 
480
- <providers>
763
+ context:
481
764
  {{providers}}
482
- </providers>
483
765
 
484
- <instructions>Decide if {{agentName}} should respond to or interact with the conversation.
766
+ current_message:
767
+ {{message}}
485
768
 
486
- IMPORTANT RULES FOR RESPONDING:
487
- - If YOUR name ({{agentName}}) is directly mentioned → RESPOND
488
- - If someone uses a DIFFERENT name (not {{agentName}}) → IGNORE (they're talking to someone else)
489
- - If you're actively participating in a conversation and the message continues that thread → RESPOND
490
- - If someone tells you to stop or be quiet → STOP
491
- - Otherwise → IGNORE
769
+ current_datetime:
770
+ {{currentDateTime}}
492
771
 
493
- The key distinction is:
494
- - "Talking TO {{agentName}}" (your name mentioned, replies to you, continuing your conversation) → RESPOND
495
- - "Talking ABOUT {{agentName}}" or to someone else → IGNORE
496
- </instructions>
772
+ instructions[5]:
773
+ - identify who to follow up with
774
+ - include entityId only when it is explicitly known
775
+ - convert requested timing into an ISO datetime in scheduledAt
776
+ - normalize priority to high, medium, or low
777
+ - include message only when the user asked for a specific note or reminder text
497
778
 
498
- <output>
499
- Do NOT include any thinking, reasoning, or <think> sections in your response.
500
- Go directly to the XML response format without any preamble or explanation.
779
+ output:
780
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
501
781
 
502
- Respond using XML format like this:
503
- <response>
504
- <name>{{agentName}}</name>
505
- <reasoning>Your reasoning here</reasoning>
506
- <action>RESPOND | IGNORE | STOP</action>
507
- </response>
782
+ Example:
783
+ contactName: Jane Doe
784
+ entityId:
785
+ scheduledAt: 2026-04-06T14:00:00.000Z
786
+ reason: Check in on the proposal
787
+ priority: medium
788
+ message: Send the latest deck before the call"""
789
+
790
+ SEARCH_CONTACTS_TEMPLATE = """task: Extract contact search criteria from the request.
791
+
792
+ context:
793
+ {{providers}}
794
+
795
+ current_message:
796
+ {{message}}
797
+
798
+ instructions[5]:
799
+ - return categories as a comma-separated list when the user filters by category
800
+ - return tags as a comma-separated list when the user filters by tags
801
+ - return searchTerm for any name or free-text lookup
802
+ - set intent to count when the user only wants a count, otherwise list
803
+ - omit fields that are not clearly requested
804
+
805
+ output:
806
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
807
+
808
+ Example:
809
+ categories: vip,colleague
810
+ searchTerm: Jane
811
+ tags: ai,design
812
+ intent: list"""
813
+
814
+ SHOULD_FOLLOW_ROOM_TEMPLATE = """task: Decide whether {{agentName}} should follow this room.
815
+
816
+ context:
817
+ {{providers}}
818
+
819
+ current_message:
820
+ {{message}}
821
+
822
+ instructions[3]:
823
+ - return true only when the user is clearly asking {{agentName}} to follow, join, listen to, or stay engaged in this room
824
+ - return false when the request is ambiguous or unrelated
825
+ - prefer false when uncertain
826
+
827
+ output:
828
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
829
+
830
+ Example:
831
+ decision: true"""
832
+
833
+ SHOULD_MUTE_ROOM_TEMPLATE = """task: Decide whether {{agentName}} should mute this room.
834
+
835
+ context:
836
+ {{providers}}
837
+
838
+ current_message:
839
+ {{message}}
840
+
841
+ instructions[3]:
842
+ - return true only when the user is clearly asking {{agentName}} to mute, silence, or ignore this room
843
+ - return false when the request is ambiguous or unrelated
844
+ - prefer false when uncertain
845
+
846
+ output:
847
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
848
+
849
+ Example:
850
+ decision: true"""
851
+
852
+ SHOULD_RESPOND_TEMPLATE = """task: Decide whether {{agentName}} should respond, ignore, or stop.
853
+
854
+ context:
855
+ {{providers}}
856
+
857
+ rules[6]:
858
+ - direct mention of {{agentName}} -> RESPOND
859
+ - different assistant name or talking to someone else -> IGNORE unless {{agentName}} is also directly addressed
860
+ - prior participation by {{agentName}} in the thread is not enough by itself; the newest message must still clearly expect {{agentName}} -> otherwise IGNORE
861
+ - request to stop or be quiet directed at {{agentName}} -> STOP
862
+ - if multiple people are mentioned and {{agentName}} is one of the addressees -> RESPOND
863
+ - if unsure whether the speaker is talking to {{agentName}}, prefer IGNORE over hallucinating relevance
864
+
865
+ available_contexts:
866
+ {{availableContexts}}
867
+
868
+ context_routing:
869
+ - primaryContext: choose one context from available_contexts, or "general" if none apply
870
+ - secondaryContexts: optional comma-separated list of additional relevant contexts
871
+ - evidenceTurnIds: optional comma-separated list of message IDs supporting the decision
872
+
873
+ decision_note:
874
+ - respond only when the latest message is talking TO {{agentName}}
875
+ - talking TO {{agentName}} means name mention, reply chain, or a clear follow-up that still expects {{agentName}} to answer
876
+ - mentions of other people do not cancel a direct address to {{agentName}}
877
+ - casual conversation between other users is not enough
878
+ - if another assistant already answered and nobody re-addressed {{agentName}}, IGNORE
879
+ - if {{agentName}} already replied recently and nobody re-addressed {{agentName}}, IGNORE
880
+ - talking ABOUT {{agentName}} or continuing a room conversation around them is not enough
881
+
882
+ output:
883
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
884
+
885
+ Example:
886
+ name: {{agentName}}
887
+ reasoning: Direct mention and clear follow-up.
888
+ action: RESPOND
889
+ primaryContext: general
890
+ secondaryContexts:
891
+ evidenceTurnIds:"""
892
+
893
+ SHOULD_RESPOND_WITH_CONTEXT_TEMPLATE = """task: Decide whether {{agentName}} should respond and which domain context applies.
894
+
895
+ context:
896
+ {{providers}}
897
+
898
+ available_contexts:
899
+ {{availableContexts}}
900
+
901
+ rules[6]:
902
+ - direct mention of {{agentName}} -> RESPOND
903
+ - different assistant name or talking to someone else -> IGNORE unless {{agentName}} is also directly addressed
904
+ - prior participation by {{agentName}} in the thread is not enough by itself; the newest message must still clearly expect {{agentName}} -> otherwise IGNORE
905
+ - request to stop or be quiet directed at {{agentName}} -> STOP
906
+ - if multiple people are mentioned and {{agentName}} is one of the addressees -> RESPOND
907
+ - if unsure whether the speaker is talking to {{agentName}}, prefer IGNORE over hallucinating relevance
908
+
909
+ context_routing:
910
+ - primaryContext: the single best-matching domain from available_contexts
911
+ - secondaryContexts: zero or more additional domains that are relevant
912
+ - action intent does not only come from the last message; consider the full recent conversation
913
+ - if no specific domain applies, use "general"
914
+
915
+ decision_note:
916
+ - respond only when the latest message is talking TO {{agentName}}
917
+ - talking TO {{agentName}} means name mention, reply chain, or a clear follow-up that still expects {{agentName}} to answer
918
+ - mentions of other people do not cancel a direct address to {{agentName}}
919
+ - casual conversation between other users is not enough
920
+ - if another assistant already answered and nobody re-addressed {{agentName}}, IGNORE
921
+ - if {{agentName}} already replied recently and nobody re-addressed {{agentName}}, IGNORE
922
+ - talking ABOUT {{agentName}} or continuing a room conversation around them is not enough
923
+ - context routing always applies, even for IGNORE/STOP decisions
924
+
925
+ output:
926
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
927
+
928
+ Example:
929
+ name: {{agentName}}
930
+ reasoning: Direct mention asking about token balance.
931
+ action: RESPOND
932
+ primaryContext: wallet
933
+ secondaryContexts: []"""
934
+
935
+ SHOULD_UNFOLLOW_ROOM_TEMPLATE = """task: Decide whether {{agentName}} should unfollow this room.
936
+
937
+ context:
938
+ {{providers}}
939
+
940
+ current_message:
941
+ {{message}}
942
+
943
+ instructions[3]:
944
+ - return true only when the user is clearly asking {{agentName}} to stop following or leave this room
945
+ - return false when the request is ambiguous or unrelated
946
+ - prefer false when uncertain
947
+
948
+ output:
949
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
950
+
951
+ Example:
952
+ decision: true"""
953
+
954
+ SHOULD_UNMUTE_ROOM_TEMPLATE = """task: Decide whether {{agentName}} should unmute this room.
955
+
956
+ context:
957
+ {{providers}}
508
958
 
509
- 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>.
510
- </output>"""
959
+ current_message:
960
+ {{message}}
961
+
962
+ instructions[3]:
963
+ - return true only when the user is clearly asking {{agentName}} to unmute or resume listening to this room
964
+ - return false when the request is ambiguous or unrelated
965
+ - prefer false when uncertain
966
+
967
+ output:
968
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
969
+
970
+ Example:
971
+ decision: true"""
972
+
973
+ THINK_TEMPLATE = """# Task: Think deeply and reason carefully for {{agentName}}.
974
+
975
+ {{providers}}
976
+
977
+ # Context
978
+ The initial planning phase identified this question as requiring deeper analysis.
979
+ The following is the conversation so far and all available context.
980
+
981
+ # Instructions
982
+ You are {{agentName}}. A question or request has been identified as complex, ambiguous, or requiring careful reasoning. Your job is to think through this thoroughly before responding.
983
+
984
+ Approach this systematically:
985
+ 1. Identify the core question or problem being asked
986
+ 2. Consider multiple angles, approaches, or interpretations
987
+ 3. Evaluate trade-offs, risks, and constraints
988
+ 4. Draw on relevant knowledge and context from the conversation
989
+ 5. Arrive at a well-reasoned conclusion or recommendation
990
+
991
+ Be thorough but concise. Prioritize depth of reasoning over length. If there are genuine unknowns, acknowledge them rather than guessing.
992
+
993
+ Respond using TOON:
994
+ thought: Your detailed internal reasoning — the full chain of thought, alternatives considered, and why you reached your conclusion
995
+ text: Your response to the user — clear, structured, and well-reasoned. Use headings, lists, or code blocks as appropriate for the content.
996
+
997
+ IMPORTANT: Your response must ONLY contain the TOON document above. Do not include any preamble or explanation outside of it."""
998
+
999
+ UPDATE_CONTACT_TEMPLATE = """task: Extract contact updates from the request.
1000
+
1001
+ context:
1002
+ {{providers}}
1003
+
1004
+ current_message:
1005
+ {{message}}
1006
+
1007
+ instructions[6]:
1008
+ - identify the contact name to update
1009
+ - set operation to replace unless the user clearly says to add_to or remove_from
1010
+ - return categories and tags as comma-separated lists
1011
+ - return preferences and customFields as comma-separated key:value pairs
1012
+ - include notes only when explicitly requested
1013
+ - omit fields that are not being changed
1014
+
1015
+ output:
1016
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
1017
+
1018
+ Example:
1019
+ contactName: Jane Doe
1020
+ operation: add_to
1021
+ categories: vip
1022
+ tags: ai,friend
1023
+ preferences: timezone:America/New_York,language:English
1024
+ customFields: company:Acme,title:Designer
1025
+ notes: Prefers async communication"""
511
1026
 
512
1027
  UPDATE_ENTITY_TEMPLATE = """# Task: Update entity information.
513
1028
 
@@ -520,19 +1035,43 @@ UPDATE_ENTITY_TEMPLATE = """# Task: Update entity information.
520
1035
  Based on the request, determine what information about the entity should be updated.
521
1036
  Only update fields that the user has explicitly requested to change.
522
1037
 
523
- Respond using XML format like this:
524
- <response>
525
- <thought>Your reasoning for the entity update</thought>
526
- <entity_id>The entity ID to update</entity_id>
527
- <updates>
528
- <field>
529
- <name>field_name</name>
530
- <value>new_value</value>
531
- </field>
532
- </updates>
533
- </response>
534
-
535
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
1038
+ Respond using TOON like this:
1039
+ thought: Your reasoning for the entity update
1040
+ entity_id: The entity ID to update
1041
+ updates[1]{name,value}:
1042
+ field_name,new_value
1043
+
1044
+ IMPORTANT: Your response must ONLY contain the TOON document above."""
1045
+
1046
+ UPDATE_ROLE_TEMPLATE = """task: Extract the requested role change.
1047
+
1048
+ context:
1049
+ {{providers}}
1050
+
1051
+ current_roles:
1052
+ {{roles}}
1053
+
1054
+ recent_messages:
1055
+ {{recentMessages}}
1056
+
1057
+ current_message:
1058
+ {{message}}
1059
+
1060
+ instructions[6]:
1061
+ - identify the single entity whose role should be updated
1062
+ - return entity_id only when the UUID is explicit in context
1063
+ - normalize new_role to one of OWNER, ADMIN, MEMBER, GUEST, or NONE
1064
+ - if the user is removing elevated access without naming a new role, use NONE
1065
+ - do not invent entity ids or roles
1066
+ - include a short thought describing the change
1067
+
1068
+ output:
1069
+ TOON only. Return exactly one TOON document. No prose before or after it. No <think>.
1070
+
1071
+ Example:
1072
+ thought: Sarah should become an admin.
1073
+ entity_id: 00000000-0000-0000-0000-000000000000
1074
+ new_role: ADMIN"""
536
1075
 
537
1076
  UPDATE_SETTINGS_TEMPLATE = """# Task: Update settings based on the request.
538
1077
 
@@ -545,39 +1084,84 @@ UPDATE_SETTINGS_TEMPLATE = """# Task: Update settings based on the request.
545
1084
  Based on the request, determine which settings to update.
546
1085
  Only update settings that the user has explicitly requested.
547
1086
 
548
- Respond using XML format like this:
549
- <response>
550
- <thought>Your reasoning for the settings changes</thought>
551
- <updates>
552
- <update>
553
- <key>setting_key</key>
554
- <value>new_value</value>
555
- </update>
556
- </updates>
557
- </response>
1087
+ Respond using TOON like this:
1088
+ thought: Your reasoning for the settings changes
1089
+ updates[1]{key,value}:
1090
+ setting_key,new_value
1091
+
1092
+ IMPORTANT: Your response must ONLY contain the TOON document above."""
1093
+
1094
+ UPDATE_SUMMARIZATION_TEMPLATE = """# Task: Update and Condense Conversation Summary
1095
+
1096
+ You are updating an existing conversation summary with new messages, while keeping the total summary concise.
558
1097
 
559
- IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
1098
+ # Existing Summary
1099
+ {{existingSummary}}
1100
+
1101
+ # Existing Topics
1102
+ {{existingTopics}}
1103
+
1104
+ # New Messages Since Last Summary
1105
+ {{newMessages}}
1106
+
1107
+ # Instructions
1108
+ Update the summary by:
1109
+ 1. Merging the existing summary with insights from the new messages
1110
+ 2. Removing redundant or less important details to stay under the token limit
1111
+ 3. Keeping the most important context and decisions
1112
+ 4. Adding new topics if they emerge
1113
+ 5. **CRITICAL**: Keep the ENTIRE updated summary under 2500 tokens
1114
+
1115
+ The goal is a rolling summary that captures the essence of the conversation without growing indefinitely.
1116
+
1117
+ Respond in TOON:
1118
+ text: Your updated and condensed summary here
1119
+ topics[0]: topic1
1120
+ topics[1]: topic2
1121
+ topics[2]: topic3
1122
+ keyPoints[0]: First key point
1123
+ keyPoints[1]: Second key point"""
560
1124
 
561
1125
  BOOLEAN_FOOTER = "Respond with only a YES or a NO."
562
1126
 
563
1127
  __all__ = [
1128
+ "ADD_CONTACT_TEMPLATE",
564
1129
  "AUTONOMY_CONTINUOUS_CONTINUE_TEMPLATE",
565
1130
  "AUTONOMY_CONTINUOUS_FIRST_TEMPLATE",
566
1131
  "AUTONOMY_TASK_CONTINUE_TEMPLATE",
567
1132
  "AUTONOMY_TASK_FIRST_TEMPLATE",
568
1133
  "CHOOSE_OPTION_TEMPLATE",
1134
+ "EXTRACT_SECRET_OPERATION_TEMPLATE",
1135
+ "EXTRACT_SECRET_REQUEST_TEMPLATE",
1136
+ "EXTRACT_SECRETS_TEMPLATE",
569
1137
  "IMAGE_DESCRIPTION_TEMPLATE",
570
1138
  "IMAGE_GENERATION_TEMPLATE",
1139
+ "INITIAL_SUMMARIZATION_TEMPLATE",
1140
+ "LONG_TERM_EXTRACTION_TEMPLATE",
1141
+ "MESSAGE_CLASSIFIER_TEMPLATE",
571
1142
  "MESSAGE_HANDLER_TEMPLATE",
572
1143
  "MULTI_STEP_DECISION_TEMPLATE",
573
1144
  "MULTI_STEP_SUMMARY_TEMPLATE",
574
1145
  "OPTION_EXTRACTION_TEMPLATE",
1146
+ "POST_ACTION_DECISION_TEMPLATE",
575
1147
  "POST_CREATION_TEMPLATE",
576
1148
  "REFLECTION_EVALUATOR_TEMPLATE",
577
1149
  "REFLECTION_TEMPLATE",
1150
+ "REMOVE_CONTACT_TEMPLATE",
578
1151
  "REPLY_TEMPLATE",
1152
+ "SCHEDULE_FOLLOW_UP_TEMPLATE",
1153
+ "SEARCH_CONTACTS_TEMPLATE",
1154
+ "SHOULD_FOLLOW_ROOM_TEMPLATE",
1155
+ "SHOULD_MUTE_ROOM_TEMPLATE",
579
1156
  "SHOULD_RESPOND_TEMPLATE",
1157
+ "SHOULD_RESPOND_WITH_CONTEXT_TEMPLATE",
1158
+ "SHOULD_UNFOLLOW_ROOM_TEMPLATE",
1159
+ "SHOULD_UNMUTE_ROOM_TEMPLATE",
1160
+ "THINK_TEMPLATE",
1161
+ "UPDATE_CONTACT_TEMPLATE",
580
1162
  "UPDATE_ENTITY_TEMPLATE",
1163
+ "UPDATE_ROLE_TEMPLATE",
581
1164
  "UPDATE_SETTINGS_TEMPLATE",
1165
+ "UPDATE_SUMMARIZATION_TEMPLATE",
582
1166
  "BOOLEAN_FOOTER",
583
1167
  ]