refactor: Optimize tool guidelines and disable tools by default

This commit is contained in:
Petr Mironychev
2025-10-26 21:04:37 +01:00
parent 6cb0b14b18
commit dfd9979450
7 changed files with 43 additions and 87 deletions

View File

@ -88,38 +88,18 @@ void ClientInterface::sendMessage(
if (Settings::generalSettings().useTools()) {
systemPrompt
+= "\n\n# Smart Tool Combinations\n\n"
"**Understanding code structure:**\n"
"find_cpp_symbol → read_project_file_by_path → find_cpp_symbol (for related "
"symbols)\n\n"
"**Finding usages and references:**\n"
"find_cpp_symbol (declaration) → search_in_project (with precise name) → read "
"files\n\n"
"**Fixing compilation errors:**\n"
"get_issues_list → find_cpp_symbol (error location) → read_project_file_by_path "
"→ edit_project_file\n\n"
"**Complex refactoring:**\n"
"find_cpp_symbol (all targets) → read files → search_in_project (verify "
"coverage) → edit files\n\n"
"**Adding features to existing code:**\n"
"find_cpp_symbol (target class/namespace) → read_project_file_by_path → "
"edit_project_file\n\n"
"# Best Practices\n\n"
"- **Prefer semantic over text search**: Use find_cpp_symbol before "
"search_in_project\n"
"- **Make atomic edits**: One comprehensive change instead of multiple small "
"ones\n"
"- **Read once, understand fully**: Avoid re-reading the same file multiple "
"times\n"
"- **Start with visible context**: Use read_visible_files when user references "
"current work\n"
"- **Verify before editing**: Always read and understand code before proposing "
"changes\n"
"- **Use file patterns**: Narrow search_in_project with *.cpp, *.h patterns\n"
"- **Chain intelligently**: Each tool result should inform the next tool "
"choice\n"
"- **Fix related issues together**: When fixing errors, address all related "
"problems in one edit\n";
+= "\n\n# Tool Usage Guidelines\n\n"
"**Workflow patterns:**\n"
"- Code structure: find_cpp_symbol → read_files_by_path\n"
"- Find usages: find_cpp_symbol → search_in_project\n"
"- Fix errors: get_issues_list → find_cpp_symbol → read_files_by_path → edit_file\n"
"- Refactoring: find_cpp_symbol → read_files → search_in_project → edit_file\n\n"
"**Best practices:**\n"
"- Prefer find_cpp_symbol over search_in_project for code symbols\n"
"- Read once, edit comprehensively (atomic edits)\n"
"- Use read_visible_files for current editor context\n"
"- Verify before editing\n"
"- Use file patterns (*.cpp, *.h) to narrow searches\n";
}
auto project = LLMCore::RulesLoader::getActiveProject();