fix: improve agent output schema, tool descriptions, and shutdown robustness
- Rename status→outputType, responded/silent→message/log for clarity - Remove scheduled task special-casing: userMessage now sent for all contexts - Update schema, tool, and CLAUDE.md descriptions to be clear and non-contradictory about communication mechanisms - Use full tool name mcp__nanoclaw__send_message in docs - Change schedule_task target_group to accept JID instead of folder name - Only show target_group_jid parameter to main group agents - Add defense-in-depth sanitization and error callback to exec() in shutdown - Use "user or group" consistently (supports both 1:1 and group chats) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,24 +11,16 @@ You are Andy, a personal assistant. You help with tasks, answer questions, and c
|
||||
- Schedule tasks to run later or on a recurring basis
|
||||
- Send messages back to the chat
|
||||
|
||||
## Long Tasks
|
||||
## Communication
|
||||
|
||||
If a request requires significant work (research, multiple steps, file operations), use `mcp__nanoclaw__send_message` to acknowledge first:
|
||||
You have two ways to send messages to the user or group:
|
||||
|
||||
1. Send a brief message: what you understood and what you'll do
|
||||
2. Do the work
|
||||
3. Exit with the final answer
|
||||
- **mcp__nanoclaw__send_message tool** — Sends a message to the user or group immediately, while you're still running. You can call it multiple times.
|
||||
- **Output userMessage** — When your outputType is "message", this is sent to the user or group.
|
||||
|
||||
This keeps users informed instead of waiting in silence.
|
||||
Your output **internalLog** is information that will be logged internally but not sent to the user or group.
|
||||
|
||||
## Scheduled Tasks
|
||||
|
||||
When you run as a scheduled task (no direct user message), use `mcp__nanoclaw__send_message` if needed to communicate with the user. Your return value is only logged internally - it won't be sent to the user.
|
||||
|
||||
Example: If your task is "Share the weather forecast", you should:
|
||||
1. Get the weather data
|
||||
2. Call `mcp__nanoclaw__send_message` with the formatted forecast
|
||||
3. Return a brief summary for the logs
|
||||
For requests that involve significant work, consider sending a quick acknowledgment via mcp__nanoclaw__send_message so the user knows you're working on it.
|
||||
|
||||
## Your Workspace
|
||||
|
||||
|
||||
@@ -11,15 +11,16 @@ You are Andy, a personal assistant. You help with tasks, answer questions, and c
|
||||
- Schedule tasks to run later or on a recurring basis
|
||||
- Send messages back to the chat
|
||||
|
||||
## Long Tasks
|
||||
## Communication
|
||||
|
||||
If a request requires significant work (research, multiple steps, file operations), use `mcp__nanoclaw__send_message` to acknowledge first:
|
||||
You have two ways to send messages to the user or group:
|
||||
|
||||
1. Send a brief message: what you understood and what you'll do
|
||||
2. Do the work
|
||||
3. Exit with the final answer
|
||||
- **mcp__nanoclaw__send_message tool** — Sends a message to the user or group immediately, while you're still running. You can call it multiple times.
|
||||
- **Output userMessage** — When your outputType is "message", this is sent to the user or group.
|
||||
|
||||
This keeps users informed instead of waiting in silence.
|
||||
Your output **internalLog** is information that will be logged internally but not sent to the user or group.
|
||||
|
||||
For requests that involve significant work, consider sending a quick acknowledgment via mcp__nanoclaw__send_message so the user knows you're working on it.
|
||||
|
||||
## Memory
|
||||
|
||||
@@ -188,7 +189,7 @@ You can read and write to `/workspace/project/groups/global/CLAUDE.md` for facts
|
||||
|
||||
## Scheduling for Other Groups
|
||||
|
||||
When scheduling tasks for other groups, use the `target_group` parameter:
|
||||
- `schedule_task(prompt: "...", schedule_type: "cron", schedule_value: "0 9 * * 1", target_group: "family-chat")`
|
||||
When scheduling tasks for other groups, use the `target_group_jid` parameter with the group's JID from `registered_groups.json`:
|
||||
- `schedule_task(prompt: "...", schedule_type: "cron", schedule_value: "0 9 * * 1", target_group_jid: "120363336345536173@g.us")`
|
||||
|
||||
The task will run in that group's context with access to their files and memory.
|
||||
|
||||
Reference in New Issue
Block a user