This file provides instructions for AI agents (Claude Code, GitHub Copilot, Cursor, etc.) on how to effectively use the In Memoria MCP server for intelligent codebase navigation and analysis.
Every new session, follow this pattern:
- 1. Call
get_project_blueprint()to get instant context - 2. Check
learningStatusin the blueprint response - 3. If
recommendation === 'learning_recommended', callauto_learn_if_needed() - 4. Use the blueprint to understand tech stack, entry points, and key directories
- 5. Leverage feature maps and semantic search for navigation
| Tool | When to Use | Key Feature |
|---|---|---|
get_project_blueprint |
Every session start | Instant context: tech stack, entry points, architecture, learning status |
auto_learn_if_needed |
When learning recommended | Smart learning with automatic staleness detection |
predict_coding_approach |
Before implementing | Get approach + file routing + patterns in one call |
search_codebase |
Finding code | Semantic (meaning), text (keywords), or pattern search |
analyze_codebase |
Understanding files/dirs | Token-efficient analysis with top concepts/patterns |
-
analyze_codebase- Analyze files or directories{ path: string, includeFileContent?: boolean }
Returns: Language, concepts (top 10), patterns (top 5), complexity
-
search_codebase- Smart search (semantic/text/pattern){ query: string, type?: 'semantic'|'text'|'pattern', limit?: number }
Returns: Scored results with context
-
learn_codebase_intelligence- Deep learning{ path: string, force?: boolean }
Returns: Blueprint, concepts learned, patterns discovered
-
get_project_blueprint- Instant project context ⭐{ path?: string, includeFeatureMap?: boolean }
Returns: Tech stack, entry points, key dirs, feature map, learning status
-
get_semantic_insights- Query learned concepts{ query?: string, conceptType?: string, limit?: number }
Returns: Concepts, relationships, usage contexts
-
get_pattern_recommendations- Pattern suggestions{ problemDescription: string, currentFile?: string, includeRelatedFiles?: boolean }
Returns: Patterns, examples, confidence, related files
-
predict_coding_approach- Implementation guidance{ problemDescription: string, context?: object, includeFileRouting?: boolean }
Returns: Approach, patterns, complexity, target files
-
get_developer_profile- Coding style and conventions{ includeRecentActivity?: boolean, includeWorkContext?: boolean }
Returns: Naming conventions, structural patterns, expertise
-
contribute_insights- Record architectural decisions{ type: string, content: object, confidence: number, sourceAgent: string }
Returns: Success, insight ID
-
auto_learn_if_needed- Smart auto-learning ⭐{ path?: string, force?: boolean, skipLearning?: boolean, includeSetupSteps?: boolean }
Returns: Action taken, intelligence status, setup steps
get_system_status- System health checkget_intelligence_metrics- Concept/pattern metricsget_performance_status- Performance diagnostics
// Step 1: Get the lay of the land
const blueprint = await mcp.get_project_blueprint({
path: '.',
includeFeatureMap: true
});
console.log('Tech Stack:', blueprint.techStack);
console.log('Entry Points:', blueprint.entryPoints);
console.log('Key Directories:', blueprint.keyDirectories);
// Step 2: Learn if needed
if (blueprint.learningStatus.recommendation !== 'ready') {
await mcp.auto_learn_if_needed({
path: '.',
includeProgress: true
});
}
// Step 3: You now have full context and intelligence!// Step 1: Get implementation approach with file routing
const approach = await mcp.predict_coding_approach({
problemDescription: 'Add user password reset functionality',
context: {
feature: 'authentication',
relatedFiles: ['src/auth/login.ts']
},
includeFileRouting: true
});
// Step 2: Get pattern recommendations for consistency
const patterns = await mcp.get_pattern_recommendations({
problemDescription: 'Password reset with email validation',
currentFile: approach.fileRouting.suggestedStartPoint,
includeRelatedFiles: true
});
// Step 3: Search for similar implementations
const examples = await mcp.search_codebase({
query: 'email validation auth',
type: 'semantic',
limit: 5
});
// Now you have: approach + target files + patterns + examples// Step 1: Analyze the mysterious directory
const analysis = await mcp.analyze_codebase({
path: './src/services/payment'
});
// Step 2: Get semantic insights about key concepts
const insights = await mcp.get_semantic_insights({
query: 'payment processing',
limit: 10
});
// Step 3: Find all related code
const related = await mcp.search_codebase({
query: 'stripe payment integration',
type: 'semantic'
});
// Now you understand: structure + concepts + usage// Step 1: Understand the coding conventions
const profile = await mcp.get_developer_profile({
includeRecentActivity: true
});
// Step 2: Check if code follows project patterns
const patterns = await mcp.get_pattern_recommendations({
problemDescription: 'Review API error handling consistency',
currentFile: 'src/api/routes/users.ts',
includeRelatedFiles: true
});
// Step 3: Find similar implementations for comparison
const similar = await mcp.search_codebase({
query: 'try catch error middleware',
type: 'pattern'
});
// Now you can: validate consistency + suggest improvementsNeed instant project context?
→ get_project_blueprint()
Need to learn/update intelligence?
→ auto_learn_if_needed() (smart) OR learn_codebase_intelligence() (force)
Need implementation guidance?
→ predict_coding_approach() with includeFileRouting=true
Need to find code?
├─ By meaning/concept? → search_codebase(type='semantic')
├─ By keyword? → search_codebase(type='text')
└─ By pattern? → search_codebase(type='pattern')
Need to understand a file?
→ analyze_codebase(path='./specific/file.ts')
Need coding patterns?
→ get_pattern_recommendations() with includeRelatedFiles=true
Need to understand what codebase knows?
→ get_semantic_insights()
Need coding style/conventions?
→ get_developer_profile()
Made an architectural decision?
→ contribute_insights()
Debugging In Memoria?
→ get_system_status() / get_intelligence_metrics() / get_performance_status()
const blueprint = await mcp.get_project_blueprint({ path: '.' });
if (blueprint.learningStatus.recommendation !== 'ready') {
// Learning needed - call auto_learn_if_needed()
}const blueprint = await mcp.get_project_blueprint({
path: '.',
includeFeatureMap: true // ← Get feature-to-file mapping
});
// Now you know which files handle which features:
// blueprint.featureMap['authentication'] = ['src/auth/login.ts', ...]// Get everything in 3 calls:
const [blueprint, approach, patterns] = await Promise.all([
mcp.get_project_blueprint({ path: '.', includeFeatureMap: true }),
mcp.predict_coding_approach({ problemDescription: '...', includeFileRouting: true }),
mcp.get_pattern_recommendations({ problemDescription: '...', includeRelatedFiles: true })
]);
// You now have: architecture + approach + files + patternsIn Memoria automatically limits responses to avoid overwhelming the LLM:
- File analysis: Top 10 concepts, top 5 patterns
- Directory analysis: Top 15 concepts, top 10 patterns
- Use
get_semantic_insightsif you need more concepts
// ✅ GOOD: Semantic search understands meaning
await mcp.search_codebase({
query: 'user authentication flow',
type: 'semantic'
});
// ❌ BAD: Text search only matches keywords
await mcp.search_codebase({
query: 'user authentication flow',
type: 'text' // Won't find conceptually related code
});// When you discover something important:
await mcp.contribute_insights({
type: 'architectural_decision',
content: {
decision: 'All database queries use Prisma ORM',
reasoning: 'Type safety and migration management',
affectedFiles: ['src/db/', 'prisma/']
},
confidence: 0.95,
sourceAgent: 'github-copilot' // or 'claude-code', 'cursor', etc.
});// Bad - might work with stale/missing data
const results = await mcp.search_codebase({ query: '...' });// Good - ensure intelligence is fresh
const blueprint = await mcp.get_project_blueprint({ path: '.' });
if (blueprint.learningStatus.recommendation !== 'ready') {
await mcp.auto_learn_if_needed({ path: '.' });
}
const results = await mcp.search_codebase({ query: '...' });// Bad - won't find semantically related code
await mcp.search_codebase({ query: 'payment processing', type: 'text' });// Good - finds conceptually related code
await mcp.search_codebase({ query: 'payment processing', type: 'semantic' });// Bad - implementing without checking patterns
// Just start coding...// Good - check patterns first
const patterns = await mcp.get_pattern_recommendations({
problemDescription: 'Create new API endpoint',
includeRelatedFiles: true
});
// Now implement following the discovered patterns// Bad - wastes time re-learning when data is fresh
await mcp.auto_learn_if_needed({ path: '.', force: true });// Good - only learns if needed
await mcp.auto_learn_if_needed({ path: '.', force: false });// === SESSION START ===
// 1. Get instant context + learning status
const blueprint = await mcp.get_project_blueprint({
path: '.',
includeFeatureMap: true
});
// 2. Learn if needed (automatic staleness check)
if (blueprint.learningStatus.recommendation !== 'ready') {
await mcp.auto_learn_if_needed({
path: '.',
includeProgress: false // Set true if you want progress updates
});
}
// 3. Understand coding style (once per session)
const profile = await mcp.get_developer_profile({
includeRecentActivity: false,
includeWorkContext: false
});
// === DURING WORK ===
// 4. For each task, get approach + routing
const approach = await mcp.predict_coding_approach({
problemDescription: userRequest,
includeFileRouting: true
});
// 5. Get patterns for consistency
const patterns = await mcp.get_pattern_recommendations({
problemDescription: userRequest,
currentFile: approach.fileRouting?.suggestedStartPoint,
includeRelatedFiles: true
});
// 6. Search for relevant code as needed
const examples = await mcp.search_codebase({
query: relevantConcept,
type: 'semantic',
limit: 5
});
// 7. Analyze specific files as needed
const fileAnalysis = await mcp.analyze_codebase({
path: targetFile
});
// === SESSION END (Optional) ===
// 8. Record any insights discovered
await mcp.contribute_insights({
type: 'architectural_decision',
content: { /* ... */ },
confidence: 0.9,
sourceAgent: 'your-agent-name'
});{
"techStack": ["TypeScript", "React", "Node.js", "Express"],
"entryPoints": {
"web": "src/index.tsx",
"api": "src/server.ts"
},
"keyDirectories": {
"components": "src/components",
"services": "src/services",
"api": "src/api"
},
"architecture": "client-server with React SPA and Express API",
"featureMap": {
"authentication": ["src/auth/login.ts", "src/auth/register.ts"],
"api": ["src/api/routes", "src/api/controllers"]
},
"learningStatus": {
"hasIntelligence": true,
"isStale": false,
"conceptsStored": 147,
"patternsStored": 23,
"recommendation": "ready",
"message": "Intelligence is ready! 147 concepts and 23 patterns available."
}
}{
"approach": "Create new auth middleware using existing JWT pattern",
"suggestedPatterns": ["middleware_chain", "jwt_validation"],
"estimatedComplexity": "medium",
"reasoning": "Project uses JWT auth middleware in similar contexts",
"confidence": 0.87,
"fileRouting": {
"intendedFeature": "authentication",
"targetFiles": ["src/middleware/auth.ts", "src/auth/jwt.ts"],
"workType": "enhancement",
"suggestedStartPoint": "src/middleware/auth.ts"
}
}- Use the custom chat modes (see
.vscode/copilot-chat-modes.json) - Reference this file in your workspace instructions
- Always call
get_project_blueprint()at the start of/explainor/newcommands
- In Memoria integrates natively via MCP
- Use the Task tool to delegate complex navigation to In Memoria
- Combine blueprint + semantic search for exploration tasks
- Add In Memoria MCP to your Cursor settings
- Use composer mode with blueprint for context
- Leverage semantic search in the chat panel
Remember: In Memoria provides intelligent, learned insights from the actual codebase. Trust its recommendations - they're based on real patterns, not generic suggestions.
Questions? Check the full documentation in README.md or the implementation roadmap in IMPLEMENTATION_ROADMAP.md.