🚀 Major Enhancement: Workflow-Based Tool Architecture v5.5.0 (#95)
* WIP: new workflow architecture * WIP: further improvements and cleanup * WIP: cleanup and docks, replace old tool with new * WIP: cleanup and docks, replace old tool with new * WIP: new planner implementation using workflow * WIP: precommit tool working as a workflow instead of a basic tool Support for passing False to use_assistant_model to skip external models completely and use Claude only * WIP: precommit workflow version swapped with old * WIP: codereview * WIP: replaced codereview * WIP: replaced codereview * WIP: replaced refactor * WIP: workflow for thinkdeep * WIP: ensure files get embedded correctly * WIP: thinkdeep replaced with workflow version * WIP: improved messaging when an external model's response is received * WIP: analyze tool swapped * WIP: updated tests * Extract only the content when building history * Use "relevant_files" for workflow tools only * WIP: updated tests * Extract only the content when building history * Use "relevant_files" for workflow tools only * WIP: fixed get_completion_next_steps_message missing param * Fixed tests Request for files consistently * Fixed tests Request for files consistently * Fixed tests * New testgen workflow tool Updated docs * Swap testgen workflow * Fix CI test failures by excluding API-dependent tests - Update GitHub Actions workflow to exclude simulation tests that require API keys - Fix collaboration tests to properly mock workflow tool expert analysis calls - Update test assertions to handle new workflow tool response format - Ensure unit tests run without external API dependencies in CI 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * WIP - Update tests to match new tools * WIP - Update tests to match new tools --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
4dae6e457e
commit
69a3121452
@@ -1,13 +1,32 @@
|
||||
# Refactor Tool - Intelligent Code Refactoring
|
||||
|
||||
**Comprehensive refactoring analysis with top-down decomposition strategy**
|
||||
**Comprehensive refactoring analysis with top-down decomposition strategy through workflow-driven investigation**
|
||||
|
||||
The `refactor` tool provides intelligent code refactoring recommendations with a focus on top-down decomposition and systematic code improvement. It prioritizes structural improvements over cosmetic changes.
|
||||
The `refactor` tool provides intelligent code refactoring recommendations with a focus on top-down decomposition and systematic code improvement. This workflow tool enforces systematic investigation of code smells, decomposition opportunities, and modernization possibilities across multiple steps, ensuring thorough analysis before providing expert refactoring recommendations with precise implementation guidance.
|
||||
|
||||
## Thinking Mode
|
||||
|
||||
**Default is `medium` (8,192 tokens).** Use `high` for complex legacy systems (worth the investment for thorough refactoring plans) or `max` for extremely complex codebases requiring deep analysis.
|
||||
|
||||
## How the Workflow Works
|
||||
|
||||
The refactor tool implements a **structured workflow** for systematic refactoring analysis:
|
||||
|
||||
**Investigation Phase (Claude-Led):**
|
||||
1. **Step 1**: Claude describes the refactoring plan and begins analyzing code structure
|
||||
2. **Step 2+**: Claude examines code smells, decomposition opportunities, and modernization possibilities
|
||||
3. **Throughout**: Claude tracks findings, relevant files, refactoring opportunities, and confidence levels
|
||||
4. **Completion**: Once investigation is thorough, Claude signals completion
|
||||
|
||||
**Expert Analysis Phase:**
|
||||
After Claude completes the investigation (unless confidence is **complete**):
|
||||
- Complete refactoring opportunity summary
|
||||
- Prioritized recommendations by impact
|
||||
- Precise implementation guidance with line numbers
|
||||
- Final expert assessment for refactoring strategy
|
||||
|
||||
This workflow ensures methodical investigation before expert recommendations, resulting in more targeted and valuable refactoring plans.
|
||||
|
||||
## Model Recommendation
|
||||
|
||||
The refactor tool excels with models that have large context windows like Gemini Pro (1M tokens), which can analyze entire files and complex codebases simultaneously. This comprehensive view enables detection of cross-file dependencies, architectural patterns, and refactoring opportunities that might be missed when reviewing code in smaller chunks due to context constraints.
|
||||
@@ -67,13 +86,28 @@ This results in Claude first performing its own expert analysis, encouraging it
|
||||
|
||||
## Tool Parameters
|
||||
|
||||
- `files`: Code files or directories to analyze for refactoring opportunities (required, absolute paths)
|
||||
**Workflow Investigation Parameters (used during step-by-step process):**
|
||||
- `step`: Current investigation step description (required for each step)
|
||||
- `step_number`: Current step number in refactoring sequence (required)
|
||||
- `total_steps`: Estimated total investigation steps (adjustable)
|
||||
- `next_step_required`: Whether another investigation step is needed
|
||||
- `findings`: Discoveries and refactoring opportunities in this step (required)
|
||||
- `files_checked`: All files examined during investigation
|
||||
- `relevant_files`: Files directly needing refactoring (required in step 1)
|
||||
- `relevant_context`: Methods/functions/classes requiring refactoring
|
||||
- `issues_found`: Refactoring opportunities with severity and type
|
||||
- `confidence`: Confidence level in analysis completeness (exploring/incomplete/partial/complete)
|
||||
- `backtrack_from_step`: Step number to backtrack from (for revisions)
|
||||
- `hypothesis`: Current assessment of refactoring priorities
|
||||
|
||||
**Initial Configuration (used in step 1):**
|
||||
- `prompt`: Description of refactoring goals, context, and specific areas of focus (required)
|
||||
- `refactor_type`: codesmells|decompose|modernize|organization (required)
|
||||
- `refactor_type`: codesmells|decompose|modernize|organization (default: codesmells)
|
||||
- `model`: auto|pro|flash|o3|o3-mini|o4-mini|o4-mini-high|gpt4.1 (default: server default)
|
||||
- `focus_areas`: Specific areas to focus on (e.g., 'performance', 'readability', 'maintainability', 'security')
|
||||
- `style_guide_examples`: Optional existing code files to use as style/pattern reference (absolute paths)
|
||||
- `thinking_mode`: minimal|low|medium|high|max (default: medium, Gemini only)
|
||||
- `use_assistant_model`: Whether to use expert analysis phase (default: true, set to false to use Claude only)
|
||||
- `continuation_id`: Thread continuation ID for multi-turn conversations
|
||||
|
||||
## Usage Examples
|
||||
|
||||
Reference in New Issue
Block a user