Skip to content

restrict tools to scope for cost savings on large repo#7

Merged
khezen merged 9 commits intomainfrom
scope_cost_saving
Feb 9, 2026
Merged

restrict tools to scope for cost savings on large repo#7
khezen merged 9 commits intomainfrom
scope_cost_saving

Conversation

@khezen
Copy link
Owner

@khezen khezen commented Feb 9, 2026

this PR aims to reduce costs on large repo by restricting MCP servers to the sub scope being reviewed.

@khezen khezen self-assigned this Feb 9, 2026
khezen

This comment was marked as outdated.

Copy link
Owner Author

@khezen khezen left a comment

Choose a reason for hiding this comment

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

🔍 CodeSpy Review

Issues Found: 0 | Critical: 0 | High: 0 | Medium: 0

📋 Summary

Restricts MCP filesystem/parser tools to scope subroot directories instead of the full repository root, reducing token consumption and cost on large monorepos. Adds helper functions for path translation between repo-relative and scope-relative coordinates, and restructures both reviewers to create/destroy tool contexts per-scope rather than once globally.

🎯 Quality Assessment

Well-structured. Clean separation of concerns: path utilities extracted to helpers, scope-restriction logic consistent across both reviewer modules. Proper resource cleanup with per-scope finally blocks. Edge cases handled ("." subroot passthrough). OSV tools correctly shared since they have no filesystem dependency. The categories input field addition is a good decoupling.

📊 Statistics
Metric Count
Total Issues 0
Critical 0
High 0
Medium 0
Low 0
Security 0
Bugs 0
Documentation 0
💰 Cost Summary

Total: $0.9618 | Tokens: 125,791 | LLM Calls: 11

Signature Cost Tokens Calls Duration
code_and_doc_review $0.7416 70,559 3 229.7s
scope_identification $0.1560 45,585 7 67.1s
summarization $0.0642 9,647 1 18.0s
💡 Recommendation

APPROVE — Correct implementation of scope-restricted tooling. No defects found. Pattern is consistent across both modules, path handling covers edge cases, and resource cleanup is properly scoped.

@khezen khezen merged commit 874d831 into main Feb 9, 2026
6 checks passed
@khezen khezen deleted the scope_cost_saving branch February 10, 2026 20:01
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

Comments