Install
$ agentstack add mcp-keshrath-agent-knowledge ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
agent-knowledge
[](LICENSE) [](https://nodejs.org) []() []() []()
Cross-session memory and recall for AI coding assistants -- works with Claude Code, Cursor, OpenCode, Cline, Continue.dev, and Aider out of the box. Git-synced knowledge base, hybrid semantic+TF-IDF search, auto-distillation with secrets scrubbing.
Benchmark: R@5 = 97.2% (sparse) / 98.8% (hybrid) on longmemeval_s and 86.0% (sparse) / 88.4% (hybrid) on the harder longmemeval_m split — the public LongMemEval academic benchmark (Wu et al. 2024, ICLR 2025), full 500 questions per split, no LLM, no API key, runs entirely offline. +8.6pp to +13.2pp R@5 over the paper's official flat-bm25 baseline in apples-to-apples reproduction. Full per-category table, reproduction instructions, and paper-comparison details in [bench/README.md](bench/README.md).
Knowledge base with category filtering TF-IDF ranked session search
Why
AI coding sessions are ephemeral. When a session ends, everything it learned -- architecture decisions, debugging insights, project context -- is gone. The next session starts from scratch.
agent-knowledge solves this with two complementary systems:
- Knowledge Base -- a git-synced markdown vault of structured entries (decisions, workflows, project context) that persists across sessions and machines.
- Session Search -- TF-IDF ranked full-text search across session transcripts from all your coding tools, so agents can recall what happened before -- regardless of which tool was used.
Supported Tools
Sessions from all major AI coding assistants are auto-discovered -- if a tool is installed, its sessions appear automatically.
| Tool | Format | Auto-detected path | | ---------------- | -------------- | --------------------------------------------------------------- | | Claude Code | JSONL | ~/.claude/projects/ | | Cursor | JSONL | ~/.cursor/projects/*/agent-transcripts/ | | Codex CLI | JSONL | ~/.codex/projects/ | | Aider | Markdown/JSONL | .aider.chat.history.md / .aider.llm.history in project dirs | | Continue.dev | JSON | ~/.continue/projects/ | | Cline | JSON | VS Code globalStorage saoudrizwan.claude-dev/tasks/ | | OpenCode | SQLite | ~/.local/share/opencode/opencode.db (or $OPENCODE_DATA_DIR) |
No configuration needed. Additional session roots can be added via the AGENT_KNOWLEDGE_EXTRA_SESSION_ROOTS env var (comma-separated paths).
Features
- Host-agnostic session search -- unified search across every major AI coding assistant (Claude Code, Cursor, Codex CLI, Aider, Continue.dev, Cline, OpenCode). No host name is baked into configuration — the adapter registry probes installed host roots at startup.
- Hybrid search -- semantic vector similarity blended with TF-IDF keyword ranking
- Git-synced knowledge base -- markdown vault with YAML frontmatter, auto commit and push on writes
- Automatic staleness detection --
knowledge_analyze(action: "stale_by_code_activity")cross-references file paths mentioned in each entry body againstfilesModifiedin recent session summaries. Pairs with a symbol-presence precision layer: identifiers the entry quotes (inline backticks + fenced blocks) are checked in the touched file; if they still exist, confidence downweights ×0.3. Entries withevergreen: trueare exempt. - Search-gap tracking --
knowledge_analyze(action: "search_gaps")surfaces zero-result queries over the lastsince_days, grouped by token-Jaccard similarity. The clearest signal for "what entries should I write next?". - Section-priority context packer --
knowledge(action: "wakeup")assembles a multi-section bundle (identity→active_tasks→recent_decisions→known_gotchas→last_session_summary→top_weighted→semantic_fallback) within a token budget (default 800, override viatoken_budgetorAGENT_KNOWLEDGE_WAKEUP_BUDGET). Unused section budget redistributes to later sections. - Scored + gated promoter -- session insights promoted via a 6-signal weighted scorer with three independent gates (
minScore,minRecallCount,minUniqueQueries). Runs automatically in background, on demand viaknowledge_admin(action: "promote"), or benchable offline vianpm run bench:promote. Emits an auditable.dreams/YYYY-MM-DD.mddiary every run. - Pluggable adapter system -- add support for new tools by implementing the
SessionAdapterinterface - Embeddings -- local (Hugging Face), OpenAI, Claude/Voyage, or Gemini providers
- Fuzzy matching -- typo-tolerant search using Levenshtein distance
- 6 search scopes -- errors, plans, configs, tools, files, decisions
- 6 MCP tools -- consolidated action-based interface (
knowledge,knowledge_search,knowledge_session,knowledge_graph,knowledge_analyze,knowledge_admin) - Evergreen entries --
evergreen: truein frontmatter exempts an entry from decay in ranking AND makes it append-only under promotion. Dashboard renders a push-pin badge on these cards. - Author attribution -- optional
author:frontmatter surfaces as a muted chip on each card. - Code graph resolution --
calls,imports,inheritsedge types for code structure; directed BFS traversal (outbound/inbound/both);bulk_linkfor efficient ingestion;unlink_by_originfor clearing stale code edges before re-ingest;code:prefixed node IDs distinguish code from knowledge - Temporal knowledge graph -- edges support
valid_from/valid_tovalidity windows;as_ofqueries return point-in-time snapshots;invalidateaction marks facts as ended without deleting them - Hybrid scoring boosts -- proper-noun and temporal-proximity boosts on top of TF-IDF + semantic blend, capped at +66.7%, short-circuit when no signals are present
- Category as boost (not filter) -- opt into
category_mode: "boost"so a wrong category guess down-ranks instead of discarding the right answer - Verbatim session indexing -- per-message chunks (≥30 chars) embedded into the vector store so raw conversation is retrievable; toggle with
AGENT_KNOWLEDGE_INDEX_VERBATIM=false - Configurable git URL --
knowledge_admin(action: "config")for runtime setup, persisted at XDG/AppData location - Cross-machine persistence -- knowledge syncs via git, sessions read from local storage of each tool
- Real-time dashboard -- browse, search, and manage at
localhost:3423 - Secrets scrubbing -- API keys, tokens, passwords, private keys automatically redacted before git push
- Knowledge graph -- relationship edges between entries (relatedto, supersedes, dependson, contradicts, specializes, partof, alternativeto, builds_on) with BFS traversal
- Confidence/decay scoring -- entries scored by access frequency and recency; auto-promotion from candidate to established to proven
- Memory consolidation -- TF-IDF duplicate detection on write (warns of similar entries) plus
knowledge_analyze(action: "consolidate")for batch dedup scanning - Reflection cycle --
knowledge_analyze(action: "reflect")surfaces unconnected entries and generates structured prompts for the agent to identify new graph connections - Auto-linking on write -- new entries automatically linked to top-3 similar existing entries when cosine similarity > 0.7
- Confidence metadata — entries tagged
extracted(user-written) orinferred(auto-distilled, 0.85× search rank multiplier);confidence_scorefield carries the model's certainty 0-1 - Knowledge analysis —
knowledge_analyzeactionsgod_nodes(most-connected entries),bridges(cross-category connectors),gaps(isolated entries) - Knowledge brief —
knowledge_analyze(action: "brief")returns a cached ~200 token summary (core concepts, active projects, recent decisions, stale and gap counts) for session-start orientation - Edge provenance — graph edges track
origin(manual, auto-link, distill, reflect) so analysis can distinguish user judgment from automated heuristics - Deterministic pre-extraction in distillation — session summaries now include git commits, error patterns, URLs accessed, and packages changed extracted via regex from bash/tool output (no LLM cost)
- Freshness metadata on every search hit — every knowledge result carries
freshness: { body_age_days, last_accessed, access_count, verified_at, verification_age_days, evergreen }. Agent reads the trust signal and decides; we impose no policy demotion. - Per-category decay windows — the "Unused" filter and bytype chart honor per-category thresholds (projects 180d, people 365d, decisions 90d, workflows 60d, notes 30d) so identity-shaped content doesn't look stale just because it isn't re-read weekly.
- Lifecycle hooks —
SessionStartauto-wakeup + ingest-freshness check,UserPromptSubmitfirst-prompt targeted injection,PreCompactmemory-flush nudge + distill,SessionEnddistill. Six hook scripts total, all fail-open, each toggleable via anAGENT_KNOWLEDGE_*env var. See [docs/HOOKS.md](docs/HOOKS.md). - Replaces host auto-memory — on hosts with a per-session memory system (Claude Code's
~/.claude/projects/*/memory/, similar in other IDEs), route durable user facts and feedback to agent-knowledge instead. Auto-memory is machine-local and invisible to other machines; agent-knowledge is git-synced, cross-machine, searchable, and surfaces in wakeup. See the Claude Code integration note in [docs/USER-MANUAL.md](docs/USER-MANUAL.md#persistent-memory--agent-knowledge-not-host-auto-memory).
Codebase Ingestion
The knowledge-ingest skill populates or updates the knowledge base from a codebase directory. It uses tree-sitter for zero-token structural extraction (classes, functions, imports, call graphs, rationale comments), then clusters files into subsystems and creates knowledge entries + graph edges via existing MCP tools. Subsequent runs are incremental — only changed files are reprocessed.
/knowledge-ingest ./my-project
Uses the Agent Skills standard — works with Claude Code, OpenCode, Cursor, Codex CLI, and Gemini CLI. See [Ingestion Guide](docs/INGEST.md) for details.
Supported languages: TypeScript, JavaScript, Python, Go, Rust, Java, C, C++.
Quick Start
Install from npm
npm install -g agent-knowledge
Or clone from source
git clone https://github.com/keshrath/agent-knowledge.git
cd agent-knowledge
npm install && npm run build
Option 1: MCP server (for AI agents)
Add to your MCP client config (Claude Code, Cline, etc.):
{
"mcpServers": {
"agent-knowledge": {
"command": "npx",
"args": ["agent-knowledge"]
}
}
}
The dashboard auto-starts at http://localhost:3423 on the first MCP connection.
See [Setup Guide](docs/SETUP.md) for client-specific instructions (Claude Code, Cursor, Windsurf, OpenCode).
Option 2: Standalone server (for REST/WebSocket clients)
node dist/server.js --port 3423
MCP Tools (6)
Knowledge Base
| Tool | Action | Description | Parameters | | ----------- | -------- | ------------------------------------------------------------- | ------------------------------------------------ | | knowledge | list | List entries by category and/or tag | category?, tag? | | | read | Read a specific entry | path (required) | | | write | Create/update entry (auto git sync) | category, filename, content (all required) | | | delete | Delete an entry (auto git sync) | path (required) | | | sync | Manual git pull + push | -- | | | wakeup | Return L0 identity + L1 top-weighted entries (token-budgeted) | token_budget?, category? |
Search
| Tool | Description | Parameters | | ------------------ | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | | knowledge_search | General hybrid TF-IDF + semantic (no scope) | query, project?, role?, max_results?, ranked?, semantic?, category?, category_mode?, mmr?, mmr_lambda?, explain? | | | Scoped session-only recall (when scope set) | query, scope, project?, max_results? |
Response shape: {mode: "general" | "scoped", sessions, knowledge}. Scoped mode returns knowledge: [] by design.
Scopes: errors, plans, configs, tools, files, decisions, all.
Search knobs:
mmr: trueapplies Maximal Marginal Relevance re-ranking (kills near-duplicate clusters in top-K).mmr_lambda0-1, default 0.7.category_mode: "boost"(default) gives matching-category entries a 1.25× score multiplier instead of dropping non-matches. Pass"filter"for hard-filter behavior.explain: trueattachesscore_components: {bm25, decay, maturity, confidence, category_boost, mmr_penalty}to every knowledge hit.
Sessions
| Tool | Action | Description | Parameters | | ------------------- | --------- | -------------------------------------- | --------------------------------------------------- | | knowledge_session | list | List sessions with metadata | project? | | | get | Retrieve full session conversation | session_id, project?, include_tools?, tail? | | | summary | Session summary (topics, tools, files) | session_id, project? |
Knowledge Graph
| Tool | Action | Description | Parameters | | ----------------- | ------------------ | ----------------------------------------- | ----------------------------------------------------------------- | | knowledge_graph | link | Create/update edge between entries | source, target, rel_type, strength? | | | unlink | Remove edges between entries | source, target, rel_type? | | | invalidate | Mark edges as expired (set validto) | source, target, rel_type?, valid_to? | | | list | List edges | entry?, rel_type?, as_of? | | | traverse | Directed BFS traversal from an entry | entry, depth?, direction?, rel_type?, as_of? | | | bulk_link | Batch-create edges (code graph ingestion) | edges (array of {source, target, reltype, strength?, origin?}) | |
…
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: keshrath
- Source: keshrath/agent-knowledge
- License: MIT
- Homepage: https://www.npmjs.com/package/agent-knowledge
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.