Grafema is a graph-based static analysis tool whose goal is to transform a codebase, along with the infrastructure, knowledge, and processes surrounding it, into a unified queryable graph for use by humans and AI. Its starting point is that code is essentially not text, but an executable graph structure; what truly matters is the structure of the system in the developer's mind—entities, invariants, constraints, goals and purposes, and the relationships among these things. Grafema uses compiler-grade AST parsers (containing knowledge accumulated over many years by various language communities) to dig as deeply as possible into the system model and transform it into a transparent, queryable, extensible map that provides a basis for understanding the system.
Main capabilities:
- Call graph: trace who calls whom across files.
- Data flow: trace values forward and backward from source to sink.
- Control flow: CFG, reachability, branch paths.
- Data shapes: infer object structure through assignment chains.
- Effect propagation: transitive side-effect analysis through the call graph.
- Symbolic execution.
- Cross-language and cross-process: service boundaries, message passing, remote calls.
- Planned (marked as ⏳): side-effect chain analysis, inter-service contracts (message queue patterns, API patterns: OpenAPI, JSON Schema, gRPC), infrastructure as code (Terraform, Kubernetes, Docker), Git integration (blame, churn, author attribution), code quality metrics (complexity, coupling, hotspots).
Usage:
- Command line: grafema --quickstart automatically detects the project language, generates configuration, and builds the graph; a two-step process can also be used: grafema init (review configuration) → grafema analyze.
- CLI commands include: tldr, who, wtf, why, check, overview.
- Combined with AI (MCP): add configuration in .mcp.json in the project root directory to provide 30+ (otherwise stated as 40+) MCP tools, such as find_nodes, find_calls, trace_dataflow, get_file_overview, describe, query_graph, etc. AI agents work by querying the graph rather than reading files, which is faster, cheaper, and more complete. A single call to find_nodes can return rich context such as callers, members, parent nodes, import/call counts, and uses local embeddings for fuzzy name matching (for example, querying " PtyHostHeartbeatService can find HeartbeatService). There is also a Docker image for running the MCP server (stdio) in a container: docker run -i --rm -v "$PWD":/workspace grafema-mcp.
- Query and API: Supports Datalog custom structural queries, the Cypher query language, and a programming API (@grafema/util).
- Visualization and editor: Provides the HexAtlas visual code map (2D/3D) and a VS Code extension (installable from the VS Code Marketplace or by searching for "Grafema Explore"). Extension features include: Cmd+Shift+G to find the graph node at the cursor, Value Trace to view data origins and flow, Callers to view all call sites of the function at the cursor, Blast Radius impact analysis (what a change will break), Nodes in File to list all graph nodes in the current file and their locations, and Explorer for interactively browsing incoming/outgoing edges.
- Export: grafema export --as docs-md generates readable documentation from the live graph; --as openapi-3.1 automatically generates OpenAPI for HTTP routes; --as mcp-schema generates a JSON-RPC tool registry that can be served directly by any MCP runtime; --as json-schema generates a Draft 2020-12 schema for each FEATURE.
- Intent and knowledge: Intent sidecars (_ai/intents/...) supplement automatically generated output with handwritten "when to use" notes and captured examples; grafema features --duplicates performs cross-modal deduplication (for example, which CLI commands and which MCP tools are wrappers around the same library function). The knowledge base can link decisions and ADRs to code nodes and flows; Effects-DB & Registry is a curated database of side-effect and contract mappings for popular third-party packages in ecosystems such as npm and PyPI.
- Rules and extensions: Architectural invariants can be written as Datalog rules; grafema check can serve as CI gate enforcement. Supports custom node types and edges via plugins; library callback enhancers can automatically detect MCP tools and CLI commands; can generate an API surface inventory with side-effect annotations.
Language support: JS/TS is the primary language, with full data flow support. Each language uses its community's canonical parser rather than a generic tokenizer. grafema init includes all languages by default, and analyzers for missing languages are skipped.
Performance and architecture: Grafema uses a Rust orchestrator, language-specific analyzers written in Haskell, and a self-developed columnar graph database (RFDB). RFDB is optimized for code analysis workloads, featuring deferred indexing, L1 compression, edge types and name-based indexing, and includes a local embedding index for fuzzy name search (e.g., PtyHostHeartbeatService can match HeartbeatService), with automatic segment reclamation after compaction. The orchestrator is a Rust binary that coordinates cross-language discovery, parsing, RFDB writes, and resolution, using a streaming pipeline to release AST memory after writes. Analyzers are separate binaries per language (Haskell plus necessary native parsers: libclang for ObjC, tree-sitter for C/C++, SwiftSyntax for Swift), run as a daemon pool, and communicate via a JSON-over-stdio protocol. The MCP server provides 30+ tools for AI agent integration.
AI agent accuracy (Autoresearch): The methodology selects 30 issues from real VS Code GitHub issues, scored by an LLM judge, with issues covering Sillito's taxonomy from L1 (finding the focus) to L4 (full architectural understanding). Each issue is run as an independent claude -p session with no prior context. Grafema has the greatest advantage on L4 architecture questions and debugging/tracing (up to +4 points per issue), where structured graph queries outperform text search; for simple L1 lookups ("Where is X?"), grep is usually sufficient. The evaluation tool captures the full tool interaction trace, including MCP tool results, reasoning chains, and fallback patterns; see the methodology and raw data in autoresearch/.
Environment variables: Usually not needed—the binaries are already included in the npm package; only used when developing Grafema or using a custom build. Platform support: macOS (ARM or Intel) or Linux (x64 or ARM64).
License and status: v0.4.1 — early access. Licensed under FSL-1.1-Apache-2.0, free to use, source-available, converting to Apache 2.0 after two years (see LICENSING.md for details). Author Vadim Reshetnikov is a senior R&D engineer with 6+ years of experience in large legacy untyped codebases and high-load, high-performance backends. He developed Grafema to combat cognitive complexity in software development and maintenance; his motivation stems from a real pain point: according to research, engineers spend 58% of their time on code comprehension, and there is a lack of tools that can truly understand code structure at scale—type systems help, but only for typed languages, and Grafema fills the gap for the rest. Related links: LinkedIn: linkedin.com/in/disentinel; Telegram: @vadresh (dev logs, research notes, behind-the-scenes content).
Note: The material does not provide specific charging methods, prices, system requirements beyond platform support, or detailed usage steps; content not mentioned above is not provided for now.