Skill:ctx

Instant recall for coding agents. Search the history already on your machine. Git blame, but for agent sessions.

适用场景

会议协作

适合角色

介绍

以下内容整理自开源仓库 `ctxrs/ctx` 的 README / SKILL.md 摘要:

<img src="docs/assets/ctx-readme-banner.png" alt="You have months of coding agent history on your machine. Search it with ctx." width="100%">

ctx is an open-source CLI for fast local search across your past coding agent sessions.

Coding agents usually start from zero. They can inspect the current repo, but they often cannot recover the discussions, decisions, failed attempts, commands, and test results from earlier work.

Those sessions are full of useful context:

- decisions, constraints, intent, and rejected approaches from you
- bug investigations, refactors, file paths, commands, patches, and notes from previous agents

ctx indexes those logs into a local search index on your machine, then gives current and future agents a CLI for finding the prior discussion, command, or failed attempt before they repeat it.

## Install and set up ctx

macOS and Linux:
```bash
curl -fsSL https://ctx.rs/install | sh
```

Windows PowerShell:
```powershell
irm https://ctx.rs/install.ps1 | iex
```

FreeBSD does not receive a prebuilt release binary. Build it from source with
the repository's Bazel target; FreeBSD support is best effort and does not
block releases. See [source builds](docs/unmanaged-installs.md#source-builds).

or prompt your agent:
```
Please install and set up ctx CLI (see github.com/ctxrs/ctx)
```

## 50x more token-efficient than raw transcript search

By structuring agent history into sessions, events, metadata, and indexed fields, then returning ranked cited matches, agents can access meaningful history with far fewer tokens than raw search. Results vary by query and corpus, but raw search is often so token-heavy that it can be effectively the same as not having usable history.

<img src="docs/assets/ctx-token-efficiency-chart.png" alt="Token output per agent history search: ctx search 917 tokens, raw transcript search 45,734 tokens." width="100%">

## How it works

Your past agent sessions are stored in local provider history files. ctx discovers supported sources, imports the real persisted records, and publishes immutable Core/Tantivy search generations built from normalized sessions, events, and touched-file metadata.

ctx is written in Rust. Searches read the verified local Core/Tantivy generation, so they are fast, scriptable, and stay on your machine.

The index is local and private by default. Transcript text is preserved rather than hiding local paths or secret-shaped strings, so review copied output before sharing it outside the machine.

```bash
# Index all of your existing local agent sessions
ctx setup

# Your agent can search prior work with normal language
ctx search "failed migration"

# Search sessions/events that touched a file
ctx search --file crates/foo/src/lib.rs

# Or search multiple terms
ctx search --term "failed mig

---

安装方式

1. 打开仓库:https://github.com/ctxrs/ctx
2. 查找 SKILL.md 或 README 中的安装章节
3. 克隆或下载所需 Skill 子目录到本地 skills 路径(如 `.cursor/skills/` 或 `.claude/skills/`)
4. 重启 / 重载 Agent 客户端
5. 用一条真实任务验证 Skill 是否被正确加载

适用平台

  • Cursor
  • Claude
  • Codex

打开详情 · 返回技巧库