Skip to content

feat: Reduce MCP tool token overhead (~72% reduction)#85

Merged
evansenter merged 3 commits into
mainfrom
issue-84-reduce-mcp-token-overhead
Jan 11, 2026
Merged

feat: Reduce MCP tool token overhead (~72% reduction)#85
evansenter merged 3 commits into
mainfrom
issue-84-reduce-mcp-token-overhead

Conversation

@evansenter

Copy link
Copy Markdown
Owner

Summary

  • Remove 7 never-used MCP tools to reduce token overhead
  • Trim all 30 remaining tool docstrings (21,983 → 6,197 chars, ~72% reduction)
  • Consolidate git functionality: add all_projects param to ingest_git_history with auto-correlation
  • Add MCP docstring authoring guidance to CLAUDE.md for future tools

Test plan

  • All tests pass (make check)
  • Verified tool count reduced from 37 to 30
  • Verified docstring chars reduced from 21,983 to 6,197
  • CLI backward compatibility preserved (underlying functions kept)
  • Updated test for ingest_git_history verifies auto-correlation

Closes #84

🤖 Generated with Claude Code

evansenter and others added 2 commits January 11, 2026 21:26
Implements RFC #84 to reduce MCP tool token overhead:

- Remove 7 never-used tools: get_languages, get_command_frequency,
  ingest_bus_events, get_bus_events, get_pre_compaction_events,
  analyze_pre_compaction_patterns, correlate_git_with_sessions,
  ingest_git_history_all_projects
- Trim all 30 remaining tool docstrings (21,983 → 6,197 chars)
- Consolidate git ingestion: add all_projects param to ingest_git_history
  with auto-correlation
- Update CLI with --all-projects flag, preserve backward compatibility
- Add MCP docstring authoring guidance to CLAUDE.md

Closes #84

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@claude

claude Bot commented Jan 11, 2026

Copy link
Copy Markdown

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

Code Review

Summary

This PR reduces MCP tool token overhead by ~72% (21,983 → 6,197 chars) by trimming docstrings, removing 7 never-used tools, and consolidating git functionality with auto-correlation. It also adds docstring authoring guidance to CLAUDE.md.

Issues Found

Critical

None

Important

None

Suggestions

  • src/session_analytics/cli.py:1141-1155 - The CLI cmd_git_ingest function now always runs correlation after ingestion, but the correlation result is nested under result["correlation"] while the CLI uses format_output(result, args.json). Consider whether the formatter handles this nested structure clearly for non-JSON output, or if users would benefit from a separate "Correlation:" section in the formatted output.

  • src/session_analytics/guide.md:117 - The git integration docs say ingest_git_history(all_projects=True, days=30) but the function signature in server.py shows the parameter order as repo_path, days, project_path, all_projects. While Python allows keyword arguments, the guide could match the actual signature order for consistency: ingest_git_history(days=30, all_projects=True).

Verdict

REQUEST_CHANGES - Two minor suggestions for documentation consistency and output clarity.


Automated review by Claude Code

@claude

claude Bot commented Jan 11, 2026

Copy link
Copy Markdown

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

Code Review

Summary

This PR reduces MCP tool token overhead by ~72% (21,983 → 6,197 chars) through removing 7 never-used tools, trimming 30 remaining docstrings, and consolidating git functionality into a single ingest_git_history tool with an all_projects parameter.

Issues Found

Critical

None

Important

None

Suggestions

  • src/session_analytics/cli.py:1153 - The cmd_git_ingest function now always runs correlation after ingestion. Consider if this should be conditional based on whether there are actually commits to correlate (i.e., check if commits_added > 0 before calling correlate_git_with_sessions), though the overhead may be negligible.

  • CLAUDE.md:81-105 - The CLAUDE.md docstring guidance section says guide.md is the "canonical reference" in the diff, but the version in the repo says "comprehensive reference". While both convey the same meaning, consider using consistent terminology since both appear in the same project documentation.

Verdict

REQUEST_CHANGES - Two minor suggestions for consideration.


Automated review by Claude Code

Show only commonly-used parameters (days, all_projects) in table.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@evansenter

Copy link
Copy Markdown
Owner Author

Feedback Addressed

Implemented

  • [Suggestion] guide.md:117 - Simplified parameter display to show commonly-used params (days, all_projects)

Skipped

  • [Suggestion] cli.py:1141-1155 - CLI nested correlation output - current formatting handles nested dicts fine
  • [Suggestion] cli.py:1153 - Conditional correlation check - overhead is negligible (~1ms), consistent behavior is cleaner
  • [Suggestion] CLAUDE.md:81-105 - Terminology already updated to "canonical reference" in earlier commit

@claude

claude Bot commented Jan 11, 2026

Copy link
Copy Markdown

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

Code Review

Summary

This PR reduces MCP tool token overhead by ~72% (21,983 → 6,197 chars) by removing 7 never-used tools, trimming 30 remaining docstrings, and consolidating git functionality with auto-correlation. It also adds docstring authoring guidance to CLAUDE.md.

Issues Found

Critical

None

Important

None

Suggestions

None

Previously Addressed (Filtered)

  • guide.md:117 - Parameter display (Implemented: simplified to show commonly-used params)
  • cli.py:1141-1155 - CLI nested correlation output (Skipped: formatting handles nested dicts)
  • cli.py:1153 - Conditional correlation check (Skipped: negligible overhead)
  • CLAUDE.md:81-105 - Terminology consistency (Skipped: already "canonical reference")

4 items from prior feedback rounds were not re-raised.

Verdict

APPROVE - Code looks good, no issues found. The PR thoroughly addresses issue #84 requirements: Phase 1 (docstring trimming), Phase 2 (removing never-used tools), Phase 3 (removing redundant get_command_frequency), and the git consolidation work. Tests are properly updated, CLI maintains backward compatibility, and guide.md is updated to reflect the changes.


Automated review by Claude Code

@evansenter evansenter merged commit 7a01359 into main Jan 11, 2026
3 checks passed
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.

RFC: Reduce MCP tool token overhead (~60% reduction)

1 participant