--- description: Search patterns and insights from previous sessions argument-hint: --- # Search Memory Search through accumulated patterns, gotchas, and session insights to find relevant knowledge for the current task. ## Input - **Query**: $ARGUMENTS (required) ## Search Scope Searches across: 1. `.auto-build/memory/patterns.json` 2. `.auto-build/memory/gotchas.json` 3. `.auto-build/memory/sessions/*.json` ## Workflow ### 1. Load Memory Files Read all memory files into searchable format. ### 2. Search Strategy **Keyword Matching** (primary): - Match query words against: - Title - Description - Tags - Context - File paths **Scoring**: - Title match: +10 points - Tag match: +5 points - Description match: +3 points - Context match: +2 points - Recent (< 7 days): +3 points - High usage count: +2 points ### 3. Present Results ``` Found 4 relevant insights for "error handling": ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ [PATTERN] API Error Handling Pattern ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Score: 18 | Used: 5 times | Added: 3 days ago All API calls should be wrapped in try-catch with consistent error response format. File: src/api/users.ts (lines 45-52) Tags: error-handling, api, patterns ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ [GOTCHA] Database Connection Error Recovery ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Score: 12 | Added: 1 week ago Problem: Oracle connections sometimes drop silently Solution: Implement connection health check with auto-reconnect Tags: database, error-handling, oracle ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ [SESSION] Feature: user-auth (2025-01-10) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Score: 8 Related insight about auth error handling... See: sessions/20250110-user-auth.json ``` ### 4. Apply to Context After showing results: ``` Apply any of these to current work? [1] View full pattern details [2] View gotcha details [A] Apply all relevant to context [N] No, just searching > ``` If user selects to apply: - Read full entry details - Add to current conversation context - Increment `usageCount` for selected entries ### 5. Update Usage Stats For each entry shown and especially those applied: - Increment `usageCount` in the original file - Track "last used" timestamp - This helps prioritize frequently useful patterns ## Search Examples | Query | Likely Matches | |-------|---------------| | "auth error" | Auth patterns, login gotchas | | "oracle pool" | Database connection patterns | | "vue component" | Frontend patterns, component gotchas | | "api response" | API patterns, error handling | ## No Results If no matches found: ``` No insights found for "exotic query" Try: - Broader terms: "database" instead of "oracle connection pool" - Category search: /ab:memory-search patterns - Browse all: /ab:memory-search * Or save new insights: /ab:memory-save ``` ## Browse All If query is `*` or `all`: - Show summary of all memory entries - Group by category - Sort by usage count (most used first)