// Fails when a built prompt names an agent product's tool by its product name. // // Prompts are read by many agents, and each one calls the same tool something // else. Prompt text says what to do ("ask with the question tool", "list the // folder") and never what one product's tool is called. This reads every // Markdown file in the built skills/ tree, so run it after // `node install.js --build-skills`. // Usage: node scripts/check-prompt-wording.mjs [skillsDir] (defaults to ./skills) import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; // Case-sensitive on purpose: "glob" and "grep" in lower case are ordinary words // and command names, "Glob" and "Grep" as tool names are what this catches. export const BANNED = [ "AskUserQuestion", "Glob", "Grep", "TodoWrite", "WebFetch", "WebSearch", "NotebookEdit", "Read tool", "Write tool", "Edit tool", "Bash tool", "ask_user_question", ]; const PATTERN = new RegExp(`(? { const m = PATTERN.exec(text); if (m) hits.push({ file: path.relative(dir, file).split(path.sep).join("/"), line: i + 1, name: m[1] }); }); } return hits; } if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { const root = path.dirname(path.dirname(fileURLToPath(import.meta.url))); const dir = process.argv[2] ? path.resolve(process.argv[2]) : path.join(root, "skills"); if (!fs.existsSync(dir)) { console.error(` FAIL ${dir} does not exist. Run: node install.js --build-skills`); process.exit(1); } const hits = findBanned(dir); if (hits.length) { for (const h of hits) console.error(` FAIL ${h.file}:${h.line} names a product tool: ${h.name}`); console.error(" Say what to do in neutral words (\"the question tool\", \"list the folder\")."); process.exit(1); } console.log("Built prompts name no product tool."); }