KnowledgeRail
KnowledgeRail is a local-first MCP server that gives AI agents durable, evidence-backed project memory, retrieval, code intelligence, ingestion, and document generation.
Knowledge context retrieval: Run task-aware searches over wiki pages, list pages, search passages, and explore graph relations/dependencies with bounded budgets and explicit coverage-gap reporting.
Page management: Read, write, edit, move, delete Markdown wiki pages, and append a durable log (INFO/WARN/ACTION/DECISION entries).
File handling: List, read, and normalize controlled source files and PDFs into Markdown for ingestion.
Source ingestion: Start and drive bounded ingestion segments, apply evidence claims, record segment status, check source/evidence coverage, finalize, report drafts, and track/recover knowledge debt.
Code intelligence: Build/update/remove deterministic code indexes, search symbols, get definitions, list references, read code URIs, and record raw fallback lookups across many languages.
Document planning: Plan document outlines and compile section-specific evidence packs for a wide range of document types.
Document writing/review: Write Markdown deliverables and perform terminal delivery reviews with content hashes, optional diagram modes, and wiki-update plans.
Administration: Initialize a project wiki, inspect status, rebuild checkpoints, set up client hooks, lint/repair pages, detect code-evidence drift, and migrate older wiki data.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@KnowledgeRailExplain how the authentication module works"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
KnowledgeRail is a local-first MCP server that turns project documentation and source code into durable, evidence-backed context for AI agents.
It is designed for agents that need to understand, change, review, or document a codebase without loading the whole repository into the model context. Retrieval is bounded, provenance is preserved, missing evidence is reported explicitly, and difficult queries widen progressively instead of silently losing relevant information.
Current status: stable release
2.7.3. The server uses MCP SDK2.xand protocol2026-07-28. It supports explicitly bound or safely inferred localstdio, a self-hosted loopback HTTP gateway, and a local desktop-chat adapter. KnowledgeRail operates no hosted service and does not upload project data. See SELF_HOSTING.md.
What it provides
Eight domain-oriented tools with validated actions and machine-readable next steps.
Task-aware hybrid retrieval with lexical, graph, passage, and optional semantic evidence.
Progressive widening with explicit coverage signals and
GAP/unknown reporting.Complete source ingestion through bounded segments, a coverage ledger, and durable Evidence IR.
A deterministic multi-language code index with symbol, reference, route, test, configuration, and database lookup.
Incremental graph, retrieval, and semantic indexes stored beside the project wiki.
Contract-driven Markdown deliverables with terminal review, content hashes, and optional caller-authored diagrams.
Conservative migration of existing v1/v2/v3 wikis and pre-rebrand
.llm-wikimetadata.Deterministic project binding through explicit Cursor workspace configuration, cwd-aware IDE processes, and terminal agents.
A local HTTP gateway that keeps concurrent clients and projects isolated per request.
A desktop-chat workspace catalog with opaque, expiring per-chat bindings.
KnowledgeRail does not call an LLM itself. The connected MCP client chooses and calls the tools. OCR and embeddings are optional external providers configured by the user.
Deterministic code-evidence languages
Code evidence is extracted locally without tree-sitter, native binaries, downloaded grammars, or runtime parser dependencies. Each file is owned by exactly one versioned adapter, so upgrading one language reparses only that language's files. Unsupported or deliberately skipped constructs remain visible through recorded raw-fallback demand rather than being assigned an unreliable anchor.
Adapter | Files | Indexed constructs |
TypeScript / JavaScript / LWC |
| Classes, functions, methods, tests, routes, imports, calls, LWC decorators and component targets. |
Java |
| Classes, interfaces, enums, records, methods, Javadoc, JUnit markers, Spring routes, imports. |
Kotlin |
| Classes, objects and companions, top-level/member/extension functions, properties, KDoc, JUnit/Kotest markers, Spring and literal Ktor routes. |
Apex |
| Classes, methods, tests, REST resources, trigger events, and static SOQL/SOSL object references. |
Salesforce metadata |
| SFDX objects, fields, validation rules, flows, permission sets, formulas, calls, and Apex-compatible database references. |
C# |
| Namespaces, types, methods, properties, XML docs, test attributes, ASP.NET controller and minimal-API routes; nested quoted strings inside interpolations are masked without losing following code. |
Go |
| Functions, receiver methods, structs/interfaces, Go doc comments, tests, imports, and common router calls. |
Rust |
| Functions, types, traits, modules, |
PHP |
| Namespaces, types, functions/methods, PHPUnit markers, Laravel/Symfony routes, configuration and database references; HTML outside PHP tags is inert. |
C |
| Function definitions including pointer-return forms, doc comments, and includes. |
C++ |
| Functions, constructors, classes/structs, namespaces, qualified methods, doc comments, and includes. |
Python |
| Indentation-aware modules, classes, nested functions/methods, docstrings, decorators, tests, FastAPI/Flask/Django routes, imports, calls, configuration and database references. |
Ruby |
| Keyword-delimited classes/modules/methods, RDoc comments, RSpec/Minitest markers, Rails/Sinatra routes, imports, configuration and explicit database references. |
The extractors are intentionally conservative. LWC HTML templates, Java anonymous classes, dynamic Apex query object names, Rust macro expansion, PHP eval()/string callables and Blade/Twig templates, K&R C definitions, macro-generated C/C++ declarations, complex C++ operator/template metaprogramming, Python lambdas/dynamic definitions/metaclass-generated members, indirect or qualified decorator-generated routes, calls inside f-string interpolations, and notebooks are not guessed. Kotlin computed Ktor paths and string-named Kotest cases are not emitted independently. Salesforce metadata is limited to the explicit SFDX suffix roster; malformed XML falls back to a file module. Ruby metaprogramming, inferred ActiveRecord tables, individual RSpec it blocks, operator methods, and ambiguous plain command-form heredocs or regex literals remain best-effort or out of scope. Headers use the C++ superset adapter. Python uses a separate indentation engine with CPython-compatible tab stops; Ruby uses its own keyword-block engine. Qualified knowledge_code action="symbol" lookups treat ., #, ::, PHP namespace backslashes, and -> as equivalent separators, while returned names retain the language-native form. The pinned golden corpus contains 52 source files, 1,429 source lines, and 199 hand-labeled symbols across twelve language adapters; the mixed-repository benchmark adds two LWC files for 54 files and 1,446 lines overall. Its perfect in-corpus score is a deterministic regression guarantee, not a claim of universal parser accuracy. Code anchors are line-based: trailing-whitespace edits remain fresh, while formatting that inserts or removes lines is deliberately reported as drift because it shifts the cited range. knowledge_admin action="status" reports the extension histogram supplied with recorded grep fallbacks, allowing later language priorities to follow real repository demand.
Related MCP server: memory-mcp
Requirements
Node.js
22.12.0or newernpm
macOS, Windows, or Linux
KnowledgeRail ships no browser or document renderer. Mermaid source remains ordinary Markdown and is rendered only by viewers that support it.
Quick start with npx
Run this from any directory inside the project in a terminal or another client that launches stdio servers with the project as its working directory:
npx -y knowledge-rail@2.7.3No project path is needed when the MCP client guarantees a project-scoped process cwd or supplies one unambiguous legacy MCP Root. Cursor project setup is explicit because its global MCP process may be shared across windows.
The reviewed package is published to npm. Pin an exact version in persistent configurations; reserve @latest for one-time trials.
Install and run from source
From source
git clone https://github.com/Deviank88/KnowledgeRail.git
cd KnowledgeRail
npm ci
npm run buildStart it from any directory inside the project whose knowledge you want to manage:
cd /path/to/your-project
node /absolute/path/to/KnowledgeRail/dist/index.jsCursor configuration
Run this once from the project root or any nested directory:
npx -y knowledge-rail@2.7.3 setup cursorThe command discovers the project upward and safely creates or merges .cursor/mcp.json. It preserves other MCP servers and pins an explicit ${workspaceFolder} binding. Re-running it is idempotent.
The equivalent manual project configuration is:
{
"mcpServers": {
"knowledge-rail": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"knowledge-rail@2.7.3",
"--root",
"${workspaceFolder}"
]
}
}
}Keep this file at <project>/.cursor/mcp.json, not in the global ~/.cursor/mcp.json. Recent Cursor releases can reuse a global stdio MCP process whose cwd is the user home or an empty window, so global cwd-based project inference is not a supported bound-workspace configuration. Cursor documents type: "stdio", project configuration, and ${workspaceFolder} interpolation in its MCP guide.
For a source checkout, use the compiled entry point while retaining the explicit workspace root:
{
"mcpServers": {
"knowledge-rail": {
"type": "stdio",
"command": "node",
"args": [
"/absolute/path/to/KnowledgeRail/dist/index.js",
"--root",
"${workspaceFolder}"
]
}
}
}For a Cursor multi-root workspace, install one project configuration in every root that should expose KnowledgeRail. The server never selects the first open root silently.
Claude Code configuration
From the project, add KnowledgeRail at project scope:
claude mcp add --transport stdio --scope project knowledge-rail -- npx -y knowledge-rail@2.7.3Claude Code writes the shared project entry to .mcp.json and launches the local server in project context. Use claude mcp list to verify the connection. The command shape and project scope follow the official Claude Code MCP guide.
Other IDE and terminal clients
For a client that explicitly guarantees one stdio process per project with the project as cwd, the minimal server configuration remains:
{
"mcpServers": {
"knowledge-rail": {
"command": "npx",
"args": ["-y", "knowledge-rail@2.7.3"]
}
}
}If the client does not guarantee that cwd contract, pass an absolute --root in its project-scoped configuration. Do not place a repository-specific absolute root in a global configuration.
The workspace precedence is explicit --root; one unambiguous legacy MCP Root; WIKI_ROOT for compatibility; the nearest existing KnowledgeRail marker; the nearest project/VCS marker; finally a safe non-empty cwd. Filesystem roots, the user home, package caches, and known Claude/Cursor application directories fail closed.
Inspect the exact choice without starting MCP:
npx -y knowledge-rail@2.7.3 doctor
npx -y knowledge-rail@2.7.3 doctor --root /absolute/project/pathThe command prints the canonical root and its resolution source, or exits non-zero with corrective guidance.
Claude Desktop and other context-free desktop chats
A desktop chat does not open a filesystem folder, so it cannot safely infer a project from its process cwd. The preferred installation is the self-contained MCP Bundle (.mcpb): it avoids npm/network resolution on every Claude launch and follows Claude Desktop's current local-extension path.
For a source/release checkout, build the deterministic bundle:
npm run mcpb:buildThen install artifacts/knowledge-rail-2.7.3.mcpb from Claude Desktop → Settings → Extensions → Advanced settings → Install Extension. The bundle contains the compiled server and its production dependencies, starts the desktop adapter directly, and does not require a project path. See Anthropic's local MCP server guide and the MCP Bundle specification.
The manual local-development configuration remains available for hosts that have not adopted MCP Bundles:
{
"mcpServers": {
"knowledge-rail": {
"command": "npx",
"args": ["-y", "knowledge-rail@2.7.3", "desktop"]
}
}
}For a source checkout, use node /absolute/path/to/KnowledgeRail/dist/index.js desktop. The adapter discovers or starts the protected loopback gateway automatically and exposes knowledge_workspace in addition to the eight domain tools.
In a new chat, ask KnowledgeRail to list workspaces, choose one entry, and confirm read or write access. The returned opaque binding belongs to that conversation and must accompany its later domain calls. For compatibility with desktop hosts that expose only textual tool results, knowledge_workspace returns the same binding in both its declared structured output and a workspace_binding: ... text line. Two chats can select different customers/projects concurrently. Start a new chat when changing customer workspace: filesystem access is isolated, but information already present in conversation history cannot be removed by the server.
Projects opened successfully by an IDE/terminal are added to the local catalog automatically without changing their clean eight-tool workflow. Operators can also manage catalog metadata locally:
npx -y knowledge-rail@2.7.3 workspace list
npx -y knowledge-rail@2.7.3 workspace register
npx -y knowledge-rail@2.7.3 workspace register /absolute/project/path
npx -y knowledge-rail@2.7.3 workspace unregister ws_exampleRegistration never copies, uploads, scans the disk, or deletes project files. workspace register without a path discovers only upward from cwd.
Local self-hosted HTTP gateway
Start one gateway for many concurrent local clients and workspaces:
npx -y knowledge-rail@2.7.3 --transport httpThe default endpoint is http://127.0.0.1:3333/mcp; liveness only is available at /healthz. MCP requests require the random credential stored in the OS-protected per-user KnowledgeRail state directory. The desktop adapter reads it automatically, so it never belongs in project configuration or a repository.
The gateway does not have a current root. Every filesystem-capable request must resolve a valid opaque binding before the first path access. Bindings are scoped, expiring, revocable, and invalidated on gateway restart. Resource links are workspace-qualified and revalidated when read.
The shipped gateway deliberately rejects non-loopback binding. It is local self-hosting, not public OAuth or hostile-user multi-tenancy. claude.ai and Claude remote custom connectors cannot use a localhost endpoint because those connections originate from the provider cloud; Claude Desktop local MCP uses the desktop adapter above.
Client context | Entry point | Workspace behavior | Tool catalog |
Cursor | default | explicit project-scoped | 8 domain tools |
Claude Code, cwd-aware IDE or terminal agent | default | automatic from a project process cwd or one legacy Root | 8 domain tools |
Claude Desktop/local desktop chat |
| user chooses an approved catalog entry per chat |
|
Generic trusted local HTTP client |
| binding supplied on every filesystem-capable request |
|
Platform state locations are %LOCALAPPDATA%\KnowledgeRail on Windows, ~/Library/Application Support/KnowledgeRail on macOS, and ${XDG_STATE_HOME:-~/.local/state}/knowledge-rail on Linux. Set KNOWLEDGE_RAIL_STATE_DIR only for controlled testing or an intentional custom local installation. Docker/devcontainers and WSL have separate filesystems and therefore separate catalogs unless their state and project mounts are explicitly shared.
Operating-system notes
Windows: if an MCP host does not resolve npm command shims, use
"command": "npx.cmd"; escape backslashes in JSON paths (C:\\Tools\\KnowledgeRail\\dist\\index.js). PowerShell operator commands use the same CLI arguments shown above. Drive-letter case and junction/real paths are canonicalized before binding.macOS: the state directory is inside
Library/Application Support, not the opened repository.Linux:
XDG_STATE_HOMEis honored. No browser sandbox configuration is required.WSL and containers: run the MCP process in the same filesystem environment as the project. A Windows Claude Desktop process and a WSL-only localhost/state directory are distinct unless an explicit bridge is configured.
Agent workflow
KnowledgeRail exposes eight stable tools. Agents choose a domain directly and use its mode or action; no menu, profile, session scope, or legacy alias is required.
Tool | Operations |
|
|
| Read, write, edit, move, delete, and append the durable log. |
| List, read, and normalize controlled source files. |
|
|
| Maintain and query deterministic code evidence. |
| Plan any document profile and compile section-specific evidence. |
| Write and review Markdown deliverables. |
| Initialize, report status, verify/rebuild checkpoints, lint, detect code-evidence drift, and migrate KnowledgeRail data. |
Every successful operation returns a machine-readable state and either one nextAction or null. nextAction identifies the next tool, action, required arguments, and safe suggested arguments. Optional guidance and resultText complete the shared output envelope. Clients that only render text also receive concise Next: and Guidance: lines when applicable.
How it works
KnowledgeRail separates context retrieval, durable memory, source ingestion, code evidence, and document production so an agent can enter at the operation it needs without learning an internal menu or carrying session state:
task objective
↓
knowledge_context ──→ ranked evidence links + coverage gaps
↓ ↓
resources/read bounded widening, if needed
↓
agent reasoning and project work
├──→ knowledge_page / knowledge_code
├──→ knowledge_ingest ──→ Evidence IR ──→ canonical wiki
└──→ knowledge_document_context ──→ knowledge_documentFor a normal task, the agent calls knowledge_context mode="task" with a concrete objective. KnowledgeRail searches the canonical wiki and its derived lexical, graph, passage, code, and optional semantic indexes, ranks the available evidence, and returns a compact context envelope. Large page bodies are exposed as knowledge-rail:// links instead of being inserted wholesale into the response; the client reads only the selected passages. Coverage is assessed over both the full retrieved candidate set and the smaller display set. The full pool distinguishes truly missing evidence from evidence that is merely budget_limited; progressive widening stops only when the evidence returned to the model is sufficient. If the token budget alone excluded relevant evidence, the returned nextAction proposes one bounded widening step. Missing, stale, contradictory, or unresolved evidence remains an explicit gap and is never filled by guessing.
Decision pages are ordinary canonical wiki knowledge and already participate in that retrieval. Each page stays bounded to one coherent flow, component, or project context. Candidate prior choices are exposed in the structured decisions and changeImpact.decisions fields, but the agent inspects their metadata and materializes only a resource link that actually matches the task—normally the selected passage, or that single bounded page when no reliable passage exists. Detailed retrieval safeguards are included in the task response only when decision candidates exist, avoiding a large fixed instruction cost for unrelated sessions. The agent never loads every decision page, and the absence of a matching decision is normal rather than a coverage gap. When the human-model discussion reaches a clearly accepted, durable project choice, the agent closes the loop at task completion: it rereads and reuses the decision page for the same context (or creates a separate page for a different one), updates the current choice and concise rationale, appends a dated history note describing what changed and why, and writes one DECISION log entry. Proposals, unresolved options, incidental implementation details, raw conversation, hidden chain-of-thought, and secrets are never decision memory. The page remains valid if the independent log append must be retried. No decision means no write; an analysis-only or otherwise unauthorized session reports the proposed update instead of mutating the wiki.
Durable knowledge lives as Markdown under wiki/. Page-tool paths are relative to that root (concepts/RAG.md); a redundant leading wiki/ is accepted and removed, while a wiki directory deeper in the path is blocked so page writes cannot create wiki/wiki/.... Page directories remain open-ended and are created lazily, so projects can add domain-specific groupings without changing the catalog. Legacy nested pages are reported by lint; knowledge_admin action="lint" force=true dry_run=true previews a collision-safe repair and dry_run=false moves them to canonical paths while updating relative links. Direct page operations preserve caller-owned content byte-for-byte. Larger source sets use knowledge_ingest: normalized sources are processed in bounded segments, claims are recorded in durable Evidence IR, coverage is reconciled, and finalization is blocked until every segment is represented or explicitly classified. Derived retrieval and graph indexes are refreshed from this canonical state rather than replacing it.
Normalized sources originating in docs/transcripts/ activate the required stakeholder-memory contract; docs/client/ and docs/reports/ activate lightweight discovery when explicit stakeholder evidence is present. Each unambiguous participant, role, group, organization, or affected party is recorded under wiki/stakeholders/. Later sources update the current role, organization, email domain, and affiliation while the Evidence IR block retains prior observations and provenance. The local user domain comes first from KNOWLEDGE_RAIL_USER_EMAIL, then project-root git config user.email, otherwise it is unknown. Only domains are persisted: equal domains classify as internal and different domains as client; without a comparable domain, an explicit source declaration of client or internal is retained, otherwise the value is unknown; partner always requires explicit evidence. Complete participant addresses are redacted from durable claims; unsupported attributes are not inferred and ambiguous identities are not merged. Identity resolution is cached for the server lifetime, so changing the environment variable or project Git email requires a KnowledgeRail server restart.
Verified warm start and phrase-aware retrieval
KnowledgeRail resumes from project-local lexical and graph checkpoints, but never treats them as authority. Before a checkpoint can serve evidence, canonical Markdown is reconciled and the graph checkpoint must match the verified lexical corpus revision and its own builder version. A missing, stale, truncated, corrupt, oversized, symlinked, or incompatible artifact—or a symlinked/non-directory .knowledge-rail boundary—is discarded as one candidate generation; KnowledgeRail rebuilds from canonical pages and exposes a stable fallback reason through knowledge_admin action="status". Read-only requests may consume valid derived files but do not rewrite them. Authorized mutations append revision-bound lexical and graph journals under one cross-process lock; either journal is compacted into its snapshot after 100 deltas or 4 MiB, preventing unbounded growth.
The default integrity policy is metadata: path, size, modification/change timestamps, and portable file identity select which pages must be reread and hashed. content fingerprints every canonical page before accepting the generation and is intended for higher-assurance environments where the extra startup I/O is appropriate. Set KNOWLEDGE_RAIL_INTEGRITY_MODE=content, or use integrity_mode="content" with the admin status/checkpoint actions. To explicitly verify and persist a clean generation, run knowledge_admin action="checkpoint"; add force=true for an oracle rebuild from canonical Markdown.
Ordered word bigrams positively rerank only a bounded BM25 pool and select the best canonical passage; a missing phrase never filters a unigram candidate. Compound identifiers such as REQ-123, Asset__c, Retry-After, and /v2/invoices remain single ordered tokens. Pages matching every strong identifier are protected, and queries containing three or more strong identifier tokens retain exact lexical passage selection instead of applying a phrase boost. The channel is enabled by default after its held-out quality gate; KNOWLEDGE_RAIL_PHRASE_RERANK=off provides an internal soak/diagnostic rollback. Trigrams and a persistent n-gram table are intentionally absent because the controlled A/B test found no additional quality gain and the bounded scorer meets the latency gate.
Search scores are relative ranking signals within one result set, not probabilities or stable values to compare across queries or releases.
Document production is a separate evidence-backed workflow. knowledge_document_context first creates a plan and a bounded evidence pack for each section. knowledge_document then writes and reviews the Markdown against the selected contract. A passing review is terminal and returns the SHA-256 of the exact inspected content; conversion or branded rendering belongs to the user's own LLM and tooling. This keeps generated documents traceable to project memory without treating the deliverable itself as canonical memory.
All public actions validate their own required arguments before reading or mutating state. The shared state/nextAction envelope makes progress explicit, but a suggested next action never grants permission to perform a consequential write: the connected client retains its normal approval policy. Compatibility with older MCP clients changes only the transport adapter, not these eight tool names or their behavior.
A normal context request starts directly with:
knowledge_context {
"mode":"task",
"intent":"understand",
"objective":"Explain how lease renewal and expiry work",
"response_detail":"compact",
"heuristic_token_budget":2000
}On MCP 2026-07-28, knowledge_context returns selected knowledge-rail:// resource links. The client materializes only the passages it needs with resources/read; clients that do not expose resource reads can use knowledge_page action="read" with the exact URI. The envelope always reports retrieval.coverageMode as lexical or semantic, plus any graceful-degradation warning. When evidence was omitted only because of the budget, nextAction provides the next bounded widening request. Semantic, stale, or unresolved gaps are returned without a futile widening loop and must remain explicit unknowns.
The consolidated catalog is deliberately action-oriented, but validation remains action-specific. For example, knowledge_page action="edit" is rejected without path, old_string, and new_string; ingestion cannot finalize before complete coverage; document review reports blockers and delivery readiness for the exact inspected Markdown.
Caller-owned page, file, and code bodies are never rewritten to modernize historical tool names. If a canonical SCHEMA.md still refers to a retired operation, knowledge_admin action="migrate" can propose the corresponding current operation for explicit review; reads remain byte-preserving.
A normalized-source loop is explicit and machine-guided:
start → next → apply_claims or record_segment → next
→ source_status → finalizeUse evidence_status for claims and recovery debt; it is intentionally separate from per-source source_status. The old overloaded apply and status ingestion actions are rejected.
Why context has a token budget
The budget bounds evidence sent to the model; it does not declare omitted knowledge irrelevant. If coverage is insufficient because of the budget, the guided read workflow widens both max_evidence (up to 20) and the heuristic token allowance from 2,000 to 4,000, 8,000, and at most 12,000. Widening stops as soon as no evidence is budget-omitted; any remaining semantic or freshness gap is exposed rather than guessed.
response_detail="compact" is recommended for normal agent use. full keeps the complete historical TaskContext payload for diagnostics and integrations that need it.
Code-backed claims and drift detection
Evidence IR claims can cite a symbol returned by knowledge_code action="search" or action="symbol". Pass that exact code://repo/...#symbol-... URI as the claim target's code_resource_uri during knowledge_ingest action="apply_claims". If the symbol resolves against the current deterministic code index, KnowledgeRail stores a repository-relative line range, a trailing-whitespace-insensitive SHA-256 range hash, the parser version, and the capture time. A missing or stale symbol produces an explicit anchor warning; KnowledgeRail never fabricates an anchor.
Run a complete read-only check through the MCP tool:
knowledge_admin {
"action":"drift"
}For a bounded pre-commit or CI check, pass repository-relative files or directory prefixes:
knowledge_admin {
"action":"drift",
"scope":"paths",
"paths":["src/payments.ts","src/invoices"]
}The same detector is available without an MCP server for agent hooks and CI. Hook mode reports non-fresh anchors but never blocks the calling tool; it is silent when everything checked is fresh:
npx -y knowledge-rail@2.7.3 drift --no-ledger
npx -y knowledge-rail@2.7.3 drift --no-ledger --path src/payments.ts --path src/invoicesAn absolute event path is accepted only when it is confined to the discovered project. For pre-commit or CI, --check exits 2 on any non-fresh anchor or timeout; operational failures exit 1. JSON mode returns the complete shared-core result:
npx -y knowledge-rail@2.7.3 drift --check --no-ledger
npx -y knowledge-rail@2.7.3 drift --format json --no-ledgerText output is capped at 20 affected anchors. Its stale count is the aggregate of drift_suspected and anchor_unresolvable, not a fourth detector verdict. The default timeout is three seconds: ordinary hook mode reports a timeout on stderr and exits 0, while --check exits 2. Omit --no-ledger only when the disposable freshness ledger should be updated for later context compilation.
The action reads current code and writes only disposable state to wiki/.knowledge-rail/drift/ledger.json; it never edits claim text, canonical pages, or source code. A changed range, missing file, or invalidated line range becomes drift_suspected. An unreadable path, a non-file target, or a symlink that escapes the repository becomes anchor_unresolvable without aborting checks for other anchors. Trailing-whitespace-only edits and a parser-version change with identical range content stay fresh. knowledge_context keeps affected evidence visible for provenance, marks it stale with the corresponding reason, excludes it from clean evidence buckets, and returns an explicit stale_evidence gap even when stale evidence was retrieved but omitted from the display. Re-verification and correction remain normal Evidence IR work—there is intentionally no automatic fix.
Project client hooks integration
Claude Code, Codex and Cursor can receive project-scoped KnowledgeRail rules and read-only drift hooks directly. Preview with npx -y knowledge-rail@2.7.3 setup clients; apply only after review with the same command plus --apply. From an MCP client, ask the model to call knowledge_admin action="client_setup" setup_mode="preview", then explicitly request setup_mode="apply". Applying through the desktop/catalog profile requires a write-scoped workspace binding; preview and status remain read-only. Ordinary initialization never installs hooks implicitly.
The full guide, generated files, client trust steps and security boundaries are in docs/guides/claude-code-hooks.md.
The CLI hook bridge is harness-neutral and emits the native output contract for Claude Code, Codex or Cursor. All generated files and recovery manifests remain inside the selected project. Before a changed configuration is applied, exact existing bytes are copied under .knowledge-rail/backups/client-setup/<run-id>/; a no-op reapply creates no backup. KnowledgeRail retains the newest 20 successfully applied transactions while preserving incomplete, rolled-back, failed and unrecognized recovery evidence.
Project data
knowledge_admin action="init" creates this structure inside the selected project. The roots are intentionally stable: wiki/ is canonical agent memory; docs/ is the document plane for sources, normalized copies, durable evidence state, and deliverables.
project/
├── wiki/
│ ├── index.md
│ ├── log.md
│ ├── SCHEMA.md
│ ├── .knowledge-rail/ # derived indexes, drift ledger, manifests and migration state
│ └── <page-type>/ # created lazily when the first typed page is written
└── docs/
├── client/
├── transcripts/
├── reports/
├── changelogs/
├── normalized/
├── evidence-ir/ # durable Evidence IR and knowledge-recovery state
├── deliverables/
└── assets/Markdown pages are canonical knowledge. Files below wiki/.knowledge-rail/ are derived or operational state and can be rebuilt where the corresponding workflow supports it. Source documents remain under docs/; normalization never overwrites the original.
knowledge_admin action="migrate" also recognizes the pre-rebrand wiki/.llm-wiki/ namespace. It backs up both namespaces, assesses the legacy manifest, imports valid source-coverage ledgers, and rebuilds manifests and indexes from the current checkout instead of copying stale sizes, mtimes, or hashes. The internal manifest v2 is deterministic across Windows, macOS, and Linux: paths use / and Unicode NFC, Markdown line endings are normalized to LF before size and SHA-256 are computed, entries have a stable order, and the serialized file contains neither timestamps nor filesystem mtimes. Trees that differ only in platform path representation, CRLF/LF line endings, or timestamps therefore produce byte-identical manifest files and the same manifest hash; case-insensitive path collisions are rejected as non-portable. Existing manifest v1 files remain readable and are upgraded when rebuilt or invalidated. The old namespace remains untouched after a successful migration and is retained in the migration backup; ambiguous partial state in both namespaces is blocked for explicit operator review.
These directories may contain private project information. Decide deliberately whether the consuming project should commit them.
Document memory and deliverables
Document generation starts with knowledge_document_context action="plan". Follow its nextAction to compile a separate bounded evidence pack for every section, then use knowledge_document action="write" and action="review". Review is terminal when no blocker remains and returns contentSha256 so the caller can bind the verdict to the exact Markdown bytes inspected. It writes no manifest or sidecar and makes no certification claim.
Built-in presets cover functional specifications and analyses, technical analyses, architecture documents, project briefs, user manuals, onboarding guides, API references, ADRs, runbooks, test plans, incident reports, and release notes. They are not a closed taxonomy: any non-empty document_type is valid, and required_sections lets the user or their LLM define the outline. Each preset supplies a purpose, default language and audience, minimum useful content, and type-specific checks; callers can override the outline, language, and client-facing status.
Diagrams are opt-in. Omitting diagram_mode means that review applies no diagram-mode constraint; clients that want an explicit choice must propagate none, mermaid, or external_asset through planning and review. With mermaid, the user's LLM writes a fenced Mermaid block directly in the Markdown; Obsidian supports Mermaid code blocks, as do other compatible viewers. With external_asset, the caller supplies an SVG/PNG in docs/assets/ and links it from the deliverable as ../assets/name.svg or ../assets/name.png; review validates confinement, signature, size, and active SVG content. Remote images and other local image formats receive portability warnings instead of security blockers. Because KnowledgeRail has no asset-write action, chat-only clients without filesystem access should offer only none and mermaid.
The generated document is an output of agent memory, not its replacement. Confirmed facts belong in wiki/; source artifacts remain in docs/; delivery-ready Markdown belongs in docs/deliverables/.
KnowledgeRail keeps its MCP catalog, prompts, stable identifiers, operational messages, and generated control files in English. This is an internal interoperability choice, not an output-language restriction: human-readable wiki pages and deliverables follow the language of the user's current request, an explicit language override takes precedence, and edits preserve the existing page language unless translation is requested. The policy has no locale allowlist.
Optional OCR and semantic retrieval
Text, Markdown, JSON, YAML, CSV/TSV, XLSX, and PPTX normalization works locally. Images and PDFs require either an Ollama-compatible OCR service or a configured native OCR endpoint.
Common OCR variables:
Variable | Purpose |
|
|
| Ollama base URL; defaults to |
| Native OCR base URL; defaults to |
| OCR model; defaults to |
| Positive request timeout in milliseconds. |
| Retry count. |
Semantic retrieval and semantic-aware coverage are optional. Without an embedding provider, deterministic lexical/graph/passage retrieval and delimiter-, stemming-, and artifact-equivalence-aware coverage remain fully available offline. With a provider, query facets and entities are additionally checked against indexed passage embeddings, which improves GAP precision. Page coverage uses the strongest indexed passage, while displayed-passage coverage is scored only against the excerpt actually selected; a relevant page therefore cannot hide a weak displayed excerpt. If the configured provider is unavailable, times out, or returns incompatible vectors, knowledge_context falls back to lexical coverage and reports the warning instead of failing.
The recommended local-first setup is an OpenAI-compatible Ollama endpoint; choose a pinned local model and use its declared vector dimensions:
KNOWLEDGE_RAIL_EMBEDDING_BASE_URL=http://localhost:11434/v1
KNOWLEDGE_RAIL_EMBEDDING_MODEL=<pinned-local-embedding-model>
KNOWLEDGE_RAIL_EMBEDDING_MODEL_VERSION=<pinned-version>
KNOWLEDGE_RAIL_EMBEDDING_DIMENSIONS=<model-dimensions>A remote OpenAI-compatible endpoint is also supported when explicitly configured:
KNOWLEDGE_RAIL_EMBEDDING_BASE_URL=https://provider.example/v1
KNOWLEDGE_RAIL_EMBEDDING_MODEL=embedding-model
KNOWLEDGE_RAIL_EMBEDDING_DIMENSIONS=1536Optional embedding variables are KNOWLEDGE_RAIL_EMBEDDING_API_KEY, KNOWLEDGE_RAIL_EMBEDDING_MODEL_VERSION, and KNOWLEDGE_RAIL_EMBEDDING_TIMEOUT_MS.
Coverage mode | Provider | Behavior |
| none, or provider degraded | Offline deterministic coverage with normalized facets/entities and shared artifact equivalences. |
| configured and healthy | Batched embedding similarity over indexed passages, with the same bounded display and explicit-gap guarantees. |
Compatibility
Capability | Status |
MCP SDK | official |
Modern protocol |
|
Cursor transport | project-scoped local |
Cwd-aware IDE/terminal transport | local |
Local HTTP transport | self-hosted loopback gateway, stateless per-request workspace resolution |
Desktop chat | local |
Legacy wire adapter | Served for existing 2025-era clients with the same eight public tool names |
Modern selective reads | MCP |
Public/hosted Streamable HTTP | Not implemented; the shipped gateway rejects non-loopback binding |
Claude remote connectors to localhost | Not supported; use Claude Desktop local MCP |
Serverless multi-tenant storage | Not implemented |
All public tools use the knowledge_* prefix in both protocol eras. Historical wiki_* tools and knowledge_menu are not advertised. The legacy adapter is transport/workspace compatibility only: it does not restore the old tool catalog. Conservative migration of existing wiki data remains supported independently of protocol compatibility.
Development and verification
npm ci
npm run verify
npm run audit:runtime
npm run audit:signatures
npm run package:smokeRun all deterministic retrieval and quality gates:
npm run eval:gatesThe aggregate command runs these unchanged individual gates:
npm run eval:retrieval:gate
npm run eval:hybrid:gate
npm run eval:widening:gate
npm run eval:source-coverage:gate
npm run eval:evidence-ir:gate
npm run eval:code-evidence:gate
npm run eval:drift:gate
npm run eval:recovery:gate
npm run eval:task-context:gate
npm run eval:semantic:gate
npm run eval:migration:gate
npm run eval:editorial:gate
npm run eval:documents:gate
npm run eval:tool-surface:gateThe benchmark fixtures and acceptance rules are documented in benchmarks/README.md. CI verifies Node.js 22 and 24, all regression gates, benchmark smoke tests, the runtime dependency audit, and installed-tarball smokes on Ubuntu, macOS, and Windows.
See CONTRIBUTING.md before opening a pull request and SECURITY.md for vulnerability reporting.
License
Licensed under the Apache License 2.0. You may use, modify, and distribute the project, including commercially, subject to the license terms and preservation of required notices. The license does not require derivative products to be open source.
Origins and acknowledgement
KnowledgeRail is an independent project. Its starting point was inspired in part by Andrej Karpathy's LLM Wiki idea file: an LLM maintains durable Markdown knowledge that compounds instead of reconstructing everything from raw sources on every query.
KnowledgeRail has since evolved into a distinct MCP 2.0 agent-memory system with bounded hybrid retrieval, coverage and gap reporting, Evidence IR, deterministic code evidence, migration support, and contract-driven document production. It is not affiliated with or endorsed by Andrej Karpathy. See ACKNOWLEDGEMENTS.md.
Available Tools
8 toolsknowledge_adminDDestructive
Initialize/inspect/rebuild, client setup, lint/repair, drift, and migration.
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | lint: repair nested wiki. | |
| paths | No | ||
| scope | No | ||
| action | Yes | init=bootstrap;status=state;checkpoint=rebuild;client_setup=hooks;lint=validate links/repair;drift=anchors;migrate=upgrade. | |
| backup | No | ||
| run_id | No | ||
| clients | No | ||
| dry_run | No | lint: false applies repair. | |
| setup_mode | No | preview | |
| integrity_mode | No | metadata | |
| target_version | No | 4 | |
| include_missing | No | ||
| include_orphans | No | ||
| migration_action | No | plan | |
| include_broken_links | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| state | Yes | |
| guidance | No | |
| nextAction | Yes | |
| resultText | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations declare destructiveHint=true and idempotentHint=false, raising the bar for behavioral disclosure, but the description adds nothing about what gets destroyed or modified, whether safety nets like backup, dry_run, or setup_mode=preview exist, or what side effects rebuild/repair/migrate have. The words 'rebuild,' 'repair,' and 'migration' are consistent with the annotations, so there is no contradiction—but the description fails to elaborate on any destructive consequence beyond the action names themselves.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The single 12-word line is brief, but this is under-specification masquerading as conciseness. There is no lead sentence stating purpose, no grouping of related behaviors, and no hierarchy—just a flat list that duplicates the action enum. Brevity without information structure earns no credit.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
This is a high-complexity tool—15 parameters, 7 actions, conditional parameter-action interactions (force/dry_run for lint, clients/setup_mode for client_setup, migration_action/target_version for migrate), and destructive semantics—yet the description delivers zero operational guidance. Even with an output schema present, an agent cannot determine which parameters are valid for which action, what the safety modes do, or what output to expect. The definition is severely inadequate for its complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is only 20% (3 of 15 parameters documented: action, force, dry_run, each with a terse one-liner), so the description carries a heavy burden it does not meet. It adds zero meaning about parameters like backup, clients, setup_mode, integrity_mode, migration_action, target_version, include_missing, include_orphans, or include_broken_links, and it does not explain which parameters apply to which action. The description merely restates the action enum, which the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description, "Initialize/inspect/rebuild, client setup, lint/repair, drift, and migration," is a comma-separated list that maps almost one-to-one onto the action enum (init, status/checkpoint, client_setup, lint, drift, migrate). It never states a clear verb+resource purpose such as 'administers the knowledge base' or 'performs maintenance operations,' so an agent cannot tell what the tool fundamentally does or how it differs from siblings like knowledge_ingest or knowledge_document. This is close to restating the schema's own enum values in prose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool versus its seven siblings, no example workflows, no conditions, and no exclusions. The only usage signal is the action list itself, which the input schema already exposes. An agent gets zero help deciding between knowledge_admin, knowledge_ingest, and knowledge_page.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
knowledge_codeDDestructive
Code index, symbols, callers, fallback.
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | ||
| kinds | No | ||
| query | No | ||
| action | Yes | status=index;rebuild=recreate;update=refresh;remove=drop;search=find;symbol=definition;references=callers of symbol;read=URI;record_fallback=raw lookup. | |
| symbol | No | ||
| max_chars | No | ||
| symbol_id | No | ||
| max_results | No | ||
| resource_uri | No | ||
| path_prefixes | No | ||
| fallback_reason | No | ||
| recovered_evidence | No | ||
| fallback_result_count | No | ||
| fallback_result_paths | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| state | Yes | |
| guidance | No | |
| nextAction | Yes | |
| resultText | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations carry the safety profile with destructiveHint=true and readOnlyHint=false, so the agent is warned that this tool can be destructive. However, the description adds no behavioral context about what gets destroyed, when side effects occur, or how fallback behavior works. The word 'fallback' hints at one behavior but is not explained.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely short, which is concise, but it is under-specified rather than efficiently structured. It is not a sentence, provides no front-loaded action, and leaves the agent to infer meaning from the schema. This is closer to a set of tags than a usable description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 14 parameters, 9 possible actions, a destructive hint, and seven sibling tools, this description is radically incomplete. An agent cannot determine which action to invoke, what parameters are relevant, or what safety caveats apply. The output schema helps with return values, but the lack of contextual guidance makes the tool very hard to use correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is only 7%, and the description does almost nothing to compensate. It names 'symbols' and 'callers', which loosely map to the symbol and references actions, but it provides no meaning for the many parameters such as path, kinds, query, symbol_id, resource_uri, or fallback_result_paths. This is insufficient for a 14-parameter tool.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description is a fragment: 'Code index, symbols, callers, fallback.' It names the tool's domain but uses no verb and does not state what the tool actually does. It is not a tautology, but it is far too vague to convey a clear purpose or distinguish it from sibling tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool versus siblings like knowledge_context or knowledge_page. No conditions, exclusions, or alternatives are mentioned. The action enum in the schema gives per-action hints, but the description itself provides zero usage direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
knowledge_contextDRead-onlyIdempotent
Evidence/gaps, pages, search, and graph.
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | task=evidence/gaps; list=pages; search=passages; graph=relations/dependencies. | task |
| view | No | subgraph | |
| query | No | ||
| intent | No | understand | |
| max_depth | No | ||
| max_nodes | No | ||
| objective | No | ||
| page_types | No | ||
| max_results | No | ||
| max_evidence | No | ||
| changed_paths | No | ||
| response_detail | No | compact | |
| retrieval_profile | No | balanced | |
| heuristic_token_budget | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| state | Yes | |
| guidance | No | |
| nextAction | Yes | |
| resultText | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate readOnlyHint=true, idempotentHint=true, and destructiveHint=false. The description adds no extra behavioral context such as retrieval behavior, output scope, or parameter interactions, and it does not contradict the annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely short and under-specified rather than appropriately concise. It is a noun phrase with no structure, offering minimal value for a tool with 14 parameters.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex tool with 14 parameters and multiple modes, this description is completely inadequate. It does not explain the modes, parameter semantics, or how to choose settings, leaving the agent without sufficient context to invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is only 7%, and the description does not compensate. The phrase 'Evidence/gaps, pages, search, and graph' only loosely maps to the mode enum and provides no meaning for the 13 other parameters like query, intent, max_depth, or retrieval_profile.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Evidence/gaps, pages, search, and graph' lists content areas but lacks a verb or explicit action, so it does not clearly state what the tool does. It vaguely hints at functionality without distinguishing it from sibling tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like knowledge_page or knowledge_document_context. There are no usage scenarios, exclusions, or references to sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
knowledge_documentCDestructive
Write or review evidence-backed documents.
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | ||
| action | Yes | write=save Markdown; review=delivery check. | |
| content | No | ||
| filename | Yes | ||
| language | No | ||
| overwrite | No | ||
| diagram_mode | No | ||
| project_name | No | ||
| client_facing | No | ||
| document_type | Yes | ||
| required_sections | No | ||
| include_wiki_update_plan | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| state | Yes | |
| guidance | No | |
| nextAction | Yes | |
| resultText | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate destructiveHint=true and readOnlyHint=false, so the agent knows this mutates. But the description does not mention overwrite behavior, wiki update plan side effects, or document review semantics. With zero descriptive behavior beyond 'write or review,' the agent gets little insight into what changes are made.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely short (8 words), which is concise, and the action enum values add meaningful precision. But it is under-specified rather than efficiently complete, so it doesn't earn a 5.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With 12 parameters, 8% schema coverage, a true output schema, destructive annotations, and seven sibling tools, the description should explain what an evidence-backed document is, when to use each action, and what side effects occur (overwrite, wiki plan, file writes). It addresses almost none of that.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is very low (8%) and 12 parameters exist, so the description carries almost none of the explanatory burden. However, the action description ('write=save Markdown; review=delivery check') does add meaning for two params. Most parameters—content, language, overwrite, diagram_mode, project_name, client_facing, required_sections, include_wiki_update_plan—are not explained anywhere in the description, so the score is at best a 3.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description says the tool writes or reviews evidence-backed documents, with action enum distinguishing write=save Markdown and review=delivery check. It is somewhat broad ('documents') given the knowledge_* sibling family, but the action enum and document_type parameter give it enough shape. It doesn't clearly distinguish itself from siblings like knowledge_page or knowledge_document_context.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit when-to-use guidance, no alternatives mentioned, and no context about when write vs review should be chosen beyond the schema's one-line enum meaning. The sibling list invites comparison but the description provides no routing cues.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
knowledge_document_contextDRead-onlyIdempotent
Document plans and section evidence.
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | ||
| action | Yes | plan=design outline; section=collect evidence. | |
| audience | No | ||
| language | No | ||
| max_pages | No | ||
| objective | No | ||
| page_paths | No | ||
| page_types | No | ||
| diagram_mode | No | ||
| max_sections | No | ||
| project_name | No | ||
| document_type | Yes | ||
| section_title | No | ||
| max_total_chars | No | ||
| max_output_chars | No | ||
| required_evidence | No | ||
| required_sections | No | ||
| retrieval_profile | No | coverage | |
| max_chars_per_page | No | ||
| preferred_evidence | No | ||
| heuristic_token_budget | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| state | Yes | |
| guidance | No | |
| nextAction | Yes | |
| resultText | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is covered. The description adds almost no behavioral context: it does not explain what the tool outputs, how it processes inputs, or what side effects (if any) are expected. It neither contradicts annotations nor enriches them.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is short, but under-specification is not the same as conciseness. A single vague phrase without a clear subject-verb-object structure does not front-load the purpose. It reads more like a topic tag than a functional description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
This is a high-complexity tool with 21 parameters and close sibling tools, yet the description is practically empty. Nothing tells an agent about the tool's scope, how to choose between plan and section, what evidence types are relevant, or how this differs from knowledge_document or knowledge_context. The output schema and annotations mitigate some gaps, but they cannot replace basic operational orientation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is only 5% across 21 parameters, so the description must compensate. It barely does: 'plans' and 'section evidence' loosely map to the two action enum values (plan and section), but essentially no other parameters (query, audience, max_pages, page_paths, required_evidence, etc.) are clarified. This leaves an agent guessing at most of the input semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Document plans and section evidence.' is a fragmented, ambiguous phrase. It fails to state a clear verb and resources: 'Document' could be a noun or a verb, and 'plans and section evidence' are vague objects. It does not convey whether the tool creates a plan, gathers evidence, or both, and it does nothing to distinguish it from sibling tools like knowledge_context or knowledge_document.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no usage guidance whatsoever. The description does not mention when to prefer this tool over knowledge_document, knowledge_context, or other siblings, nor does it state any prerequisites or when not to use it. The only implicit hint is the schema's action enum, which is separate from the description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
knowledge_filesCDestructive
Controlled source files and PDFs: list, read, normalize to Markdown.
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | ||
| action | No | list=sources; read=open; normalize=Markdown. | list |
| pattern | No | **/* | |
| category | No | ||
| max_chars | No | ||
| overwrite | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| state | Yes | |
| guidance | No | |
| nextAction | Yes | |
| resultText | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With destructiveHint=true in annotations, the description should explain what side effects may occur, especially given the overwrite parameter, but it does not. The word 'controlled' suggests access limits, but it adds little concrete behavioral context about mutation, overwriting, or normalization side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single compact sentence that front-loads the core resource and action set. There is no filler or redundant restatement of the tool name.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given six parameters, a destructive hint, an overwrite flag, and several sibling tools, this one-line description is not sufficient context. The output schema may cover return values, but input selection, side effects, and usage boundaries are left unexplained.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is only 17%, so the tool description must compensate for undocumented parameters like path, pattern, category, max_chars, and overwrite. It does not explain these; only the action values are loosely reflected in the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description identifies a specific resource ('controlled source files and PDFs') and concrete actions (list, read, normalize to Markdown), so an agent can tell what the tool operates on and what it can do. It stops short of a 5 because it does not differentiate this tool from closely named siblings like knowledge_document or knowledge_page.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance about when to choose this tool over siblings such as knowledge_document_context or knowledge_admin, nor any mention of when to use list versus read versus normalize. The action enum hints at usage, but the description does not provide decision criteria or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
knowledge_ingestDDestructive
Source ingestion, claims, coverage, recovery.
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | start=begin;next=segment;apply_claims=integrate claims;record_segment=classify;source_status=coverage;evidence_status=debt;finalize=close;report=drafts;record_recovery=track;resolve_recovery=resolve. | |
| claims | No | Stakeholder target: entity_key,page_path,page_title,page_type,role,organization,email_domain,affiliation. | |
| reason | No | ||
| claim_ids | No | ||
| max_chars | No | ||
| page_refs | No | ||
| segment_id | No | ||
| evidence_refs | No | ||
| segment_status | No | ||
| recovery_events | No | ||
| recovery_reason | No | ||
| report_filename | No | ||
| include_resolved | No | ||
| recovery_event_id | No | ||
| segment_max_chars | No | ||
| recovery_page_refs | No | ||
| normalized_filename | No | ||
| recovery_resolution | No | ||
| total_evidence_used | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| state | Yes | |
| guidance | No | |
| nextAction | Yes | |
| resultText | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The annotations already indicate destructiveHint=true and readOnlyHint=false, but the description adds no behavioral context beyond that. It does not describe effects, prerequisites, or what makes the operation destructive, though it does not contradict the annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely short, but this is under-specification rather than efficient structure. It front-loads keywords that do not convey enough meaning to be useful, so the brevity does not earn its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 19 parameters, a 10-value action enum, and a complex ingestion/recovery workflow, this description is severely incomplete. It gives no sense of the required sequence, the meaning of the actions, or how this tool fits with sibling tools.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 19 parameters and only 11% schema description coverage, the description needed to compensate by clarifying parameter meaning and workflow. Instead, it offers only domain keywords and no parameter semantics, leaving the large action enum and many parameters unexplained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description is a set of noun phrases ('Source ingestion, claims, coverage, recovery') rather than a clear statement of what the tool does. It lacks a verb and resource pattern, and it does not distinguish knowledge_ingest from its knowledge_* siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance about when to use this tool versus alternatives like knowledge_page, knowledge_document, or knowledge_admin. The action enum implies a workflow, but the description itself provides no usage context or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
knowledge_pageCDestructive
Page CRUD and durable log.
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Wiki .md path; leading wiki/ maps to root. | |
| entry | No | ||
| level | No | ACTION | |
| action | Yes | read=open; write=create; edit=replace; move=rename; delete=remove; append_log=event. | |
| content | No | ||
| dry_run | No | ||
| new_path | No | Wiki-relative .md; creates dirs. | |
| old_path | No | ||
| max_chars | No | ||
| new_string | No | ||
| old_string | No | ||
| replace_all | No | ||
| resource_uri | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| state | Yes | |
| guidance | No | |
| nextAction | Yes | |
| resultText | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already convey that the tool is destructive and not read-only, and the description does not contradict them. 'Durable log' adds a small behavioral nuance suggesting append_log events persist, but the description does not disclose destructive consequences, path mapping behavior, or how actions like move/delete behave.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The text is extremely short and front-loaded with the resource name, but for a tool with 13 parameters and six distinct actions it is under-specified rather than appropriately concise. It reads more like a label than a usable tool description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity, the one-phrase description is not enough for an agent to safely invoke the right action with the right parameters. The schema and annotations supply some structure, but the description omits important context such as action semantics, path resolution, dry-run behavior, and when to use append_log versus a page write.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description provides no parameter-level information beyond the generic CRUD/log idea, while schema description coverage is only 23%. It does not compensate for the many undocumented parameters such as old_string/new_string, replace_all, dry_run, max_chars, or level.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The phrase 'Page CRUD and durable log' clearly identifies the tool as performing CRUD operations on wiki pages plus a persistent log action, so an agent can tell this is not a file-walking or ingest tool. It is not a tautology, but it does not explicitly differentiate itself from siblings like knowledge_document or knowledge_files.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance about when to choose this tool over alternatives, no mention of workflow context, and no exclusions such as 'for raw file operations use knowledge_files.' The word 'Page' offers only an implicit hint that this tool is page-oriented.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
v2.7.2- Changed
knowledge_admin3 fields changed- changed
Input schema / properties / action / descriptionPrevious value: -"init=bootstrap;status=state;checkpoint=rebuild;client_setup=hooks;lint=validate links;drift=anchors;migrate=upgrade stored knowledge format."New value: +"init=bootstrap;status=state;checkpoint=rebuild;client_setup=hooks;lint=validate links/repair;drift=anchors;migrate=upgrade." - added
Input schema / properties / dry_run / descriptionAdded value: +"lint: false applies repair." - added
Input schema / properties / force / descriptionAdded value: +"lint: repair nested wiki."
- Changed
knowledge_ingest2 fields changed- changed
Input schema / properties / claims / descriptionPrevious value: -"Claims; target/relations optional."New value: +"Stakeholder target: entity_key,page_path,page_title,page_type,role,organization,email_domain,affiliation." - removed
Input schema / properties / recovery_events / descriptionRemoved value: -"Recovery events; pages optional."
- Changed
knowledge_page2 fields changed- added
Input schema / properties / new_path / descriptionAdded value: +"Wiki-relative .md; creates dirs." - added
Input schema / properties / path / descriptionAdded value: +"Wiki .md path; leading wiki/ maps to root."
8 tool updates
v2.7.0- First observed
knowledge_admin - First observed
knowledge_code - First observed
knowledge_context - First observed
knowledge_document - First observed
knowledge_document_context - First observed
knowledge_files - First observed
knowledge_ingest - First observed
knowledge_page
TDQS
Most tools address distinct areas, but several pairs have fuzzy boundaries: knowledge_context mentions pages while knowledge_page is the page CRUD tool, and knowledge_document_context vs knowledge_document are easy to confuse. The one-line descriptions help clarify intent, but an agent could still hesitate between context-oriented and resource-oriented tools.
All tools share a knowledge_ prefix, giving the set a cohesive namespace, but the suffixes are inconsistent: some are nouns (page, code, admin), one is a verb (ingest), one is plural (files), and two are compound concepts (document_context, document). The pattern is readable but not a consistent verb_noun convention.
Eight tools is a reasonable, well-scoped count for a knowledge management platform. Each tool represents a meaningful functional area without excessive fragmentation or thin redundancy.
The set covers the core knowledge lifecycle: ingestion, file sources, page CRUD, code context, document planning/writing, and admin/maintenance. Minor gaps exist around explicit document deletion or lifecycle management, but the main workflows are well supported.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
shared AI-context layer for teams — persistent memory your agents search and update over MCP
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
An MCP server that gives your AI access to the source code and docs of all public github repos
Private-by-default, local-first memory/context/task orchestrator for MCP apps and agents.
Related MCP Servers
- AlicenseBqualityCmaintenanceA local-first MCP server that provides AI agents with safe codebase access through file discovery, hybrid lexical-semantic search, and project introspection. It features durable local memory and semantic indexing while keeping all data and processing entirely on your local machine.74296MIT
- AlicenseAqualityDmaintenanceA local-first MCP server that exposes personal notes and files as unified semantic context for AI agents via vector search and file monitoring.6MIT
- AlicenseNot gradedqualityDmaintenanceA local-first MCP server that turns a .context/ folder of markdown files into a searchable knowledge layer for AI coding agents.122MIT
- AlicenseNot gradedqualityAmaintenanceLocal-first MCP server that provides project context, verification gates, and structured tools for coding agents to discover knowledge, run diagnostics, and execute allowlisted commands within a repository.35MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Deviank88/KnowledgeRail'
If you have feedback or need assistance with the MCP directory API, please join our Discord server