Sponsored by Deepsite.site

Memoria

Created By
byronwade13 days ago
Prevents your AI from breaking code by revealing hidden file dependencies through git forensics.
Content

Memoria

The Memory Your AI Lacks.

An MCP server that prevents your AI from breaking code by revealing hidden file dependencies through git forensics.

npm version License: MIT TypeScript MCP Twitter


⚡ Quick Install

One-Click Install (Smithery)

Smithery - Install Memoria

Click the badge above to install Memoria with one click via Smithery.

Quick Copy-Paste Config

Add this to your MCP config file (works with Claude, Cursor, Windsurf, Cline):

{
  "mcpServers": {
    "memoria": {
      "command": "npx",
      "args": ["-y", "@byronwade/memoria"]
    }
  }
}

Terminal One-Liners

ToolCommand
Claude Codeclaude mcp add memoria -- npx -y @byronwade/memoria
Claude Desktopnpx @anthropic/claude-code mcp add memoria -- npx -y @byronwade/memoria
Cursormkdir -p .cursor && echo '{"mcpServers":{"memoria":{"command":"npx","args":["-y","@byronwade/memoria"]}}}' > .cursor/mcp.json
npm globalnpm install -g @byronwade/memoria
🪟 Windows PowerShell Install
# Claude Desktop
$config = "$env:APPDATA\Claude\claude_desktop_config.json"
$json = if(Test-Path $config){Get-Content $config | ConvertFrom-Json}else{@{}}
$json.mcpServers = @{memoria=@{command="npx";args=@("-y","@byronwade/memoria")}}
$json | ConvertTo-Json -Depth 10 | Set-Content $config
🍎 macOS Manual Install
# Claude Desktop (requires jq: brew install jq)
echo '{"mcpServers":{"memoria":{"command":"npx","args":["-y","@byronwade/memoria"]}}}' | \
  jq -s '.[0] * .[1]' ~/Library/Application\ Support/Claude/claude_desktop_config.json - > tmp.json && \
  mv tmp.json ~/Library/Application\ Support/Claude/claude_desktop_config.json

Then restart your AI tool. That's it!


Why Memoria?

You ask your AI to refactor a file. It does a perfect job. You run your app. It crashes.

Why? Some other file depended on the old implementation - but there's no import between them, so the AI didn't know.

Memoria fixes this. It analyzes git history to find files that change together, even without direct imports.

Without Memoria:                        With Memoria:
─────────────────                       ─────────────
You: "Update route.ts"                  You: "Update route.ts"
AI: "Done!" ✅                           Memoria: "⚠️ 85% coupled with billing.tsx"
Result: 💥 CRASH                         AI: "I'll update both files"
                                        Result: ✅ Works

Private & Local

Memoria runs 100% on your machine.

  • No code is uploaded to the cloud
  • No API keys required
  • Works offline
  • Analyzes your local .git folder directly

Your code never leaves your computer.


Installation

Choose your AI tool:

ToolOne-LinerConfig File
Claudenpx @anthropic/claude-code mcp add memoria -- npx -y @byronwade/memoriaSee below
Claude Codeclaude mcp add memoria -- npx -y @byronwade/memoriaAutomatic
Cursormkdir -p .cursor && echo '{"mcpServers":{"memoria":{"command":"npx","args":["-y","@byronwade/memoria"]}}}' > .cursor/mcp.json.cursor/mcp.json
WindsurfManual config~/.codeium/windsurf/mcp_config.json
VS CodeManual config~/.continue/config.json
ClineSettings UICline MCP Settings

📦 Claude Desktop

Config location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Option 1: Claude Code CLI (Recommended)

npx @anthropic/claude-code mcp add memoria -- npx -y @byronwade/memoria

Option 2: Manual config

{
  "mcpServers": {
    "memoria": {
      "command": "npx",
      "args": ["-y", "@byronwade/memoria"]
    }
  }
}
📦 Claude Code (CLI)
claude mcp add memoria -- npx -y @byronwade/memoria

Done! Claude Code handles everything automatically.

📦 Cursor

One-liner (project-level):

mkdir -p .cursor && echo '{"mcpServers":{"memoria":{"command":"npx","args":["-y","@byronwade/memoria"]}}}' > .cursor/mcp.json

