Skip to main content
POST
Create Memory

Overview

Create a new memory entry for a repository. This allows you to manually add project rules, guidelines, or context that the AI should consider during code reviews.

Authentication

Requires a valid JWT token in the Authorization header:

Request Body

string
required
Repository in owner/repo format (e.g., “acme/api-server”)
string
required
Memory content - clear, descriptive text about the rule, pattern, or context
string
default:"project_rule"
Type of memory to create. Valid values:
  • project_rule: Project-specific guidelines and standards
  • architecture: System architecture and design decisions
  • project_map: Codebase structure descriptions

Response

string
Unique ID of the created memory
string
Status of the operation (“added”)

Example Request

Example Response

Error Responses

Repository Not Connected

HTTP Status: 403 Forbidden

Memory Layer Not Available

HTTP Status: 503 Service Unavailable

Validation Error

HTTP Status: 422 Unprocessable Entity

Best Practices

Writing Effective Memories

Good:
Bad:

Memory Content Guidelines

  1. Be Specific: Include concrete details and examples
  2. Be Actionable: Describe what should be done, not just what to avoid
  3. Provide Context: Explain why the rule exists when relevant
  4. Use Clear Language: Avoid jargon unless it’s well-established in your team
  5. Keep it Focused: One rule or concept per memory

Use Cases

Add Security Requirements

Document Architecture Decisions

Add Testing Standards

Import Team Guidelines

Bulk Import from README

Notes

  • Only project_rule, architecture, and project_map memory types can be manually created
  • Developer-specific memories (contributor_profile, developer_pattern, developer_strength) are automatically learned from PR analysis
  • Memories are immediately available for use in future code reviews
  • You must have the repository connected to your account to create memories
  • Duplicate content is allowed - Mem0 will handle deduplication automatically