Skip to main content
Glama

M8ven Score License: MIT Node Version

🧠 local-brain-mcp

Local-first, Git-aware persistent memory for AI coding assistants.

Local Brain is a lightweight Model Context Protocol (MCP) server that indexes your repository's Git history and manual engineering decisions into an embedded SQLite vector database. It equips AI coding assistants (Claude Code, Cursor, GitHub Copilot, Windsurf, Zed) with long-term codebase memoryβ€”100% offline, zero egress, and zero cloud API keys.


πŸ“– Table of Contents

Problem with cloud AI memory tools

How local-brain solves it

🐌 150–800ms network latency per recall

⚑ < 5ms β€” local SQLite vector search

☁️ Your code sent to foreign servers

πŸ”’ 100% on-device, zero egress

πŸ’Έ Token bloat on every session

πŸ“¦ Hard 250-token budget cap per recall

πŸ—‘οΈ Stale outdated context from old decisions

πŸ”„ Git-diff invalidation marks old memories STALE

🌊 WIP/typo commits pollute the brain

🎯 Quality filter keeps only high-signal lessons

πŸ—οΈ Monorepo noise across packages

🎯 Path-scoped queries, per-package namespacing

πŸ” Duplicate memories waste tokens

🧬 Smart deduplication + merge on ingest

🀷 No record of how a decision evolved

πŸ” Full memory lineage with brain_trace


Related MCP server: Heimdall MCP Server

Quick Start

# 1. Navigate to your Git repository
cd /path/to/your-project

# 2. Auto-detect installed AI editors and link MCP configuration
npx local-brain init

# 3. Ingest your Git history into the local brain database
npx local-brain ingest

# 4. Check memory database statistics
npx local-brain status

# 5. Restart your AI editor (Claude Code, Cursor, Copilot, Windsurf, Zed)

Editor / MCP Setup

All tools carry MCP 1.5 annotations (readOnlyHint, destructiveHint, idempotentHint) so hosts can show confirmation dialogs before destructive operations.

brain_recall

Semantic search your codebase memory. Results ranked by a composite score (similarity 45%, scope 20%, recency 10%, confidence 10%, importance 10%, quality 5%) and capped to 250 tokens.

{
  "mcpServers": {
    "local-brain": {
      "command": "node",
      "args": ["/absolute/path/to/local-brain-mcp/dist/mcp-server.js"],
      "env": {}
    }
  }
}

What is MCP? (For Beginners)

The Model Context Protocol (MCP) is an open standard created by Anthropic that allows AI applications (like Claude or Cursor) to securely interact with local tools and data sources.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   AI Coding Assistant   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚ Tool Invocation (JSON-RPC over stdio)
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Local Brain MCP     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚ Parameterized SQL
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Embedded SQLite DB     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Local Brain runs locally as a background process over standard input/output (stdio). The AI invokes Local Brain tools whenever it needs to recall past lessons or remember new rules.


MCP Tools Reference

1. brain_recall

Semantically searches codebase memories relevant to the query and optional file scope.

  • Type: Read-only

  • When to use: Before refactoring, fixing bugs, or implementing features to check if relevant lessons or constraints exist.

Parameters:

Parameter

Type

Required

Description

query

string

Yes

What to search for (max 1000 characters).

file_path

string

No

Repo-relative file path to scope the query (e.g. src/auth/jwt.ts).

max_items

number

No

Maximum memories to return (1–20, default: 5).

category

string

No

Filter by category: fix, architecture, convention, bug, manual.

Example Input:

{
  "query": "JWT token expiration bug",
  "file_path": "src/auth/jwt.ts",
  "max_items": 3
}

Example Output:

## Brain Recall: "JWT token expiration bug"
β€’ [src/auth/jwt.ts @ 8a4f12] (fix): JWT refresh race condition β€” RS256 cert rotates every 24h. Cache public keys with 1h TTL.
β€’ [src/auth/session.ts @ c31d04] (bug): Sessions expire silently on Tuesday UTC maintenance window.

