Agent Knowledge

io.github.keshrathPublished by GitHub account keshrathv2.0.0Updated Oct 31, 2026

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

Overview

AI-generated overview

Local MCP server giving coding assistants a git-synced knowledge base plus searchable memory of past AI coding sessions.

What you can do
  • Browse, read, write, delete and git-sync knowledge base entries, and assemble a token-budgeted context bundle at session start
  • Search knowledge entries and past session transcripts with hybrid TF-IDF and semantic ranking, including scoped recall for errors, plans, configs, tools, files and decisions
  • List sessions, retrieve full conversations and get session summaries across supported coding tools
  • Create, remove, invalidate, list and traverse typed knowledge graph edges, including code structure edges
  • Analyze the knowledge base for duplicates, isolated entries, hubs, bridges, gaps and search gaps, and produce a short brief
  • Inspect vector store stats, change configuration, rebuild…
When to use it
Useful when you work with AI coding assistants across many sessions and want decisions, gotchas and project context to carry over instead of being lost when a session ends. Also fits teams that want a shared, git-backed knowledge vault readable by agents.
Requirements
Runs as a local stdio process, installed from npm (npx agent-knowledge) or built from source with Node.js. A git remote is optional for syncing the knowledge base. Embeddings default to a local model; OpenAI, Claude/Voyage or Gemini providers need the matching API key variable. Optional AGENT_KNOWLEDGE_* variables tune paths, port and hooks.
Before you install
Writes and deletes entries in a git repository and can auto commit and push on writes, so a misconfigured remote can publish content. It reads local session transcripts from installed coding tools and indexes raw message chunks by default, which may capture sensitive conversation text. Background auto-distillation and promotion write entries automatically. Cloud embedding providers send content to a third party and need API keys such as AGENT_KNOWLEDGE_OPENAI_API_KEY. A local REST API listens…

Installation

In SourceWeft

  1. Open Agent Knowledge in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

agent-knowledge

[License: MIT] [Node >= 20] [Tests: 604 passing] [MCP Tools: 6] [LongMemEval R@5: 98.8%]

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.

In Claude Code, the agent-knowledge plugin adds the /knowledge pane: the knowledge base beside the conversation. How it works, with pictures: the user manual.

[The /knowledge pane: open it, open an entry, follow a link]

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:

  1. Knowledge Base -- a git-synced markdown vault of structured entries (decisions, workflows, project context) that persists across sessions and machines.
  2. 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.

