# agent-knowledge [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/keshrath/agent-knowledge  
**GitHub Stars:** 19  
**Views:** 6  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/agent-knowledge

## Description
Cross-session memory for AI agents - knowledge graph, scoring, semantic search

## Tools
Capabilities this server exposes over MCP:

- **knowledge** — Knowledge base CRUD, sync, and session-start hydration. Actions: "list" (browse entries), "read" (get entry content), "write" (create/update entry, auto git sync), "delete" (remove entry, auto git sync), "sync" (manual git pull + push), "wakeup" (return token-budgeted section-priority context bundle — identity, active_tasks, recent_decisions, known_gotchas, last_session_summary, top_weighted, semantic_fallback — call once at session start).
- **knowledge_search** — Search across sessions AND knowledge entries. Returns `{mode, sessions, knowledge}`. General mode (no `scope`): hybrid TF-IDF + semantic over both sources, with optional MMR diversity and category boost. Scoped mode (`scope` set): sessions-only filtered recall for a specific domain (errors, plans, configs, tools, files, decisions).
- **knowledge_session** — Session operations: list sessions, get a full conversation, or get a summary. Use action "list" to browse sessions, "get" to retrieve messages, "summary" for a quick overview.
- **knowledge_admin** — Admin operations: view vector store stats, view/update configuration, rebuild embeddings, prune orphan session embeddings, or VACUUM the database. Use action "status" for index stats, "config" to view or update settings, "rebuild_embeddings" to re-embed all knowledge entries (useful when switching providers), "prune_orphans" to delete embeddings for sessions no longer present on disk, "vacuum" to reclaim free pages.
- **knowledge_graph** — Knowledge graph operations with temporal validity and code structure support. Create/remove edges, traverse via directed BFS, bulk-import code graph edges. Relationship types: related_to, supersedes, depends_on, contradicts, specializes, part_of, alternative_to, builds_on, calls, imports, inherits. Code structure types (calls/imports/inherits) are created by knowledge-ingest and use "code:" prefixed node IDs.
- **knowledge_analyze** — Analysis tools: find duplicates, unconnected entries, most-connected concepts (god nodes), bridge entries, knowledge gaps, zero-result search queries, stale-by-code-activity entries, or generate a compact knowledge brief. Actions: consolidate, reflect, god_nodes, bridges, gaps, brief, search_gaps, stale_by_code_activity.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "agent-knowledge": {
    "command": "npx",
    "args": ["agent-knowledge"]
  }
}
```

## Documentation

## What agent-knowledge does

agent-knowledge provides cross-session memory for AI coding assistants through six action-based MCP tools. Its two primary data sources are a structured Markdown knowledge base and conversation histories discovered from supported coding tools. Knowledge entries can contain project context, decisions, workflows, gotchas, and other durable information; session search retrieves details from prior conversations even when those conversations came from a different assistant.

The knowledge base is synchronized through Git. Writes and deletes can trigger synchronization, while a separate action performs a manual pull and push. Before data is pushed, secrets such as API keys, tokens, passwords, and private keys are scrubbed. Entries support metadata including categories, authors, confidence, provenance, and an evergreen flag that prevents decay and promotion-based appending.

## How it works

Search combines semantic vector similarity with TF-IDF keyword ranking. General searches cover both sessions and knowledge entries, with optional diversity handling and category boosts. Scoped searches focus on session recall for errors, plans, configurations, tools, files, or decisions. Fuzzy matching helps with spelling variations, and individual session messages can be indexed for verbatim retrieval.

At session start, the `knowledge` tool's `wakeup` action builds a token-limited context bundle. It prioritizes identity, active tasks, recent decisions, known gotchas, the previous session summary, weighted entries, and semantic fallbacks. The default budget is 800 tokens, with unused capacity passed to later sections.

A temporal knowledge graph connects entries with relationships such as `depends_on`, `supersedes`, `contradicts`, and `part_of`. Directed traversal supports inbound, outbound, or bidirectional exploration. Code relationships use `calls`, `imports`, and `inherits`, with `code:`-prefixed node IDs and bulk-linking support for ingestion workflows. Edges can have validity windows and can be queried as of a point in time.

## Setup and configuration

Node.js 20 or newer is required. Session adapters automatically inspect local storage for Claude Code, Cursor, Codex CLI, Aider, Continue.dev, Cline, and OpenCode. Additional session directories can be supplied through the comma-separated `AGENT_KNOWLEDGE_EXTRA_SESSION_ROOTS` environment variable.

Embedding providers include local Hugging Face models, OpenAI, Claude/Voyage, and Gemini. Runtime configuration, including the Git URL, can be viewed or changed through `knowledge_admin`. The wakeup token limit can be changed with the tool's `token_budget` argument or `AGENT_KNOWLEDGE_WAKEUP_BUDGET`. Verbatim session indexing can be disabled with `AGENT_KNOWLEDGE_INDEX_VERBATIM=false`.

## Tools and capabilities

- `knowledge` lists, reads, writes, deletes, and synchronizes entries, and creates session-start context bundles.
- `knowledge_search` searches sessions and knowledge entries using hybrid ranking, scopes, category boosts, and optional diversity behavior.
- `knowledge_session` lists sessions or returns a complete conversation or summary.
- `knowledge_admin` reports index status, changes configuration, rebuilds embeddings, removes orphaned session embeddings, and vacuums the database.
- `knowledge_graph` creates, removes, imports, invalidates, and traverses temporal or code-structure edges.
- `knowledge_analyze` detects duplicates, disconnected entries, highly connected nodes, bridges, gaps, stale entries, search gaps, and produces compact briefs.

Automatic promotion uses weighted signals and multiple gates, while analysis can expose a diary of promotion runs. New entries can be auto-linked to similar existing entries, and write-time duplicate checks help identify overlapping content. Staleness analysis compares file paths and quoted code identifiers in entries with recent session activity; entries marked `evergreen: true` are exempt.

## Limitations and notes

Session data remains on the local storage used by each coding assistant, while the knowledge vault is the part designed for Git-based cross-machine synchronization. Adding support for another host requires an adapter implementing the `SessionAdapter` interface. Rebuilding embeddings is needed when changing embedding providers, and orphan cleanup removes vectors for sessions that no longer exist on disk. The Claude Code plugin additionally provides a `/knowledge` pane for browsing and searching the vault beside a conversation.

_Full upstream README: https://allmcps.com/mcp/agent-knowledge/readme_

