# Show GN: cgrep: AI 코딩 에이전트를 위한 로컬 코드 의도 검색 도구

> Clean Markdown view of GeekNews topic #26685. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=26685](https://news.hada.io/topic?id=26685)
- GeekNews Markdown: [https://news.hada.io/topic/26685.md](https://news.hada.io/topic/26685.md)
- Type: show
- Author: [meghendra](https://news.hada.io/@meghendra)
- Published: 2026-02-14T21:15:08+09:00
- Updated: 2026-02-14T21:15:08+09:00
- Original source: [github.com/meghendra6](https://github.com/meghendra6/cgrep)
- Points: 7
- Comments: 4

## Summary

**cgrep**은 AI 코딩 에이전트가 대형 코드베이스를 탐색할 때 발생하는 **토큰 낭비를 최소화**하기 위해 설계된 로컬 코드 검색 도구입니다. BM25 기반의 텍스트 검색(Tantivy)과 AST 심볼 분석(tree-sitter)을 결합해, 단순 문자열 매칭이 아닌 코드의 ‘의도’ 단위로 탐색을 수행합니다. `agent locate → agent expand`의 2단계 흐름을 통해 필요한 코드만 확장하며, PyTorch 벤치마크에서는 토큰 사용량을 95% 이상 줄이고 검색 지연을 50배 이상 단축했습니다.

## Topic Body

안녕하세요. cgrep이라는 로컬 우선(code-local) 코드 검색 도구를 만들었습니다.  
  
핵심 목표는 AI 코딩 에이전트가 코드베이스를 탐색할 때 발생하는 토큰 낭비와 반복 검색을 줄이는 것입니다.  
cgrep은 BM25 검색(Tantivy) + AST 심볼 분석(tree-sitter)을 결합해서, 단순 문자열 검색보다 코드 의도에 맞는 탐색을 하도록 설계했습니다.  
  
주요 기능:  
- 코드 탐색: definition / references / callers / dependents  
- 컨텍스트 탐색: read / map  
- 에이전트 2단계 흐름: `agent locate -> agent expand` (작은 페이로드로 후보 찾고 필요한 것만 확장)  
- MCP 지원: `cgrep mcp serve` + host 설치 지원  
- 에이전트 설치 지원: claude-code, codex, copilot, cursor, opencode  
  
PyTorch 기준 벤치마크(구현 추적 시나리오 6개):  
- grep 기준 tokens-to-complete: 127,665  
- cgrep(agent locate/expand) tokens-to-complete: 6,153  
- 토큰 95.2% 감소 (20.75x 축소)  
- 완료까지 평균 검색 지연: 1321.3ms -> 22.7ms (약 58.2x)  
  
모든 처리는 로컬에서 동작합니다(클라우드 인덱스 의존 없음).  
  
피드백 부탁드립니다:  
- 실제 대형 코드베이스에서 부족한 점  
- MCP/에이전트 연동에서 필요한 개선점  
- 벤치마크 시나리오 보강 아이디어  
  
Repo: https://github.com/meghendra6/cgrep  
Docs: https://meghendra6.github.io/cgrep/  
Benchmark: https://meghendra6.github.io/cgrep/benchmarks/pytorch-agent-token-efficiency/

## Comments



### Comment 51203

- Author: winterjung
- Created: 2026-02-15T16:25:09+09:00
- Points: 1

[mgrep](https://news.hada.io/topic?id=25775)이나 [ck 도구](https://github.com/BeaconBay/ck)와 비슷한 목적이군요  
macos에서 v1.4.1 기준 릴리즈 바이너리를 실행하려하니 경고가 뜨며 실행되지 않네요.  
[agent-browser 예시](https://github.com/vercel-labs/agent-browser#usage-with-ai-agents)처럼 agent가 참고할 수 있는 skills나 instruction이 있어도 좋겠다 싶었습니다.

### Comment 51260

- Author: meghendra
- Created: 2026-02-16T20:50:42+09:00
- Points: 1
- Parent comment: 51203
- Depth: 1

바이너리 서명에 문제가 있어서 해결했습니다.  
확인해주시고 리뷰해주셔서 감사합니다!

### Comment 51202

- Author: woung717
- Created: 2026-02-15T15:34:44+09:00
- Points: 1

토튼 감소효과는 참 좋네요. Readme 에 코딩 관련 벤치 결과도 함께 있으면, 벤치 성능이 비슷하게 유지만 되더라도 신뢰도가 더 올라갈것 같습니다.

### Comment 51280

- Author: meghendra
- Created: 2026-02-17T12:17:05+09:00
- Points: 1
- Parent comment: 51202
- Depth: 1

피드백 주신대로 real coding agent 시나리오 벤치마크 결과도 추가해두었습니다.  
피드백 감사합니다!
