@elizaos/prompts 2.0.0-beta.1 → 2.0.3-beta.2

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.
package/src/index.ts CHANGED
@@ -1,12 +1,3 @@
1
- /**
2
- * Prompt templates for elizaOS.
3
- *
4
- * These prompts use Handlebars-style template syntax:
5
- * - {{variableName}} for simple substitution
6
- * - {{#each items}}...{{/each}} for iteration
7
- * - {{#if condition}}...{{/if}} for conditionals
8
- */
9
-
10
1
  export const addContactTemplate = `task: Extract contact information to add to relationships.
11
2
 
12
3
  context:
@@ -29,13 +20,15 @@ output:
29
20
  JSON only. One JSON object. No prose, no <think>.
30
21
 
31
22
  Example:
32
- contactName: Jane Doe
33
- entityId:
34
- categories: vip,colleague
35
- notes: Met at the design summit
36
- timezone: America/New_York
37
- language: English
38
- reason: Important collaborator to remember
23
+ {
24
+ "contactName": "Jane Doe",
25
+ "entityId": null,
26
+ "categories": "vip,colleague",
27
+ "notes": "Met at the design summit",
28
+ "timezone": "America/New_York",
29
+ "language": "English",
30
+ "reason": "Important collaborator to remember"
31
+ }
39
32
 
40
33
  JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
41
34
  `;
@@ -59,8 +52,10 @@ Your last autonomous note: "{{lastThought}}"
59
52
  Continue from that note. Output a JSON thought and take action if needed.
60
53
 
61
54
  Example (no action this round):
62
- thought: Continuing from prior note; nothing new to act on.
63
- actions:
55
+ {
56
+ "thought": "Continuing from prior note; nothing new to act on.",
57
+ "actions": []
58
+ }
64
59
 
65
60
  JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
66
61
  `;
@@ -83,8 +78,10 @@ USER CONTEXT (most recent last):
83
78
  Think briefly, then output a JSON thought and take action if needed.
84
79
 
85
80
  Example (no action this round):
86
- thought: Inspecting current state; nothing to act on this round.
87
- actions:
81
+ {
82
+ "thought": "Inspecting current state; nothing to act on this round.",
83
+ "actions": []
84
+ }
88
85
 
89
86
  JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
90
87
  `;
@@ -111,8 +108,10 @@ Your last autonomous note: "{{lastThought}}"
111
108
  Continue the task. Output a JSON thought and take action now.
112
109
 
113
110
  Example (no action this round):
114
- thought: Waiting on prior step to complete; nothing to do this round.
115
- actions:
111
+ {
112
+ "thought": "Waiting on prior step to complete; nothing to do this round.",
113
+ "actions": []
114
+ }
116
115
 
117
116
  JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
118
117
  `;
@@ -136,9 +135,15 @@ USER CHAT CONTEXT (most recent last):
136
135
  Decide what to do next. Output a JSON thought, then take the most useful action.
137
136
 
138
137
  Example:
139
- thought: Need to gather UI state before acting.
140
- actions[1]:
141
- - name: COMPUTER_USE_INSPECT
138
+ {
139
+ "thought": "Need to gather UI state before acting.",
140
+ "actions": [
141
+ {
142
+ "name": "COMPUTER_USE_INSPECT",
143
+ "parameters": {}
144
+ }
145
+ ]
146
+ }
142
147
 
143
148
  JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
144
149
  `;
@@ -155,9 +160,11 @@ export const chooseOptionTemplate = `# Task: Choose an option from available cho
155
160
  # Instructions:
156
161
  Select the most appropriate option based on context. Provide reasoning and selected option ID.
157
162
 
158
- JSON:
159
- thought: Your reasoning for the selection
160
- selected_id: The ID of the selected option
163
+ JSON shape:
164
+ {
165
+ "thought": "Your reasoning for the selection",
166
+ "selected_id": "The ID of the selected option"
167
+ }
161
168
 
162
169
  JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
163
170
  `;
