### Install AIVectorMemory using uvx (zero install) Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Runs AIVectorMemory directly without pip installation using uvx. Requires uv to be installed. uvx auto-downloads and runs the package. ```bash cd /path/to/your/project uvx aivectormemory install ``` -------------------------------- ### Run AIVectorMemory Installation Source: https://github.com/edlineas/aivectormemory/blob/main/website/index.html Execute the AIVectorMemory installation command to configure MCP for supported IDEs. This command automates the setup process. ```bash $avmrun install ✓ 已自动为 Cursor、Claude Code、VSCode 等 10 款 IDE 配置 MCP ``` -------------------------------- ### Install AIVectorMemory using pip Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Installs the AIVectorMemory package. Use the upgrade command to get the latest version. Navigate to your project directory and run 'run install' for IDE setup. ```bash # Install pip install aivectormemory # Upgrade to latest version pip install --upgrade aivectormemory # Navigate to your project directory, one-click IDE setup cd /path/to/your/project run install ``` -------------------------------- ### Start AIVectorMemory Web Dashboard Source: https://github.com/edlineas/aivectormemory/blob/main/website/index.html Launch the AIVectorMemory web data dashboard. Access it via the provided local URL. ```bash $avmrun web # 启动 Web 数据看板 → http://localhost:9080 ``` -------------------------------- ### Steering Rules Example for AIVectorMemory Source: https://github.com/edlineas/aivectormemory/blob/main/README.md An example of auto-generated steering rules for AIVectorMemory, detailing session startup, message processing flow, and blocking rules for AI interaction. ```markdown # AIVectorMemory - Workflow Rules ## 1. New Session Startup (execute in order) 1. `recall` (tags: ["project-knowledge"], scope: "project", top_k: 100) load project knowledge 2. `recall` (tags: ["preference"], scope: "user", top_k: 20) load user preferences 3. `status` (no state param) read session state 4. Blocked → report and wait; Not blocked → enter processing flow ## 2. Message Processing Flow - Step A: `status` read state, wait if blocked - Step B: Classify message type (chat/correction/preference/code issue) - Step C: `track create` record issue - Step D: Investigate (`recall` pitfalls + read code + find root cause) - Step E: Present plan to user, set blocked awaiting confirmation - Step F: Modify code (`recall` pitfalls before changes) - Step G: Run tests to verify - Step H: Set blocked awaiting user verification - Step I: User confirms → `track archive` + clear block ## 3. Blocking Rules Must `status({ is_blocked: true })` when proposing plans or awaiting verification. Only clear after explicit user confirmation. Never self-clear. ``` -------------------------------- ### Build macOS Installer Image Source: https://github.com/edlineas/aivectormemory/blob/main/desktop/README.md Builds a redistributable, production mode package for macOS. This command generates a drag-install image for easy application installation. ```bash cd desktop /tmp/gopath/bin/wails build -clean -platform darwin/amd64 -m -nosyncgomod ./build/package_dmg.sh ``` -------------------------------- ### Install AIVectorMemory using Homebrew Python (macOS) Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Installs AIVectorMemory using Homebrew Python, necessary for macOS users experiencing SQLite extension loading issues with default Python installations. ```bash brew install python /opt/homebrew/bin/python3 -m pip install aivectormemory ``` -------------------------------- ### Install AIVectorMemory Source: https://github.com/edlineas/aivectormemory/blob/main/website/index.html Install the AIVectorMemory package using pip. This command sets up the necessary components for IDE integration. ```bash $pip install aivectormemory ``` -------------------------------- ### Trial AIVectorMemory with uvx Source: https://github.com/edlineas/aivectormemory/blob/main/website/index.html Use uvx for a zero-installation trial of AIVectorMemory. This command allows quick testing without a full installation. ```bash $ uvx aivectormemory install ``` -------------------------------- ### Kiro Hooks Configuration Example Source: https://github.com/edlineas/aivectormemory/blob/main/README.md This JSON configuration is used for Kiro hooks, specifically for a 'Dev Workflow Check'. It defines when the hook is enabled and the prompt to be used when a prompt is submitted. ```json { "enabled": true, "name": "Dev Workflow Check", "version": "1", "when": { "type": "promptSubmit" }, "then": { "type": "askAgent", "prompt": "Core principles: verify before acting, no blind testing, only mark done after tests pass" } } ``` -------------------------------- ### Run Web Dashboard Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Start the AIVectorMemory web dashboard. Customize the port and suppress logs if needed. The dashboard can be run in the background on macOS/Linux. ```bash run web --port 9080 ``` ```bash run web --port 9080 --quiet # Suppress request logs ``` ```bash run web --port 9080 --quiet --daemon # Run in background (macOS/Linux) ``` -------------------------------- ### Add Language Parameter to Hook Functions Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md Adds an optional 'lang' parameter to hook writing functions to specify the language for the hooks. This is used when generating hooks during the installation process. ```python def _write_cursor_hooks(hooks_dir, lang: str | None = None): # ... implementation ... def _write_windsurf_hooks(hooks_dir, lang: str | None = None): # ... implementation ... # In run_install(): _write_claude_code_hooks(hooks_dir, lang=selected_lang) _write_cursor_hooks(hooks_dir, lang=selected_lang) _write_windsurf_hooks(hooks_dir, lang=selected_lang) ``` -------------------------------- ### Custom DMG Packaging Script Usage Source: https://github.com/edlineas/aivectormemory/blob/main/desktop/build/README.md Allows specifying custom paths for the application bundle and the output DMG file when using the packaging script. ```bash ./build/package_dmg.sh /path/to/AIVectorMemory.app /path/to/output.dmg ``` -------------------------------- ### Manual MCP Server Configuration (JSON) Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Manual configuration for the MCP server, specifying the command and arguments to run AIVectorMemory. ```json { "mcpServers": { "aivectormemory": { "command": "run", "args": ["--project-dir", "/path/to/your/project"] } } } ``` -------------------------------- ### Set Hugging Face Mirror Endpoint Source: https://github.com/edlineas/aivectormemory/blob/main/README.md This environment variable can be set to use a mirror for Hugging Face model downloads, which can be faster in certain regions. It is recommended for users in China. ```bash export HF_ENDPOINT=https://hf-mirror.com ``` -------------------------------- ### Generate or Diff README Content Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Use the `readme` action to auto-generate or compare README content. Supports multiple languages and specific sections. ```shell action (string) "generate" (default) / "diff" (compare differences) lang (string) Language: en / zh-TW / ja / de / fr / es sections (string[]) Specify sections: header / tools / deps ``` -------------------------------- ### Manual MCP Server Configuration (TOML for Codex) Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Manual configuration for the MCP server using TOML format for Codex IDE. This configuration is project-scoped and loaded after the repository is marked as trusted. ```toml [mcp_servers.aivectormemory] command = "run" args = ["--project-dir", "/path/to/your/project"] ``` -------------------------------- ### MCP Configuration for Hugging Face Mirror Source: https://github.com/edlineas/aivectormemory/blob/main/README.md This JSON configuration snippet shows how to set environment variables within the Model Context Protocol (MCP) configuration. It specifically sets the HF_ENDPOINT to a mirror for Hugging Face model downloads. ```json { "env": { "HF_ENDPOINT": "https://hf-mirror.com" } } ``` -------------------------------- ### Fix Transaction Deadlock in DB Begin Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md Adjusts the order of operations in the DB.Begin() function to prevent deadlocks by performing conn.Begin() before acquiring the mutex lock. This ensures that if conn.Begin() fails, the mutex is not held. ```go func (d *DB) Begin() (*sql.Tx, error) { tx, err := d.conn.Begin() if err != nil { return nil, err // 未持有锁,安全返回 } d.mu.Lock() return tx, nil } ``` -------------------------------- ### Set Hugging Face Hub Download Timeout Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md Configures the timeout for downloading models from Hugging Face Hub by setting the HF_HUB_TIMEOUT environment variable. This helps prevent excessively long download times. ```python # In aivectormemory/embedding/engine.py # Set environment variable for download timeout import os os.environ['HF_HUB_TIMEOUT'] = '30' ``` -------------------------------- ### Task Management Command Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Manages tasks, supporting batch creation, updates, listing, deletion, and archiving. Links to spec docs and auto-syncs with issue status. ```text action (string, required) "batch_create" / "update" / "list" / "delete" / "archive" feature_id (string) Linked feature identifier (required for list) tasks (array) Task list (batch_create, supports subtasks) task_id (integer) Task ID (update) status (string) "pending" / "in_progress" / "completed" / "skipped" ``` -------------------------------- ### Manage Code Knowledge Graph Source: https://github.com/edlineas/aivectormemory/blob/main/README.md The `graph` action manages a code knowledge graph for tracking function calls, data flows, and dependencies. Supports querying, tracing, and adding/removing nodes and edges. ```shell action (string, required) "query" / "trace" / "batch" / "add_node" / "add_edge" / "remove" / "refresh" name (string) Entity name (add_node/query) entity_type (string) Entity type: function/class/module/api/table/config (add_node/query) file_path (string) File path, auto-converts to relative (add_node/query/refresh) source (string) Source node name or ID (add_edge) target (string) Target node name or ID (add_edge) relation (string) Relation type: calls/imports/inherits/uses/depends_on/contains (add_edge/trace) start (string) Start node name or ID (trace) direction (string) Traversal direction: "up" / "down" / "both" (trace) max_depth (integer) Max traversal depth, default 3 (trace) ``` -------------------------------- ### Format Readme Content as JSON Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md Ensures that the content returned by the readme handler is properly formatted as JSON using a `to_json()` wrapper. This prevents non-standard JSON output when converting the result to a string. ```python return to_json({"content": content, "lang": lang, ...}) ``` -------------------------------- ### Remember Memory Command Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Stores a memory with specified content and tags. Similarity above 0.95 auto-updates existing memories. ```text content (string, required) Memory content in Markdown format tags (string[], required) Tags, e.g. ["pitfall", "python"] scope (string) "project" (default) / "user" (cross-project) ``` -------------------------------- ### v12 Migration Script for Data Cleanup Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md A Python script for database migration version 12. It performs several cleanup operations including deleting memories with specific tags like '[问题追踪]', 'modification', 'todo', 'decision', and '行为纠正', as well as cleaning up orphaned memory tags. ```python def upgrade(conn, **_): # 29a: 删除 [问题追踪] 开头的记忆 conn.execute(""" DELETE FROM memory_tags WHERE memory_id IN ( SELECT id FROM memories WHERE content LIKE '[问题追踪]%' )""") conn.execute("DELETE FROM vec_memories WHERE id IN (SELECT id FROM memories WHERE content LIKE '[问题追踪]%')") conn.execute("DELETE FROM memories WHERE content LIKE '[问题追踪]%'") # 29b: 删除 modification/todo/decision 旧碎片 conn.execute(""" DELETE FROM memory_tags WHERE memory_id IN ( SELECT id FROM memories WHERE (tags LIKE '%"modification"%' OR tags LIKE '%"todo"%' OR tags LIKE '%"decision"%') AND tags NOT LIKE '%"preference"%' AND tags NOT LIKE '%"项目知识"%' )""") conn.execute(""" DELETE FROM vec_memories WHERE id IN ( SELECT id FROM memories WHERE (tags LIKE '%"modification"%' OR tags LIKE '%"todo"%' OR tags LIKE '%"decision"%') AND tags NOT LIKE '%"preference"%' AND tags NOT LIKE '%"项目知识"%' )""") conn.execute(""" DELETE FROM memories WHERE (tags LIKE '%"modification"%' OR tags LIKE '%"todo"%' OR tags LIKE '%"decision"%') AND tags NOT LIKE '%"preference"%' AND tags NOT LIKE '%"项目知识"%' """) # 29c: 清理孤立标签 conn.execute("DELETE FROM memory_tags WHERE memory_id NOT IN (SELECT id FROM memories)") conn.execute("DELETE FROM user_memory_tags WHERE memory_id NOT IN (SELECT id FROM user_memories)") # 29e: 删除行为纠正类记忆 conn.execute(""" DELETE FROM memory_tags WHERE memory_id IN ( SELECT id FROM memories WHERE tags LIKE '%"行为纠正"%' )""") conn.execute("DELETE FROM vec_memories WHERE id IN (SELECT id FROM memories WHERE tags LIKE '%"行为纠正"%')") conn.execute("DELETE FROM memories WHERE tags LIKE '%"行为纠正"%'") conn.commit() ``` -------------------------------- ### Track Command Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Manages issue tracking, allowing creation, updating, archiving, and listing of issues. Supports detailed content and status updates. ```text action (string) "create" / "update" / "archive" / "list" title (string) Issue title issue_id (integer) Issue ID status (string) "pending" / "in_progress" / "completed" content (string) Investigation content ``` -------------------------------- ### Check tx.Exec Errors in ImportMemories Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md Ensures that errors returned by tx.Exec() are checked and handled by rolling back the transaction and returning the error. This is crucial for maintaining data integrity during memory import operations. ```go if _, err := tx.Exec(...); err != nil { tx.Rollback() return imported, skipped, err } ``` -------------------------------- ### Status Command Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Reads or updates the session state, including blocking status, current task, and progress. Omit 'state' to read, pass an object to update. ```text state (object, optional) Omit to read, pass to update is_blocked, block_reason, current_task, next_step, progress[], recent_changes[], pending[] ``` -------------------------------- ### Recall Memory Command Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Performs semantic search to find related memories. Supports filtering by tags and specifying the number of results. ```text query (string) Semantic search keywords tags (string[]) Exact tag filter scope (string) "project" / "user" / "all" top_k (integer) Number of results, default 5 ``` -------------------------------- ### Extend English Stopwords Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md Expands the set of English stopwords by adding system management-related terms. This improves keyword extraction by ignoring common but irrelevant words. ```python _EN_STOP |= {"modification", "todo", "decision", "issue", "task", "track", "feature", "problem", "bug", "question", "tracking", "description", "update", "change", "pitfall", "information"} ``` -------------------------------- ### Auto Save User Preferences Source: https://github.com/edlineas/aivectormemory/blob/main/README.md The `auto_save` action extracts and stores user preferences from conversations. It supports deduplication and works across projects. ```shell preferences (string[]) User-expressed technical preferences (fixed scope=user, cross-project) extra_tags (string[]) Additional tags ``` -------------------------------- ### CSS Font Import Source: https://github.com/edlineas/aivectormemory/blob/main/design-system/aivectormemory/MASTER.md Import Google Fonts for Space Grotesk and DM Sans. Ensure these fonts are loaded before applying them to text elements. ```css @import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Space+Grotesk:wght@400;500;600;700&display=swap'); ``` -------------------------------- ### AIVectorMemory Architecture Diagram Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Visual representation of the AIVectorMemory architecture, showing the interaction between AI IDEs, the AIVectorMemory Server, the Embedding Engine, and the Vector Index. ```text ┌─────────────────────────────────────────────────┐ │ AI IDE │ │ OpenCode / Codex / Claude Code / Cursor / ... │ └──────────────────────┬──────────────────────────┘ │ MCP Protocol (stdio) ┌──────────────────────▼──────────────────────────┐ │ AIVectorMemory Server │ │ │ │ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │ │ │ remember │ │ recall │ │ auto_save │ │ │ │ forget │ │ task │ │ status/track │ │ │ └────┬─────┘ └────┬─────┘ └───────┬──────────┘ │ │ │ │ │ │ │ ┌────▼────────────▼───────────────▼──────────┐ │ │ │ Embedding Engine (ONNX) │ │ │ │ intfloat/multilingual-e5-small │ │ │ └────────────────────┬───────────────────────┘ │ │ │ │ │ ┌────────────────────▼───────────────────────┐ │ │ │ SQLite + sqlite-vec (Vector Index) │ │ │ │ ~/.aivectormemory/memory.db │ │ │ └────────────────────────────────────────────┘ │ └──────────────────────────────────────────────────┘ ``` -------------------------------- ### Configure SQLite Busy Timeout Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md Sets the busy timeout for SQLite connections to 5000 milliseconds. This helps prevent transaction failures when the database is busy. ```python # In aivectormemory/db/connection.py conn.execute("PRAGMA busy_timeout=5000") ``` -------------------------------- ### Embedding Engine Encode with Fallback Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md Handles potential exceptions during the embedding encoding process. If an error occurs or the input text is empty, it logs a warning and returns a zero vector to ensure graceful degradation. ```python def encode(self, text: str) -> list[float]: if not text or not text.strip(): return [0.0] * MODEL_DIMENSION try: if not self.ready: self.load() return list(self._encode_cached(text)) except Exception as e: log.warning("Embedding encode failed: %s, returning zero vector", e) return [0.0] * MODEL_DIMENSION ``` -------------------------------- ### Handle QueryRow Scan Errors in Go Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md Adds error checking to `QueryRow().Scan()` operations in Go to log potential scanning errors. For count queries, it's acceptable to log the error and proceed with a zero value. ```go // Before: d.QueryRow("SELECT COUNT(*) FROM memories").Scan(&r.MemoriesTotal) // After: if err := d.QueryRow("SELECT COUNT(*) FROM memories").Scan(&r.MemoriesTotal); err != nil { log.Printf("scan error: %v", err) } ``` -------------------------------- ### Modal CSS Source: https://github.com/edlineas/aivectormemory/blob/main/design-system/aivectormemory/MASTER.md Styles for modal overlays and content containers. Utilizes backdrop filter for a blurred background effect and shadow for depth. ```css .modal-overlay { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); } .modal { background: white; border-radius: 16px; padding: 32px; box-shadow: var(--shadow-xl); max-width: 500px; width: 90%; } ``` -------------------------------- ### Input Field CSS Source: https://github.com/edlineas/aivectormemory/blob/main/design-system/aivectormemory/MASTER.md Styling for input fields, including focus states and transitions. Ensures a clean and responsive user input experience. ```css .input { padding: 12px 16px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 16px; transition: border-color 200ms ease; } .input:focus { border-color: #1E293B; outline: none; box-shadow: 0 0 0 3px #1E293B20; } ``` -------------------------------- ### Extend Chinese Stopwords Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md Expands the set of Chinese stopwords by adding relevant terms. This enhances keyword extraction for Chinese text. ```python _CN_STOP |= {"修改", "任务", "问题", "追踪", "记录", "描述", "功能", "更新"} ``` -------------------------------- ### Primary Button CSS Source: https://github.com/edlineas/aivectormemory/blob/main/design-system/aivectormemory/MASTER.md Styles for a primary action button. Includes hover effects for visual feedback. Use for main calls to action. ```css /* Primary Button */ .btn-primary { background: #2563EB; color: white; padding: 12px 24px; border-radius: 8px; font-weight: 600; transition: all 200ms ease; cursor: pointer; } .btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); } ``` -------------------------------- ### Forget Memory Command Source: https://github.com/edlineas/aivectormemory/blob/main/README.md Deletes memories by their unique ID or a batch of IDs. ```text memory_id (string) Single ID memory_ids (string[]) Batch IDs ``` -------------------------------- ### Card Component CSS Source: https://github.com/edlineas/aivectormemory/blob/main/design-system/aivectormemory/MASTER.md Basic styling for a card component. Includes hover effect with a subtle shadow and border color change. Use for content containers. ```css .card { background: #FFFFFF; border: 1px solid #E5E5E3; border-radius: 12px; padding: 24px; transition: all 200ms ease; cursor: pointer; } .card:hover { box-shadow: var(--shadow-md); border-color: #D4D4D2; } ``` -------------------------------- ### Secondary Button CSS Source: https://github.com/edlineas/aivectormemory/blob/main/design-system/aivectormemory/MASTER.md Styles for a secondary button, suitable for less critical actions. Features a transparent background and border. ```css /* Secondary Button */ .btn-secondary { background: transparent; color: #191919; border: 1px solid #E5E5E3; padding: 12px 24px; border-radius: 8px; font-weight: 600; transition: all 200ms ease; cursor: pointer; } .btn-secondary:hover { background: #F7F7F5; border-color: #D4D4D2; } ``` -------------------------------- ### Intersection Observer for Element Visibility Source: https://github.com/edlineas/aivectormemory/blob/main/website/index.html This JavaScript code uses the Intersection Observer API to add a 'visible' class to elements when they enter the viewport. It's configured with a 0.1 threshold and a root margin. ```javascript const obs = new IntersectionObserver(entries => { entries.forEach(e => { if (e.isIntersecting) e.target.classList.add('visible'); }); }, { threshold: 0.1, rootMargin: '0px 0px -40px 0px' }); document.querySelectorAll('.reveal').forEach(el => obs.observe(el)); ``` -------------------------------- ### Safe JSON Parsing Function Source: https://github.com/edlineas/aivectormemory/blob/main/docs/specs/code-quality-audit/design.md A utility function to safely parse JSON strings, returning an empty list or the parsed list on success, and an empty list on decoding or type errors. Handles cases where the input is already a list. ```python def _safe_parse_tags(raw): if isinstance(raw, list): return raw try: return json.loads(raw) if isinstance(raw, str) else [] except (json.JSONDecodeError, TypeError): return [] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.