show_summary
Retrieve a one-paragraph summary of each model's plan for a specific round, giving a quick overview of all positions.
Instructions
One-paragraph summary of each model's plan — quick overview of all positions
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| round | No | Which round to summarize (defaults to latest round with plans) | |
| modelName | No | Your model name (optional) |
Implementation Reference
- src/server.ts:261-274 (registration)Registration of the show_summary tool with MCP server, defining its schema (optional round and modelName parameters) and delegating to executeSummary handler.
// ─── show_summary ───────────────────────────────────────────────── server.tool( "show_summary", "One-paragraph summary of each model's plan — quick overview of all positions", { round: z.enum(["round1", "round2", "final"]).optional().describe("Which round to summarize (defaults to latest round with plans)"), modelName: z.string().optional().describe("Your model name (optional)"), }, async (params, extra) => { const identity = detectCaller(server.server.getClientVersion(), params.modelName); const formatted = await executeSummary(projectRoot, identity, params.round as Round | undefined); return { content: [{ type: "text", text: formatted }] }; } ); - src/tools/summary.ts:66-111 (handler)Core handler: reads plans for the target round (or auto-detects latest round), extracts a one-paragraph summary and topics for each plan, logs the action to history, and returns formatted output.
export async function executeSummary( projectRoot: string, identity: CallerIdentity, round?: Round ): Promise<string> { // Default to the latest round that has plans const targetRound = round ?? (await findLatestRound(projectRoot)); const plans = await readPlansByRound(projectRoot, targetRound); if (plans.length === 0) { return `No plans found for ${targetRound}. Run /polyplan ${targetRound} first.`; } const lines: string[] = []; lines.push(`SUMMARY — ${targetRound.toUpperCase()} (${plans.length} plans)`); lines.push("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"); lines.push(""); for (const plan of plans) { const modelId = `${plan.cliTool}-${plan.modelName}`; const summary = extractSummary(plan.content); const topics = extractTopics(plan.content); const wordCount = plan.content.split(/\s+/).length; lines.push(`📄 ${modelId} (${wordCount} words)`); if (topics.length > 0) { lines.push(` Sections: ${topics.join(" → ")}`); } lines.push(` Summary: ${summary}`); lines.push(""); } lines.push("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"); lines.push("💡 Read full plans in .plans/ for complete details."); await logAction( projectRoot, identity.cliTool, identity.modelName, "summary", `Viewed summary for ${targetRound}: ${plans.length} plans` ); return lines.join("\n"); } - src/tools/summary.ts:16-50 (helper)Helper that extracts the first substantial paragraph from plan markdown content (skipping headings, empty lines, and short metadata lines), truncated to max 300 characters.
function extractSummary(content: string, maxLength: number = 300): string { const lines = content.split("\n"); const paragraphs: string[] = []; let currentParagraph: string[] = []; for (const line of lines) { const trimmed = line.trim(); // Skip headings and empty lines to find content paragraphs if (trimmed.startsWith("#") || trimmed === "") { if (currentParagraph.length > 0) { paragraphs.push(currentParagraph.join(" ")); currentParagraph = []; } continue; } // Skip very short lines (likely list markers or metadata) if (trimmed.length < 10 && !trimmed.endsWith(".")) continue; currentParagraph.push(trimmed); } if (currentParagraph.length > 0) { paragraphs.push(currentParagraph.join(" ")); } // Find the first substantial paragraph const substantial = paragraphs.find((p) => p.length > 50); const summary = substantial ?? paragraphs[0] ?? "No summary available."; return summary.length > maxLength ? summary.substring(0, maxLength) + "..." : summary; } - src/tools/summary.ts:55-61 (helper)Helper that extracts up to 6 section headings (h1-h3) from plan content as key topics.
function extractTopics(content: string): string[] { return content .split("\n") .filter((line) => /^#{1,3}\s/.test(line)) .map((line) => line.replace(/^#+\s*/, "").trim()) .slice(0, 6); // Max 6 topics } - src/tools/summary.ts:116-124 (helper)Helper that finds the latest round with any plans by checking final -> round2 -> round1 in order.
async function findLatestRound(projectRoot: string): Promise<Round> { const finalPlans = await readPlansByRound(projectRoot, "final"); if (finalPlans.length > 0) return "final"; const round2Plans = await readPlansByRound(projectRoot, "round2"); if (round2Plans.length > 0) return "round2"; return "round1"; }