Skip to content

Comments

docs: add session summary hook as companion tool#143

Open
FlorianBruniaux wants to merge 2 commits intomasterfrom
docs/session-summary-companion
Open

docs: add session summary hook as companion tool#143
FlorianBruniaux wants to merge 2 commits intomasterfrom
docs/session-summary-companion

Conversation

@FlorianBruniaux
Copy link
Collaborator

Summary

  • Adds a "Companion Tools" section to README.md documenting the Session Summary hook as a recommended companion for automatic RTK savings visibility
  • Includes install instructions (curl + settings.json config) and example output
  • Addresses the gap where RTK tracks savings but users must manually run rtk gain to see them

Closes #142 (Option C: Documentation + reference)

Context

4 open issues on anthropics/claude-code request session analytics visibility (#1109, #18550, #16373, #22625) — Anthropic hasn't shipped anything. The community-built Session Summary hook already solves this with 15 configurable analytics sections, including per-session RTK token savings.

Test plan

  • Verify README renders correctly on GitHub
  • Verify curl URLs resolve to actual hook scripts
  • Verify settings.json snippet is valid JSON

🤖 Generated with Claude Code

…vings visibility

Closes #142

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 16, 2026 08:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds documentation for a community-built Session Summary hook as a companion tool for RTK, implementing "Option C" from issue #142. The documentation enables users to automatically see their RTK token savings at the end of each Claude Code session without manually running rtk gain.

Changes:

  • Adds a new "Companion Tools" section to README.md with installation instructions and usage examples for the Session Summary hook
  • Documents the two-hook system (SessionStart baseline capture + Stop/SessionEnd summary display) with curl-based installation
  • Includes JSON configuration snippet for settings.json and example output showing per-session RTK savings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


**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
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent hook name: the text says "A SessionEnd hook" but the JSON configuration on line 740 uses "Stop" as the hook name. These should match for clarity. Based on the JSON example being the actual configuration, consider changing this line to say "A Stop hook" or add a note that Stop is the hook event name that runs at session end.

Suggested change
2. A `SessionEnd` hook computes the per-session delta and displays it
2. A `Stop` hook (session end) computes the per-session delta and displays it

Copilot uses AI. Check for mistakes.
Comment on lines +733 to +747
{
"hooks": {
"SessionStart": [
{
"hooks": [{ "type": "command", "command": "~/.claude/hooks/rtk-baseline.sh" }]
}
],
"Stop": [
{
"hooks": [{ "type": "command", "command": "~/.claude/hooks/session-summary.sh", "timeout": 10000 }]
}
]
}
}
```
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSON structure shown here has inconsistent nesting compared to the PreToolUse hook examples elsewhere in the README (lines 495-511). The PreToolUse hooks include a "matcher" field at the same level as "hooks", but this configuration omits it. Verify whether SessionStart and Stop hooks require or support a matcher field. If they don't require it, the current structure is correct; if they do, a matcher should be added for consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +728 to +729
# 2. Add to ~/.claude/settings.json (merge with existing hooks)
```
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instruction says "merge with existing hooks" but the JSON example shows a complete hooks object structure that would replace existing hooks if copied as-is. Consider clarifying the merge instructions, such as: "If you already have hooks configured, add these SessionStart and Stop arrays to your existing hooks object. If you don't have any hooks yet, you can use this complete structure."

Copilot uses AI. Check for mistakes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
```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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we directly integrate this ?

@pszymkowiak
Copy link
Collaborator

we need to reduce or restructure the readme . it's too massive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: integrate session summary hook for end-of-session analytics

2 participants