메뉴
HN
Hacker News 26일 전

ctx: 로컬 코딩 에이전트 기록 검색 도구

IMP
8/10
핵심 요약

ctx는 로컬 환경에 저장된 과거 코딩 에이전트 세션 기록을 고속으로 검색할 수 있는 오픈소스 CLI 도구입니다. AI 코딩 에이전트들이 이전 작업의 맥락을 파악하지 못하고 처음부터 다시 시작해야 하는 비효율성을 해결하며, 구조화된 인덱싱을 통해 원본 기록을 뒤지는 것보다 50배 더 적은 토큰으로 유의미한 과거 맥락을 제공합니다.

번역된 본문

ctx는 과거 코딩 에이전트 세션 전체를 로컬에서 빠르게 검색할 수 있는 오픈소스 CLI(Command Line Interface)입니다.

코딩 에이전트는 보통 매번 제로 상태에서 시작합니다. 현재의 저장소(repository)는 검사할 수 있지만, 과거 작업에서 논의된 내용, 결정 사항, 실패한 시도, 명령어 및 테스트 결과는 복구할 수 없는 경우가 많습니다.

하지만 그러한 세션 기록에는 매우 유용한 컨텍스트가 가득합니다. 버그 조사, 리팩토링, 파일 경로, 명령어, 패치, 이전 에이전트의 메모, 그리고 그곳에서 내린 결정, 제약 조건, 의도 및 기각된 접근 방식 등이 모두 포함되죠.

ctx는 이러한 로그들을 사용자 머신의 SQLite 데이터베이스에 인덱싱합니다. 그런 다음 현재 그리고 미래의 에이전트가 같은 실수를 반복하기 전에 과거의 논의, 명령어, 실패한 시도를 찾을 수 있도록 CLI를 제공합니다.

설치 및 설정 curl -fsSL https://ctx.rs/install | sh

(에이전트 세션을 위한 선택 사항이지만 권장됨:) npx skills add ctxrs/ctx (Codex, Claude Code, Cursor 및 순정 Agent Skills의 마켓플레이스/플러그인 설치에 대해서는 'Agent Skill Install' 가이드를 참조하세요.)

원본 기록 검색 대비 50배 높은 토큰 효율성 에이전트 기록을 세션, 이벤트, 메타데이터 및 인덱스 필드로 구조화하고 순위가 매겨진 인용 결과를 반환함으로써, 에이전트는 원문 검색보다 훨씬 적은 토큰으로 유의미한 과거 기록에 접근할 수 있습니다. 검색어와 데이터에 따라 결과는 다를 수 있지만, 일반적인 원문 검색은 너무 많은 토큰을 소모하여 '사용 가능한 과거 기록이 없는 것과 다름없는' 결과를 낳기도 합니다.

작동 방식 과거 에이전트 세션은 로컬 공급자(provider) 기록 파일에 저장됩니다. ctx는 지원되는 소스를 찾아 실제 영구 기록을 가져온 뒤, 검색에 최적화된 로컬 SQLite 데이터베이스에 정규화된 세션, 이벤트 및 수정된 파일 메타데이터를 저장합니다.

ctx는 Rust로 작성되었으며 로컬 SQLite 인덱스를 사용하기 때문에 검색이 빠르고 스크립트 작성이 가능하며 백그라운드 서비스가 필요하지 않습니다. 인덱스는 기본적으로 로컬에 저장되며 비공개로 유지됩니다. 로컬 경로나 비밀 정보 형태의 문자열을 숨기지 않고 기록 텍스트가 그대로 보존되므로, 외부로 공유하기 전에는 복사된 출력물을 검토해야 합니다.

주요 명령어 예시:

  • ctx setup # 기존의 모든 로컬 에이전트 세션을 인덱싱합니다.
  • ctx search "failed migration" # 자연어로 이전 작업을 검색합니다.
  • ctx search --file crates/foo/src/lib.rs # 해당 파일을 건드린 세션/이벤트를 검색합니다.
  • ctx search --term "failed migration" --term rollback --term "cursor rename" # 여러 검색어를 조합합니다.
  • ctx sql "SELECT provider, COUNT(*) AS sessions FROM ctx_sessions GROUP BY provider" # 읽기 전용 SQL로 정확한 로컬 인덱스 데이터를 검사합니다.
  • ctx show event <ctx-event-id> --window 3 # 매칭된 이전 기록의 일부를 출력합니다.
  • ctx show session <ctx-session-id> # 원본 세션의 간결한 기록을 출력합니다.

이러한 ID를 통해 현재 에이전트는 필요한 만큼 이전 세션의 컨텍스트를 복구할 수 있습니다. ctx는 프롬프트, 기록 또는 인덱싱된 과거 기록을 클라우드 서비스로 전송하거나 모델 API를 호출하지 않으며, API 키를 요구하거나 소스 코드 저장소에 기록하지 않습니다.

설치된 바이너리에는 로컬 문서 및 매뉴얼 페이지 생성 기능도 포함되어 있습니다 (예: ctx docs search, ctx docs show cli-reference, ctx docs man --print). 공식 설치 프로그램으로 관리되는 바이너리는 서명된 자가 업그레이드를 지원합니다 (ctx upgrade status, ctx upgrade check).

