# Ctx

Use ctx as working memory for prior agent work.

- Repository: https://github.com/ctxrs/ctx (1175 stars)
- Category: AI and agents
- License: Apache-2.0
- Last updated: 2026-10-27
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add ctxrs/ctx --skill ctx -g -a claude-code -y`
Codex: `npx skills add ctxrs/ctx --skill ctx -g -a codex -y`
Cursor: `npx skills add ctxrs/ctx --skill ctx -g -a cursor -y`
Gemini CLI: `npx skills add ctxrs/ctx --skill ctx -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add ctxrs/ctx`

## Description

Use ctx as working memory for prior agent work. Before starting or continuing work in an unfamiliar area, resuming earlier work, or revisiting an investigation, search prior sessions to ground yourself in earlier context. Use ctx blame to trace a line, file, commit, or PR to the agent session that produced it. Use when prior decisions, constraints, attempts, tool calls, transcript evidence, or code provenance may matter. Use ctx graph queries on indexed projects to follow calls and dependencies and understand what a change might affect.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# ctx

Use ctx to ground your work in relevant prior agent sessions. Search history
for decisions and attempts, trace provenance with blame, and inspect code
relationships with the graph. ctx retrieves evidence; you perform the analysis.

## Choose the operation

- Prior work, decisions or errors: `ctx search "<query>"`.
- Which session produced code: `ctx blame file <path>` or
  `ctx blame commit <sha>`; PR targets are also supported.
- Code relationships or potential impact: `ctx graph search <symbol>`,
  `ctx graph callers <symbol>`, or `ctx graph impact <symbol>`.
- Requested or explicitly opted-in output compaction: `ctx sift -- PROGRAM
  ARG...` for a command, or `ctx sift compact <file>` for existing output.

These commands are built into the installed ctx executable. Graph and output
commands do not require history setup. Only history search and blame need
indexed agent history: inspect `ctx status` and `ctx sources`; run `ctx setup`
if history has not been initialized. First indexing can take time.
If ctx or relevant evidence is unavailable, state the limit rather than
inventing results.

Read documentation on demand instead of guessing flags or behavior:

```bash
ctx docs show unified-context
ctx docs search "<topic>"
ctx docs show <topic>
ctx <command> --help
```

Installed help and embedded docs match the executable. For installation, see
[ctx.rs](https://ctx.rs); install tools only when appropriate to the task.

## History and blame

Before starting or continuing unfamiliar work, search for relevant earlier
decisions, constraints, failed attempts and evidence. Start with normal language,
then narrow by workspace, file, time or session:

```bash
ctx search "<query>" --workspace <workspace> --since 30d
ctx search "<query>" --file <path>
ctx search "<query>" --session <ctx-session-id>
ctx show event <ctx-event-id> --window 5
ctx show session <ctx-session-id>
ctx locate session <ctx-session-id>
```

The rest: https://github.com/ctxrs/ctx/blob/HEAD/plugins/ctx/skills/ctx/SKILL.md