Config locations:

  • Project: .cursor/mcp.json (in project root)
  • Global: ~/.cursor/mcp.json
{
  "mcpServers": {
    "memoria": {
      "command": "npx",
      "args": ["-y", "@byronwade/memoria"]
    }
  }
}
📦 Windsurf

Config: ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "memoria": {
      "command": "npx",
      "args": ["-y", "@byronwade/memoria"]
    }
  }
}
📦 Continue (VS Code)

Config: ~/.continue/config.json

{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "npx",
          "args": ["-y", "@byronwade/memoria"]
        }
      }
    ]
  }
}
📦 Cline (VS Code)

Open Cline settings → MCP Servers → Add new server:

{
  "mcpServers": {
    "memoria": {
      "command": "npx",
      "args": ["-y", "@byronwade/memoria"]
    }
  }
}
📦 Other MCP Clients

Any MCP-compatible client works. Use this universal config:

{
  "mcpServers": {
    "memoria": {
      "command": "npx",
      "args": ["-y", "@byronwade/memoria"]
    }
  }
}

⚠️ After configuring, restart your AI tool.

Verify Installation

After restarting, ask your AI:

"What MCP tools do you have available?"

You should see analyze_file and ask_history in the list.

Or test directly:

"Use the analyze_file tool on any file in this project"

Usage

Ask your AI to analyze a file before making changes:

"Analyze src/api/stripe/route.ts before I refactor it"

Memoria returns:

  • Coupled files - Files that frequently change together
  • Risk score - How bug-prone this code is historically
  • Stale dependencies - Coupled files that may need updating
  • Evidence - Actual code diffs showing why files are related

Configuration (Optional)

Create a .memoria.json in your project root to customize thresholds:

{
  "thresholds": {
    "couplingPercent": 20,
    "driftDays": 14,
    "analysisWindow": 100
  },
  "ignore": [
    "**/*.lock",
    "dist/",
    "legacy/**"
  ],
  "panicKeywords": {
    "postmortem": 3,
    "incident": 3,
    "p0": 3
  },
  "riskWeights": {
    "volatility": 0.35,
    "coupling": 0.30,
    "drift": 0.20,
    "importers": 0.15
  }
}
OptionDefaultDescription
thresholds.couplingPercent15Minimum coupling % to report
thresholds.driftDays7Days before a file is "stale"
thresholds.analysisWindow50Number of commits to analyze
ignore[]Additional glob patterns to ignore
panicKeywords{}Custom keywords with severity weights
riskWeights{}Override risk calculation weights

How It Works

Volatility Engine

Scans commits for panic keywords (fix, bug, revert, urgent, hotfix) with time-decay - recent bugs matter more than old ones. Also tracks Bus Factor (who owns the code).

Entanglement Engine

Finds files that change together >15% of the time. Reveals implicit dependencies that imports can't show.

Sentinel Engine

Detects when coupled files are >7 days out of sync. Flags stale dependencies before they cause bugs.

Static Import Engine

Uses git grep to find files that import the target - even for brand new files with no git history.

History Search (The Archaeologist)

Search git history to understand why code was written. Solves the "Chesterton's Fence" problem before you delete that weird-looking code.


Example Output

### 🧠 Forensics for `route.ts`

**🔥 RISK: 65/100 (HIGH)**
> Proceed carefully. Check all coupled files and update stale dependencies.

**Risk Factors:** High volatility (45% panic score) • Tightly coupled (3 files) • Heavily imported (8 files depend on this)

---

**🔗 COUPLED FILES**

**📐 `billing/page.tsx`** (85% coupled, schema)
> These files share type definitions. If you modify types in one, update the other to match.
> + interface SubscriptionUpdated
> - oldStatus: string

---

**🧱 STATIC DEPENDENTS**
> These files explicitly import `route.ts`. If you change the API, you MUST update them.
- [ ] Check `src/components/SubscriptionCard.tsx`
- [ ] Check `src/hooks/useSubscription.ts`

---

**🛑 PRE-FLIGHT CHECKLIST**
- [ ] Modify `route.ts` (primary target)
- [ ] Verify `billing/page.tsx` (schema coupling)
- [ ] Update `tests/stripe.test.ts` (stale by 12 days)

