Overview
Nectr integrates Mem0, a semantic memory layer that learns from every PR review to deliver increasingly personalized and context-aware feedback. Unlike traditional static rule engines, Mem0 builds a dynamic understanding of your project’s patterns, architectural decisions, and individual developer strengths.Mem0 is a managed AI memory service that stores contextual memories about your project and team, automatically retrieved during PR reviews to ground AI analysis in your specific codebase culture.
How It Works
Memory Extraction
After each PR review, Claude analyzes the review content and extracts key patterns:
- Project-level patterns (architectural decisions, coding conventions)
- Developer-specific patterns (coding style, common mistakes)
- Risk modules (files or patterns that frequently cause issues)
- Contributor profiles (expertise areas, review preferences)
Memory Storage
Extracted memories are stored in Mem0 with metadata:
- user_id: GitHub username for developer-specific memories
- repo: Repository identifier for project-level patterns
- memory_type: Classification (project_pattern, developer_strength, etc.)
- tags: Searchable keywords for retrieval
Context Retrieval
During PR reviews, Nectr queries Mem0 for relevant memories:
- Project patterns matching changed files or features
- Developer-specific habits for the PR author
- Historical decisions related to the code being modified
Memory Types
Nectr extracts and stores six types of memories:Project Patterns
Project Patterns
What it captures: Recurring architectural patterns, coding conventions, and project-wide standards.Example:Impact: Ensures new code follows established patterns, reducing review friction.
Architectural Decisions
Architectural Decisions
What it captures: Key technical decisions and the reasoning behind them.Example:Impact: Prevents regression to previously considered and rejected approaches.
Developer Patterns
Developer Patterns
What it captures: Individual coding habits, common mistakes, and growth areas.Example:Impact: Provides personalized feedback targeting specific improvement areas.
Developer Strengths
Developer Strengths
What it captures: Areas of expertise and consistently high-quality contributions.Example:Impact: Recognizes strengths while focusing feedback on other areas.
Risk Modules
Risk Modules
What it captures: Files or modules that frequently introduce bugs or require extra scrutiny.Example:Impact: Triggers extra careful review for high-risk areas.
Contributor Profiles
Contributor Profiles
What it captures: Overall developer profiles including tenure, focus areas, and review preferences.Example:Impact: Tailors review tone and focus to individual preferences.
Implementation Details
Memory Adapter
Nectr uses an async wrapper around the Mem0 Python client:app/services/memory_adapter.py
Memory Extraction
After each review, Claude extracts structured memories:app/services/memory_extractor.py
Memory Management API
Nectr exposes a REST API for managing memories:List Memories
GET /api/v1/memory - Retrieve all memories for a repository
Add Memory
POST /api/v1/memory - Add a custom rule or pattern
Delete Memory
DELETE /api/v1/memory/:id - Remove a specific memory
Project Map
GET /api/v1/memory/project-map - Get project context summary
Configuration
Configure Mem0 with a single environment variable:.env
Mem0 is optional but highly recommended. Without it, reviews lack historical context and personalization.
Best Practices
Seed Initial Patterns
Seed Initial Patterns
Add 5-10 core project patterns manually via the API to bootstrap the memory system:
Review Extracted Memories
Review Extracted Memories
Periodically audit extracted memories via the dashboard to:
- Remove outdated patterns
- Correct misclassified memories
- Merge duplicate patterns
Leverage Developer Profiles
Leverage Developer Profiles
Encourage team members to review their developer-specific memories and add growth goals:
Memory in Action
Scenario: A developer submits a PR adding a new API endpoint without async database access. Without Mem0:“Consider using async database access for better performance.”With Mem0:
“This project uses async SQLAlchemy sessions for all database operations (seeapp/core/database.py). Please update this endpoint to useasync with async_session() as db:to maintain consistency with existing endpoints like/api/v1/reposand/api/v1/reviews.”
Troubleshooting
Memories Not Appearing in Reviews
Memories Not Appearing in Reviews
Cause: Memory extraction or retrieval failure.Fix:
- Check Mem0 API key is valid:
curl https://api.mem0.ai/v1/memories -H "Authorization: Bearer $MEM0_API_KEY" - Review backend logs for memory extraction errors
- Verify memories exist: GET /api/v1/memory?repo=owner/repo
Duplicate or Conflicting Memories
Duplicate or Conflicting Memories
Cause: Memory extraction created redundant patterns.Fix:
- List memories: GET /api/v1/memory
- Delete duplicates: DELETE /api/v1/memory/:id
- Add a consolidated memory via POST /api/v1/memory
Outdated Patterns Affecting Reviews
Outdated Patterns Affecting Reviews
Cause: Project evolved but old memories remain.Fix:
- Review project map: GET /api/v1/memory/project-map
- Delete obsolete memories
- Rescan repository: POST /api/v1/memory/rescan
Next Steps
AI Analysis
Learn how Claude uses memories during PR reviews
Memory API
Explore the complete memory management API