The SystemAnalyzerTool performs holistic analysis of the mindX system state, including codebase structure, performance metrics, resource usage, and improvement backlogs. It uses LLM-powered analysis to generate actionable insights and improvement suggestions.
File: tools/system_analyzer_tool.py
Class: SystemAnalyzerTool
Version: 1.0.0
Status: ✅ Active
class SystemAnalyzerTool:
- belief_system: BeliefSystem - Shared belief system
- llm_handler: LLMHandlerInterface - LLM for analysis
- coordinator_ref: CoordinatorAgent - System state access
- performance_monitor: PerformanceMonitor - Performance metrics
- resource_monitor: ResourceMonitor - Resource usage
from tools.system_analyzer_tool import SystemAnalyzerTool
from core.belief_system import BeliefSystem
from llm.llm_interface import LLMHandlerInterface
from orchestration.coordinator_agent import CoordinatorAgent
tool = SystemAnalyzerTool(
belief_system=belief_system,
llm_handler=llm_handler,
coordinator_ref=coordinator
)
Perform analysis
result = await tool.execute(analysis_focus_hint="performance optimization")
# Analyze specific area
result = await tool.analyze_system_for_improvements(
analysis_focus_hint="memory management"
)
{
"improvement_suggestions": [
{
"target_component_path": str,
"suggestion": str,
"justification": str,
"priority": int # 1-10
}
]
}
{
"error": str,
"improvement_suggestions": []
}
From PerformanceMonitor:
From ResourceMonitor:
From Coordinator:
From Coordinator:
Uses LLM to:
If LLM unavailable:
Can focus on specific areas:
Accesses system state:
self.performance_monitor = self.coordinator_ref.performance_monitor
self.resource_monitor = self.coordinator_ref.resource_monitor
Uses LLM for analysis:
response_str = await self.llm_handler.generate_text(
prompt,
model=self.llm_handler.model_name_for_api,
max_tokens=2000,
temperature=0.2,
json_mode=True
)
result = await tool.analyze_system_for_improvements(
analysis_focus_hint="performance optimization"
)
for suggestion in result["improvement_suggestions"]:
print(f"Priority {suggestion['priority']}: {suggestion['suggestion']}")
core.belief_system.BeliefSystem: Belief systemllm.llm_interface.LLMHandlerInterface: LLM handlerorchestration.coordinator_agent.CoordinatorAgent: System accessllm.model_selector.ModelSelector: Model selection (optional)prompt = (
"You are a Senior Systems Architect AI...\n"
f"System State Snapshot:\njson\n{system_state}\n``\n\n"
"Analysis Task:\n"
"1. Synthesize data...\n"
"2. Propose improvements...\n"
"3. Provide priority...\n"
)
``