---

**📊 VOLATILITY**
**🔥 Status:** VOLATILE (Score: 45%)
**Expert:** Dave wrote 90% of this file. If the logic is unclear, assume it is complex.

Auto-Pilot Mode

Want your AI to check Memoria automatically before every edit? Install the rule files:

# Install globally first
npm install -g @byronwade/memoria

# Then in your project directory:
memoria init --all

This installs rule files that tell your AI to always call analyze_file before editing code.

What Gets Installed

FlagFileTool
--cursor.cursor/rules/memoria.mdcCursor
--claude.claude/CLAUDE.mdClaude Code
--windsurf.windsurfrulesWindsurf
--cline.clinerulesCline/Continue
--allAll of the aboveAll tools
--forceUpdate existing rulesOverwrites Memoria section

Smart Merge Behavior

memoria init is safe to run multiple times - it won't overwrite your existing rules:

ScenarioWhat Happens
File doesn't existCreates new file with Memoria rules
File exists, no MemoriaAppends Memoria rules (your content preserved)
File exists, has MemoriaSkips (use --force to update)
# First run - creates or appends
memoria init --cursor
#   ✓ Created .cursor/rules/memoria.mdc

# Second run - skips (already installed)
memoria init --cursor
#   ⊘ Skipped .cursor/rules/memoria.mdc (already has Memoria rules)
#   Use --force to update existing Memoria rules.

# Force update to latest version
memoria init --cursor --force
#   ✓ Updated .cursor/rules/memoria.mdc (--force)

Auto-Detection

Running memoria init without flags will auto-detect which tools you're using:

memoria init
# Detected: Cursor, Claude Code
# Installing Memoria rules...
#   ✓ Created .cursor/rules/memoria.mdc
#   ✓ Appended to .claude/CLAUDE.md (preserved existing content)
# ✓ Installed/updated 2 rule file(s)

Now Memoria acts as a mandatory safety guard for every edit.


Performance

Memoria is optimized for speed and minimal token usage:

MetricValue
Full analysis time<100ms
Tokens per analysis~600 tokens
Cache speedup2000x+ on repeat calls

Engine Breakdown

EngineTimePurpose
Coupling~45msFind files that change together
Volatility~10msCalculate bug-prone score
Drift<1msDetect stale dependencies
Importers~8msFind static dependents
History Search~7msSearch git commits

Run benchmarks yourself:

npm run build
npx tsx benchmarks/run-benchmarks.ts

Requirements

  • Node.js 18+
  • Git repository with commit history
  • MCP-compatible AI tool

Development

npm install
npm run build
npm test        # 294 tests

Troubleshooting

❌ "Tool not found" or "analyze_file not available"
  1. Restart your AI tool - MCP servers only load on startup
  2. Check config syntax - JSON must be valid (no trailing commas)
  3. Verify Node.js 18+ - Run node --version to check
  4. Check file path - Config file must be in the exact location for your tool
❌ "Not a git repository"

Memoria requires a git repository with history. Make sure:

  1. You're in a git repo (git status should work)
  2. The repo has at least a few commits
  3. You're passing an absolute path to analyze_file
❌ npx is slow or times out

Install globally for faster startup:

npm install -g @byronwade/memoria

Then update your config to use memoria directly:

{
  "mcpServers": {
    "memoria": {
      "command": "memoria"
    }
  }
}
❌ Windows path issues

Use forward slashes or escaped backslashes in paths:

"args": ["-y", "@byronwade/memoria"]

If issues persist, install globally and use the command directly.

Still stuck? Open an issue with your config and error message.


License

MIT


When Memoria saves you from a regression, let us know.

Server Config

{
  "mcpServers": {
    "memoria": {
      "command": "npx",
      "args": [
        "-y",
        "@byronwade/memoria"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
WindsurfThe new purpose-built IDE to harness magic
ChatWiseThe second fastest AI chatbot™
Tavily Mcp
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
CursorThe AI Code Editor
Amap Maps高德地图官方 MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Serper MCP ServerA Serper MCP Server
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
DeepChatYour AI Partner on Desktop
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Playwright McpPlaywright MCP server
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.