Commit Graph

60 Commits

Author SHA1 Message Date
Fahad
f44ca326ef Breaking change: openrouter_models.json -> custom_models.json
* Support for Custom URLs and custom models, including locally hosted models such as ollama
* Support for native + openrouter + local models (i.e. dozens of models) means you can start delegating sub-tasks to particular models or work to local models such as localizations or other boring work etc.
* Several tests added
* precommit to also include untracked (new) files
* Logfile auto rollover
* Improved logging
2025-06-13 15:22:09 +04:00
Fahad
bed069826d Improvements to continuation prompts to avoid repetition and save on tokens 2025-06-13 09:44:04 +04:00
Fahad
a641159a67 Use consistent terminology
Remove test folder from .gitignore for live simulation test to pass
2025-06-13 09:28:33 +04:00
Fahad
b16f85979b Use consistent terminology 2025-06-13 09:06:12 +04:00
Fahad
c692511e69 Cleanup 2025-06-13 08:37:14 +04:00
Fahad
8abbba2d92 Improved auto mode model discovery when using OpenRouter 2025-06-13 08:35:09 +04:00
Fahad
0e36fcbc69 Final cleanup 2025-06-13 07:12:29 +04:00
Fahad
2cdb92460b WIP
- OpenRouter model configuration registry
- Model definition file for users to be able to control
- Additional tests
- Update instructions
2025-06-13 06:33:12 +04:00
Fahad
93daa2942a WIP - OpenRouter support 2025-06-12 22:45:16 +04:00
Fahad
3aedb16101 Use the new Gemini 2.5 Flash
Updated to support Thinking Tokens as a ratio of the max allowed
Updated tests
Updated README
2025-06-12 20:46:54 +04:00
Fahad
b34c63d710 Fixed web-search prompt, models can prompt claude to perform web searches on their behalf if and as needed 2025-06-12 20:05:55 +04:00
Fahad
7462599ddb Simplified thread continuations
Fixed and improved tests
2025-06-12 12:47:02 +04:00
Fahad
fb66825bf6 Rebranding, refactoring, renaming, cleanup, updated docs 2025-06-12 10:40:43 +04:00
Fahad
9a55ca8898 WIP lots of new tests and validation scenarios
Simulation tests to confirm threading and history traversal
Chain of communication and branching validation tests from live simulation
Temperature enforcement per model
2025-06-12 09:35:05 +04:00
Fahad
2a067a7f4e WIP major refactor and features 2025-06-12 07:14:59 +04:00
Fahad
22a3fb91ed feat: Add comprehensive dynamic configuration system v3.3.0
## Major Features Added

### 🎯 Dynamic Configuration System
- **Environment-aware model selection**: DEFAULT_MODEL with 'pro'/'flash' shortcuts
- **Configurable thinking modes**: DEFAULT_THINKING_MODE_THINKDEEP for extended reasoning
- **All tool schemas now dynamic**: Show actual current defaults instead of hardcoded values
- **Enhanced setup workflow**: Copy from .env.example with smart customization

### 🔧 Model & Thinking Configuration
- **Smart model resolution**: Support both shortcuts ('pro', 'flash') and full model names
- **Thinking mode optimization**: Only apply thinking budget to models that support it
- **Flash model compatibility**: Works without thinking config, still beneficial via system prompts
- **Dynamic schema descriptions**: Tool parameters show current environment values

### 🚀 Enhanced Developer Experience
- **Fail-fast Docker setup**: GEMINI_API_KEY required upfront in docker-compose
- **Comprehensive startup logging**: Shows current model and thinking mode defaults
- **Enhanced get_version tool**: Reports all dynamic configuration values
- **Better .env documentation**: Clear token consumption details and model options

### 🧪 Comprehensive Testing
- **Live model validation**: New simulator test validates Pro vs Flash thinking behavior
- **Dynamic configuration tests**: Verify environment variable overrides work correctly
- **Complete test coverage**: All 139 unit tests pass, including new model config tests

### 📋 Configuration Files Updated
- **docker-compose.yml**: Fail-fast API key validation, thinking mode support
- **setup-docker.sh**: Copy from .env.example instead of manual creation
- **.env.example**: Detailed documentation with token consumption per thinking mode
- **.gitignore**: Added test-setup/ for cleanup

