Map

ctx

Toolbox toolboxai-agentscontext-managementclaude-codecodexpythonPythonMIT โ†ณ show in map Markdown
title
ctx
type
toolbox
summary
Local SQLite-backed context manager for Claude Code and Codex with workstreams, conversation binding, and branching
tags
ai-agents, context-management, claude-code, codex, python
language
Python
license
MIT
created
2026-04-22
updated
2026-04-22

ctx (by dchu917) is a local context manager for Claude Code and Codex that lets you save conversation context into named "workstreams," resume them cleanly across sessions, and branch from a saved state without leaking future changes back to the source. All state lives in a local SQLite database โ€” no API keys, no hosted service.

Python-based, MIT, 68 stars, created April 13 2026.

What it solves

Default Claude Code and Codex conversation handling has two chronic failures:

  1. Transcript drift. Resuming "the last session" may pick up a newer conversation that happens to share the same repo, losing the original thread.
  2. No clean branching. Starting a parallel line of work from the current state requires either duplicating the entire transcript or losing history.

ctx addresses both by binding each workstream to the exact Claude and/or Codex conversation IDs it came from. Later pulls stay on that conversation instead of jumping to the newest chat on disk. Branching creates a new workstream seeded from the saved state of another one, without sharing future transcript pulls.

Workstream model

Claude Code chat          Codex chat
      |                      |
      v                      v
   /ctx ...               ctx ...
          \              /
           v            v
      +----------------------+
      | workstream: feature-audit |
      |   claude:  abc123    |
      |   codex:   def456    |
      +----------------------+
                 |
                 +--> feature-audit-v2 branch

Each workstream is tied to a repo and references 0 or more bound conversation IDs per provider. Entries (captured from --pull) are indexed for search. Curation is first-class: pin saved entries so they always load into future resumes, exclude entries so they stay searchable but stop getting passed to the model, or delete them entirely.

Usage

From Claude Code (slash commands):

  • /ctx start feature-audit --pull โ€” create workstream, pull the current conversation into it.
  • /ctx resume feature-audit โ€” continue an existing workstream, append new context.
  • /ctx branch feature-audit feature-audit-v2 โ€” create a new workstream seeded from the current saved state of another.
  • /ctx search dataset download โ€” search saved workstreams and entries.
  • /ctx curate my-stream โ€” open the curation UI.

From Codex (CLI โ€” Codex doesn't support repo-defined slash commands):

  • ctx start my-stream --pull
  • ctx resume my-stream --compress (for smaller load pack)
  • ctx list --this-repo, ctx search ... --this-repo
  • ctx web --open โ€” local browser UI for browsing, searching, and copying continuation commands.

Install options

  • git clone && ./setup.sh โ€” project-local SQLite DB at ./.contextfun/context.db, skill links into ~/.claude/skills and ~/.codex/skills.
  • ./setup.sh --global โ€” pinned global release into ~/.contextfun.
  • curl | bash install script for global without cloning.
  • npx skills add for the bootstrap skill only.
  • Shell bootstrap via source <(curl ... agent_bootstrap.sh).

How it fits

This is the "workflow tool" side of LLM-agent infrastructure, distinct from:

ctx is about user-directed agent sessions โ€” helping a human keep multiple threads of agent-assisted work distinct and recoverable. It solves a productivity problem, not a security problem.

The conversation-binding idea is the load-bearing part of the design: both Claude Code and Codex write transcripts to disk with no stable "this is the conversation I meant" handle, so a context manager that infers identity from "the newest transcript" is inherently fragile. Binding to explicit conversation IDs makes resume semantics robust.

Repo

https://github.com/dchu917/ctx โ€” 68 stars, MIT, Python. Docs in-repo.

  • botctl โ€” process manager for long-running autonomous Claude agents (adjacent but different problem: ctx is for interactive sessions, botctl is for unattended ones)
  • bubblewrap-dev-env, hazmat, crabtrap, charlie-daemons โ€” the rest of the LLM-agent infrastructure cluster
  • context-engineering โ€” the broader concept of assembling the right prior state into an LLM's context