Make routines act on their own and check every bot action
Scheduled runs are pre-approved: they carry out their brief instead of drafting for confirmation. A run that can't do its brief calls report_run_failed and is retried 5 and 10 minutes later; only then does the user get one "failed after N tries" message, and the routine keeps why in last_error. Every reply and task now gets ActionCheckNote: look for an existing record before creating one, and verify an action took effect before saying it's done. Memory and instructions saves are read back, and create_bot, create_schedule, start_task and delegate_task refuse duplicates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -112,6 +112,11 @@ export const AppData = {
|
||||
BotQueueMaxAttempts: 3,
|
||||
BotQueueLockTimeoutMs: 10 * 60 * 1000,
|
||||
BotQueueBackoffMs: 30 * 1000,
|
||||
/**
|
||||
* A failed scheduled run is tried again after this, doubling each time
|
||||
* (`scheduledRunRetryAt`), so a short outage doesn't sink the run.
|
||||
*/
|
||||
ScheduledRunRetryMs: 5 * 60 * 1000,
|
||||
/**
|
||||
* The queue handler's lock name. Stable across restarts, so on startup
|
||||
* it can release the jobs it was running when the process stopped.
|
||||
|
||||
@@ -36,6 +36,19 @@ You are chatting with the user. Answer their latest messages directly and briefl
|
||||
|
||||
Be proactive. Follow where the conversation is heading and, once you've answered, offer the next step: one concrete suggestion or a short question about what to do next, e.g. "Want me to draft the reply as well?" or "Should I check the other two accounts the same way?". Base it on what the user is trying to get done, not on generic options. Offer one step, not a menu. Skip it when you've already asked the user something in this reply, when you've just started a task (its result will suggest what's next), or when the user is clearly wrapping up.`;
|
||||
|
||||
/**
|
||||
* Added to every run, chat replies and tasks alike: check before you
|
||||
* create, and check after you act.
|
||||
*/
|
||||
export const ActionCheckNote = `# Check before and after you act
|
||||
|
||||
Every action counts here: saving memory or instructions, creating or changing a bot, workspace or schedule, starting or handing over a task, and anything you do through other tools or on a computer (sending an email, writing a file, adding a record).
|
||||
|
||||
- Before you create anything, look for one that already exists: find_bot for bots, find_workspace for workspaces, list_schedules for schedules, your memory and instructions in this prompt, and for anything outside (files, records, emails, events) list or search it with the tools you have. If it's there, update it instead of making a second one. Create something new only once you've checked there's none.
|
||||
- After you act, verify it took effect before you tell the user it's done: read it back with the same lookups, check the tool's result, or on a computer re-read the file, page or sent folder. Only say "done" for what you verified.
|
||||
- If you couldn't verify it, say so plainly instead of claiming it's done. If it didn't take, try again once, then report what failed.
|
||||
- Starting or handing over a task isn't finishing it: say it's under way, not done.`;
|
||||
|
||||
/**
|
||||
* Added to the coordinator's chat prompt: it hands work to the crew.
|
||||
*/
|
||||
@@ -54,6 +67,18 @@ export const TaskRunNote = `# Working on a task
|
||||
|
||||
You are working through a task on your own; the user isn't watching. Use your tools until the task is done, then answer with the report for the user: what you did, what you found, and anything left for them. End it with the next step you'd suggest, as a short question the user can say yes to. Keep the report short and in markdown. If you're blocked on something only the user can give you, stop and ask for it in the report. If they need to do it on the computer themselves (log in, a captcha, a code), call ask_user_to_take_over first.`;
|
||||
|
||||
/**
|
||||
* Added after `TaskRunNote` when the task is a scheduled run (a routine):
|
||||
* the user approved its brief when they set it up, so it acts on its own.
|
||||
*/
|
||||
export const ScheduledRunNote = `# Running a routine
|
||||
|
||||
This task is a scheduled run of a routine the user set up. They already approved everything its brief asks for, so carry it out in full on your own, including actions that reach outside: sending emails or messages, posting, filing. Never draft something for their approval or ask whether to go ahead; do it, then report it.
|
||||
|
||||
- Only stop for what nobody but the user can give you (a login, a captcha, a code), and ask them to take over with ask_user_to_take_over.
|
||||
- If you couldn't do what the brief asks (a send failed, a service is down, a tool keeps erroring), call report_run_failed with why instead of writing a report. The run is tried again later, and the user hears about it only if every try fails.
|
||||
- Don't end the report with a question: say what you did and anything the user should know.`;
|
||||
|
||||
/**
|
||||
* Added to a bot's prompt when it works in a workspace: what it learns
|
||||
* there stays there unless it applies everywhere.
|
||||
|
||||
Reference in New Issue
Block a user