claudecode-rlm
Unlimited context for Claude Code - Knowledge graph-based context storage with surgical precision code analysis.
Author: Michael Thornton (tekcin@yahoo.com) Repository: https://github.com/tekcin/claudecode-rlm
Features
- TRUE Unlimited Context - Proxy server auto-stores ALL conversations, auto-injects relevant context
- Surgical Precision - Deep code analysis for function, class, and symbol-level understanding
- Live File Tracking - Real-time monitoring of code changes with automatic re-analysis
- Repository Loading - Bulk load entire codebases into the knowledge graph
- Web Console - Full management GUI with file browser, symbol explorer, and graph visualizer
- Docker Ready - Production-ready containerization with Nginx reverse proxy
- Knowledge Graph - Hierarchical storage (Document → Section → Chunk → Entity → Symbol)
- 74x Faster Reads - LRU cache with inverted index
- Entity Extraction - Automatic extraction of code elements, files, concepts
- Multi-Language Support - TypeScript, JavaScript, Python, Go, Rust
Quick Start (30 seconds)
# 1. Install and setup
git clone https://github.com/tekcin/claudecode-rlm.git
cd claudecode-rlm
npm install && npm run build && npm run setup
# 2. Start proxy (keep running)
npm run proxy
# 3. Open NEW terminal and use Claude Code
claude
That's it! Works with Claude Max subscription (no API key needed) or API key.
Web Console
Open http://localhost:3456/web to browse files, symbols, and the knowledge graph.
Alternative: Docker
git clone https://github.com/tekcin/claudecode-rlm.git
cd claudecode-rlm
docker-compose up -d
Alternative: Global Install
npm install -g claudecode-rlm
claudecode-rlm-proxy
Proxy Mode (Recommended)
The proxy server intercepts ALL API calls for complete automatic context:
1. Start the proxy
claudecode-rlm-proxy
2. Configure Claude Code
export ANTHROPIC_BASE_URL=http://localhost:3456
What happens automatically:
- Every user message → Stored in knowledge graph
- Every assistant response → Stored in knowledge graph
- Before each request → Relevant past context injected
- Streaming supported → Works with Claude Code's streaming
- Live tracking → Auto-watches your working directory
Web Console
Access the full management console at http://localhost:3456/web
Features
| Page | Description |
|---|---|
| Dashboard | Overview with stats, node charts, loading progress |
| File Browser | Tree view of tracked files with Monaco Editor |
| Symbol Explorer | Search symbols, view usages and call hierarchy |
| Graph Visualizer | Interactive vis-network graph visualization |
| Upload Manager | Drag-drop file upload and repository loading |
| Live Monitor | Real-time file change tracking |
| Settings | Server status and graph management |
Building the Web Console
cd web
npm install
npm run build
Repository Loading
Load entire codebases into the knowledge graph:
Via Web Console
- Open
http://localhost:3456/web - Go to Upload Manager
- Enter repository path and file patterns
- Click Load Repository
Via API
curl -X POST http://localhost:3456/repo/load \
-H "Content-Type: application/json" \
-d '{
"rootDir": "/path/to/repo",
"patterns": ["**/*.ts", "**/*.js", "**/*.py"]
}'
Via CLI Menu
claudecode-rlm-menu
Surgical Precision Code Analysis
Get precise code context for surgical edits:
Find Symbol
curl "http://localhost:3456/code/symbol?name=processRequest"
Get Context at Location
curl "http://localhost:3456/code/context?file=src/index.ts&line=42"
Find All Usages
curl "http://localhost:3456/code/usages?name=GraphStorage"
Get Call Hierarchy
curl "http://localhost:3456/code/callers?name=ingestFile&direction=both"
Live File Tracking
Real-time monitoring of code changes:
Start Watching
curl -X POST http://localhost:3456/live/start \
-H "Content-Type: application/json" \
-d '{"rootDir": "/path/to/watch"}'
Get Live File Content
curl "http://localhost:3456/live/content?path=src/index.ts"
Subscribe to Changes (SSE)
curl http://localhost:3456/live/updates
Docker Deployment
Basic Deployment
docker-compose up -d
Production with Nginx + SSL
docker-compose -f docker-compose.prod.yml up -d
Development with Hot Reload
docker-compose -f docker-compose.dev.yml up
See DOCKER.md for full deployment guide.
API Reference
Proxy Endpoints
| Endpoint | Method | Description |
|---|---|---|
/v1/messages | POST | Anthropic API proxy with context injection |
Repository Endpoints
| Endpoint | Method | Description |
|---|---|---|
/repo/load | POST | Start loading repository |
/repo/status | GET | Get loading progress |
/repo/progress | GET | SSE stream for real-time progress |
/repo/cancel | POST | Cancel current load |
/repo/clear | POST | Clear session memory |
Code Context Endpoints
| Endpoint | Method | Description |
|---|---|---|
/code/symbol?name=X | GET | Find symbol by name |
/code/context?file=X&line=N | GET | Get precise context |
/code/usages?name=X | GET | Find all usages |
/code/callers?name=X | GET | Get call hierarchy |
/code/source?name=X | GET | Get symbol source code |
/code/search?pattern=X | GET | Search symbols |
/code/imports?file=X | GET | Get import graph |
Live File Endpoints
| Endpoint | Method | Description |
|---|---|---|
/live/start | POST | Start watching directory |
/live/stop | POST | Stop watching |
/live/status | GET | Get watcher status |
/live/files | GET | List tracked files |
/live/file?path=X | GET | Get file with analysis |
/live/content?path=X | GET | Get raw file content |
/live/updates | GET | SSE stream for file changes |
Upload Endpoints
| Endpoint | Method | Description |
|---|---|---|
/upload/files | POST | Upload files (multipart) |
/upload/url | POST | Download from URL |
Graph API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/graph_stats | GET | Get graph statistics |
/api/graph_query | POST | Query the graph |
/api/list_entities | POST | List entities by type |
MCP Mode
For manual control via MCP tools:
Add to Claude Code config
{
"mcpServers": {
"claudecode-rlm": {
"command": "claudecode-rlm"
}
}
}
Available Tools
| Tool | Description |
|---|---|
memory_auto | Store AND retrieve context in one call |
memory_store | Store content in knowledge graph |
memory_search | Search with recency weighting |
graph_query | Query graph (search/entity/expand/path) |
list_entities | List tracked entities |
graph_stats | Get storage statistics |
Architecture
Knowledge Graph Structure
Document (conversation turn)
├── Section (topic/header group)
│ ├── Chunk (~300 chars, searchable)
│ │ ├── Entity (function name)
│ │ ├── Entity (file path)
│ │ └── Entity (concept)
│ └── Chunk
│ └── [FOLLOWS] → next chunk
├── File (source code file)
│ ├── Symbol (function/class/method)
│ │ ├── [CALLS] → Symbol
│ │ ├── [REFERENCES] → Symbol
│ │ └── [CONTAINS] → Symbol
│ └── Import
│ └── [IMPORTS] → File
└── Section
Node Types
| Type | Description |
|---|---|
document | Conversation turn container |
section | Topic group |
chunk | Searchable text segment |
entity | Extracted concept/reference |
file | Source code file |
symbol | Function, class, method, etc. |
import | Import statement |
Relationship Types
| Type | Description |
|---|---|
HAS_SECTION | Document → Section |
HAS_CHUNK | Section → Chunk |
MENTIONS | Chunk → Entity |
FOLLOWS | Chunk → next Chunk |
DEFINES | File → Symbol |
CALLS | Symbol → Symbol |
REFERENCES | Symbol → Symbol |
IMPORTS | File → File |
EXTENDS | Class → Class |
IMPLEMENTS | Class → Interface |
Storage Location
.claudecode-rlm/graph/{sessionID}/
├── nodes/*.json - Content nodes
├── edges/*.json - Relationships
└── indexes/*.json - Search indexes
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
CLAUDECODE_RLM_PROXY_PORT | 3456 | Proxy server port |
CLAUDECODE_RLM_WORKDIR | ./ | Storage directory |
CLAUDECODE_RLM_SESSION | auto | Session ID |
CLAUDECODE_RLM_MAX_INJECT | 2000 | Max tokens to inject |
CLAUDECODE_RLM_UPLOAD_DIR | ./uploads | Upload directory |
ANTHROPIC_API_KEY | - | Your Anthropic API key |
ANTHROPIC_REAL_URL | https://api.anthropic.com | Target API URL |
Performance
| Operation | Basic | Optimized | Speedup |
|---|---|---|---|
| Node reads | 21.3µs | 0.3µs | 74x |
| Get by type | 1.1ms | 21µs | 54x |
| Bulk insert | 6.07s | 1.21s | 5x |
Development
# Install dependencies
npm install
# Build TypeScript
npm run build
# Build web console
cd web && npm install && npm run build && cd ..
# Start MCP server
npm start
# Start proxy server
npm run proxy
# Start with Docker
npm run docker:up
License
MIT
Author
Michael Thornton
- Email: tekcin@yahoo.com
- GitHub: @tekcin