Skip to main content

What are Custom Instructions?

Custom instructions are natural language guidelines that let you define exactly what Mem0 should include or exclude when creating memories from conversations. This gives you precise control over what information is extracted, acting as smart filters so your AI application only remembers what matters for your use case.

Why Use Custom Instructions?

  • Focus on What Matters: Only capture information relevant to your application
  • Maintain Privacy: Explicitly exclude sensitive data like passwords or personal identifiers
  • Ensure Consistency: All memories follow the same extraction rules across your project
  • Improve Quality: Filter out noise and irrelevant conversations

How to Set Custom Instructions

Basic Setup

Best Practice Template

Structure your instructions using this proven template:

Real-World Examples

Advanced Techniques

Conditional Processing

Handle different conversation types with conditional logic:

Testing Your Instructions

Always test your custom instructions with real message examples:

Best Practices

✅ Do

  • Be specific about what information to extract
  • Use clear categories to organize your instructions
  • Test with real conversations before deploying
  • Explicitly state exclusions for privacy and compliance
  • Start simple and iterate based on results

❌ Don’t

  • Make instructions too long or complex
  • Create conflicting rules within your guidelines
  • Be overly restrictive (balance specificity with flexibility)
  • Forget to exclude sensitive information
  • Skip testing with diverse conversation examples

Common Issues and Solutions

IssueSolution
Instructions too longBreak into focused categories, keep concise
Missing important dataAdd specific examples of what to capture
Capturing irrelevant infoStrengthen exclusion rules and be more specific
Inconsistent resultsClarify guidelines and test with more examples