engramdev
v0.1.0
Published
Your AI coding tool has amnesia. EngramDev gives it long-term memory.
Downloads
138
Maintainers
Readme
EngramDev
Your AI coding assistant forgets everything between sessions. EngramDev remembers.
EngramDev is an open-source MCP server that learns your coding patterns and serves them to AI tools like Claude Code and Cursor - so they stop regenerating what they already know.
npx engramdev initThe Problem
Every time you start a new AI coding session:
- Your AI regenerates the same component structure it built yesterday
- It burns tokens re-learning your project conventions
- It ignores patterns that are already established in your codebase
- You paste the same context over and over
You're paying for the AI to re-learn what it already figured out.
How EngramDev Works
Your request ──> EngramDev ──> AI Tool
│
┌──────────┼──────────┐
▼ ▼ ▼
Known Pattern Similar Novel Task
(0 tokens) Pattern (full LLM)
│ (small prompt) │
▼ ▼ ▼
Serve template "Adapt Generate
directly this" from scratchEngramDev sits between you and your AI coding tool as an MCP server. It:
- Indexes your project's recurring patterns (components, routes, tests, configs)
- Classifies each coding request against known patterns
- Serves matching templates locally (zero tokens) or as adaptation hints (minimal tokens)
- Routes only truly novel tasks to the LLM
Quick Start
1. Install
npm install -g engramdev2. Initialize in your project
cd your-project
engramdev initThis scans your codebase and creates a .engramdev/ directory with indexed patterns.
3. Connect to Claude Code
Add to your Claude Code MCP config (~/.claude/settings.json):
{
"mcpServers": {
"engramdev": {
"command": "engramdev",
"args": ["serve"]
}
}
}4. Start coding
EngramDev automatically intercepts requests and serves known patterns. No workflow changes needed.
Token Savings
Real measurements from a production React + Node.js project (250+ modules):
| Task Type | Without EngramDev | With EngramDev | Savings | |-----------|---------------------|-------------------|---------| | New React component | ~2,400 tokens | ~400 tokens | 83% | | API route handler | ~1,800 tokens | ~300 tokens | 83% | | Test file | ~2,000 tokens | ~250 tokens | 87% | | Config change | ~800 tokens | ~0 tokens | 100% | | Novel algorithm | ~3,500 tokens | ~3,500 tokens | 0% |
Average across mixed workload: 50-70% token reduction
Features
Pattern Indexing
Automatically extracts patterns from your codebase:
- Component structures and prop patterns
- API route handlers and middleware chains
- Test file structures and assertion patterns
- Configuration files and build setups
- Import patterns and module organization
Smart Classification
Three-tier routing with local-first approach:
- Exact match - serve template directly, zero LLM tokens
- Partial match - serve template + "adapt for X" prompt, minimal tokens
- No match - pass through to LLM normally
MCP Native
Works with any MCP-compatible AI tool:
- Claude Code (CLI + IDE extensions)
- Cursor
- Any future MCP client
Pattern Learning
engramdev learn # Re-index patterns from codebase
engramdev learn --from-git # Learn from git history (last 100 commits)
engramdev learn --watch # Watch for new patterns continuouslyToken Dashboard
engramdev stats
Requests today: 47
Served from cache: 31 (66%)
Partial matches: 9 (19%)
Passed to LLM: 7 (15%)
Tokens saved: ~42,300
Est. cost saved: $0.63Team Patterns (Shared)
engramdev export > team-patterns.json # Share with team
engramdev import team-patterns.json # Import team patternsArchitecture
engramdev/
├── core/ # Pattern engine
│ ├── indexer.js # Extracts patterns from codebase
│ ├── classifier.js # Classifies requests against patterns
│ ├── matcher.js # Pattern matching algorithms
│ └── store.js # Pattern storage (SQLite default)
├── mcp/ # MCP server
│ ├── server.js # MCP protocol handler
│ ├── tools.js # MCP tool definitions
│ └── middleware.js # Request interception
├── cli/ # CLI commands
│ ├── init.js # Project initialization
│ ├── learn.js # Pattern learning
│ ├── serve.js # Start MCP server
│ └── stats.js # Token savings dashboard
├── adapters/ # Storage backends
│ ├── sqlite.js # Default local storage
│ ├── json.js # Simple JSON file storage
│ └── redis.js # Team/shared storage
└── plugins/ # Extensibility
├── react.js # React pattern extractors
├── express.js # Express/Node pattern extractors
├── testing.js # Test pattern extractors
└── custom.js # User-defined extractorsMCP Tools Exposed
EngramDev exposes these tools to your AI coding assistant:
suggest_pattern
Called before code generation. Returns matching patterns if found.
{
"name": "suggest_pattern",
"description": "Check if a known pattern exists for this coding task",
"input": {
"task": "Create a new React component for user profile",
"context": { "framework": "react", "directory": "src/components" }
},
"output": {
"match": "exact",
"pattern": "react-component-with-props",
"template": "// ... full template ...",
"confidence": 0.94,
"tokens_saved": 2100
}
}learn_pattern
Called after code generation to index new patterns.
{
"name": "learn_pattern",
"description": "Index a newly generated code pattern for future reuse",
"input": {
"code": "// ... generated code ...",
"tags": ["react", "component", "form"],
"description": "Form component with validation"
}
}get_stats
Returns token savings metrics.
Configuration
.engramdev/config.json:
{
"store": "sqlite",
"patterns": {
"minConfidence": 0.8,
"maxAge": "30d",
"autoLearn": true
},
"ignore": [
"node_modules",
"dist",
".env*"
],
"plugins": ["react", "express", "testing"],
"stats": {
"enabled": true,
"tokenCostPerMillion": 3.0
}
}Plugin System
Create custom pattern extractors for your stack:
// plugins/my-stack.js
export default {
name: 'my-stack',
// Define what files to scan
glob: 'src/**/*.{ts,tsx}',
// Extract patterns from each file
extract(file, content) {
const patterns = [];
// Your extraction logic
if (content.includes('export default function') && content.includes('useState')) {
patterns.push({
id: `component-${file.name}`,
type: 'react-stateful-component',
template: content,
tags: ['react', 'component', 'stateful']
});
}
return patterns;
}
};Comparison
| Feature | EngramDev | CLAUDE.md | Cursor Rules | Pieces.app | Cody | |---------|-------------|-----------|-------------|------------|------| | Auto-learns patterns | Yes | No | No | No | No | | Routes locally vs LLM | Yes | No | No | No | No | | Token savings tracking | Yes | No | No | No | No | | MCP native | Yes | N/A | No | No | No | | Open source | Yes | N/A | No | Partial | Yes | | Team sharing | Yes | Git | Git | Yes | Yes | | Zero config start | Yes | Manual | Manual | Manual | Yes |
Roadmap
v0.1 - Foundation (Current)
- [x] Core pattern indexer
- [x] SQLite pattern store
- [x] MCP server with
suggest_patterntool - [x] CLI: init, learn, serve
- [ ] React + Express plugins
- [ ] Basic token stats
v0.2 - Intelligence
- [ ] Git history learning
- [ ] Confidence scoring improvements
- [ ] Pattern decay (stale patterns auto-expire)
- [ ] Watch mode for continuous learning
v0.3 - Teams
- [ ] Export/import pattern sets
- [ ] Redis adapter for shared storage
- [ ] Team dashboard (web UI)
- [ ] Pattern conflict detection
v0.4 - Ecosystem
- [ ] Cursor integration guide
- [ ] VS Code extension
- [ ] GitHub Action for CI pattern indexing
- [ ] Community pattern marketplace
v1.0 - Production
- [ ] Enterprise features (SSO, audit logs)
- [ ] Hosted cloud option
- [ ] Pattern analytics and insights
- [ ] Multi-language support (Python, Go, Rust extractors)
Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
Key areas where help is needed:
- Language plugins - extractors for Python, Go, Rust, Java ecosystems
- Pattern algorithms - better matching and classification approaches
- Benchmarks - real-world token savings measurements across different project types
- Documentation - tutorials, guides, and examples
Philosophy
- Local first - your code patterns never leave your machine unless you choose to share them
- Zero lock-in - works with any MCP client, patterns are portable JSON
- Additive, not invasive - no changes to your workflow, no wrapper scripts, just an MCP server
- Honest metrics - we show real savings, including when we can't help (novel tasks)
License
MIT
Built by developers who got tired of watching their AI assistant forget everything between sessions.
