메뉴
HN
Hacker News 13일 전

에이전트용 초고속 코드 검색 라이브러리 Semble

IMP
8/10
핵심 요약

해커뉴스에 AI 코딩 에이전트를 위해 개발된 'Semble'라는 새로운 오픈소스 코드 검색 라이브러리가 소개되었습니다. 이 도구는 기존의 grep+read 방식보다 토큰 사용량을 약 98% 줄여주며, GPU나 외부 API 키 없이 CPU 환경에서도 초고속으로 코드를 인덱싱하고 검색할 수 있습니다. MCP 서버 및 CLI 환경과 연동이 쉬워 Claude Code, Cursor 등 다양한 코딩 에이전트에 즉시 통합해 사용할 수 있는 것이 큰 장점입니다.

번역된 본문

에이전트를 위한 빠르고 정확한 코드 검색 도구. grep+read 방식보다 약 98% 적은 토큰 사용.

빠른 시작 • MCP 서버 • Bash / AGENTS.md • CLI • Python API • 벤치마크

Semble은 에이전트(Agent)를 위해 설계된 코드 검색 라이브러리입니다. 에이전트가 필요한 정확한 코드 스니펫을 즉시 반환하며, grep+read 방식에 비해 약 98% 적은 토큰을 사용하여 모든 단계의 지연 시간을 줄여줍니다. 전체 코드베이스의 인덱싱 및 검색은 1초 미만으로 완료됩니다. 코드 특화 트랜스포머 모델에 비해 인덱싱은 약 200배 빠르고, 쿼리는 약 10배 빠르면서도 검색 품질은 99% 수준을 유지합니다(벤치마크 참조). 모든 작업은 CPU에서 실행되며, API 키, GPU 또는 외부 서비스가 필요하지 않습니다. MCP 서버로 실행하거나 셸(Shell)에서 AGENTS.md를 통해 호출하면, Claude Code, Cursor, Codex, OpenCode 등 어떤 에이전트든 모든 저장소(Repo)에 즉시 접근할 수 있습니다.

빠른 시작 에이전트는 코드를 찾아야 할 때 자동으로 Semble을 사용합니다. 키워드로 grep한 뒤 전체 파일을 읽는 대신, 자연어로 쿼리(예: "인증은 어떻게 처리되나요?")하여 관련 컨텍스트만 반환받습니다. Semble은 MCP 서버 또는 Bash 도구로 설정할 수 있습니다.

MCP Claude Code에 Semble 추가(uv 필요): claude mcp add semble -s user -- uvx --from "semble[mcp]" semble

다른 에이전트 환경을 사용 중이신가요? Codex, OpenCode, Cursor 및 기타 MCP 클라이언트에 대한 설정 방법은 MCP 서버 섹션을 참조하세요.

Bash / AGENTS.md Semble을 먼저 설치한 다음, 코드 검색 스니펫을 AGENTS.md 또는 CLAUDE.md에 추가하세요: pip install semble # pip로 설치 uv tool install semble # 또는 uv로 설치

참고: Claude Code나 Codex CLI 하위 에이전트의 경우, MCP 대신 또는 함께 Bash 통합을 사용하세요. Semble을 업데이트하려면 'Updating' 가이드를 참조하세요. Semble이 절약해 준 토큰 수가 궁금하신가요? semble savings를 실행해 보세요. 자세한 내용은 Savings 섹션을 참조하세요.

주요 기능

  • 빠름 (Fast): 평균적인 저장소를 약 250ms 만에 인덱싱하고, 쿼리에 약 1.5ms 만에 응답합니다. 모두 CPU 기반에서 작동합니다.
  • 정확함 (Accurate): 벤치마크에서 0.854의 NDCG@10을 기록했습니다. 크기와 비용의 일부만으로 코드 특화 트랜스포머 모델과 동등한 수준입니다.
  • 토큰 효율성 (Token-efficient): 관련 청크만 반환하여 grep+read보다 약 98% 적은 토큰을 사용합니다.
  • 제로 설정 (Zero setup): API 키, GPU 또는 외부 서비스 없이 CPU에서 실행됩니다.
  • MCP 서버 (MCP server): Claude Code, Cursor, Codex, OpenCode 및 기타 MCP 호환 에이전트에 바로 사용할 수 있는 도구입니다.
  • 로컬 및 원격 지원 (Local and remote): 로컬 경로 또는 git URL을 전달할 수 있습니다.

MCP 서버 Semble은 MCP 서버로 실행되어 에이전트가 모든 코드베이스를 직접 검색할 수 있게 합니다. 저장소는 필요할 때 클론 및 인덱싱되며, 인덱스는 세션 유지 기간 동안 캐시됩니다. 로컬 경로의 경우 파일 변경 사항을 감시하여 자동으로 재인덱싱합니다.

