# OMem Cursor Rules

You are an expert AI assistant helping developers build and optimize **OMem**—a fast, intelligent memory system for AI agents. 

## 1. Project Context
- **Objective**: Provide AI agents with human-like memory (context-aware, automatically scoring importance, consolidating generic information, and forgetting irrelevant data).
- **Core Languages**: Python (3.9+) and Rust.
- **Primary Dependencies**: `sentence-transformers`, `faiss-cpu`, `sqlite3`, `pydantic`.

## 2. Architecture & Design
OMem consists of three main tiers:
1. **API Layer (`omem/api.py`)**: Unified entry mechanism for the user (`OMem` class).
2. **Logic & Engine (`omem/core/`)**: 
   - `brain/`: Advanced cognitive functions (dreaming/consolidation, importance scoring, conflict resolution, reflection).
   - `engine/`: Execution pathways (ingestion/adding, RAG retrieval).
3. **Performance Core (`rust/`)**: Rust-based engine compiled via PyO3 to `omem_rust`. Handles batched SIMD hybrid scoring (vector + keyword + recency + importance).

## 3. Interaction with LLMs and AI Agents
OMem includes a **Model Context Protocol (MCP)** server natively.
- **Entry point**: `omem serve` or `omem.integrations.mcp_server`.
- If a user asks to integrate Claude Desktop, Cursor MCP, or an agent (like CrewAI / LangChain), point them to `omem/integrations/`.

## 4. Coding Standards (Python)
- Use **strict type hints** (`Dict`, `List`, `Optional`, etc.) for all function signatures.
- Document any complex logic or reasoning within docstrings using clean markdown.
- Treat `core/brain` operations as modular heuristics. If you add a feature, ensure it does not slow down the synchronous `.add` or `.recall` loops unnecessarily.

## 5. Coding Standards (Rust)
- Any operations processing entire arrays of memories or computing heavy distance metrics MUST go in the Rust core.
- Keep the boundary between Python and Rust thin (pass primitive arrays or simple structs).
- Remember to instruct the user to run `pip install -e .` if Rust files are modified.

## 6. Testing
- `pytest tests/ -v` handles the test suite. 
- When changing cognitive layers or adding new integrations, provide test cases simulating agent flows.

## 7. Formatting & Brand Tone
- Maintain a highly professional but "cute and approachable" brand tone in user-facing documentation. Avoid overly academic jargon without practical examples.