brain_learn

Manually store a lesson or team convention with quality assessment. Low-signal content (shell noise, one-liners) is automatically filtered.

  • Type: Write

  • When to use: When you or the AI discover a crucial rule, edge case, or convention that is not documented in git commits.

Parameters:

Parameter

Type

Required

Description

lesson

string

Yes

Actionable lesson or decision (max 10000 characters).

category

string

No

Category: fix, architecture, convention, bug, manual (default: manual).

file_path

string

No

Associated file path (e.g. src/db/connection.ts).

importance

number

No

Importance multiplier between 0.5 and 2.0 (default: 1.0).

Example Input:

{
  "lesson": "Always use parameterized prepared statements in better-sqlite3 to prevent injection.",
  "category": "convention",
  "file_path": "src/db/queries.ts",
  "importance": 1.5
}

brain_trace

Full chronological history of all memories for a specific file, including superseded and deprecated entries.

  • Type: Read-only

  • When to use: When investigating the maintenance history or past regressions of a specific source file.

Parameters:

Parameter

Type

Required

Description

file_path

string

Yes

Repo-relative file path (e.g. src/db.ts).

Example Input:

{
  "file_path": "src/db.ts"
}

brain_forget

Permanently remove or deprecate a specific memory by ID (idempotent).

{
  "id": 42,
  "hard_delete": false
}

brain_prune

Remove stale/deprecated memories in bulk. Optionally triggers a full git-diff invalidation pass.

  • Type: Destructive Write

  • When to use: After major refactors or codebase rewrites to purge outdated knowledge.

Parameters:

Parameter

Type

Required

Description

status

string

No

stale, deprecated, or all (default: stale).

run_invalidation

boolean

No

If true, runs a git invalidation pass first (default: false).

Example Input:

{
  "status": "stale",
  "run_invalidation": true
}

brain_status

Returns health diagnostics: memory counts by status, DB size, schema version, oldest/newest entries.

{}

CLI Commands

local-brain init              # setup wizard β€” writes MCP config for all detected editors
local-brain ingest            # scan git history and build the brain DB
local-brain ingest --since "6 months ago" --verbose
local-brain status            # show DB memory counts and diagnostics
local-brain prune --invalidate  # detect + remove stale memories
local-brain learn "lesson text" --category convention --file src/db/client.ts
local-brain trace --file src/db/client.ts
local-brain forget --id 42

Real-World Usage Example

git history
    ↓
[git-ingest.ts] β€” filters WIP/typo/format commits + quality assessment
    ↓ duplicate?
[db.ts] β€” findDuplicateMemory β†’ smart merge (preserves richest summary)
    ↓
[embeddings.ts] β€” pure-JS TF-IDF feature hashing (384-dim, sub-1ms, zero network)
    ↓
[db.ts] β€” stores in .git/brain.db (provenance: author, branch, confidence, importance)
    ↓ (on file change)
[invalidation.ts] β€” marks stale if file changed > 30% (multi-file array support)
    ↓ (on MCP tool call)
[recall.ts] β€” cosine similarity + multi-factor ranking, scoped to package, capped to 250 tokens
    ↓
Claude Code / Cursor / Copilot / Windsurf / Zed

Ranking Formula

rank_score = (similarity Γ— 0.45)
           + (scope_boost Γ— 0.20)
           + (recency Γ— 0.10)
           + (confidence Γ— 0.10)
           + (importance Γ— 0.10)
           + (quality Γ— 0.05)
           Γ— status_multiplier   (active=1.0, stale=0.25, deprecated=0.05)

Memory Lifecycle

inserted (active)
    β†’ stale   (git-diff invalidation if file changed > 30%)
    β†’ deprecated  (superseded by newer memory or manual forget)
    β†’ deleted (hard prune)

Schema & Provenance

Each memory stores:

Field

Description

content

Raw commit message or lesson text

summary

Distilled one-liner (merged on dedup)

file_path

Canonical file(s) this memory belongs to

author

Git commit author

