@pissmaa/contextforge
v0.1.6
Published
Headless Context Graph Engine for AI coding agents. Never let your AI forget your architecture again.
Maintainers
Readme
ContextForge 🚀
Give your AI coding agent architectural memory.
ContextForge builds a living knowledge graph of your full-stack application so AI agents can understand your architecture before they modify your code.
Why ContextForge?
Modern AI coding agents are excellent at generating code.
They are not good at understanding your application's architecture.
Imagine asking an AI to rename a Prisma model, modify an Express route, or refactor a React component.
Without understanding the relationships between your frontend, backend, and database, the AI may unknowingly break dozens of files.
ContextForge solves this problem by creating a living architectural knowledge graph of your project.
Instead of guessing, your AI agent can query the graph to understand exactly what depends on what before making any changes.
What ContextForge Does
ContextForge analyzes your project and builds a local graph containing relationships between every major part of your application.
React Component
│
│ calls_api
▼
Express Route
│
│ depends_on
▼
Prisma ModelYour AI agent can then ask questions like:
- What components call this API?
- Which routes depend on this model?
- What will break if this field changes?
- What files are affected by this refactor?
- Which parts of the application depend on this database table?
Instead of searching hundreds of files, the AI receives a precise dependency graph in milliseconds.
Features
✅ Prisma Schema Parser
- Parses models
- Parses fields
- Parses enums
- Detects one-to-one, one-to-many and many-to-many relationships
✅ Express Route Parser
- Detects API endpoints
- Maps routes to business logic
- Connects routes to database models
✅ React Parser
- Parses React components
- Detects Axios requests
- Detects custom Axios instances
- Maps frontend requests to backend routes
✅ Knowledge Graph Engine
- Local SQLite database
- Stores Nodes and Relationships
- Extremely fast graph lookups
- No cloud dependency
✅ REST Query API
Query your architecture using HTTP.
Perfect for:
- Claude Code
- Cursor
- Cline
- Roo Code
- OpenHands
- Codex
- Gemini CLI
- Any AI coding agent
Why Not RAG?
Traditional RAG systems index files.
ContextForge indexes architecture.
| Capability | Traditional RAG | ContextForge | | ------------------------ | --------------- | ------------ | | Search source code | ✅ | ✅ | | Understand relationships | ❌ | ✅ | | Dependency analysis | ❌ | ✅ | | Architecture awareness | ❌ | ✅ | | Local knowledge graph | ❌ | ✅ | | AI agent integration | ⚠️ | ✅ |
ContextForge doesn't replace RAG.
It complements it.
Use RAG to retrieve code.
Use ContextForge to understand architecture.
Installation
Install globally:
npm install -g @pissmaa/contextforgeOr install inside your project:
npm install @pissmaa/contextforgeQuick Start
1. Build the Knowledge Graph
contextforge extract \
--schema ./apps/api/prisma/schema.prisma \
--app ./apps/api/src/app.ts \
--frontend ./apps/web/srcOutput:
Scanning Prisma schema...
✓ 12 models
✓ 26 relationships
Scanning Express...
✓ 41 routes
Scanning React...
✓ 83 components
✓ 56 API calls
Building Knowledge Graph...
✓ 218 nodes
✓ 347 edges
Saved to:
contextforge.db2. Start the Query Engine
contextforge serveOutput:
ContextForge Query Engine
Database:
./contextforge.db
Listening on:
http://localhost:40013. Query the Graph
List every node:
curl http://localhost:4001/api/nodesGet complete dependency context:
curl "http://localhost:4001/api/context?node_id=prisma:model:User"Example response:
{
"target_node": {
"id": "prisma:model:User",
"type": "PrismaModel",
"name": "User"
},
"dependencies": [],
"dependents": [
{
"id": "api:route:GET:/me",
"relation": "depends_on"
},
{
"id": "react:component:AuthProvider",
"relation": "calls_api"
}
]
}AI Agent Integration
Before modifying code, instruct your AI agent to query ContextForge.
Example workflow:
User
↓
Rename User.id
↓
AI Agent
↓
Query ContextForge
↓
Analyze Dependencies
↓
Generate Impact Report
↓
Safely Modify Code
↓
DoneExample prompt for your AI agent:
# ContextForge Agent Protocol
You have access to ContextForge.
Never guess architectural relationships.
Whenever you modify:
- Prisma models
- Database schema
- API routes
- React components
Always:
1. Identify the target node.
2. Query ContextForge.
3. Analyze dependencies.
4. Produce an impact report.
5. Modify every affected file.
Never skip dependency analysis.CLI Reference
Extract
contextforge extract| Option | Description | Default |
| ------------ | ---------------------- | ------------------- |
| --schema | Prisma schema | ./schema.prisma |
| --app | Express entry file | ./app.ts |
| --frontend | React source directory | — |
| --db | SQLite database | ./contextforge.db |
Serve
contextforge serve| Option | Description | Default |
| -------- | ---------------- | ------------------- |
| --port | HTTP server port | 4001 |
| --db | SQLite database | ./contextforge.db |
Architecture
Your Project
Prisma Express React
│ │ │
└──────┬─────┴───────────┘
│
▼
contextforge extract
│
▼
SQLite Knowledge Graph
│
▼
contextforge serve
│
REST Query Engine
│
▼
AI Coding AgentRoadmap
Core Engine
- [x] Prisma parser
- [x] Express parser
- [x] React parser
- [x] Axios request mapping
- [x] SQLite knowledge graph
- [x] REST query engine
Next Releases
- [ ] TypeScript interface extraction
- [ ] Next.js App Router support
- [ ] NestJS support
- [ ] Fastify support
- [ ] Drizzle ORM support
- [ ] OpenAPI / Swagger importer
- [ ] GraphQL resolver extraction
- [ ] File watcher mode
- [ ] Incremental graph updates
- [ ] Model Context Protocol (MCP) server
- [ ] VS Code extension
- [ ] Dependency visualization UI
Contributing
Contributions are welcome.
Whether you're fixing bugs, improving parsers, adding framework support, or enhancing AI integrations, every contribution helps make ContextForge a better architectural companion for AI-assisted development.
License
MIT License
ContextForge gives AI coding agents something they never had before: architectural memory.
Build once. Query forever.
