detect_flag
Detect existing feature flags in your codebase to prevent duplicates and encourage reuse. Uses file search, git history, semantic matching, and code context analysis.
Instructions
Discover existing feature flags in the codebase to prevent duplicates and encourage reuse.
This tool provides comprehensive search instructions for finding existing flags through multiple detection strategies:
File-based detection: Search in files being modified
Git history analysis: Find recently added flags
Semantic name matching: Match description to flag names
Code context analysis: Find flags near modification point
Use this tool when:
About to create a new feature flag
Evaluating whether a flag is needed
Want to check if similar functionality is already flagged
The tool returns detailed search instructions that guide you through:
Executing searches using Bash and Grep tools
Scoring candidates from multiple detection methods
Combining results to find the best match
Returning a confidence-scored recommendation
Workflow Integration: This tool is automatically called by 'evaluate_change' before recommending 'create_flag'. You can also call it directly when you want to search for existing flags.
Output: Returns markdown guidance with:
Step-by-step search instructions for each detection method
Scoring criteria and weight calculations
Expected JSON response format
Confidence level interpretation
After following the instructions and finding results, you should return a JSON object indicating whether a flag was found and, if so, its details with a confidence score.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | Description of the change or feature you want to find flags for (e.g., "payment processing with Stripe") | |
| files | No | Optional: List of files being modified to search for flags in the same area | |
| codeContext | No | Optional: Code context around the modification point to analyze for nearby flags |