설정 (uv 설치 필요) Claude Code claude mcp add semble -s user -- uvx --from "semble[mcp]" semble

Codex ~/.codex/config.toml에 추가: [mcp_servers.semble] command = "uvx" args = ["--from", "semble[mcp]", "semble"]

OpenCode ~/.opencode/config.json에 추가: {"mcp": {"semble": {"type": "local", "command": ["uvx", "--from", "semble[mcp]", "semble"]}}}

Cursor ~/.cursor/mcp.json (또는 프로젝트 내 .cursor/mcp.json)에 추가: {"mcpServers": {"semble": {"command": "uvx", "args": ["--from", "semble[mcp]", "semble"]}}}

도구 (Tools) search: 자연어 또는 코드 쿼리로 코드베이스를 검색합니다. 로컬 디렉터리 경로 또는 https:// git URL을 저장소로 전달합니다. find_related: 파일 경로와 줄 번호가 주어지면, 해당 위치의 코드와 의미론적으로 유사한 청크를 반환합니다.

Bash 통합 MCP의 대안으로 Bash를 통해 Semble을 호출할 수 있습니다. Claude Code 및 Codex CLI의 경우, 하위 에이전트(sub-agent)는 MCP 도구를 직접 호출할 수 없으므로(둘 다 최상위 에이전트에서만 MCP 스키마를 지연 로드하기 때문), Bash 통합이 유일한 옵션입니다. Bash 지원을 추가하려면 AGENTS.md 또는 CLAUDE.md에 다음을 추가하세요:

코드 검색

grep 대신 코드가 수행하는 작업을 설명하거나 기호/식별자를 지정하여 semble search로 코드를 찾으세요:

