What It Does — Semantic Graph Context Management
Codex-CLI-Compact (also called Dual Graph) is a local context engine that sits between you and Claude Code. Instead of letting Claude explore your codebase through expensive tool calls, it builds a semantic graph of your entire project first—extracting files, functions, classes, and import relationships. When you ask a question, the graph identifies the most relevant files and packs them into the prompt before Claude even sees it.
Why It Works — Token Economics and Local Processing
The magic happens in three stages:
- Project scanning:
dgc /path/to/projectscans your codebase and builds a local graph stored in<project>/.dual-graph/(automatically gitignored) - Context pre-loading: For each prompt, the graph ranks relevant files based on semantic relationships and includes them upfront
- Session memory: Files you've read or edited are prioritized in future turns, creating compounding token savings across a session
All processing is local—no code leaves your machine. The tool supports TypeScript, JavaScript, Python, Go, Swift, Rust, Java, Kotlin, C#, Ruby, and PHP.
How To Install and Use It — Commands That Save Tokens
Installation (macOS/Linux):
curl -sSL https://raw.githubusercontent.com/kunal12203/Codex-CLI-Compact/main/install.sh | bash
source ~/.zshrc # or ~/.bashrc / ~/.profile
Installation (Windows PowerShell):
irm https://raw.githubusercontent.com/kunal12203/Codex-CLI-Compact/main/install.ps1 | iex
Basic usage:
dgc . # Scan current directory and launch Claude
dgc /path/to/project # Scan specific project
dgc . "fix the login bug" # Start with initial prompt
For Codex CLI users: Replace dgc with dg in all commands.
MCP Integration — Graph-Aware Tool Calls
When Claude needs to explore beyond the pre-loaded context, it can use graph-aware MCP tools:
graph_read: Read specific files with graph contextgraph_retrieve: Retrieve related code based on graph connectionsgraph_neighbors: Find symbol relationships in the graph
These tools maintain the efficiency gains while allowing deep exploration when needed.
Benchmarks and Real-World Impact
The developer benchmarked across 80+ prompts at 5 complexity levels on a real-world full-stack app. Results:
- Cost wins on 16 out of 20 prompts (80% success rate)
- Quality equal or better on all complexity levels
- 30-45% token reduction on average
These savings compound—each turn gets cheaper as the graph learns which files are relevant to your current task.
Configuration Options — Fine-Tune Your Workflow
All configuration is optional via environment variables:
- Session continuity: Decisions, tasks, and facts persist in
.dual-graph/context-store.jsonand re-inject at next session start - Global settings in
~/.dual-graph/ - Project-specific graphs in each project's
.dual-graph/directory
When This Shines — Specific Use Cases
- Large refactoring tasks: The graph understands cross-file dependencies
- Bug hunting across modules: Semantic connections help identify related code
- Multi-session projects: Context memory reduces repetition
- Cost-sensitive development: Direct token savings translate to budget efficiency
This follows Claude Code's architecture built on Model Context Protocol (MCP), which we covered on March 30th—the graph tools integrate seamlessly with Claude's existing tool-calling infrastructure.





