Claude Code에서 컨텍스트를 50%까지 줄이는 그래프 기반 코드 검색

hackernews | | 📦 오픈소스
#claude #claude code #비용 절감 #시맨틱 그래프 #컨텍스트 최적화 #코드 검색
원문 출처: hackernews · Genesis Park에서 요약 및 분석

요약

듀얼 그래프(Dual-Graph) 기반의 컨텍스트 엔진은 클로드 코드(Claude Code) 및 코덱스 CLI(Codex CLI) 환경에서 코드베이스의 의미론적 그래프를 구축해 프롬프트에 적합한 파일을 자동으로 로드합니다. 80개 이상의 실제 앱 테스트 벤치마크 결과, 이 엔진을 적용했을 때 프롬프트당 평균 비용이 0.46달러에서 0.27달러로 약 40% 감소했으며, 평균 응답 시간과 턴 수는 줄어든 반면 품질 점수는 87.1점으로 향상되었습니다. TS, 파이썬 등 다양한 언어를 지원하며 세션 간 작업 기억과 로컬 데이터 처리 기능을 제공하는 이 도구는 현재 macOS, 리눅스, 윈도우 환경에서 설치 스크립트를 통해 사용할 수 있습니다.

본문

A context engine that makes Claude Code and Codex CLI 30-45% cheaper without sacrificing quality. It builds a semantic graph of your codebase and pre-loads the right files into every prompt — so Claude spends tokens reasoning, not exploring. Works on macOS, Linux, and Windows. Supports any project size. Supports TypeScript, JavaScript, Python, Go, Swift, Rust, Java, Kotlin, C#, Ruby, and PHP. Join the community: discord.gg/ptyr7KJz You run: dgc /path/to/project ↓ 1. Project scanned → semantic graph built (files, symbols, imports) 2. You ask a question 3. Graph identifies the relevant files → packs them into context 4. Claude gets your question + the right code already loaded 5. Fewer turns, fewer tokens, better answers Token savings compound across a session. The graph remembers which files were read, edited, and queried — each turn gets cheaper. Benchmarked across 80+ prompts (5 complexity levels) on a real-world full-stack app: | Metric | Without Dual-Graph | With Dual-Graph | |---|---|---| | Avg cost per prompt | $0.46 | $0.27 | | Avg turns | 16.8 | 10.3 | | Avg response time | 186s | 134s | | Quality (regex scorer) | 82.7/100 | 87.1/100 | Cost wins on 16 out of 20 prompts. Quality equal or better on all complexity levels. macOS / Linux: curl -sSL https://raw.githubusercontent.com/kunal12203/Codex-CLI-Compact/main/install.sh | bash source ~/.zshrc # or ~/.bashrc / ~/.profile Windows (PowerShell): irm https://raw.githubusercontent.com/kunal12203/Codex-CLI-Compact/main/install.ps1 | iex Windows (Scoop): scoop bucket add dual-graph https://github.com/kunal12203/scoop-dual-graph scoop install dual-graph Prerequisites: Python 3.10+, Node.js 18+, Claude Code or Codex CLI. The installer detects missing tools and offers to install them via winget (Windows) or homebrew (macOS). dgc # scan current directory, launch Claude dgc /path/to/project # scan a specific project dgc /path/to/project "fix the login bug" # start with a prompt dg # scan current directory, launch Codex dg /path/to/project # scan a specific project dg /path/to/project "add tests" # start with a prompt dgc . # from inside the project directory dgc "D:\projects\my-app" # any drive, any path dg "C:\work\backend" # Codex CLI - Scans your project — extracts files, functions, classes, import relationships into a local graph. Supports TS/JS, Python, Go, Swift, Rust, Java, Kotlin, C#, Ruby, and PHP. - Pre-loads context — when you ask a question, the graph ranks relevant files and packs them into the prompt before Claude sees it. No extra tool calls needed. - Remembers across turns — files you've read or edited are prioritized in future turns. Context compounds. - MCP tools available — Claude can still explore the codebase via graph-aware tools ( graph_read ,graph_retrieve ,graph_neighbors , etc.) when it needs to go deeper. All processing is local. No code leaves your machine. All data lives in /.dual-graph/ (gitignored automatically). | File | Description | |---|---| info_graph.json | Semantic graph of the project: files, symbols, edges | chat_action_graph.json | Session memory: reads, edits, queries, decisions | context-store.json | Persistent store for decisions/tasks/facts across sessions | mcp_server.log | MCP server logs | Global files in ~/.dual-graph/ : | File | Description | |---|---| dgc.ps1 / dg.ps1 | Launcher scripts (auto-updated) | venv/ | Python virtual environment for dependencies | version.txt | Current installed version | All optional, via environment variables: | Variable | Default | Description | |---|---|---| DG_HARD_MAX_READ_CHARS | 4000 | Max characters per file read | DG_TURN_READ_BUDGET_CHARS | 18000 | Total read budget per turn | DG_FALLBACK_MAX_CALLS_PER_TURN | 1 | Max fallback grep calls per turn | DG_RETRIEVE_CACHE_TTL_SEC | 900 | Retrieval cache TTL (15 min) | DG_MCP_PORT | auto (8080-8099) | Force a specific MCP server port | Decisions, tasks, and facts from your sessions are persisted in .dual-graph/context-store.json and re-injected at the start of the next session. This gives Claude continuity across conversations. You can also create a CONTEXT.md in your project root for free-form session notes. A token-counter dashboard is registered automatically with Claude Code: http://localhost:8899 Usage from inside a Claude session: count_tokens({text: ""}) # estimate tokens before reading get_session_stats() # running session cost The launcher checks for updates on every run and auto-updates if a new version is available. No manual intervention needed. Current version: 3.9.51 - All project data stays local. Graphs, session data, and code never leave your machine. - The only outbound calls are: - Version check — fetches a version string (no project data). - Heartbeat — sends a random install ID and platform only. No hardware fingerprinting, no file names, no code. - One-time feedback — optional rating after first day of use. .dual-graph/ is automatically added to.gitignore . macOS / Linux: rm -rf ~/.dual-graph sed -i.bak '/\.dual

Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.

공유

관련 저널 읽기

전체 보기 →