semble search "authentication flow" ./my-project
semble search "save_pretrained" ./my-project
semble search "save model to disk" ./my-project --top-k 10
원문 보기
원문 보기 (영어)
Fast and Accurate Code Search for Agents Uses ~98% fewer tokens than grep+read Quickstart • MCP Server • Bash / AGENTS.md • CLI • Python API • Benchmarks Semble is a code search library built for agents. It returns the exact code snippets they need instantly, using ~98% fewer tokens than grep+read and cutting latency on every step. Indexing and searching a full codebase end-to-end takes under a second, with ~200x faster indexing and ~10x faster queries than a code-specialized transformer, at 99% of its retrieval quality (see benchmarks ). Everything runs on CPU with no API keys, GPU, or external services. Run it as an MCP server or call it from the shell via AGENTS.md and any agent (Claude Code, Cursor, Codex, OpenCode, etc.) gets instant access to any repo. Quickstart Your agent will automatically use Semble whenever it needs to find code. Instead of grepping with a keyword and reading full files, it queries in natural language (e.g. "How is authentication handled?" ) and gets back only the relevant context. Semble can be set up as an MCP server or as a bash tool: MCP Add Semble to Claude Code (requires uv ): claude mcp add semble -s user -- uvx --from " semble[mcp] " semble Using another agent harness? See MCP Server for setup instructions for Codex, OpenCode, Cursor, and other MCP clients. Bash / AGENTS.md Install Semble first, then add the code search snippet to your AGENTS.md or CLAUDE.md : pip install semble # Install with pip uv tool install semble # Or install with uv Note: for Claude Code or Codex CLI sub-agents, use the bash integration instead of, or alongside, MCP. To update Semble, see Updating . Curious how many tokens Semble has saved you? Run semble savings to see. See Savings for details. Main Features Fast : indexes an average repo in ~250 ms and answers queries in ~1.5 ms, all on CPU. Accurate : NDCG@10 of 0.854 on our benchmarks , on par with code-specialized transformer models, at a fraction of the size and cost. Token-efficient : returns only the relevant chunks, using ~98% fewer tokens than grep+read . Zero setup : runs on CPU with no API keys, GPU, or external services required. MCP server : drop-in tool for Claude Code, Cursor, Codex, OpenCode, and any other MCP-compatible agent. Local and remote : pass a local path or a git URL. MCP Server Semble can run as an MCP server so agents can search any codebase directly. Repos are cloned and indexed on demand, and indexes are cached for the lifetime of the session. Local paths are watched for file changes and re-indexed automatically. Setup Requires uv to be installed. Claude Code claude mcp add semble -s user -- uvx --from " semble[mcp] " semble Codex Add to ~/.codex/config.toml : [ mcp_servers . semble ] command = " uvx " args = [ " --from " , " semble[mcp] " , " semble " ] OpenCode Add to ~/.opencode/config.json : { "mcp" : { "semble" : { "type" : " local " , "command" : [ " uvx " , " --from " , " semble[mcp] " , " semble " ] } } } Cursor Add to ~/.cursor/mcp.json (or .cursor/mcp.json in your project): { "mcpServers" : { "semble" : { "command" : " uvx " , "args" : [ " --from " , " semble[mcp] " , " semble " ] } } } Tools Tool Description search Search a codebase with a natural-language or code query. Pass repo as a local directory path or an https:// git URL. find_related Given a file path and line number, return chunks semantically similar to the code at that location. Bash integration An alternative to MCP is to invoke Semble via Bash. For Claude Code and Codex CLI, this is the only option for sub-agents, which cannot call MCP tools directly (both lazy-load MCP schemas at the top-level agent only). To add Bash support, append the following to your AGENTS.md or CLAUDE.md : ## Code Search Use ` semble search ` to find code by describing what it does or naming a symbol/identifier, instead of grep: ​```bash semble search "authentication flow" ./my-project semble search "save_pretrained" ./my-project semble search "save model to disk" ./my-project --top-k 10 ​``` Use ` semble find-related ` to discover code similar to a known location (pass ` file_path ` and ` line ` from a prior search result): ​```bash semble find-related src/auth.py 42 ./my-project ​``` ` path ` defaults to the current directory when omitted; git URLs are accepted. If ` semble ` is not on ` $PATH ` , use ` uvx --from "semble[mcp]" semble ` in its place. ## Workflow 1 . Start with ` semble search ` to find relevant chunks. 2 . Inspect full files only when the returned chunk is not enough context. 3 . Optionally use ` semble find-related ` with a promising result's ` file_path ` and ` line ` to discover related implementations. 4 . Use grep only when you need exhaustive literal matches or quick confirmation of an exact string. Claude Code sub-agent : Claude Code also supports a dedicated sub-agent. Run this once in your project root: semble init # or, if semble is not on $PATH: uvx --from " semble[mcp] " semble init This writes .claude/agents/semble-search.md . CLI Semble also ships as a standalone CLI for use outside of MCP. This is useful in scripts or anywhere you want search results without an MCP session. # Search a local repo semble search " authentication flow " ./my-project # Search for a symbol or identifier semble search " save_pretrained " ./my-project # Search a remote repo (cloned on demand) semble search " save model to disk " https://github.com/MinishLab/model2vec # Find code similar to a known location (file_path and line from a prior search result) semble find-related src/auth.py 42 ./my-project path defaults to the current directory when omitted; git URLs are accepted. If semble is not on $PATH , use uvx --from "semble[mcp]" semble in its place. Savings semble savings shows how many tokens semble has saved across all your searches: semble savings # summary by period semble savings --verbose # also show breakdown by call type Semble Token Savings ════════════════════════════════════════════════════════════════ Period Calls Savings ──────────────────────────────────────────────────────────────── Today 42 [███████████████░] ~58.4k tokens (95%) Last 7 days 287 [██████████████░░] ~312.4k tokens (90%) All time 1.4k [██████████████░░] ~1.2M tokens (89%) How savings are calculated: for each call, semble records the total character count of the unique files containing returned chunks and the character count of the snippets returned. Estimated tokens saved is (file chars − snippet chars) / 4 (4 chars per token). This is a conservative estimate: the baseline is reading matched files in full, which is how coding agents often explore unfamiliar code. Stats are stored in ~/.semble/savings.jsonl . Updating To update/upgrade Semble to the latest version: pip install --upgrade semble # with pip uv tool upgrade semble # with uv uv cache clean semble # for MCP users (restart your MCP client after) Python API Semble can also be used as a Python library for programmatic access, useful when building custom tooling or integrating search directly into your own code. from semble import SembleIndex # Index a local directory index = SembleIndex . from_path ( "./my-project" ) # Index a remote git repository index = SembleIndex . from_git ( "https://github.com/MinishLab/model2vec" ) # Search the index with a natural-language or code query results = index . search ( "save model to disk" , top_k = 3 ) # Find code similar to a specific result related = index . find_related ( results [ 0 ], top_k = 3 ) # Each result exposes the matched chunk result = results [ 0 ] result . chunk . file_path # "model2vec/model.py" result . chunk . start_line # 127 result . chunk . end_line # 150 result . chunk . content # "def save_pretrained(self, path: PathLike, ..." How it works Semble splits each file into code-aware chunks using Chonkie , then scores every query against the chunks with two complementary retrievers: static Model2Vec embeddings using the code-specialized potion-code-16M model for semantic similarity, and BM25 for lexical mat