RTFM 标志

RTFM

社区
roomi-fields

The open retrieval layer for AI coding agents. Indexes code, docs, legal, research, data — 22 parsers (incl. EPUB, DOCX, ODT), FTS5 + semantic search, knowledge graph. Serves surgical context via MCP. Open source, local, free.

发布者roomi-fields
代码仓库rtfm
语言Python
复刻数
5
星标数
24
可用工具
0
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    RTFM 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 24 个 Star 和 5 个 Fork。

RTFM

Retrieve The Forgotten Memory

The open retrieval layer your AI agent was missing

Index everything in your project — code, docs, PDFs, legal texts, research, data — and your agent finds the right context instantly. No hallucinations. No cloud. No API costs.

Free · Local · Open Source · MIT

RTFM vs vanilla Claude Code — same task, same model, who pays the bill?

PyPI version License: MIT Python MCP Claude Code GitHub stars


The problem

Your AI agent is flying blind.

It greps through thousands of files, misses the doc that answers the question, invents modules that don't exist, forgets what you decided last session. The bigger the project, the worse it gets. You've added a smarter model. It didn't help. Because the bottleneck isn't intelligence — it's retrieval.

Code indexers (Augment, Sourcegraph, Cursor) only see code. But your project isn't just code. It's specs, PRs, architecture decisions, research papers, PDFs, regulations, vault notes — the context your agent needs to stop guessing.

Why I built this

I was writing a French tax article (~50 pages of regulatory text, cross-references between code articles, case law, administrative doctrine). Claude Code kept grep-ing the same directories in loops, running out of context, and producing confidently wrong citations. I'd added more memory, better prompts, a smarter model. None of it worked, because the agent wasn't reasoning badly — it just couldn't find the right paragraph in a 2,000-file legal corpus. So I stopped trying to make the model smarter and built the layer it was missing. That's RTFM.

The solution

RTFM indexes everything. One command, one SQLite file, one retrieval layer your agent queries before grepping.

bash
pip install rtfm-ai && cd your-project && rtfm init

30 seconds. Claude Code now searches your indexed knowledge base — code and docs and PDFs and whatever else you drop in — with full-text, semantic, or hybrid search. The agent sees 300 tokens of metadata first, then expands only what's relevant. Progressive disclosure instead of context dumps.

Free. Runs locally. No API keys. No cloud. Your data stays yours.

What it looks like

text
$ rtfm search "authentication flow" --limit 3
[1] src/auth/handlers.py > authenticate_user (p.2)    score 9.12
    src/auth/handlers.py:147  42 lines
[2] docs/architecture/auth.md > SSO flow (p.1)        score 7.84
    docs/architecture/auth.md:1   23 lines
[3] docs/ADR/0007-oauth.md > Decision (p.1)           score 6.90
    docs/ADR/0007-oauth.md:12  18 lines

Three results, ~300 tokens. The agent decides what to read next with rtfm_expand(source, target_section) — not a context dump, a conversation.


Quick start

Recommended — Claude Code plugin

In Claude Code (CLI or Desktop Code tab) :

/plugin marketplace add roomi-fields/claude-plugins
/plugin install rtfm@roomi-fields

RTFM is distributed via the roomi-fields/claude-plugins marketplace, which also ships notebooklm-mcp for citation-backed Q&A. To grab both at once:

/plugin install notebooklm@roomi-fields

That's it. The plugin auto-initializes each project on first use:

  • Creates .rtfm/library.db (one SQLite file)
  • Injects search instructions into CLAUDE.md
  • Pre-grants permission for the MCP tools (no prompt every search)
  • Indexes the project on the first prompt, re-indexes incrementally on every prompt

No pip install required. Pure Python, runs on Linux / macOS / Windows / WSL with Python 3.10+ already on PATH. The plugin bundles its own MCP server (no mcp SDK dep) and resolves python3 / python / py automatically.

Then say to Claude: "Find the authentication flow" — it uses rtfm_search instead of grepping.

Optional extras (semantic search, PDF parsing)

The core plugin is dependency-free. Heavier optional extras (embedding model, PDF parsers) install on demand into an isolated venv inside the plugin's data directory — no pollution of your system Python, no PEP 668 conflicts:

