Skip to content

feat: Add limit parameters and efficiency metrics (closes #77, #78, #79)#80

Merged
evansenter merged 2 commits into
mainfrom
feat/efficiency-improvements
Jan 10, 2026
Merged

feat: Add limit parameters and efficiency metrics (closes #77, #78, #79)#80
evansenter merged 2 commits into
mainfrom
feat/efficiency-improvements

Conversation

@evansenter

Copy link
Copy Markdown
Owner

Summary

Changes

Limit Parameters (#77)

  • get_tool_sequences(limit=50) - returns total_patterns for pagination awareness
  • get_compaction_events(limit=50) - returns total_compaction_count for full count
  • get_session_efficiency(limit=50) - limits sessions returned
  • Uses parameterized SQL queries for LIMIT clauses (security best practice)

Efficiency Metrics in Trends (#78)

  • compactions - context reset count comparison
  • avg_compactions_per_session - normalized metric
  • files_read_multiple_times - rework indicator
  • avg_result_mb_per_session - context consumption

Efficiency Metrics in Sessions (#79)

  • Each session now includes efficiency object 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, shell builtins) from permission gaps
  • Updated guide.md documentation
  • Added 6 new tests

Test plan

  • All 371 tests pass
  • make check passes (format, lint, test)
  • CI passes

🤖 Generated with Claude Code

## 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>
@claude

claude Bot commented Jan 10, 2026

Copy link
Copy Markdown

Prompt: evansenter/dotfiles/.../claude-review.md

Code Review

Summary

This PR adds limit parameters to three verbose MCP endpoints (get_tool_sequences, get_compaction_events, get_session_efficiency) to prevent context overflow, and adds efficiency metrics to analyze_trends() and classify_sessions() for workflow improvement tracking. Also filters non-actionable commands from permission gaps.

Issues Found

Critical

None

Important

  • cli.py:1136-1145 (cmd_compactions) - CLI/MCP parity violation: The compactions CLI command doesn't expose the new limit parameter that was added to get_compaction_events MCP tool. Per CLAUDE.md: "Every query accessible from both interfaces." Add --limit argument similar to other commands.
  • cli.py:778-793 (cmd_sequences) - CLI/MCP parity violation: The sequences CLI command doesn't expose the new limit parameter that was added to get_tool_sequences MCP tool.
  • cli.py:1679-1682 (efficiency subparser) - CLI/MCP parity violation: The efficiency CLI command doesn't expose the new limit parameter that was added to get_session_efficiency MCP tool.

Suggestions

  • cli.py:619-636 (_format_compactions) - The formatter now has access to total_compaction_count but doesn't display it. Consider showing "Showing X of Y total compactions" when results are truncated, helping users understand there's more data available.

Verdict

REQUEST_CHANGES - CLI commands need --limit parameters to maintain parity with MCP tools as required by CLAUDE.md.


Automated review by Claude Code

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>
@evansenter

Copy link
Copy Markdown
Owner Author

Feedback Addressed

Implemented

  • [Important] cli.py - Added --limit parameter to sequences command for MCP parity
  • [Important] cli.py - Added --limit parameter to compactions command for MCP parity
  • [Important] cli.py - Added --limit parameter to efficiency command for MCP parity
  • [Suggestion] cli.py - Updated formatters to show "Showing X of Y total" when results are truncated

@claude

claude Bot commented Jan 10, 2026

Copy link
Copy Markdown

Prompt: evansenter/dotfiles/.../claude-review.md

Code Review

Summary

This PR adds limit parameters to three verbose MCP endpoints (get_tool_sequences, get_compaction_events, get_session_efficiency) to prevent context overflow, adds efficiency metrics to analyze_trends() and classify_sessions(), and filters non-actionable commands from permission gaps. Closes #77, #78, #79.

Previous Feedback Verified

All items from the previous review have been addressed:

  • ✅ CLI --limit parameters added to sequences, compactions, and efficiency commands
  • ✅ Formatters now show "Showing X of Y total" when results are truncated

Issues Found

Critical

None

Important

None

Suggestions

None

Verdict

APPROVE - Code looks good, no issues found. The implementation correctly addresses all three linked issues:

Test coverage is comprehensive with 6 new tests covering all the new functionality.


Automated review by Claude Code

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.

1 participant