Overview
Therename tool performs safe, multi-file coordinated renaming of code symbols by combining knowledge graph relationships (high confidence) with regex text search (lower confidence). It previews changes by default and tags each edit with its confidence level.
When to use: Renaming a function, class, method, or variable across the codebase. Safer than find-and-replace.Next step: Run
detect_changes() to verify no unexpected side effects.Parameters
Current symbol name to rename (e.g., “validateUser”, “AuthService”)Required unless
symbol_uid is provided.Direct symbol UID from prior tool results for zero-ambiguity lookupWhen available, prefer this over
symbol_name to avoid disambiguation.The new name for the symbolMust be a valid identifier for the symbol’s language.
File path to disambiguate common names when multiple symbols share the same nameExample:
"src/auth/validator.ts"Preview edits without modifying files
true(default): Show what would be changedfalse: Apply changes to disk
Repository name or path. Required when multiple repos are indexed.
At least one of
symbol_name or symbol_uid must be provided.Response
All proposed edits grouped by file
High-level summary of proposed changes
Whether changes were applied to disk (true) or just previewed (false)
Example Usage
Preview Rename (Default)
Apply Rename
Rename with UID (Zero-Ambiguity)
Disambiguate by File Path
Multi-Repo Rename
Example Response (Dry Run)
Confidence Levels
"graph" (High Confidence)
"graph" (High Confidence)
Source: Knowledge graph relationshipsSafety: High — these are actual code references tracked by the graphExamples:
- Function calls
- Import statements
- Class instantiations
- Method invocations
"text_search" (Lower Confidence)
"text_search" (Lower Confidence)
Source: Regex text searchSafety: Lower — may include false positives like comments, strings, or unrelated matchesExamples:
- References in config files
- String literals
- Comments
- Dynamic references
Real-World Examples
Example 1: Safe Rename Workflow
Example 2: Class Rename
Example 3: Method Rename
Best Practices
Always dry run first
Always dry run first
Never skip the preview. Review the changes, especially
text_search edits, before applying.Use UIDs when available
Use UIDs when available
If you have a
symbol_uid from query() or context() results, use it to avoid ambiguity.Review text_search edits carefully
Review text_search edits carefully
Graph edits are safe, but text_search edits may include false positives (comments, strings, unrelated code).
Run detect_changes after
Run detect_changes after
After applying the rename, run
detect_changes() to verify only expected files were modified.Use impact() for high-risk renames
Use impact() for high-risk renames
Before renaming widely-used symbols, run
impact() to understand the blast radius.Commit after rename
Commit after rename
Rename operations can touch many files. Commit immediately after a successful rename to isolate it from other changes.
Workflow Checklist
Use Cases
- Function renaming: Better naming for clarity
- Class renaming: Architecture refactoring
- Method renaming: API improvements
- Variable renaming: Code quality improvements
- Refactoring prep: Rename before extracting modules
Limitations
Related Tools
- impact - Analyze blast radius before renaming
- detect_changes - Verify rename scope after applying
- context - Understand symbol usage before renaming
Related Resources
gitnexus://repo/{name}/processes- See which flows use the symbol