ToolFormatAuto-detected path
Claude CodeJSONL~/.claude/projects/
CursorJSONL~/.cursor/projects/*/agent-transcripts/
Codex CLIJSONL~/.codex/projects/
AiderMarkdown/JSONL.aider.chat.history.md / .aider.llm.history in project dirs
Continue.devJSON~/.continue/projects/
ClineJSONVS Code globalStorage saoudrizwan.claude-dev/tasks/
OpenCodeSQLite~/.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 against filesModified in 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 with evergreen: true are exempt.
  • Search-gap tracking -- knowledge_analyze(action: "search_gaps") surfaces zero-result queries over the last since_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 via token_budget or AGENT_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 via knowledge_admin(action: "promote"), or benchable offline via npm run bench:promote. Emits an auditable .dreams/YYYY-MM-DD.md diary every run.
  • Pluggable adapter system -- add support for new tools by implementing the SessionAdapter interface
  • 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: true in frontmatter exempts an entry from decay in ranking AND makes it append-only under promotion. The /knowledge pane marks them.
  • Author attribution -- optional author: <string> frontmatter, kept with the entry and returned by the REST API.
  • Code graph resolution -- calls, imports, inherits edge types for code structure; directed BFS traversal (outbound/inbound/both); bulk_link for efficient ingestion; unlink_by_origin for clearing stale code edges before re-ingest; code: prefixed node IDs distinguish code from knowledge
  • Temporal knowledge graph -- edges support valid_from / valid_to validity windows; as_of queries return point-in-time snapshots; invalidate action 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
  • /knowledge pane in Claude Code -- browse and search the knowledge base beside the conversation (agent-knowledge plugin)
  • Secrets scrubbing -- API keys, tokens, passwords, private keys automatically redacted before git push
  • Knowledge graph -- relationship edges between entries (related_to, supersedes, depends_on, contradicts, specializes, part_of, alternative_to, 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) or inferred (auto-distilled, 0.85× search rank multiplier); confidence_score field carries the model's certainty 0-1
  • Knowledge analysis — knowledge_analyze actions god_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 — SessionStart auto-wakeup + ingest-freshness check, UserPromptSubmit first-prompt targeted injection, PreCompact memory-flush nudge + distill, SessionEnd distill. Six hook scripts total, all fail-open, each toggleable via an AGENT_KNOWLEDGE_* env var. See 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.

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 for details.

Supported languages: TypeScript, JavaScript, Python, Go, Rust, Java, C, C++.

Quick Start

Install from npm

bash
npm install -g agent-knowledge

Or clone from source

bash
git clone https://github.com/keshrath/agent-knowledge.gitcd agent-knowledgenpm install && npm run build

Option 1: MCP server (for AI agents)

Add to your MCP client config (Claude Code, Cline, etc.):

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

The first MCP process also serves a local REST API on 127.0.0.1:3423 (what the hooks, the /knowledge pane and agent-tasks call); when it exits, another running session takes the port over.

See Setup Guide for client-specific instructions (Claude Code, Cursor, Windsurf, OpenCode).

Option 2: Claude Code plugin

bash
claude plugin marketplace add keshrath/agent-knowledgeclaude plugin install agent-knowledge@agent-knowledge

The plugin brings the MCP server, the knowledge-ingest skill and the /knowledge pane (Claude Code 2.1.289+).

MCP Tools (6)

Knowledge Base

ToolActionDescriptionParameters
knowledgelistList entries by category and/or tagcategory?, tag?
readRead a specific entrypath (required)
writeCreate/update entry (auto git sync)category, filename, content (all required)
deleteDelete an entry (auto git sync)path (required)
syncManual git pull + push--
wakeupReturn L0 identity + L1 top-weighted entries (token-budgeted)token_budget?, category?

Search

ToolDescriptionParameters
knowledge_searchGeneral 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: true applies Maximal Marginal Relevance re-ranking (kills near-duplicate clusters in top-K). mmr_lambda 0-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: true attaches score_components: {bm25, decay, maturity, confidence, category_boost, mmr_penalty} to every knowledge hit.

Sessions

ToolActionDescriptionParameters
knowledge_sessionlistList sessions with metadataproject?
getRetrieve full session conversationsession_id, project?, include_tools?, tail?
summarySession summary (topics, tools, files)session_id, project?

Knowledge Graph

ToolActionDescriptionParameters
knowledge_graphlinkCreate/update edge between entriessource, target, rel_type, strength?
unlinkRemove edges between entriessource, target, rel_type?
invalidateMark edges as expired (set valid_to)source, target, rel_type?, valid_to?
listList edgesentry?, rel_type?, as_of?
traverseDirected BFS traversal from an entryentry, depth?, direction?, rel_type?, as_of?
bulk_linkBatch-create edges (code graph ingestion)edges (array of {source, target, rel_type, strength?, origin?})
unlink_by_originDelete all edges by originorigin

Knowledge types: related_to, supersedes, depends_on, contradicts, specializes, part_of, alternative_to, builds_on Code structure types: calls, imports, inherits

Traverse directions: outbound (source→target), inbound (target→source), both (default, undirected)

Analysis

ToolActionDescriptionParameters
knowledge_analyzeconsolidateFind near-duplicate entriescategory?, threshold?
reflectFind unconnected entries for linkingcategory?, max_entries?
god_nodesMost-connected entries (degree centrality)top_n?
bridgesCross-category connectors (betweenness)top_n?
gapsIsolated entries (0-1 edges) by maturitymax_entries?
briefCached ~200 token knowledge base summary--

Admin

ToolActionDescriptionParameters
knowledge_adminstatusVector store statistics--
configView or update configurationgit_url?, memory_dir?, auto_distill?
rebuild_embeddingsRe-embed all knowledge entries (useful on provider switch)--
prune_orphansDelete embeddings for sessions no longer on diskvacuum?, force_vacuum?
vacuumReclaim free pages in the vector store--
promoteScored + gated promoterpromote_mode? (apply|explain), min_score?, min_recall_count?, min_unique_queries?

Scored promoter

Every project-level candidate is scored on six signals (relevance 0.30, frequency 0.24, query-diversity 0.15, recency 0.15, consolidation 0.10, conceptual-richness 0.06) and gated on minScore ≥ 0.5, minRecallCount ≥ 2, minUniqueQueries ≥ 2. All three gates must pass. Background auto-promotion is controlled by the same auto_distill config flag; invoke on demand with knowledge_admin(action: "promote").

  • promote_mode: "explain" (default) — score + gate candidates, write diary, DO NOT touch the KB.
  • promote_mode: "apply" — promote candidates that pass, write diary, git-commit.
  • Every run drops ~/agent-knowledge/.dreams/YYYY-MM-DD.md with per-candidate signal breakdowns and gate outcomes. The .-prefixed dir is git-tracked but excluded from list/search.
  • Grounded rehydration: a candidate is skipped if its source session file no longer exists on disk (prevents promoting deleted content).
  • Entries with evergreen: true frontmatter are never overwritten by promotion — activity is appended.

Write-bench harness: npm run bench:promote — offline replay with auto-labeling by "referenced in later sessions". Compares gated promoter to a naive "ship all" baseline, reports precision / recall / F1. Use it to gate signal-weight or threshold changes before rolling them out.

REST API

Loopback only (127.0.0.1), JSON only. Every request goes through a guard: a foreign Host or any Origin header gets 403, a request body must be application/json. A :path with a slash is sent encoded (notes%2Fx.md).

MethodEndpointCallerDescription
GET/healthpane, hooksStatus, version, entry count
GET/api/overview/knowledge paneCounts, categories, recent events
GET/api/knowledge?category=&tag=paneList entries with their scoring
GET/api/knowledge/search?q=&max_results=pane, opencode pluginSearch the knowledge base
GET/api/knowledge/:pathpaneRead one entry
GET/api/knowledge/:path/linkspaneThe entry's graph edges, each with the other end's title
DELETE/api/knowledge/:pathpaneDelete an entry (git synced)
POST/api/knowledgeagent-tasks KnowledgeBridgeWrite an entry (full write pipeline)
POST/api/knowledge/syncpanegit pull + push
GET/api/analysispaneHubs and isolated entries
GET/api/sessions?limit=&offset=&project=paneSessions, paged: { sessions, total }
GET/api/sessions/search?q=&role=paneSearch sessions
GET/api/sessions/:id/summarypaneSession summary
POST/api/eventssessionend-distill hookA receipt the pane shows

Architecture

mermaid
graph LR    subgraph Storage        KB[(Knowledge Base<br/>~/agent-knowledge<br/>Git Repository)]    end
    subgraph Session Sources        CC[(Claude Code<br/>JSONL)]        CU[(Cursor<br/>JSONL)]        OC[(OpenCode<br/>SQLite)]        CL[(Cline<br/>JSON)]        CD[(Continue.dev<br/>JSON)]        AI[(Aider<br/>MD / JSONL)]    end
    subgraph agent-knowledge        KM[Knowledge Module<br/>store / search / git]        AD[Session Adapters<br/>auto-discovery]        SE[Search Engine<br/>TF-IDF + Fuzzy]        DS[REST API<br/>127.0.0.1:3423]        MCP[MCP Server<br/>stdio]    end
    subgraph Clients        AG[Agent Sessions]        PN["/knowledge pane<br/>hooks, agent-tasks"]    end
    KB <-->|git pull/push| KM    CC --> AD    CU --> AD    OC --> AD    CL --> AD    CD --> AD    AI --> AD    AD --> SE    KM --> MCP    SE --> MCP    KM --> DS    SE --> DS    MCP --> AG    DS --> PN

Knowledge Graph

Entries and code symbols can be connected via typed, weighted edges stored in a dedicated edges SQLite table. Eleven relationship types are supported — 8 for knowledge edges and 3 for code structure:

Knowledge: related_to, supersedes, depends_on, contradicts, specializes, part_of, alternative_to, builds_on Code structure: calls, imports, inherits

  • knowledge_graph(action: "link") creates or updates an edge (with optional strength 0-1)
  • knowledge_graph(action: "unlink") removes edges (optionally filtered by type)
  • knowledge_graph(action: "list") lists edges for an entry or relationship type
  • knowledge_graph(action: "traverse") performs directed BFS traversal from a starting entry. Supports direction (outbound, inbound, both) and rel_type filter
  • knowledge_graph(action: "bulk_link") batch-creates edges in a single transaction (for code graph ingestion)
  • knowledge_graph(action: "unlink_by_origin") deletes all edges with a specific origin (for clearing stale code edges before re-ingest)

Code Graph

Code structure edges are created by the knowledge-ingest skill during codebase ingestion. They use code: prefixed node IDs:

code:src/auth/middleware.ts                    # file nodecode:src/auth/middleware.ts::validateToken      # symbol node

Query examples:

# Who calls validateToken?knowledge_graph({ action: "traverse", entry: "code:src/auth.ts::validateToken", direction: "inbound", rel_type: "calls", depth: 3 })
# What breaks if I change this function?knowledge_graph({ action: "traverse", entry: "code:src/auth.ts::validateToken", direction: "inbound", rel_type: "calls", depth: 5 })
# Combined: callers + knowledge context (decisions, design rationale)knowledge_graph({ action: "traverse", entry: "code:src/auth.ts::validateToken", depth: 2 })

Auto-linking

When knowledge with action: "write" creates or updates an entry, it automatically finds the top-3 most similar existing entries via cosine similarity and creates related_to edges for any pair scoring above 0.7.

Confidence & Decay Scoring

Each knowledge entry has a confidence score tracked in the entry_scores SQLite table. Search results are ranked using:

finalScore = baseRelevance * 0.5^(daysSinceLastAccess / 90) * maturityMultiplier

Entries mature automatically based on access count:

StageAccessesMultiplier
candidate< 50.5x
established5-191.0x
proven20+1.5x

Frequently accessed entries rise in search rankings; stale entries decay over time.

Search Capabilities

TF-IDF Ranking -- results scored by term frequency-inverse document frequency. Rare terms boost relevance. Global index cached for 60 seconds.

Fuzzy Matching -- Levenshtein edit distance with sliding window. Configurable threshold (default 0.7).

Scoped Recall via knowledge_search with the scope parameter:

ScopeMatches
errorsStack traces, exceptions, failed commands
plansArchitecture, TODOs, implementation steps
configsSettings, env vars, configuration files
toolsMCP tool calls, CLI commands
filesFile paths, modifications
decisionsTrade-offs, rationale, choices

Integrations

REST Write Endpoint

POST /api/knowledge accepts { category, filename, content } and runs the full write pipeline: git pull → file write → embedding index → auto-link → git push → duplicate check. Returns { path, autoLinks?, duplicateWarnings?, git } with status 201.

This enables HTTP-based writes from other services without an MCP connection.

agent-tasks KnowledgeBridge

agent-tasks has a built-in KnowledgeBridge that auto-pushes learning and decision artifacts to agent-knowledge on task completion. Entries land in decisions/ with frontmatter tags (agent-tasks, project name, artifact type), are auto-indexed with embeddings, and auto-linked to similar entries. No configuration needed: while any session runs agent-knowledge, its REST API on 127.0.0.1:3423 answers.

Testing

bash
npm test              # 604 tests across 39 filesnpm run test:watch    # Watch modenpm run lint          # ESLint on src/ and tests/npm run typecheck     # tsc --noEmitnpm run check         # typecheck + lint + format + test

Environment Variables

All env vars live under the AGENT_KNOWLEDGE_* prefix. No host name is baked in — the adapter registry auto-detects installed AI coding hosts (.claude, .cursor, .codex, .aider, .continue, OpenCode) without configuration.

Core

VariableDefaultDescription
AGENT_KNOWLEDGE_MEMORY_DIR~/agent-knowledgeGit-synced knowledge base directory
AGENT_KNOWLEDGE_GIT_URL--Git remote URL (auto-clones if dir missing)
AGENT_KNOWLEDGE_AUTO_DISTILLtrueAuto-distill session insights into the knowledge base
AGENT_KNOWLEDGE_INDEX_VERBATIMtrueIndex raw session message chunks into the vector store so conversation is retrievable later. Set false to save disk at scale.
AGENT_KNOWLEDGE_DATA_DIR(platform config)Override the primary host data root. Leave unset in the common case — adapters auto-detect every well-known host root under ~/.
AGENT_KNOWLEDGE_EXTRA_SESSION_ROOTS--Extra session directories, comma-separated. Added to whatever auto-detection finds.
AGENT_KNOWLEDGE_PORT3423Local REST API port (the /knowledge pane, hooks, agent-tasks)
AGENT_KNOWLEDGE_HOST127.0.0.1REST bind address

Embeddings

VariableDefaultDescription
AGENT_KNOWLEDGE_EMBEDDING_PROVIDERlocallocal | openai | claude | gemini
AGENT_KNOWLEDGE_EMBEDDING_ALPHA0.3TF-IDF vs semantic blend weight (0 = pure semantic, 1 = pure TF-IDF)
AGENT_KNOWLEDGE_EMBEDDING_MODEL--Override provider default model
AGENT_KNOWLEDGE_EMBEDDING_IDLE_TIMEOUT60Seconds before unloading the local model (0 = keep loaded)
AGENT_KNOWLEDGE_EMBEDDING_THREADS(auto)ONNX / OMP thread count for the local provider

API keys

Project-scoped overrides win over the standard keys. Set either; the scoped form lets you run agent-knowledge with a different key than the rest of your environment.

VariableFallbackDescription
AGENT_KNOWLEDGE_OPENAI_API_KEYOPENAI_API_KEYOpenAI embeddings
AGENT_KNOWLEDGE_ANTHROPIC_API_KEYANTHROPIC_API_KEYClaude / Voyage embeddings
AGENT_KNOWLEDGE_GEMINI_API_KEYGEMINI_API_KEYGemini embeddings

Hooks

VariableDefaultDescription
AGENT_KNOWLEDGE_AUTOWAKE1Auto-inject a knowledge(action: wakeup) bundle into SessionStart. Set 0 to disable.
AGENT_KNOWLEDGE_WAKEUP_BUDGET800Tokens for the wakeup bundle
AGENT_KNOWLEDGE_FIRSTPROMPT_INJECT1Run a targeted knowledge_search on the first user prompt and inject top hits. 0 / false / off to disable.
AGENT_KNOWLEDGE_FIRSTPROMPT_BUDGET600Tokens for first-prompt injection (clamp [100, 8000])
AGENT_KNOWLEDGE_FIRSTPROMPT_MAX_HITS4Max knowledge hits attached to the first prompt (clamp [1, 20])
AGENT_KNOWLEDGE_PRECOMPACT_NUDGE1Before pre-compaction, nudge the agent to save context via knowledge(action: write). 0 disables the nudge; off suppresses both nudge and disk dump.

External tool overrides

VariableDefaultDescription
OPENCODE_DATA_DIR~/.local/share/opencodeOverride where OpenCode's session DB lives (OpenCode's own env, honored by our adapter)

Documentation

  • Setup Guide — installation, client setup (Claude Code, OpenCode, Cursor, Windsurf), hooks, skills
  • Ingestion Guide — codebase ingestion skill, tree-sitter extraction, incremental updates
  • Architecture — source structure, design principles, database schema
  • Hooks — the Claude Code lifecycle hooks
  • Changelog

License

MIT

Source: README.md at commit b614c04

Tools

6

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).

Parameterstagpathactionrequiredcontentcategoryfilenamesectionstoken_budgetsection_budgets

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.

Parameterstaillimitactionrequiredoffsetprojectsession_idinclude_tools

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.

Parametersactionrequiredvacuumgit_urlmin_scorememory_dirauto_distillforce_vacuumpromote_modemin_recall_countmin_unique_queries

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.

Parametersas_ofdepthedgesentryactionrequiredoriginsourcetargetrel_typestrengthvalid_todirection+1 more

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.

Parameterstop_nactionrequiredcategorymin_countthresholdsince_daysmax_entriesgroup_similaritymin_touching_sessions

Version history

3
  1. v2.0.0LatestOct 24, 2026
  2. v1.9.8Oct 1, 2026
  3. v1.9.7Sep 16, 2026

Score

90% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts
  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listedRequired15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts