Skip to content
Merged
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
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ await get_session_stats({});
"tokenReductionPercent": 68.2,
"originalTokens": 184000,
"optimizedTokens": 58570,
"cacheHitRate": 0.72,
"cacheHitRate": 72.0,
"byTool": {
"smart_read": { "saved": 45000, "percent": 80 },
"smart_grep": { "saved": 32000, "percent": 75 }
Expand All @@ -495,20 +495,36 @@ All operations are automatically tracked in session data files:

**Location**: `~/.claude-global/hooks/data/current-session.txt`

**IMPORTANT**: This file shows operation tracking, NOT token savings:
**Format**:

```json
{
"sessionId": "abc-123",
"sessionStart": "20251031-082211",
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

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

[nitpick] Timestamp format uses 'YYYYMMDD-HHMMSS' pattern. Consider adding clarification in documentation that this represents '2025-10-31 08:22:11' to improve readability.

Copilot uses AI. Check for mistakes.
"totalOperations": 1250, // ← Number of operations
"totalTokens": 184000, // ← Cumulative token COUNT (not savings!)
"lastOptimized": 1698765432
"totalTokens": 184000, // ← Cumulative token COUNT
"lastOptimized": 1698765432,
"savings": { // ← Auto-updated every 10 operations (Issue #113)
"totalTokensSaved": 125430, // Tokens saved by compression
"tokenReductionPercent": 68.2, // Percentage of tokens saved
"originalTokens": 184000, // Original token count before optimization
"optimizedTokens": 58570, // Token count after optimization
"cacheHitRate": 42.5, // Cache hit rate percentage
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

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

[nitpick] The example shows cacheHitRate: 42.5 in the session file format, but the earlier example at line 484 shows cacheHitRate: 72.0. Using consistent example values throughout the documentation would improve clarity and reduce potential confusion.

Suggested change
"cacheHitRate": 42.5, // Cache hit rate percentage
"cacheHitRate": 72.0, // Cache hit rate percentage

Copilot uses AI. Check for mistakes.
"compressionRatio": 0.32, // Compression efficiency (lower is better)
"lastUpdated": "20251031-092500" // Last savings update timestamp
}
}
```

**To see actual token SAVINGS**, you MUST use `get_session_stats()` - the session file only tracks operation counts, not optimization results.
**New in v1.x**: The `savings` object is now automatically updated every 10 operations, eliminating the need to manually call `get_session_stats()` for real-time monitoring. This provides instant visibility into token optimization performance.

**How it works**:
- Every 10 operations, the PowerShell hooks automatically call `get_cache_stats()` MCP tool
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

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

[nitpick] The documentation mentions 'PowerShell hooks' which may not apply to all users. Consider clarifying whether this automatic update mechanism works across all platforms or is platform-specific.

Suggested change
- Every 10 operations, the PowerShell hooks automatically call `get_cache_stats()` MCP tool
- On Windows, every 10 operations, the PowerShell hooks automatically call `get_cache_stats()` MCP tool
- On other platforms, you may need to manually call `get_cache_stats()` or set up a similar hook using your preferred shell (e.g., Bash, Zsh)

Copilot uses AI. Check for mistakes.
- Savings metrics are calculated from cache performance data (compression ratio, original vs compressed sizes)
- The session file is atomically updated with the latest savings data
- If the MCP call fails, the update is skipped gracefully without blocking operations

**Note**: Detailed CSV logging with per-operation savings is planned for a future release.
**Note**: For detailed per-operation analysis, use `get_session_stats()`. The session file provides high-level aggregate metrics.

### Project-Wide Analysis

Expand Down
Loading