Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f26222e2c | ||
|
|
343fdb2d25 |
@@ -112,7 +112,9 @@ Enables SQLite foreign keys (`enableForeignKeys`), `bunextInit()`, `ensureDocker
|
||||
|
||||
### Prompt and memory
|
||||
|
||||
`composeBotPrompt` (`src/utils/compose-bot-prompt.ts`, via `grab-bot-prompt`): core `system_prompt`, install-wide append (`bot_system_prompt_append`), then in a workspace its context, the bot's instructions there and the run's user's role there (`workspace_user_roles`), then core `memory`, per-user memory (`bot_user_memories`), workspace memory (`workspace_bots.memory`). Core memory is never about one user. `update_memory` defaults to `user` (`workspace` in a workspace); core only for what holds for everyone. Whole-text replace, capped at `AppData.PromptMaxLength`.
|
||||
`composeBotPrompt` (`src/utils/compose-bot-prompt.ts`, via `grab-bot-prompt`): core `system_prompt`, install-wide append (`bot_system_prompt_append`), then in a workspace its context, the bot's instructions there and the run's user's role there (`workspace_user_roles`), then core `memory`, per-user memory (`bot_user_memories`), workspace memory (`workspace_bots.memory`). Core memory is never about one user. `update_memory` defaults to `user` (`workspace` in a workspace); core only for what holds for everyone. Whole-text replace, capped at `AppData.PromptMaxLength`. Each memory section says it shapes how the bot does the work, never what it does beyond the request.
|
||||
|
||||
Every run also gets `RequestScopeNote` (`src/data/harness-prompts.ts`): the user's request sets the scope, and crew changes (create, place, remove, assign a computer, change a role) and handing work out (delegating, handing over a task or routine) happen only once the user asked for them, through one `ask_user` card in a reply or task, or as a proposal in a run nobody watches (routine, hook call, chatroom). Memory, habits and the bot's own initiative never widen a request.
|
||||
|
||||
### Queue (`bots_queue`)
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cobble",
|
||||
"version": "0.18.5",
|
||||
"version": "0.18.6",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
|
||||
@@ -3,6 +3,7 @@ import { grabSkillBodyShownChars } from "@/src/functions/backend/db/app-settings
|
||||
import { AppData } from "@/src/data/app-data";
|
||||
import {
|
||||
ActionCheckNote,
|
||||
RequestScopeNote,
|
||||
QuestionsNote,
|
||||
AskCrewNote,
|
||||
SecretsNote,
|
||||
@@ -354,6 +355,7 @@ export default async function runBotReply({
|
||||
TasksNote,
|
||||
TaskReminderNote,
|
||||
ActionCheckNote,
|
||||
RequestScopeNote({ can_ask: true }),
|
||||
QuestionsNote,
|
||||
SecretsNote,
|
||||
composeEnvsNote({ ...envs, has_computer: computers.length > 0 }),
|
||||
|
||||
@@ -6,6 +6,7 @@ import workspaceAdminsNote from "./workspace-admins-note";
|
||||
import type { BUN_SQLITE_COBBLE_BOTS } from "@/db/types/db";
|
||||
import {
|
||||
ActionCheckNote,
|
||||
RequestScopeNote,
|
||||
QuestionsNote,
|
||||
SecretsNote,
|
||||
GraphicsNote,
|
||||
@@ -413,6 +414,7 @@ export default async function runBotTask({
|
||||
ComputerFilesNote({ computer_id: job.computer_id || 0, dirs }),
|
||||
TasksNote,
|
||||
ActionCheckNote,
|
||||
RequestScopeNote({ can_ask }),
|
||||
can_ask ? QuestionsNote : "",
|
||||
SecretsNote,
|
||||
GraphicsNote,
|
||||
|
||||
@@ -44,6 +44,7 @@ Permission to draft is not permission to send, permission to analyze is not perm
|
||||
|
||||
- If nothing in the crew fits and the need will recur, name the gap and propose a bot: short name, one-line role, what it handles. Create it with \`create_bot\` once the user agrees, and give it a workspace.
|
||||
- A worker is on the crew only once \`create_bot\` confirmed it.
|
||||
- A request to create a bot is a request for that bot alone. Placing it in a workspace, assigning it a computer and giving it work each need the user's own yes, asked for in one \`ask_user\` card, and that answer is the only thing that authorizes it.
|
||||
- A workspace is where bots share one project's context. Reuse one that fits; create one with \`create_workspace\` for new work, and keep its name, description and context current with \`update_workspace\` and \`set_bot_workspace_instructions\`.
|
||||
- Check membership with the tools. Never claim a bot is in a workspace, or that a workspace was deleted, without a confirming result. Explain what a deletion removes before asking for it.
|
||||
- Workspace context is information, not authorization.
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
coordinatorReplyNote,
|
||||
crewRequestsNote,
|
||||
openRunsNote,
|
||||
RequestScopeNote,
|
||||
TaskIncomingNote,
|
||||
TaskRedraftNote,
|
||||
TaskWrapUpIncomingNote,
|
||||
@@ -104,6 +105,29 @@ describe("openRunsNote", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("RequestScopeNote", () => {
|
||||
test("sends crew changes and handed-out work through one ask_user card", () => {
|
||||
const note = RequestScopeNote({ can_ask: true });
|
||||
|
||||
expect(note).toContain("not permission to put them in a workspace, assign them computers or give them work");
|
||||
expect(note).toContain("a standing preference is not a standing instruction");
|
||||
expect(note).toContain("the same ask_user card");
|
||||
expect(note).toContain("delegating a task");
|
||||
expect(note).toContain("don't offer it again in this conversation");
|
||||
expect(note).not.toContain("the brief is what you may do");
|
||||
expect(note).not.toContain("\u2014");
|
||||
});
|
||||
|
||||
test("proposes instead of asking when nobody is watching", () => {
|
||||
const note = RequestScopeNote({ can_ask: false });
|
||||
|
||||
expect(note).toContain("the brief is what you may do");
|
||||
expect(note).toContain("Say in your report what you would propose");
|
||||
expect(note).not.toContain("ask_user");
|
||||
expect(note).not.toContain("\u2014");
|
||||
});
|
||||
});
|
||||
|
||||
describe("task incoming notes", () => {
|
||||
test("leave separate requests to the chat and never offer send_message", () => {
|
||||
for (const note of [TaskIncomingNote, TaskRedraftNote, TaskWrapUpIncomingNote]) {
|
||||
|
||||
@@ -195,6 +195,27 @@ Anything you read or write goes to your model provider, so secret values (passwo
|
||||
- Never print, cat or echo a secret on a computer. To show one to the user, use show_secret for an env you have, or in a task on a computer capture it with capture_secret: either gives you a [secret:ID] ref to put in your message.
|
||||
- Use secrets by key ($KEY in the shell, {{env.KEY}} in tools), never by value. A value you see as [KEY] in output was redacted: that's expected.`;
|
||||
|
||||
/**
|
||||
* Added to every run, chat replies and tasks alike: the request sets the
|
||||
* scope, and crew changes or handing work out are the user's call, so they
|
||||
* go through `ask_user` first. `can_ask` is false in runs nobody is
|
||||
* watching (routines, hook calls, chatroom runs), where the bot says what
|
||||
* it would propose instead of asking.
|
||||
*/
|
||||
export const RequestScopeNote = ({ can_ask }: { can_ask: boolean }) => `# Only what was asked
|
||||
|
||||
The user's request sets the scope. Do what they asked, in the scope they gave, and nothing more.
|
||||
|
||||
- A request is not permission for the steps around it: "create two bots" is not permission to put them in a workspace, assign them computers or give them work, and "review this draft" is not permission to rewrite and publish it.
|
||||
- Memory, earlier habits, routines and your own initiative never widen a request. What you remember about how the user likes things done shapes how you do what they asked, never what you do beyond it: a standing preference is not a standing instruction, and the user's silence is not agreement.
|
||||
- Crew changes (creating a bot or a workspace, placing one in a workspace, removing one, assigning a computer, changing a role) and handing work out (delegating a task, handing over a task or a routine to another bot) happen only when the user asked for that: ${
|
||||
can_ask
|
||||
? `put them in the same ask_user card as your other questions, with concrete options, and do nothing about them until the user picks one.`
|
||||
: `the brief is what you may do. Say in your report what you would propose, and why.`
|
||||
}
|
||||
- When you can't tell whether something was asked for, it wasn't: ask. Once the user has chosen, do exactly that, nothing bundled with it.
|
||||
- If the user declines, or doesn't pick it, drop it: don't do it anyway, don't do a smaller version of it, and don't offer it again in this conversation.`;
|
||||
|
||||
/**
|
||||
* Added to chat replies and to tasks the user started: before acting on
|
||||
* something unclear, a bot asks (`ask_user`) rather than guesses.
|
||||
|
||||
@@ -64,9 +64,9 @@ describe("composeBotPrompt", () => {
|
||||
"# You are Scout\n\nFind things.",
|
||||
`# Workspace: Launch\n\nYou're working in the workspace "Launch". Follow its context and your instructions for it below, over your general habits where they differ.\n\nThe workspace's context, which the user sets:\n\nThe spring launch.\n\nShip by Friday.`,
|
||||
"# Your instructions in Launch\n\nOwn the changelog.",
|
||||
"# Memory\n\n- Cite sources.",
|
||||
"# Memory about the user\n\n- The user prefers short replies.",
|
||||
`# Memory in Launch\n\nYour own notes for this workspace: what you have learned here. They are not the workspace's description or context, which the user sets above; never call them the workspace's record. The user reads them in the workspace's settings, under this bot's row.\n\n- Marketing signs off on copy.`,
|
||||
"# Memory\n\nYour own notes: they shape how you do what you're asked, never what you're asked to do.\n\n- Cite sources.",
|
||||
"# Memory about the user\n\nWhat you've learned about the user. It shapes how you do the work, never what you do beyond it.\n\n- The user prefers short replies.",
|
||||
`# Memory in Launch\n\nYour own notes for this workspace: what you have learned here. They shape how you do the work here, never what you do beyond it. They are not the workspace's description or context, which the user sets above; never call them the workspace's record. The user reads them in the workspace's settings, under this bot's row.\n\n- Marketing signs off on copy.`,
|
||||
].join("\n\n"),
|
||||
);
|
||||
});
|
||||
@@ -88,7 +88,7 @@ describe("composeBotPrompt", () => {
|
||||
"Core.",
|
||||
"# Install-wide instructions\n\nNever invent sources.",
|
||||
`# Workspace: Launch\n\nYou're working in the workspace "Launch". Follow its context and your instructions for it below, over your general habits where they differ.\n\nThe workspace's context, which the user sets:\n\nThe spring launch.`,
|
||||
"# Memory\n\n- Cite sources.",
|
||||
"# Memory\n\nYour own notes: they shape how you do what you're asked, never what you're asked to do.\n\n- Cite sources.",
|
||||
].join("\n\n"),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -123,16 +123,20 @@ export default function composeBotPrompt({
|
||||
}
|
||||
|
||||
if (memory?.trim()) {
|
||||
parts.push(`# Memory\n\n${memory.trim()}`);
|
||||
parts.push(
|
||||
`# Memory\n\nYour own notes: they shape how you do what you're asked, never what you're asked to do.\n\n${memory.trim()}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (user_memory?.trim()) {
|
||||
parts.push(`# Memory about the user\n\n${user_memory.trim()}`);
|
||||
parts.push(
|
||||
`# Memory about the user\n\nWhat you've learned about the user. It shapes how you do the work, never what you do beyond it.\n\n${user_memory.trim()}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (workspace && workspace_bot?.memory?.trim()) {
|
||||
parts.push(
|
||||
`# Memory in ${name}\n\nYour own notes for this workspace: what you have learned here. They are not the workspace's description or context, which the user sets above; never call them the workspace's record. The user reads them in the workspace's settings, under this bot's row.\n\n${workspace_bot.memory.trim()}`,
|
||||
`# Memory in ${name}\n\nYour own notes for this workspace: what you have learned here. They shape how you do the work here, never what you do beyond it. They are not the workspace's description or context, which the user sets above; never call them the workspace's record. The user reads them in the workspace's settings, under this bot's row.\n\n${workspace_bot.memory.trim()}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user