Less context. Less tokens. Less money.
ContextFS transforms your codebase into a structured, queryable context system. AI reads plain-text summaries instead of raw files — same understanding, a fraction of the token cost. Plus automatic cross-session memory so every new session picks up where the last one left off.
You ask about auth code
→ AI queries ContextFS summaries
→ Reads ~130-token summaries instead of ~690-token raw files
→ Uses ~81% fewer tokens
You close a session at ~65% context (auto-compact threshold)
→ PreCompact hook fires automatically
→ Session is summarized: decisions, open questions, next steps
→ Written to ~/.claude/sessions/summaries/<project-slug>/latest.json
You open a new session
→ SessionStart hook fires automatically
→ Previous session summary is injected as context
→ AI continues seamlessly from where you left off
curl -fsSL https://raw.githubusercontent.com/nanaubusiness/contextfs/main/install.sh | shRequirements: Node.js 18+, fswatch (macOS) or inotifywait (Linux)
After install, ContextFS MCP server is configured for your editor automatically.
| Command | What it does |
|---|---|
contextfs build |
Summarize all code files with Claude Opus 4.7 |
contextfs build --target <file> |
Update one file's summary |
contextfs build --mock |
Use mock summarizer (no API key needed) |
contextfs query "<topic>" |
Search summaries for files matching a topic |
contextfs demo <file> |
Preview what a summary looks like |
contextfs init |
Set up ContextFS rules in a new project |
contextfs context-files |
Summarize context/*.md files into .summary sidecars |
contextfs compact |
Compact current session transcript into a structured summary |
contextfs compact --session-id <id> --transcript-path <path> --project <path> |
Compact a specific session |
contextfs session-resume |
Print previous session summary (for hook integration) |
contextfs mcp |
Start MCP server over stdio (for AI tool integration) |
contextfs install |
Auto-detect editors and install integrations |
# 1. Install
curl -fsSL https://raw.githubusercontent.com/nanaubusiness/contextfs/main/install.sh | sh
# 2. Connect your editor (Claude Code, Cursor, Codex, or VS Code)
contextfs install
# 3. Summarize your codebase
contextfs build
# 4. Ask AI about your code
contextfs query "authentication"
# → Returns ranked file matches with summaries
# 5. Done — summaries update automatically on every file saveContextFS maintains automatic session continuity with Claude Code:
- At ~65% context: PreCompact hook fires →
contextfs compactwrites session summary to~/.claude/sessions/summaries/<project-slug>/latest.json - On next session start: SessionStart hook fires →
contextfs session-resumereads the summary and injects it as context
The summary includes:
- What was accomplished
- Decisions made
- Open questions
- Next steps
- Files discussed
- Projects affected
No manual steps required. It just works.
- Run
contextfs buildonce — Claude Opus 4.7 summarizes every file - Summaries are written as
.summarysidecar files - On Claude Code: the MCP server intercepts file reads and returns
.summarycontent - On other editors: use
contextfs queryto search summaries; summaries auto-update on save
contextfs context-files summarizes context/*.md files (e.g. me.md, work.md, team.md) into .summary sidecars. Run after updating any context file.
The PreCompact hook in Claude Code fires at ~65% context automatically. It runs contextfs compact which:
- Reads the session transcript from the path provided by the PreCompact hook
- Extracts user/assistant messages
- Generates a structured summary via Claude Opus 4.7
- Writes to
~/.claude/sessions/summaries/<project-slug>/latest.json
The SessionStart hook reads this file on the next launch and injects it as context.
Each .summary file is plain text:
Purpose: Handles user authentication and session management
Exports: login, logout, verifyToken, refreshSession
Dependencies: bcrypt, jsonwebtoken, ./db/user.repository
Core logic:
- login
- logout
- verifyToken
- refreshToken
Risk: high
hash: abc123def456
| Type | Extensions | Notes |
|---|---|---|
| TypeScript | .ts, .tsx |
Full summarization |
| JavaScript | .js, .jsx |
Full summarization |
| Python | .py |
Full summarization |
| Markdown | .md |
Structure + links parsed |
Skipped: JSON, YAML, HTML, CSS (already compact or prose).
Tested on 1,995 production code files with Claude Opus 4.7.
| Metric | Value |
|---|---|
| Token savings | ~81% |
| Summary quality | High — every summary covers purpose, exports, dependencies, and risk |
Raw file (TypeScript): ~690 tokens
ContextFS summary: ~130 tokens
Savings: ~81% fewer tokens
The MCP server (contextfs mcp) intercepts every file read and returns .summary content when available. Raw file access requires user approval for files without summaries — this prevents AI from silently reading thousands of tokens when it could have used a 130-token summary.
Tools exposed via MCP:
contextfs_read_file— read with summary preferencecontextfs_query— search summaries by topiccontextfs_mcp_compact_session— trigger session compactioncontextfs_mcp_get_session_summary— get previous session summary
| Editor | Integration | Auto-update |
|---|---|---|
| Claude Code | MCP server + PreCompact/SessionStart hooks | Yes |
| Cursor | MCP server | Yes |
| Codex | MCP server | Yes |
| VS Code | MCP server | Yes |
MIT