### Node.js Project Setup Source: https://github.com/george-rd/mag/blob/main/conductor/workflow.md Installs project dependencies for a Node.js project. Run this command in your project's root directory. ```bash npm install ``` -------------------------------- ### Define Setup Functions for Tool Configuration Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/connector-wave-plan.md Declares the function signatures for installing tool-specific configuration assets in setup.rs. ```rust pub fn install_agents_md(tool: AiTool, home: &Path) -> Result pub fn install_skills(tool: AiTool, home: &Path) -> Result pub fn install_rules(tool: AiTool, home: &Path, project_root: Option<&Path>) -> Result ``` -------------------------------- ### Install MAG Source: https://context7.com/george-rd/mag/llms.txt Use the shell installer or various package managers to install the MAG binary. ```bash # Shell installer (recommended - auto-configures AI tools) curl -fsSL https://raw.githubusercontent.com/George-RD/mag/main/install.sh | sh # Or via package managers brew install George-RD/mag/mag # Homebrew npm install -g mag-memory # npm cargo install mag-memory # Cargo pip install mag-memory # pip uv tool install mag-memory # uv ``` -------------------------------- ### Start mag Memory Server Source: https://github.com/george-rd/mag/blob/main/python/README.md This command starts the mag memory server. The native binary is downloaded automatically on the first run, and all CLI arguments are passed through to the Rust binary. ```bash # Start the MCP server mag serve # The native binary is downloaded automatically on first run. # All CLI arguments are passed through to the Rust binary. ``` -------------------------------- ### Install MAG via Package Managers Source: https://github.com/george-rd/mag/blob/main/README.md Standard installation commands for various package managers. ```bash brew install George-RD/mag/mag ``` ```bash npm install -g mag-memory ``` ```bash uv tool install mag-memory ``` ```bash pip install mag-memory ``` ```bash cargo install mag-memory ``` -------------------------------- ### Install Skills for Cross-tool Integration Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/mag-improvement-plan.md Required setup for Tier 2 tools like Codex CLI and OpenCode to enable necessary functionality. ```rust install_skills() ``` -------------------------------- ### Example Memory Store Call Source: https://github.com/george-rd/mag/blob/main/docs/SETUP.md Demonstrates the syntax for storing a memory with specific tags. ```text memory_store("Use exponential backoff with jitter for retries", tags: ["project:api-gateway", "decision"]) ``` -------------------------------- ### Go Project Setup Source: https://github.com/george-rd/mag/blob/main/conductor/workflow.md Initializes and updates Go module dependencies. Ensure you are in the project's root directory. ```bash go mod tidy ``` -------------------------------- ### MAG CLI: Start MCP Server Source: https://context7.com/george-rd/mag/llms.txt Start the MCP server using the 'mag serve' command. Supports stdio transport by default. Use '--cross-encoder' to enable cross-encoder reranking. ```bash # Start MCP server (stdio transport) mag serve # Start with cross-encoder reranking enabled mag serve --cross-encoder ``` -------------------------------- ### Conventional Commit Examples Source: https://github.com/george-rd/mag/blob/main/conductor/workflow.md Examples of commit messages following the conventional commit format for different types of changes. Use these as a guide for your commits. ```bash git commit -m "feat(auth): Add remember me functionality" ``` ```bash git commit -m "fix(posts): Correct excerpt generation for short posts" ``` ```bash git commit -m "test(comments): Add tests for emoji reaction limits" ``` ```bash git commit -m "style(mobile): Improve button touch targets" ``` -------------------------------- ### Install mag-memory package Source: https://github.com/george-rd/mag/blob/main/npm/README.md Install the package via npm to automatically download the platform-specific binary. ```bash npm install mag-memory ``` -------------------------------- ### Run MCP Server Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Start the Memory Communication Protocol (MCP) server in release mode. ```bash ./target/release/mag serve ``` -------------------------------- ### Install mag-memory Package Source: https://github.com/george-rd/mag/blob/main/python/README.md Use this command to install the mag-memory package using pip. ```bash pip install mag-memory ``` -------------------------------- ### Start MCP server Source: https://github.com/george-rd/mag/blob/main/docs/cli-reference.md Initializes the MCP server using stdio transport, with optional cross-encoder support. ```bash mag serve mag serve --cross-encoder ``` -------------------------------- ### Log MAG session start event Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/wave1-implementation-blueprint.md This script logs the start of a MAG session, including project and session IDs, before invoking the 'mag welcome' command. It ensures logging occurs even if the 'mag' command fails. Output is appended to a log file in the user's home directory. ```shell #!/bin/sh # MAG session start — recall project context # Outputs memory context for Claude Code injection set -eu PROJECT="$(basename "$PWD")" SESSION_ID="${CLAUDE_SESSION_ID:-unknown}" LOG="$HOME/.mag/auto-capture.log" # Log BEFORE invocation so failed mag calls are still recorded mkdir -p "$HOME/.mag" printf '%s session_start project=%s session=%s\n' \ "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$PROJECT" "$SESSION_ID" >> "$LOG" 2>/dev/null || true mag welcome --project "$PROJECT" --session-id "$SESSION_ID" 2>/dev/null || true ``` -------------------------------- ### Example of using existing CLI commands Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/improvement-plan-dg-r2.md This shows how hook scripts could be rewritten to use existing CLI commands like `mag welcome` instead of the unimplemented `mag hook` subcommand. Note the absence of a `--budget-tokens` equivalent. ```bash mag welcome --project ... ``` -------------------------------- ### Run system diagnostics Source: https://github.com/george-rd/mag/blob/main/docs/cli-reference.md Validates the MAG setup and reports diagnostic information. ```bash mag doctor mag doctor --verbose ``` -------------------------------- ### Configure MAG Source: https://github.com/george-rd/mag/blob/main/README.md Run the setup command to detect AI tools and generate MCP configuration. ```bash mag setup ``` -------------------------------- ### Run mag CLI commands Source: https://github.com/george-rd/mag/blob/main/npm/README.md Execute the mag binary to start the MCP server or view help documentation. ```bash # Start the MCP server (stdio transport) mag serve # Show help mag --help ``` -------------------------------- ### Set local development binary path Source: https://github.com/george-rd/mag/blob/main/npm/README.md Use the MAG_BINARY_PATH environment variable to point to a local build during installation. ```bash MAG_BINARY_PATH=./target/release/mag npm install ``` -------------------------------- ### Install MAG CLI Source: https://github.com/george-rd/mag/blob/main/README.md Installs the MAG command-line interface using a curl script. This command auto-detects AI tools for configuration. ```bash curl -fsSL https://raw.githubusercontent.com/George-RD/mag/main/install.sh | sh ``` -------------------------------- ### Execute Automated Test Suite Source: https://github.com/george-rd/mag/blob/main/conductor/workflow.md Example command for running automated tests during the verification phase. ```bash CI=true npm test ``` -------------------------------- ### MAG Serve Source: https://github.com/george-rd/mag/blob/main/docs/cli-reference.md Starts the MCP server over stdio transport. Can optionally enable cross-encoder reranking. ```APIDOC ## `mag serve` ### Description Start the MCP server over stdio transport. ### Method CLI Command ### Endpoint `mag serve` ### Parameters #### Query Parameters - **cross-encoder** (boolean) - Optional - Default: `false` - Enable cross-encoder reranking. ### Request Example ```bash mag serve mag serve --cross-encoder ``` ``` -------------------------------- ### Configure MAG via npx Source: https://github.com/george-rd/mag/blob/main/docs/SETUP.md Alternative configuration using npx to avoid local binary installation. ```json { "command": "npx", "args": ["-y", "mag-memory", "serve"] } ``` -------------------------------- ### Node.js Daily Development Commands Source: https://github.com/george-rd/mag/blob/main/conductor/workflow.md Starts the development server, runs tests, and lints code for a Node.js project. Use these for regular development tasks. ```bash npm run dev ``` ```bash npm test ``` ```bash npm run lint ``` -------------------------------- ### Implement Compact Refresh Hook Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/wave1-implementation-blueprint.md Re-injects top memories after context compaction. Requires the mag CLI to be installed. ```sh #!/bin/sh # MAG post-compact — re-inject top memories after context compaction # Budget trimming deferred to Wave 2 (requires --budget-tokens flag, not yet in Rust) set -eu PROJECT="$(basename "$PWD")" SESSION_ID="${CLAUDE_SESSION_ID:-unknown}" LOG="$HOME/.mag/auto-capture.log" mkdir -p "$HOME/.mag" printf '%s compact_refresh project=%s session=%s\n' \ "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$PROJECT" "$SESSION_ID" >> "$LOG" 2>/dev/null || true mag welcome --project "$PROJECT" --session-id "$SESSION_ID" 2>/dev/null || true ``` -------------------------------- ### Manual MCP Configuration via npx Source: https://github.com/george-rd/mag/blob/main/README.md Configuration for running MAG via npx without a global installation. ```json { "mcpServers": { "mag": { "command": "npx", "args": ["-y", "mag-memory", "serve"] } } } ``` -------------------------------- ### Manage Memory Relations (CLI) Source: https://context7.com/george-rd/mag/llms.txt Manage memory relationships and traverse the knowledge graph using the Mag CLI. Options include listing relationships, traversing the graph, and getting version history. ```bash # CLI: Show relationships for a memory mag relations 01J5K9X2... ``` ```bash # CLI: Traverse graph from a memory mag traverse 01J5K9X2... --max-hops 3 --min-weight 0.5 ``` ```bash # CLI: Get version history chain mag version-chain 01J5K9X2... ``` -------------------------------- ### Session welcome Source: https://github.com/george-rd/mag/blob/main/docs/cli-reference.md Provides a startup briefing including recent activity and pending tasks. ```bash mag welcome --project myapp ``` -------------------------------- ### MAG CLI: Session Welcome Source: https://context7.com/george-rd/mag/llms.txt Initiate a session welcome using the MAG CLI, specifying the project name. ```bash # CLI: Session welcome mag welcome --project myapp ``` -------------------------------- ### Run Quality Gates 1-3 with Prek Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Convenience command to run formatting, linting, and tests. Always use this before pushing. ```bash prek run ``` -------------------------------- ### Build MAG from Source Source: https://github.com/george-rd/mag/blob/main/README.md Clone the repository and build the release binary using Cargo. ```bash git clone https://github.com/George-RD/mag.git && cd mag && cargo build --release ``` -------------------------------- ### View protocol guidelines Source: https://github.com/george-rd/mag/blob/main/docs/cli-reference.md Displays available MCP tools and operational documentation. ```bash mag protocol mag protocol --section tools ``` -------------------------------- ### Example `mag hook` CLI subcommand invocations Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/improvement-plan-dg-r2.md These are example invocations of the `mag hook` subcommand found in plugin scripts. The `mag hook` command group is currently unimplemented, causing these scripts to fail silently. ```bash mag hook session-start --project ... --budget-tokens 2000 ``` ```bash mag hook session-end --project ... --session-id ... ``` ```bash mag hook compact-refresh --project ... --budget-tokens 800 ``` -------------------------------- ### GET /memory_lessons Source: https://github.com/george-rd/mag/blob/main/docs/mcp-tools.md Query lesson_learned memories. ```APIDOC ## GET /memory_lessons ### Description Query lesson_learned memories relevant to a task or project. ### Method GET ### Endpoint /memory_lessons ### Parameters #### Query Parameters - **task** (string) - Optional - Task description to match - **project** (string) - Optional - Project filter - **limit** (integer) - Optional - Maximum results (default: 5) ``` -------------------------------- ### GET /memory_list Source: https://github.com/george-rd/mag/blob/main/docs/mcp-tools.md List memories with pagination and filtering capabilities. ```APIDOC ## GET /memory_list ### Description Lists memories with pagination and filtering. ### Method GET ### Endpoint /memory_list ### Query Parameters - **sort** (string) - Optional - Default: "created" - Sort order: "created" (paginated) or "recent" (recently accessed) - **offset** (integer) - Optional - Default: 0 - Pagination offset (created sort only) - **limit** (integer) - Optional - Default: 10 - Maximum results - **event_type** (string) - Optional - Filter by event type - **project** (string) - Optional - Filter by project - **session_id** (string) - Optional - Filter by session - **include_superseded** (boolean) - Optional - Include superseded memories - **event_after** (string) - Optional - ISO 8601 lower bound for event_at - **event_before** (string) - Optional - ISO 8601 upper bound for event_at - **importance_min** (number) - Optional - Minimum importance threshold - **created_after** (string) - Optional - ISO 8601 lower bound for created_at - **created_before** (string) - Optional - ISO 8601 upper bound for created_at - **context_tags** (string[]) - Optional - Context tags ``` -------------------------------- ### GET /memory_session_info Source: https://github.com/george-rd/mag/blob/main/docs/mcp-tools.md Retrieves session-oriented information and tool discovery data. ```APIDOC ## GET /memory_session_info ### Description Provides session-oriented information and tool discovery. ### Method GET ### Endpoint /memory_session_info ### Parameters #### Query Parameters - **mode** (string) - Optional - Mode: "welcome" or "protocol". Default: "welcome" - **session_id** (string) - Optional - Session identifier - **project** (string) - Optional - Project scope ``` -------------------------------- ### Display system paths Source: https://github.com/george-rd/mag/blob/main/docs/cli-reference.md Shows the current configuration paths for data, models, and benchmark caches. ```bash mag paths ``` -------------------------------- ### GET /health Source: https://github.com/george-rd/mag/blob/main/docs/mcp-tools.md Retrieves the health status of the system with optional detail levels. ```APIDOC ## GET /health ### Description Retrieves the health status of the system. ### Method GET ### Endpoint /health ### Parameters #### Query Parameters - **detail** (string) - Optional - Detail level: basic, stats, types, sessions, digest, access_rate. Default: "basic" - **days** (integer) - Optional - Days for digest detail level. Default: 7 ``` -------------------------------- ### Run omega-memory Comparison Source: https://github.com/george-rd/mag/blob/main/docs/benchmarks/methodology.md Compares MAG performance against the omega-memory repository using a local checkout. ```bash COMPARISON_REPO=/path/to/omega-memory OMEGA_REPO="$COMPARISON_REPO" UV_CACHE_DIR=/tmp/uv-cache-mag uv run --project "$COMPARISON_REPO" python benches/python_comparison.py ``` -------------------------------- ### Go Project Daily Development Commands Source: https://github.com/george-rd/mag/blob/main/conductor/workflow.md Runs the main application, executes unit tests, and formats Go code. These are common commands for Go development. ```bash go run main.go ``` ```bash go test ./... ``` ```bash go fmt ./... ``` -------------------------------- ### Get version history Source: https://github.com/george-rd/mag/blob/main/docs/cli-reference.md Retrieves the full version history chain for a specific memory. ```bash mag version-chain 01J5K9X2... ``` -------------------------------- ### Run Benchmarks Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Execute benchmarks for performance evaluation. Use --grid-search for parameter optimization. ```bash cargo run --release --bin longmemeval_bench ``` ```bash cargo run --release --bin longmemeval_bench -- --grid-search ``` -------------------------------- ### System Prompt Patterns Source: https://github.com/george-rd/mag/blob/main/docs/SETUP.md Recommended instructions to include in AI tool system prompts for effective memory usage. ```text When I make an architectural decision, store it with the rationale. Tag with the project name. When I solve a bug, store the root cause and fix. Include the error message. At the end of a work session, store what I was working on and what's next. Tag as "handoff". Before starting work, recall memories for the current project to load context. ``` -------------------------------- ### Query Lessons Learned Source: https://context7.com/george-rd/mag/llms.txt CLI commands to query learned lessons by project or task. ```bash # CLI mag lessons --project myapp --limit 10 mag lessons --task "database migrations" ``` -------------------------------- ### MAG Doctor Source: https://github.com/george-rd/mag/blob/main/docs/cli-reference.md Checks the MAG setup and reports diagnostic information. Supports a verbose mode for detailed output. ```APIDOC ## `mag doctor` ### Description Check MAG setup and report diagnostics. ### Method CLI Command ### Endpoint `mag doctor` ### Parameters #### Query Parameters - **verbose** (boolean) - Optional - Show detailed output. ### Request Example ```bash mag doctor mag doctor --verbose ``` ``` -------------------------------- ### MAG CLI: Show Protocol and Tools Source: https://context7.com/george-rd/mag/llms.txt Display the MAG protocol and available tools using the CLI. Optionally, specify the 'tools' section for a focused view. ```bash # CLI: Show protocol and available tools mag protocol mag protocol --section tools ``` -------------------------------- ### MCP Tool: memory_session_info - Welcome Briefing Source: https://context7.com/george-rd/mag/llms.txt Request a welcome briefing for a specific session, including recent memories, pending reminders, and active checkpoints. ```json // MCP Tool: memory_session_info - Welcome briefing { "mode": "welcome", "session_id": "session-123", "project": "api-gateway" } // Response: {"recent_memories": [...], "pending_reminders": [...], "active_checkpoints": [...]} ``` -------------------------------- ### Check MAG Daemon Health Source: https://github.com/george-rd/mag/blob/main/plugin/skills/memory-health/SKILL.md Use this command to check if the MAG daemon is running and responsive. Requires `curl` and `jq` to be installed. ```bash curl -sf http://127.0.0.1:19420/health | jq . ``` -------------------------------- ### Broken CLI Command in Skill Documentation Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/connector-wave-dg-r1.md Example of a non-existent CLI command found in existing skill documentation that causes silent failures. ```bash mag hook store "Brief title..." \ --project PROJECT \ --event-type TYPE \ ... ``` -------------------------------- ### Manage User Profile Source: https://context7.com/george-rd/mag/llms.txt CLI commands to set and retrieve the user profile. ```bash # CLI mag profile set "Prefers Rust, uses Neovim, deploys to Fly.io" mag profile get ``` -------------------------------- ### Get Latest Commit Hash Source: https://github.com/george-rd/mag/blob/main/conductor/workflow.md Retrieve the full commit hash of the most recent commit. This is used for referencing specific commits in Git notes and plan updates. ```bash git log -1 --format="%H" ``` -------------------------------- ### Run Parity Harness Source: https://github.com/george-rd/mag/blob/main/parity/README.md Execute the parity harness script using bash. This script compares mag and omega-memory behavior. ```bash bash parity/run_parity.sh ``` -------------------------------- ### Execute Benchmarks Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/mag-improvement-plan.md Command to run the LoCoMo-10 retrieval benchmark with a specified sample size. ```bash ./scripts/bench.sh --samples 10 ``` -------------------------------- ### Example of overriding TTL in session summary storage Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/improvement-plan-dg-r2.md This command demonstrates an attempt to override the default TTL for storing a session summary, setting it to 'none' which implies permanent storage. This contradicts other specifications in the plan. ```bash mag process "session summary" --event-type session_end --ttl none ... ``` -------------------------------- ### Example of silent failure in hook scripts Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/improvement-plan-dg-r2.md This shell construct `2>/dev/null || true` is used in hook scripts to ensure they fail silently, meaning errors are suppressed and the script continues execution. ```bash 2>/dev/null || true ``` -------------------------------- ### Build Release Binary Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Compile the project in release mode for optimized performance. ```bash cargo build --release ``` -------------------------------- ### Extracting Specific Error Lines Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/wave1-implementation-blueprint.md This script extracts the first specific error line from the output, prioritizing lines starting with 'error'. If no such line is found, it falls back to the first 'FAILED' line. The extracted line is truncated to 200 characters. ```bash ERROR_LINE="$(printf '%s' "$OUTPUT" | grep -m1 -E '^error(\[E[0-9]+\])?: ' | head -c 200 || true)" if [ -z "$ERROR_LINE" ]; then ERROR_LINE="$(printf '%s' "$OUTPUT" | grep -m1 'FAILED' | head -c 200 || true)" fi [ -n "$ERROR_LINE" ] || exit 0 ``` -------------------------------- ### Verify Auto-context in Welcome Output Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/mag-improvement-plan.md Command to verify that auto-captured memories are correctly surfaced in the briefing. ```bash mag welcome ``` -------------------------------- ### Storage Pipeline Workflow Source: https://github.com/george-rd/mag/blob/main/docs/architecture.md Visual representation of the steps taken when executing the mag store command. ```text Input text | v 1. Dedup check (content hash + Jaccard similarity) | duplicate? --> bump access_count, return early v 2. Embedding generation (ONNX, ~8ms) | v 3. Supersession detection (cosine >= 0.70 AND Jaccard >= 0.30) | found older version? --> mark superseded, create SUPERSEDES edge, link version chain v 4. INSERT memory + FTS5 index sync | v 5. Entity extraction (auto-tagging: people, tools, projects) | v 6. Graph edge creation - PRECEDED_BY: link to previous memory in same session (temporal adjacency) - RELATES_TO: link to other memories sharing entity tags (co-occurrence) ``` -------------------------------- ### Set executable permissions Source: https://github.com/george-rd/mag/blob/main/docs/SETUP.md Run this command if you encounter a permission denied error when attempting to execute the mag binary. ```bash chmod +x $(which mag) ``` -------------------------------- ### POST /compact Source: https://github.com/george-rd/mag/blob/main/docs/mcp-tools.md Merge near-duplicate memories based on similarity. ```APIDOC ## POST /compact ### Description Merge near-duplicate memories to optimize storage. ### Method POST ### Endpoint /compact ### Parameters #### Request Body - **event_type** (string) - Optional - Event type to compact (default: "lesson_learned") - **similarity_threshold** (number) - Optional - Similarity threshold for clustering (default: 0.6) - **min_cluster_size** (integer) - Optional - Minimum cluster size to merge (default: 3) - **dry_run** (boolean) - Optional - Preview without applying changes (default: false) ``` -------------------------------- ### Manage user profile Source: https://github.com/george-rd/mag/blob/main/docs/cli-reference.md Sets or retrieves user profile information. ```bash mag profile set "Prefers Rust, uses Neovim, deploys to Fly.io" mag profile get ``` -------------------------------- ### Run Quality Gate Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Execute the preferred quality gate using prek.toml. Alternatively, manually run formatting, linting, and tests. ```bash prek run ``` ```bash cargo fmt --all -- --check ``` ```bash cargo clippy --all-targets --all-features -- -D warnings ``` ```bash cargo test --all-features ``` -------------------------------- ### Run Project Parity Checks Source: https://github.com/george-rd/mag/blob/main/src/memory_core/AGENTS.md Run formatting, linting, and full test suites to ensure project parity. ```bash # full parity gate cargo fmt --all -- --check cargo clippy --all-targets --all-features -- -D warnings cargo test --all-features ``` -------------------------------- ### Run Single Test Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Execute a specific test case with all features enabled. ```bash cargo test --all-features ``` -------------------------------- ### Create a New Commit with JJ Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Describes the current changes and creates a new commit. Use this for committing in jj. ```bash jj describe -m "msg" && jj new ``` -------------------------------- ### Commit Changes with JJ Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Alternative command to describe changes and create a new commit using jj. ```bash jj commit -m "msg" ``` -------------------------------- ### Go Project Pre-Commit Checks Source: https://github.com/george-rd/mag/blob/main/conductor/workflow.md Runs all pre-commit checks, typically defined in a Makefile. Ensure a Makefile exists with a 'check' target. ```bash make check ``` -------------------------------- ### Retrieve lessons Source: https://github.com/george-rd/mag/blob/main/docs/cli-reference.md Fetches lessons learned from past sessions, filterable by task or project. ```bash mag lessons --project myapp --limit 10 mag lessons --task "database migrations" ``` -------------------------------- ### Fast-path Rejection for Build/Test Commands Source: https://github.com/george-rd/mag/blob/main/docs/strongholds/wave1-implementation-blueprint.md This script quickly exits if the command is not a recognized build or test command. It uses 'jq' to parse input and checks against a list of common build/test commands. ```bash COMMAND="$(printf '%s' "${CLAUDE_TOOL_INPUT:-}" | jq -r '.command // empty' 2>/dev/null || true)" case "$COMMAND" in *"cargo test"*|*"cargo build"*|*"cargo check"*|*"cargo clippy"*|*"npm test"*|*"npm run"*|*"prek run"*) : # fall through ;; *) exit 0 ;; esac ``` -------------------------------- ### Run Benchmark Gate Script Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Executes the benchmark script for quality gate checks. Use this instead of raw cargo run for benchmarks. ```bash ./scripts/bench.sh --gate ``` -------------------------------- ### Run LoCoMo Benchmark Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Execute the LoCoMo benchmark for retrieval quality. Adjust --samples for iteration speed or full validation. Use --llm-judge for LLM-based scoring, requiring OPENAI_API_KEY. ```bash cargo run --release --bin locomo_bench -- --samples 2 ``` ```bash cargo run --release --bin locomo_bench -- --samples 2 --scoring-mode word-overlap ``` ```bash cargo run --release --bin locomo_bench -- --llm-judge --samples 2 ``` -------------------------------- ### List Memories (CLI) Source: https://context7.com/george-rd/mag/llms.txt List memories with options for pagination, filtering by event type and minimum importance, and showing recently accessed memories. ```bash # CLI: List recent memories mag list --limit 20 --project myapp ``` ```bash # CLI: Filter by event type and importance mag list --event-type decision --importance-min 0.8 ``` ```bash # CLI: Show recently accessed memories mag recent --limit 5 ``` -------------------------------- ### Run Scale Benchmark Source: https://github.com/george-rd/mag/blob/main/docs/benchmarks/methodology.md Measures store throughput and search latency at different scales. ```bash cargo run --release --bin scale_bench -- --max-scale 10000 --search-queries 50 ``` -------------------------------- ### POST /consolidate Source: https://github.com/george-rd/mag/blob/main/docs/mcp-tools.md Prune stale data from the memory store. ```APIDOC ## POST /consolidate ### Description Prune stale data based on age and count thresholds. ### Method POST ### Endpoint /consolidate ### Parameters #### Request Body - **prune_days** (integer) - Optional - Age threshold in days (default: 30) - **max_summaries** (integer) - Optional - Maximum summaries to retain (default: 50) ``` -------------------------------- ### Manage Reminders Source: https://context7.com/george-rd/mag/llms.txt CLI commands for setting, listing, and dismissing time-based reminders. ```bash # CLI mag remind set --text "Review PR #42" --duration 2h --project myapp mag remind list --project myapp mag remind dismiss --reminder-id abc123 ``` -------------------------------- ### Configure MAG for VS Code / Copilot Source: https://github.com/george-rd/mag/blob/main/docs/SETUP.md Configuration JSON for VS Code MCP integration. ```json { "servers": { "mag": { "command": "mag", "args": ["serve"] } } } ``` -------------------------------- ### Node.js Pre-Commit Checks Source: https://github.com/george-rd/mag/blob/main/conductor/workflow.md Executes all pre-commit checks, including formatting, linting, and type checking for a Node.js project. Run this before committing. ```bash npm run check ``` -------------------------------- ### Manual MCP Configuration Source: https://github.com/george-rd/mag/blob/main/README.md Add the MAG server manually to your client's configuration file. ```json { "mcpServers": { "mag": { "command": "mag", "args": ["serve"] } } } ``` -------------------------------- ### Run Full Benchmark Validation Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Performs a comprehensive benchmark run for pre-merge validation. This is an authoritative 10-sample run. ```bash ./scripts/bench.sh --samples 10 --notes "pre-merge validation" ``` -------------------------------- ### Configure MAG in Cursor MCP Source: https://github.com/george-rd/mag/blob/main/docs/setup/cursor.md Add this JSON block to your .cursor/mcp.json file to register the MAG server. Ensure the command path points to your local MAG binary. ```json { "mcpServers": { "mag": { "command": "/path/to/mag", "args": ["serve"], "env": { "RUST_LOG": "info" } } } } ``` -------------------------------- ### Warm Benchmark Cache Source: https://github.com/george-rd/mag/blob/main/docs/benchmarks/methodology.md Pre-fetches benchmark datasets to the cache without executing the actual benchmark tests. ```bash cargo run --release --bin fetch_benchmark_data -- --dataset all ``` -------------------------------- ### Run Additional ONNX Embedder Variants Source: https://github.com/george-rd/mag/blob/main/AGENTS.md Execute benchmarks with various ONNX embedder models for comparison. Includes fast, small, and base variants. ```bash ./scripts/bench.sh --model granite ``` ```bash ./scripts/bench.sh --model minilm-l6 ``` ```bash ./scripts/bench.sh --model minilm-l12 ``` ```bash ./scripts/bench.sh --model e5-small ``` ```bash ./scripts/bench.sh --model bge-base ``` ```bash ./scripts/bench.sh --model nomic ```