### 🛠 Technical Improvements
- **Removed setup.py**: Fully Docker-based deployment (no longer needed)
- **REDIS_URL smart defaults**: Auto-configured for Docker, still configurable for dev
- **All tools updated**: Consistent dynamic model parameter descriptions
- **Enhanced error handling**: Better model resolution and validation

## Breaking Changes
- Removed setup.py (Docker-only deployment)
- Model parameter descriptions now show actual defaults (dynamic)

## Migration Guide
- Update .env files using new .env.example format
- Use 'pro'/'flash' shortcuts or full model names
- Set DEFAULT_THINKING_MODE_THINKDEEP for custom thinking depth

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-11 20:10:25 +04:00
Fahad
898373bc22 More tests 2025-06-11 18:44:34 +04:00
Fahad
ee3b9fdcd8 Always return a continuation offer 2025-06-11 18:32:23 +04:00
Fahad
4974fbc725 Extra logging and more tests 2025-06-11 18:26:13 +04:00
Fahad
e8df6a7a31 Comments 2025-06-11 17:18:40 +04:00
Fahad
780000f9c9 Lots of tests with live simulation to validate conversation continuation / preservation work across requests 2025-06-11 17:16:05 +04:00
Fahad
c90ac7561e Lots of tests with live simulation to validate conversation continuation / preservation work across requests 2025-06-11 17:03:09 +04:00
Fahad
ac763e0213 More tests 2025-06-11 14:34:51 +04:00
Fahad
98eab46abf WIP - improvements to token usage tracking, simulator added for live testing, improvements to file loading 2025-06-11 13:24:59 +04:00
Fahad
5a94737516 Fix conversation history duplication and optimize file embedding
This major refactoring addresses critical bugs in conversation history management
and significantly improves token efficiency through intelligent file embedding:

**Key Improvements:**
• Fixed conversation history duplication bug by centralizing reconstruction in server.py
• Added intelligent file filtering to prevent re-embedding files already in conversation history
• Centralized file processing logic in BaseTool._prepare_file_content_for_prompt()
• Enhanced log monitoring with better categorization and file embedding visibility
• Updated comprehensive test suite to verify new architecture and edge cases

**Architecture Changes:**
• Removed duplicate conversation history reconstruction from tools/base.py
• Conversation history now handled exclusively by server.py:reconstruct_thread_context
• All tools now use centralized file processing with automatic deduplication
• Improved token efficiency by embedding unique files only once per conversation

**Performance Benefits:**
• Reduced token usage through smart file filtering
• Eliminated redundant file embeddings in continued conversations
• Better observability with detailed debug logging for file operations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-11 11:40:12 +04:00
Fahad
94f542c76a fix: critical conversation history bug and improve Docker integration
This commit addresses several critical issues and improvements:

🔧 Critical Fixes:
- Fixed conversation history not being included when using continuation_id in AI-to-AI conversations
- Fixed test mock targeting issues preventing proper conversation memory validation
- Fixed Docker debug logging functionality with Gemini tools

🐛 Bug Fixes:
- Docker compose configuration for proper container command execution
- Test mock import targeting from utils.conversation_memory.* to tools.base.*
- Version bump to 3.1.0 reflecting significant improvements

🚀 Improvements:
- Enhanced Docker environment configuration with comprehensive logging setup
- Added cross-tool continuation documentation and examples in README
- Improved error handling and validation across all tools
- Better logging configuration with LOG_LEVEL environment variable support
- Enhanced conversation memory system documentation

🧪 Testing:
- Added comprehensive conversation history bug fix tests
- Added cross-tool continuation functionality tests
- All 132 tests now pass with proper conversation history validation
- Improved test coverage for AI-to-AI conversation threading

 Code Quality:
- Applied black, isort, and ruff formatting across entire codebase
- Enhanced inline documentation for conversation memory system
- Cleaned up temporary files and improved repository hygiene
- Better test descriptions and coverage for critical functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-11 08:53:45 +04:00
Fahad
ce23a996c6 Conversation threading test fixes 2025-06-10 20:53:20 +04:00
Fahad
7ffbfc9596 WIP - communication memory 2025-06-10 20:04:13 +04:00
Fahad
f5060367a0 WIP - communication memory 2025-06-10 19:16:51 +04:00
Fahad
bb8a101dbf cleanup: remove Windows native support, enforce WSL requirement
Remove Windows batch scripts and native setup instructions since Claude Code CLI
requires WSL on Windows. Consolidate Docker as primary recommendation across all platforms.

