Provides structured indexing for LaTeX research papers and documents, allowing for context-aware retrieval based on sections and chapters.
Offers specialized parsing for Markdown files, supporting header-based content splitting and frontmatter metadata extraction.
Indexes Python source code using AST-based parsing to treat classes and functions as individual chunks for precise retrieval.
Enables function-aware indexing for shell scripts, allowing agents to retrieve specific logic from within script files.
Supports indexing of XML documents, including specialized strategies for structured regulatory and legal data.
Indexes YAML configuration files by splitting them into chunks based on top-level keys for efficient search.
Specifically parses and indexes Zsh scripts, recognizing function boundaries to provide relevant automation context to AI agents.
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.
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 init30 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 parsersNon-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 initThis 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] # EverythingMCP Tools
Tool | What it does |
| Search the index (FTS, semantic, or hybrid) |
| Get relevant context for a subject (metadata-only) |
| Show all chunks of a source with full content |
| Fast project structure scan (~1s, no indexing needed) |
| List indexed documents |
| Library statistics |
| Sync a directory (incremental) |
| Ingest a single file |
| List all tags |
| Add tags to specific chunks |
| 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 |
| Split by headers, YAML frontmatter extraction |
Python |
| AST-based: each class/function = 1 chunk |
LaTeX |
| Split by |
YAML |
| Split by top-level keys |
JSON |
| Split by top-level keys or array elements |
Shell |
| Function-aware chunking |
| Page-based ( | |
Legifrance XML |
| French legal codes (LEGI format) |
BOFiP HTML |
| French tax doctrine |
Plain text |
| 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 servePython 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
Augment indexes your code. RTFM indexes everything.
Star on GitHub if this saves your agent from hallucinating!