aide_scaffold
Create .aide spec files that enforce naming conventions: research.aide triggers rename of existing .aide to intent.aide. Supports intent, research, both, todo, plan.
Instructions
Create new .aide spec files with automatic naming convention enforcement. Handles the naming rules: intent specs are .aide by default, but become intent.aide when research.aide exists in the same folder. Creating a research.aide auto-renames any existing .aide to intent.aide.
Types:
intent — Strategy, contracts, anti-patterns
research — Sources, data, patterns (triggers rename of existing .aide)
both — Creates research.aide + intent.aide pair
todo — QA re-alignment document for QA agents
plan -- Architect's implementation plan (no naming interaction with intent/research)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| directory | Yes | Directory where the .aide file(s) will be created | |
| type | Yes | Type of .aide file to create |
Implementation Reference
- src/index.ts:111-130 (registration)Tool registration for 'aide_scaffold' — defines name, description, and inputSchema with directory (string) and type (enum: intent, research, both, todo, plan) properties as part of the ListToolsRequestSchema handler setup.
{ name: "aide_scaffold", description: "Create new .aide spec files with automatic naming convention enforcement. Handles the naming rules: intent specs are .aide by default, but become intent.aide when research.aide exists in the same folder. Creating a research.aide auto-renames any existing .aide to intent.aide.\n\nTypes:\n- intent — Strategy, contracts, anti-patterns\n- research — Sources, data, patterns (triggers rename of existing .aide)\n- both — Creates research.aide + intent.aide pair\n- todo — QA re-alignment document for QA agents\n- plan -- Architect's implementation plan (no naming interaction with intent/research)", inputSchema: { type: "object" as const, properties: { directory: { type: "string", description: "Directory where the .aide file(s) will be created", }, type: { type: "string", enum: ["intent", "research", "both", "todo", "plan"], description: "Type of .aide file to create", }, }, required: ["directory", "type"], }, }, - src/index.ts:268-272 (handler)Call handler for 'aide_scaffold' — parses args with ScaffoldInput, calls scaffold(), returns text content.
case "aide_scaffold": { const parsed = ScaffoldInput.parse(args); const result = await scaffold(root, parsed.directory, parsed.type); return { content: [{ type: "text", text: result }] }; } - src/tools/scaffold/index.ts:5-10 (schema)Zod schema ScaffoldInput — validates directory (string) and type (enum: intent, research, both, todo, plan).
export const ScaffoldInput = z.object({ directory: z.string().describe("Directory where the .aide file(s) will be created"), type: z .enum(["intent", "research", "both", "todo", "plan"]) .describe("Type of .aide file to create (intent, research, both, todo, or plan)"), }); - src/tools/scaffold/index.ts:103-160 (handler)Main scaffold function — creates .aide files with naming convention enforcement. Handles auto-rename logic (.aide -> intent.aide when research.aide exists), writes templates for intent/research/todo/plan/both types.
export default async function scaffold( root: string, directory: string, type: "intent" | "research" | "both" | "todo" | "plan", ): Promise<string> { const dir = isAbsolute(directory) ? directory : join(root, directory); // Ensure directory exists await mkdir(dir, { recursive: true }); const existing = await existingAideFiles(dir); const actions: string[] = []; if (type === "todo") { const target = join(dir, "todo.aide"); await writeFile(target, TODO_TEMPLATE, "utf-8"); actions.push("Created todo.aide"); } else if (type === "plan") { const target = join(dir, "plan.aide"); await writeFile(target, PLAN_TEMPLATE, "utf-8"); actions.push("Created plan.aide"); } else if (type === "intent") { if (existing.includes("research.aide")) { const target = join(dir, "intent.aide"); await writeFile(target, INTENT_TEMPLATE, "utf-8"); actions.push("Created intent.aide (research.aide exists, so using explicit name)"); } else { const target = join(dir, ".aide"); await writeFile(target, INTENT_TEMPLATE, "utf-8"); actions.push("Created .aide"); } } else if (type === "research") { // If .aide exists, rename to intent.aide first if (existing.includes(".aide") && !existing.includes("intent.aide")) { await rename(join(dir, ".aide"), join(dir, "intent.aide")); actions.push("Renamed .aide → intent.aide"); } const target = join(dir, "research.aide"); await writeFile(target, RESEARCH_TEMPLATE, "utf-8"); actions.push("Created research.aide"); } else if (type === "both") { // If .aide exists, remove it since we're creating intent.aide if (existing.includes(".aide") && !existing.includes("intent.aide")) { await rename(join(dir, ".aide"), join(dir, "intent.aide")); actions.push("Renamed .aide → intent.aide"); } else if (!existing.includes("intent.aide")) { await writeFile(join(dir, "intent.aide"), INTENT_TEMPLATE, "utf-8"); actions.push("Created intent.aide"); } if (!existing.includes("research.aide")) { await writeFile(join(dir, "research.aide"), RESEARCH_TEMPLATE, "utf-8"); actions.push("Created research.aide"); } } if (actions.length === 0) return "No changes needed — files already exist."; return actions.join("\n"); }