8.8 KiB
description, proactive
| description | proactive |
|---|---|
| Automatically search memory and retrieve context when user asks questions about the project, past work, patterns, decisions, or implementations. Always invoke before answering "how did we", "what patterns", "who worked on". | true |
Memory Auto-Track Skill
⚡ IMPORTANT: This skill is ALWAYS ACTIVE. Use it automatically whenever the user asks questions.
Purpose
Automatic memory search integrated into conversation:
- ALWAYS search memory when user asks ANY question about the project
- Check for established patterns before suggesting implementations
- Surface relevant past work automatically
- No manual /memory-recall needed - you do it automatically
Note: Storage is handled automatically by hooks. This skill makes retrieval AUTOMATIC.
When to Search Memory (Automatically!)
ALWAYS invoke mcp__memory-store__recall when:
-
User asks ANY question about the project
- "How did we implement X?"
- "What patterns do we use?"
- "Why did we choose Y?"
- → AUTOMATICALLY search memory BEFORE answering
-
User asks you to implement something
- "Create an API endpoint"
- "Add authentication"
- "Fix the bug in X"
- → AUTOMATICALLY search for similar past work
-
User asks about team/ownership
- "Who worked on X?"
- "What does the team use for Y?"
- → AUTOMATICALLY search memory
-
User mentions uncertainty
- "I'm not sure how we..."
- "What's our convention for..."
- → AUTOMATICALLY search memory
-
You're about to suggest something
- Before proposing an approach
- → AUTOMATICALLY search to check for existing patterns
Cues for retrieval:
- Project name
- File/directory names being worked on
- Technology stack keywords
- Feature names
- Problem domain terms
What to Do
For Storing Memories
When storing (reactive to hooks):
-
Parse the context to extract:
- The main memory text (concise summary)
- Background details (full context)
- Importance level (low, normal, high)
-
Invoke
mcp__memory__recordtool with the extracted information -
Confirm silently - No need to tell the user unless there's an error
For Retrieving Context
When retrieving (proactive for guidance):
-
Identify what you need to know:
- What patterns exist for this type of work?
- How was similar functionality implemented?
- What decisions were made about this?
-
Create search cues (3-7 relevant terms):
["authentication", "API endpoint", "OAuth", "patterns"] -
Invoke
mcp__memory__recallwith:cues: Array of search termsbackground: Context about why you're searchingk: Number of results (default 10)
-
Use the results to:
- Follow established patterns
- Reference past decisions
- Ensure consistency with team conventions
- Provide better, context-aware responses
-
Mention to user when using past context:
- "Based on our previous work with authentication..."
- "Following the API pattern we established in auth.ts..."
- "Consistent with the decision we made on 2024-11-01..."
Examples
Example 1: Storing - Session Start
Input additionalContext:
🚀 Development session starting in project mem-plugin on branch main.
Session ID: mem-20251113-ABC123. This session context should be stored
in memory using memory__record tool with importance: normal.
Action:
// Invoke mcp__memory__record
{
"memory": "Development session started in mem-plugin on branch main",
"background": "Session ID: mem-20251113-ABC123. Session initialized at 2025-11-13T17:00:00Z",
"importance": "normal"
}
Example 2: File Change
Input additionalContext:
📝 File created: auth.ts (TypeScript). Pattern: API endpoint. Store this
in memory using memory__record with importance: low, background: 'File
auth.ts was created in session mem-123. Language: TypeScript. Pattern:
API endpoint. Change #5.'
Action:
// Invoke mcp__memory__record
{
"memory": "File created: auth.ts (TypeScript). Pattern: API endpoint",
"background": "File auth.ts was created in session mem-123. Language: TypeScript. Pattern: API endpoint. Change #5.",
"importance": "low"
}
Example 3: Commit Analysis
Input additionalContext:
💾 Commit: feat: add OAuth2 authentication (feature) - Ticket AUTH-123.
Store this commit in memory using memory__record with importance: high,
background: 'Commit abc1234 on branch feature/auth. Type: feature. Files
changed: 8. Breaking change: false.'
Action:
// Invoke mcp__memory__record
{
"memory": "Commit: feat: add OAuth2 authentication (feature) - Ticket AUTH-123",
"background": "Commit abc1234 on branch feature/auth. Type: feature. Files changed: 8. Breaking change: false.",
"importance": "high"
}
Important Notes
- Always invoke immediately when you see the pattern
- Don't ask for confirmation - hooks have already decided this should be stored
- Extract importance carefully - defaults to "normal" if not specified
- Handle errors gracefully - if
mcp__memory__recordfails, mention it to the user - Be silent on success - no need to confirm to user unless they ask
Parsing Guidelines
Look for these patterns in additionalContext:
- Memory text: Usually the first sentence or main statement
- Importance level: Look for "importance: (low|normal|high)"
- Background: Either explicitly marked as "background: '...'" or the detailed context following the main statement
Example 4: Retrieving - User Asks About Past Work
User says:
"How did we implement authentication in this project?"
Action:
// Invoke mcp__memory__recall
{
"cues": ["authentication", "implement", "auth", "login", "OAuth"],
"background": "User asking about authentication implementation. Need to retrieve past work on auth systems in this project.",
"k": 10
}
Expected results:
- Past commits related to authentication
- Files that implement auth (auth.ts, login.tsx, etc.)
- Decisions made about auth approach
- Patterns used for authentication
Response to user:
Based on our previous work, we implemented OAuth2 authentication.
See auth.ts:45 where we established the pattern. The flow uses...
Example 5: Retrieving - Starting Similar Work
User says:
"Create a new API endpoint for user profiles"
Before implementing, retrieve context:
// Invoke mcp__memory__recall
{
"cues": ["API endpoint", "create endpoint", "user", "REST API", "patterns"],
"background": "About to create new API endpoint. Need to check existing API patterns and conventions.",
"k": 5
}
Use results to:
- Follow same authentication pattern
- Use same error handling approach
- Match existing API structure
- Maintain consistency
Response:
I'll create the user profiles endpoint following our established API pattern.
Based on our existing endpoints (like auth.ts), I'll use the same middleware
structure and error handling...
Example 6: Retrieving - Avoiding Going Off Track
Scenario: Claude is about to suggest using MongoDB, but team uses PostgreSQL
Before suggesting:
// Invoke mcp__memory__recall
{
"cues": ["database", "data storage", "PostgreSQL", "MongoDB", "decision"],
"background": "Need to recommend database approach. Checking if team has established database preferences.",
"k": 5
}
Results show: "Decision: Use PostgreSQL for ACID compliance (2024-10-15)"
Corrected response:
I'll use PostgreSQL for this, consistent with our team's decision from
October 2024. This ensures ACID compliance and aligns with our existing
database infrastructure.
Error Handling
If mcp__memory__record fails:
- Don't silently fail - inform the user
- Provide context - tell them what you were trying to store
- Suggest solutions - check MCP server connection, retry later
Example error message:
⚠️ Unable to store memory: "File created: auth.ts".
The memory store server may be unavailable. Your work is still tracked
locally and will sync when the connection is restored.
Testing
For Storage:
- Make a file change
- Hook fires → outputs additionalContext
- This skill activates → invokes memory__record
- Memory is stored
For Retrieval:
- Ask Claude about past work: "How did we implement X?"
- Skill should invoke memory__recall automatically
- Claude uses retrieved context in response
- Mentions where pattern/decision came from
End-to-end test:
- Create file with specific pattern (e.g., API endpoint)
- Verify stored via memory__record
- Later ask: "How should I create an API endpoint?"
- Claude retrieves the pattern and follows it
- Consistency maintained! ✅