跳转到内容

快速上手

CtxCtl 让文件和命令输出在到达模型之前就变小。你的 agent 只读需要的符号——通过 tree-sitter AST 定位再映射回原始源码切片——并把命令输出压缩为关键行加头尾摘要。

Terminal window
cargo install ctxctl
Terminal window
npm install -g ctxctl
# or
bun add -g ctxctl

GitHub releases 页面 下载对应平台的预编译二进制——release 同时提供 .deb.rpm.apk 和 Arch 包。

Terminal window
ctxctl outline src/main.rs # symbol map + savings
ctxctl symbol src/main.rs --name run --compact # one symbol, body folded
ctxctl read src/main.rs --lines 40-80 # raw line slices
ctxctl deps src/main.rs # import graph (local/external)
ctxctl exec "cargo test" --keep "FAILED|passed" # run + compress output
ctxctl outline src/main.rs --json # machine contract

不整文件倾倒,不堆原始日志。输出确定性强——相同输入产出相同字节,缓存持续命中。

CtxCtl 是无状态的:配置文件只保存默认行为偏好。查找优先级从高到低:

  1. --config <path>(显式指定)
  2. .ctxctl/config.toml(项目级,像 .git 一样向上逐级查找)
  3. $XDG_CONFIG_HOME/ctxctl/config.toml(XDG 全局)
  4. 内置默认值

加载 ctxctl-core skill,让你的编程代理主动使用符号切片和压缩输出:

Terminal window
# List available skills
npx skills add Xuepoo/ctxctl-skills --list
# Install the core skill for all detected agents
npx skills add Xuepoo/ctxctl-skills --all

或者不安装、直接试用一次:

Terminal window
npx skills use Xuepoo/ctxctl-skills --skill ctxctl-core

skill 赋予代理对 outline / symbol / read / deps / exec 工作流的一等感知——每个任务更少 token,运行更友好地命中缓存。

MCP 原生代理可以完全跳过 skill,把 ctxctl 当作原生工具调用;见 MCP 适配器