[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-80218":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":15,"starSnapshotCount":15,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},80218,"krusch-context-mcp","kruschdev\u002Fkrusch-context-mcp","kruschdev","A unified Zero-Trust MCP server that gives IDE agents local semantic codebase search, isolated episodic project memory, and hallucination-free framework RAG.","",null,"JavaScript",66,5,65,0,1,42.43,"MIT License",false,"main",true,[],"2026-06-12 04:01:27","\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fassets\u002Fbanner.png?v=2\" alt=\"Krusch Context MCP\" width=\"800\" \u002F>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>Unified IDE context engine that merges semantic codebase search with episodic project memory into a single MCP server.\u003C\u002Fstrong>\n\u003C\u002Fp>\n\n[![Version](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fpackage-json\u002Fv\u002Fkruschdev\u002Fkrusch-context-mcp.svg)](https:\u002F\u002Fgithub.com\u002Fkruschdev\u002Fkrusch-context-mcp)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n![Node](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNode.js-22+-green.svg)\n![Ollama](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FOllama-bge--large-blue.svg)\n![DB](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDatabase-PostgreSQL%20%2B%20pgvector-lightgrey.svg)\n\n---\n\n## The Problem\n\nEvery time you start a new AI coding session, your agent starts from zero. It doesn't remember the bug you fixed yesterday, the architectural decision you made last week, or even what files exist in your project. You end up re-explaining context, watching it hallucinate stale assumptions, and losing momentum to the \"goldfish memory\" problem.\n\n**Krusch Context MCP fixes this.** It gives your AI coding agent persistent, searchable memory across every session — paired with semantic search over your entire codebase — so your agent always knows *what* your code does, *why* you built it that way, and *what went wrong last time*.\n\n## What It Does\n\nA single [Model Context Protocol](https:\u002F\u002Fmodelcontextprotocol.io\u002F) server exposing **26 tools** to any MCP-compatible IDE agent (Cursor, Claude Code, Windsurf, Gemini CLI, etc.):\n\n| Capability | What It Provides |\n|-----------|-----------------|\n| 🔍 **Semantic Codebase Search** | Search the *meaning* of your code, not just filenames. \"How do we handle auth?\" returns the actual implementation. |\n| 🧠 **Episodic Memory** | Bugs, decisions, and lessons persist across sessions, retrieved by semantic relevance with temporal decay. |\n| 💎 **Steering Nudges** | Lightweight key-value facts (preferences, conventions) give the agent behavioral continuity without re-prompting. |\n| 📖 **Documentation Search** | Ingested external docs are searchable locally — your agent references *your* versions, not its training data. |\n| 🌍 **Zero-Trust Deep Search** | One tool call cross-references codebase reality with historical memory to verify understanding before acting. |\n\n## Why You'd Want It\n\n**🛡️ Everything stays on your hardware** — All embeddings via local [Ollama](https:\u002F\u002Follama.com\u002F) (`bge-large` + `llama3.2`). Storage is PostgreSQL + pgvector + SQLite. Zero API costs, full data sovereignty.\n\n**🔄 Switch models without losing context** — Memory is decoupled from the reasoning engine. Swap between Gemini, Claude, GPT-4o, or local models mid-project — every model inherits the same context.\n\n**⚡ One server, not three** — Codebase search, episodic memory, and steering nuggets in a single process with shared connection pool and embedding pipeline.\n\n---\n\n## Quick Start\n\n**Prerequisites:** [Node.js 22+](https:\u002F\u002Fnodejs.org\u002F) · [Ollama](https:\u002F\u002Follama.com\u002F) with `bge-large` and `llama3.2` · PostgreSQL with [`pgvector`](https:\u002F\u002Fgithub.com\u002Fpgvector\u002Fpgvector)\n\n```bash\n# 1. Install [PG-Git-MCP](https:\u002F\u002Fgithub.com\u002Fkruschdev\u002Fpg-git-mcp) (codebase ingestion engine)\nnpm install -g pg-git-mcp\n\n# 2. Clone and install\ngit clone https:\u002F\u002Fgithub.com\u002Fkruschdev\u002Fkrusch-context-mcp.git\ncd krusch-context-mcp\nnpm install\ncp .env.example .env  # Configure your database connection\n\n# 3. Start\nnpm start\n```\n\nAdd to your IDE MCP settings (e.g., `.cursor\u002Fmcp.json`, `claude_desktop_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"krusch-context-mcp\": {\n      \"command\": \"node\",\n      \"args\": [\"\u002Fpath\u002Fto\u002Fkrusch-context-mcp\u002Fsrc\u002Findex.js\"]\n    }\n  }\n}\n```\n\nRestart your IDE — your agent now has access to all 26 tools.\n\n> **Upgrading?** `git pull origin main && npm install && npm start` — idempotent migrations run on startup.\n\n---\n\n## Architecture\n\n```mermaid\ngraph TD;\n    A[Agent Tool Call] --> B{Krusch Context MCP};\n    B -- Semantic Code Search --> C[(PG-Git: blobs)];\n    B -- Read\u002FWrite --> D[(SQLite Compute Cache)];\n    B -- Read\u002FWrite --> E[(Postgres Object Storage)];\n    D -. Async Pull\u002FPush .-> E;\n    B -- Deep Search --> C;\n    B -- Deep Search --> D;\n    B -- Deep Search --> E;\n    F[Ollama Fleet] -. embeddings .-> B;\n```\n\n| Component | Details |\n|-----------|---------|\n| **Storage** | Hybrid: Local SQLite (per-project) + PostgreSQL (global & codebase) |\n| **Embeddings** | Ollama `bge-large` @ 1024 dims, fleet load-balanced |\n| **Tagging** | SpectralQuant KV Compression for automatic keyword extraction |\n| **Temporal Decay** | `score = similarity × e^(-0.01 × age_days)` — relevance drops ~26% after 30 days |\n\n### Key Design Decisions\n\n- **Lakebase Architecture** — Local SQLite for zero-latency reads, async write-behind to durable PostgreSQL. A `+0.3` local scoring bias mitigates Ebbinghaus forgetting as the global corpus grows. *Inspired by [Neon](https:\u002F\u002Fneon.com\u002Fdocs\u002Fintroduction\u002Farchitecture-overview).*\n- **Hybrid Retrieval** — Auto-tagged via **SpectralQuant KV Cache Compression** to address pure-cosine failure modes (negation, numeric, role-swap) while maintaining massive context windows without OOM. *Per [Sentra](https:\u002F\u002Fsentra.app).*\n- **Consolidation** — Semantic dedup via L2-normalized centroid averaging without re-embedding. *From [Geometry of Consolidation](https:\u002F\u002Fgithub.com\u002Fniashwin\u002Fgeometry-of-consolidation).*\n- **Holographic Nuggets** — Lightweight steering facts adapted from [NeoVertex1\u002Fnuggets](https:\u002F\u002Fgithub.com\u002FNeoVertex1\u002Fnuggets).\n- **Resilient Multi-Tier Tagging (v1.1)** — Implements robust failover from SpectralQuant KV compression to local Ollama endpoints (running `llama3.2:1b`), with fuzzy parsing of varied list index styles to guarantee 100% keyword extraction reliability under offline or proxy down states.\n\n### Company Brain Substrate (v2)\n\nImplements the three-layer organizational memory model from the [Sentra \"Company Brain\" research](https:\u002F\u002Fsentra.app):\n\n1. **Factual Memory** — Raw codebase state + episodic events → *\"what happened\"*\n2. **Interaction Memory** — Parent-child UUID lineage, attribution, conflict resolution → *\"why it happened\"*\n3. **Action Memory** — Autonomous state compilation and graph traversal → *\"what to do next\"*\n\n---\n\n## Usage Examples\n\n### Episodic Memory\n\n> **You:** \"That fixed the port conflict! Save this.\"  \n> **Agent:** *[`add_memory`]* Saved to 'bugs': port 5441 conflicts with legacy DB, use 5442.\n\n> **You:** \"How did we structure the auth system?\"  \n> **Agent:** *[`search_memory`]* From 'lessons': chose singleton JWT factory to avoid circular dependencies.\n\n### Codebase Search\n\n> **You:** \"How does our auth middleware work?\"  \n> **Agent:** *[`search_code`]* Found 3 files — here's the implementation in `lib\u002Fauth.js`...\n\n### Zero-Trust Verification\n\n> **You:** \"Before we start, verify what you know about the DB schema.\"  \n> **Agent:** *[`deep_search`]* Cross-referencing codebase + memory — schema uses pgvector 1024 dims, last session added the `tags` column.\n\n### Steering Nudges\n\n> **You:** \"Always use `const` over `let` in this project.\"  \n> **Agent:** *[`nugget_remember`]* Saved: `coding-style:const-over-let`.\n\n### Multi-Agent Conflict Resolution\n\n> **You:** \"The previous agent was wrong about the database port.\"  \n> **Agent:** *[`resolve_conflict`]* Merged conflicting states. Deprecated old branches, created unified resolution.\n\n---\n\n## Agent Integration Patterns\n\n### Pattern 1: Zero-Trust Session Start\n\n> **🛑 ZERO-TRUST CONTEXT VERIFICATION (MANDATORY FIRST STEP)**  \n> **Root Cause Vulnerability**: An agent operating in a new session suffers from \"goldfish memory\" and will confidently hallucinate an understanding of decoupled architectures if it hasn't anchored itself in recent memory.  \n> **Rule**: Before executing a research task, writing code, or answering architectural questions in a new session, the agent **MUST** independently execute a Vector Database query to pull the latest codebase realities.   \n> **Execution**: You are forbidden from guessing context. You must physically execute the Context MCP tool:  \n> `search_memory(category: 'lessons', query: \"\u003Ccurrent_topic_or_project>\")`  \n> If you proceed without querying this database first, you are violating the core partnership agreement.\n\n```\n1. search_memory({ category: \"lessons\", query: \"\u003Ctopic>\" })\n   → Pull the latest codebase realities and historical context\n\n2. deep_search({ query: \"\u003Ctopic>\", project: \"\u003Cproject>\" })\n   → Verify codebase + memory in one call\n\n3. nugget_nudges({ query: \"\u003Ctask>\", active_project: \"\u003Cproject>\" })\n   → Load conventions and preferences\n```\n\n### Pattern 2: Bug Investigation\n\n```\n1. search_memory({ category: \"bugs\", query: \"\u003Csymptoms>\" })     → Check history\n2. search_code({ query: \"\u003Cerror>\", project: \"\u003Cproject>\" })      → Find implementation\n3. [Fix the bug]\n4. add_memory({ category: \"bugs\", content: \"\u003Croot cause + fix>\" }) → Document\n```\n\n### Pattern 3: Session Close\n\n```\n1. add_memory({ category: \"outcomes\", content: \"\u003Cdecisions and results>\" })\n2. nugget_remember({ key: \"\u003Cproject>:last-session\", value: \"\u003Cin-progress work>\" })\n3. consolidate({ category: \"activity\", project: \"\u003Cproject>\", dry_run: true })\n```\n\n---\n\n## Tool Quick-Reference\n\n> Full parameter details, defaults, and examples → **[Tool Reference](docs\u002FTOOL_REFERENCE.md)**\n\n| Tool | Description |\n|------|-------------|\n| **Episodic Memory** | |\n| `add_memory` | Store a memory (bug, lesson, priority, outcome, activity) |\n| `search_memory` | Semantic search with temporal decay |\n| `list_memories` | List recent memories by category |\n| `delete_memory` \u002F `update_memory` | CRUD by ID |\n| `consolidate` | Merge semantically duplicate memories |\n| `compile_state` | Contextmaxxing — compile full project state |\n| **Company Brain v2** | |\n| `write_state` | Stateful write with concurrency control and attribution |\n| `resolve_conflict` | Merge conflicting sibling states |\n| `get_provenance` | Trace version history and lineage |\n| `search_lens` | Role-filtered semantic retrieval |\n| `traverse_graph` | Navigate parent\u002Fchild lineage and linked blobs |\n| `update_ontology` \u002F `link_blob` | Tag management and codebase linking |\n| **Codebase Search** | |\n| `search_code` | Semantic search over indexed files |\n| `deep_search` | Composite zero-trust search (memory + codebase) |\n| `list_repos` \u002F `read_tree` \u002F `read_blob` | Browse indexed repositories |\n| **Nuggets** | |\n| `nugget_remember` \u002F `nugget_nudges` \u002F `nugget_forget` \u002F `nugget_list` | Steering fact CRUD |\n| **System** | |\n| `docs_list` \u002F `docs_search` | External documentation search |\n| `health_check` | Server status verification |\n\n---\n\n## Project Structure\n\n```\nkrusch-context-mcp\u002F\n├── src\u002F\n│   ├── index.js              # MCP server entry — tool registration & dispatch\n│   ├── memory-engine.js      # Episodic memory CRUD + consolidation\n│   ├── v2-engine.js          # Company Brain v2 substrate\n│   ├── nuggets-engine.js     # Holographic Nuggets CRUD\n│   ├── sqlite-engine.js      # Lakebase SQLite layer (pull\u002Fpush sync)\n│   └── llm-tags.js           # Shared LLM tag generation\n├── scripts\u002F                  # Benchmarking, evaluation, and maintenance\n├── tests\u002F                    # *.test.js = automated, test_*.js = smoke\n├── docs\u002F\n│   ├── TOOL_REFERENCE.md     # Full parameter reference for all 26 tools\n│   ├── SETUP.md              # Configuration, storage routing, troubleshooting\n│   └── research\u002F             # Sentra Company Brain research essays\n└── package.json\n```\n\n---\n\n## Testing\n\n```bash\nnpm test                                # Automated (node:test, *.test.js)\nnpm run test:smoke                      # JSON-RPC stdio smoke tests\nnode tests\u002Ftest_client.js               # All 26 tools against live DB\nnode scripts\u002Fbenchmark_latency.js       # End-to-end latency\nnode scripts\u002Feval_accuracy.js           # Precision\u002Frecall\n```\n\n> **Convention:** `*.test.js` = automated tests · `test_*.js` = stdio smoke tests\n\n---\n\n## Related Projects\n\n| Project | Role |\n|---------|------|\n| [PG-Git-MCP](https:\u002F\u002Fgithub.com\u002Fkruschdev\u002Fpg-git-mcp) | Semantic codebase search engine (sibling dependency) |\n| [Krusch Memory MCP](https:\u002F\u002Fgithub.com\u002Fkruschdev\u002Fkrusch-memory-mcp) | Legacy standalone memory (superseded) |\n| [Krusch Sequential MCP](https:\u002F\u002Fgithub.com\u002Fkruschdev\u002Fkrusch-sequential-mcp) | Sequential thinking with PG persistence |\n| [Krusch Cascade Router](https:\u002F\u002Fgithub.com\u002Fkruschdev\u002Fkrusch-cascade-router) | Automated LLM inference routing |\n| [NeoVertex Nuggets](https:\u002F\u002Fgithub.com\u002FNeoVertex1\u002Fnuggets) | Original Holographic Nuggets architecture |\n\n---\n\n## Acknowledgments\n\nThe evolution from a simple RAG cache to a stateful **Company Brain Substrate** is deeply inspired by the [Sentra \"Company Brain\" Essay Series](https:\u002F\u002Fsentra.app). We recommend reading their work on why organizational memory is an infrastructure problem.\n\nThe automated, continuous optimization of agent tool usage through execution tracing and LLM analysis is powered by the [HALO RLM Engine](https:\u002F\u002Fgithub.com\u002Fcontext-labs\u002Fhalo).\n\nTag generation and context analysis rely on the massive context extensions enabled by **SpectralQuant KV Cache Compression**, authored by Ashwin Gopinath. Our production proxy bridge seamlessly handles both agentic reasoning tasks and native `\u002Fapi\u002Fembeddings` pass-through for RAG, and is open-source at the [SpectralQuant Ollama Bridge standalone repository](https:\u002F\u002Fgithub.com\u002Fkruschdev\u002FSpectralQuant-Ollama-Bridge).\n\n## Contributing\n\nWe welcome contributions! Please ensure tests pass and adhere to the project formatting standards.\n\n## License\n\nMIT License © 2026 [kruschdev](https:\u002F\u002Fgithub.com\u002Fkruschdev)\n","Krusch Context MCP 是一个统一的零信任多上下文协议服务器，为IDE代理提供本地语义代码库搜索、隔离的项目记忆以及无幻觉的框架检索增强生成。其核心功能包括通过语义理解来搜索代码的实际含义，跨会话保持项目中的错误、决策和经验教训，并且能够在本地搜索已摄入的外部文档。该项目采用JavaScript编写，支持Node.js 22+版本，使用PostgreSQL与pgvector作为数据库存储解决方案。它适合于需要提高开发效率、减少重复劳动并确保数据主权的场景，特别是对于频繁切换AI编码模型但希望保持一致上下文记忆的开发者而言非常有用。此外，由于所有处理都在本地进行，因此能够有效保护敏感信息不被泄露。",2,"2026-06-11 03:59:42","CREATED_QUERY"]