branch

Branch at ingest time

commit_hash

SHA of the commit

confidence

Float 0–1, updated on merge

importance

Float, boosted by quality signals

status

active / stale / deprecated

superseded_by

FK to the memory that replaced this one

quality_score

Float output of quality assessment


Project Structure

local-brain-mcp/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ cli.ts              # Command-line interface and setup wizard
β”‚   β”œβ”€β”€ db.ts               # SQLite database management and migrations
β”‚   β”œβ”€β”€ embeddings.ts       # Code-aware TF-IDF feature hashing vectorizer
β”‚   β”œβ”€β”€ git-ingest.ts       # Commit filtering and git ingestion pipeline
β”‚   β”œβ”€β”€ invalidation.ts     # Git-diff staleness detection engine
β”‚   β”œβ”€β”€ mcp-server.ts       # MCP server definition and tool handlers
β”‚   β”œβ”€β”€ recall.ts           # Multi-factor ranking and token-capped search
β”‚   β”œβ”€β”€ schema.sql          # Core SQLite table schemas and triggers
β”‚   └── scoping.ts          # Monorepo package scope and path sanitization
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ mcp-tools.test.js    # MCP protocol and tool integration tests
β”‚   β”œβ”€β”€ embeddings.test.js   # Vectorizer and cosine math unit tests
β”‚   β”œβ”€β”€ recall-ranking.test.js # Multi-factor ranking algorithm tests
β”‚   β”œβ”€β”€ scoping.test.js      # Monorepo scope and path security tests
β”‚   β”œβ”€β”€ security.test.js     # SQL injection and path traversal tests
β”‚   β”œβ”€β”€ invalidation.test.js # Diff parsing and threshold tests
β”‚   └── git-ingest.test.js   # Commit filter regex and classifier tests
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ benchmark.mjs        # Performance benchmark runner
β”‚   β”œβ”€β”€ copy-schema.mjs      # Build step copying SQL schema to dist
β”‚   └── evaluate-retrieval.mjs # Information Retrieval evaluation runner
β”œβ”€β”€ .github/workflows/ci.yml # Multi-version Node.js CI workflow
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── README.md

Troubleshooting

1. MCP Server Not Appearing in AI Assistant

  • Run npx local-brain init to re-apply editor configurations.

  • Verify that your editor was completely restarted.

  • Check that node is available in your system PATH.

2. No Memories Returned on Recall

  • Ensure git history has been ingested: npx local-brain ingest.

  • Check database status: npx local-brain status.

  • If working in a subdirectory, check monorepo package scoping.

3. Memories Flagged as Stale

  • If a file had substantial changes (>30% lines), its memories are automatically marked stale.

  • Run npx local-brain prune --invalidate to clean outdated records and re-run npx local-brain ingest.


Development & Testing

# Clone the repository
git clone https://github.com/cosmiccoder200x-sys/local-brain-mcp.git
cd local-brain-mcp

# Install dependencies
npm install

# Type check
npm run typecheck

# Build TypeScript to dist/
npm run build

# Run unit and integration tests
npm test

# Run performance benchmarks
npm run benchmark

# Run retrieval quality evaluation
npm run eval

FAQ

Q: Does Local Brain send code to the cloud?
A: No. Local Brain is 100% offline and makes zero external network requests.

Q: Do I need an OpenAI or Anthropic API key to run it?
A: No. Local Brain uses a built-in pure-JavaScript feature-hashing embedding engine.

Q: Where is the memory database saved?
A: In <your-repo>/.git/brain.db (or ~/.config/local-brain/brain.db outside git repos).

Q: Does it work with monorepos?
A: Yes. Local Brain auto-detects package boundaries (e.g. packages/auth, apps/web) and scopes recalls accordingly.


Tech Stack

  • Protocol: @modelcontextprotocol/sdk (StdioServerTransport)

  • Storage: better-sqlite3 (SQLite WAL mode, BLOB float32 vectors)

  • Embeddings: Pure-JS TF-IDF feature hashing (384-dim, sub-1ms, 100% offline)

  • Git Engine: simple-git

  • CLI Engine: commander


