Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Keep active automations visible across conversations

Sebastian Bd40f17d7fd4d
diff --git a/server/active-routines-context.e2e.test.ts b/server/active-routines-context.e2e.test.ts
new file mode 100644
index 0000000000..250192d1e9
--- /dev/null
+++ b/server/active-routines-context.e2e.test.ts
@@ -0,0 +1,66 @@
+import { existsSync, readFileSync, writeFileSync } from "node:fs";
+import { join } from "node:path";
+import { expect, it } from "vitest";
+import { launchVerificationServer, runControlOmb } from "../scripts/control-omb.ts";
+
+it("shows a work conversation's interval monitor and stop rule in main chat, then reads back its pause", async () => {
+ const fixture = await launchVerificationServer(process.env, undefined, undefined, undefined, undefined, { scripted: true });
+ const planPath = join(fixture.info.dataDir, "room-plan.json");
+ const evidence = () => existsSync(`${planPath}.evidence.jsonl`)
+ ? readFileSync(`${planPath}.evidence.jsonl`, "utf8").trim().split("\n").filter(Boolean).map(line => JSON.parse(line)) : [];
+ const api = async (method: string, path: string, body?: unknown) => {
+ const response = await fetch(`${fixture.info.url}${path}`, { method,
+ headers: { "content-type": "application/json", origin: fixture.info.url },
+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),
+ });
+ const value = await response.json() as any;
+ expect(response.ok, JSON.stringify(value)).toBe(true);
+ return value;
+ };
+ const cli = (...args: string[]) => runControlOmb([...args, "--url", fixture.info.url]) as Promise<any>;
+ try {
+ const { bot } = await cli("new-bot", "--name", "Payment fixture");
+ const main = bot.activeTaskId as string;
+ const { task: work } = await api("POST", `/api/bots/${bot.id}/tasks`, { title: "Payment work" });
+ const instructions = "Check the fixture payment. After successful delivery, pause this automation.";
+ const turn = async (threadId: string, text: string, plan: unknown) => {
+ const before = evidence().length;
+ writeFileSync(planPath, JSON.stringify({ [bot.id]: plan }));
+ await cli("send", "--bot", bot.id, "--task", threadId, "--text", text);
+ await expect.poll(() => evidence().length, { timeout: 20_000 }).toBe(before + 1);
+ await cli("wait", "--bot", bot.id, "--task", threadId, "--timeout", "20");
+ return evidence().at(-1);
+ };
+ await turn(work.threadId, "Watch the fixture payment hourly until delivery.", {
+ steps: [{ tool: "trigger", arguments: { action: "create", when: "schedule", name: "Temporary payment monitor", instructions,
+ schedule: { type: "interval", everyMinutes: 60 } } }], reply: "The hourly monitor is ready.",
+ });
+ const { routines } = await api("GET", "/api/routines");
+ expect(routines).toHaveLength(1);
+ const monitor = routines[0];
+ expect(monitor).toMatchObject({ enabled: true, sourceThreadId: work.threadId });
+ writeFileSync(planPath, JSON.stringify({ [bot.id]: { reply: "The fixture payment has not arrived." } }));
+ const { run } = await api("POST", `/api/routines/${monitor.id}/run`);
+ await expect.poll(async () => (await api("GET", "/api/routines")).runs.find((item: any) => item.id === run.id)?.status,
+ { timeout: 20_000 }).toBe("completed");
+ const runPrompt = JSON.stringify(evidence().at(-1).prompt);
+ const settled = await turn(main, "The fixture payment was delivered. Finish the task.", {
+ steps: [
+ { tool: "trigger_info", arguments: { action: "list", trigger_id: monitor.id } },
+ { tool: "trigger", arguments: { action: "pause", trigger_id: monitor.id } },
+ { tool: "trigger_info", arguments: { action: "list", trigger_id: monitor.id } },
+ ], reply: "Delivery is complete and the temporary monitor is paused.",
+ });
+ expect(settled.system).toContain('"id":"' + monitor.id + '"');
+ expect(settled.system).toContain('"source":"Payment work"');
+ expect(settled.system).toContain(instructions);
+ expect(settled.system).toContain('"schedule":"interval"');
+ expect(runPrompt).toContain(`Trigger id: ${monitor.id}`);
+ const reads = settled.evidence.filter((entry: any) => entry.step?.tool === "trigger_info");
+ const readback = reads.at(-1).response.result.content[0].text;
+ const state = JSON.parse(readback.slice(readback.indexOf("\n") + 1));
+ expect(state).toMatchObject({ id: monitor.id, enabled: false, nextRunAt: null });
+ const after = await turn(main, "Confirm the final fixture state.", { reply: "The monitor remains paused." });
+ expect(after.system).not.toContain('"id":"' + monitor.id + '"');
+ } finally { await fixture.close(); }
+}, 90_000);
diff --git a/server/active-routines-context.test.ts b/server/active-routines-context.test.ts
new file mode 100644
index 0000000000..cfec4eeb62
--- /dev/null
+++ b/server/active-routines-context.test.ts
@@ -0,0 +1,91 @@
+import { describe, expect, it } from "vitest";
+import { activeRoutinesContext, ACTIVE_ROUTINES_MAX_CHARS, ACTIVE_ROUTINES_MAX_COUNT } from "./active-routines-context.ts";
+import { mayRead, memberAudience } from "./audience.ts";
+import type { Routine } from "./routines.ts";
+import { buildSystemPrompt } from "./system-prompt.ts";
+
+const routine = (id: string, patch: Partial<Routine> = {}): Routine => ({
+ id, botId: "bot", target: "bot", name: `Monitor ${id}`, prompt: "Check the payment. Pause after delivery.",
+ enabled: true, runOn: "maus", durationMinutes: 10, createdAt: 1, updatedAt: 1,
+ schedule: { type: "interval", everyMinutes: 60, anchorAt: 0 }, nextRunAt: 3_600_000, ...patch,
+});
+const context = (routines: Routine[], extra: Partial<Parameters<typeof activeRoutinesContext>[0]> = {}) =>
+ activeRoutinesContext({ botId: "bot", routines, ...extra });
+
+describe("activeRoutinesContext", () => {
+ it("is absent without enabled schedules for this bot", () => {
+ expect(context([])).toBe("");
+ expect(context([routine("paused", { enabled: false }), routine("other", { botId: "other" }), routine("room", { target: "room-goal" })])).toBe("");
+ });
+
+ it("carries the id, schedule, next run, source title and the stop rule as quoted previews", () => {
+ const text = context([routine("stable-id", { sourceThreadId: "work" })], { title: () => "Payment work" });
+ expect(text).toContain('"id":"stable-id"');
+ expect(text).toContain('"schedule":"interval"');
+ expect(text).toContain('"nextRun":"1970-01-01T01:00:00.000Z"');
+ expect(text).toContain('"source":"Payment work"');
+ expect(text).toContain("Pause after delivery.");
+ expect(text).toContain("trigger_info");
+ expect(text).toContain("not permission");
+ });
+
+ it("puts temporary schedules and interval monitors before standing work, newest first within each kind", () => {
+ const text = context([
+ routine("standing", { schedule: { type: "daily", time: "09:00", weekdays: [1] }, createdAt: 100 }),
+ routine("old-interval"), routine("new-interval", { createdAt: 10 }),
+ routine("temporary", { schedule: { type: "interval", everyMinutes: 60, anchorAt: 0, endsAt: 99 } }),
+ ]);
+ const ids = [...text.matchAll(/"id":"([^"]+)"/g)].map(match => match[1]);
+ expect(ids).toEqual(["temporary", "new-interval", "old-interval", "standing"]);
+ });
+
+ it("includes enabled app and webhook monitors but leaves model-free posts and room deliveries alone", () => {
+ const text = context([], {
+ appTriggers: [routine("app"), routine("off", { enabled: false }), routine("other", { botId: "other" })],
+ webhooks: [routine("hook"), { ...routine("post"), delivery: "post" }, { ...routine("room-hook"), groupId: "room" }],
+ });
+ expect(text).toContain('"schedule":"app_event"');
+ expect(text).toContain('"schedule":"webhook"');
+ for (const id of ["off", "other", "post", "room-hook"]) expect(text).not.toContain(`"id":"${id}"`);
+ expect(context([], { appTriggers: [routine("private", { sourceThreadId: "bob" })], webhooks: [routine("unknown")], include: () => false })).toBe("");
+ });
+
+ it("caps count, each preview and the whole part even with escaped text", () => {
+ const list = Array.from({ length: 30 }, (_, i) => routine(`id-${i}`, {
+ name: '"\\\n'.repeat(200), prompt: '"\\\n'.repeat(20_000), createdAt: i,
+ }));
+ const text = context(list, { title: () => '"\\\n'.repeat(200) });
+ expect(text.length).toBeLessThanOrEqual(ACTIVE_ROUTINES_MAX_CHARS);
+ const records = text.split("\n").filter(line => line.startsWith("{")).map(line => JSON.parse(line));
+ expect(records.length).toBeGreaterThan(0);
+ expect(records.length).toBeLessThanOrEqual(ACTIVE_ROUTINES_MAX_COUNT);
+ expect(records[0].id).toBe("id-29");
+ expect(records[0].instructions.length).toBeLessThanOrEqual(500);
+ expect(context(Array.from({ length: 30 }, (_, i) => routine(String(i)))).match(/"id":/g)).toHaveLength(ACTIVE_ROUTINES_MAX_COUNT);
+ });
+
+ it("uses the conversation audience for source and results and refuses missing provenance when scoped", () => {
+ const alice = memberAudience("alice");
+ const audiences = new Map([["alice", alice], ["bob", memberAudience("bob")], ["team", "team" as const]]);
+ const include = (id: string) => audiences.has(id) && mayRead(audiences.get(id)!, alice);
+ const title = (id: string) => `Title ${id}`;
+ const text = context([
+ routine("own", { sourceThreadId: "alice" }), routine("shared", { sourceThreadId: "team" }),
+ routine("private", { sourceThreadId: "bob" }), routine("missing"),
+ routine("gone", { sourceThreadId: "deleted" }), routine("private-results", { sourceThreadId: "team", resultsThreadId: "bob" }),
+ ], { include, title });
+ expect(text).toContain('"id":"own"');
+ expect(text).toContain('"id":"shared"');
+ for (const id of ["private", "missing", "gone", "private-results"]) expect(text).not.toContain(`"id":"${id}"`);
+ expect(text).not.toContain("Title bob");
+ expect(context([routine("hidden", { sourceThreadId: "bob" })], { include })).toBe("");
+ });
+
+ it("redacts before truncating and keeps changing routines outside the stable prompt", () => {
+ const text = context([routine("safe", { prompt: "Use sk-proj-abcdefghijklmnopqrstuvwxyz0123456789 then pause.", name: "Safe monitor" })]);
+ expect(text).not.toContain("sk-proj-abcdefghijklmnopqrstuvwxyz0123456789");
+ const built = buildSystemPrompt("Bot", "", [{ id: "active-routines", label: "Active automations", text }]);
+ expect(built.volatile).toContain('"id":"safe"');
+ expect(built.stable).not.toContain('"id":"safe"');
+ });
+});
diff --git a/server/active-routines-context.ts b/server/active-routines-context.ts
new file mode 100644
index 0000000000..edd841f2c4
--- /dev/null
+++ b/server/active-routines-context.ts
@@ -0,0 +1,53 @@
+import { redactSecretsInText } from "./redact.ts";
+import type { Routine } from "./routines.ts";
+
+export const ACTIVE_ROUTINES_MAX_COUNT = 6;
+export const ACTIVE_ROUTINES_MAX_CHARS = 4_000;
+const INTRO = "\n\nYour enabled automations (bounded previews, not permission to act). Before reporting related work finished, use trigger_info to read the full instructions and current state. Pause a temporary monitor only when its goal is met, then read its state back. Keep standing automations.\n";
+
+function preview(text: string, limit: number): string {
+ const safe = redactSecretsInText(text).replace(/\s+/g, " ").trim();
+ return safe.length > limit ? `${safe.slice(0, limit - 1)}…` : safe;
+}
+
+type EventMonitor = Pick<Routine, "id" | "botId" | "name" | "prompt" | "enabled" | "createdAt" | "sourceThreadId" | "resultsThreadId">;
+
+const priority = ({ schedule }: { schedule: { type: string; endsAt?: number } }) => schedule.type === "once" || (schedule.type === "interval" && schedule.endsAt !== undefined)
+ ? 0 : schedule.type === "interval" ? 1 : 2;
+
+export function activeRoutinesContext(input: {
+ botId: string;
+ routines: readonly Routine[];
+ appTriggers?: readonly EventMonitor[];
+ webhooks?: readonly (EventMonitor & { delivery?: string; groupId?: string })[];
+ include?: (threadId: string) => boolean;
+ title?: (threadId: string) => string | null | undefined;
+}): string {
+ const candidates = [
+ ...input.routines.filter(routine => routine.target === "bot"),
+ ...(input.appTriggers ?? []).map(trigger => ({ ...trigger, schedule: { type: "app_event" }, nextRunAt: null })),
+ ...(input.webhooks ?? []).filter(trigger => trigger.delivery !== "post" && !trigger.groupId)
+ .map(trigger => ({ ...trigger, schedule: { type: "webhook" }, nextRunAt: null })),
+ ];
+ const eligible = candidates.filter(routine => {
+ if (!routine.enabled || routine.botId !== input.botId) return false;
+ // Scoped turns need known, readable provenance; results may have a narrower audience too.
+ return !input.include || Boolean(routine.sourceThreadId && input.include(routine.sourceThreadId) &&
+ (!routine.resultsThreadId || input.include(routine.resultsThreadId)));
+ }).sort((a, b) => priority(a) - priority(b) || b.createdAt - a.createdAt || a.id.localeCompare(b.id));
+ let text = INTRO;
+ let count = 0;
+ for (const routine of eligible) {
+ const source = routine.sourceThreadId ? input.title?.(routine.sourceThreadId) : undefined;
+ const next = routine.nextRunAt === null ? null : new Date(routine.nextRunAt);
+ const entry = JSON.stringify({
+ id: routine.id, name: preview(routine.name, 80), schedule: routine.schedule.type,
+ nextRun: next && Number.isFinite(next.getTime()) ? next.toISOString() : null,
+ ...(source ? { source: preview(source, 80) } : {}), instructions: preview(routine.prompt, 500),
+ }) + "\n";
+ if (text.length + entry.length > ACTIVE_ROUTINES_MAX_CHARS) break;
+ text += entry;
+ if (++count === ACTIVE_ROUTINES_MAX_COUNT) break;
+ }
+ return count ? text : "";
+}
diff --git a/server/cloud-owner-lines.test.ts b/server/cloud-owner-lines.test.ts
index 327bbf6d5d..297512a49b 100644
--- a/server/cloud-owner-lines.test.ts
+++ b/server/cloud-owner-lines.test.ts
@@ -12,9 +12,9 @@ describe("a line its owner wrote on the computer it came from", () => {
});
it("is never another's words or an automation's, however it arrives", () => {
- const routine = composeExecutionPrompt({ name: "Morning brief", trigger: "schedule", runOn: "maus" }, "Read my inbox.", []);
- const byHand = composeExecutionPrompt({ name: "Morning brief", trigger: "manual", runOn: "maus" }, "Read my inbox.", []);
- const hook = composeExecutionPrompt({ name: "Inbox", trigger: "webhook", runOn: "maus" }, "[USER-CONFIGURED WEBHOOK INSTRUCTIONS]\nHandle it.\n[/USER-CONFIGURED WEBHOOK INSTRUCTIONS]\n\n[UNTRUSTED WEBHOOK EVENT DATA]\n{}\n[/UNTRUSTED WEBHOOK EVENT DATA]", []);
+ const routine = composeExecutionPrompt({ id: "routine-id", name: "Morning brief", trigger: "schedule", runOn: "maus" }, "Read my inbox.", []);
+ const byHand = composeExecutionPrompt({ id: "routine-id", name: "Morning brief", trigger: "manual", runOn: "maus" }, "Read my inbox.", []);
+ const hook = composeExecutionPrompt({ id: "routine-id", name: "Inbox", trigger: "webhook", runOn: "maus" }, "[USER-CONFIGURED WEBHOOK INSTRUCTIONS]\nHandle it.\n[/USER-CONFIGURED WEBHOOK INSTRUCTIONS]\n\n[UNTRUSTED WEBHOOK EVENT DATA]\n{}\n[/UNTRUSTED WEBHOOK EVENT DATA]", []);
const event = "[USER-CONFIGURED TRIGGER INSTRUCTIONS]\nDraft a reply.\n[/USER-CONFIGURED TRIGGER INSTRUCTIONS]\n[UNTRUSTED APP EVENT DATA]\n{}\n[/UNTRUSTED APP EVENT DATA]";
for (const other of [
line({ sender: { name: "Guest", id: "p_guest" } }),
diff --git a/server/drivers/agents-catalog-goldens/full.tools-list.json b/server/drivers/agents-catalog-goldens/full.tools-list.json
index 23d99d5231..7076571593 100644
--- a/server/drivers/agents-catalog-goldens/full.tools-list.json
+++ b/server/drivers/agents-catalog-goldens/full.tools-list.json
@@ -1231,7 +1231,7 @@
},
{
"name": "trigger_info",
- "description": "Read this bot's triggers (was list_triggers / list_trigger_events). list: its routines (schedules), app events and webhooks: ids, when they fire, on or paused, next run or last fire, problems, and the computer's authoritative current time and timezone; trigger_id gives one trigger with its last 10 fires, and with include_address a webhook's private address, to paste into the setup of the app that sends to it. events: before a when=app_event trigger, the connected apps you may use, with their accounts and events, and popular apps not connected yet.",
+ "description": "Read this bot's triggers (was list_triggers / list_trigger_events). list: its routines (schedules), app events and webhooks: ids, when they fire, on or paused, next run or last fire, problems, and the computer's authoritative current time and timezone; trigger_id gives one trigger with its last 10 fires, and with include_address a webhook's private address, to paste into the setup of the app that sends to it. Before reporting completion, inspect related monitors and verify enabled=false and nextRunAt=null after stopping them with trigger. events: before a when=app_event trigger, the connected apps you may use, with their accounts and events, and popular apps not connected yet.",
"inputSchema": {
"type": "object",
"additionalProperties": false,
@@ -1277,7 +1277,7 @@
},
{
"name": "trigger",
- "description": "Set up or change work that happens on its own (was create_trigger / manage_trigger): when <something happens>, a bot does <instructions>. create in this turn whenever the person describes recurring or event-based work (\"every morning send me…\", \"whenever I get an email from…\", \"when another app calls…\"); never ask for confirmation first. when=schedule runs on a time rule, cron included (call trigger_info first for relative dates: it has the authoritative time and timezone); when=app_event runs when something happens in a connected app (trigger_info action=events first; prefer it to a schedule that keeps checking); when=webhook gives an address another app sends to: the result carries its private address, so you can paste it into that app's setup yourself (never anywhere else). when=limit_reset runs when an AI's usage limit resets (\"run this when my limit resets\", or to finish work your own limit stopped). To the person these are automations: write name and instructions as they would say them. Something to do once, now, is not a trigger. update (only the fields to change), pause, resume and run_now (an app event or webhook gets a test event) act on one of the bot's routines, app events or webhooks, by its trigger_id from trigger_info; delete_trigger deletes one. Each applies at once; the person sees it with Edit, Pause and Undo. for_bot_id: a trigger of ANOTHER bot in your section, which keeps that bot's engine and permissions.",
+ "description": "Set up or change work that happens on its own (was create_trigger / manage_trigger): when <something happens>, a bot does <instructions>. create in this turn whenever the person describes recurring or event-based work (\"every morning send me…\", \"whenever I get an email from…\", \"when another app calls…\"); never ask for confirmation first. when=schedule runs on a time rule, cron included (call trigger_info first for relative dates: it has the authoritative time and timezone); when=app_event runs when something happens in a connected app (trigger_info action=events first; prefer it to a schedule that keeps checking); when=webhook gives an address another app sends to: the result carries its private address, so you can paste it into that app's setup yourself (never anywhere else). when=limit_reset runs when an AI's usage limit resets (\"run this when my limit resets\", or to finish work your own limit stopped). To the person these are automations: write name and instructions as they would say them. Something to do once, now, is not a trigger. update (only the fields to change), pause, resume and run_now (an app event or webhook gets a test event) act on one of the bot's routines, app events or webhooks, by its trigger_id from trigger_info. Before reporting a task finished, inspect related automations with trigger_info; pause a temporary monitor whose goal is met, then read its state back. Keep standing automations; delete_trigger deletes one only at the person's explicit request. Each applies at once; the person sees it with Edit, Pause and Undo. for_bot_id: a trigger of ANOTHER bot in your section, which keeps that bot's engine and permissions.",
"inputSchema": {
"type": "object",
"additionalProperties": false,
diff --git a/server/drivers/agents-catalog-goldens/profiles.json b/server/drivers/agents-catalog-goldens/profiles.json
index f7775fbb7e..7760fc6aca 100644
--- a/server/drivers/agents-catalog-goldens/profiles.json
+++ b/server/drivers/agents-catalog-goldens/profiles.json
@@ -1,7 +1,7 @@
{
"default": {
- "bytes": 56624,
- "sha256": "e66b25328e2af9b45c980617ed466a492f4aa9b97d675f41f9fe06327617e3fa",
+ "bytes": 56973,
+ "sha256": "b31e21d737c0a33e5a90157245b4354e3fbc5d002ba77b9851c8d53ba83bed46",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -49,8 +49,8 @@
]
},
"voice": {
- "bytes": 57405,
- "sha256": "01f2d2c619bbdaca6054e50ef567f232c58dc9dfa3a7f6b5847ea3a9dc70d84d",
+ "bytes": 57754,
+ "sha256": "210969e0f67929da8a575d6c3ca525f643db514dbb2c92fec5741b24735c0521",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -99,8 +99,8 @@
]
},
"shared": {
- "bytes": 58855,
- "sha256": "cd18a44cda3d213333815dbdc49adb41f6554b5d8f4f616df512e9b2486c2848",
+ "bytes": 59204,
+ "sha256": "06613bf5cb3858edf88aae0b03de27cb51c24b591753a55974cb9ca7acdbcb3d",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -150,8 +150,8 @@
]
},
"shared+voice": {
- "bytes": 59636,
- "sha256": "ec42f87cc1fff8c559d789ace2bfe0305159144833f79651f7fa69d17a699947",
+ "bytes": 59985,
+ "sha256": "8877044c1cc8e8ca3828f7243bf8786306a72c95876a8c9421a84753260dc966",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -202,8 +202,8 @@
]
},
"skills": {
- "bytes": 59443,
- "sha256": "a6b159bd81b0a97c6254535de48ace743d6003afd47aa294136f282583334a41",
+ "bytes": 59792,
+ "sha256": "100052a7648b7d3637a2ad1fbe59cad2ce9a1595d99fbf949577f226ae8366c6",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -253,8 +253,8 @@
]
},
"skills+voice": {
- "bytes": 60224,
- "sha256": "b5f0c3cbcc4f59467218a8b4758e2fafddc47717dbe735795f5f881695416bb6",
+ "bytes": 60573,
+ "sha256": "6b9d12f23fb6f47d90cab6078908f57e538afe74cb7d9b5e52bdf78f7ebf7674",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -305,8 +305,8 @@
]
},
"skills+shared": {
- "bytes": 61674,
- "sha256": "4e4f8e380516807ef2a81eee2f2d4eea64eb679490ba6c078334bdcfb7c12b86",
+ "bytes": 62023,
+ "sha256": "863edd9f7bf2ae15048d0ed123000e9739cdf0fe78d933972c061dd4fb52933f",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -358,8 +358,8 @@
]
},
"skills+shared+voice": {
- "bytes": 62455,
- "sha256": "d94a3780ca969a304217866a2364f5c3ef140f34996de8dec742449eacf26169",
+ "bytes": 62804,
+ "sha256": "6bb468e9a83bdfe743279dde649d676fc3e7c6556db2b10f423cc01614ca8e07",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -412,8 +412,8 @@
]
},
"non-chief": {
- "bytes": 47567,
- "sha256": "b4e788609224b3218c936cd9fef912b2113e09425ed667b53f51be1db7032ba2",
+ "bytes": 47916,
+ "sha256": "43fc0c3140536a1cad874cd9fddd3cfa6d4d09412fd0d1f54f9bc0bcd564d44f",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -454,8 +454,8 @@
]
},
"voice+non-chief": {
- "bytes": 48348,
- "sha256": "38f22f6df9e0db390000ba4f6387b3229901449e66d3af3f8f9b3903123e9ebb",
+ "bytes": 48697,
+ "sha256": "2743761b3a6fb804d6e03d78108238854ef1e297924c4ed397d9ac3b7d549e2d",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -497,8 +497,8 @@
]
},
"shared+non-chief": {
- "bytes": 49798,
- "sha256": "da9649b9a71c402d8220dad2e95f331ac4fcf7a3b6661361cfa2b94a966abe93",
+ "bytes": 50147,
+ "sha256": "51aee02292a82ee66e33401318765831a2adc71a13ecf6e9e793f5a8472f74af",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -541,8 +541,8 @@
]
},
"shared+voice+non-chief": {
- "bytes": 50579,
- "sha256": "fd45d1f5608b1f7221956ad7d8d9a8921f20d44ca84faeeae263d6b2aed6807d",
+ "bytes": 50928,
+ "sha256": "ac87f50cf6cd36c056210d02833452b74cbb010a027df72afbdf6097dc3958de",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -586,8 +586,8 @@
]
},
"skills+non-chief": {
- "bytes": 50386,
- "sha256": "03582f8ced0381de4db6155406de3fcf06fc8258c0d147c7f91dda5a0649721a",
+ "bytes": 50735,
+ "sha256": "4540f2f7a358237f2d270a09790fd928f1800f16a0593df58c8678182668c5a6",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -630,8 +630,8 @@
]
},
"skills+voice+non-chief": {
- "bytes": 51167,
- "sha256": "cfef5d5bff8977e9bba4c2dd1b8eeb1ac7fa750b348adaf974d6a672e5c80721",
+ "bytes": 51516,
+ "sha256": "611f613af2d836a41f9ef99988fff006085572598bc0497985077f1485fc249d",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -675,8 +675,8 @@
]
},
"skills+shared+non-chief": {
- "bytes": 52617,
- "sha256": "62f05b964a208c51ba3fca8ab311178145aeb14970770ac36b6f6a0250809cf3",
+ "bytes": 52966,
+ "sha256": "61e67da15c24ce4a53bee52e61e3871121dbbdf8f6a8293b77cd8b506dd19fa8",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -721,8 +721,8 @@
]
},
"skills+shared+voice+non-chief": {
- "bytes": 53398,
- "sha256": "72c9e5511fcb458515ced183a27e620b1c3929e4f6c34a05bc5585b29618a979",
+ "bytes": 53747,
+ "sha256": "2e62e40992f3c5a9abb8548256dd6b92e6e67d46aa3c723d3be67379fa18cb35",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -768,8 +768,8 @@
]
},
"skills+shared+voice+cloud-home": {
- "bytes": 61536,
- "sha256": "5223baa1cadbc6828e9bb9981904ec7b4c53d4b7948d930b87230b8b1615c516",
+ "bytes": 61885,
+ "sha256": "c10fb9e4caa267ac3404f0818753b5f4f7bb95d87445839f0985d272fa0faa0e",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -821,8 +821,8 @@
]
},
"skills+shared+voice+non-chief+cloud-home": {
- "bytes": 52479,
- "sha256": "5c473710c00a9f36971fed3a6cf66a8189463858d26d4927650a81dd6a5b471e",
+ "bytes": 52828,
+ "sha256": "aa9a4a6187f3a2de37701eabf5dd12ed11147973967c4ab9cebba787d70b15f8",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -867,8 +867,8 @@
]
},
"skills+shared+voice+escalations": {
- "bytes": 63285,
- "sha256": "d93590f4975fc6c40b6a91116cb15532fca0e2ea0f34cc51a95f9e171ece3236",
+ "bytes": 63634,
+ "sha256": "42b08fdbc53f679a5e480d93c16b1afba94ab30bcb11513491fabbe414788192",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -922,8 +922,8 @@
]
},
"skills+shared+voice+escalations+x": {
- "bytes": 67124,
- "sha256": "6075c49d8486e424ac1ebf2c200d7aab9a9d4216357bc88931eb07b01203d0af",
+ "bytes": 67473,
+ "sha256": "0774ba1edf8545bd566cee21b498c83e40d394d67407858f767080f82c285f19",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -981,8 +981,8 @@
]
},
"skills+shared+voice+escalations+x+team": {
- "bytes": 67756,
- "sha256": "c87fc05711552cd4fd067ce8c56969aa076bdd2df47564de23ac3576fa421d73",
+ "bytes": 68105,
+ "sha256": "9bf33e7232e29cf57a51616efe48747958564cbc3864fc2bd34155309029e0f1",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -1041,8 +1041,8 @@
]
},
"default+legacy-switches": {
- "bytes": 56624,
- "sha256": "e66b25328e2af9b45c980617ed466a492f4aa9b97d675f41f9fe06327617e3fa",
+ "bytes": 56973,
+ "sha256": "b31e21d737c0a33e5a90157245b4354e3fbc5d002ba77b9851c8d53ba83bed46",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -1090,8 +1090,8 @@
]
},
"default+mausbot": {
- "bytes": 57275,
- "sha256": "d52b2c15fbb96184184553d400e00402c53aeb0b431cd6e96992d4a43d7bbb82",
+ "bytes": 57624,
+ "sha256": "e4b30734988432a23fe06e548607428eeb009d032b219205148b37fcaecd9cd8",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -1141,8 +1141,8 @@
]
},
"skills+shared+voice+mausbot": {
- "bytes": 63106,
- "sha256": "37c4463e026372bb4c16bae7f7d277c27cf2c79863553644e5c19f7307ed5339",
+ "bytes": 63455,
+ "sha256": "f3b49e027e0db3a93be882be4aac29702a4745cf30cf2dc6bf657f62b8fba923",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -1197,8 +1197,8 @@
]
},
"default+no-computer-pick": {
- "bytes": 55412,
- "sha256": "327f708a442a6e29ef6e0e34c81e1ff89327c4420ad60e126c0fbe93f5340605",
+ "bytes": 55761,
+ "sha256": "9a5d722fadd67ce6b8aa773c7cc43f38874628470b71c66247096b7950c38a27",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -1245,8 +1245,8 @@
]
},
"default+room": {
- "bytes": 48494,
- "sha256": "d9dde7446473263e481151696b40955653ee9c80fc395f5dba8963f5088db171",
+ "bytes": 48843,
+ "sha256": "2f609620d315e56122aad79c5d196ffedc150fbe821084d0d13bb83de25a9338",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -1288,8 +1288,8 @@
]
},
"non-chief+room": {
- "bytes": 39437,
- "sha256": "c9e8d8e802b058eb78dfd5b8fe2de4b533b2fe8a4856a24eb49405ee6aa658d5",
+ "bytes": 39786,
+ "sha256": "0f037fce04eb4a448cc1125b3f4115f4774968d0d9ee392e34b166c7cdfaa5ce",
"tools": [
"tool_result_read",
"list_room_targets",
diff --git a/server/drivers/agents-catalog.ts b/server/drivers/agents-catalog.ts
index a5c84656c6..a03548674e 100644
--- a/server/drivers/agents-catalog.ts
+++ b/server/drivers/agents-catalog.ts
@@ -589,7 +589,7 @@ const TOOL_DEFINITIONS = [
{
name: "trigger_info",
description:
- "Read this bot's triggers (was list_triggers / list_trigger_events). list: its routines (schedules), app events and webhooks: ids, when they fire, on or paused, next run or last fire, problems, and the computer's authoritative current time and timezone; trigger_id gives one trigger with its last 10 fires, and with include_address a webhook's private address, to paste into the setup of the app that sends to it. events: before a when=app_event trigger, the connected apps you may use, with their accounts and events, and popular apps not connected yet.",
+ "Read this bot's triggers (was list_triggers / list_trigger_events). list: its routines (schedules), app events and webhooks: ids, when they fire, on or paused, next run or last fire, problems, and the computer's authoritative current time and timezone; trigger_id gives one trigger with its last 10 fires, and with include_address a webhook's private address, to paste into the setup of the app that sends to it. Before reporting completion, inspect related monitors and verify enabled=false and nextRunAt=null after stopping them with trigger. events: before a when=app_event trigger, the connected apps you may use, with their accounts and events, and popular apps not connected yet.",
inputSchema: {
type: "object",
additionalProperties: false,
@@ -607,7 +607,7 @@ const TOOL_DEFINITIONS = [
{
name: "trigger",
description:
- "Set up or change work that happens on its own (was create_trigger / manage_trigger): when <something happens>, a bot does <instructions>. create in this turn whenever the person describes recurring or event-based work (\"every morning send me…\", \"whenever I get an email from…\", \"when another app calls…\"); never ask for confirmation first. when=schedule runs on a time rule, cron included (call trigger_info first for relative dates: it has the authoritative time and timezone); when=app_event runs when something happens in a connected app (trigger_info action=events first; prefer it to a schedule that keeps checking); when=webhook gives an address another app sends to: the result carries its private address, so you can paste it into that app's setup yourself (never anywhere else). when=limit_reset runs when an AI's usage limit resets (\"run this when my limit resets\", or to finish work your own limit stopped). To the person these are automations: write name and instructions as they would say them. Something to do once, now, is not a trigger. update (only the fields to change), pause, resume and run_now (an app event or webhook gets a test event) act on one of the bot's routines, app events or webhooks, by its trigger_id from trigger_info; delete_trigger deletes one. Each applies at once; the person sees it with Edit, Pause and Undo. for_bot_id: a trigger of ANOTHER bot in your section, which keeps that bot's engine and permissions.",
+ "Set up or change work that happens on its own (was create_trigger / manage_trigger): when <something happens>, a bot does <instructions>. create in this turn whenever the person describes recurring or event-based work (\"every morning send me…\", \"whenever I get an email from…\", \"when another app calls…\"); never ask for confirmation first. when=schedule runs on a time rule, cron included (call trigger_info first for relative dates: it has the authoritative time and timezone); when=app_event runs when something happens in a connected app (trigger_info action=events first; prefer it to a schedule that keeps checking); when=webhook gives an address another app sends to: the result carries its private address, so you can paste it into that app's setup yourself (never anywhere else). when=limit_reset runs when an AI's usage limit resets (\"run this when my limit resets\", or to finish work your own limit stopped). To the person these are automations: write name and instructions as they would say them. Something to do once, now, is not a trigger. update (only the fields to change), pause, resume and run_now (an app event or webhook gets a test event) act on one of the bot's routines, app events or webhooks, by its trigger_id from trigger_info. Before reporting a task finished, inspect related automations with trigger_info; pause a temporary monitor whose goal is met, then read its state back. Keep standing automations; delete_trigger deletes one only at the person's explicit request. Each applies at once; the person sees it with Edit, Pause and Undo. for_bot_id: a trigger of ANOTHER bot in your section, which keeps that bot's engine and permissions.",
inputSchema: {
type: "object",
additionalProperties: false,
diff --git a/server/index.ts b/server/index.ts
index 416ac8f1d4..d47624b910 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -404,7 +404,7 @@ import {
PROFILE_PROMPT,
TEAM_MEMORY_PROMPT,
TRIGGER_PROMPT,
- ROUTINE_EXECUTION_PROMPT,
+ ROUTINE_EXECUTION_PROMPT, READ_ONLY_ROUTINE_EXECUTION_PROMPT,
WEBHOOK_PROMPT, AUTOMATION_REPLY_PROMPT,
resolveComputerPromptKind,
savedLoginsPrompt,
@@ -449,6 +449,7 @@ import { createBrowserHost } from "./host/browser.ts";
import { createScreenFrameSource, rememberTurnFrame, type ScreenCapture } from "./screen-frame-source.ts";
import { screenFrameHash, screenSurfaceForTool, screenTouchingTool, settledFrameIsNews } from "./screen-frame-gate.ts";
import { asSchedule, RoutineRequestService } from "./routine-requests.ts"; import { ownerSpokeOnly } from "./cloud-routine-level.ts"; import { routineRunCard, routineRunFallbackText } from "./routine-run-card.ts";
+import { activeRoutinesContext } from "./active-routines-context.ts";
import { automationContextText, createAutomationReports, newestAutomationLines } from "./automation-reports.ts"; import { createAutomationDestinations } from "./automation-destinations.ts"; import { createProactive } from "./host/proactive.ts"; import { createFirstHourHooks, startFirstHour, welcomeDonePatch } from "./host/first-hour-host.ts"; import { greetingMessage } from "./host/first-hour.ts"; import { READ_AND_DRAFT_PARTS, READ_AND_DRAFT_REFUSAL, READ_AND_DRAFT_TOOLS, recordsAnswer } from "./read-and-draft.ts"; import { createPresenceRoutes } from "./routes/presence.ts"; import { needsYouNow } from "./today.ts";
import { engineLabel, LimitResetClock, nearLimitNote } from "./limit-resets.ts"; import { planAccountsFromInstances } from "./plan-usage.ts"; import { LimitFailovers, limitBackupAllowed } from "./limit-failover.ts"; import { createLimitResetRoutes } from "./routes/limit-resets.ts";
import { parseTriggerRequest, triggerTarget } from "./trigger-tools.ts"; import { WebhookRequestError, WebhookRequestService } from "./webhook-requests.ts"; import { createAppTriggerHost } from "./app-trigger-host.ts";
@@ -8520,7 +8521,12 @@ async function startTurn(
{ id: "credential", label: "Credentials", text: credentialPrompt },
{ id: "recall", label: "Recall", text: recallPrompt },
{ id: "routine", label: "Routines", text: routinePrompt },
- { id: "routine-execution", label: "Routine execution", text: opts?.automationSource === "schedule" || opts?.automationSource === "manual" || opts?.automationSource === "startup" ? ROUTINE_EXECUTION_PROMPT : "" },
+ { id: "active-routines", label: "Active automations", text: integrations.agents && !confined && (!CLOUD_HOME || cloudOwnerOnlyThread(threadId)) ? activeRoutinesContext({
+ botId: bot.id, routines: routines?.listRoutines() ?? [], appTriggers: appTriggers.manager.list(), webhooks: webhooks.list(),
+ include: (CLOUD_TEAM || CLOUD_HOME) ? (id) => Boolean(threadOwner(id)) && (recentWorkFilter(threadId).include?.(id) ?? false) : undefined,
+ title: (id) => store.taskByThread(bot.id, id)?.title ?? store.groupByThread(id)?.name,
+ }) : "" },
+ { id: "routine-execution", label: "Routine execution", text: opts?.automationSource === "schedule" || opts?.automationSource === "manual" || opts?.automationSource === "startup" ? (confined ? READ_ONLY_ROUTINE_EXECUTION_PROMPT : ROUTINE_EXECUTION_PROMPT) : "" },
{ id: "profile", label: "Profile changes", text: profilePrompt },
{ id: "learn", label: "Skill authoring", text: learnPrompt },
{ id: "section-context", label: "Section context", text: sectionContextSystemPrompt(bot.section) },
diff --git a/server/proactive-routines.e2e.test.ts b/server/proactive-routines.e2e.test.ts
index 5b02bbb369..873ae7d413 100644
--- a/server/proactive-routines.e2e.test.ts
+++ b/server/proactive-routines.e2e.test.ts
@@ -236,6 +236,9 @@ describe("a read-and-draft run", () => {
const decisions = readFileSync(join(fixture.info.dataDir, "decisions", `${month}.ndjson`), "utf8");
const dump = JSON.parse(readFileSync(fixture.fixtureDumpPath, "utf8"));
expect(Object.keys(dump.mcpConfig.mcpServers).sort()).toEqual(["agents", "composio", "ogb"]);
+ expect(dump.systemPrompt).not.toContain("Your enabled automations");
+ expect(dump.systemPrompt).not.toContain("Pause a temporary monitor");
+ expect(dump.systemPrompt).toContain("within its read-and-draft limits");
const read = transcript.find((message) => message.kind === "activity" && String(message.tool?.output).includes("GMAIL_FETCH_EMAILS"));
expect(String(read.tool.output)).toContain("[Records from a connected app (Gmail or Google Calendar).");
diff --git a/server/routine-execution.test.ts b/server/routine-execution.test.ts
index 132e65a3e2..563dce67b0 100644
--- a/server/routine-execution.test.ts
+++ b/server/routine-execution.test.ts
@@ -26,10 +26,10 @@ describe("foreignPaths", () => {
describe("composeExecutionPrompt", () => {
it("heads scheduled and manual runs with what to do now, and leaves webhook runs to their own boundary", () => {
- expect(composeExecutionPrompt({ name: "Daily [brief]\n", trigger: "schedule", runOn: "maus" }, "Write it", undefined))
- .toBe('[Scheduled routine "Daily brief" — do this now:]\nWrite it');
- expect(composeExecutionPrompt({ name: "Daily", trigger: "startup", runOn: "maus" }, "Write it", undefined))
- .toBe('[Routine "Daily" — do this now:]\nWrite it');
- expect(composeExecutionPrompt({ name: "Hook", trigger: "webhook", runOn: "maus" }, "Payload block", undefined)).toBe("Payload block");
+ expect(composeExecutionPrompt({ id: "routine-id", name: "Daily [brief]\n", trigger: "schedule", runOn: "maus" }, "Write it", undefined))
+ .toBe('[Scheduled routine "Daily brief" — do this now:]\nTrigger id: routine-id\nWrite it');
+ expect(composeExecutionPrompt({ id: "routine-id", name: "Daily", trigger: "startup", runOn: "maus" }, "Write it", undefined))
+ .toBe('[Routine "Daily" — do this now:]\nTrigger id: routine-id\nWrite it');
+ expect(composeExecutionPrompt({ id: "hook-id", name: "Hook", trigger: "webhook", runOn: "maus" }, "Payload block", undefined)).toBe("Payload block");
});
});
diff --git a/server/routine-execution.ts b/server/routine-execution.ts
index 68ff834542..b8c48434d4 100644
--- a/server/routine-execution.ts
+++ b/server/routine-execution.ts
@@ -65,13 +65,13 @@ export function continuityCarry(run: RoutineRun, routines: readonly Pick<Routine
}
export function composeExecutionPrompt(
- routine: { name: string; trigger: RoutineRunTrigger; runOn: RoutineRunOn },
+ routine: { id: string; name: string; trigger: RoutineRunTrigger; runOn: RoutineRunOn },
prompt: string,
attachments: readonly RoutineContextAttachment[] | undefined,
carry?: RoutineContinuityCarry | null,
retried?: RoutineRetryCause,
): string {
- const parts = [`${routineHeader(routine.name, routine.trigger)}${prompt}`, retried ? retryNote(retried) : ""];
+ const parts = [`${routineHeader(routine.name, routine.trigger)}${routine.trigger === "webhook" ? "" : `Trigger id: ${routine.id}\n`}${prompt}`, retried ? retryNote(retried) : ""];
const foreign = foreignPaths([prompt, ...(attachments ?? []).map((attachment) => attachment.path)], runHostPlatform(routine.runOn));
if (foreign.length) {
parts.push(`[OpenMausBot: this run is on a ${hostName(runHostPlatform(routine.runOn))} computer, where ${foreign.join(", ")} cannot exist. If the work needs ${foreign.length > 1 ? "them" : "it"}, say plainly what is missing instead of reporting success.]`);
diff --git a/server/routines.test.ts b/server/routines.test.ts
index 41aef9d9c8..23eea4df82 100644
--- a/server/routines.test.ts
+++ b/server/routines.test.ts
@@ -17,9 +17,8 @@ import {
const dirs: string[] = [];
-/** What the bot is sent: the routine header, then its instructions. */
-const routineTurn = (name: string, text: string, trigger: "schedule" | "manual" = "schedule") =>
- `[${trigger === "schedule" ? "Scheduled routine" : "Routine"} ${JSON.stringify(name)} — do this now:]\n${text}`;
+const routineTurn = (id: string, name: string, text: string, trigger: "schedule" | "manual" = "schedule") =>
+ `[${trigger === "schedule" ? "Scheduled routine" : "Routine"} ${JSON.stringify(name)} — do this now:]\nTrigger id: ${id}\n${text}`;
function tempFile() {
const dir = mkdtempSync(join(tmpdir(), "omb-routines-"));
@@ -657,7 +656,7 @@ describe("cron routines use the existing persistent scheduler", () => {
await h.manager.tick(); expect(h.started).toHaveLength(0);
h.setNow(routine.nextRunAt!);
await h.manager.tick(); await h.manager.tick();
- expect(h.started).toEqual([{ botId: "maus-1", threadId: "thread-1", prompt: routineTurn("Monthly report", "Write the report") }]);
+ expect(h.started).toEqual([{ botId: "maus-1", threadId: "thread-1", prompt: routineTurn(routine.id, "Monthly report", "Write the report") }]);
expect(h.manager.listRuns()[0]).toMatchObject({ scheduledFor: routine.nextRunAt, status: "running", triggerSource: "schedule" });
expect(h.manager.listRoutines()[0].nextRunAt).toBe(Date.parse("2026-11-01T09:00:00Z"));
});
@@ -821,8 +820,8 @@ describe("persistent routine results destinations", () => {
expect(second.resultsThreadId).toBe(first.resultsThreadId);
expect(h.created()).toBe(1);
expect(h.started).toEqual([
- { botId: "maus-1", threadId: "thread-1", prompt: routineTurn("Daily report", "Write a fresh report", "manual") },
- { botId: "maus-1", threadId: "thread-2", prompt: routineTurn("Daily report", "Write a fresh report", "manual") },
+ { botId: "maus-1", threadId: "thread-1", prompt: routineTurn(routine.id, "Daily report", "Write a fresh report", "manual") },
+ { botId: "maus-1", threadId: "thread-2", prompt: routineTurn(routine.id, "Daily report", "Write a fresh report", "manual") },
]);
complete(h, "thread-2");
const loaded = new RoutineManager(h.options);
@@ -1803,7 +1802,7 @@ describe("RoutineManager", () => {
h.setBot("ready");
await h.manager.tick();
- expect(h.started).toEqual([{ botId: "maus-2", threadId: "thread-1", prompt: routineTurn("Review queue", "Review the queue") }]);
+ expect(h.started).toEqual([{ botId: "maus-2", threadId: "thread-1", prompt: routineTurn(routine.id, "Review queue", "Review the queue") }]);
expect(h.manager.listRuns()[0]).toMatchObject({ status: "running", threadId: "thread-1" });
expect(h.manager.activeRunForBot("maus-2")?.threadId).toBe("thread-1");
expect(h.manager.isActiveThread("thread-1")).toBe(true);
@@ -1869,7 +1868,7 @@ describe("RoutineManager", () => {
expect(h.manager.update(routine.id, { name: "Renamed", prompt: "Updated" })?.nextRunAt).toBe(routine.nextRunAt);
await h.manager.tick();
expect(h.manager.listRuns()[0]).toMatchObject({ scheduledFor: routine.nextRunAt, status: "running" });
- expect(h.started[0]?.prompt).toBe(routineTurn("Renamed", "Updated"));
+ expect(h.started[0]?.prompt).toBe(routineTurn(routine.id, "Renamed", "Updated"));
});
it("keeps delegated work active through its continuation and accumulates turn costs", async () => {
@@ -1945,7 +1944,7 @@ describe("RoutineManager", () => {
const h = harness();
h.setBot("busy");
const anchorAt = new Date(2026, 7, 17, 8, 5).getTime();
- h.manager.create({
+ const routine = h.manager.create({
name: "Frequent check",
prompt: "Check the latest queue",
botId: "maus-interval",
@@ -1970,7 +1969,7 @@ describe("RoutineManager", () => {
expect(h.started).toEqual([{
botId: "maus-interval",
threadId: "thread-1",
- prompt: routineTurn("Frequent check", "Check the latest queue"),
+ prompt: routineTurn(routine.id, "Frequent check", "Check the latest queue"),
}]);
});
@@ -1978,7 +1977,7 @@ describe("RoutineManager", () => {
const mondayAtEight = new Date(2026, 7, 17, 8, 0, 0).getTime();
const h = harness(mondayAtEight);
h.setBot("busy");
- h.manager.create({
+ const routine = h.manager.create({
name: "Business-hours check",
prompt: "Check at an allowed time",
botId: "maus-interval",
@@ -2007,7 +2006,7 @@ describe("RoutineManager", () => {
expect(h.started).toEqual([{
botId: "maus-interval",
threadId: "thread-1",
- prompt: routineTurn("Business-hours check", "Check at an allowed time"),
+ prompt: routineTurn(routine.id, "Business-hours check", "Check at an allowed time"),
}]);
expect(h.manager.listRuns()[0]).toMatchObject({
status: "running",
@@ -2019,7 +2018,7 @@ describe("RoutineManager", () => {
const mondayAtEightOhFive = new Date(2026, 7, 17, 8, 5, 0).getTime();
const h = harness(mondayAtEightOhFive);
h.setBot("busy");
- h.manager.create({
+ const routine = h.manager.create({
name: "Phase-aligned check",
prompt: "Keep the original cadence",
botId: "maus-interval",
@@ -2055,7 +2054,7 @@ describe("RoutineManager", () => {
expect(h.started).toEqual([{
botId: "maus-interval",
threadId: "thread-1",
- prompt: routineTurn("Phase-aligned check", "Keep the original cadence"),
+ prompt: routineTurn(routine.id, "Phase-aligned check", "Keep the original cadence"),
}]);
expect(h.manager.listRuns()[0]).toMatchObject({
status: "running",
@@ -2523,7 +2522,7 @@ describe("RoutineManager", () => {
h.setBot("ready");
await h.manager.tick();
- expect(h.started[0]?.prompt).toBe(routineTurn("Original brief", "Use the original instructions"));
+ expect(h.started[0]?.prompt).toBe(routineTurn(routine.id, "Original brief", "Use the original instructions"));
expect(h.manager.listRuns()[0]).toMatchObject({
routineName: "Original brief",
prompt: "Use the original instructions",
@@ -2568,7 +2567,7 @@ describe("RoutineManager", () => {
h.setBot("ready");
await h.manager.tick();
expect(h.started[0]?.prompt).toBe(
- `${routineTurn("Original context", "Use the original attachment")}\n\n<attached-file path="/tmp/original.txt" name="original.txt" />`,
+ `${routineTurn(routine.id, "Original context", "Use the original attachment")}\n\n<attached-file path="/tmp/original.txt" name="original.txt" />`,
);
expect(h.manager.listRuns()[0]?.attachments?.[0]?.path).toBe("/tmp/original.txt");
expect(h.manager.listRoutines()[0]?.attachments?.[0]?.path).toBe("/tmp/replacement.txt");
@@ -2594,7 +2593,7 @@ describe("RoutineManager", () => {
await h.manager.tick();
expect(h.started[0]?.prompt).toBe(
- `${routineTurn("Inspect image", "Inspect it")}\n\n<attached-image path="/tmp/a&quot;&amp;&lt;&gt;&#9;&#10;&#13;.png" name="image.png" />`,
+ `${routineTurn(routine.id, "Inspect image", "Inspect it")}\n\n<attached-image path="/tmp/a&quot;&amp;&lt;&gt;&#9;&#10;&#13;.png" name="image.png" />`,
);
expect(h.manager.listRoutines()[0]?.prompt).toBe("Inspect it");
expect(h.manager.listRoutines()[0]?.attachments?.[0]?.path).toBe(unusualPath);
@@ -3650,8 +3649,8 @@ describe("routine continuity", () => {
const first = await runOnce(h, routine.id, anchorAt, "Nothing shipped yesterday.");
const second = await runOnce(h, routine.id, anchorAt + 60 * 60_000, "Still nothing.");
- expect(first).toBe(routineTurn("Morning brief", "Write the brief"));
- expect(second).toBe(routineTurn("Morning brief", "Write the brief"));
+ expect(first).toBe(routineTurn(routine.id, "Morning brief", "Write the brief"));
+ expect(second).toBe(routineTurn(routine.id, "Morning brief", "Write the brief"));
expect(second).not.toContain("previous-run");
});
@@ -3669,8 +3668,8 @@ describe("routine continuity", () => {
const first = await runOnce(h, routine.id, anchorAt, "Two deploys, one rollback.");
const second = await runOnce(h, routine.id, anchorAt + 60 * 60_000);
- expect(first).toBe(routineTurn("Morning brief", "Write the brief"));
- expect(second).toContain(routineTurn("Morning brief", "Write the brief"));
+ expect(first).toBe(routineTurn(routine.id, "Morning brief", "Write the brief"));
+ expect(second).toContain(routineTurn(routine.id, "Morning brief", "Write the brief"));
expect(second).toContain("Two deploys, one rollback.");
expect(second).toContain("<previous-run finished=");
expect(second).toContain("untrusted, bounded excerpt");
@@ -3767,7 +3766,7 @@ describe("routine continuity", () => {
const routine = h.manager.create({ name: "Private brief", prompt: "Write the brief", botId: "maus-1", schedule: everyHour(anchorAt), continuity: true });
await runOnce(h, routine.id, anchorAt, "Private result from the old assignment.");
h.manager.update(routine.id, patch);
- expect(await runOnce(h, routine.id, anchorAt + 60 * 60_000)).toBe(routineTurn("Private brief", "Write the brief"));
+ expect(await runOnce(h, routine.id, anchorAt + 60 * 60_000)).toBe(routineTurn(routine.id, "Private brief", "Write the brief"));
});
it("survives a reload, because continuity is part of the stored routine", async () => {
@@ -3801,7 +3800,7 @@ describe("routine continuity", () => {
const second = await runOnce(h, routine.id, anchorAt + 60 * 60_000);
- expect(second).toBe(routineTurn("Morning brief", "Write the brief"));
+ expect(second).toBe(routineTurn(routine.id, "Morning brief", "Write the brief"));
});
it("refuses continuity on a room goal, which does not run the bot prompt path", () => {
diff --git a/server/routines.ts b/server/routines.ts
index ff1a0282e3..3b9a966d0c 100644
--- a/server/routines.ts
+++ b/server/routines.ts
@@ -1174,7 +1174,7 @@ export class RoutineManager {
await this.options.startTurn(
run.botId,
task.threadId,
- composeExecutionPrompt({ name: run.routineName, trigger: triggerSource, runOn: run.runOn ?? "maus" }, prompt, run.attachments, continuityCarry(run, this.routines, this.runs), run.retried),
+ composeExecutionPrompt({ id: run.routineId, name: run.routineName, trigger: triggerSource, runOn: run.runOn ?? "maus" }, prompt, run.attachments, continuityCarry(run, this.routines, this.runs), run.retried),
run.runOn ?? "maus",
triggerSource,
(message) => this.failThread(task.threadId, message, { cause: "refused" }),
diff --git a/server/system-prompt.ts b/server/system-prompt.ts
index 25a4546d79..eb79f9e838 100644
--- a/server/system-prompt.ts
+++ b/server/system-prompt.ts
@@ -26,7 +26,7 @@ export function userProfileSystemPrompt(profile?: { aboutMe?: string; person?: s
// at the computer, or not there) and what its words switched on.
// Two per-turn sections stay stable on purpose: "setup" sits right after the standing instructions it overrides,
// and "webhook" keeps its untrusted-data rule in the system prompt, out of reach of the payload it guards.
-const VOLATILE_SECTIONS = new Set(["memory", "mentions", "outstanding", "recent", "availability",
+const VOLATILE_SECTIONS = new Set(["memory", "mentions", "outstanding", "recent", "availability", "active-routines",
"plan", "assignment", "routine-execution", "skill-instructions", "playbooks", "device-place"]);
/** Its id is what puts it in the volatile half. */
@@ -223,12 +223,16 @@ export const WIDGET_PROMPT =
" Ask only what you cannot find or sensibly default yourself, and one thing at a time. When the answer is a pick from a few options (a time, a day, one of a few choices), offer them with show_widget as tap-to-answer choices instead of asking the person to type: a Card with a Row of Buttons, one per option, whose onClickAction sends that option in one tap, at most six; the caption can say they may also just type an answer. When the person wants to change something that already exists, such as a routine, a reminder, a booking or a setting, show it as a form prefilled with its current values (each field's defaultValue), say in the caption that this is how it is set now, and give it a confirm button that saves the change, so they edit what is there instead of describing it again. Use a form with several fields only for that, or when several required details truly cannot be defaulted. A plain yes or no, such as whether to go ahead, needs no widget: ask it in one short sentence; the person answers in a word or with 👍 or 👎 on your message, and either comes back to you as their reply. Put data and comparisons in a markdown table in your message, not in a widget.";
const APPLIED_RESULT_PROMPT =
" Follow the tool result: a change you ask for (your skills, profile or model, or as a Chief a teammate's) applies immediately at every access level and the person sees it with an Undo; then continue the requested work without asking for another confirmation. Only a pending result (a Cloud conversation its owner did not drive) waits for the owner: then end the turn. Never claim success before an applied result, and report failures honestly. Full Access does not grant another bot broader permissions.";
+const AUTOMATION_COMPLETION_PROMPT =
+ " Before reporting a task finished, check its related automations with trigger_info. Pause a temporary monitor whose goal is met with trigger action=pause, then read it back with trigger_info to verify enabled=false and nextRunAt=null. Keep standing automations; delete only at the person's explicit request.";
+
export const TRIGGER_PROMPT =
- " When the person describes something that should happen on its own — on a schedule (\"every morning send me…\", \"each Friday…\"), whenever something happens in one of their apps (\"whenever I get an email from Acme…\", \"when someone posts in #sales…\") or when another app calls a link — set it up with trigger action=create in this turn. Do not ask for confirmation and do not announce it first: it applies at once and the person sees a card with Edit, Pause and Undo. Ask one short question only when something required is missing and cannot be inferred, such as which of two Gmail accounts. For anything that happens in an app, call trigger_info action=events and use when=app_event rather than a schedule that keeps checking; put who or what it is about in filter (Gmail filters at the source), and judgement (\"if it is not about an order, stop\") in the instructions. If the app is not connected yet, ask the person to connect it the usual way (a Connect card when you have connected-app tools), then create the trigger once it is. Write the instructions as complete steps for a future run that will not see this conversation, in the plain words the person would use (\"draft a reply\", \"add the lead to the sheet\"): never \"event data\", \"payload\", \"webhook\" or \"trigger\", since the person reads them as the automation's sentence and each run is already told where its event is. A request to do something once, now, is not a trigger. Then confirm in plain words what you set up and what you assumed: when it runs, with the time zone as people say it (\"weekdays at 9:00 AM India time\", never a zone id such as Asia/Kolkata), where its results will appear, what each run covers, and when the first run is. To the person these are \"automations\", never triggers or webhooks. Use trigger_info to review triggers, the trigger tool to change, pause or test them, and delete_trigger to delete one. Keep run_on omitted or maus to use the bot's current model and configured computer, including its VPS; box runs on the bot's cloud computer, only when the person wants that. Convert calendar requests such as the first or last day of each month or the second Monday to a five-field cron expression with an explicit IANA timezone; use interval for elapsed every-N-minutes work. Never replace a calendar rule with daily AI date checking or an approximate weekly schedule; clarify ambiguous or unsupported requests. For \"run this when my limit resets\" use when=limit_reset (it defaults to your own engine). When you are told your usage limit is nearly used up and the task may not finish, set up its continuation yourself with trigger action=create when=limit_reset, instructions to pick up where you stopped, and tell the person in one sentence. To tell the person when something a plain check can see happens (a page says something, a file appears or changes, a program starts or stops, another bot finishes), use wait_until instead of staying busy or making a short-interval routine, and give follow_up only when they asked for something to be done at that moment.";
+ " When the person describes something that should happen on its own — on a schedule (\"every morning send me…\", \"each Friday…\"), whenever something happens in one of their apps (\"whenever I get an email from Acme…\", \"when someone posts in #sales…\") or when another app calls a link — set it up with trigger action=create in this turn. Do not ask for confirmation and do not announce it first: it applies at once and the person sees a card with Edit, Pause and Undo. Ask one short question only when something required is missing and cannot be inferred, such as which of two Gmail accounts. For anything that happens in an app, call trigger_info action=events and use when=app_event rather than a schedule that keeps checking; put who or what it is about in filter (Gmail filters at the source), and judgement (\"if it is not about an order, stop\") in the instructions. If the app is not connected yet, ask the person to connect it the usual way (a Connect card when you have connected-app tools), then create the trigger once it is. Write the instructions as complete steps for a future run that will not see this conversation, in the plain words the person would use (\"draft a reply\", \"add the lead to the sheet\"): never \"event data\", \"payload\", \"webhook\" or \"trigger\", since the person reads them as the automation's sentence and each run is already told where its event is. A request to do something once, now, is not a trigger. Then confirm in plain words what you set up and what you assumed: when it runs, with the time zone as people say it (\"weekdays at 9:00 AM India time\", never a zone id such as Asia/Kolkata), where its results will appear, what each run covers, and when the first run is. To the person these are \"automations\", never triggers or webhooks. Use trigger_info to review triggers, the trigger tool to change, pause or test them, and delete_trigger to delete one. Keep run_on omitted or maus to use the bot's current model and configured computer, including its VPS; box runs on the bot's cloud computer, only when the person wants that. Convert calendar requests such as the first or last day of each month or the second Monday to a five-field cron expression with an explicit IANA timezone; use interval for elapsed every-N-minutes work. Never replace a calendar rule with daily AI date checking or an approximate weekly schedule; clarify ambiguous or unsupported requests. For \"run this when my limit resets\" use when=limit_reset (it defaults to your own engine). When you are told your usage limit is nearly used up and the task may not finish, set up its continuation yourself with trigger action=create when=limit_reset, instructions to pick up where you stopped, and tell the person in one sentence. To tell the person when something a plain check can see happens (a page says something, a file appears or changes, a program starts or stops, another bot finishes), use wait_until instead of staying busy or making a short-interval routine, and give follow_up only when they asked for something to be done at that moment." + AUTOMATION_COMPLETION_PROMPT;
export const AUTOMATION_REPLY_PROMPT =
" Only your final reply leaves this run: it is posted in your chat with the person under this automation's name, and your steps stay here. Write it for them, in plain words. If nothing needs their attention this time, reply with just NOTHING NEW and nothing is posted. If you need something only they can give, such as a decision or a missing detail, end with a line that starts with NEEDS INPUT: and the question; they answer in that chat. Ask in words, not with show_widget: they do not see this conversation.";
+export const READ_ONLY_ROUTINE_EXECUTION_PROMPT = " Execute this automation now within its read-and-draft limits.";
export const ROUTINE_EXECUTION_PROMPT =
- " Execute this routine now: use coordinate_bots for required handoffs rather than merely announcing that you will wait; after an accepted hand-off, end this turn for automatic resumption, and report a concrete blocker if no handoff is possible.";
+ " Execute this routine now: use coordinate_bots for required handoffs rather than merely announcing that you will wait; after an accepted hand-off, end this turn for automatic resumption, and report a concrete blocker if no handoff is possible." + AUTOMATION_COMPLETION_PROMPT;
export const LEARN_PROMPT =
" If the user sends /learn or asks you to save a reusable procedure from this work, use skills_list and skill_manage. Create new skills; update an existing learned skill only when the user explicitly asks to revise that exact name. Include source provenance." + APPLIED_RESULT_PROMPT;
export const WEBHOOK_PROMPT =