Tell every bot its own id, in every run
The bot's id never reached its prompt: `composeBotPrompt` only took its instructions, the appendix, its memory and its workspace, and `grabBotPrompt` never passed `bot.id` or `bot.name` on. A bot could only learn its id by accident, from a tool description that named it, so "which bot am I" was unanswerable in most contexts. - Open the prompt with who the bot is (`composeIdentity`): its name, whether it's the coordinator or a worker, its role, and its id, said to be how tools and refs point back at it. `grabBotPrompt` now passes the bot, which covers chat replies, tasks, routines and delegated tasks, since both runners build their prompt there. - Turn the notes' example refs into functions bound to the running bot: `chatReplyNote`, `botFilesNote` and `coordinatorReplyNote` take its id, so the folder-ref example no longer points at a hardcoded `owner_id: 5` (another bot's folder) nor `[bot:3]`. ComputerFilesNote keeps the computer it's given. - Stop `create_task` from hiding the worker's own id in its own chat. Tests: four new `composeBotPrompt` cases pin the identity block (worker, coordinator, unnamed, no bot at all), and a new `harness-prompts.test.ts` checks each note's own-folder and self refs point at exactly the running bot, for three ids.
This commit is contained in:
@@ -101,7 +101,7 @@ export default function createTaskTool({
|
||||
name: "create_task",
|
||||
description: is_coordinator
|
||||
? `Add a task to a list: a worker's own (${crew || "no workers yet"}), a workspace's shared one (${places || "no workspaces yet"}), or your own (leave both ids out). Write the description as a brief: what to do, where, and how you'll know it's done. A workspace's tasks are visible to every bot working there.`
|
||||
: `Add a task to a list: ${workspace_id ? "this workspace's shared one (leave the ids out), or your own (bot_id: " + bot_id + ")" : "your own (leave the ids out)"}. Write the description as a brief: what to do, where, and how you'll know it's done.`,
|
||||
: `Add a task to a list: ${workspace_id ? `this workspace's shared one (leave the ids out), or your own (bot_id: ${bot_id})` : `your own, bot_id ${bot_id} (or leave the id out, since it defaults to yours)`}. Write the description as a brief: what to do, where, and how you'll know it's done.`,
|
||||
schema: z.object({
|
||||
title: z.string().trim().min(1).max(AppData.TaskTitleMaxLength).describe(`A short label`),
|
||||
description: z
|
||||
@@ -111,7 +111,7 @@ export default function createTaskTool({
|
||||
bot_id: z.number().int().optional().describe(
|
||||
is_coordinator
|
||||
? `Whose own list, when it isn't a workspace's. Leave out for your own.`
|
||||
: `Your own id (${bot_id}), to keep it in your list rather than the workspace's.`,
|
||||
: `Your own id (${bot_id}), to keep it in your list rather than the workspace's; leaving it out has the same effect here.`,
|
||||
),
|
||||
workspace_id: z
|
||||
.number()
|
||||
|
||||
Reference in New Issue
Block a user