feat: Add compaction aggregation and pre-compaction pattern analysis (closes #81)#82
Conversation
## Issue #77: Limit parameters for verbose endpoints - Add `limit` parameter to get_tool_sequences (default: 50) - Add `limit` parameter to get_compaction_events (default: 50) - Add `limit` parameter to get_session_efficiency (default: 50) - Return total_patterns/total_compaction_count for pagination awareness - Use parameterized queries for LIMIT clauses (SQL injection prevention) ## Issue #78: Efficiency metrics in analyze_trends - Add compactions, avg_compactions_per_session to trend comparison - Add files_read_multiple_times as rework indicator - Add avg_result_mb_per_session for context consumption tracking ## Issue #79: Efficiency metrics in classify_sessions - Add efficiency object to each session with: - compaction_count, total_result_mb, files_read_multiple_times - burn_rate: "high" (>2/hr), "medium" (0.5-2/hr), "low" (<0.5/hr) ## Additional improvements - Filter non-actionable commands (pwd, cd, echo, etc.) from permission gaps - Update guide.md with new parameters and efficiency documentation - Add 6 new tests for all new functionality Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Address reviewer feedback from claude-review:
- Add --limit parameter to sequences, compactions, efficiency commands
- Show truncation info in formatters ("Showing X of Y total")
- Maintain CLI/MCP parity as required by CLAUDE.md
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…loses #81) RFC #81 implementation: - Add `aggregate` parameter to `get_compaction_events()` for session-level grouping - Add new `analyze_pre_compaction_patterns()` endpoint to identify antipatterns (consecutive reads, file rework, large results) before compactions - Update CLI with --aggregate flag and new pre-compaction-patterns command - Add benchmark entries for new functionality - Update guide.md documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolve conflicts after main updated with PR #76 changes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code ReviewSummaryAdds aggregation mode to Issues FoundCriticalNone ImportantNone Suggestions
VerdictREQUEST_CHANGES - One suggestion for handling the edge case where edit_count is zero in the read:edit ratio check. Automated review by Claude Code |
Addresses claude-review feedback: when edit_count is 0 but reads > 10, this now generates a "pure exploration pattern" recommendation instead of silently skipping the check. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Feedback AddressedImplemented
|
Code ReviewSummaryThis PR adds an Issues FoundCriticalNone ImportantNone SuggestionsNone VerdictAPPROVE - Clean implementation addressing all requirements from RFC #81. Previous review feedback (zero-edit handling) has been addressed. Tests are comprehensive, documentation is updated, and benchmark includes both new endpoints. Automated review by Claude Code |
Summary
aggregateparameter toget_compaction_events()for session-level groupinganalyze_pre_compaction_patterns()endpoint identifying antipatterns before compactionsTest plan
🤖 Generated with Claude Code