RTFM
The open retrieval layer for AI agents. Index your entire project — code, docs, legal, research, data — and serve surgical context via MCP. FTS5 full-text search, optional semantic search (FastEmbed/ONNX), 10 built-in parsers, incremental auto-sync.
README
<!-- mcp-name: io.github.roomi-fields/rtfm --> <div align="center">
RTFM
Retrieve The Forgotten Memory
The open retrieval layer for AI agents
Index your entire project — code, docs, legal, research, data — and serve your AI agent exactly the context it needs.
<!-- Badges -->
<!-- End Badges -->
</div>
Why?
Your AI agent is blind. It greps through thousands of files, loses context every session, hallucinates modules that don't exist. The fix isn't a smarter model — it's smarter retrieval.
Augment, Sourcegraph, and Cursor index code. RTFM indexes everything.
pip install rtfm-ai[mcp] && cd your-project && rtfm init
30 seconds. Claude Code now searches your indexed knowledge base before grepping.
Features
Search & Retrieval
- FTS5 full-text search — instant, zero-config, works out of the box
- Semantic search — optional embeddings (FastEmbed/ONNX, no GPU needed)
- Metadata-first — search returns file paths + scores (~300 tokens), not content dumps
- Progressive disclosure — the agent reads only what it needs via
Read(file_path)
Indexing
- 10 parsers built-in — Markdown, Python (AST), LaTeX, YAML, JSON, Shell, PDF, XML, HTML, plain text
- Extensible — add any format in ~50 lines of Python
- Incremental sync — only re-indexes what changed
- Auto-sync — hooks keep the index fresh every prompt, zero manual work
Integration
- MCP server — works with Claude Code, Cursor, Codex, any MCP client
- CLI —
rtfm search,rtfm sync,rtfm status, ... - Python API —
Library,SearchResults, custom parsers - Non-invasive — doesn't touch your code, doesn't replace your workflow tools
Quick Start
Install
pip install rtfm-ai[mcp]
Initialize in your project
cd /path/to/your-project
rtfm init
This creates .rtfm/library.db, registers the MCP server, injects search instructions into CLAUDE.md, and installs auto-sync hooks. Done.
Then say to Claude Code: "Search for authentication flow" — it uses rtfm_search instead of grepping.
Optional extras
pip install rtfm-ai[embeddings] # Semantic search (FastEmbed ONNX)
pip install rtfm-ai[pdf] # PDF parsing (pdftext + marker)
pip install rtfm-ai[mcp,embeddings,pdf] # Everything
MCP Tools
| Tool | What it does |
|---|---|
rtfm_search |
Search the index (FTS, semantic, or hybrid) |
rtfm_context |
Get relevant context for a subject (metadata-only) |
rtfm_expand |
Show all chunks of a source with full content |
rtfm_discover |
Fast project structure scan (~1s, no indexing needed) |
rtfm_books |
List indexed documents |
rtfm_stats |
Library statistics |
rtfm_sync |
Sync a directory (incremental) |
rtfm_ingest |
Ingest a single file |
rtfm_tags |
List all tags |
rtfm_tag_chunks |
Add tags to specific chunks |
rtfm_remove |
Remove a file from the index |
The Parser Architecture
This is what makes RTFM different. Need to index a format nobody supports?
from rtfm.parsers.base import BaseParser, ParserRegistry
from rtfm.core.models import Chunk
@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,
)
50 lines. Now your medical AI agent understands FHIR records.
Built-in parsers
| Parser | Extensions | Strategy |
|---|---|---|
| Markdown | .md |
Split by headers, YAML frontmatter extraction |
| Python | .py |
AST-based: each class/function = 1 chunk |
| LaTeX | .tex |
Split by \section, \chapter, etc. |
| YAML | .yaml, .yml |
Split by top-level keys |
| JSON | .json |
Split by top-level keys or array elements |
| Shell | .sh, .bash, .zsh |
Function-aware chunking |
.pdf |
Page-based (pip install rtfm-ai[pdf]) |
|
| Legifrance XML | .xml |
French legal codes (LEGI format) |
| BOFiP HTML | .html |
French tax doctrine |
| Plain text | .js, .ts, .rs, .go, ... |
Line-boundary chunks (~500 chars) |
How It Compares
| RTFM | Augment CE | Sourcegraph | Code-Index-MCP | |
|---|---|---|---|---|
| Code indexing | Yes | Yes | Yes | Yes |
| Docs, specs, markdown | Yes | Partial | No | Limited |
| Legal / regulatory | Yes | No | No | No |
| Research (LaTeX, PDF) | Yes | No | No | No |
| Custom parsers | Yes (50 lines) | No | No | No |
| MCP native | Yes | Yes | Yes | Yes |
| Open source | MIT | No | Partial | Yes |
| Dependencies | SQLite (built-in) | Cloud service | Enterprise server | Varies |
| Price | Free | $20-200/mo | $$$/mo | Free |
Use Cases
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.
- Any regulated industry — If your project mixes code with domain documents, RTFM is for you.
CLI Reference
# Search (auto-detects .rtfm/ database)
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
# Status & info
rtfm status
rtfm books
rtfm tags
# Semantic search (requires embeddings)
rtfm embed # Generate embeddings (one-time)
rtfm semantic-search "tax deductions" --hybrid # Hybrid FTS + semantic
# MCP server
rtfm serve
Python API
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()
Works With Your Workflow Tools
RTFM isn't a task manager. It's a knowledge layer.
┌─────────────────────────────────┐
│ GSD / Taskmaster / Claude Flow │ <- Workflow
├─────────────────────────────────┤
│ RTFM │ <- Knowledge
├─────────────────────────────────┤
│ Claude Code │ <- Execution
└─────────────────────────────────┘
Without RTFM, your workflow tool orchestrates an agent that hallucinates. With RTFM, your 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.
License
MIT — use it, fork it, extend it, ship it.
Author
Romain Peyrichou — @roomi-fields
<div align="center">
Augment indexes your code. RTFM indexes everything.
Star on GitHub if this saves your agent from hallucinating!
</div>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。