/rtfm:install-embeddings    # FastEmbed ONNX (~85 MB), semantic + hybrid search
/rtfm:install-pdf           # pdftext only (~50 MB), fast text extraction
/rtfm:install-pdf-full      # + marker-pdf + CPU-only torch (~1.5 GB), complex layouts

The pdf-full install uses PyTorch's CPU-only index (no CUDA, no GPU needed) to stay around 1.5 GB instead of 5 GB.

Restart Claude Code after install for the extras to be picked up.

Manual install (Cursor, Codex, Claude Desktop chat, other MCP clients)

For clients without Claude Code's plugin system :

bash
pip install rtfm-ai
cd /path/to/your-project
rtfm init

Then point your MCP client at rtfm-serve (the entry exposed by the pip package). Optional extras via pip install rtfm-ai[embeddings,pdf].


How it compares

RTFMAugment CESourcegraphCode-Index-MCPMemPalace
Code indexing✅ (AST-aware)✅✅✅Shallow (char-chunk)
Docs, specs, markdown✅ (header-parsed)Partial❌LimitedVerbatim chunks
Legal / regulatory✅ (XML, BOFiP)❌❌❌❌
Research (LaTeX, PDF)✅❌❌❌❌
Custom parsers✅ (~50 lines)❌❌❌❌
Knowledge graph✅ (file/code links)❌Partial❌Entity graph (people)
File version history✅ (unlimited)❌❌❌❌ (purge-and-replace)
MCP native✅✅✅✅✅
Runs locally✅CloudEnterprise✅✅
Open sourceMIT❌Partial✅MIT
PriceFree$20-200/mo$$$/moFreeFree

RTFM is the only open-source option that indexes multi-domain content with structural parsing, a code-level knowledge graph, and unlimited per-file history. That's the niche.

Different from MemPalace specifically: MemPalace is an entity-level memory for conversations (who/project/decision triples in SQLite, plus verbatim chunks in ChromaDB). RTFM is a retrieval layer for artefacts — parsed by format, linked at the file level, versioned over time. The two are stackable, not competing.

For a deeper breakdown of the design choices behind any RAG (chunking, retrieval, augmentation, integration, freshness, storage), see RAG Fundamentals — the 6 axes →


Memory that survives sessions

Between sessions, most agents forget. RTFM indexes Claude Code's own memory files across every project on your machine, with full version history.