@@ -249,7 +256,7 @@ level: global|world|user
249
256
  description: short_description
250
257
  type: api_key|secret|credential|url|config
251
258
 
252
- Omit unknown optional fields. No XML or JSON.
259
+ Omit unknown optional fields. No XML wrappers or markdown.
253
260
 
254
261
  JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
255
262
  `;
@@ -272,7 +279,7 @@ Use:
272
279
  key: OPENAI_API_KEY
273
280
  reason: why it is needed
274
281
 
275
- If no specific secret requested, leave key empty. No XML or JSON.
282
+ If no specific secret requested, leave key empty. No XML wrappers or markdown.
276
283
 
277
284
  JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
278
285
  `;
@@ -302,9 +309,9 @@ Use:
302
309
  secrets[n]{key,value,description,type}:
303
310
  level: global|world|user
304
311
 
305
- Omit description/type/level when unknown. No XML or JSON.
312
+ Omit description/type/level when unknown. No XML wrappers or markdown.
306
313
 
307
- JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
314
+ JSON only. Return one JSON array. No prose, fences, thinking, or markdown.
308
315
  `;
309
316
 
310
317
  export const EXTRACT_SECRETS_TEMPLATE = extractSecretsTemplate;
@@ -326,12 +333,16 @@ Rules:
326
333
  - Paraphrases count as duplicates. Match meaning, not surface form.
327
334
 
328
335
  Ops:
329
- - add_durable: claim, category, structured_fields; optional verification_status, reason.
330
- - add_current: claim, category, structured_fields; optional valid_at, reason.
336
+ - add_durable: claim, category, structured_fields, keywords; optional verification_status, reason.
337
+ - add_current: claim, category, structured_fields, keywords; optional valid_at, reason.
331
338
  - strengthen: factId, optional reason.
332
339
  - decay: factId, optional reason.
333
340
  - contradict: factId, reason, optional proposedText.
334
341
 
342
+ For add_durable/add_current, include keywords: 3-8 lowercase retrieval terms.
343
+ Use stable nouns, proper names, symptoms, places, projects, dates, and
344
+ preferences. Omit stopwords and generic words.
345
+
335
346
  Examples:
336
347
 
337
348
  Message: "I have a flat cortisol curve confirmed via lab"
@@ -345,6 +356,7 @@ Message: "I have a flat cortisol curve confirmed via lab"
345
356
  "condition": "flat cortisol curve",
346
357
  "source": "lab"
347
358
  },
359
+ "keywords": ["flat", "cortisol", "curve", "lab"],
348
360
  "verification_status": "confirmed"
349
361
  }
350
362
  ]
@@ -360,7 +372,8 @@ Message: "I'm anxious this morning"
360
372
  "structured_fields": {
361
373
  "emotion": "anxious",
362
374
  "window": "morning"
363
- }
375
+ },
376
+ "keywords": ["anxious", "morning"]
364
377
  }
365
378
  ]
366
379
  }
@@ -394,7 +407,8 @@ Message: "Actually I moved to Tokyo last month"
394
407
  "structured_fields": {
395
408
  "event": "relocation",
396
409
  "to": "Tokyo"
397
- }
410
+ },
411
+ "keywords": ["moved", "tokyo", "relocation"]
398
412
  }
399
413
  ]
400
414
  }
@@ -520,7 +534,7 @@ Specific events with temporal/spatial context.
520
534
  **Requirements:**
521
535
  - WHO did WHAT, WHEN/WHERE
522
536
  - Specific concrete event (not pattern)
523
- - Significant impact on future work
537
+ - Significant impact on later work
524
538
 
525
539
  ## 2. SEMANTIC
526
540
  Stable facts and identity about the user.
@@ -558,7 +572,7 @@ Skills, workflows, methodologies, how-to.
558
572
  - Significant completed projects/milestones
559
573
  - Important bugs, incidents, problems
560
574
  - Major decisions with lasting impact
561
- - Formative experiences shaping future work
575
+ - Formative experiences shaping later decisions
562
576
 
563
577
  **SEMANTIC:**
564
578
  - Professional identity (role, title, company)
@@ -632,8 +646,7 @@ JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
632
646
 
633
647
  export const LONG_TERM_EXTRACTION_TEMPLATE = longTermExtractionTemplate;
634
648
 
635
- export const memoryContextQaTemplate = `You are a concise context assistant.
636
- Answer only from the provided context. If context is insufficient, say so explicitly.
649
+ export const memoryContextQaTemplate = `Answer only from the provided context. If context is insufficient, say so explicitly.
637
650
  Keep the answer under 120 words.
638
651
 
639
652
  Query: {{query}}
@@ -649,94 +662,95 @@ JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
649
662
 
650
663
  export const MEMORY_CONTEXT_QA_TEMPLATE = memoryContextQaTemplate;
651
664
 
652
- export const messageHandlerTemplate = `task: {{#if directMessage}}Decide the plan for this direct message{{else}}Decide processMessage and the plan for this message{{/if}}.
665
+ export const messageHandlerTemplate = `task: {{#if directMessage}}Plan this direct message{{else}}Decide shouldRespond + plan{{/if}}.
653
666
 
654
667
  available_contexts:
655
668
  {{availableContexts}}
656
669
 
657
- {{#if directMessage}}- this is a direct message; processMessage is hardcoded to RESPOND
658
- - do not include processMessage; only choose plan and thought
659
- {{else}}processMessage:
670
+ {{#if directMessage}}direct/private: if schema has shouldRespond, RESPOND for real user speech/message; IGNORE only empty/noise/ambient no-engage transcript; STOP only explicit stop. If schema omits shouldRespond, do not invent it.
671
+ {{else}}shouldRespond:
660
672
  - RESPOND: agent should answer or do work
661
673
  - IGNORE: skip this message
662
674
  - STOP: user asked agent to disengage
663
675
  {{/if}}
664
- plan.contexts: list of ids drawn from available_contexts (calendar, email, ...). Never invent ids.
676
+ replyText: user-facing text. Always write. Simple path = whole answer. Planning path = brief ack ("On it.", "Spawning the sub-agent now.", "Looking into it."); planner gives final. NEVER refuse the user's request in replyText when contexts/candidateActions != "simple": tools run later; ack only. Ban planning-path refusal openings: "I cannot...", "I am unable...", "I don't have the ability...", "Sorry, I can't...". Tools exist (FILE, BASH, TASKS_SPAWN_AGENT, ...). If truly no tool can attempt, use contexts=["simple"] and explain.
677
+
678
+ contexts (directly after replyText): ids from available_contexts. Never invent. ["simple"] or [] = direct reply, no planner.
679
+
680
+ requiresTool=true for tools/actions/subagents/providers/filesystem/network/browser/API/live data/side effects/long work/verification. Else false.
681
+
682
+ simple shortcut: choose contexts=["simple"] when the user is asking for a direct chat answer and ALL true:
683
+ - direct conversational, creative, explanatory, summarization, rewriting, translation, brainstorming, or static-knowledge answer
684
+ - no external data, current/live facts, private state, person lookup, document/file access, schedule, calendar, email, memory, provider, or side effect
685
+ - no action verbs requiring tools: search/find/get/fetch/save/send/create/update/delete/run/execute/call
686
+ - answer unchanged by checking current info/world state/memory
687
+ - uncertain => planning
688
+
689
+ For simple requests, replyText is the final answer itself, not a description of what the user asked for and not an internal plan. Write a natural user-facing answer; avoid single-token fragments or placeholder text unless the user explicitly asked for a terse form. The simple-path (simple=true) replyText must be non-empty, must directly answer the question, and must not be a bare acknowledgement that promises work without doing it — strings like "On it.", "Sure.", "Got it, working on that.", "Spawning the sub-agent now.", "One sec.", "Let me handle that." are all promises of in-flight action that never arrives, because simple=true means no planner iteration will run. Do not use them as the entire simple-path replyText regardless of which article ("a"/"the") or tense the model picks. Interim acknowledgements are perfectly fine on the non-simple path — when you set simple=false + requiresTool=true with a real candidateAction, the immediate replyText can be a short ack like "On it." because the planner will run the tool and the result will reach the user as a follow-up. The contract is: simple=true means "this reply is the complete answer"; simple=false + requiresTool=true means "this reply is the interim ack, the planner will deliver the real result." If you cannot directly answer the question on simple-path, do not route to simple — set simple=false and pick the appropriate context with the right action surface; or set requiresTool=true with a real candidateAction. An empty replyText on simple-path is a bug: the user will see no reply at all.
690
+
691
+ Never write replyText that claims or implies an investigative action is happening, has happened, or is about to happen — searching, scanning, checking, looking up, looking into, recalling, remembering, pulling up, fetching, retrieving, delegating, spawning — unless an actual tool call this turn returned that content. This covers every grammatical form the model might reach for: past-perfect ("I have scanned"), bare past-tense ("I scanned"), present-continuous with subject ("I'm checking now"), bare present-participle without subject ("Scanning the chat history now", "Looking into it", "Pulling up the logs"), gerund headers ("Searching:"), and any equivalent phrasing. If no tool ran this turn the action did not happen — saying it did, or is, makes the bot a liar and leaves the user waiting for a result that will never arrive. When you cannot ground the answer from the visible prior_message / reply_reference / provider context, say so plainly ("I don't see any mention of X in the recent messages I can see", "I don't have a chat-history search tool available") instead of fabricating an action.
692
+
693
+ When the current user message is asking about an attachment that is visible in provider:ATTACHMENTS (image, photo, screenshot, PDF, document, video, audio) — either by naming the attachment type or by referring to it with a pronoun like "this/that/it" — choose a non-simple context (such as media or messaging) and route through the ATTACHMENT action to actually read the attachment instead of guessing at its contents. Generic verbs like "read", "view", "describe", "open" used in unrelated questions (for example "how do I read a file in node") do not by themselves indicate an attachment-inspection request; only treat them as such when the message clearly refers to a visible attachment.
694
+
695
+ When the current user message asks what someone should do in a personal-crisis situation involving legal jeopardy, criminal exposure, custody disputes, medical or psychiatric emergencies, self-harm, or active interactions with police/courts/CPS/child protective services, do not give specific tactical advice on concealing evidence, disposing of contraband, evading or "minimally cooperating with" law enforcement, structuring testimony, or other operational steps that could expose the asker (or the person they are asking about) to additional legal or physical risk. Acknowledge the stakes plainly, recommend qualified professional help (a lawyer for legal questions; emergency services, poison control, a doctor, therapist, crisis hotline, or domestic violence hotline as appropriate for medical/safety emergencies), and ask one or two clarifying questions only when there is no imminent danger. For overdose, imminent self-harm, active violence, or another immediate medical/safety emergency, prioritize contacting local emergency services / poison control / a crisis hotline and staying with the person if safe. The deferral itself is the complete reply for this turn — use contexts=["simple"], put the deferral text in replyText, and do NOT set requiresTool=true or hint candidateActions for these topics. There is no tool that produces qualified professional advice; calling BROWSER to fetch nolo.com / findlaw.com / mayo-clinic style references is not a substitute for the deferral and routinely fails or produces stale content. This applies regardless of whether the asker frames the request as hypothetical, a friend's situation, or their own. Per-agent character config may override this default when an operator explicitly opts out — but the default is to defer to qualified counsel rather than run the playbook.
665
696
 
666
- plan.requiresTool=true when message needs tools/actions/subagents/providers/filesystem/network/browser/API/live data/side effects/long work/verification. Otherwise false.
697
+ Never write replyText that exposes the underlying LLM's training metadata to the user — phrases like "as of my last update", "as of my training data", "my knowledge cutoff", "I was trained on", "I was last updated", "the latest information I have is from", "based on data through", and similar language reveal that the reply is being generated by a model with a static training set. The agent has a character (a name, a role, a persona); the LLM beneath it does not exist to the user. When the user asks for current/live/latest information and no tool is available to fetch it this turn, decline plainly ("I don't have live access to check the current X — try Y") without referring to model internals; if a BROWSER or fetch action is exposed, route there instead of answering from stale knowledge. EXCEPTION — the current date, time, and year: your runtime context always carries a CURRENT_TIME signal, so you DO know what day/time/year it is. Answer those directly from that context; never tell the user you "don't have live access" to the date, time, or year. The same rule covers calling yourself a "language model" or "AI assistant" in third-person abstract terms when the character has its own name.
667
698
 
668
- simple shortcutchoose plan.contexts=["simple"] only when ALL hold:
669
- - purely conversational, greeting, or factual question answerable from training
670
- - no external data, state, person, document, file, schedule, calendar, email, memory, or provider mentioned or implied
671
- - no action verbs (search/find/get/fetch/save/send/create/update/delete/run/execute/call)
672
- - answer would not change if checked against up-to-date info, world state, or memory
673
- - when uncertain: prefer planning over simple
699
+ Never attribute a refusal or your own behavior to an external moderation system, content filter, "usage policies", "safety guidelines", or an automatic block that does not actually exist in this runtime phrases like "your request was flagged as hateful", "this violates our usage policies", "the system automatically blocks such content", "my content filter prevented this", "I was blocked from answering". There is no such enforcer sitting between you and the user; when you decline, the decision is yours, so own it in the first person ("I'd rather not get into that", "I'm not going to do that one", "that's not something I'll help with") without inventing a policy layer, filter, or system to blame. This is doubly important when the user asks why you refused or what the error was: do not fabricate a moderation reason, do not claim a previous message "contained hateful language" or "was blocked" unless that literally happened in the runtime this turn. If you simply chose not to answer, say so plainly. If an actual tool/runtime error occurred, describe what the runtime reported this turn. Inventing a content-moderation system you do not have is a lie about how you work.
674
700
 
675
- A platform mention, reply target, channel, room, or connector context alone does NOT disqualify simple — use simple when only a direct conversational reply is needed.
701
+ Platform mention/reply target/channel/room/connector alone can still be simple when only chat reply needed.
676
702
 
677
- Never choose simple when the message:
678
- - needs any tool/action/subagent/provider/filesystem/network/API/live data/side effect/verification
679
- - names a person, place, file, document, data source, or asks about schedules or past interactions ("what did I say earlier", "what's on my calendar", "how many X")
680
- - searches, browses, looks up current facts; runs shell commands; inspects files/logs/repos/services/disk; builds or deploys apps; creates PRs; spawns coding/task agents; sends messages; schedules tasks
681
- - would benefit from a tool call even if the agent could fabricate a plausible answer
682
- - is owner life-management (todos/habits/routines/goals/reminders/alarms/check-ins/blocks/calls/travel/device delivery/desktop actions/approvals) route to the owning context so its action can ask any missing detail
683
- - changes/persists/updates/remembers agent or user settings, preferences, identity, persona, response style, or future behavior select settings (and any relevant context)
703
+ Never simple when message:
704
+ - needs tool/action/subagent/provider/filesystem/network/API/live data/side effect/verification
705
+ - names person/place/file/document/data source, or asks schedules/past interactions ("what did I say earlier", "what's on my calendar", "how many X")
706
+ - searches/browses/current facts; runs shell; inspects files/logs/repos/services/disk; builds/deploys apps; creates PRs; spawns coding/task agents; sends messages; schedules tasks
707
+ - benefits from tool call even if plausible answer exists
708
+ - owner life-management: todos/habits/routines/goals/reminders/alarms/check-ins/blocks/calls/travel/device delivery/desktop actions/approvals; route owner context, action asks missing detail
709
+ - changes/persists/updates/remembers settings/preferences/identity/persona/response style/future behavior; select settings + relevant context
684
710
 
685
711
  Domain routing (when context is available):
686
- - morning/night/daily check-ins -> tasks; only include automation if user asks to schedule/change cadence
687
- - relationship cadence ("follow up with David", "last talked to Alice", "how long since I spoke with Sam") -> contacts; one-off dated todos to call/text -> tasks
688
- - explicit phone/call/dial a third party -> phone + contacts; do NOT include calendar just because the call is about an appointment
689
- - device-targeted or broadcast reminders ("to my phone", "all devices", "broadcast") -> automation + connectors (not simple chat); tasks may be secondary
690
- - owner password/saved-login lookup ("look up my GitHub password") -> settings + secrets so PASSWORD_MANAGER handles it; never answer with the raw secret in Stage 1
691
- - website/social-site focus blocking -> automation + settings; app blocking -> automation + settings (not screen_time unless reporting)
692
- - real flight/hotel/trip booking -> browser + calendar + payments + tasks so BOOK_TRAVEL owns the workflow
693
- - Calendly availability + single-use booking links -> calendar + connectors, even when the message contains a Calendly API URL
712
+ - morning/night/daily check-ins -> tasks; add automation only schedule/cadence asked
713
+ - relationship cadence ("follow up with David", "last talked to Alice", "how long since I spoke with Sam") -> contacts; one-off dated call/text todo -> tasks
714
+ - explicit phone/call/dial third party -> phone + contacts; not calendar just because appointment mentioned
715
+ - device/broadcast reminders ("to my phone", "all devices", "broadcast") -> automation + connectors; tasks secondary
716
+ - owner password/saved-login lookup -> settings + secrets; CREDENTIALS handles; never raw secret in Stage 1
717
+ - build/create/make/update/edit/fix/redeploy a website/web page/app/site/landing page/feature, or any imperative code/repo/file change ("add X to the site", "fix the about page", "update my landing page") -> code (SPAWN_AGENT / TASKS spawn_agent); NOT tasks/automation/settings/scheduled. This is hands-on build work for a coding sub-agent, not a scheduled task or a focus block.
718
+ - screen-time FOCUS BLOCK only (blocking/limiting a distracting website or app, e.g. "block twitter after 9pm", "limit instagram") -> automation + settings; screen_time only reports. Does NOT apply to building/updating a site or app.
719
+ - real flight/hotel/trip booking -> browser + calendar + payments + tasks; PERSONAL_ASSISTANT action=book_travel owns
720
+ - Calendly availability/single-use booking links -> calendar + connectors, even with Calendly API URL
694
721
  - health/wearable reads (steps/sleep/heart rate/workouts) -> health
695
- - X/Twitter DMs -> messaging + connectors; X/Twitter timeline/feed/mentions/post search -> social_posting + connectors (not generic web browsing)
696
- - desktop/native-app/browser/Finder/window screenshots or control -> browser or automation (not media alone)
697
- - LifeOps browser bridge/companion/extension/tab/settings -> browser; settings/connectors as secondary when configuration/connection state is asked
698
- - durable owner facts and stable personal preferences, especially travel/booking preferences ("remember that I prefer aisle seats", "save my hotel preferences") -> memory; add PROFILE as a parent action hint when possible; do not route these to documents unless the user explicitly asks to create/search/edit a document or file
722
+ - X/Twitter DMs -> messaging + connectors; X/Twitter timeline/feed/mentions/post search -> social_posting + connectors
723
+ - desktop/native-app/browser/Finder/window screenshots/control -> browser or automation
724
+ - LifeOps browser bridge/companion/extension/tab/settings -> browser; add settings/connectors for config/connection
725
+ - durable owner facts/preferences, esp travel/booking ("remember aisle seats") -> memory + settings; documents only create/search/edit document/file
699
726
 
700
- Otherwise: list every relevant context id; planning will run and tools will be selected from those contexts. If only general is available and a tool is still needed, use plan.contexts=["general"]. Include plan.reply only on the simple path.
727
+ Otherwise: list relevant context ids. If only general exists and tool needed, use contexts=["general"].
701
728
 
702
- Optional plan fields:
703
- - plan.candidateActions: up to 12 action-like retrieval hints inferred from the request ("send_email", "calendar_create_event", "search_documents", "play_music"). Speculative BM25/regex hints, not tool calls.
704
- - plan.parentActionHints: up to 6 parent action names only when explicit or highly likely. Omit over guess.
705
- - plan.contextSlices: up to 12 stable retrieval slice ids visible in the provided context. Never invent slice ids.
729
+ Optional fields:
730
+ - candidateActions: <=12 action-like retrieval hints ("send_email", "calendar_create_event", "search_documents", "play_music"). Hints, not tool calls.
731
+ - parentActionHints: <=6 parent action names when explicit/high-confidence. Omit over guess.
732
+ - contextSlices: <=12 visible stable retrieval slice ids. Never invent.
706
733
 
707
734
  thought is internal rationale, not shown to user.
708
735
 
709
- extract is OPTIONAL. Populate ONLY when the user states a durable fact about themselves, a person they know, or a relationship.
736
+ extract OPTIONAL. Populate ONLY durable fact about user/person/relationship.
710
737
  - worth extracting: "my birthday is March 5", "Alice is my manager", "I live in Brooklyn"
711
738
  - skip: questions, requests, ephemeral state, agent self-talk, anything obvious from agent persona
712
- - extract.facts: short factual statements in the user's voice ("the user's birthday is 1990-03-05"), under ~120 chars each, self-contained
713
- - extract.relationships: subject-predicate-object triples; short entity names ("user", "Alice", "Acme Corp"); snake_case predicate ("works_with", "lives_in", "manages")
714
- - extract.addressedTo: OPTIONAL entity UUIDs (preferred) or participant names this message is directed at. Agent's id/name when user talks to the agent; another participant's id/name when addressed by name or @-mention. Empty/omit when broadcast or unclear. Do not guess.
715
- - omit extract entirely when nothing durable was stated and no addressee identified. Never invent.
739
+ - extract.facts: self-contained facts, user voice, ~120 chars max
740
+ - extract.relationships: subject-predicate-object; short entities; snake_case predicate
741
+ - extract.addressedTo: UUIDs preferred or participant names addressed. Agent id/name when user talks to agent; other participant by name/@mention. Empty/omit if broadcast/unclear. Do not guess.
742
+ - omit extract when no durable fact/addressee. Never invent.
716
743
 
717
- Call {{handleResponseToolName}} exactly once with the plan. Do not answer in plain text.
744
+ Call {{handleResponseToolName}} exactly once. If native tool calls are unavailable, return the same envelope as plain JSON.
718
745
 
719
746
  return:
720
- Use the {{handleResponseToolName}} tool. Do not return JSON as message text.
747
+ Use the {{handleResponseToolName}} tool when available; otherwise return only the JSON envelope.
721
748
 
722
749
  JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
723
750
  `;
724
751
 
725
752
  export const MESSAGE_HANDLER_TEMPLATE = messageHandlerTemplate;
726
753
 
727
- export const mobileDirectReplyTemplate = `{{system}}
728
-
729
- Answer the user directly. Do not select actions, do not return structured control output, and do not explain internal reasoning.
730
- If the user asks for exact words, output exactly those words and nothing else.
731
-
732
- User: {{userText}}
733
- {{agentName}}:
734
-
735
- JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
736
- `;
737
-
738
- export const MOBILE_DIRECT_REPLY_TEMPLATE = mobileDirectReplyTemplate;
739
-
740
754
  export const observationExtractionTemplate = `You are analyzing recent conversation exchanges between a user and an AI assistant.
741
755
  Extract any durable observations about the user that would be useful across future sessions.
742
756
 
@@ -781,7 +795,7 @@ JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
781
795
 
782
796
  export const OPTION_EXTRACTION_TEMPLATE = optionExtractionTemplate;
783
797
 
784
- export const plannerTemplate = `task: Plan the next native tool calls for the current ContextObject.
798
+ export const plannerTemplate = `task: Plan next native tool calls for current ContextObject.
785
799
 
786
800
  context_object:
787
801
  {{contextObject}}
@@ -790,11 +804,11 @@ trajectory:
790
804
  {{trajectory}}
791
805
 
792
806
  rules:
793
- - use only tools exposed in the current context object
794
- - plan smallest grounded queue of useful tool calls
795
- - include arguments only when grounded in user request or prior tool results
796
- - if task is complete or only next step is speaking to user, return no toolCalls and set messageToUser
797
- - do not invent tool names, connector names, providers, ids, or benchmark ids
807
+ - use only tools in current context object
808
+ - smallest grounded useful tool queue
809
+ - args only from user request or prior tool results
810
+ - task complete or next step is user speech => no toolCalls, set messageToUser
811
+ - never invent tool names, connector names, providers, ids, benchmark ids
798
812
 
799
813
  return:
800
814
  JSON object only. No markdown, prose, XML, or legacy formats.
@@ -1066,51 +1080,7 @@ JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
1066
1080
 
1067
1081
  export const SHOULD_RESPOND_TEMPLATE = shouldRespondTemplate;
1068
1082
 
1069
- export const shouldRespondWithContextTemplate = `task: Decide whether {{agentName}} should respond, ignore, or stop.
1070
-
1071
- context:
1072
- {{providers}}
1073
-
1074
- rules[7]:
1075
- - direct mention of {{agentName}} -> RESPOND
1076
- - different assistant name or talking to someone else -> IGNORE unless {{agentName}} is also directly addressed
1077
- - prior participation alone is not enough; newest message must clearly expect {{agentName}} -> otherwise IGNORE
1078
- - request to stop or be quiet directed at {{agentName}} -> STOP
1079
- - if multiple people mentioned and {{agentName}} is one of the addressees -> RESPOND
1080
- - in groups, if latest message is addressed to someone else, IGNORE
1081
- - when unsure, default IGNORE
1082
-
1083
- available_contexts:
1084
- {{availableContexts}}
1085
-
1086
- context_routing:
1087
- - contexts: zero or more context ids from available_contexts
1088
- - use [] when no tool or context provider is needed
1089
- - if contexts non-empty, planning runs and simple is ignored
1090
-
1091
- decision_note:
1092
- - respond only when latest message is talking TO {{agentName}}
1093
- - talking TO {{agentName}}: name mention, reply chain, or clear follow-up
1094
- - mentions of others don't cancel direct address
1095
- - casual conversation between others is not enough
1096
- - if another assistant answered and nobody re-addressed, IGNORE
1097
- - if {{agentName}} replied recently and nobody re-addressed, IGNORE
1098
- - talking ABOUT {{agentName}} is not enough
1099
-
1100
- output:
1101
- JSON only. One JSON object. No prose, no <think>.
1102
-
1103
- Example:
1104
- {
1105
- "action": "RESPOND",
1106
- "simple": true,
1107
- "contexts": [],
1108
- "thought": "Direct mention and clear follow-up.",
1109
- "reply": "Short direct reply when no context is needed."
1110
- }
1111
-
1112
- JSON only. Return one JSON object. No prose, fences, thinking, or markdown.
1113
- `;
1083
+ export const shouldRespondWithContextTemplate = shouldRespondTemplate;
1114
1084
 
1115
1085
  export const SHOULD_RESPOND_WITH_CONTEXT_TEMPLATE =
1116
1086
  shouldRespondWithContextTemplate;
@@ -1,2 +0,0 @@
1
- """elizaOS Prompts Package"""
2
- from .prompts import *