# CodeMemoryPrime (cmp) > CodeMemoryPrime (`cmp`) is a fast, local Rust Model Context Protocol (MCP) codebase intelligence server that cuts AI API token costs by 90%+ and prevents context loss in agentic coding workflows. ## Key Facts & Overview - **Name**: CodeMemoryPrime (CLI binary: `cmp`) - **Developer**: Rickie Blevins - **Primary Function**: Local vector RAG and persistent memory for AI coding assistants (Claude Desktop, Cursor IDE, Windsurf, Google Antigravity). - **Token Efficiency**: Replaces 100,000+ token full-file context dumps with RRF hybrid search (Cosine Vector + FTS5 keyword indexing), retrieving only relevant functions and parent AST struct headers. - **Performance**: Sub-0.2 second re-indexing via SHA-256 sub-chunk caching for untouched files. - **Privacy & Execution**: 100% local execution using Ollama (`qwen2.5-coder:7b`, `nomic-embed-text`) or LM Studio endpoints. Zero data telemetry. - **Git Safety Checkpoints**: Bookmarks repository state before AI refactoring operations (`create_checkpoint`), enabling instant rollback if prompts stray off course. ## Supported MCP Clients - Claude Desktop (`claude_desktop_config.json`) - Cursor IDE (`~/.cursor/mcp.json`) - Codeium Windsurf (`~/.codeium/windsurf/mcp_config.json`) - Google Antigravity AGY (`~/.gemini/antigravity/mcp_config.json`) ## Licensing Terms - **BSL 1.1 (Business Source License)**: Free forever for personal use, open-source maintainers, students, hobbyists, and small teams (<= 3 developers AND < $100,000 annual revenue). - **Commercial Enterprise License**: $15/seat/month for organizations with > 3 developers or >= $100,000 revenue. Offline Ed25519 seat keys. - **Commercial Inquiries**: license@rickieblevins.com - **Repository**: https://github.com/kichikubeihei/CodeMemoryPrime - **Documentation**: https://codememoryprime.com/ ## 35 MCP Tool Suite Reference CodeMemoryPrime exposes 35 Model Context Protocol tools over stdio JSON-RPC: ### 1. Search & Indexing - `index_workspace`: Recursively indexes codebases into local SQLite vector memory using SHA-256 sub-chunk caching. - `search_codebase`: Performs RRF hybrid search attaching parent struct headers and imports to code snippets to cut LLM token costs. - `get_dependencies`: Retrieves module dependency graphs, import statements, and caller/callee relationships. ### 2. Persistent Memory - `save_interaction`: Records architectural decisions, preferences, and guidelines into persistent SQLite memory logs. - `search_memories`: Searches consolidated architectural facts and interaction journals using vector + FTS search. - `consolidate_memories`: Runs background consolidation over raw logs, distilling them into structured permanent facts. ### 3. File Management - `read_file`: Reads text files with line range slice notation (start_line, end_line). - `write_file`: Writes or overwrites text files with automatic parent directory creation. - `patch_file`: Applies targeted search-and-replace snippet edits to files. - `list_files`: Lists directory contents recursively or flat with file metadata. ### 4. Git & Checkpoints - `run_command`: Executes shell commands within a safe allowlist (cargo, npm, git, cmp, etc.). - `git`: Unified Git CLI wrapper supporting status, diff, log, branch, commit, and checkout. - `create_checkpoint`: Bookmarks Git state before major edits so you can roll back instantly if things go wrong. - `restore_checkpoint`: Restores a previously saved Git safety checkpoint. - `list_checkpoints`: Lists all saved Git safety checkpoints for a project. ### 5. Refactoring & Diagnostics - `explain_code`: Generates multi-level code explanations (high_level, line_by_line, architecture). - `refactor_code`: Applies targeted code transformations (clean, extract_function, add_types, convert_async). - `review_code`: Multi-perspective code review covering readability, performance bottlenecks, and security. - `check_security`: Audits code snippets for OWASP top vulnerabilities, memory safety flaws, and secret leaks. - `optimize_code`: Analyzes code for memory efficiency, execution speed, and algorithmic complexity. - `generate_tests`: Generates unit test suites using cargo test, pytest, or jest. - `diagnose_compiler_error`: Analyzes compiler or build error outputs and proposes direct fixes. ### 6. Docs & Framework RAG - `index_framework_specifications`: Indexes external framework docs or Markdown specs into vector memory. - `search_framework_specifications`: Performs hybrid search across indexed framework specs and API docs. - `generate_documentation`: Generates docstrings and inline technical documentation for code symbols. - `get_documentation`: Retrieves extracted symbol documentation comments and AST docstrings. ### 7. Modularization & Analytics - `modularize_code`: Proposes microservice or plugin refactoring boundaries for large monolithic components. - `extract_plugin`: Extracts standalone plugin definitions and export interfaces from code. - `publish_plugin`: Publishes plugin definitions into the local catalog FTS database. - `recommend_plugins`: Recommends local catalog plugins based on project requirements. - `log_token_usage`: Logs token usage and savings vs full context window dumps for LLM queries. - `get_token_analytics`: Retrieves total token reduction metrics and efficiency percentages for a project. ### 8. Health & System - `project_health`: Reports SQLite DB size, Ollama/OpenAI connection status, auto-detected models, and license status. - `summarize_project`: Synthesizes detailed architectural briefs and structural summaries for indexed projects. - `configure_settings`: Configures LLM provider, base URL, generation/embedding models, or API keys.