# ctx — Claude Code plugin
Code intelligence for AI-assisted development, generated by
`ctx harness init --mode plugin` (ctx v{{CTX_VERSION}}).
This plugin wires the [ctx](https://github.com/agentis-tools/ctx) CLI into
Claude Code:
- **Hooks** — `SessionStart` prints a token-budgeted codebase map,
`PostToolUse` (Edit|Write) reindexes and checks architecture rules,
`Stop` prints a quality scorecard. All hooks fail open: if the installed
`ctx` binary is missing or older than these templates, they warn on stderr
and do nothing.
- **Skill** (`skills/ctx/SKILL.md`) — teaches the model when and how to use
the ctx commands (index, map, check, duplicates, similar, hotspots, score).
- **MCP server** (`.mcp.json`, if present) — exposes ctx's code intelligence
tools over the Model Context Protocol. Requires a ctx build with the `mcp`
feature: `cargo install agentis-ctx --features mcp`.
- **Permissions** (`settings.json`) — allows `Bash(ctx *)` while denying
self-updates and edits to `.ctx/rules.toml`, the generated hooks, and
`.claude/settings.json`.
## Requirements
- `ctx` v{{CTX_VERSION}} or newer on `PATH`
- An indexed project: run `ctx index` in the repository root
## Install (local marketplace)
### From GitHub
Install the released plugin ZIP for a session:
```bash
claude --plugin-url https://github.com/agentis-tools/ctx/releases/download/v{{CTX_VERSION}}/ctx-claude-plugin-{{CTX_VERSION}}.zip
```
Or clone the repository and load the canonical plugin directly:
```bash
claude --plugin-dir ./plugins/claude/ctx
```
The plugin runs locally and invokes only the installed `ctx` binary. Nothing
leaves the machine unless you separately build ctx with `--features mcp` and
configure an MCP client to use it.
### From a local checkout
From the directory containing this plugin:
1. Start Claude Code:
```bash
claude
```
2. Add this directory as a local marketplace:
```
/plugin marketplace add ./
```
3. Install the plugin from it:
```
/plugin install ctx@ctx-local
```
4. Verify: run `/plugin` and confirm **ctx** is enabled, then start a new
session — the SessionStart hook should print a codebase map, and the
**ctx** skill should appear in the skills list.
## Regenerating
All files here are generated from templates embedded in the ctx binary.
After updating ctx, rerun:
```bash
ctx harness init --mode plugin
```
Files you have modified are skipped with a warning (use `--force` to
overwrite them); `.ctx/rules.toml` is never overwritten.