[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-3512":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":38,"readmeContent":39,"aiSummary":40,"trendingCount":16,"starSnapshotCount":16,"syncStatus":14,"lastSyncTime":41,"discoverSource":42},3512,"CTX","Alegau03\u002FCTX","Alegau03","CTX - Context Runtime Engine for Coding Agents","",null,"Rust",135,11,2,1,0,16,3.24,false,"main",true,[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"ai-agent","ai-agents","ai-tools","chatgpt","claude","context-engineering","context-management","developer-tools","mcp","mcp-server","open-source","opencode","optimization","rust","token-optimization","2026-06-12 02:00:51","\u003Cdiv align=\"center\">\n\n\u003Ch1>CTX\u003C\u002Fh1>\n\n\u003Ch3>The context layer for AI coding agents\u003C\u002Fh3>\n\n\u003Cp>\u003Cstrong>Reduce token waste in OpenCode and AI coding workflows with graph memory, compact task packs, read-cache compression, command pruning, and a live right-sidebar dashboard.\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Cp>OpenCode-first runtime · Local MCP tools · Read cache + delta-aware indexing · Single Rust binary\u003C\u002Fp>\n\n\u003Cp>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCI-ready-22c55e?style=flat-square\" alt=\"CI ready\" \u002F>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flocal--first-yes-0f172a?style=flat-square\" alt=\"Local first\" \u002F>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Ftelemetry-local-2563eb?style=flat-square\" alt=\"Telemetry local\" \u002F>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-f43f5e?style=flat-square\" alt=\"MIT license\" \u002F>\n\u003C\u002Fp>\n\n\u003Cp>\n  \u003Ca href=\"#install-ctx\">Install\u003C\u002Fa> ·\n  \u003Ca href=\"#opencode-first-usage\">OpenCode Usage\u003C\u002Fa> ·\n  \u003Ca href=\"#ctx-dashboard\">Dashboard\u003C\u002Fa> ·\n  \u003Ca href=\"#proof-from-the-demo-fixture\">Benchmarks\u003C\u002Fa> ·\n  \u003Ca href=\"#documentation\">Docs\u003C\u002Fa> ·\n  \u003Ca href=\"#security\">Security\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003C\u002Fdiv>\n\n> CTX 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.\n\n## See It In Action\n\n| Install + Bootstrap | Planning + Packing | Read Cache + Dashboard |\n|---|---|---|\n| ![Install + Bootstrap](docs\u002Fassets\u002Fgif1.gif) | ![Planning + Packing](docs\u002Fassets\u002Fgif2.gif) | ![Read Cache + Dashboard](docs\u002Fassets\u002Fgif3.gif) |\n| 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. |\n\n## Contents\n\n- [What CTX Is](#what-ctx-is)\n- [Why It Exists](#why-it-exists)\n- [Install CTX](#install-ctx)\n- [OpenCode-First Usage](#opencode-first-usage)\n- [What Works Today](#what-works-today)\n- [Graph Memory](#graph-memory)\n- [CTX Dashboard](#ctx-dashboard)\n- [Proof From The Demo Fixture](#proof-from-the-demo-fixture)\n- [Demo And Screenshots](#demo-and-screenshots)\n- [Security](#security)\n- [Documentation](#documentation)\n- [Repository Layout](#repository-layout)\n\n## What CTX Is\n\nCTX 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.\n\nCTX is **not** another agent launcher.\n\n- OpenCode keeps the selected model, provider, and normal workflow.\n- CTX sits underneath as the context layer.\n- The product surface is the OpenCode-native `\u002Fctx-*` experience, not wrapper-first shell workflows.\n\n## Why It Exists\n\nCoding agents usually waste tokens on things that are useful once but expensive forever.\n\n| Problem | Traditional flow | CTX flow |\n|---|---|---|\n| Project rules | Reload a full `AGENTS.md` every turn | Import rules into graph memory and retrieve only the relevant directives |\n| File rereads | Pay full price for the same file again | Re-read unchanged files through `digest` \u002F `outline` modes with local read-cache compression |\n| Noisy logs | Paste thousands of repeated lines | Run `\u002Fctx-run` or prune logs into root-cause signal |\n| Broad diffs | Feed huge patches | Keep only task-relevant hunks and changed symbols |\n| Repo navigation | Manual file spelunking | Query local graph, snippets, symbols, and semantic ranking |\n| Host integration | Wrapper commands outside the agent | OpenCode-native `\u002Fctx-*` commands plus local MCP tools |\n\n## Install CTX\n\nInstall CTX with the channel that fits your workflow best:\n\n- `cargo install ctx-cli`\n- one-line installer script\n- GitHub Release archives\n- `npm i -g @alegau\u002Fctx-bin`\n- `brew tap Alegau03\u002Fctx && brew install ctx`\n\nUpdate paths:\n\n- `ctx update`\n- `ctx update --check`\n- `cargo install ctx-cli --force`\n- rerun the installer script\n- `npm update -g @alegau\u002Fctx-bin`\n- `brew upgrade ctx`\n\n### Cargo\n\n```bash\ncargo install ctx-cli\n```\n\n### One-Line Installer\n\n```bash\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002FAlegau03\u002FCTX\u002Fmain\u002Fscripts\u002Finstall.sh | sh\n```\n\n### npm\n\n```bash\nnpm i -g @alegau\u002Fctx-bin\n```\n\n### Homebrew\n\n```bash\nbrew tap Alegau03\u002Fctx\nbrew install ctx\n```\n\n### Source Install\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FAlegau03\u002FCTX.git\ncd CTX\ncargo install --locked --path crates\u002Fctx-cli\n```\n\nVerify:\n\n```bash\nctx help\nctx doctor\nctx update --check\n```\n\nNative update command:\n\n```bash\nctx update\n```\n\nHow `ctx update` behaves:\n\n- installer-based installs: reruns the official installer path\n- Cargo installs: prints `cargo install ctx-cli --force`\n- npm installs: prints `npm update -g @alegau\u002Fctx-bin`\n- Homebrew installs: prints `brew upgrade ctx`\n- ambiguous installs: prints all supported update commands without guessing\n\n### GitHub Release Archive\n\nDownload the latest assets from [GitHub Releases](https:\u002F\u002Fgithub.com\u002FAlegau03\u002FCTX\u002Freleases), then run:\n\n```bash\nshasum -a 256 -c SHA256SUMS\ntar -xzf ctx-0.2.5-aarch64-apple-darwin.tar.gz\nmkdir -p \"$HOME\u002F.local\u002Fbin\"\ninstall -m 0755 ctx-0.2.5-aarch64-apple-darwin\u002Fctx \"$HOME\u002F.local\u002Fbin\u002Fctx\"\nexport PATH=\"$HOME\u002F.local\u002Fbin:$PATH\"\n```\n\nIf you prefer a system-wide install:\n\n```bash\nsudo install -m 0755 ctx-0.2.5-aarch64-apple-darwin\u002Fctx \u002Fusr\u002Flocal\u002Fbin\u002Fctx\n```\n\nFor the full install matrix, release verification notes, native update behavior, and distribution details, see [docs\u002Finstall.md](docs\u002Finstall.md).\n\n## OpenCode-First Usage\n\nOnce `ctx` is installed, enable it in any project:\n\n```bash\ncd \u002Fpath\u002Fto\u002Fyour\u002Fproject\nctx init\nctx index\nctx opencode install\nopencode\n```\n\nIf you want the leanest possible OpenCode surface first:\n\n```bash\nctx opencode install --profile core\n```\n\nProfile summary:\n\n- `full` (default): full CTX slash-command surface plus the live right-sidebar `CTX Dashboard`\n- `core`: lean daily workflow with `\u002Fctx`, `\u002Fctx-doctor`, `\u002Fctx-plan`, `\u002Fctx-retrieve`, `\u002Fctx-pack`, `\u002Fctx-run`, `\u002Fctx-prune-logs`, `\u002Fctx-stats`, and `\u002Fctx-gain`\n\nInside OpenCode, start with:\n\n```text\n\u002Fctx\n```\n\nFrom there, the main workflow is:\n\n```text\n\u002Fctx-doctor\n\u002Fctx-memory-bootstrap\n\u002Fctx-plan \u003Ctask>\n\u002Fctx-retrieve \u003Cquery>\n\u002Fctx-read \u003Cfile> [mode]\n\u002Fctx-pack \u003Ctask>\n\u002Fctx-compare \u003Ctask>\n\u002Fctx-run \u003Cshell command>\n\u002Fctx-gain\n\u002Fctx-dashboard\n```\n\nToolbooks and reusable lessons are also first-class:\n\n```text\n\u002Fctx-toolbook-import \u003Cname> \u003Cfile>\n\u002Fctx-toolbook-search \u003Cname> \"\u003Cquery>\"\n\u002Fctx-toolbook-pack \u003Cname> \"\u003Ctask>\"\n\u002Fctx-learn \u003Ckey> \"\u003Cbody>\"\n```\n\nFor full usage, expected outputs, and CLI equivalents, see [guide.md](guide.md) and [docs\u002Fcommands.md](docs\u002Fcommands.md).\n\n## What Works Today\n\n| Area | Current state |\n|---|---|\n| OpenCode integration | `ctx opencode install` writes `opencode.json`, `.opencode\u002Fcommands\u002F*.md`, `.opencode\u002Finstructions\u002Fctx-host-first.md`, and in `full` profile also provisions `.opencode\u002Ftui.json` plus a live sidebar plugin |\n| Install profiles | `ctx opencode install --profile full|core` lets you choose between the full CTX surface and a lean daily workflow |\n| Command center | `\u002Fctx` shows a categorized CTX menu and best next command |\n| Planning | `\u002Fctx-plan \u003Ctask>` combines retrieval, graph, memory, and pack signals into an implementation plan |\n| Context packing | `\u002Fctx-pack \u003Ctask>` builds compact task packs with graph, memory, failure, diff, and attachment signals |\n| Density check | `\u002Fctx-compare \u003Ctask>` shows before-vs-CTX token density for one task |\n| Read cache | `\u002Fctx-read \u003Cfile> [mode]` supports `full`, `outline`, and `digest` with session re-read compression |\n| Delta-aware indexing | repeated `ctx index` runs reuse unchanged files and write index-cache summaries |\n| Command compression | `\u002Fctx-run \u003Cshell command>` keeps the root cause and stores the raw log |\n| Gain reporting | `\u002Fctx-gain` summarizes recent token savings and top repeated queries |\n| Dashboard | the `full` profile adds a live right-sidebar `CTX Dashboard`, while `\u002Fctx-dashboard` prints a local snapshot in-thread |\n| Graph memory | bootstrap\u002Fimport\u002Fsearch\u002Flist\u002Fget\u002Fset\u002Fdelete\u002Fexport project directives seeded from `AGENTS.md`, `CLAUDE.md`, `CODEX.md`, and Copilot instructions |\n| Toolbooks | OpenCode-only `\u002Fctx-toolbook-*` commands keep large CLI manuals out of `AGENTS.md` |\n| Learning | `\u002Fctx-learn \u003Ckey> \"\u003Cbody>\"` stores reusable project lessons in graph memory |\n| Retrieval | hybrid graph, snippets, FTS, symbols, and semantic ranking with local fallback |\n| Pruning | deterministic log and diff pruning with parser-aware diagnostics |\n| MCP | local stdio MCP plus localhost HTTP JSON-RPC runtime |\n| File coverage | Rust, Python, TypeScript, JavaScript, Markdown runbooks, and common config\u002Fscript files |\n| Privacy | local-only defaults, sensitive attachment blocking, local audit log |\n\n## Graph Memory\n\nGraph 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.\n\nInstead of this:\n\n- one giant `AGENTS.md`\n- every host turn re-reading it\n- unclear relevance to the active task\n\nCTX lets you do this:\n\n- import rules once with `\u002Fctx-memory-bootstrap`\n- retrieve only task-relevant directives with `\u002Fctx-memory-search`\n- fold those directives into `\u002Fctx-plan` and `\u002Fctx-pack`\n- store new lessons with `\u002Fctx-learn`\n\n## CTX Dashboard\n\nWhen CTX is installed with the default `full` profile, OpenCode gets a live `CTX Dashboard` in the right sidebar.\n\nThe 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:\n\n- total estimated tokens saved\n- average tokens saved per run\n- average and latest reduction percentages\n- read-cache hit rate\n- index-cache reuse rate\n- top current win\n- latest pack artifact\n\nThe 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 main CTX outputs.\n\nUse the `core` profile when you want the smallest possible slash-command surface and do not need the sidebar yet.\n\n## Proof From The Demo Fixture\n\nThe committed demo benchmark compares a traditional markdown-rule flow against CTX graph memory on `demo\u002Ffixtures\u002Fopencode-auth-lab`.\n\n| Metric | Result |\n|---|---:|\n| Markdown rule tokens | `744` |\n| Graph memory tokens | `322` |\n| Token reduction | `56.72%` |\n| Query coverage | `markdown=1.00`, `graph=1.00` |\n| Markdown answer success | `33.33%` |\n| Graph memory answer success | `100.00%` |\n| Quality wins | `markdown=0`, `graph=1`, `ties=0` |\n\nReproduce it with:\n\n```bash\nscripts\u002Fdemo\u002Fopencode-auth-lab-benchmark.sh .\u002Ftarget\u002Fdebug\u002Fctx\n```\n\nEvidence files:\n\n- [benchmark report](demo\u002Ffixtures\u002Fopencode-auth-lab\u002Fbenchmarks\u002Freport.md)\n- [benchmark JSON](demo\u002Ffixtures\u002Fopencode-auth-lab\u002Fbenchmarks\u002Freport.json)\n- [demo walkthrough](docs\u002Fdemo-walkthrough.md)\n\nExternal validation is also committed in [docs\u002Fexternal-benchmark-agentsmd.md](docs\u002Fexternal-benchmark-agentsmd.md), including a public-repo snapshot with:\n\n- token reduction `72.62%`\n- query coverage `markdown=1.00`, `graph=0.89`\n- success rate `markdown=0.50`, `graph=1.00`\n- quality wins `markdown=0`, `graph=1`, `ties=0`\n\n## Demo And Screenshots\n\n| Media Slot | Suggested Asset |\n|---|---|\n| Hero GIF | full install -> `ctx init` -> `ctx index` -> `ctx opencode install` -> `\u002Fctx` |\n| Sidebar GIF | live right-sidebar `CTX Dashboard` refreshing after `\u002Fctx-pack` and `\u002Fctx-read` |\n| Command GIF | `\u002Fctx-plan`, `\u002Fctx-pack`, `\u002Fctx-compare`, `\u002Fctx-run` |\n| Static Screenshot | `CTX Dashboard` in OpenCode right sidebar |\n\n| Asset | Status |\n|---|---|\n| Fixture project | `demo\u002Ffixtures\u002Fopencode-auth-lab` is committed |\n| Automated smoke | `scripts\u002Fdemo\u002Fopencode-auth-lab-smoke.sh` |\n| MCP smoke | `scripts\u002Fdemo\u002Fopencode-auth-lab-mcp-smoke.sh` |\n| Benchmark smoke | `scripts\u002Fdemo\u002Fopencode-auth-lab-benchmark.sh` |\n| Demo walkthrough | [docs\u002Fdemo-walkthrough.md](docs\u002Fdemo-walkthrough.md) |\n| Recording script | [docs\u002Fdemo-script.md](docs\u002Fdemo-script.md) |\n| Demo video | [Watch the OpenCode demo video](https:\u002F\u002Fyoutu.be\u002FgFwGb7sCzKI) |\n\n## Security\n\nCTX is local-first by default:\n\n- `local_only = true`\n- `remote_upload_enabled = false`\n- no mandatory network calls\n- `.ctx\u002Fgraph.db`, `.ctx\u002Fpacks\u002F`, `.ctx\u002Fstats\u002F`, and `.ctx\u002Faudit.log` stay local\n- sensitive-looking attachments such as `.env`, private keys, credentials, and secret files are blocked by default\n\nSee [docs\u002Fsecurity.md](docs\u002Fsecurity.md).\n\n## Documentation\n\n| File | Purpose |\n|---|---|\n| [guide.md](guide.md) | Operational OpenCode workflow, examples, expected outputs |\n| [docs\u002Fcommands.md](docs\u002Fcommands.md) | Complete CTX command syntax and explanations |\n| [docs\u002Finstall.md](docs\u002Finstall.md) | Install paths, PATH notes, release archive verification |\n| [docs\u002Fopencode-integration.md](docs\u002Fopencode-integration.md) | OpenCode integration architecture and install profiles |\n| [docs\u002Fdemo-script.md](docs\u002Fdemo-script.md) | Recording sequence for demos and walkthroughs |\n| [docs\u002Fdemo-walkthrough.md](docs\u002Fdemo-walkthrough.md) | End-to-end fixture validation |\n| [docs\u002Farchitecture.md](docs\u002Farchitecture.md) | Runtime architecture |\n| [docs\u002Fsecurity.md](docs\u002Fsecurity.md) | Privacy and trust model |\n| [docs\u002Frelease-playbook.md](docs\u002Frelease-playbook.md) | Release messaging and checklist |\n| [docs\u002Ffinal-qa.md](docs\u002Ffinal-qa.md) | Final QA gate |\n| [docs\u002Fexternal-benchmark-agentsmd.md](docs\u002Fexternal-benchmark-agentsmd.md) | Public external benchmark evidence |\n\n## Repository Layout\n\n| Path | Purpose |\n|---|---|\n| `crates\u002Fctx-cli` | `ctx` binary, OpenCode bootstrap, user-facing CLI commands |\n| `crates\u002Fctx-core` | Runtime orchestration for indexing, packing, memory, retrieval, benchmarks |\n| `crates\u002Fctx-graph` | SQLite graph, FTS, memory directives, run metadata |\n| `crates\u002Fctx-mcp` | Local MCP runtime over stdio and localhost HTTP JSON-RPC |\n| `crates\u002Fctx-pack` | Budget-aware context packing and rewriting |\n| `crates\u002Fctx-prune` | Log and diff pruning |\n| `crates\u002Fctx-ast` | Symbol extraction and code slicing |\n| `crates\u002Fctx-semantic` | Semantic ranking and local fallback embedding backend |\n| `crates\u002Fctx-telemetry` | Local stats, audit lines, benchmark summaries |\n| `demo\u002Ffixtures\u002Fopencode-auth-lab` | Realistic fixture project for smoke tests and benchmark proof |\n| `scripts\u002Fdemo` | Demo smoke, MCP smoke, and benchmark scripts |\n| `scripts\u002Finstall.sh` | Official user-local installer script |\n| `scripts\u002Frelease` | Build, package, verify, and final QA scripts |\n| `packages\u002Fctx-bin` | npm binary package that downloads prebuilt release assets |\n| `Formula\u002Fctx.rb` | Homebrew formula source used for local tap preparation |\n","CTX是一个针对OpenCode和AI编码代理的本地上下文运行时引擎，旨在减少在这些环境中令牌的浪费。其核心功能包括图记忆存储、紧凑的任务包生成、读取缓存压缩以及命令剪枝，并提供实时右侧边栏仪表板以展示优化效果。通过使用Rust开发为单一二进制文件，CTX强调本地优先策略，支持本地MCP工具集成与增量感知索引。适用于需要高效管理代码库知识、规则重用及文件重读等场景，特别是在涉及大量AI辅助编程任务时能够显著提升性能并降低成本。","2026-06-11 02:54:40","CREATED_QUERY"]