Changes:
- Remove setup.bat, run_gemini.bat, setup-docker-env.bat
- Remove examples/claude_config_windows.json
- Update README to clarify WSL requirement for Windows users
- Promote Docker as recommended setup for all platforms
- Update troubleshooting section for WSL-only support
- Apply code formatting fixes from ruff/black

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 16:30:58 +04:00
Fahad
1be339ecc0 enhance: improve tool prompts with better file request grounding and response guidance
- Update DEBUG_ISSUE_PROMPT to request files when diagnostics are irrelevant/incomplete
- Clarify question field to specify what information is needed from Claude/user
- Update chat tool format_response to ask Claude to continue with user's request
- Update debug tool format_response to encourage implementing fixes when root cause identified
- Fix line length formatting to comply with 120 char limit

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 14:59:18 +04:00
Fahad
032e783efb Groundings added 2025-06-10 14:39:14 +04:00
Fahad
7cb0186389 docs: update README with renamed tool names and fix syntax error
- Updated all references in README.md from old tool names to new ones:
  - think_deeper → thinkdeep
  - review_code → codereview
  - review_changes → precommit
- Fixed syntax error in base.py (unterminated f-string literal)
- Removed trailing whitespace to pass linting
- All tests now pass (96 tests)
- All linting checks pass (ruff, black, isort)

This completes the tool renaming refactor with full documentation updates.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 12:51:55 +04:00
Fahad
3d958ef7e9 feat: enhance websearch functionality with reasoning-based approach
- Changed use_websearch default from False to True for all tools
- Redesigned websearch behavior to focus on reasoning rather than direct search
- Tools now analyze when web searches would be helpful and recommend specific searches
- Updated all tool-specific websearch instructions to be more thoughtful
- Gemini will now suggest what Claude should search for and explain why

Key improvements:
- Web search is now enabled by default for better documentation awareness
- Instead of performing searches, Gemini reasons about what searches would help
- Provides specific search recommendations for Claude to execute
- More collaborative approach between Gemini and Claude

This change makes the tools more intelligent about when external information
would be valuable while keeping Claude in control of actual web searches.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 12:45:57 +04:00
Fahad
ba8f7192c3 refactor: rename think_deeper to thinkdeep for brevity
- Renamed `think_deeper` tool to `thinkdeep` for shorter, cleaner naming
- Updated all imports from ThinkDeeperTool to ThinkDeepTool
- Updated all references from THINK_DEEPER_PROMPT to THINKDEEP_PROMPT
- Updated tool registration in server.py
- Updated all test files to use new naming convention
- Updated README documentation to reflect new tool names
- All functionality remains the same, only naming has changed

This completes the tool renaming refactor for improved clarity and consistency.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 12:38:38 +04:00
Fahad
5f8ed3aae8 refactor: rename review tools for clarity and consistency
- Renamed `review_code` tool to `codereview` for better naming convention
- Renamed `review_changes` tool to `precommit` to better reflect its purpose
- Updated all tool descriptions to remove "Triggers:" sections and improve clarity
- Updated all imports and references throughout the codebase
- Renamed test files to match new tool names
- Updated server.py tool registrations
- All existing functionality preserved with improved naming

This refactoring improves code organization and makes tool purposes clearer.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 12:30:06 +04:00
Fahad
67f18ef3c9 refactor: rename debug_issue tool to debug for brevity
- Rename debug_issue.py to debug.py
- Update tool name from 'debug_issue' to 'debug' throughout codebase
- Update all references in server.py, tests, and README
- Keep DebugIssueTool class name for backward compatibility
- All tests pass with the renamed tool

This makes the tool name shorter and more consistent with other
tool names like 'chat' and 'analyze'. The functionality remains
exactly the same.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 11:43:47 +04:00
Fahad
8c07ad1eb2 feat: enhance debug_issue tool description to encourage sharing large diagnostic files
- Emphasize Gemini's 1M token capacity in the description
- Explicitly encourage sharing large log files, stack traces, memory dumps
- Add 'diagnose issue' as a trigger phrase
- Instruct Claude to proactively use this tool for debugging
- Encourage sharing comprehensive file paths rather than snippets
- Make clear that more context leads to better debugging analysis