Test Coverage

Suite

Tests

Status

MCP Tool Annotations

8

βœ… pass

Database & Migrations

4

βœ… pass

Deduplication & Smart Merge

4

βœ… pass

Quality Assessment

3

βœ… pass

Memory Supersession

2

βœ… pass

MCP Server Lifecycle (integration)

7

βœ… pass

Adversarial Retrieval (18 cases A–R)

18

βœ… pass

npm test   # runs all suites

License

MIT β€” build freely.

Available Tools

6 tools
brain_forgetA
DestructiveIdempotent

Remove or deprecate specific memories from Local Brain. Can target a memory by ID, file path, or search query. By default deprecates the memory to maintain audit trail; pass hard_delete: true to purge.

ParametersJSON Schema
NameRequiredDescriptionDefault
idNoExact memory ID to forget.
queryNoForget memories matching this text/topic.
file_pathNoForget all memories associated with this file path.
hard_deleteNoIf true, permanently deletes records from SQLite. Default is false (marks deprecated).

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations (destructiveHint=true, idempotentHint=true), the description clearly discloses the soft-delete default, the audit-trail rationale, and the hard_delete behavior that purges records. It adds meaningful context about what happens to the data without contradicting the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two dense sentences with no filler. The core action and targeting options come first, followed by the destructive/soft-delete distinction that matters most for a destructive tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the main action, selectors, and default vs purge behavior, and the annotations cover safety. It is still missing guidance on whether at least one target selector is required, whether selectors are mutually exclusive, and what the tool returns or reports after forgetting.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents id, query, file_path, and hard_delete. The description usefully recasts them as targeting strategies and explains the default behavior of hard_delete, but it does not add details beyond what the schema provides, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb phrase ('Remove or deprecate specific memories') and a clear resource ('Local Brain'), then names three targeting modes (ID, file path, search query). This makes it distinct from its sibling retrieval and pruning tools even though no sibling is named.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The intended use is implied: call this when you need to forget memories, choosing an ID, file path, or query. However, it does not explicitly contrast with tools like brain_prune or brain_learn, and it does not state whether one selector is required or how to choose among the three when several apply.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

brain_learnB

Store a new durable lesson, architecture decision, bug root-cause, or team convention. Includes automatic quality evaluation, deduplication, provenance tracking, and supersession. Examples: "Never use RS256 in dev", "JWT refresh token expires in 7d; rotate on each use".

ParametersJSON Schema
NameRequiredDescriptionDefault
filesNoOptional: array of related files.
lessonYesThe lesson, rule, or decision to remember. Be specific and actionable.
categoryNoCategory for this memory.manual
file_pathNoOptional: the primary file this lesson applies to.
confidenceNoConfidence rating from 0.0 to 1.0 (default: 1.0).
importanceNoImportance multiplier from 0.1 to 2.0 (default: 1.0).
supersedes_idNoOptional: ID of an older memory that is superseded/replaced by this new lesson.

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no useful annotation hints (all false), the description carries the behavioral burden. It discloses several non-obvious behaviors: automatic quality evaluation, deduplication, provenance tracking, and supersession. However, it does not explain the consequences of supersession (e.g., whether it modifies or deletes existing memories) or what happens when deduplication triggers. This is a reasonable but incomplete disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences: purpose, feature summary, and examples. It front-loads the core action and keeps the feature list compact. The examples are useful and relevant, though slightly redundant with the category list.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description names key behaviors (evaluation, dedup, provenance, supersession) but omits practical details an agent needs: return value or confirmation, failure modes (e.g., low-quality lesson rejected), and the exact side effects of supersedes_id. Given seven parameters, no output schema, and no annotation safety signals, this is a moderate gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all seven parameters. The description does not add parameter-level meaning beyond the schema; it only provides example lessons, which are illustrative but not tied to specific parameters. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a clear action ('Store') and a specific resource ('a new durable lesson, architecture decision, bug root-cause, or team convention'), with concrete examples. It does not explicitly differentiate from sibling tools like brain_recall or brain_forget, but the storage-oriented wording makes the distinction obvious.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use the tool: when you have a lesson, decision, root-cause, or convention to persist. It does not explicitly say when not to use it, nor does it point to alternatives (e.g., use brain_recall to retrieve). Examples help, but exclusion guidance is absent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

