feat: refactored and tweaked model descriptions / schema to use fewer tokens at launch (average reduction per field description: 60-80%) without sacrificing tool effectiveness

Disabled secondary tools by default (for new installations), updated README.md with instructions on how to enable these in .env
run-server.sh now displays disabled / enabled tools (when DISABLED_TOOLS is set)
This commit is contained in:
Fahad
2025-08-22 09:23:59 +04:00
parent 6921616db3
commit 4b202f5d1d
31 changed files with 409 additions and 609 deletions

View File

@@ -37,15 +37,9 @@ logger = logging.getLogger(__name__)
# Tool-specific field descriptions for documentation generation
DOCGEN_FIELD_DESCRIPTIONS = {
"step": (
"For step 1: DISCOVERY PHASE ONLY - describe your plan to discover ALL files that need documentation in the current directory. "
"DO NOT document anything yet. Count all files, list them clearly, report the total count, then IMMEDIATELY proceed to step 2. "
"For step 2 and beyond: DOCUMENTATION PHASE - describe what you're currently documenting, focusing on ONE FILE at a time "
"to ensure complete coverage of all functions and methods within that file. CRITICAL: DO NOT ALTER ANY CODE LOGIC - "
"only add documentation (docstrings, comments). ALWAYS use MODERN documentation style for the programming language "
'(e.g., /// for Objective-C, /** */ for Java/JavaScript, """ for Python, // for Swift/C++, etc. - NEVER use legacy styles). '
"Consider complexity analysis, call flow information, and parameter descriptions. "
"If you find bugs or logic issues, TRACK THEM but DO NOT FIX THEM - report after documentation is complete. "
"Report progress using num_files_documented out of total_files_to_document counters."
"Step 1 (DISCOVERY): Plan to discover ALL files needing documentation; count and list them clearly. DO NOT document yet. "
"Step 2+ (DOCUMENTATION): Document ONE file at a time. CRITICAL: DO NOT ALTER CODE LOGIC - only add documentation. "
"If you find bugs, TRACK them but DO NOT FIX. Report progress using counters."
),
"step_number": (
"The index of the current step in the documentation generation sequence, beginning at 1. Each step should build upon or "
@@ -60,40 +54,24 @@ DOCGEN_FIELD_DESCRIPTIONS = {
"documentation plan is complete and ready for implementation."
),
"findings": (
"Summarize everything discovered in this step about the code and its documentation needs. Include analysis of missing "
"documentation, complexity assessments, call flow understanding, and opportunities for improvement. Be specific and "
"avoid vague language—document what you now know about the code structure and how it affects your documentation plan. "
"IMPORTANT: Document both well-documented areas (good examples to follow) and areas needing documentation. "
"ALWAYS use MODERN documentation style appropriate for the programming language (/// for Objective-C, /** */ for Java/JavaScript, "
'""" for Python, // for Swift/C++, etc. - NEVER use legacy /* */ style for languages that have modern alternatives). '
"If you discover ANY BUGS OR LOGIC ERRORS (critical or non-critical), IMMEDIATELY STOP "
"the documentation workflow and ask the user directly if this bug should be addressed before continuing. "
"This includes: incorrect logic, wrong calculations, backwards conditions, inverted values, missing error handling, "
"security vulnerabilities, performance issues, or any code that doesn't match its intended function name/purpose. "
"NEVER document code with known bugs - always stop and report to user first. "
"In later steps, confirm or update past findings with additional evidence."
"Summary of documentation needs found in this step. Note missing docs, complexity, and call flows. "
"IMPORTANT: Document both well-documented areas and areas needing docs. "
"CRITICAL: If ANY bugs are found, STOP and report them immediately before continuing documentation."
),
"relevant_files": (
"Current focus files (as full absolute paths) for this step. In each step, focus on documenting "
"ONE FILE COMPLETELY before moving to the next. This should contain only the file(s) being "
"actively documented in the current step, not all files that might need documentation."
"Current focus files (absolute paths) for this step. Focus on documenting ONE FILE completely per step."
),
"relevant_context": (
"List methods, functions, or classes that need documentation, in the format "
"'ClassName.methodName' or 'functionName'. "
"Prioritize those with complex logic, important interfaces, or missing/inadequate documentation."
"List methods/functions needing documentation, in 'ClassName.methodName' or 'functionName' format. "
"Prioritize complex logic, important interfaces, or missing documentation."
),
"num_files_documented": (
"CRITICAL COUNTER: Number of files you have COMPLETELY documented so far. Start at 0. "
"Increment by 1 only when a file is 100% documented (all functions/methods have documentation). "
"This counter prevents premature completion - you CANNOT set next_step_required=false "
"unless num_files_documented equals total_files_to_document."
"Counter for fully documented files. Starts at 0. Increment only when a file is 100% complete. "
"CRITICAL: Must equal 'total_files_to_document' to finish."
),
"total_files_to_document": (
"CRITICAL COUNTER: Total number of files discovered that need documentation in current directory. "
"Set this in step 1 after discovering all files. This is the target number - when "
"num_files_documented reaches this number, then and ONLY then can you set next_step_required=false. "
"This prevents stopping after documenting just one file."
"Counter for total files needing documentation. Set in step 1 during discovery. "
"This is the completion target for the 'num_files_documented' counter."
),
"document_complexity": (
"Whether to include algorithmic complexity (Big O) analysis in function/method documentation. "