claude-mpm 4.1.1__py3-none-any.whl ā 4.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- claude_mpm/BUILD_NUMBER +1 -1
- claude_mpm/VERSION +1 -1
- claude_mpm/__main__.py +1 -1
- claude_mpm/agents/BASE_PM.md +74 -46
- claude_mpm/agents/INSTRUCTIONS.md +11 -153
- claude_mpm/agents/WORKFLOW.md +61 -321
- claude_mpm/agents/__init__.py +11 -11
- claude_mpm/agents/agent_loader.py +23 -20
- claude_mpm/agents/agent_loader_integration.py +1 -1
- claude_mpm/agents/agents_metadata.py +27 -0
- claude_mpm/agents/async_agent_loader.py +5 -8
- claude_mpm/agents/base_agent_loader.py +36 -25
- claude_mpm/agents/frontmatter_validator.py +6 -6
- claude_mpm/agents/schema/agent_schema.json +1 -1
- claude_mpm/agents/system_agent_config.py +9 -9
- claude_mpm/agents/templates/api_qa.json +47 -2
- claude_mpm/agents/templates/imagemagick.json +256 -0
- claude_mpm/agents/templates/qa.json +41 -2
- claude_mpm/agents/templates/ticketing.json +5 -5
- claude_mpm/agents/templates/web_qa.json +50 -2
- claude_mpm/cli/__init__.py +51 -46
- claude_mpm/cli/__main__.py +1 -1
- claude_mpm/cli/commands/__init__.py +10 -12
- claude_mpm/cli/commands/agent_manager.py +186 -181
- claude_mpm/cli/commands/agents.py +271 -268
- claude_mpm/cli/commands/aggregate.py +30 -29
- claude_mpm/cli/commands/cleanup.py +50 -44
- claude_mpm/cli/commands/cleanup_orphaned_agents.py +25 -25
- claude_mpm/cli/commands/config.py +162 -127
- claude_mpm/cli/commands/doctor.py +52 -62
- claude_mpm/cli/commands/info.py +37 -25
- claude_mpm/cli/commands/mcp.py +3 -7
- claude_mpm/cli/commands/mcp_command_router.py +14 -18
- claude_mpm/cli/commands/mcp_install_commands.py +28 -23
- claude_mpm/cli/commands/mcp_pipx_config.py +58 -49
- claude_mpm/cli/commands/mcp_server_commands.py +23 -17
- claude_mpm/cli/commands/memory.py +192 -141
- claude_mpm/cli/commands/monitor.py +117 -88
- claude_mpm/cli/commands/run.py +120 -84
- claude_mpm/cli/commands/run_config_checker.py +4 -5
- claude_mpm/cli/commands/socketio_monitor.py +17 -19
- claude_mpm/cli/commands/tickets.py +92 -92
- claude_mpm/cli/parser.py +1 -5
- claude_mpm/cli/parsers/__init__.py +1 -1
- claude_mpm/cli/parsers/agent_manager_parser.py +50 -98
- claude_mpm/cli/parsers/agents_parser.py +2 -3
- claude_mpm/cli/parsers/base_parser.py +7 -5
- claude_mpm/cli/parsers/mcp_parser.py +4 -2
- claude_mpm/cli/parsers/monitor_parser.py +26 -18
- claude_mpm/cli/shared/__init__.py +10 -10
- claude_mpm/cli/shared/argument_patterns.py +57 -71
- claude_mpm/cli/shared/base_command.py +61 -53
- claude_mpm/cli/shared/error_handling.py +62 -58
- claude_mpm/cli/shared/output_formatters.py +78 -77
- claude_mpm/cli/startup_logging.py +204 -172
- claude_mpm/cli/utils.py +10 -11
- claude_mpm/cli_module/__init__.py +1 -1
- claude_mpm/cli_module/args.py +1 -1
- claude_mpm/cli_module/migration_example.py +5 -5
- claude_mpm/config/__init__.py +9 -9
- claude_mpm/config/agent_config.py +15 -14
- claude_mpm/config/experimental_features.py +4 -4
- claude_mpm/config/paths.py +0 -1
- claude_mpm/config/socketio_config.py +5 -6
- claude_mpm/constants.py +1 -2
- claude_mpm/core/__init__.py +8 -8
- claude_mpm/core/agent_name_normalizer.py +1 -1
- claude_mpm/core/agent_registry.py +20 -23
- claude_mpm/core/agent_session_manager.py +3 -3
- claude_mpm/core/base_service.py +7 -15
- claude_mpm/core/cache.py +4 -6
- claude_mpm/core/claude_runner.py +85 -113
- claude_mpm/core/config.py +43 -28
- claude_mpm/core/config_aliases.py +0 -9
- claude_mpm/core/config_constants.py +52 -30
- claude_mpm/core/constants.py +0 -1
- claude_mpm/core/container.py +18 -27
- claude_mpm/core/exceptions.py +2 -2
- claude_mpm/core/factories.py +10 -12
- claude_mpm/core/framework_loader.py +581 -280
- claude_mpm/core/hook_manager.py +26 -22
- claude_mpm/core/hook_performance_config.py +58 -47
- claude_mpm/core/injectable_service.py +1 -1
- claude_mpm/core/interactive_session.py +61 -152
- claude_mpm/core/interfaces.py +1 -100
- claude_mpm/core/lazy.py +5 -5
- claude_mpm/core/log_manager.py +587 -0
- claude_mpm/core/logger.py +125 -8
- claude_mpm/core/logging_config.py +15 -15
- claude_mpm/core/minimal_framework_loader.py +5 -8
- claude_mpm/core/oneshot_session.py +15 -33
- claude_mpm/core/optimized_agent_loader.py +4 -6
- claude_mpm/core/optimized_startup.py +2 -1
- claude_mpm/core/output_style_manager.py +147 -106
- claude_mpm/core/pm_hook_interceptor.py +0 -1
- claude_mpm/core/service_registry.py +11 -8
- claude_mpm/core/session_manager.py +1 -2
- claude_mpm/core/shared/__init__.py +1 -1
- claude_mpm/core/shared/config_loader.py +101 -97
- claude_mpm/core/shared/path_resolver.py +72 -68
- claude_mpm/core/shared/singleton_manager.py +56 -50
- claude_mpm/core/socketio_pool.py +26 -6
- claude_mpm/core/tool_access_control.py +4 -5
- claude_mpm/core/typing_utils.py +50 -59
- claude_mpm/core/unified_agent_registry.py +14 -19
- claude_mpm/core/unified_config.py +4 -6
- claude_mpm/core/unified_paths.py +197 -109
- claude_mpm/dashboard/open_dashboard.py +2 -4
- claude_mpm/experimental/cli_enhancements.py +51 -36
- claude_mpm/generators/agent_profile_generator.py +2 -4
- claude_mpm/hooks/base_hook.py +1 -2
- claude_mpm/hooks/claude_hooks/connection_pool.py +72 -26
- claude_mpm/hooks/claude_hooks/event_handlers.py +93 -38
- claude_mpm/hooks/claude_hooks/hook_handler.py +130 -76
- claude_mpm/hooks/claude_hooks/hook_handler_eventbus.py +104 -77
- claude_mpm/hooks/claude_hooks/memory_integration.py +2 -4
- claude_mpm/hooks/claude_hooks/response_tracking.py +15 -11
- claude_mpm/hooks/claude_hooks/tool_analysis.py +12 -18
- claude_mpm/hooks/memory_integration_hook.py +5 -5
- claude_mpm/hooks/tool_call_interceptor.py +1 -1
- claude_mpm/hooks/validation_hooks.py +4 -4
- claude_mpm/init.py +4 -9
- claude_mpm/models/__init__.py +2 -2
- claude_mpm/models/agent_session.py +11 -14
- claude_mpm/scripts/mcp_server.py +20 -11
- claude_mpm/scripts/mcp_wrapper.py +5 -5
- claude_mpm/scripts/mpm_doctor.py +321 -0
- claude_mpm/scripts/socketio_daemon.py +28 -25
- claude_mpm/scripts/socketio_daemon_hardened.py +298 -258
- claude_mpm/scripts/socketio_server_manager.py +116 -95
- claude_mpm/services/__init__.py +49 -49
- claude_mpm/services/agent_capabilities_service.py +12 -18
- claude_mpm/services/agents/__init__.py +22 -22
- claude_mpm/services/agents/agent_builder.py +140 -119
- claude_mpm/services/agents/deployment/__init__.py +3 -3
- claude_mpm/services/agents/deployment/agent_config_provider.py +9 -9
- claude_mpm/services/agents/deployment/agent_configuration_manager.py +19 -20
- claude_mpm/services/agents/deployment/agent_definition_factory.py +1 -5
- claude_mpm/services/agents/deployment/agent_deployment.py +136 -106
- claude_mpm/services/agents/deployment/agent_discovery_service.py +4 -8
- claude_mpm/services/agents/deployment/agent_environment_manager.py +2 -7
- claude_mpm/services/agents/deployment/agent_filesystem_manager.py +6 -10
- claude_mpm/services/agents/deployment/agent_format_converter.py +11 -15
- claude_mpm/services/agents/deployment/agent_frontmatter_validator.py +2 -3
- claude_mpm/services/agents/deployment/agent_lifecycle_manager.py +5 -5
- claude_mpm/services/agents/deployment/agent_metrics_collector.py +13 -19
- claude_mpm/services/agents/deployment/agent_restore_handler.py +0 -1
- claude_mpm/services/agents/deployment/agent_template_builder.py +26 -35
- claude_mpm/services/agents/deployment/agent_validator.py +0 -1
- claude_mpm/services/agents/deployment/agent_version_manager.py +7 -9
- claude_mpm/services/agents/deployment/agent_versioning.py +3 -3
- claude_mpm/services/agents/deployment/agents_directory_resolver.py +6 -7
- claude_mpm/services/agents/deployment/async_agent_deployment.py +51 -38
- claude_mpm/services/agents/deployment/config/__init__.py +1 -1
- claude_mpm/services/agents/deployment/config/deployment_config.py +7 -8
- claude_mpm/services/agents/deployment/deployment_type_detector.py +1 -1
- claude_mpm/services/agents/deployment/deployment_wrapper.py +18 -18
- claude_mpm/services/agents/deployment/facade/__init__.py +1 -1
- claude_mpm/services/agents/deployment/facade/deployment_executor.py +0 -3
- claude_mpm/services/agents/deployment/facade/deployment_facade.py +3 -4
- claude_mpm/services/agents/deployment/interface_adapter.py +5 -7
- claude_mpm/services/agents/deployment/multi_source_deployment_service.py +345 -276
- claude_mpm/services/agents/deployment/pipeline/__init__.py +2 -2
- claude_mpm/services/agents/deployment/pipeline/pipeline_builder.py +1 -1
- claude_mpm/services/agents/deployment/pipeline/pipeline_context.py +6 -4
- claude_mpm/services/agents/deployment/pipeline/pipeline_executor.py +3 -3
- claude_mpm/services/agents/deployment/pipeline/steps/__init__.py +2 -2
- claude_mpm/services/agents/deployment/pipeline/steps/agent_processing_step.py +14 -13
- claude_mpm/services/agents/deployment/pipeline/steps/base_step.py +0 -1
- claude_mpm/services/agents/deployment/pipeline/steps/configuration_step.py +1 -1
- claude_mpm/services/agents/deployment/pipeline/steps/target_directory_step.py +8 -9
- claude_mpm/services/agents/deployment/pipeline/steps/validation_step.py +1 -1
- claude_mpm/services/agents/deployment/processors/__init__.py +1 -1
- claude_mpm/services/agents/deployment/processors/agent_processor.py +20 -16
- claude_mpm/services/agents/deployment/refactored_agent_deployment_service.py +5 -12
- claude_mpm/services/agents/deployment/results/__init__.py +1 -1
- claude_mpm/services/agents/deployment/results/deployment_result_builder.py +1 -1
- claude_mpm/services/agents/deployment/strategies/__init__.py +2 -2
- claude_mpm/services/agents/deployment/strategies/base_strategy.py +1 -7
- claude_mpm/services/agents/deployment/strategies/project_strategy.py +1 -4
- claude_mpm/services/agents/deployment/strategies/system_strategy.py +2 -3
- claude_mpm/services/agents/deployment/strategies/user_strategy.py +3 -7
- claude_mpm/services/agents/deployment/validation/__init__.py +1 -1
- claude_mpm/services/agents/deployment/validation/agent_validator.py +1 -1
- claude_mpm/services/agents/deployment/validation/template_validator.py +2 -2
- claude_mpm/services/agents/deployment/validation/validation_result.py +2 -6
- claude_mpm/services/agents/loading/__init__.py +1 -1
- claude_mpm/services/agents/loading/agent_profile_loader.py +6 -12
- claude_mpm/services/agents/loading/base_agent_manager.py +5 -5
- claude_mpm/services/agents/loading/framework_agent_loader.py +2 -4
- claude_mpm/services/agents/management/__init__.py +1 -1
- claude_mpm/services/agents/management/agent_capabilities_generator.py +1 -3
- claude_mpm/services/agents/management/agent_management_service.py +5 -9
- claude_mpm/services/agents/memory/__init__.py +4 -4
- claude_mpm/services/agents/memory/agent_memory_manager.py +280 -160
- claude_mpm/services/agents/memory/agent_persistence_service.py +0 -2
- claude_mpm/services/agents/memory/content_manager.py +44 -38
- claude_mpm/services/agents/memory/template_generator.py +4 -6
- claude_mpm/services/agents/registry/__init__.py +10 -6
- claude_mpm/services/agents/registry/deployed_agent_discovery.py +30 -27
- claude_mpm/services/agents/registry/modification_tracker.py +3 -6
- claude_mpm/services/async_session_logger.py +1 -2
- claude_mpm/services/claude_session_logger.py +1 -2
- claude_mpm/services/command_deployment_service.py +173 -0
- claude_mpm/services/command_handler_service.py +20 -22
- claude_mpm/services/core/__init__.py +25 -25
- claude_mpm/services/core/base.py +0 -5
- claude_mpm/services/core/interfaces/__init__.py +32 -32
- claude_mpm/services/core/interfaces/agent.py +0 -21
- claude_mpm/services/core/interfaces/communication.py +0 -27
- claude_mpm/services/core/interfaces/infrastructure.py +0 -56
- claude_mpm/services/core/interfaces/service.py +0 -29
- claude_mpm/services/diagnostics/__init__.py +1 -1
- claude_mpm/services/diagnostics/checks/__init__.py +6 -6
- claude_mpm/services/diagnostics/checks/agent_check.py +89 -80
- claude_mpm/services/diagnostics/checks/base_check.py +12 -16
- claude_mpm/services/diagnostics/checks/claude_desktop_check.py +84 -81
- claude_mpm/services/diagnostics/checks/common_issues_check.py +99 -91
- claude_mpm/services/diagnostics/checks/configuration_check.py +82 -77
- claude_mpm/services/diagnostics/checks/filesystem_check.py +67 -68
- claude_mpm/services/diagnostics/checks/installation_check.py +254 -94
- claude_mpm/services/diagnostics/checks/mcp_check.py +90 -88
- claude_mpm/services/diagnostics/checks/monitor_check.py +75 -76
- claude_mpm/services/diagnostics/checks/startup_log_check.py +67 -73
- claude_mpm/services/diagnostics/diagnostic_runner.py +67 -59
- claude_mpm/services/diagnostics/doctor_reporter.py +107 -70
- claude_mpm/services/diagnostics/models.py +21 -19
- claude_mpm/services/event_aggregator.py +10 -17
- claude_mpm/services/event_bus/__init__.py +1 -1
- claude_mpm/services/event_bus/config.py +54 -35
- claude_mpm/services/event_bus/event_bus.py +76 -71
- claude_mpm/services/event_bus/relay.py +74 -64
- claude_mpm/services/events/__init__.py +11 -11
- claude_mpm/services/events/consumers/__init__.py +3 -3
- claude_mpm/services/events/consumers/dead_letter.py +71 -63
- claude_mpm/services/events/consumers/logging.py +39 -37
- claude_mpm/services/events/consumers/metrics.py +56 -57
- claude_mpm/services/events/consumers/socketio.py +82 -81
- claude_mpm/services/events/core.py +110 -99
- claude_mpm/services/events/interfaces.py +56 -72
- claude_mpm/services/events/producers/__init__.py +1 -1
- claude_mpm/services/events/producers/hook.py +38 -38
- claude_mpm/services/events/producers/system.py +46 -44
- claude_mpm/services/exceptions.py +81 -80
- claude_mpm/services/framework_claude_md_generator/__init__.py +2 -4
- claude_mpm/services/framework_claude_md_generator/content_assembler.py +3 -5
- claude_mpm/services/framework_claude_md_generator/content_validator.py +1 -1
- claude_mpm/services/framework_claude_md_generator/deployment_manager.py +4 -4
- claude_mpm/services/framework_claude_md_generator/section_generators/__init__.py +0 -1
- claude_mpm/services/framework_claude_md_generator/section_generators/agents.py +0 -2
- claude_mpm/services/framework_claude_md_generator/version_manager.py +4 -5
- claude_mpm/services/hook_service.py +6 -9
- claude_mpm/services/infrastructure/__init__.py +1 -1
- claude_mpm/services/infrastructure/context_preservation.py +8 -12
- claude_mpm/services/infrastructure/monitoring.py +21 -23
- claude_mpm/services/mcp_gateway/__init__.py +37 -37
- claude_mpm/services/mcp_gateway/auto_configure.py +95 -103
- claude_mpm/services/mcp_gateway/config/__init__.py +1 -1
- claude_mpm/services/mcp_gateway/config/config_loader.py +23 -25
- claude_mpm/services/mcp_gateway/config/config_schema.py +5 -5
- claude_mpm/services/mcp_gateway/config/configuration.py +9 -6
- claude_mpm/services/mcp_gateway/core/__init__.py +10 -10
- claude_mpm/services/mcp_gateway/core/base.py +0 -3
- claude_mpm/services/mcp_gateway/core/interfaces.py +1 -38
- claude_mpm/services/mcp_gateway/core/process_pool.py +99 -93
- claude_mpm/services/mcp_gateway/core/singleton_manager.py +65 -62
- claude_mpm/services/mcp_gateway/core/startup_verification.py +75 -74
- claude_mpm/services/mcp_gateway/main.py +2 -1
- claude_mpm/services/mcp_gateway/registry/service_registry.py +5 -8
- claude_mpm/services/mcp_gateway/registry/tool_registry.py +1 -1
- claude_mpm/services/mcp_gateway/server/__init__.py +1 -1
- claude_mpm/services/mcp_gateway/server/mcp_gateway.py +12 -19
- claude_mpm/services/mcp_gateway/server/stdio_handler.py +4 -3
- claude_mpm/services/mcp_gateway/server/stdio_server.py +79 -71
- claude_mpm/services/mcp_gateway/tools/__init__.py +2 -2
- claude_mpm/services/mcp_gateway/tools/base_adapter.py +5 -6
- claude_mpm/services/mcp_gateway/tools/document_summarizer.py +13 -22
- claude_mpm/services/mcp_gateway/tools/health_check_tool.py +79 -78
- claude_mpm/services/mcp_gateway/tools/hello_world.py +12 -14
- claude_mpm/services/mcp_gateway/tools/ticket_tools.py +42 -49
- claude_mpm/services/mcp_gateway/tools/unified_ticket_tool.py +51 -55
- claude_mpm/services/memory/__init__.py +3 -3
- claude_mpm/services/memory/builder.py +3 -6
- claude_mpm/services/memory/cache/__init__.py +1 -1
- claude_mpm/services/memory/cache/shared_prompt_cache.py +3 -5
- claude_mpm/services/memory/cache/simple_cache.py +1 -1
- claude_mpm/services/memory/indexed_memory.py +5 -7
- claude_mpm/services/memory/optimizer.py +7 -10
- claude_mpm/services/memory/router.py +8 -9
- claude_mpm/services/memory_hook_service.py +48 -34
- claude_mpm/services/monitor_build_service.py +77 -73
- claude_mpm/services/port_manager.py +130 -108
- claude_mpm/services/project/analyzer.py +12 -10
- claude_mpm/services/project/registry.py +11 -11
- claude_mpm/services/recovery_manager.py +10 -19
- claude_mpm/services/response_tracker.py +0 -1
- claude_mpm/services/runner_configuration_service.py +19 -20
- claude_mpm/services/session_management_service.py +7 -11
- claude_mpm/services/shared/__init__.py +1 -1
- claude_mpm/services/shared/async_service_base.py +58 -50
- claude_mpm/services/shared/config_service_base.py +73 -67
- claude_mpm/services/shared/lifecycle_service_base.py +82 -78
- claude_mpm/services/shared/manager_base.py +94 -82
- claude_mpm/services/shared/service_factory.py +96 -98
- claude_mpm/services/socketio/__init__.py +3 -3
- claude_mpm/services/socketio/client_proxy.py +5 -5
- claude_mpm/services/socketio/event_normalizer.py +199 -181
- claude_mpm/services/socketio/handlers/__init__.py +3 -3
- claude_mpm/services/socketio/handlers/base.py +5 -4
- claude_mpm/services/socketio/handlers/connection.py +163 -136
- claude_mpm/services/socketio/handlers/file.py +13 -14
- claude_mpm/services/socketio/handlers/git.py +12 -7
- claude_mpm/services/socketio/handlers/hook.py +49 -44
- claude_mpm/services/socketio/handlers/memory.py +0 -1
- claude_mpm/services/socketio/handlers/project.py +0 -1
- claude_mpm/services/socketio/handlers/registry.py +37 -19
- claude_mpm/services/socketio/migration_utils.py +98 -84
- claude_mpm/services/socketio/server/__init__.py +1 -1
- claude_mpm/services/socketio/server/broadcaster.py +81 -87
- claude_mpm/services/socketio/server/core.py +65 -54
- claude_mpm/services/socketio/server/eventbus_integration.py +95 -56
- claude_mpm/services/socketio/server/main.py +64 -38
- claude_mpm/services/socketio_client_manager.py +10 -12
- claude_mpm/services/subprocess_launcher_service.py +4 -7
- claude_mpm/services/system_instructions_service.py +13 -14
- claude_mpm/services/ticket_manager.py +2 -2
- claude_mpm/services/utility_service.py +5 -13
- claude_mpm/services/version_control/__init__.py +16 -16
- claude_mpm/services/version_control/branch_strategy.py +5 -8
- claude_mpm/services/version_control/conflict_resolution.py +9 -23
- claude_mpm/services/version_control/git_operations.py +5 -7
- claude_mpm/services/version_control/semantic_versioning.py +16 -17
- claude_mpm/services/version_control/version_parser.py +13 -18
- claude_mpm/services/version_service.py +10 -11
- claude_mpm/storage/__init__.py +1 -1
- claude_mpm/storage/state_storage.py +22 -28
- claude_mpm/utils/__init__.py +6 -6
- claude_mpm/utils/agent_dependency_loader.py +47 -33
- claude_mpm/utils/config_manager.py +11 -14
- claude_mpm/utils/dependency_cache.py +1 -1
- claude_mpm/utils/dependency_manager.py +13 -17
- claude_mpm/utils/dependency_strategies.py +8 -10
- claude_mpm/utils/environment_context.py +3 -9
- claude_mpm/utils/error_handler.py +3 -13
- claude_mpm/utils/file_utils.py +1 -1
- claude_mpm/utils/path_operations.py +8 -12
- claude_mpm/utils/robust_installer.py +110 -33
- claude_mpm/utils/subprocess_utils.py +5 -6
- claude_mpm/validation/agent_validator.py +3 -6
- claude_mpm/validation/frontmatter_validator.py +1 -1
- {claude_mpm-4.1.1.dist-info ā claude_mpm-4.1.2.dist-info}/METADATA +1 -1
- claude_mpm-4.1.2.dist-info/RECORD +498 -0
- claude_mpm-4.1.1.dist-info/RECORD +0 -494
- {claude_mpm-4.1.1.dist-info ā claude_mpm-4.1.2.dist-info}/WHEEL +0 -0
- {claude_mpm-4.1.1.dist-info ā claude_mpm-4.1.2.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.1.1.dist-info ā claude_mpm-4.1.2.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.1.1.dist-info ā claude_mpm-4.1.2.dist-info}/top_level.txt +0 -0
|
@@ -15,16 +15,12 @@ import json
|
|
|
15
15
|
import os
|
|
16
16
|
from datetime import datetime
|
|
17
17
|
from pathlib import Path
|
|
18
|
-
from typing import
|
|
18
|
+
from typing import Any, Dict
|
|
19
19
|
|
|
20
|
-
import click
|
|
21
|
-
|
|
22
|
-
from ...core.config import Config
|
|
23
20
|
from ...core.logger import get_logger
|
|
24
21
|
from ...core.shared.config_loader import ConfigLoader
|
|
25
22
|
from ...services.agents.memory import AgentMemoryManager
|
|
26
|
-
from ..shared.base_command import
|
|
27
|
-
from ..shared.argument_patterns import add_memory_arguments, add_output_arguments
|
|
23
|
+
from ..shared.base_command import CommandResult, MemoryCommand
|
|
28
24
|
|
|
29
25
|
|
|
30
26
|
class MemoryManagementCommand(MemoryCommand):
|
|
@@ -49,8 +45,17 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
49
45
|
def validate_args(self, args) -> str:
|
|
50
46
|
"""Validate command arguments."""
|
|
51
47
|
# Check if memory command is valid
|
|
52
|
-
if hasattr(args,
|
|
53
|
-
valid_commands = [
|
|
48
|
+
if hasattr(args, "memory_command") and args.memory_command:
|
|
49
|
+
valid_commands = [
|
|
50
|
+
"init",
|
|
51
|
+
"view",
|
|
52
|
+
"add",
|
|
53
|
+
"clean",
|
|
54
|
+
"optimize",
|
|
55
|
+
"build",
|
|
56
|
+
"cross-ref",
|
|
57
|
+
"route",
|
|
58
|
+
]
|
|
54
59
|
if args.memory_command not in valid_commands:
|
|
55
60
|
return f"Unknown memory command: {args.memory_command}. Valid commands: {', '.join(valid_commands)}"
|
|
56
61
|
return None
|
|
@@ -59,7 +64,7 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
59
64
|
"""Execute the memory command."""
|
|
60
65
|
try:
|
|
61
66
|
# Handle default case (no subcommand)
|
|
62
|
-
if not hasattr(args,
|
|
67
|
+
if not hasattr(args, "memory_command") or not args.memory_command:
|
|
63
68
|
return self._show_status(args)
|
|
64
69
|
|
|
65
70
|
# Route to specific subcommand handlers
|
|
@@ -78,20 +83,17 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
78
83
|
|
|
79
84
|
if args.memory_command in command_map:
|
|
80
85
|
return command_map[args.memory_command](args)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
print(f"ā {error_msg}")
|
|
93
|
-
print(f"Available commands: {', '.join(available_commands)}")
|
|
94
|
-
return CommandResult.error_result(error_msg)
|
|
86
|
+
available_commands = list(command_map.keys())
|
|
87
|
+
error_msg = f"Unknown memory command: {args.memory_command}"
|
|
88
|
+
|
|
89
|
+
output_format = getattr(args, "format", "text")
|
|
90
|
+
if output_format in ["json", "yaml"]:
|
|
91
|
+
return CommandResult.error_result(
|
|
92
|
+
error_msg, data={"available_commands": available_commands}
|
|
93
|
+
)
|
|
94
|
+
print(f"ā {error_msg}")
|
|
95
|
+
print(f"Available commands: {', '.join(available_commands)}")
|
|
96
|
+
return CommandResult.error_result(error_msg)
|
|
95
97
|
|
|
96
98
|
except Exception as e:
|
|
97
99
|
self.logger.error(f"Error managing memory: {e}", exc_info=True)
|
|
@@ -100,16 +102,17 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
100
102
|
def _show_status(self, args) -> CommandResult:
|
|
101
103
|
"""Show memory system status."""
|
|
102
104
|
try:
|
|
103
|
-
output_format = getattr(args,
|
|
105
|
+
output_format = getattr(args, "format", "text")
|
|
104
106
|
|
|
105
|
-
if output_format in [
|
|
107
|
+
if output_format in ["json", "yaml"]:
|
|
106
108
|
# Structured output
|
|
107
109
|
status_data = self._get_status_data()
|
|
108
|
-
return CommandResult.success_result(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
return CommandResult.success_result(
|
|
111
|
+
"Memory status retrieved", data=status_data
|
|
112
|
+
)
|
|
113
|
+
# Text output using existing function
|
|
114
|
+
_show_status(self.memory_manager)
|
|
115
|
+
return CommandResult.success_result("Memory status displayed")
|
|
113
116
|
|
|
114
117
|
except Exception as e:
|
|
115
118
|
self.logger.error(f"Error showing memory status: {e}", exc_info=True)
|
|
@@ -125,7 +128,7 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
125
128
|
"exists": False,
|
|
126
129
|
"agents": [],
|
|
127
130
|
"total_size_kb": 0,
|
|
128
|
-
"total_files": 0
|
|
131
|
+
"total_files": 0,
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
agents = []
|
|
@@ -136,34 +139,37 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
136
139
|
size = memory_file.stat().st_size
|
|
137
140
|
total_size += size
|
|
138
141
|
|
|
139
|
-
agents.append(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
agents.append(
|
|
143
|
+
{
|
|
144
|
+
"agent_id": memory_file.stem,
|
|
145
|
+
"file": memory_file.name,
|
|
146
|
+
"size_kb": size / 1024,
|
|
147
|
+
"path": str(memory_file),
|
|
148
|
+
}
|
|
149
|
+
)
|
|
145
150
|
|
|
146
151
|
return {
|
|
147
152
|
"memory_directory": str(memory_dir),
|
|
148
153
|
"exists": True,
|
|
149
154
|
"agents": agents,
|
|
150
155
|
"total_size_kb": total_size / 1024,
|
|
151
|
-
"total_files": len(agents)
|
|
156
|
+
"total_files": len(agents),
|
|
152
157
|
}
|
|
153
158
|
|
|
154
159
|
def _show_memories(self, args) -> CommandResult:
|
|
155
160
|
"""Show agent memories."""
|
|
156
161
|
try:
|
|
157
|
-
output_format = getattr(args,
|
|
162
|
+
output_format = getattr(args, "format", "text")
|
|
158
163
|
|
|
159
|
-
if output_format in [
|
|
164
|
+
if output_format in ["json", "yaml"]:
|
|
160
165
|
# Structured output
|
|
161
166
|
memories_data = self._get_memories_data(args)
|
|
162
|
-
return CommandResult.success_result(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
+
return CommandResult.success_result(
|
|
168
|
+
"Memories retrieved", data=memories_data
|
|
169
|
+
)
|
|
170
|
+
# Text output using existing function
|
|
171
|
+
_show_memories(args, self.memory_manager)
|
|
172
|
+
return CommandResult.success_result("Memories displayed")
|
|
167
173
|
|
|
168
174
|
except Exception as e:
|
|
169
175
|
self.logger.error(f"Error showing memories: {e}", exc_info=True)
|
|
@@ -171,7 +177,7 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
171
177
|
|
|
172
178
|
def _get_memories_data(self, args) -> Dict[str, Any]:
|
|
173
179
|
"""Get memories as structured data."""
|
|
174
|
-
agent_id = getattr(args,
|
|
180
|
+
agent_id = getattr(args, "agent", None)
|
|
175
181
|
|
|
176
182
|
if agent_id:
|
|
177
183
|
# Single agent memory
|
|
@@ -179,48 +185,48 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
179
185
|
return {
|
|
180
186
|
"agent_id": agent_id,
|
|
181
187
|
"memory_content": memory_content,
|
|
182
|
-
"has_memory": bool(memory_content)
|
|
188
|
+
"has_memory": bool(memory_content),
|
|
183
189
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return {"agents": [], "memory_directory": str(memory_dir), "exists": False}
|
|
189
|
-
|
|
190
|
-
agents = {}
|
|
191
|
-
for memory_file in memory_dir.glob("*.md"):
|
|
192
|
-
if memory_file.is_file():
|
|
193
|
-
agent_id = memory_file.stem
|
|
194
|
-
memory_content = self.memory_manager.load_agent_memory(agent_id)
|
|
195
|
-
agents[agent_id] = {
|
|
196
|
-
"memory_content": memory_content,
|
|
197
|
-
"file_path": str(memory_file)
|
|
198
|
-
}
|
|
190
|
+
# All agent memories
|
|
191
|
+
memory_dir = self.memory_manager.memories_dir
|
|
192
|
+
if not memory_dir.exists():
|
|
193
|
+
return {"agents": [], "memory_directory": str(memory_dir), "exists": False}
|
|
199
194
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
195
|
+
agents = {}
|
|
196
|
+
for memory_file in memory_dir.glob("*.md"):
|
|
197
|
+
if memory_file.is_file():
|
|
198
|
+
agent_id = memory_file.stem
|
|
199
|
+
memory_content = self.memory_manager.load_agent_memory(agent_id)
|
|
200
|
+
agents[agent_id] = {
|
|
201
|
+
"memory_content": memory_content,
|
|
202
|
+
"file_path": str(memory_file),
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
"agents": agents,
|
|
207
|
+
"memory_directory": str(memory_dir),
|
|
208
|
+
"exists": True,
|
|
209
|
+
"agent_count": len(agents),
|
|
210
|
+
}
|
|
206
211
|
|
|
207
212
|
def _init_memory(self, args) -> CommandResult:
|
|
208
213
|
"""Initialize project-specific memories."""
|
|
209
214
|
try:
|
|
210
|
-
output_format = getattr(args,
|
|
215
|
+
output_format = getattr(args, "format", "text")
|
|
211
216
|
|
|
212
|
-
if output_format in [
|
|
217
|
+
if output_format in ["json", "yaml"]:
|
|
213
218
|
# For structured output, return the initialization task
|
|
214
219
|
task_data = {
|
|
215
220
|
"task": "Initialize project-specific agent memories",
|
|
216
221
|
"description": "Analyze project structure and create targeted memories for agents",
|
|
217
|
-
"suggested_command": "claude-mpm memory add --agent <agent_name> --learning '<insight>'"
|
|
222
|
+
"suggested_command": "claude-mpm memory add --agent <agent_name> --learning '<insight>'",
|
|
218
223
|
}
|
|
219
|
-
return CommandResult.success_result(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
+
return CommandResult.success_result(
|
|
225
|
+
"Memory initialization task created", data=task_data
|
|
226
|
+
)
|
|
227
|
+
# Text output using existing function
|
|
228
|
+
_init_memory(args, self.memory_manager)
|
|
229
|
+
return CommandResult.success_result("Memory initialization task displayed")
|
|
224
230
|
|
|
225
231
|
except Exception as e:
|
|
226
232
|
self.logger.error(f"Error initializing memory: {e}", exc_info=True)
|
|
@@ -229,17 +235,16 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
229
235
|
def _add_learning(self, args) -> CommandResult:
|
|
230
236
|
"""Add learning to agent memory."""
|
|
231
237
|
try:
|
|
232
|
-
output_format = getattr(args,
|
|
238
|
+
output_format = getattr(args, "format", "text")
|
|
233
239
|
|
|
234
|
-
if output_format in [
|
|
240
|
+
if output_format in ["json", "yaml"]:
|
|
235
241
|
# For structured output, we'd need to implement the actual learning addition
|
|
236
242
|
# For now, delegate to existing function and return success
|
|
237
243
|
_add_learning(args, self.memory_manager)
|
|
238
244
|
return CommandResult.success_result("Learning added to agent memory")
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return CommandResult.success_result("Learning added")
|
|
245
|
+
# Text output using existing function
|
|
246
|
+
_add_learning(args, self.memory_manager)
|
|
247
|
+
return CommandResult.success_result("Learning added")
|
|
243
248
|
|
|
244
249
|
except Exception as e:
|
|
245
250
|
self.logger.error(f"Error adding learning: {e}", exc_info=True)
|
|
@@ -248,16 +253,21 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
248
253
|
def _clean_memory(self, args) -> CommandResult:
|
|
249
254
|
"""Clean up old/unused memory files."""
|
|
250
255
|
try:
|
|
251
|
-
output_format = getattr(args,
|
|
256
|
+
output_format = getattr(args, "format", "text")
|
|
252
257
|
|
|
253
|
-
if output_format in [
|
|
258
|
+
if output_format in ["json", "yaml"]:
|
|
254
259
|
# For structured output, return cleanup results
|
|
255
|
-
cleanup_data = {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
return CommandResult.success_result(
|
|
260
|
+
cleanup_data = {
|
|
261
|
+
"cleaned_files": [],
|
|
262
|
+
"errors": [],
|
|
263
|
+
"summary": "Memory cleanup completed",
|
|
264
|
+
}
|
|
265
|
+
return CommandResult.success_result(
|
|
266
|
+
"Memory cleanup completed", data=cleanup_data
|
|
267
|
+
)
|
|
268
|
+
# Text output using existing function
|
|
269
|
+
_clean_memory(args, self.memory_manager)
|
|
270
|
+
return CommandResult.success_result("Memory cleanup completed")
|
|
261
271
|
|
|
262
272
|
except Exception as e:
|
|
263
273
|
self.logger.error(f"Error cleaning memory: {e}", exc_info=True)
|
|
@@ -266,16 +276,21 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
266
276
|
def _optimize_memory(self, args) -> CommandResult:
|
|
267
277
|
"""Optimize memory files."""
|
|
268
278
|
try:
|
|
269
|
-
output_format = getattr(args,
|
|
279
|
+
output_format = getattr(args, "format", "text")
|
|
270
280
|
|
|
271
|
-
if output_format in [
|
|
281
|
+
if output_format in ["json", "yaml"]:
|
|
272
282
|
# For structured output, return optimization results
|
|
273
|
-
optimization_data = {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
return CommandResult.success_result(
|
|
283
|
+
optimization_data = {
|
|
284
|
+
"optimized_agents": [],
|
|
285
|
+
"size_reduction": 0,
|
|
286
|
+
"summary": "Memory optimization completed",
|
|
287
|
+
}
|
|
288
|
+
return CommandResult.success_result(
|
|
289
|
+
"Memory optimization completed", data=optimization_data
|
|
290
|
+
)
|
|
291
|
+
# Text output using existing function
|
|
292
|
+
_optimize_memory(args, self.memory_manager)
|
|
293
|
+
return CommandResult.success_result("Memory optimization completed")
|
|
279
294
|
|
|
280
295
|
except Exception as e:
|
|
281
296
|
self.logger.error(f"Error optimizing memory: {e}", exc_info=True)
|
|
@@ -284,16 +299,21 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
284
299
|
def _build_memory(self, args) -> CommandResult:
|
|
285
300
|
"""Build agent memories from project documentation."""
|
|
286
301
|
try:
|
|
287
|
-
output_format = getattr(args,
|
|
302
|
+
output_format = getattr(args, "format", "text")
|
|
288
303
|
|
|
289
|
-
if output_format in [
|
|
304
|
+
if output_format in ["json", "yaml"]:
|
|
290
305
|
# For structured output, return build results
|
|
291
|
-
build_data = {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
return CommandResult.success_result(
|
|
306
|
+
build_data = {
|
|
307
|
+
"built_memories": [],
|
|
308
|
+
"processed_files": [],
|
|
309
|
+
"summary": "Memory build completed",
|
|
310
|
+
}
|
|
311
|
+
return CommandResult.success_result(
|
|
312
|
+
"Memory build completed", data=build_data
|
|
313
|
+
)
|
|
314
|
+
# Text output using existing function
|
|
315
|
+
_build_memory(args, self.memory_manager)
|
|
316
|
+
return CommandResult.success_result("Memory build completed")
|
|
297
317
|
|
|
298
318
|
except Exception as e:
|
|
299
319
|
self.logger.error(f"Error building memory: {e}", exc_info=True)
|
|
@@ -302,16 +322,21 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
302
322
|
def _cross_reference_memory(self, args) -> CommandResult:
|
|
303
323
|
"""Find cross-references and common patterns."""
|
|
304
324
|
try:
|
|
305
|
-
output_format = getattr(args,
|
|
325
|
+
output_format = getattr(args, "format", "text")
|
|
306
326
|
|
|
307
|
-
if output_format in [
|
|
327
|
+
if output_format in ["json", "yaml"]:
|
|
308
328
|
# For structured output, return cross-reference results
|
|
309
|
-
crossref_data = {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
return CommandResult.success_result(
|
|
329
|
+
crossref_data = {
|
|
330
|
+
"common_patterns": [],
|
|
331
|
+
"agent_similarities": [],
|
|
332
|
+
"summary": "Cross-reference analysis completed",
|
|
333
|
+
}
|
|
334
|
+
return CommandResult.success_result(
|
|
335
|
+
"Cross-reference analysis completed", data=crossref_data
|
|
336
|
+
)
|
|
337
|
+
# Text output using existing function
|
|
338
|
+
_cross_reference_memory(args, self.memory_manager)
|
|
339
|
+
return CommandResult.success_result("Cross-reference analysis completed")
|
|
315
340
|
|
|
316
341
|
except Exception as e:
|
|
317
342
|
self.logger.error(f"Error cross-referencing memory: {e}", exc_info=True)
|
|
@@ -320,16 +345,21 @@ class MemoryManagementCommand(MemoryCommand):
|
|
|
320
345
|
def _route_memory_command(self, args) -> CommandResult:
|
|
321
346
|
"""Route memory command to appropriate agent."""
|
|
322
347
|
try:
|
|
323
|
-
output_format = getattr(args,
|
|
348
|
+
output_format = getattr(args, "format", "text")
|
|
324
349
|
|
|
325
|
-
if output_format in [
|
|
350
|
+
if output_format in ["json", "yaml"]:
|
|
326
351
|
# For structured output, return routing results
|
|
327
|
-
routing_data = {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
return CommandResult.success_result(
|
|
352
|
+
routing_data = {
|
|
353
|
+
"routed_to": "memory_agent",
|
|
354
|
+
"command": getattr(args, "command", ""),
|
|
355
|
+
"summary": "Command routed successfully",
|
|
356
|
+
}
|
|
357
|
+
return CommandResult.success_result(
|
|
358
|
+
"Command routed successfully", data=routing_data
|
|
359
|
+
)
|
|
360
|
+
# Text output using existing function
|
|
361
|
+
_route_memory_command(args, self.memory_manager)
|
|
362
|
+
return CommandResult.success_result("Command routed successfully")
|
|
333
363
|
|
|
334
364
|
except Exception as e:
|
|
335
365
|
self.logger.error(f"Error routing memory command: {e}", exc_info=True)
|
|
@@ -346,7 +376,7 @@ def manage_memory(args):
|
|
|
346
376
|
result = command.execute(args)
|
|
347
377
|
|
|
348
378
|
# Print result if structured output format is requested
|
|
349
|
-
if hasattr(args,
|
|
379
|
+
if hasattr(args, "format") and args.format in ["json", "yaml"]:
|
|
350
380
|
command.print_result(result, args)
|
|
351
381
|
|
|
352
382
|
return result.exit_code
|
|
@@ -361,7 +391,7 @@ def manage_memory(args) -> int:
|
|
|
361
391
|
result = command.execute(args)
|
|
362
392
|
|
|
363
393
|
# Print result if structured output format is requested
|
|
364
|
-
if hasattr(args,
|
|
394
|
+
if hasattr(args, "format") and args.format in ["json", "yaml"]:
|
|
365
395
|
command.print_result(result, args)
|
|
366
396
|
|
|
367
397
|
return result.exit_code
|
|
@@ -379,7 +409,7 @@ def _init_memory(args, memory_manager):
|
|
|
379
409
|
args: Command line arguments (unused but kept for consistency)
|
|
380
410
|
memory_manager: AgentMemoryManager instance
|
|
381
411
|
"""
|
|
382
|
-
|
|
412
|
+
get_logger("cli")
|
|
383
413
|
|
|
384
414
|
print("š Initializing project-specific memories...")
|
|
385
415
|
print("=" * 80)
|
|
@@ -493,7 +523,7 @@ def _show_status(memory_manager):
|
|
|
493
523
|
# Show per-agent details
|
|
494
524
|
agents = status.get("agents", {})
|
|
495
525
|
if agents:
|
|
496
|
-
print(
|
|
526
|
+
print("š Agent Memory Details:")
|
|
497
527
|
for agent_id, agent_info in sorted(agents.items()):
|
|
498
528
|
if "error" in agent_info:
|
|
499
529
|
print(f" ā {agent_id}: Error - {agent_info['error']}")
|
|
@@ -554,8 +584,15 @@ def _show_basic_status(memory_manager):
|
|
|
554
584
|
memory_files = list(memory_dir.glob("*_memories.md"))
|
|
555
585
|
# Also check for old formats for backward compatibility
|
|
556
586
|
memory_files.extend(memory_dir.glob("*_agent.md"))
|
|
557
|
-
memory_files.extend(
|
|
558
|
-
|
|
587
|
+
memory_files.extend(
|
|
588
|
+
[
|
|
589
|
+
f
|
|
590
|
+
for f in memory_dir.glob("*.md")
|
|
591
|
+
if f.name != "README.md"
|
|
592
|
+
and not f.name.endswith("_memories.md")
|
|
593
|
+
and not f.name.endswith("_agent.md")
|
|
594
|
+
]
|
|
595
|
+
)
|
|
559
596
|
|
|
560
597
|
if not memory_files:
|
|
561
598
|
print("š No memory files found")
|
|
@@ -680,8 +717,15 @@ def _clean_memory(args, memory_manager):
|
|
|
680
717
|
memory_files = list(memory_dir.glob("*_memories.md"))
|
|
681
718
|
# Also check for old formats for backward compatibility
|
|
682
719
|
memory_files.extend(memory_dir.glob("*_agent.md"))
|
|
683
|
-
memory_files.extend(
|
|
684
|
-
|
|
720
|
+
memory_files.extend(
|
|
721
|
+
[
|
|
722
|
+
f
|
|
723
|
+
for f in memory_dir.glob("*.md")
|
|
724
|
+
if f.name != "README.md"
|
|
725
|
+
and not f.name.endswith("_memories.md")
|
|
726
|
+
and not f.name.endswith("_agent.md")
|
|
727
|
+
]
|
|
728
|
+
)
|
|
685
729
|
if not memory_files:
|
|
686
730
|
print("š No memory files found - nothing to clean")
|
|
687
731
|
return
|
|
@@ -756,7 +800,7 @@ def _build_memory(args, memory_manager):
|
|
|
756
800
|
result = memory_manager.build_memories_from_docs(force_rebuild)
|
|
757
801
|
|
|
758
802
|
if result.get("success"):
|
|
759
|
-
print(
|
|
803
|
+
print("ā
Successfully processed documentation")
|
|
760
804
|
print(f" Files processed: {result.get('files_processed', 0)}")
|
|
761
805
|
print(f" Memories created: {result.get('memories_created', 0)}")
|
|
762
806
|
print(f" Memories updated: {result.get('memories_updated', 0)}")
|
|
@@ -839,7 +883,7 @@ def _cross_reference_memory(args, memory_manager):
|
|
|
839
883
|
# Display agent correlations
|
|
840
884
|
correlations = result.get("agent_correlations", {})
|
|
841
885
|
if correlations:
|
|
842
|
-
print(
|
|
886
|
+
print("\nš¤ Agent knowledge correlations:")
|
|
843
887
|
sorted_correlations = sorted(
|
|
844
888
|
correlations.items(), key=lambda x: x[1], reverse=True
|
|
845
889
|
)
|
|
@@ -941,8 +985,15 @@ def _show_all_agent_memories(format_type, memory_manager):
|
|
|
941
985
|
memory_files = list(memory_dir.glob("*_memories.md"))
|
|
942
986
|
# Also check for old formats for backward compatibility
|
|
943
987
|
memory_files.extend(memory_dir.glob("*_agent.md"))
|
|
944
|
-
memory_files.extend(
|
|
945
|
-
|
|
988
|
+
memory_files.extend(
|
|
989
|
+
[
|
|
990
|
+
f
|
|
991
|
+
for f in memory_dir.glob("*.md")
|
|
992
|
+
if f.name != "README.md"
|
|
993
|
+
and not f.name.endswith("_memories.md")
|
|
994
|
+
and not f.name.endswith("_agent.md")
|
|
995
|
+
]
|
|
996
|
+
)
|
|
946
997
|
if not memory_files:
|
|
947
998
|
print("š No agent memories found")
|
|
948
999
|
return
|
|
@@ -1042,7 +1093,7 @@ def _find_common_patterns(agent_memories):
|
|
|
1042
1093
|
for agent_id, sections in agent_memories.items():
|
|
1043
1094
|
agent_patterns[agent_id] = set()
|
|
1044
1095
|
|
|
1045
|
-
for
|
|
1096
|
+
for _section_name, items in sections.items():
|
|
1046
1097
|
for item in items:
|
|
1047
1098
|
# Normalize item for comparison (lowercase, basic cleanup)
|
|
1048
1099
|
normalized = item.lower().strip()
|
|
@@ -1123,7 +1174,7 @@ def _route_memory_command(args, memory_manager):
|
|
|
1123
1174
|
confidence = result.get("confidence", 0.0)
|
|
1124
1175
|
reasoning = result.get("reasoning", "No reasoning provided")
|
|
1125
1176
|
|
|
1126
|
-
print(
|
|
1177
|
+
print("\nšÆ Routing Decision:")
|
|
1127
1178
|
print(f" Target Agent: {target_agent}")
|
|
1128
1179
|
print(f" Section: {section}")
|
|
1129
1180
|
print(f" Confidence: {confidence:.2f}")
|
|
@@ -1132,7 +1183,7 @@ def _route_memory_command(args, memory_manager):
|
|
|
1132
1183
|
# Show agent scores if available
|
|
1133
1184
|
agent_scores = result.get("agent_scores", {})
|
|
1134
1185
|
if agent_scores:
|
|
1135
|
-
print(
|
|
1186
|
+
print("\nš Agent Relevance Scores:")
|
|
1136
1187
|
sorted_scores = sorted(
|
|
1137
1188
|
[(agent, data["score"]) for agent, data in agent_scores.items()],
|
|
1138
1189
|
key=lambda x: x[1],
|
|
@@ -1184,7 +1235,7 @@ def _display_bulk_optimization_results(result):
|
|
|
1184
1235
|
"""Display optimization results for all agents."""
|
|
1185
1236
|
summary = result.get("summary", {})
|
|
1186
1237
|
|
|
1187
|
-
print(
|
|
1238
|
+
print("ā
Bulk optimization completed")
|
|
1188
1239
|
print(f" Agents processed: {summary.get('agents_processed', 0)}")
|
|
1189
1240
|
print(f" Agents optimized: {summary.get('agents_optimized', 0)}")
|
|
1190
1241
|
print(f" Total size before: {summary.get('total_size_before', 0):,} bytes")
|
|
@@ -1198,7 +1249,7 @@ def _display_bulk_optimization_results(result):
|
|
|
1198
1249
|
# Show per-agent summary
|
|
1199
1250
|
agents_results = result.get("agents", {})
|
|
1200
1251
|
if agents_results:
|
|
1201
|
-
print(
|
|
1252
|
+
print("\nš Per-agent results:")
|
|
1202
1253
|
for agent_id, agent_result in agents_results.items():
|
|
1203
1254
|
if agent_result.get("success"):
|
|
1204
1255
|
reduction = agent_result.get("size_reduction_percent", 0)
|
|
@@ -1234,7 +1285,7 @@ def _output_all_memories_raw(memory_manager):
|
|
|
1234
1285
|
except Exception as e:
|
|
1235
1286
|
error_output = {
|
|
1236
1287
|
"success": False,
|
|
1237
|
-
"error": f"Failed to retrieve all memories: {
|
|
1288
|
+
"error": f"Failed to retrieve all memories: {e!s}",
|
|
1238
1289
|
"timestamp": datetime.now().isoformat(),
|
|
1239
1290
|
}
|
|
1240
1291
|
print(json.dumps(error_output, indent=2))
|
|
@@ -1287,7 +1338,7 @@ def _output_single_agent_raw(agent_id, memory_manager):
|
|
|
1287
1338
|
except Exception as e:
|
|
1288
1339
|
error_output = {
|
|
1289
1340
|
"success": False,
|
|
1290
|
-
"error": f"Failed to retrieve memory for agent {agent_id}: {
|
|
1341
|
+
"error": f"Failed to retrieve memory for agent {agent_id}: {e!s}",
|
|
1291
1342
|
"timestamp": datetime.now().isoformat(),
|
|
1292
1343
|
}
|
|
1293
1344
|
print(json.dumps(error_output, indent=2))
|