Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ rtk gain # MUST show token savings, not "command not found"
No hook, no global effect
```

**Using Codex CLI instead?**

```bash
rtk init --codex # Local AGENTS.md + RTK.md
rtk init -g --codex # ~/.codex/AGENTS.md + ~/.codex/RTK.md
rtk init --show --codex # Verify Codex setup
```

Codex support is awareness-based: RTK adds concise instructions, and Codex should prefer explicit `rtk ...` commands. It does **not** patch a hook registry like Claude Code.

### Recommended: Global Hook-First Setup

**Best for: All projects, automatic RTK usage**
Expand Down Expand Up @@ -148,6 +158,34 @@ rtk init # Creates ./CLAUDE.md with full RTK instructions (137 lines)

**Token savings**: Instructions loaded only for this project

### Codex CLI Setup

**Best for: Codex CLI users who want RTK awareness without Claude hook patching**

```bash
# Global Codex setup
rtk init -g --codex
# → Creates ~/.codex/RTK.md
# → Adds @RTK.md reference to ~/.codex/AGENTS.md

# Project-local Codex setup
rtk init --codex
# → Creates ./RTK.md
# → Adds @RTK.md reference to ./AGENTS.md

# Verify
rtk init --show --codex
```

**Usage pattern in Codex**:
```bash
rtk git status
rtk git diff
rtk read file.rs
rtk grep "pattern" .
rtk cargo test
```

### Upgrading from Previous Version

#### From old 137-line CLAUDE.md injection (pre-0.22)
Expand Down Expand Up @@ -210,6 +248,24 @@ rtk init -g --no-patch
# Restart Claude Code
```

### Codex CLI User
```bash
# 1. Install RTK
brew install rtk
rtk gain # Verify (must show token stats)

# 2. Setup for Codex
rtk init -g --codex

# 3. Verify
rtk init --show --codex

# 4. In Codex sessions, prefer explicit rtk commands
rtk git status
rtk read README.md
rtk cargo test
```

### Temporary Trial
```bash
# Install hook
Expand Down Expand Up @@ -255,6 +311,16 @@ rtk init -g --uninstall
# Restart Claude Code after uninstall
```

**Codex CLI global uninstall:**

```bash
rtk init -g --codex --uninstall

# What gets removed:
# - Context: ~/.codex/RTK.md
# - Reference: @RTK.md line from ~/.codex/AGENTS.md
```

**For Local Projects**: Manually remove RTK block from `./CLAUDE.md`

### Binary Removal
Expand Down
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ rtk init --global
# Follow instructions to register in ~/.claude/settings.json
# Claude Code only by default (use --opencode for OpenCode, --gemini for Gemini CLI)

# Codex CLI (awareness mode, no hook patching)
rtk init -g --codex
# Creates ~/.codex/RTK.md and adds @RTK.md to ~/.codex/AGENTS.md
# Then prefer explicit rtk commands such as: rtk git status

# 2. Restart Claude Code, then test
git status # Automatically rewritten to rtk git status
```
Expand Down Expand Up @@ -330,6 +335,38 @@ mkdir -p ~/.config/opencode/plugins
cp hooks/opencode-rtk.ts ~/.config/opencode/plugins/rtk.ts
```

## Codex CLI Support (Global or Local)

RTK supports Codex CLI through lightweight awareness files rather than hook-based command rewriting.

**Install for Codex CLI:**
```bash
rtk init --codex # Configure local AGENTS.md + RTK.md
rtk init -g --codex # Configure ~/.codex/AGENTS.md + ~/.codex/RTK.md
rtk init --show --codex # Verify current Codex configuration
```

**What it creates:**
- `RTK.md` with concise Codex-specific RTK guidance
- `@RTK.md` reference in `AGENTS.md`

**How to use it in Codex:**
```bash
rtk git status
rtk git diff
rtk read src/main.rs
rtk grep "pattern" .
rtk cargo test
rtk pytest
```

**Behavior note:** unlike Claude Code, Gemini CLI, and OpenCode, Codex support is instruction-based today. Use explicit `rtk ...` commands for the highest reliability.

**Uninstall:**
```bash
rtk init -g --codex --uninstall
```

### Commands Rewritten

| Raw Command | Rewritten To |
Expand Down
10 changes: 9 additions & 1 deletion hooks/rtk-awareness-codex.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# RTK - Rust Token Killer (Codex CLI)

**Usage**: Token-optimized CLI proxy for shell commands.
**Usage**: Token-optimized CLI proxy for shell-heavy commands in Codex.

Prefer explicit `rtk ...` commands for noisy shell output.

## Rule

Always prefix shell commands with `rtk`.

Use raw shell commands only when you need exact unfiltered output, exact line slices, or exact patch hunks.

Examples:

```bash
rtk git status
rtk git diff
rtk read src/main.rs
rtk grep "pattern" .
rtk cargo test
rtk npm run build
rtk pytest -q
Expand All @@ -28,5 +35,6 @@ rtk proxy <cmd> # Run raw command without filtering
```bash
rtk --version
rtk gain
rtk init --show --codex
which rtk
```
Loading