brain_pruneA
Destructive

Clean up stale or deprecated memories from the brain. Run this after major refactors to prevent outdated context from polluting recalls. Optionally runs the full git-diff invalidation pass to detect modified/deleted files.

ParametersJSON Schema
NameRequiredDescriptionDefault
statusNoWhich memories to remove.stale
run_invalidationNoIf true, run the full git-based stale detection pass first.

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses the mutating nature by saying 'clean up' and 'remove,' matching the destructiveHint annotation. It also adds useful context beyond the annotations by explaining the optional git-diff invalidation pass that detects modified/deleted files.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and front-loaded: it states the core purpose in the first sentence and provides the key usage trigger in the second. Every sentence earns its place with no redundant detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (2 optional parameters, no output schema) and the destructiveHint annotation, the description is complete enough for an agent to invoke it correctly. It covers what is removed, when to run it, and the optional invalidation behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters. The description adds modest context by elaborating on the invalidation pass as git-diff based, but it does not substantially expand parameter meaning beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific verb ('clean up'), resource ('memories'), and scope ('stale or deprecated'). It does not explicitly differentiate from sibling brain_forget, but the stale/deprecated framing and git invalidation context make the role reasonably distinct.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit timing guidance: 'Run this after major refactors.' It explains the benefit of preventing outdated context from polluting recalls, but it does not explicitly state when to prefer brain_forget or other alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

brain_recallA
Read-onlyIdempotent

Semantically search your local codebase memory. Returns the most relevant lessons, bug fixes, architecture decisions, and conventions from your git history and AI sessions β€” filtered to current file and package scope. Results are ranked deterministically and token-capped to stay within 250 tokens.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesWhat to search for. Plain English, e.g. "JWT auth bug" or "database connection pooling".
categoryNoOptional: filter by memory category.
file_pathNoOptional: current file path (repo-relative). Narrows search to relevant file and package scope.
max_itemsNoMaximum memories to return (default: 5, max: 10).
min_confidenceNoOptional: minimum confidence threshold (0.0 to 1.0, default: 0.0).
include_deprecatedNoOptional: include stale and deprecated memories (default: false).

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already mark it readOnly, idempotent, and non-destructive, and the description adds genuinely new behavioral detail: results are 'ranked deterministically' and 'token-capped to stay within 250 tokens', plus the current file/package scoping behavior. It also names the memory sources (git history and AI sessions), which the schema does not convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, front-loaded with the primary action and then adding return contents, scoping, and output constraints. Every sentence adds a distinct piece of information with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only search tool with no output schema, the description is self-sufficient: it states the source corpus, optional scope filter, result ranking determinism, and the 250-token cap. Combined with fully documented parameters, an agent has everything needed to decide whether and how to call it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all six parameters, including defaults and enums. The description adds context about search scope and result types but no per-parameter semantics that the schema doesn't already provide; the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description opens with 'Semantically search your local codebase memory', a specific verb-resource pair, and enumerates the content types returned: lessons, bug fixes, architecture decisions, and conventions. This clearly distinguishes it from sibling write/delete/lifecycle tools like brain_learn, brain_forget, and brain_prune.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear contextβ€”use when you need to retrieve prior lessons or decisions from git history and AI sessions, optionally scoped to the current file/packageβ€”without explicitly naming exclusions or alternatives. It lacks an explicit 'when not to use' or a comparison to brain_trace, so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

brain_statusA
Read-onlyIdempotent

