메뉴
HN
Hacker News 40일 전

클로드 코드·코드엑스 대화 이어쓰는 로컬 매니저 Ctx

IMP
8/10
핵심 요약

AI 코딩 에이전트인 Claude Code와 Codex의 대화 컨텍스트를 로컬에서 관리해주는 오픈소스 도구인 Ctx가 소개되었습니다. 개발자들은 이 도구를 통해 이전 작업 대화를 정확히 불러와 이어서 작업하거나 안전하게 브랜치를 나누어 컨텍스트를 분리할 수 있습니다. API 키가 필요 없는 로컬 우선 아키텍처와 SQLite 기반으로 빠르고 안전하게 작업 스트림을 관리할 수 있다는 것이 핵심 강점입니다.

번역된 본문

Ctx는 Claude Code와 Codex를 위한 로컬 컨텍스트 매니저입니다. 정확한 대화 바인딩을 유지하고, 작업을 깔끔하게 이어가며(resume), 컨텍스트 스트림이 섞이지 않게 안전하게 분기(branch)할 수 있습니다. 또한 선택적으로 로컬 브라우저 프론트엔드에서 저장된 작업 스트림을 검토할 수 있습니다.

[Claude Code 채팅] [Codex 채팅] | | v v /ctx ... ctx ... \ / v v +----------------------+ | workstream: feature-audit | | claude: abc123 | | codex: def456 | +----------------------+ | +--> feature-audit-v2 브랜치

왜 Ctx를 사용해야 할까요?

  • 정확한 트랜스크립트 바인딩 (Exact transcript binding): 각 내부 ctx 세션은 원래 시작된 정확한 Claude 및/또는 Codex 대화에 바인딩될 수 있습니다.
  • 트랜스크립트 표류 방지 (No transcript drift): 이후에 대화를 불러올 때(pull) 디스크에 있는 최신 채팅으로 임의로 넘어가는 것이 아니라, 바인딩된 해당 대화에 머무릅니다.
  • 안전한 브랜칭 (Safe branching): 다른 작업 스트림의 현재 상태에서 새로운 스트림을 시작하되, 향후 대화 내용이 공유되거나 원본 대화를 가로채는 일 없이 안전하게 분기할 수 있습니다.
  • 인덱스 검색 (Indexed retrieval): 저장된 작업 스트림, 세션 및 항목은 인덱싱되어 빠른 ctx 검색이 가능합니다.
  • 엄선된 불러오기 (Curated loads): 저장된 항목을 고정하여 항상 불러오게 하거나, 검색은 가능하되 모델에 다시 전달되지 않도록 제외하거나, 완전히 삭제할 수 있습니다.
  • 로컬 우선 (Local-first): API 키나 호스팅 서비스가 필요 없으며, 순수 SQLite와 로컬 파일만 사용합니다.

빠른 설치 방법 저장소를 복제(clone)하고 표준 프로젝트 로컬 설정을 수행합니다:

git clone https://github.com/dchu917/ctx.git cd ctx ./setup.sh

이는 개발 친화적인 기본 설치 경로입니다. 이 설정은 다음 작업을 수행합니다:

  • ./.contextfun/context.db를 생성합니다.
  • ./ctx.env를 작성합니다.
  • 저장소 기반의 ctx 심(shim)을 ~/.contextfun/bin에 설치합니다.
  • 로컬 스킬(skills)을 ~/.claude/skills 및 ~/.codex/skills에 연결(link)합니다.

다음과 같은 경우에 이 설치 방법을 사용하세요:

  • 저장소를 로컬에 체크아웃하고 싶을 때
  • ctx가 프로젝트 로컬 DB를 기본으로 사용하길 원할 때
  • 저장소 자체를 개발하거나 편집하고 있을 때

4단계 데모

  1. 복제 및 설정: git clone https://github.com/dchu917/ctx.git cd ctx ./setup.sh

  2. 새 작업 스트림(workstream) 시작: Claude Code: /ctx start feature-audit --pull Codex 또는 터미널: ctx start feature-audit --pull

  3. --pull 옵션의 의미 이해: ctx start feature-audit --pull은 작업 스트림을 생성하고 현재 대화의 기존 컨텍스트를 해당 스트림으로 가져옵니다. 반면 ctx start feature-audit는 그 시점부터 새로운 작업 스트림을 생성할 뿐, 이전 대화 내용을 채워 넣지(backfill) 않습니다.

  4. 나중에 돌아와서 계속하거나 분기하기: Claude Code: /ctx resume feature-audit /ctx branch feature-audit feature-audit-v2

Codex: ctx resume feature-audit ctx branch feature-audit feature-audit-v2

