fix(agent): tell agent that when to use tools and when to respond directly

This commit is contained in:
Acbox
2026-02-23 04:38:13 +08:00
parent c7a2bec709
commit da9d64e508
2 changed files with 27 additions and 21 deletions
+26 -20
View File
@@ -30,9 +30,9 @@ ${skill.content}
const formatInbox = (items: InboxItem[]): string => {
if (!items || items.length === 0) return ''
return `
## Inbox
## Inbox (${items.length} unread)
You have ${items.length} unread message(s) in your inbox. These are messages from group conversations where you were not directly mentioned, or notifications from external sources. Review them to stay informed about ongoing discussions.
These are messages from other channels — NOT from the current conversation. Use ${quote('send')} or ${quote('react')} if you want to respond to any of them.
<inbox>
${JSON.stringify(items)}
@@ -91,32 +91,38 @@ ${quote('/data')} is your HOME — you can read and write files there freely.
## Memory
Use ${quote('search_memory')} to recall earlier conversations beyond the current context window.
## Messaging
- ${quote('send')}: send a message to a channel target. Requires a ${quote('target')} — use ${quote('get_contacts')} to find available targets.
- ${quote('react')}: add or remove an emoji reaction on a message
## How to Respond
Use message tools when:
- Schedule tasks are triggered.
- You need to send a message to other channels.
- You want to reply or react an inbox message.
**Direct reply (default):** When someone sends you a message in the current session, just write your response as plain text. This is the normal way to answer — your text output goes directly back to the person talking to you. Do NOT use ${quote('send')} for this.
Do not:
- Use message tools to respond to the user directly
**${quote('send')} tool:** ONLY for reaching out to a DIFFERENT channel or conversation — e.g. posting to another group, messaging a different person, or replying to an inbox item from another platform. Requires a ${quote('target')} — use ${quote('get_contacts')} to find available targets.
**${quote('react')} tool:** Add or remove an emoji reaction on a specific message (any channel).
### When to use ${quote('send')}
- A scheduled task tells you to notify or post somewhere.
- You want to forward information to a different group or person.
- You want to reply to an inbox message that came from another channel.
- The user explicitly asks you to send a message to someone else or another channel.
### When NOT to use ${quote('send')}
- The user is chatting with you and expects a reply — just respond directly.
- The user asks a question, gives a command, or has a conversation — just respond directly.
- If you are unsure, respond directly. Only use ${quote('send')} when the destination is clearly a different target.
## Contacts
You may receive messages from different people, bots, and channels. Use ${quote('get_contacts')} to list all known contacts and conversations for your bot.
It returns each route's platform, conversation type, and ${quote('target')} (the value you pass to ${quote('send')}).
## Your Inbox
You have an inbox full of notifications, they may be from:
- Different groups you are in, they are not mentioned you, but you can be a watcher.
- Other platforms you are connected to, like email, etc.
Your inbox contains notifications from:
- Group conversations where you were not directly mentioned.
- Other connected platforms (email, etc.).
Knows when to react:
- You can use ${quote('send')} or ${quote('react')} to respond to the inbox messages.
- But remember, Not all messages are needed to be responded to.
- Chat like a human, reply your interesting message.
- Sometimes, an emoji reaction is better than a long text.
Guidelines:
- Not all messages need a response — be selective like a human would.
- If you decide to reply to an inbox message, use ${quote('send')} or ${quote('react')} (since inbox messages come from other channels).
- Sometimes an emoji reaction is better than a long reply.
## Attachments
@@ -145,7 +151,7 @@ You can create and manage schedule tasks via cron.
Use ${quote('schedule')} to create a new schedule task, and fill ${quote('command')} with natural language.
When cron pattern is valid, you will receive a schedule message with your ${quote('command')}.
Using ${quote('send')} to respond is a better way than responding directly.
When a scheduled task triggers, use ${quote('send')} to deliver the result to the intended channel — do not respond directly, as there is no active conversation to reply to.
## Subagent
+1 -1
View File
@@ -4,7 +4,7 @@ import { cva } from 'class-variance-authority'
export { default as Button } from './Button.vue'
export const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-pointer",
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=\'size-\'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-pointer',
{
variants: {
variant: {