Files
rtk-ai__rtk/hooks/rtk-awareness.md
Florian BRUNIAUX 9620f66cd6 feat(init): refactor to hook-first with slim RTK.md
## Changes

**New default mode (hook + RTK.md):**
- Embed hook script in binary (include_str!)
- Write hook + chmod +x with guards (rtk/jq check before set -e)
- Write slim RTK.md (10 lines: meta commands only)
- Add @RTK.md reference to CLAUDE.md
- Print settings.json instructions (no auto-patch)

**Migration:**
- Auto-detect old <!-- rtk-instructions --> block
- Remove 137-line block, preserve user content
- Replace with @RTK.md reference

**New CLI flags:**
- `--claude-md`: Legacy mode (full injection)
- `--hook-only`: Hook only, no RTK.md
- Default (no flags): Hook + RTK.md (recommended)

**Enhanced --show:**
- Detect hook executable status (Unix)
- Detect hook guards (rtk/jq)
- Detect @RTK.md vs old block
- Show slim vs legacy mode

**Files added:**
- hooks/rtk-rewrite.sh (embedded, with guards)
- hooks/rtk-awareness.md (slim RTK.md content)

**Token savings:**
~2000 tokens → ~10 tokens in context (99.5% reduction)
Hook rewrites commands transparently (0 tokens overhead)

**Tests:** 9 new tests, all passing (236 total)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 15:11:24 +01:00

964 B

RTK - Rust Token Killer

Usage: Token-optimized CLI proxy (60-90% savings on dev operations)

Meta Commands (always use rtk directly)

rtk gain              # Show token savings analytics
rtk gain --history    # Show command usage history with savings
rtk discover          # Analyze Claude Code history for missed opportunities
rtk proxy <cmd>       # Execute raw command without filtering (for debugging)

Installation Verification

rtk --version         # Should show: rtk X.Y.Z
rtk gain              # Should work (not "command not found")
which rtk             # Verify correct binary

⚠️ Name collision: If rtk gain fails, you may have reachingforthejack/rtk (Rust Type Kit) installed instead.

Hook-Based Usage

All other commands are automatically rewritten by the Claude Code hook. Example: git status → rtk git status (transparent, 0 tokens overhead)

Refer to CLAUDE.md for full command reference.