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

@@ -24,8 +24,8 @@ class TestChallengeTool:
def test_tool_metadata(self):
"""Test that tool metadata matches requirements"""
assert self.tool.get_name() == "challenge"
assert "prevent reflexive agreement" in self.tool.get_description()
assert "think critically" in self.tool.get_description()
assert "reflexive agreement" in self.tool.get_description()
assert "critical thinking" in self.tool.get_description()
assert "thoughtful evaluation" in self.tool.get_description()
assert self.tool.get_default_temperature() == 0.2 # TEMPERATURE_ANALYTICAL

View File

@@ -22,7 +22,7 @@ class TestChatTool:
def test_tool_metadata(self):
"""Test that tool metadata matches requirements"""
assert self.tool.get_name() == "chat"
assert "GENERAL CHAT & COLLABORATIVE THINKING" in self.tool.get_description()
assert "collaborative thinking" in self.tool.get_description()
assert self.tool.get_system_prompt() is not None
assert self.tool.get_default_temperature() > 0
assert self.tool.get_model_category() is not None

View File

@@ -18,7 +18,7 @@ class TestConsensusTool:
tool = ConsensusTool()
assert tool.get_name() == "consensus"
assert "COMPREHENSIVE CONSENSUS WORKFLOW" in tool.get_description()
assert "consensus" in tool.get_description()
assert tool.get_default_temperature() == 0.2 # TEMPERATURE_ANALYTICAL
assert tool.get_model_category() == ToolModelCategory.EXTENDED_REASONING
assert tool.requires_model() is False # Consensus manages its own models

View File

@@ -14,7 +14,7 @@ class TestDebugTool:
tool = DebugIssueTool()
assert tool.get_name() == "debug"
assert "DEBUG & ROOT CAUSE ANALYSIS" in tool.get_description()
assert "debugging and root cause analysis" in tool.get_description()
assert tool.get_default_temperature() == 0.2 # TEMPERATURE_ANALYTICAL
assert tool.get_model_category() == ToolModelCategory.EXTENDED_REASONING
assert tool.requires_model() is True

View File

@@ -21,7 +21,7 @@ class TestListModelsTool:
def test_tool_metadata(self, tool):
"""Test tool has correct metadata"""
assert tool.name == "listmodels"
assert "LIST AVAILABLE MODELS" in tool.description
assert "model providers" in tool.description
assert tool.get_request_model().__name__ == "ToolRequest"
@pytest.mark.asyncio

View File

@@ -18,7 +18,7 @@ class TestPlannerTool:
tool = PlannerTool()
assert tool.get_name() == "planner"
assert "SEQUENTIAL PLANNER" in tool.get_description()
assert "sequential planning" in tool.get_description()
assert tool.get_default_temperature() == 0.5 # TEMPERATURE_BALANCED
assert tool.get_model_category() == ToolModelCategory.EXTENDED_REASONING
assert tool.get_default_thinking_mode() == "medium"

View File

@@ -22,8 +22,8 @@ class TestPrecommitWorkflowTool:
tool = PrecommitTool()
assert tool.get_name() == "precommit"
assert "COMPREHENSIVE PRECOMMIT WORKFLOW" in tool.get_description()
assert "Step-by-step pre-commit validation" in tool.get_description()
assert "git changes" in tool.get_description()
assert "systematic analysis" in tool.get_description()
def test_tool_model_category(self):
"""Test that precommit tool uses extended reasoning category"""

View File

@@ -68,11 +68,11 @@ class TestRefactorTool:
def test_get_description(self, refactor_tool):
"""Test that the tool returns a comprehensive description"""
description = refactor_tool.get_description()
assert "COMPREHENSIVE REFACTORING WORKFLOW" in description
assert "refactoring" in description
assert "code smell detection" in description
assert "decomposition planning" in description
assert "modernization opportunities" in description
assert "organization improvements" in description
assert "modernization" in description
assert "maintainability improvements" in description
def test_get_input_schema(self, refactor_tool):
"""Test that the input schema includes all required workflow fields"""

View File

@@ -16,7 +16,7 @@ class TestSecauditTool:
tool = SecauditTool()
assert tool.get_name() == "secaudit"
assert "COMPREHENSIVE SECURITY AUDIT" in tool.get_description()
assert "security audit" in tool.get_description()
assert tool.get_default_temperature() == 0.2 # TEMPERATURE_ANALYTICAL
assert tool.get_model_category() == ToolModelCategory.EXTENDED_REASONING
assert tool.requires_model() is True
@@ -312,9 +312,9 @@ class TestSecauditTool:
# Verify field descriptions are comprehensive
assert "OWASP Top 10" in fields["step"]
assert "security implications" in fields["step"]
assert "threat vectors" in fields["step"]
assert "application context" in fields["security_scope"]
assert "OWASP Top 10" in fields["step"]
assert "MANDATORY" in fields["step"]
assert "Security context" in fields["security_scope"]
assert "threat level" in fields["threat_level"]
assert "compliance frameworks" in fields["compliance_requirements"]

View File

@@ -19,7 +19,7 @@ class TestThinkDeepTool:
def test_tool_metadata(self, tool):
"""Test tool metadata"""
assert tool.get_name() == "thinkdeep"
assert "COMPREHENSIVE INVESTIGATION & REASONING" in tool.get_description()
assert "investigation and reasoning" in tool.get_description()
assert tool.get_default_temperature() == 0.7
schema = tool.get_input_schema()
@@ -120,7 +120,7 @@ class TestCodeReviewTool:
def test_tool_metadata(self, tool):
"""Test tool metadata"""
assert tool.get_name() == "codereview"
assert "COMPREHENSIVE CODE REVIEW" in tool.get_description()
assert "code review" in tool.get_description()
assert tool.get_default_temperature() == 0.2
schema = tool.get_input_schema()
@@ -213,7 +213,7 @@ class TestAnalyzeTool:
def test_tool_metadata(self, tool):
"""Test tool metadata"""
assert tool.get_name() == "analyze"
assert "COMPREHENSIVE ANALYSIS WORKFLOW" in tool.get_description()
assert "code analysis" in tool.get_description()
assert tool.get_default_temperature() == 0.2
schema = tool.get_input_schema()

View File

@@ -23,10 +23,10 @@ class TestTracerTool:
def test_get_description(self, tracer_tool):
"""Test that the tool returns a comprehensive description"""
description = tracer_tool.get_description()
assert "STEP-BY-STEP CODE TRACING WORKFLOW" in description
assert "code tracing" in description
assert "precision" in description
assert "dependencies" in description
assert "guided investigation" in description
assert "systematic" in description
def test_get_input_schema(self, tracer_tool):
"""Test that the input schema includes required fields"""