This ensures Claude understands it should liberally share diagnostic
files and logs when debugging, taking full advantage of Gemini's
massive context window for thorough root cause analysis.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 11:37:57 +04:00
Fahad
2f62b722d1 feat: enhance review_code tool to guide Claude's fix implementation workflow
- Update format_response to include clear next steps for Claude
- Claude will now:
  1. First understand the context of issues by examining referenced code
  2. Present improvement options to the user as a clear list
  3. Only implement fixes the user selects
- Ensures user has control over which improvements to implement
- Promotes better understanding of issues before suggesting fixes

This change improves the user experience by making code review fixes
more interactive and user-controlled rather than automatic.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 11:12:41 +04:00
Fahad
cf0b3f7f44 feat: add web search capability to all tools for enhanced analysis
- Add use_websearch parameter to base ToolRequest class
- All tools now inherit web search capability automatically
- Enhanced description emphasizes brainstorming and architectural design
- Add get_websearch_instruction() helper method to base class
- Update all tools to include web search in their prompts when enabled
- Update README documentation with web search examples
- Fix linting issues (ruff, black formatting)

Web search is particularly useful for:
- Brainstorming sessions and architectural design discussions
- Exploring industry best practices
- Working with specific frameworks/technologies
- Researching solutions to complex problems
- Getting current documentation and community insights

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 11:09:28 +04:00
Fahad
af68e8bf7c fix: ensure review_changes properly translates both path and files for Docker
- Added explicit translation of files parameter using translate_file_paths()
- Now both path and files parameters are properly translated for Docker environments
- Ensures consistent behavior between dockerized and normal installations
- Updated all references to use translated_files consistently

This fixes the bug where files parameter wasn't being explicitly translated,
even though resolve_and_validate_path was handling it internally. The explicit
translation makes the behavior clear and consistent with path translation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 09:56:20 +04:00
Fahad
27add4d05d feat: Major refactoring and improvements v2.11.0
## 🚀 Major Improvements

### Docker Environment Simplification
- **BREAKING**: Simplified Docker configuration by auto-detecting sandbox from WORKSPACE_ROOT
- Removed redundant MCP_PROJECT_ROOT requirement for Docker setups
- Updated all Docker config examples and setup scripts
- Added security validation for dangerous WORKSPACE_ROOT paths

### Security Enhancements
- **CRITICAL**: Fixed insecure PROJECT_ROOT fallback to use current directory instead of home
- Enhanced path validation with proper Docker environment detection
- Removed information disclosure in error messages
- Strengthened symlink and path traversal protection

### File Handling Optimization
- **PERFORMANCE**: Optimized read_files() to return content only (removed summary)
- Unified file reading across all tools using standardized file_utils routines
- Fixed review_changes tool to use consistent file loading patterns
- Improved token management and reduced unnecessary processing

### Tool Improvements
- **UX**: Enhanced ReviewCodeTool to require user context for targeted reviews
- Removed deprecated _get_secure_container_path function and _sanitize_filename
- Standardized file access patterns across analyze, review_changes, and other tools
- Added contextual prompting to align reviews with user expectations

### Code Quality & Testing
- Updated all tests for new function signatures and requirements
- Added comprehensive Docker path integration tests
- Achieved 100% test coverage (95 tests passing)
- Full compliance with ruff, black, and isort linting standards

### Configuration & Deployment
- Added pyproject.toml for modern Python packaging
- Streamlined Docker setup removing redundant environment variables
- Updated setup scripts across all platforms (Windows, macOS, Linux)
- Improved error handling and validation throughout

## 🔧 Technical Changes

- **Removed**: `_get_secure_container_path()`, `_sanitize_filename()`, unused SANDBOX_MODE
- **Enhanced**: Path translation, security validation, token management
- **Standardized**: File reading patterns, error handling, Docker detection
- **Updated**: All tool prompts for better context alignment

## 🛡️ Security Notes

This release significantly improves the security posture by:
- Eliminating broad filesystem access defaults
- Adding validation for Docker environment variables
- Removing information disclosure in error paths
- Strengthening path traversal and symlink protections

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 09:50:05 +04:00
Fahad
7ea790ef88 fix: Docker path translation for review_changes and code deduplication
- Fixed review_changes tool to properly translate host paths to container paths in Docker
- Prevents "No such file or directory" errors when running in Docker containers
- Added proper error handling with clear messages when paths are inaccessible

