Files
auto-build/plugin/commands/memory-search.md
Marius Mutu 940c6a9f58 feat: Move specs and memory to git for multi-developer collaboration (v1.0.6)
BREAKING CHANGE: Specs, plans, and memory moved from .auto-build-data/ (gitignored)
to .auto-build/ (git-tracked) to enable team collaboration.

Changes:
- Specs/plans now in .auto-build/specs/ (shared with team)
- Memory (patterns, gotchas) now in .auto-build/memory/ (shared with team)
- .auto-build-data/ now only contains local data (worktrees, cache)
- Added /ab:migrate command for existing projects
- Removed symlinks from worktree-create.sh (no longer needed)

Benefits:
- Any developer can continue a plan started by another
- Patterns and gotchas shared across team
- Works on Windows/Linux/Mac without symlinks
- Full version history in git

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 17:44:52 +02:00

134 lines
3.5 KiB
Markdown

---
description: Search patterns and insights from previous sessions
argument-hint: <query>
---
# 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)