
CTX
by Alegau03·★ 122·综合分 47
CTX是一个上下文运行时引擎,通过图记忆、紧凑任务包和缓存机制优化AI编码工作流程,减少token浪费。
概述
CTX是一个基于Rust的本地运行时层,作为OpenCode和AI编码代理的上下文引擎。它索引存储库,将可重用指导存储为图记忆,暴露本地MCP工具,并维护token节省的遥测数据。CTX通过实现图记忆、读取缓存压缩、命令修剪和紧凑上下文包等策略来解决token浪费问题。与其他代理启动器不同,CTX作为上下文层直接集成到OpenCode工作流程中。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
如果你使用 OpenCode 并需要通过智能上下文管理显著减少令牌消耗,特别是有复杂规则集或重复文件读取的场景,应该选择 CTX。
什么时候不要选它
如果你不使用 OpenCode,或者更喜欢传统的基于 markdown 的指令文件而非基于图的记忆系统,则不应选择 CTX。
此 server 暴露的工具
从 README 抽取出 12 个工具queryQuery repository knowledge with hybrid graph, snippets, FTS, symbols, and semantic ranking
read_fileRead files with compressed modes: full, outline, or digest
packBuild compact task packs with graph, memory, failure, diff, and attachment signals
planCreate implementation plans by combining retrieval, graph, memory, and pack signals
run_commandExecute shell commands with root cause extraction and log storage
learnStore reusable project lessons in graph memory
toolbook_importImport toolbooks into CTX for large CLI manuals
toolbook_searchSearch imported toolbooks for specific information
toolbook_packPack relevant toolbook sections for specific tasks
prune_logsPrune logs and shell output to extract root cause signals
get_statsRetrieve token savings and performance metrics
dashboardDisplay live CTX dashboard with local runtime metrics
说明:Tool names inferred from slash commands documented in the OpenCode usage section. The documentation mentions MCP functionality but doesn't explicitly list the MCP tool names or signatures.
可对比工具
安装
使用以下方法之一安装CTX:
# 通过Cargo安装
cargo install ctx-cli
# 一行安装器
curl -fsSL https://raw.githubusercontent.com/Alegau03/CTX/main/scripts/install.sh | sh
# 通过npm安装
npm i -g @alegau/ctx-bin
# 通过Homebrew安装
brew tap Alegau03/ctx && brew install ctx要与OpenCode集成:
cd /path/to/your/project
ctx init
ctx index
ctx opencode install
opencode对于Claude Desktop集成,添加到claude_desktop_config.json:
{
"mcpServers": {
"ctx": {
"command": "ctx",
"args": ["mcp"]
}
}
}FAQ
- CTX与其他AI编码工具有何不同?
- CTX不是另一个代理启动器,而是一个上下文运行时层,通过压缩、缓存和图记忆优化信息传递给AI模型的方式,在保留原始AI模型和工作流程的同时减少token浪费。
- CTX如何减少AI编码工作流程中的token使用?
- CTX实现了多种策略,包括用于可重用规则的图记忆、用于文件重新读取的读取缓存压缩、用于日志的命令修剪、增量感知索引以及仅包含任务相关信息的紧凑上下文包。
CTX 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。