Compare commits

...
Author SHA1 Message Date
Florian BRUNIAUXandClaude Opus 4.6 ebb73e9b1d fix: update version reference to 0.18.1 in README.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 09:33:55 +01:00
Florian BRUNIAUXandClaude Opus 4.6 0bb09683bb docs: add session summary hook as companion tool for automatic RTK savings visibility
Closes #142

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 09:17:48 +01:00
+53 -1
View File
@@ -22,7 +22,7 @@ rtk filters and compresses command outputs before they reach your LLM context, s
**How to verify you have the correct rtk:**
```bash
rtk --version # Should show "rtk 0.18.0"
rtk --version # Should show "rtk 0.18.1"
rtk gain # Should show token savings stats
```
@@ -700,6 +700,58 @@ cp ~/.claude/settings.json.bak ~/.claude/settings.json
See **[TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)** for more issues and solutions.
## Companion Tools
### Session Summary Hook — Automatic RTK Savings Visibility
RTK tracks savings via `rtk gain`, but you have to run it manually. The **Session Summary hook** displays your RTK token savings automatically at every Claude Code session exit — alongside 14 other analytics sections (duration, tools, files, git diff, cost, cache, etc.).
**How it works:**
1. A `SessionStart` hook captures an RTK baseline (`rtk gain` snapshot)
2. A `SessionEnd` hook computes the per-session delta and displays it
**Example output (RTK section):**
```
🔧 RTK Savings
Commands: 41 (+33 this session)
Tokens saved: 25.3K (+12.4K this session, 73%)
```
**Install:**
```bash
# 1. Download hooks
mkdir -p ~/.claude/hooks
curl -fsSL https://raw.githubusercontent.com/FlorianBruniaux/claude-code-ultimate-guide/main/examples/hooks/bash/session-summary.sh -o ~/.claude/hooks/session-summary.sh
curl -fsSL https://raw.githubusercontent.com/FlorianBruniaux/claude-code-ultimate-guide/main/examples/hooks/bash/rtk-baseline.sh -o ~/.claude/hooks/rtk-baseline.sh
chmod +x ~/.claude/hooks/session-summary.sh ~/.claude/hooks/rtk-baseline.sh
# 2. Add to ~/.claude/settings.json (merge with existing hooks)
```
Add these entries to your `settings.json`:
```json
{
"hooks": {
"SessionStart": [
{
"hooks": [{ "type": "command", "command": "~/.claude/hooks/rtk-baseline.sh" }]
}
],
"Stop": [
{
"hooks": [{ "type": "command", "command": "~/.claude/hooks/session-summary.sh", "timeout": 10000 }]
}
]
}
}
```
**Requirements:** `jq` (`brew install jq` / `apt install jq`)
**Configuration:** All 15 sections are toggleable via environment variables or a config CLI. If RTK isn't installed, the savings section is simply hidden.
For full documentation, configuration options, and the config CLI tool, see the [Session Summary hook README](https://github.com/FlorianBruniaux/claude-code-ultimate-guide/blob/main/examples/hooks/README.md#session-summarysh-v3).
## For Maintainers
### Security Review Workflow