# Add to your Claude Code skills
git clone https://github.com/Alegau03/CTXCTX is a local context runtime for OpenCode and AI coding agents. It keeps repository knowledge, reusable rules, shell output, diffs, and file rereads compact before they ever bloat the model context.
| Install + Bootstrap | Planning + Packing | Read Cache + Dashboard |
|---|---|---|
| GIF placeholder | GIF placeholder | GIF placeholder |
| Install ctx, run ctx init, ctx index, ctx opencode install, then open OpenCode. | Build a plan, pack the smallest useful context, and compare broad vs packed token cost. | Re-read files through digest mode and watch live savings in the right sidebar. |
CTX is a local runtime layer for OpenCode. It indexes the repository, stores reusable guidance as graph memory, exposes local MCP tools, generates OpenCode slash commands, and keeps local telemetry about token savings, cache reuse, and compact context packs.
No comments yet. Be the first to share your thoughts!
CTX is not another agent launcher.
/ctx-* experience, not wrapper-first shell workflows.Coding agents usually waste tokens on things that are useful once but expensive forever.
| Problem | Traditional flow | CTX flow |
|---|---|---|
| Project rules | Reload a full AGENTS.md every turn | Import rules into graph memory and retrieve only the relevant directives |
| File rereads | Pay full price for the same file again | Re-read unchanged files through digest / outline modes with local read-cache compression |
| Noisy logs | Paste thousands of repeated lines | Run /ctx-run or prune logs into root-cause signal |
| Broad diffs | Feed huge patches | Keep only task-relevant hunks and changed symbols |
| Repo navigation | Manual file spelunking | Query local graph, snippets, symbols, and semantic ranking |
| Host integration | Wrapper commands outside the agent | OpenCode-native /ctx-* commands plus local MCP tools |
Install CTX with the channel that fits your workflow best:
cargo install ctxnpm i -g ctx-binbrew tap Alegau03/ctx && brew install ctxUpdate paths:
ctx updatectx update --checkcargo install ctx --forcenpm update -g ctx-binbrew upgrade ctxcargo install ctx
curl -fsSL https://raw.githubusercontent.com/Alegau03/CTX/main/scripts/install.sh | sh
npm i -g ctx-bin
brew tap Alegau03/ctx
brew install ctx
git clone https://github.com/Alegau03/CTX.git
cd CTX
cargo install --locked --path crates/ctx-cli
Verify:
ctx help
ctx doctor
ctx update --check
Native update command:
ctx update
How ctx update behaves:
cargo install ctx --forcenpm update -g ctx-binbrew upgrade ctxDownload the latest assets from GitHub Releases, then run:
shasum -a 256 -c SHA256SUMS
tar -xzf ctx-0.2.2-aarch64-apple-darwin.tar.gz
mkdir -p "$HOME/.local/bin"
install -m 0755 ctx-0.2.2-aarch64-apple-darwin/ctx "$HOME/.local/bin/ctx"
export PATH="$HOME/.local/bin:$PATH"
If you prefer a system-wide install:
sudo install -m 0755 ctx-0.2.2-aarch64-apple-darwin/ctx /usr/local/bin/ctx
For the full install matrix, release verification notes, native update behavior, and distribution details, see docs/install.md.
Once ctx is installed, enable it in any project:
cd /path/to/your/project
ctx init
ctx index
ctx opencode install
opencode
If you want the leanest possible OpenCode surface first:
ctx opencode install --profile core
Profile summary:
full (default): full CTX slash-command surface plus the live right-sidebar CTX Dashboardcore: lean daily workflow with /ctx, /ctx-doctor, /ctx-plan, /ctx-retrieve, /ctx-pack, /ctx-run, /ctx-prune-logs, /ctx-stats, and /ctx-gainInside OpenCode, start with:
/ctx
From there, the main workflow is:
/ctx-doctor
/ctx-memory-bootstrap
/ctx-plan <task>
/ctx-retrieve <query>
/ctx-read <file> [mode]
/ctx-pack <task>
/ctx-compare <task>
/ctx-run <shell command>
/ctx-gain
/ctx-dashboard
Toolbooks and reusable lessons are also first-class:
/ctx-toolbook-import <name> <file>
/ctx-toolbook-search <name> "<query>"
/ctx-toolbook-pack <name> "<task>"
/ctx-learn <key> "<body>"
For full usage, expected outputs, and CLI equivalents, see guide.md and docs/commands.md.
| Area | Current state |
|---|---|
| OpenCode integration | ctx opencode install writes opencode.json, .opencode/commands/*.md, .opencode/instructions/ctx-host-first.md, and in full profile also provisions .opencode/tui.json plus a live sidebar plugin |
| Install profiles | ctx opencode install --profile full|core lets you choose between the full CTX surface and a lean daily workflow |
| Command center | /ctx shows a categorized CTX menu and best next command |
| Planning | /ctx-plan <task> combines retrieval, graph, memory, and pack signals into an implementation plan |
| Context packing | /ctx-pack <task> builds compact task packs with graph, memory, failure, diff, and attachment signals |
| Density check | /ctx-compare <task> shows before-vs-CTX token density for one task |
| Read cache | /ctx-read <file> [mode] supports full, outline, and digest with session re-read compression |
| Delta-aware indexing | repeated ctx index runs reuse unchanged files and write index-cache summaries |
| Command compression | /ctx-run <shell command> keeps the root cause and stores the raw log |
| Gain reporting | /ctx-gain summarizes recent token savings and top repeated queries |
| Dashboard | the full profile adds a live right-sidebar CTX Dashboard, while /ctx-dashboard prints a local snapshot in-thread |
| Graph memory | bootstrap/import/search/list/get/set/delete/export project directives seeded from AGENTS.md, CLAUDE.md, CODEX.md, and Copilot instructions |
| Toolbooks | OpenCode-only /ctx-toolbook-* commands keep large CLI manuals out of AGENTS.md |
| Learning | /ctx-learn <key> "<body>" stores reusable project lessons in graph memory |
| Retrieval | hybrid graph, snippets, FTS, symbols, and semantic ranking with local fallback |
| Pruning | deterministic log and diff pruning with parser-aware diagnostics |
| MCP | local stdio MCP plus localhost HTTP JSON-RPC runtime |
| File coverage | Rust, Python, TypeScript, JavaScript, Markdown runbooks, and common config/script files |
| Privacy | local-only defaults, sensitive attachment blocking, local audit log |
Graph Memory is CTX's structured replacement for repeatedly loading whole instruction markdown files. It keeps directives local, queryable, editable, and exportable when markdown compatibility is still needed.
Instead of this:
AGENTS.mdCTX lets you do this:
/ctx-memory-bootstrap/ctx-memory-search/ctx-plan and /ctx-pack/ctx-learnWhen CTX is installed with the default full profile, OpenCode gets a live CTX Dashboard in the right sidebar.
The sidebar is meant to be a lightweight control tower for the current repo, not another verbose chat response. It auto-refreshes local runtime metrics such as:
The right-sidebar view is intentionally compact. It focuses on the live metrics that matter most instead of repeating verbose activity logs or warning blocks that are already available in the m