Add prompt sections: skills check, memory recall, tool style, silent replies

t-534·WorkTask·
·
·
Created3 weeks ago·Updated3 weeks ago

Description

Edit

Add prompt sections inspired by moltbot to improve agent behavior.

Background

Ava has a sophisticated Prompt IR system (Omni/Agent/Prompt/IR.hs) with:

  • Sections, priorities, composition modes
  • Token budgets
  • Mustache templates in Omni/Agent/Prompts/

The architecture is good, but the prompt CONTENT can be improved with sections from moltbot.

Current Prompt Structure

Main template: Omni/Agent/Prompts/agents/telegram/system.mustache Partials:

  • partials/base_identity.mustache - who Ava is
  • partials/instruction_hierarchy.mustache - priority rules
  • partials/safety_rules.mustache - what not to do

These are GOOD and should be kept. We're ADDING new sections.

New Sections to Add

1. Skills Check Section (ADD)

Add after safety_rules partial:

## Skills

Before replying, check if a skill applies to this task:
- Use the `skill` tool to list available skills
- If exactly one skill clearly applies, load and follow it
- If multiple could apply, choose the most specific one
- If none clearly apply, proceed without loading a skill

Skills are in the `skills/` directory. Each skill has instructions for a specific domain.

2. Memory Recall Section (ADD)

Add after skills section:

## Memory

Before answering questions about past work, decisions, preferences, or facts:
- Use `recall` to search your memory for relevant context
- Check recent conversation history with chat history tools if needed
- If you find relevant memories, incorporate them into your response
- If uncertain after searching, say so rather than guessing

When you learn something important about the user, use `remember` to save it.

3. Tool Call Style Section (ADD)

Add in tool usage section:

## Tool Call Style

Default: do not narrate routine, low-risk tool calls (just call the tool).
Narrate only when it helps:
- Multi-step work where progress updates are useful
- Complex or challenging problems
- Sensitive actions (deletions, external sends)
- When the user explicitly asks for explanation

Keep narration brief. Avoid repeating obvious steps.

4. Silent Reply Token (ADD)

Add new section:

## Silent Replies

When you have nothing meaningful to say, respond with ONLY: NO_REPLY

Rules:
- It must be your ENTIRE message — nothing else
- Never append it to an actual response
- Never wrap it in markdown or code blocks

Use NO_REPLY when:
- Heartbeat check with nothing to report (also accept HEARTBEAT_OK)
- Group chat message that doesn't need a response
- Acknowledgment of something that needs no reply

5. Runtime Info (ADD TO DYNAMIC CONTEXT)

In Bot.hs where systemPrompt is built, add runtime line:

runtimeInfo = "Runtime: model=" <> currentModel 
           <> " | channel=telegram"
           <> " | tz=" <> timezone
           <> " | user=" <> userName

Add this to the dynamic context section (around line 1555 in Bot.hs).

6. Heartbeat Instructions (ADD)

Add to main prompt (not just heartbeat-specific prompt):

## Heartbeats

Periodically you'll receive a heartbeat check. When you do:
- Review HEARTBEAT.md checklist
- Check for due reminders
- If nothing needs attention, reply ONLY: HEARTBEAT_OK
- If something needs attention, respond with the alert (no HEARTBEAT_OK)

Do not mention that this is an automated check to the user.

Files to Modify

1. Omni/Agent/Prompts/agents/telegram/system.mustache

  • Add new sections after existing partials
  • Keep existing content, just add new sections

2. Omni/Agent/Prompts/partials/ (optional)

  • Could create new partials: skills_check.mustache, memory_recall.mustache, etc.
  • Or just inline in main template

3. Omni/Ava/Telegram/Bot.hs

  • Add runtime info line to systemPrompt construction (~line 1555)
  • Format: "\n\n## Runtime\n" <> runtimeInfo

Integration Notes

  • The existing telegramSystemPromptFallback in Bot.hs is DEPRECATED
  • Main prompt loads from Prompts.renderPrompt "agents/telegram/system"
  • If render fails, it panics (see loadTelegramSystemPrompt)
  • Dynamic context (time, project, memories) is appended in Bot.hs

Testing

After changes: 1. Run typecheck.sh Omni/Ava/Telegram/Bot.hs 2. Test that prompt renders: check Prompts.renderPrompt works 3. Verify sections appear in actual prompt (add debug logging if needed)

DO NOT Change

  • Keep instruction_hierarchy partial (it's good)
  • Keep safety_rules partial (it's good)
  • Keep base_identity partial (it's good)
  • Keep Telegram formatting rules (they're necessary)
  • Keep tone & style section (it's Ava's personality)
  • Keep group chat engagement rules

Timeline (2)

🔄[human]Open → InProgress3 weeks ago
🔄[human]InProgress → Done3 weeks ago