The prompt had grown to a policy document: 13 sections, the same rules repeated across them, and a state vocabulary no tool accepts. It also never mentioned the reply/task split, so the model would burn a reply's 8 tool steps on work that belongs in a 50-step task. - Lead with work placement: answer directly, start_task for its own long work, delegate_task for a worker, and say work is under way, not done. - Replace the invented Requested/Queued/Verified list with the real TaskStatuses and update_task. - Name the 19 tools it tells the coordinator to use, and which tool writes which instruction layer, instead of "the available tools". - Give routines their own section; create_schedule was uncovered. - Say each safety rule once, and keep the interrupt list short so the prompt reads as proactive rather than timid. - Drop the commented-out previous prompt: that is git's job. The test asserted a heading and a section that no longer exist, so it was already failing. It now checks the heading, the SiteData name, the absence of em dashes, the real statuses, and every tool named.
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { CoordinatorSystemPrompt } from "./coordinator-system-prompt";
|
|
import { SiteData } from "./site-data";
|
|
|
|
/**
|
|
* The prompt's own guarantees: it is markdown that names the product, it
|
|
* keeps the real task statuses and the reply/task split, and every tool it
|
|
* names is one a coordinator actually gets.
|
|
*/
|
|
describe("CoordinatorSystemPrompt", () => {
|
|
test("is markdown that opens with the coordinator heading", () => {
|
|
expect(CoordinatorSystemPrompt.startsWith("# You Are the Coordinator")).toBe(
|
|
true,
|
|
);
|
|
expect(CoordinatorSystemPrompt).toContain("\n## 1. ");
|
|
});
|
|
|
|
test("names the product from SiteData", () => {
|
|
expect(CoordinatorSystemPrompt).toContain(SiteData["SiteName"]);
|
|
});
|
|
|
|
test("has no em dashes", () => {
|
|
expect(CoordinatorSystemPrompt).not.toContain(String.fromCharCode(0x2014));
|
|
});
|
|
|
|
test("uses the real task statuses, not invented ones", () => {
|
|
for (const status of ["todo", "doing", "blocked", "done", "cancelled"]) {
|
|
expect(CoordinatorSystemPrompt).toContain(status);
|
|
}
|
|
|
|
// Words from the previous draft that no tool accepts.
|
|
for (const stale of ["Verified:", "**Requested:**", "**Queued:**"]) {
|
|
expect(CoordinatorSystemPrompt).not.toContain(stale);
|
|
}
|
|
});
|
|
|
|
test("names the tools it tells the coordinator to use", () => {
|
|
const tools = [
|
|
"start_task",
|
|
"delegate_task",
|
|
"create_bot",
|
|
"create_workspace",
|
|
"update_workspace",
|
|
"set_bot_workspace_instructions",
|
|
"update_instructions",
|
|
"update_memory",
|
|
"list_tasks",
|
|
"update_task",
|
|
"create_schedule",
|
|
"list_schedules",
|
|
"update_schedule",
|
|
"delete_schedule",
|
|
"search_computers",
|
|
"ask_user_to_take_over",
|
|
"write_file",
|
|
"make_pdf",
|
|
"generate_image",
|
|
];
|
|
|
|
for (const tool of tools) {
|
|
expect(CoordinatorSystemPrompt).toContain(tool);
|
|
}
|
|
});
|
|
});
|