일상적인 사용법 Claude Code:

  • /ctx : 현재 저장소의 현재 작업 스트림을 표시하거나, 설정된 것이 없음을 알려줍니다.
  • /ctx list : 저장된 작업 스트림을 나열하며, 해당되는 경우 현재 저장소를 먼저 표시합니다.
  • /ctx search dataset download : 일치하는 컨텍스트에 대해 저장된 작업 스트림과 항목을 검색합니다.
  • /ctx start my-stream --pull : 새 작업 스트림을 생성하고 계속하기 전에 현재 대화의 기존 컨텍스트를 가져옵니다.
  • /ctx resume my-stream : 기존 작업 스트림을 계속 진행하고 이 대화의 새 컨텍스트를 추가합니다.
  • /ctx rename better-name : 현재 작업 스트림의 이름을 변경합니다.
  • /ctx rename better-name --from old-name : 먼저 전환하지 않고 특정 작업 스트림의 이름을 변경합니다.
  • /ctx delete my-stream : 해당 작업 스트림에서 가장 최근에 저장된 ctx 세션을 삭제합니다.
  • /ctx curate my-stream : 해당 작업 스트림의 저장된 메모리 큐레이션 UI를 엽니다.
  • /ctx branch source-stream target-stream : 다른 작업 스트림의 현재 저장된 상태를 기반으로 새 작업 스트림을 생성합니다.
  • /branch source-stream target-stream : 동일한 브랜치 작업을 위한 Claude 바로 가기입니다.

Codex:

  • ctx : 현재 저장소의 현재 작업 스트림을 표시하거나 설정된 것이 없음을 알려줍니다.
  • ctx list : 저장된 작업 스트림을 나열합니다.
  • ctx list --this-repo : 현재 저장소에 연결된 작업 스트림만 나열합니다.
  • ctx search dataset download : 일치하는 컨텍스트에 대해 저장된 작업 스트림과 항목을 검색합니다.
  • ctx search dataset download --this-repo : 현재 저장소에 연결된 작업 스트림만 검색합니다.
  • ctx web --open : 검색, 탐색 및 계속하기 명령어 복사를 위한 선택적 로컬 브라우저 UI를 엽니다.
  • ctx start my-stream : 이 시점부터 시작하는 새 작업 스트림을 생성합니다.
