io.github.Hustada/collective-memory

السجل الرسمي الذكاء الاصطناعي والوكلاء

MCP server for persistent, semantic memory across AI sessions

ماذا يمكنك أن تفعل مع io.github.Hustada/collective-memory؟

  • Semantic search — Find memories by meaning, not keywords (OpenAI embeddings + LanceDB)
  • Automatic deduplication — Won't store near-duplicates (>95% similarity)
  • Project scoping — Organize memories by project
  • Type classification — Categorize as decision, milestone, context, learning, or session_summary
  • Zero config storage — Embedded vector database, no server required

التثبيت

أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: ‏.cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).

NPM package collective-memory
Claude Code
claude mcp add collective-memory -e 'OPENAI_API_KEY=<your openai_api_key>' -- npx -y collective-memory@0.1.2
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "collective-memory": {
            "command": "npx",
            "args": [
                "-y",
                "collective-memory@0.1.2"
            ],
            "env": {
                "OPENAI_API_KEY": "<your openai_api_key>"
            }
        }
    }
}

متغيرات البيئة

  • OPENAI_API_KEY إلزامي سري OpenAI API key for generating embeddings

التوثيق

مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.

المحتويات
  1. Collective Memory
  2. Why
  3. Features
  4. Installation
  5. Setup
  6. Tools
  7. CLI
  8. Configuration
  9. How it works
  10. Data
  11. License
  12. Credits

Collective Memory

MCP server for persistent, semantic memory across AI sessions. Store context, decisions, and learnings — recall them later with natural language search.

Why

AI assistants forget everything between sessions. Collective Memory fixes that. Store what matters, search by meaning, build context that compounds.

Features

  • Semantic search — Find memories by meaning, not keywords (OpenAI embeddings + LanceDB)
  • Automatic deduplication — Won't store near-duplicates (>95% similarity)
  • Project scoping — Organize memories by project
  • Type classification — Categorize as decision, milestone, context, learning, or session_summary
  • Zero config storage — Embedded vector database, no server required

Installation

npm install -g collective-memory

Or clone and build:

git clone https://github.com/Hustada/collective-memory.git
cd collective-memory
npm install
npm run build

Setup

1. Get an OpenAI API key

Required for embeddings. Get one at platform.openai.com.

2. Add to Claude Code

Add to ~/.claude/settings.json under mcpServers:

{
  "mcpServers": {
    "collective-memory": {
      "type": "stdio",
      "command": "npx",
      "args": ["collective-memory"],
      "env": {
        "OPENAI_API_KEY": "sk-..."
      }
    }
  }
}

Or if installed from source:

{
  "mcpServers": {
    "collective-memory": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/collective-memory/dist/index.js"],
      "env": {
        "OPENAI_API_KEY": "sk-..."
      }
    }
  }
}
3. Add usage instructions to CLAUDE.md

Add to your global ~/.claude/CLAUDE.md:

## Memory

Collective Memory is active. Two tools:

- `remember(content, project?, type?, tags?)` — Persist important context
- `recall(query, project?, type?, limit?)` — Search memory

**On session start**: Run `recall("recent decisions and context")` to load relevant memory.

When to remember: after decisions, milestones, completed work, learned patterns.
When to recall: session start, context switches, referencing past work.

Types: decision, milestone, context, learning, session_summary.

Tools

remember

Store a memory with semantic embedding.

ParameterTypeRequiredDescription
contentstringyesThe memory to store — be specific and self-contained
projectstringnoProject context (e.g., "myapp", "client-x")
typestringnoOne of: decision, milestone, context, learning, session_summary
tagsstring[]noTags for categorization

Returns the stored memory ID, or existing ID if deduplicated.

recall

Search memories by semantic similarity.

ParameterTypeRequiredDescription
querystringyesNatural language search query
projectstringnoFilter to specific project
typestringnoFilter to specific memory type
limitnumbernoMax results (default: 10)

Returns array of matching memories with similarity scores.

CLI

Also usable from command line:

# Store a memory
collective-memory remember --content "Decided to use PostgreSQL for the auth service"

# Search memories
collective-memory recall --query "database decisions" --limit 5

# Pipe content from stdin
echo "Long content here" | collective-memory remember --content-stdin --project myapp

Configuration

Environment VariableDefaultDescription
OPENAI_API_KEY(required)OpenAI API key for embeddings
COLLECTIVE_MEMORY_PATH~/.collective-memory/dataStorage location

How it works

  1. Store: Content is embedded using OpenAI's text-embedding-3-small (768 dimensions)
  2. Dedupe: Before storing, checks for >95% similar existing memories
  3. Index: Stored in LanceDB, an embedded vector database
  4. Search: Queries are embedded and matched via cosine similarity

Data

Memories are stored locally at ~/.collective-memory/data (or COLLECTIVE_MEMORY_PATH). It's a LanceDB database — portable, no server process.

To export memories:

npm run export  # Outputs to viz/memories.json

To visualize:

npm run dash    # Opens UMAP visualization at localhost:3333

License

MIT

Credits

Built by The Victor Collective.

الأسئلة الشائعة

ما هو io.github.Hustada/collective-memory؟

MCP server for persistent, semantic memory across AI sessions

كيف أثبّت io.github.Hustada/collective-memory؟

يعمل على جهازك. في Claude Code: claude mcp add collective-memory -e 'OPENAI_API_KEY=<your openai_api_key>' -- npx -y collective-memory@0.1.2. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.

هل يحتاج io.github.Hustada/collective-memory إلى مفتاح API؟

نعم. يتطلب OPENAI_API_KEY، وتضبطها في إعداداته.

هل io.github.Hustada/collective-memory مفتوح المصدر؟

نعم. شيفرته متاحة على GitHub بترخيص MIT.

من يصون io.github.Hustada/collective-memory؟

ينشره Hustada. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.

من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.