지원하는 에이전트 기록 지원된다는 것은 ctx가 해당 도구의 로컬 영구 기록을 찾아 읽고 검색 인덱스로 가져올 수 있음을 의미합니다.

  • Claude Code: 지원됨
  • Codex: 지원됨
  • Cursor: 지원됨
  • Pi: 지원됨
  • OpenCode: 지원됨
  • Antigravity / Gemini CLI: 지원됨
  • Factory AI Droid: 지원됨
  • Copilot CLI: 지원됨

비교 일반적인 에이전트 메모리 도구는 압축된 팩트, 요약, 벡터 또는 그래프 노드를 저장합니다. 이는 변하지 않는 설정값 등에는 도움이 될 수 있지만, 다음 에이전트가 버그가 어디서 발생했는지, 이전 시도에서 무엇이 문제였는지 알아야 할 때는 매우 취약한 증거가 됩니다. 반면 ctx는 원본 세션을 구조화하여 기록의 맥락을 온전히 파악할 수 있게 도와줍니다.

원문 보기
원문 보기 (영어)
ctx is an open-source CLI for fast local search across your past coding agent sessions. Coding agents usually start from zero. They can inspect the current repo, but they often cannot recover the discussions, decisions, failed attempts, commands, and test results from earlier work. Those sessions are full of useful context: decisions, constraints, intent, and rejected approaches from you bug investigations, refactors, file paths, commands, patches, and notes from previous agents ctx indexes those logs into SQLite on your machine, then gives current and future agents a CLI for finding the prior discussion, command, or failed attempt before they repeat it. Install and set up ctx curl -fsSL https://ctx.rs/install | sh Optional but recommended for agent sessions: npx skills add ctxrs/ctx For marketplace/plugin installs in Codex, Claude Code, Cursor, and raw Agent Skills, see Agent Skill Install . 50x more token-efficient than raw transcript search By structuring agent history into sessions, events, metadata, and indexed fields, then returning ranked cited matches, agents can access meaningful history with far fewer tokens than raw search. Results vary by query and corpus, but raw search is often so token-heavy that it can be effectively the same as not having usable history. How it works Your past agent sessions are stored in local provider history files. ctx discovers supported sources, imports the real persisted records, and stores normalized session, event, and touched-file metadata in a local SQLite database optimized for retrieval. ctx is written in Rust and stores a local SQLite index, so searches are fast, scriptable, and do not require a background service. The index is local and private by default. Transcript text is preserved rather than hiding local paths or secret-shaped strings, so review copied output before sharing it outside the machine. # Index all of your existing local agent sessions ctx setup # Your agent can search prior work with normal language ctx search " failed migration " # Search sessions/events that touched a file ctx search --file crates/foo/src/lib.rs # Or search multiple terms ctx search --term " failed migration " --term rollback --term " cursor rename " # Advanced: inspect exact local index data with read-only SQL ctx sql " SELECT provider, COUNT(*) AS sessions FROM ctx_sessions GROUP BY provider " # Results include matching sessions, snippets, and ctx IDs # evt_01h... ses_01h... codex "migration expected the old cursor name" ... # Print the matching part of the old transcript ctx show event < ctx-event-id > --window 3 # Or print a compact transcript of the original session ctx show session < ctx-session-id > Those IDs let your current agent recover as much context from previous sessions as it needs. ctx does not send your prompts, transcripts, or indexed history to a cloud service, call model APIs, require API keys, or write into your source repositories. The installed binary also includes local docs and man-page generation: ctx docs search " upgrade " ctx docs show cli-reference ctx docs man --print ctx Official installer-managed binaries support signed self-upgrades: ctx upgrade status ctx upgrade check Source builds and package-manager installs remain unmanaged and do not self-upgrade. For the full pipeline, see How ctx works . For a quick first run, see Quickstart . Supported agent histories Support means ctx can discover or read that harness's persisted local history and import it into the local search index. Use ctx sources --json on your machine to see which sources are currently importable . Agent harness Support Claude Code Supported Codex Supported Cursor Supported Pi Supported OpenCode Supported Antigravity / Gemini CLI Supported Factory AI Droid Supported Copilot CLI Supported How ctx compares Agent memory tools usually save compact facts, summaries, vectors, or graph nodes. Those can help with stable preferences, but they are weak evidence when the next agent needs to know where a decision came from, what command failed, or what was rejected in the original conversation. Graphify-style tools answer a different question. They map the current repository: files, symbols, imports, folders, and relationships. ctx searches the prior agent sessions that explain what happened while people and agents changed that repository. ctx keeps retrieval tied to sessions and events, so another agent can inspect the source before using it. Read more about agent memory , Graphify-style codebase graphs , and grep or log search . Explore the docs Page What it covers Install Install ctx, initialize local storage, and index discovered local history. Quickstart Search local history, inspect an event, open the session, and use JSON output. Install the ctx skill Install the agent-history search skill with the open skills installer. Agent plugin installs Install the ctx skill through Codex, Claude Code, Cursor, or a raw skill folder. SDKs Use ctx agent history search from TypeScript, Python, Rust, Go, JVM, Swift, or .NET code. Custom history plugins Build an advanced local adapter for agent formats ctx does not support natively. Cursor Import Cursor agent transcripts and ask Cursor to cite retrieved local history before editing. How it works Understand discovery, import, SQLite storage, search refresh, and cited retrieval. Supported agents See which agent histories ctx can discover, import, and search today. CLI reference Review setup, status, sources, import, show, locate, search, SQL, MCP, and doctor.