Get system diagnostics and memory statistics for Local Brain. Returns memory count, breakdown by status (active/stale/deprecated), source breakdown (git vs manual), and database storage path.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover read-only, idempotent, and non-destructive behavior. The description adds useful context by listing the returned diagnostics, but it doesn't disclose additional behavioral traits like authentication needs, freshness guarantees, or potential failure modes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single action-first sentence with no filler. Every clause adds distinct value: the operation, the resource, and the specific output categories.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter diagnostic tool with thorough safety annotations, the description is complete. It covers the important return categories even without an output schema, and nothing critical appears missing for an agent to decide to call it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has no parameters, so the description doesn't need to explain parameter semantics. The baseline of 4 applies because there is no parameter burden to address.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Get'), a clear resource ('system diagnostics and memory statistics for Local Brain'), and enumerates the exact return categories. This clearly distinguishes it from sibling memory-operation tools like brain_recall, brain_learn, brain_forget, and brain_prune.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies use when the agent needs system diagnostics or memory statistics rather than memory operations. It doesn't explicitly name alternatives or exclusion conditions, but for a zero-parameter status tool the usage context is clear enough.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

brain_traceA
Read-onlyIdempotent

Show all memory entries associated with a specific file. Returns the full fix history, architecture decisions, and past bugs for that file in chronological order. Includes confidence and status flags.

ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYesRepo-relative file path to trace (e.g. "src/auth/jwt.ts").

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false. The description adds useful behavioral detail beyond those annotations: results are chronological, include confidence and status flags, and cover fix history, architecture decisions, and past bugs. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences with no wasted words. The main action is front-loaded, and supporting details about return contents, ordering, and flags are packed efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple single-parameter schema, rich annotations, and no output schema, the description is complete. It tells the agent what the tool returns, how it is ordered, and what kinds of memory entries are included.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and the single parameter file_path is clearly documented with an example. The description adds little beyond the schema, but it does reinforce that the parameter selects a specific file for tracing. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb and resource: 'Show all memory entries associated with a specific file.' It also distinguishes this tool from siblings by framing it as a file-scoped trace of fix history, architecture decisions, and past bugs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies when to use the tool: when you need all memory entries tied to a specific file, in chronological order. It does not explicitly name alternatives or exclusions, but the file-scoped framing and sibling names like brain_recall make the intended use reasonably clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 6 tool updatesv1.1.0
    • First observedbrain_forget
    • First observedbrain_learn
    • First observedbrain_prune
    • First observedbrain_recall
    • First observedbrain_status
    • First observedbrain_trace

TDQS

A4/5.0
Disambiguation4/5

Each tool has a distinct primary role: status, semantic recall, storing, file-scoped tracing, targeted forgetting, and bulk pruning. Some overlap exists between recall and trace (both retrieve memories) and between forget and prune (both deprecate), but the descriptions clarify scope well enough.

Naming Consistency5/5

All tool names follow the same brain_<verb> pattern using simple, consistent lowercase verbs. The naming convention is uniform and predictable across the entire set.

Tool Count5/5

Six tools is well-scoped for a memory management server. Each tool covers a distinct phase of the memory lifecycle: store, recall, trace, deprecate, prune, and inspect.

Completeness4/5

The core memory lifecycle is covered: learn creates, recall/trace read, forget/prune delete or deprecate, and status reports health. There is no dedicated explicit update-by-ID tool, but supersession during learn and deprecation via forget provide reasonable workarounds.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides persistent memory for AI coding assistants, storing and retrieving architectural decisions, patterns, and solutions across sessions using semantic search, while also offering git integration for commit messages and code expertise mapping.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides AI coding assistants with persistent, context-rich memory of a codebase, including documentation and git history, enabling recall across sessions.
    104
    Apache 2.0
  • A
    license
    A
    quality
    B
    maintenance
    Provides persistent memory and a codebase knowledge graph for AI coding assistants, enabling shared context across multiple tools like Claude, Cursor, and ChatGPT, with significant token reduction.
    5
    25
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cosmiccoder200x-sys/local-brain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server