Search Result Summaries Implementation Plan
For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Add one-sentence wiki page summaries and show them in almanac search results.
Architecture: Parse an optional summary frontmatter field into the SQLite pages table, expose it through search/show JSON, and render summaries for scan-friendly search output. Preserve pipe-friendly slug-only output with --slugs and make explicit summary output available with --summaries.
Tech Stack: TypeScript, commander, better-sqlite3, Vitest.
Task 1: Index summary metadata#
Files:
- Modify:
src/indexer/frontmatter.ts - Modify:
src/indexer/schema.ts - Modify:
src/indexer/index.ts - Test:
test/frontmatter.test.ts
Steps:
- Add
summary?: stringtoFrontmatterand coercesummaryas a trimmed string. - Add nullable
summarytopages. - Bump
SCHEMA_VERSIONand migrate older DBs withALTER TABLE pages ADD COLUMN summary TEXT, clearingcontent_hashso summaries are populated on next reindex. - Persist
summaryin page upserts. - Add/extend tests for summary parsing and indexing through query/show surfaces.
Task 2: Render summaries in search/show#
Files:
- Modify:
src/commands/search.ts - Modify:
src/commands/show.ts - Modify:
src/cli/register-query-commands.ts - Test:
test/search.test.ts - Test:
test/show.test.ts
Steps:
- Add
summaryto search rows and JSON output. - Render summary search output as
slugfollowed by indented summary when present. - Add
--slugsto keep old one-slug-per-line output and--summariesto force summary output. - Add
summarytoShowRecordand default metadata header. - Add tests for default search summaries,
--slugs, JSON output, and show JSON/header.
Task 3: Prompt convention#
Files:
- Modify:
prompts/base/syntax.md
Steps:
- Document
summaryas a current tooling field. - Tell agents to keep it to one direct sentence that explains what the page is for.
Task 4: Verify and ship#
Commands:
npm testnpm run lintnpm run build
Commit:
feat: add search result summaries