npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

local-agent-brain

v1.0.2

Published

A local, lightweight second brain for AI agents (RAG and Knowledge Graph) with CLI and MCP Server.

Readme

🧠 Local Agent Brain

A local, lightweight, and offline Second Brain for AI agents (like Cursor, Windsurf, Claude Desktop, and Copilot) powered by Graph RAG (Knowledge Graph + Semantic Search).

local-agent-brain helps AI agents retain long-term memory about your project setups, build commands, architecture decisions, database schemas, and workflows. It runs 100% locally and offline.


✨ Features

  • Local Vector Embeddings: Uses the lightweight Xenova/all-MiniLM-L6-v2 model locally via Hugging Face Transformers.js. No API keys needed.
  • Hybrid Search: Combines semantic similarity (Cosine Similarity) with keyword matching for highly accurate retrieval.
  • Knowledge Graph: Create directed connections between notes/memories (nodes) and relations (edges) so the agent understands context and dependencies.
  • MCP Server Integration: Exposes native tools to AI agents using Anthropic's Model Context Protocol (MCP), letting agents search, query, and save memories during chat.
  • Project-Specific or Global: Can be initialized locally in a repository (.agent-brain/) or globally (~/.agent-brain/).

🚀 Quick Start

1. Installation

You can run it directly using npx, install it globally, or install it locally in your project:

# Global installation
npm install -g local-agent-brain

2. Initialization

Go to your project directory and run:

# Initialize a local brain for the current project
local-agent-brain init

# Or initialize a global brain
local-agent-brain init --global

This creates a .agent-brain/ directory with a brain.json database.

3. Store Memories (CLI)

Add facts, setups, or tips to your brain:

local-agent-brain store "Production Build" "To build the project for production, run 'npm run build'" --tags "build,prod"

You can also create links between memories:

# Store another memory
local-agent-brain store "Deploy Command" "To deploy the built application, run 'npm run deploy'" --tags "deploy,prod"

# Link them together
local-agent-brain link "Production Build" "Deploy Command" --relation "pre-requisito"

4. Query Memories (CLI)

Test the RAG search using the CLI:

local-agent-brain remember "how to deploy the application?"

Output:

Querying brain for: "how to deploy the application?"...

1. [Score: 61.1%] "Deploy Command" (ID: 3b72daca-69ab-44b2-a233-7dbb493a1f4e)
   Tags: deploy, prod
   Content: To deploy the built application, run 'npm run deploy'
   Linked to:
     - "Production Build" (pre-requisito)

🤖 Integrating with AI Agents (MCP Server Setup)

The absolute best way to use local-agent-brain is by exposing it as a Model Context Protocol (MCP) server in your IDE. This allows agents to query your memory graph automatically when you ask questions.

⚡ Automatic Configuration (Recommended)

You can automatically configure local-agent-brain in your IDEs (Cursor, Windsurf, and Claude Desktop) with a single command:

# Register MCP server automatically in Cursor, Windsurf, and Claude Desktop
local-agent-brain setup

This will inspect your system, locate the configuration directories for these applications, and register the MCP server automatically. Afterward, please restart your IDE or reload the chat window to apply the changes.


🛠️ Manual Configuration (Alternative)

1. Cursor IDE

  1. Go to Cursor Settings > Features > MCP.
  2. Click + Add New MCP Server.
  3. Fill in the details:
    • Name: local-agent-brain
    • Type: command
    • Command: npx -y local-agent-brain mcp

2. Windsurf IDE

Add the following to your global MCP configuration file (typically located at ~/.codeium/windsurf/mcp_config.json):

{
  "mcpServers": {
    "local-agent-brain": {
      "command": "npx",
      "args": ["-y", "local-agent-brain", "mcp"]
    }
  }
}

3. Claude Desktop App

Add the following to your configuration file (typically located at %APPDATA%\Claude\claude_desktop_config.json on Windows or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "local-agent-brain": {
      "command": "npx",
      "args": ["-y", "local-agent-brain", "mcp"]
    }
  }
}

🛠️ CLI Reference

Usage: local-agent-brain [options] [command]

Options:
  -V, --version                      output the version number
  -h, --help                         display help for command

Commands:
  init [options]                     Initialize the agent brain database
  store [options] <title> <content>  Store a new fact, instruction, or note in the brain
  remember [options] <query>         Query the brain for memories using semantic hybrid search
  link [options] <source> <target>   Create a relationship connection between two memories
  delete <id>                        Delete a memory from the brain
  status                             Check the database location and memory graph stats
  mcp                                Start the Model Context Protocol (MCP) server on stdio
  setup                              Automatically register local-agent-brain MCP server in Cursor, Windsurf, and Claude Desktop config

📦 MCP Tools Exposed to AI

When active, the agent gains access to these tools:

  • query_memory(query: string, limit?: number): Queries the local knowledge graph.
  • store_memory(title: string, content: string, tags?: string[], linksTo?: string[]): Saves new context.
  • link_memories(source: string, target: string, relationType?: string): Links existing nodes.
  • get_memory_graph(): Inspects the overall graph structure.
  • delete_memory(id: string): Removes outdated facts.

📄 License

MIT License. Feel free to use and contribute!