bash
rtfm memory                    # Manual snapshot
rtfm memory --install-hook     # Auto-snapshot on every SessionEnd
  • Cross-project index — one DB at ~/.rtfm/memory.db sees every ~/.claude/projects/*/memory/ directory on your machine. Ask rtfm_search("OAuth auth decisions") and get hits from all 18 of your projects.
  • Unlimited version history — every change to a memory file is snapshotted (no prune). rtfm_history <slug> returns the full evolution.
  • Auto-snapshot on SessionEnd — one command installs a global Claude Code hook. Every session you close captures a new snapshot.
  • Curated, not verbatim — RTFM indexes the notes the agent already curated itself during the session (small, structured, signal-dense). Different philosophy from MemPalace, which indexes the full conversation transcripts in ChromaDB (large, noisy, needs aggressive semantic filtering).

Obsidian vault mode

RTFM is the retrieval layer for the Karpathy LLM Wiki pattern. Karpathy himself wrote: "at small scale the index file is enough, but as the wiki grows you want proper search." This is proper search.

bash
cd /path/to/your-obsidian-vault
rtfm vault
  • Detects .obsidian/, proposes a folder → corpus mapping
  • Resolves [[wikilinks]] following Obsidian rules → stored as graph edges
  • Generates _rtfm/ with Obsidian-native navigation (index, graph with Mermaid, hubs, orphans, Dataview frontmatter)
  • Tested on a 1,700-note research vault
_rtfm/
├── index.md      # Hub: corpus list, top connected documents
├── graph.md      # Hub documents, orphans, broken links, Mermaid
├── recent.md     # Recently modified files
└── corpus/       # Per-corpus indexes

The LLM still writes your wiki. RTFM handles the retrieval that index.md can't scale to.

Full Obsidian guide →


NotebookLM integration

RTFM pairs naturally with notebooklm-mcp. NotebookLM caps you at 50 queries/day per notebook; RTFM removes that ceiling by indexing answers locally — ask once, retrieve forever, offline, in milliseconds.

notebooklm-mcp's /batch-to-vault endpoint writes citation-backed Q&A as {slug}.md (markdown with frontmatter) plus {slug}.json (structured nblm-answer-v1 sidecar). Both are guaranteed to coexist. Two integration paths, both ship today:

  • Path A — Markdown (zero config): drop the vault into RTFM and rtfm sync. The default markdown parser slices each answer into question / answer / per-citation chunks automatically. No mapping, no schema, no code.
  • Path B — JSON sidecar (typed metadata): drop a nblm-answer.yaml mapping into .rtfm/mappings/. Each .json answer file produces typed chunks with notebook_id, source_name, citation_marker queryable via SQL, plus cites edge candidates between answers and sources.

Use Path A unless you specifically need to filter or graph by structured citation fields.

Full NotebookLM recipe →


What I measured

I ran two kinds of benchmarks. The honest picture is nuanced — retrieval helps most on tasks that are actually solvable and where the agent is spending time looking for things.

Document-heavy task: French tax article generation (B10)

Writing a ~50-page regulated article from a corpus of legal code, case law, and administrative doctrine. Same agent (Claude Code + Sonnet 4), same prompt, eight configurations tested.

ConfigurationDurationCostTokens
Baseline (no RTFM)8m 16s$22.618.21 M
With RTFM (FTS default)6m 58s$11.143.22 M

Δ : −51 % cost, −61 % tokens, −16 % duration — with better factual accuracy. This is the use case RTFM was built for: navigating a large multi-domain corpus where grep misses the right paragraph.

Code task: FeatureBench (LiberCoders dataset)

11 tasks, 3 repos of varying size, 4 conditions (A = standard prompt with file paths; B = discovery, no paths; C = RTFM FTS; D = RTFM hybrid), 3 runs each.

RepoSizeWhere RTFM helps
metaflow620 filesEveryone resolves — RTFM adds no measurable gain
astropy1,119 filesAll conditions 25–30 % F2P pass; none fully resolve
mlflow8,255 filesAll conditions 0–5 % F2P pass; none fully resolve

On a single smaller-scope run (test_stub_generator on metaflow), RTFM cut agent time by −37 % vs the no-paths baseline. On the larger repos, the tasks themselves were too hard for Sonnet 4 to resolve inside a 20-minute timeout regardless of retrieval.

The honest caveats

  • Single model (Sonnet 4), single agent (Claude Code). Not statistically bullet-proof.
  • On small repos (< 1k files), grep is enough and RTFM adds overhead.
  • FeatureBench measures code modification, not information retrieval. It's the wrong benchmark for a retrieval tool — I'm running against it because it's what exists. Better-suited benchmarks (RepoQA, SWE-QA, LocAgent) are on the roadmap.

What this says

RTFM measurably wins when the bottleneck is "find the right paragraph in a 2,000-file corpus". It doesn't magically make unsolvable tasks solvable. The model still has to do the work — RTFM just makes sure it has the right context to do it with.


Who it's for

RTFM works anywhere your project isn't just code:

  • LegalTech — Code + tax law + regulatory specs. Ships with Legifrance XML and BOFiP parsers.
  • Research — Code + LaTeX papers + datasets. Ships with LaTeX and PDF parsers.
  • FinTech — Code + financial regulations + XBRL reports. Write an XBRL parser in 50 lines.
  • HealthTech — Code + medical records (HL7/FHIR) + clinical guidelines.
  • Solo devs with big projects — Stop watching your agent grep the same 8,000 files every session.
  • Obsidian / PKM users — Make your vault actually searchable by your AI.
  • Any regulated industry — If your project mixes code with domain documents, RTFM is for you.

Full feature list

Search & retrieval

  • FTS5 full-text search — instant, zero-config, works out of the box
  • Semantic search — optional embeddings (FastEmbed/ONNX, no GPU needed)
  • Hybrid mode — combine both, rank by relevance score
  • Metadata-first — results return file paths + scores (~300 tokens), not content dumps
  • Progressive disclosure — agent expands only the chunks it actually needs
  • Knowledge graph — wikilinks + Python imports resolved as graph edges, hub detection, centrality ranking

Multi-format indexing

  • 22 parsers built-in — Markdown, Python (AST), LaTeX, YAML, JSON, TOML, Shell, PDF, XML, HTML, SQLite, Jupyter, CSV/TSV, XLSX, EPUB, MOBI/AZW, FB2, DJVU, DOCX, ODT, RTF, plain text
  • Extensible — add any format in ~50 lines of Python
  • Auto-sync hooks — index stays fresh every prompt, zero manual work
  • Incremental — only re-indexes what changed

Integration

  • Native Claude Code plugin — /plugin install rtfm@roomi-fields/rtfm, auto-init per project
  • Pure-Python MCP server — 0 external deps, no mcp SDK / pydantic / native binaries
  • Cross-platform — Linux, macOS, Windows, WSL (only requires Python ≥ 3.10 on PATH)
  • 13 MCP tools — search, context, expand, graph, history, sync, tags, ...
  • Manual install fallback — pip install rtfm-ai for Cursor, Codex, Claude Desktop chat, any other MCP client
  • CLI + Python API — scriptable for pipelines
  • Non-invasive — doesn't touch your code, doesn't replace your editor

The parser architecture

Need to index a format nobody supports? Write a parser in ~50 lines.

python
from rtfm.parsers.base import BaseParser, ParserRegistry
from rtfm.core.models import Chunk
import json
from uuid import uuid4

@ParserRegistry.register
class FHIRParser(BaseParser):
    """Parse HL7 FHIR medical records."""
    extensions = ['.fhir.json']
    name = "fhir"

    def parse(self, path, metadata=None):
        data = json.loads(path.read_text())
        for entry in data.get('entry', []):
            resource = entry.get('resource', {})
            yield Chunk(
                id=resource.get('id', str(uuid4())),
                content=json.dumps(resource, indent=2),
                book_title=f"FHIR {resource.get('resourceType', 'Unknown')}",
                book_slug=resource.get('id', 'unknown'),
                page_start=1,
                page_end=1,
            )

Drop it in your project, restart Claude Code, your medical AI agent now understands FHIR records.

Two levels of JSON integration

For JSON-based formats specifically, RTFM offers a second extensibility path that doesn't need any Python:

LevelWhat you doWhat you get
1. GenericNothing. Just index the file.Each top-level key becomes a chunk. Full-text search works on values.
2. MappedDrop a YAML mapping in .rtfm/mappings/ (~30 lines).Typed chunks with declared metadata, custom titles, foreach extraction over arrays, edge candidates. The producing project (NotebookLM, Linear, Notion, OpenAPI…) ships the mapping; RTFM stays generic.

See JSON schema mappings for the full reference, and RTFM × NotebookLM for a concrete recipe.

Built-in parsers

ParserExtensionsStrategy
Markdown.mdSplit by headers, YAML frontmatter extraction
Python.pyAST-based: each class/function = 1 chunk
LaTeX.texSplit by \section, \chapter, etc.
YAML.yaml, .ymlSplit by top-level keys
JSON.jsonSplit by top-level keys or array elements
TOML.tomlTop-level tables; emits depends_on edges (PEP 621, Cargo, Poetry)
Shell.sh, .bash, .zshFunction-aware chunking
PDF.pdfPage-based (pip install rtfm-ai[pdf])
Legifrance XML.xmlFrench legal codes (LEGI format)
BOFiP HTML.htmlFrench tax doctrine
SQLite.sqlite, .sqlite3, .dbSchema + sample rows per table; FK edges (read-only)
Jupyter.ipynbGroup cells by markdown heading; outputs dropped
CSV / TSV.csv, .tsvHeader + sample rows + lightweight type inference
XLSX.xlsxPer-sheet schema + sample (pip install rtfm-ai[xlsx])
Plain text.js, .ts, .rs, .go, ...Line-boundary chunks (~500 chars)

MCP tools

ToolWhat it does
rtfm_searchSearch the index (FTS, semantic, or hybrid)
rtfm_contextGet relevant context for a subject (metadata-only)
rtfm_expandShow all chunks of a source with full content
rtfm_discoverFast project structure scan (~1s, no indexing needed)
rtfm_booksList indexed documents
rtfm_statsLibrary statistics
rtfm_syncSync a directory (incremental)
rtfm_ingestIngest a single file
rtfm_tagsList all tags
rtfm_tag_chunksAdd tags to specific chunks
rtfm_removeRemove a file from the index
rtfm_graphShow dependency graph for a source (imports, links)
rtfm_historyFile version history and memory snapshots

CLI reference

bash
# Search
rtfm search "authentication flow"
rtfm search "article 39" --corpus cgi --limit 5

# Sync
rtfm sync                              # All registered sources
rtfm sync /path/to/docs --corpus docs  # Specific directory
rtfm sync . --force                    # Force re-index

# Source management
rtfm add /path/to/docs --corpus docs --extensions md,pdf
rtfm sources

# Obsidian vault
rtfm vault                             # Initialize for cwd vault
rtfm vault /path/to/vault              # Specific vault
rtfm vault --regenerate                # Regenerate _rtfm/ files

# Cross-project Claude memory
rtfm memory                            # Manual snapshot
rtfm memory --install-hook             # Auto-snapshot on SessionEnd

# Status & info
rtfm status
rtfm books
rtfm tags
rtfm history path/to/file.md           # Memory version history

# Semantic search
rtfm embed                             # Generate embeddings (one-time)
rtfm semantic-search "tax deductions" --hybrid

# MCP server
rtfm serve

Python API

python
from rtfm import Library

lib = Library("my_library.db")

# Index
stats = lib.ingest("documents/article.md", corpus="docs")
result = lib.sync(".", corpus="my-project")  # SyncResult(+3 ~1 -0 =42)

# Search
results = lib.search("depreciation", limit=10, corpus="cgi")
results = lib.hybrid_search("amortissement fiscal", limit=10)

# Export for LLM
prompt_context = results.to_prompt(max_chars=8000)

lib.close()

Where RTFM fits

RTFM isn't a task manager. It's not an agent framework. It's the knowledge layer your agent needs underneath whatever you're already using.

┌─────────────────────────────────┐
│  GSD / Taskmaster / Claude Flow │  ← Orchestration
├─────────────────────────────────┤
│              RTFM               │  ← Knowledge (you are here)
├─────────────────────────────────┤
│          Claude Code            │  ← Execution
└─────────────────────────────────┘

Without RTFM, your orchestrator drives an agent that hallucinates. With RTFM, the agent knows what it's building on.


Contributing

Adding a parser is the easiest way to contribute — and the most impactful. See CONTRIBUTING.md.

Found a bug? Have an idea? Open an issue.

Thanks

@AVeryTastyRaspberry made RTFM run on native Windows. RTFM is developed on Linux, and every command was broken there — the CLI died at import time before it could parse an argument. The report (#8) named the line; the testing that followed, on a real Windows 11 machine and checked against tasklist rather than against RTFM's own claims, found five more defects behind it and confirmed each fix. #9 then traced the console windows that kept popping up. That is a platform this project could not otherwise support.

License

MIT — use it, fork it, extend it, ship it.

Author

Romain Peyrichou — @roomi-fields


Code indexers see your code. RTFM sees everything.

⭐ Star on GitHub if RTFM saves your agent from hallucinating.

Curious how it works under the hood? See the Architecture — SQLite + FTS5, the parser registry, and the priority-queue worker (ingest → embed → OCR).

将 RTFM MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 RTFM 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 RTFM 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 RTFM MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "rtfm": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 RTFM MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 RTFM MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 RTFM 帮我完成这项任务吗?
RTFM
当然。我已阅读。
以下是我使用 RTFM 得到的结果。

常见问题

RTFM MCP 服务器有什么用途?

RTFM 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 RTFM MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 RTFM,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 RTFM MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 RTFM 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 RTFM MCP 连接到 TypingMind?

RTFM 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

RTFM MCP 在 TypingMind 中提供哪些工具?

RTFM 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 RTFM MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 RTFM 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