원문 보기
원문 보기 (영어)
ctx Local context manager for Claude Code and Codex. Keep exact conversation bindings, resume work cleanly, branch context without mixing streams, and optionally inspect saved workstreams in a local browser frontend. Claude Code chat Codex chat | | v v /ctx ... ctx ... \ / v v +----------------------+ | workstream: feature-audit | | claude: abc123 | | codex: def456 | +----------------------+ | +--> feature-audit-v2 branch Why ctx Exact transcript binding: each internal ctx session can bind to the exact Claude and/or Codex conversation it came from. No transcript drift: later pulls stay on that bound conversation instead of jumping to the newest chat on disk. Safe branching: start a new workstream from the current state of another one without sharing future transcript pulls or hijacking the source conversation. Indexed retrieval: saved workstreams, sessions, and entries are indexed for fast ctx search lookup. Curated loads: pin saved entries so they always load, exclude saved entries so they stay searchable but stop getting passed back to the model, or delete them entirely. Local-first: no API keys, no hosted service, plain SQLite plus local files. Quick Install Clone the repo and do the standard project-local setup: git clone https://github.com/dchu917/ctx.git cd ctx ./setup.sh This is the main development-friendly install path. It does the following: creates ./.contextfun/context.db writes ./ctx.env installs a repo-backed ctx shim into ~/.contextfun/bin links local skills into ~/.claude/skills and ~/.codex/skills Use this when: you want the repo checked out locally you want ctx to use a project-local DB by default you are developing or editing the repo itself 4-Step Demo Clone and set it up: git clone https://github.com/dchu917/ctx.git cd ctx ./setup.sh Start a new workstream: Claude Code: /ctx start feature-audit --pull Codex or your terminal: ctx start feature-audit --pull Know what --pull means: ctx start feature-audit --pull creates the workstream and pulls the existing context from the current conversation into it. ctx start feature-audit creates the workstream starting from that point only. It does not backfill the earlier conversation. Come back later and continue or branch: Claude Code: /ctx resume feature-audit /ctx branch feature-audit feature-audit-v2 Codex: ctx resume feature-audit ctx branch feature-audit feature-audit-v2 Daily Use Claude Code: /ctx : show the current workstream for this repo, or tell you that none is set yet. /ctx list : list saved workstreams, with this repo first when applicable. /ctx search dataset download : search saved workstreams and entries for matching context. /ctx start my-stream --pull : create a new workstream and pull the existing context from the current conversation into it before continuing. /ctx resume my-stream : continue an existing workstream and append new context from this conversation to it. /ctx rename better-name : rename the current workstream. /ctx rename better-name --from old-name : rename a specific workstream without switching to it first. /ctx delete my-stream : delete the latest saved ctx session in that workstream. /ctx curate my-stream : open the saved-memory curation UI for that workstream. /ctx branch source-stream target-stream : create a new workstream seeded from the current saved state of another one. /branch source-stream target-stream : Claude shortcut for the same branch operation. Codex: ctx : show the current workstream for this repo, or tell you that none is set yet. ctx list : list saved workstreams. ctx list --this-repo : list only workstreams linked to the current repo. ctx search dataset download : search saved workstreams and entries for matching context. ctx search dataset download --this-repo : search only workstreams linked to the current repo. ctx web --open : open the optional local browser UI for browsing, searching, and copying continuation commands. ctx start my-stream : create a new workstream starting from this point only. ctx start my-stream --pull : create a new workstream and pull the existing context from the current conversation into it first. ctx resume my-stream : continue an existing workstream. ctx resume my-stream --compress : continue an existing workstream with a smaller load pack. ctx rename better-name : rename the current workstream. ctx rename better-name --from old-name : rename a specific workstream without switching to it first. ctx delete my-stream : delete the latest saved ctx session in that workstream. ctx curate my-stream : open the saved-memory curation UI for that workstream. ctx branch source-stream target-stream : create a new workstream seeded from the current saved state of another one. Codex note: Codex does not currently support repo-defined custom slash commands like /ctx list , so in Codex you should use the installed ctx command with subcommands. When ctx start , ctx resume , or ctx branch load context, they print a short summary of what the workstream is, the latest session being targeted, and the most recent items. They also include an explicit hint that in Codex you can inspect the full command output with ctrl-t , and in Claude you can expand the tool output block, plus guidance for the agent to summarize briefly and ask how you want to proceed instead of pasting the full pack back. Other Installation Paths Clone the repo and install a shared global setup from that clone git clone https://github.com/dchu917/ctx.git cd ctx ./setup.sh --global This runs the same quickstart entrypoint, but installs the pinned global release into ~/.contextfun instead of wiring the current clone as the live runtime. Install globally without cloning first curl -fsSL https://raw.githubusercontent.com/dchu917/ctx/main/scripts/install.sh | bash This installs a pinned tagged release into ~/.contextfun , including the ctx binary, the Python package, the default DB, and the self-contained Claude/Codex skills. Install the bootstrap skill first with skills.sh npx skills add https://github.com/dchu917/ctx --skill ctx -y -g This installs the ctx bootstrap skill first, not the CLI binary directly. After that, the bundled skills/ctx/scripts/ctx.sh wrapper can run ctx install or auto-install the global CLI into ~/.contextfun on first use. Bootstrap an agent shell without a full manual clone flow Global shell bootstrap: source <( curl -fsSL https://raw.githubusercontent.com/dchu917/ctx/main/scripts/agent_bootstrap.sh ) Project-local shell bootstrap: source <( curl -fsSL https://raw.githubusercontent.com/dchu917/ctx/main/scripts/agent_setup_local_ctx.sh ) These are best for Claude Code or Codex terminals. Advanced manual wiring after cloning Repo-backed ctx shim: bash scripts/install_shims.sh Skill links only: bash scripts/install_skills.sh Override skill directories if needed: CODEX_SKILLS_DIR=/custom/codex/skills \ CLAUDE_SKILLS_DIR=/custom/claude/skills \ bash scripts/install_skills.sh Documentation Install and Remove Usage Architecture Integrations Repo Layout Maintenance and Release Documentation Index Curate Saved Memory Use ctx curate <workstream> to review the saved entries that feed future loads for a workstream: ctx curate my-stream The terminal UI lets you scroll saved entries, inspect a preview, and change how each entry behaves in future packs: j / k or arrow keys move through entries Enter toggles a larger preview p pins an entry so it always loads, even in compressed mode x excludes an entry from future loads, but keeps it saved and searchable a restores the default load behavior d marks an entry for deletion, then y confirms the delete q exits Notes: This changes ctx memory only. It does not edit or delete the original Claude/Codex chat. If you are in a non-interactive shell, use ctx web --open and manage entries from the browser detail page instead. ctx delete --interactive <workstream> opens the same curation UI. See docs/usage.md and docs/architecture.md for deeper detail on load controls. Clear Workstreams Use ctx clear to delete who