ContextSearch
ContextSearch
Search prior work for: $ARGUMENTS
Usage Modes
- Standalone — Search, present findings, say: "Context loaded on [topic]. Most recent session: [X]. What would you like to do?"
- Paired with request — Search first, then execute the request informed by context.
Phase 1 — Fast Index Scan (ALL IN PARALLEL)
Run all four searches simultaneously in a single response:
1A. Session Registry
Read ~/.claude/PAI/MEMORY/STATE/work.json. Match entries where task, slug (object key), or sessionName contains "$ARGUMENTS" (case-insensitive). Extract: task, phase, progress, effort. Limit to 5 most recent matches.
1B. Session Names
Read ~/.claude/PAI/MEMORY/STATE/session-names.json. Match entries where name contains "$ARGUMENTS" (case-insensitive). Extract: sessionId, name. Limit to 5 most recent.
1C. Work Directory Names
fd -t d -i "$ARGUMENTS" ~/.claude/PAI/MEMORY/WORK/ --max-depth 1 | tail -10
1D. ISA Title Grep
Use Grep to search for "$ARGUMENTS" across ~/.claude/PAI/MEMORY/WORK/ with glob **/ISA.md. Use files_with_matches mode. Limit to 5 results.
Phase 2 — Conditional Deep Dive
SKIP Phase 2 entirely if Phase 1 returned 3+ matches. Phase 1 is usually sufficient.
Only if Phase 1 returned fewer than 3 total matches, run in parallel:
2A. PAI Git History
git -C ~/.claude log --oneline --all --grep="$ARGUMENTS" -i -10
2B. Current Project Git History
git log --oneline --all --grep="$ARGUMENTS" -i -10
After Search: Load ISA Summaries (NOT full ISAs)
From Phase 1C/1D matches, identify the 3 most recent ISAs (by directory date prefix). Read only the first 10 lines of each (title + summary). Do NOT read full ISAs — the main agent can request a full read if needed.
Output Format
Compact single list. Omit sections with no results. Keep total output under 40 lines.
═══ CONTEXT: $ARGUMENTS ═══════════════════════
📋 SESSIONS (newest first, max 5):
- [slug] — [task] | [phase] | [progress]
📂 ISA SUMMARIES (max 3):
- [dir name]: [first heading from ISA]
Path: ~/.claude/PAI/MEMORY/WORK/[dir]/ISA.md
🔗 COMMITS (if Phase 2 ran):
- [hash] [message] ([repo])
════════════════════════════════════════════════
After Results
Standalone: "Context loaded on [topic]. Most recent: [X]. What would you like to do?"
Paired: Proceed with the request. If deeper context is needed, Read the specific ISA path shown above.
Gotchas
- Searches PAI session registry, work directories, and ISAs — not published content (use _CONTENTSEARCH for that).
- Phase 1 (fast scan) may miss relevant sessions. If results seem incomplete, use phase 2 (full search).
- Session descriptions in work.json are AI-generated summaries. They may not capture every topic discussed.
Examples
Example 1: Find prior work
User: "what did we do with the Telegram bot?"
→ Phase 1: fast scan of session registry
→ Finds sessions: telegram-monitor-revival, fix-telegram-channels-plugin-broken
→ Returns session summaries with ISA links
Example 2: Resume previous work
User: "pick up where we left off on the feed system"
→ Searches work directories and ISAs
→ Finds latest ISA with phase/progress state
→ Provides context for cold-start recovery
Execution Log
After completing any workflow, append a single JSONL entry:
echo '{"ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","skill":"ContextSearch","workflow":"WORKFLOW_USED","input":"8_WORD_SUMMARY","status":"ok|error","duration_s":SECONDS}' >> ~/.claude/PAI/MEMORY/SKILLS/execution.jsonl
Replace WORKFLOW_USED with the workflow executed, 8_WORD_SUMMARY with a brief input description, and SECONDS with approximate wall-clock time. Log status: "error" if the workflow failed.
More from danielmiessler/personal_ai_infrastructure
documents
Read, write, convert, and analyze documents — routes to PDF, DOCX, XLSX, PPTX sub-skills for creation, editing, extraction, and format conversion. USE WHEN document, process file, create document, convert format, extract text, PDF, DOCX, XLSX, PPTX, Word, Excel, spreadsheet, PowerPoint, presentation, slides, consulting report, large PDF, merge PDF, fill form, tracked changes, redlining.
114council
Multi-agent collaborative debate that produces visible round-by-round transcripts with genuine intellectual friction. All council members are custom-composed via ComposeAgent (Agents skill) with domain expertise, unique voice, and personality tailored to the specific topic — never built-in generic types. ComposeAgent invoked as: bun run ~/.claude/skills/Agents/Tools/ComposeAgent.ts. Two workflows: DEBATE (3 rounds, full transcript + synthesis, parallel execution within rounds, 40-90 seconds total) and QUICK (1 round, fast perspective check). Context files: CouncilMembers.md (agent composition instructions), RoundStructure.md (three-round structure and timing), OutputFormat.md (transcript format templates). Agents are designed per debate topic to create real disagreement; 4-6 well-composed agents outperform 12 generic ones. Council is collaborative-adversarial (debate to find best path); for pure adversarial attack on an idea, use RedTeam instead. NOT FOR parallel task execution across agents (use Delegation skill). USE WHEN council, debate, multiple perspectives, weigh options, deliberate, get different views, multi-agent discussion, what would experts say, is there consensus, pros and cons from multiple angles.
112art
Generates static visual content across 20+ formats via Flux, Nano Banana Pro (Gemini 3 Pro), and GPT-Image-1. Covers blog header illustrations, editorial art, Mermaid flowcharts, technical architecture diagrams, D3.js dashboards, taxonomies, timelines, 2x2 framework matrices, comparisons, annotated screenshots, recipe cards, aphorism/quote cards, conceptual maps, stat cards, comic panels, YouTube thumbnails, PAI pack icons, and brand-logo wallpapers. Named workflows: Essay, D3Dashboards, Visualize, Mermaid, TechnicalDiagrams, Taxonomies, Timelines, Frameworks, Comparisons, AnnotatedScreenshots, RecipeCards, Aphorisms, Maps, Stats, Comics, YouTubeThumbnailChecklist, AdHocYouTubeThumbnail, CreatePAIPackIcon, LogoWallpaper, RemoveBackground. SKILLCUSTOMIZATIONS loads PREFERENCES.md, CharacterSpecs.md, and SceneConstruction.md. --remove-bg flag produces transparent-background PNG (can produce black backgrounds — verify visually). Up to 14 reference images per request (5 human, 6 object Gemini API limit). Output staged to ~/Downloads/ for preview before any project directory copy. Nano Banana Pro uses --size for resolution tier 1K/2K/4K and separate --aspect-ratio. USE WHEN: art, illustration, diagram, flowchart, infographic, header image, thumbnail, visualize, generate image, mermaid, architecture diagram, comic, icon, blog art, framework diagram, D3 chart, remove background, wallpaper. NOT FOR video or animation (use Remotion). NOT FOR the user's personal portrait/headshot (use a dedicated headshot skill).
107recon
Network reconnaissance — subdomain enumeration, port scanning, DNS/WHOIS/ASN lookups, endpoint discovery from JS, mass scanning, path discovery, CIDR/netblock analysis. Passive and active modes with corporate structure mapping and bounty program tracking. USE WHEN recon, reconnaissance, bug bounty, bounty programs, attack surface, subdomains, subdomain enumeration, port scan, mass scan, DNS, WHOIS, ASN, CIDR, netblock, IP recon, domain recon, passive recon, corporate structure, endpoint discovery, path discovery, scan results, analyze scan, update tools.
106browser
Headless browser automation via agent-browser — Rust CLI daemon with persistent auth profiles for fast, scriptable, parallel browser work. Supports batch commands, network interception, device emulation, per-site profile auth (one-time headed login, headless forever after), and parallel isolated sessions via --session. Workflows: ReviewStories (fan out YAML user stories to parallel UIReviewers), Automate (load/run parameterized recipe templates), Update. Delegates to general-purpose agents with agent-browser instructions for background parallel scraping. Falls back to Interceptor if site has bot detection. USE WHEN headless browser, batch scrape, fast screenshot, dev server test, parallel browser, background automation, extract data, review stories, automate recipe, batch screenshots, scrape multiple pages in parallel. NOT FOR deploy verification or UI confirmation with real Chrome (use Interceptor). NOT FOR simple single-URL fetching (use WebFetch). NOT FOR CAPTCHA or bot-detection bypass (use BrightData or Interceptor).
102prompting
Meta-prompting standard library — the PAI system for generating, optimizing, and composing prompts programmatically. Owns three pillars: Standards (Anthropic Claude 4.x best practices, context engineering principles, 1,500+ paper synthesis, Fabric pattern system, markdown-first / no-XML-tags); Templates (Handlebars-based — Briefing.hbs, Structure.hbs, Gate.hbs, DynamicAgent.hbs, and eval-specific templates Judge.hbs, Rubric.hbs, TestCase.hbs, Comparison.hbs, Report.hbs used by Agents and Evals skills); and Tools (RenderTemplate.ts for CLI/TypeScript rendering with data-content separation). Philosophy: prompts that write prompts — structure is code, content is data. Delivered 65% token reduction across PAI (53K → 18K tokens) via template extraction. Output is always a prompt to be used elsewhere, not final content. Reference files: Standards.md (complete prompt engineering guide), Tools/RenderTemplate.ts (rendering implementation). NOT FOR generating final content or answers — this skill produces prompts only (for content, use the appropriate domain skill). USE WHEN meta-prompting, template generation, prompt optimization, prompt engineering, write a prompt for, generate an agent prompt, create system prompt, programmatic prompt, Handlebars template, optimize this prompt, prompt hygiene, context engineering, eval prompt, judge prompt, agent briefing.
98