### Verify Workspace Setup Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Command to verify the successful setup and startup of the Zerikai Memory workspace. ```python python -c "from main import scan_workspace, query_memory; print('OK')" ``` -------------------------------- ### Assistant Command for Project Setup Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Command to instruct the assistant to set up memory for the current project. ```text "Set up memory for this project" ``` -------------------------------- ### Install Zerikai Memory Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md Steps to clone the repository, set up a Python virtual environment, and install dependencies. ```bash git clone https://github.com/your-username/zerikai_memory.git cd zeriakai_memory # Create and activate a virtual environment (Python 3.11+) python -m venv venv source venv/bin/activate # Windows: .\venv\Scripts\activate pip install -r requirements.txt ``` -------------------------------- ### Configure Zerikai Memory Environment Variables Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md Instructions to rename the example environment file and set up API keys and memory mode. ```env DEEPSEEK_API_KEY=your_deepseek_key_here # Memory Mode controls which LLM is used for operations: # - "cloud": Use DeepSeek for all operations (scan, brief, queries) - highest quality, tracked usage # - "hybrid": Use Ollama for file scanning, DeepSeek for briefs and escalated queries # - "local": Use Ollama for everything (free, but lower quality briefs) MEMORY_MODE=cloud # Enable token tracking and cost reporting (SQLite database at .brain/token_usage.db) # Set to "false" to disable tracking ENABLE_TOKEN_TRACKING=true # Enable deepseek-v4-pro for complex architectural queries (design, architecture, tradeoffs) # v4-pro is 3x more expensive than v4-flash (currently $0.435/M vs $0.14/M input) # After May 31 2026, v4-pro will be 6x more expensive ($1.74/M vs $0.14/M) # Recommended: keep this "false" unless you need maximum reasoning capability ENABLE_DEEPSEEK_PRO=false # Semantic search relevance cutoff for query_memory (L2 distance). # Lower = stricter. Watch "best dist=X.XX" in server.log to calibrate. # Typical: <0.8 strong match, 0.8-1.5 related, >1.5 noise. QUERY_DISTANCE_THRESHOLD=1.0 # File extensions to skip during scanning when tree-sitter produces zero # entities (no functions, classes, headings, semantic HTML elements, etc.). ``` -------------------------------- ### Example Workspace Management Commands Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md These commands are executed by your AI agent to manage project workspaces. They are not run directly. ```markdown | Tool | |---|---| | `init_workspace` | Registers a project folder, assigns a UUID, and creates a pending brief file. Idempotent; safe to run multiple times. | | `list_workspaces` | Lists all known workspaces that have a brief or stored memories. | | `resolve_workspace` | Resolves a workspace identifier (UUID, short-UUID, or display name) to its filesystem path. | | `merge_workspaces` | Consolidates duplicate workspace IDs into one. **Irreversible.** | | `debug_workspace_id` | Diagnostic tool; shows what workspace ID would be generated from a given path. | ``` -------------------------------- ### IDE Agent Rules Example Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md Directives to enforce memory protocol adherence within an IDE. Ensure these are copied into your IDE's agent rules profile. ```markdown * **Universal-Brain First:** The agent *must* query `universal-brain` before attempting raw file searches. * **Source Discipline:** Every answer *must* surface actual `file.py:line` citations with zero fabrication. ``` -------------------------------- ### Example Chat with Memory Commands Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md Natural language commands to interact with the AI agent for memory management and querying. Prefix queries with 'universal-brain:' ```markdown * Scan the workspace for the first time: `"Set up memory for this project"` * Ask a question: `"What are the main architectural components of this project?"` **Frequently used follow-ups:** * After a code change: `"Rescan the workspace and force a refresh of the project brief."` * Save part of a chat: `"Save the following context to memory: [your custom notes or constraints here]"` * Ask how much have you used: `"Get me a cost report for my memory usage so far." ``` -------------------------------- ### Universal-Brain First Rule Source: https://github.com/kikeven/zerikai_memory/blob/main/agent_rules/ide_agent_rules.md Always query the universal-brain MCP first using `query_memory` with the active workspace before any codebase exploration. Use its response as the starting point and escalate to raw file searches only when the MCP has no memory of the topic. ```markdown 1. UNIVERSAL-BRAIN FIRST: Before ANY codebase exploration, always query the `universal-brain` MCP first using `query_memory` with the active workspace. - Use it for: functions, files, architecture, patterns, task flows, and integrations. - Treat its response as your L2 starting point (file + line references). - If the MCP returns a source citation (e.g., `file.py:136`), use it as the entry point for deeper digging via `view_file` or `grep_search`. - Only escalate to raw file searches when the MCP has no memory of the topic. Always state that this triggered the escalation. ``` -------------------------------- ### Python Docstring Format Source: https://github.com/kikeven/zerikai_memory/blob/main/embedding-docstring/SKILL.md Example of a Python function docstring adhering to the embedding optimization checklist. Includes summary, extended description covering routing, guarantees, and side effects, and explicitly names external technologies. Args, Returns, and Raises sections are structural. ```python def function_name(param: str) -> int: """Summary sentence. Extended description of routing, guarantees, and side effects. Names any external technology explicitly. Args: param: What it represents. Returns: Description of return value and what the caller should do with it. Raises: SpecificError: When this happens and why. """ ``` -------------------------------- ### Merge Workspaces Command Example Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md This command is used to merge two workspace IDs when duplicates are detected. The source workspace is deleted after a successful merge. This operation is irreversible. ```bash "Merge workspaces into " ``` -------------------------------- ### HTML Docstring Format Source: https://github.com/kikeven/zerikai_memory/blob/main/embedding-docstring/SKILL.md Example of an HTML comment block used as a docstring for a section. The comment includes a summary sentence and describes the section's purpose, interactions, and any explicitly named libraries or endpoints. The checklist applies to the comment body, and brevity for complex sections is a concern. ```html
``` -------------------------------- ### Sample .memignore File Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md A sample .memignore file demonstrating patterns for excluding directories and files from memory scans. Configure this in your project's root directory. ```gitignore # Directories (trailing slash required) .git/ node_modules/ virtual/ __pycache__/ .brain/ dist/ build/ # File/Folder patterns **/test/ **/tests/ .env *.log *.lock *.pyc ``` -------------------------------- ### Configure Zerikai Memory Environment Variables Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Set up the .env file with essential configuration for Zerikai Memory, including API keys and operational modes. ```env DEEPSEEK_API_KEY=your_deepseek_key_here # Required. Get one at platform.deepseek.com MEMORY_MODE=cloud # Start here. No Ollama needed. ENABLE_TOKEN_TRACKING=true ENABLE_DEEPSEEK_PRO=false # Keep false — v4-flash handles 99% of queries QUERY_DISTANCE_THRESHOLD=1.0 # Lower = stricter matches ENABLE_LEXICAL_RERANK=true # Recommended: on LEXICAL_RERANK_WEIGHT=0.05 SKIP_BARE_FILES=['.py', '.html', '.md', '.css'] ``` -------------------------------- ### Tail Log File on Windows Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Use Get-Content with -Wait and -Tail to monitor the log file in real-time on Windows. ```powershell Get-Content .brain\server.log -Wait -Tail 30 ``` -------------------------------- ### Zerikai Memory Architecture Overview Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Illustrates the data flow from your codebase and questions to the final AI-synthesized answer with citations. It shows how Zerikai Memory uses local parsing, a vector store, and an MCP server for semantic search and LLM synthesis. ```text Your Codebase ──► tree-sitter (local parse) ──► ChromaDB (vector store) │ Your Question ──► MCP Server ──► semantic search ──► │ │ ▼ └──────────────────────► Ollama / DeepSeek (auto-routed synthesis) │ ▼ Answer + #file:line citations ``` -------------------------------- ### Live Stream Logs (macOS/Linux) Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md Monitor server activity, runtime operations, and auto-routing logs in real-time. This command is for macOS and Linux. ```bash tail -f .brain/server.log ``` -------------------------------- ### VS Code (Copilot / Cline) Server Command Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Command to register a local server for VS Code using the STDIO protocol. Ensure the path to Python and the main script are absolute. ```bash C:\path\to\zerikai_memory\venv\Scripts\python.exe C:\path\to\zerikai_memory\main.py ``` -------------------------------- ### macOS/Linux Server Command for VS Code Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Alternative command for macOS and Linux systems using forward slashes for paths. ```bash /path/to/zerikai_memory/venv/bin/python ``` -------------------------------- ### Cursor MCP Config Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Configuration for Cursor IDE's MCP server, using a JSON format with command and arguments. ```json { "mcpServers": { "universal-brain": { "command": "/path/to/zerikai_memory/venv/bin/python", "args": ["/path/to/zerikai_memory/main.py"] } } } ``` -------------------------------- ### Google Antigravity MCP Config Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Configuration for Google Antigravity's MCP server, specifying the command and arguments. ```json "universal-brain": { "command": "C:\\path\\to\\zerikai_memory\\venv\\Scripts\\python.exe", "args": ["C:\\path\\to\\zerikai_memory\\main.py"], "disabled": false } ``` -------------------------------- ### Project Configuration Variables Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md These variables control file skipping, lexical re-ranking, and its associated weight. They are typically set in a configuration file. ```python SKIP_BARE_FILES=['.py', '.html', '.md', '.css'] ENABLE_LEXICAL_RERANK=true LEXICAL_RERANK_WEIGHT=0.05 ``` -------------------------------- ### Zerikai Memory Query Pipeline Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Details the four-stage process for handling queries: receiving the query, performing a vector search, optionally re-ranking results lexically, and synthesizing the final answer using an LLM. This pipeline ensures efficient and relevant context retrieval. ```text 1. Receive query │ ▼ 2. Vector search (ChromaDB) ──► top-N results by L2 distance │ ▼ 3. Lexical re-rank (optional) ──► boost on keyword hits in entity name + docstring │ pure reorder, nothing dropped ▼ 4. LLM synthesis ──► Ollama (free) or DeepSeek (cloud, auto-routed) │ ▼ Answer + inline #file:line (distance) citations ``` -------------------------------- ### Force Project Brief Refresh Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Use this command to force a refresh of the project brief when significant architectural changes occur. This action resets the KV cache, so it should be used judiciously. ```shell "Rescan the workspace and force a refresh of the project brief." ``` -------------------------------- ### Run Embedding-Docstring Skill Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Initiate the embedding-docstring skill to audit and optimize docstrings across the project for better vector search performance. This respects the .memignore file and only processes files intended for indexing. ```shell "Audit and optimise docstrings across this project using the embedding-docstring skill, respecting .memignore." ``` ```shell "Audit docstrings in api_handler.py using the embedding-docstring skill" ``` ```shell "Optimise the docstring for authenticate_user for vector search" ``` -------------------------------- ### Local Server Configuration for MCP Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md Configuration to add a local server for universal-brain access within the Claude Desktop application. Update the path to match your project's Python executable. ```json { "mcpServers": { "universal-brain": { "command": "C:\\path\\to\\zerikai_memory\\venv\\Scripts\\python.exe", "args": ["C:\\path\\to\\zerikai_memory\\main.py"] } } } ``` -------------------------------- ### Live Stream Logs (Windows PowerShell) Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md Monitor server activity, runtime operations, and auto-routing logs in real-time. This command is for Windows PowerShell. ```powershell Get-Content .\brain\server.log -Wait -Tail 30 ``` -------------------------------- ### Zerikai Memory Architecture Diagram Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md Illustrates the flow of data and processing stages within Zerikai Memory, from codebase parsing to LLM synthesis. ```text Your Codebase → tree-sitter (local parse) → ChromaDB (.brain/) │ Your IDE → MCP Server (:stdio) → ▼ Ollama / DeepSeek │ (auto-routed synthesis) ┌─────────┴──────────────┐ │ 4-Stage Pipeline │ │ L1 Vector Search │ ChromaDB L2 distance matching │ L2 Lexical Re-rank │ Keyword overlap boost on names │ L3 Auto-Routing │ Ollama (free) vs. DeepSeek Cloud │ L4 LLM Synthesis │ Answer + inline #file:line citations └────────────────────────┘ ``` -------------------------------- ### Assistant Command for Workspace Scan Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Command to instruct the assistant to scan and index the workspace. ```text "Scan and index the workspace." ``` -------------------------------- ### Assistant Command for Docstring Optimization Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Instruction to the assistant to audit and optimize docstrings using the embedding-docstring skill, respecting .memignore. ```text "Audit and optimise docstrings across this project using the embedding-docstring skill, respecting .memignore." ``` -------------------------------- ### Source Discipline Rule Source: https://github.com/kikeven/zerikai_memory/blob/main/agent_rules/ide_agent_rules.md Always surface the full source citation from `universal-brain` in every answer, including a clickable file link with line number and the confidence score. Never fabricate answers; if the MCP doesn't know, state it and escalate. ```markdown 2. SOURCE DISCIPLINE: Always surface the full source citation from `universal-brain` in every answer. This serves both the agent (as an L2 entry point for deeper digging) and the user (to navigate directly to the relevant code). Each citation must include: - A clickable file link with line number (e.g., `file.py:136`) - The confidence score returned by the MCP (e.g., `0.80`) Never fabricate answers — if the MCP doesn't know, say so and escalate. ``` -------------------------------- ### Reset Workspace Memory (Windows) Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md Use this script to delete stale workspace data if a crawl was executed before configuring `.memignore`. This command is for Windows. ```bash .\venv\Scripts\python.exe drop_memory.py "Workspace Name" ``` -------------------------------- ### Reset Workspace Memory (macOS/Linux) Source: https://github.com/kikeven/zerikai_memory/blob/main/README.md Use this script to delete stale workspace data if a crawl was executed before configuring `.memignore`. This command is for macOS and Linux. ```bash venv/bin/python drop_memory.py "Workspace Name" ``` -------------------------------- ### Drop Workspace Memory on Windows Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Execute the drop_memory.py script to remove a workspace's memory data on Windows. Requires specifying the workspace name or UUID. ```bash .\venv\Scripts\python.exe drop_memory.py "Workspace Name" # or by UUID .\venv\Scripts\python.exe drop_memory.py workspace-uuid ``` -------------------------------- ### Required .gitignore Entries Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md These entries prevent sensitive information like API keys and local vector databases from being committed to version control. Ensure these files are not tracked by Git. ```gitignore .env # Contains DEEPSEEK_API_KEY .brain/ # Contains local vector DB and project briefs ``` -------------------------------- ### Filter Errors in Log File on macOS/Linux Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Use grep to filter for lines containing 'ERROR' in the log file on macOS and Linux. ```bash grep "ERROR" .brain/server.log ``` -------------------------------- ### Drop Workspace Memory on macOS/Linux Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Execute the drop_memory.py script to remove a workspace's memory data on macOS or Linux. Requires specifying the workspace name or UUID. ```bash venv/bin/python drop_memory.py "Workspace Name" # or by UUID venv/bin/python drop_memory.py workspace-uuid ``` -------------------------------- ### Filter Errors in Log File on Windows Source: https://github.com/kikeven/zerikai_memory/blob/main/documentation/README_FULL.md Use Select-String to filter for lines containing 'ERROR' in the log file on Windows. ```powershell Select-String -Path .brain\server.log -Pattern "ERROR" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.