refactor: Centralized token limit validation across all tools
- Added _validate_token_limit method to BaseTool to eliminate code duplication
- Reduced ~25 lines of duplicated code across 5 tools (analyze, chat, debug_issue, review_code, think_deeper)
- Maintains exact same error messages and behavior

feat: Enhanced large prompt handling
- Added support for prompts >50K chars by requesting file-based input
- Preserves MCP's ~25K token capacity for responses
- All tools now check prompt size before processing

test: Added comprehensive Docker path integration tests
- Tests for path translation, security validation, and error handling
- Tests for review_changes tool specifically with Docker paths
- Fixed failing think_deeper test (updated default from "max" to "high")

chore: Code quality improvements
- Applied black formatting across all files
- Fixed import sorting with isort
- All tests passing (96 tests)
- Standardized error handling follows MCP TextContent format

The changes ensure consistent behavior across all environments while reducing code duplication and improving maintainability.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 07:20:24 +04:00
Fahad
53303f86be feat: enhance review_changes with dynamic file requests
- Add instruction for Gemini to request files when needed
- Add comprehensive tests for files parameter functionality
- Test file request instruction presence/absence based on context
- Run all tests, ruff, and black formatting

Now review_changes can both accept context files and allow Gemini
to request additional files during review for better validation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-09 21:43:45 +04:00
Fahad
a01cc9677a feat: add optional files parameter to review_changes tool
- Add files parameter to provide additional context during review
- Context files help validate if changes align with existing patterns
- Files are processed after diffs to prioritize actual changes for token budget
- Clear section headers and summaries show what context was included
- Handles token limits gracefully with truncation when needed

This allows users to provide config files, docs, or related code that
helps Gemini better understand and validate the changes being reviewed.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-09 21:26:56 +04:00
Fahad
783ba73181 refactor: cleanup and comprehensive documentation
Major changes:
- Add comprehensive documentation to all modules with detailed docstrings
- Remove unused THINKING_MODEL config (use single GEMINI_MODEL with thinking_mode param)
- Remove list_models functionality (simplified to single model configuration)
- Rename DEFAULT_MODEL to GEMINI_MODEL for clarity
- Remove unused python-dotenv dependency
- Fix missing pydantic in setup.py dependencies

Documentation improvements:
- Document security measures in file_utils.py (path validation, sandboxing)
- Add detailed comments to critical logic sections
- Document tool creation process in BaseTool
- Explain configuration values and their impact
- Add comprehensive function-level documentation

Code quality:
- Apply black formatting to all files
- Fix all ruff linting issues
- Update tests to match refactored code
- All 63 tests passing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-09 19:04:24 +04:00
Fahad
fd6e2f9b64 refactor: rename review_pending_changes to review_changes
- Renamed tool from review_pending_changes to review_changes for brevity
- Enhanced tool descriptions for better MCP auto-discovery
- Updated all references throughout codebase including:
  - Tool implementation (tools/review_changes.py)
  - Test files (tests/test_review_changes.py)
  - Server registration and imports
  - Documentation in README.md
  - Tool prompts in prompts/tool_prompts.py
- Enhanced review_changes description to emphasize pre-commit usage
- All tests pass, linting and formatting checks pass

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-09 14:37:03 +04:00
Fahad
b179c0ad48 feat: enhance review_pending_changes tool visibility and triggers
- Update tool description to strongly encourage Claude to use it before commits
- Add 'ALWAYS use this tool before creating any git commit\!' emphasis
- Add comprehensive trigger words in TOOL_TRIGGERS including:
  - 'before commit', 'about to commit', 'ready to commit'
  - 'review pending changes', 'check my changes'
  - 'pre-commit', 'before I commit', 'should I commit'
- Make it clear this is essential for code quality and preventing bugs
- All tests pass (65 tests), ruff linting clean, black formatting applied
2025-06-09 14:12:55 +04:00
Fahad
e3e6f12cf3 fix: resolve linting issues across multiple files
- Remove unused imports (os, Optional, json, List, sys, MagicMock, DebugIssueTool)
- Remove unused variable assignments (safe_file_name)
- Fix f-strings without placeholders
- Reorder imports in test_live_integration.py
2025-06-09 13:53:37 +04:00
Fahad
667b8d0ce7 style: apply black formatting to review_pending_changes files
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-09 12:43:59 +04:00