claude-mpm 4.12.1__py3-none-any.whl → 4.13.0__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.
Potentially problematic release.
This version of claude-mpm might be problematic. Click here for more details.
- claude_mpm/VERSION +1 -1
- claude_mpm/agents/PM_INSTRUCTIONS.md +110 -459
- claude_mpm/agents/templates/README.md +465 -0
- claude_mpm/agents/templates/circuit_breakers.md +638 -0
- claude_mpm/agents/templates/git_file_tracking.md +584 -0
- claude_mpm/agents/templates/pm_examples.md +474 -0
- claude_mpm/agents/templates/pm_red_flags.md +240 -0
- claude_mpm/agents/templates/response_format.md +583 -0
- claude_mpm/agents/templates/validation_templates.md +312 -0
- claude_mpm/cli/__init__.py +10 -0
- claude_mpm/cli/commands/agents.py +31 -0
- claude_mpm/cli/commands/agents_detect.py +380 -0
- claude_mpm/cli/commands/agents_recommend.py +309 -0
- claude_mpm/cli/commands/auto_configure.py +564 -0
- claude_mpm/cli/parsers/agents_parser.py +9 -0
- claude_mpm/cli/parsers/auto_configure_parser.py +253 -0
- claude_mpm/cli/parsers/base_parser.py +7 -0
- claude_mpm/core/log_manager.py +2 -0
- claude_mpm/services/agents/__init__.py +18 -5
- claude_mpm/services/agents/auto_config_manager.py +797 -0
- claude_mpm/services/agents/observers.py +547 -0
- claude_mpm/services/agents/recommender.py +568 -0
- claude_mpm/services/core/__init__.py +33 -1
- claude_mpm/services/core/interfaces/__init__.py +16 -1
- claude_mpm/services/core/interfaces/agent.py +184 -0
- claude_mpm/services/core/interfaces/project.py +121 -0
- claude_mpm/services/core/models/__init__.py +46 -0
- claude_mpm/services/core/models/agent_config.py +397 -0
- claude_mpm/services/core/models/toolchain.py +306 -0
- claude_mpm/services/project/__init__.py +23 -0
- claude_mpm/services/project/detection_strategies.py +719 -0
- claude_mpm/services/project/toolchain_analyzer.py +581 -0
- {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/METADATA +1 -1
- {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/RECORD +38 -18
- {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/WHEEL +0 -0
- {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.12.1.dist-info → claude_mpm-4.13.0.dist-info}/top_level.txt +0 -0
|
@@ -21,6 +21,15 @@ from dataclasses import dataclass
|
|
|
21
21
|
from pathlib import Path
|
|
22
22
|
from typing import Any, Dict, List, Optional, Tuple
|
|
23
23
|
|
|
24
|
+
from ..models.agent_config import (
|
|
25
|
+
AgentCapabilities,
|
|
26
|
+
AgentRecommendation,
|
|
27
|
+
ConfigurationPreview,
|
|
28
|
+
ConfigurationResult,
|
|
29
|
+
ValidationResult,
|
|
30
|
+
)
|
|
31
|
+
from ..models.toolchain import ToolchainAnalysis
|
|
32
|
+
|
|
24
33
|
|
|
25
34
|
# Agent registry interface
|
|
26
35
|
@dataclass
|
|
@@ -328,3 +337,178 @@ class RunnerConfigurationInterface(ABC):
|
|
|
328
337
|
Args:
|
|
329
338
|
config: Logging configuration
|
|
330
339
|
"""
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
# Agent recommender interface
|
|
343
|
+
class IAgentRecommender(ABC):
|
|
344
|
+
"""Interface for agent recommendation operations.
|
|
345
|
+
|
|
346
|
+
WHY: Automated agent recommendation is critical for the auto-configuration
|
|
347
|
+
feature. This interface abstracts the recommendation logic to enable different
|
|
348
|
+
scoring algorithms, rule-based systems, and ML-based approaches.
|
|
349
|
+
|
|
350
|
+
DESIGN DECISION: Separates recommendation from configuration to enable
|
|
351
|
+
independent testing and different recommendation strategies (rule-based,
|
|
352
|
+
ML-based, hybrid). Returns structured recommendations with confidence scores.
|
|
353
|
+
"""
|
|
354
|
+
|
|
355
|
+
@abstractmethod
|
|
356
|
+
def recommend_agents(
|
|
357
|
+
self,
|
|
358
|
+
toolchain: ToolchainAnalysis,
|
|
359
|
+
constraints: Optional[Dict[str, Any]] = None,
|
|
360
|
+
) -> List[AgentRecommendation]:
|
|
361
|
+
"""Recommend agents based on toolchain analysis.
|
|
362
|
+
|
|
363
|
+
Analyzes the toolchain and recommends agents that best match the
|
|
364
|
+
project's technical requirements. Considers:
|
|
365
|
+
- Language compatibility
|
|
366
|
+
- Framework expertise
|
|
367
|
+
- Deployment environment requirements
|
|
368
|
+
- Optional user-defined constraints (max agents, required capabilities)
|
|
369
|
+
|
|
370
|
+
Args:
|
|
371
|
+
toolchain: Complete toolchain analysis results
|
|
372
|
+
constraints: Optional constraints for recommendations:
|
|
373
|
+
- max_agents: Maximum number of agents to recommend
|
|
374
|
+
- required_capabilities: List of required agent capabilities
|
|
375
|
+
- excluded_agents: List of agent IDs to exclude
|
|
376
|
+
- min_confidence: Minimum confidence score threshold
|
|
377
|
+
|
|
378
|
+
Returns:
|
|
379
|
+
List[AgentRecommendation]: Ordered list of recommended agents
|
|
380
|
+
with confidence scores and reasoning
|
|
381
|
+
|
|
382
|
+
Raises:
|
|
383
|
+
ValueError: If constraints are invalid or contradictory
|
|
384
|
+
"""
|
|
385
|
+
|
|
386
|
+
@abstractmethod
|
|
387
|
+
def get_agent_capabilities(self, agent_id: str) -> AgentCapabilities:
|
|
388
|
+
"""Get detailed capabilities for an agent.
|
|
389
|
+
|
|
390
|
+
Retrieves comprehensive capability information for a specific agent:
|
|
391
|
+
- Supported languages and frameworks
|
|
392
|
+
- Specialization areas
|
|
393
|
+
- Required toolchain components
|
|
394
|
+
- Performance characteristics
|
|
395
|
+
|
|
396
|
+
Args:
|
|
397
|
+
agent_id: Unique identifier of the agent
|
|
398
|
+
|
|
399
|
+
Returns:
|
|
400
|
+
AgentCapabilities: Complete capability information
|
|
401
|
+
|
|
402
|
+
Raises:
|
|
403
|
+
KeyError: If agent_id does not exist
|
|
404
|
+
"""
|
|
405
|
+
|
|
406
|
+
@abstractmethod
|
|
407
|
+
def match_score(self, agent_id: str, toolchain: ToolchainAnalysis) -> float:
|
|
408
|
+
"""Calculate match score between agent and toolchain.
|
|
409
|
+
|
|
410
|
+
Computes a numerical score (0.0 to 1.0) indicating how well an agent
|
|
411
|
+
matches the project's toolchain. Higher scores indicate better matches.
|
|
412
|
+
Considers:
|
|
413
|
+
- Language compatibility
|
|
414
|
+
- Framework experience
|
|
415
|
+
- Deployment target alignment
|
|
416
|
+
- Toolchain component coverage
|
|
417
|
+
|
|
418
|
+
Args:
|
|
419
|
+
agent_id: Unique identifier of the agent
|
|
420
|
+
toolchain: Complete toolchain analysis
|
|
421
|
+
|
|
422
|
+
Returns:
|
|
423
|
+
float: Match score between 0.0 (no match) and 1.0 (perfect match)
|
|
424
|
+
|
|
425
|
+
Raises:
|
|
426
|
+
KeyError: If agent_id does not exist
|
|
427
|
+
"""
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
# Auto-configuration manager interface
|
|
431
|
+
class IAutoConfigManager(ABC):
|
|
432
|
+
"""Interface for automated configuration management.
|
|
433
|
+
|
|
434
|
+
WHY: Auto-configuration orchestrates the entire process of analyzing,
|
|
435
|
+
recommending, validating, and deploying agents. This interface abstracts
|
|
436
|
+
the orchestration logic to enable different workflows and approval processes.
|
|
437
|
+
|
|
438
|
+
DESIGN DECISION: Provides both preview and apply modes to enable user review
|
|
439
|
+
before deployment. Includes validation to catch configuration issues early.
|
|
440
|
+
Supports both interactive (confirmation required) and automated modes.
|
|
441
|
+
"""
|
|
442
|
+
|
|
443
|
+
@abstractmethod
|
|
444
|
+
async def auto_configure(
|
|
445
|
+
self, project_path: Path, confirmation_required: bool = True
|
|
446
|
+
) -> ConfigurationResult:
|
|
447
|
+
"""Perform automated agent configuration.
|
|
448
|
+
|
|
449
|
+
Complete end-to-end configuration workflow:
|
|
450
|
+
1. Analyze project toolchain
|
|
451
|
+
2. Generate agent recommendations
|
|
452
|
+
3. Validate proposed configuration
|
|
453
|
+
4. Request user confirmation (if required)
|
|
454
|
+
5. Deploy approved agents
|
|
455
|
+
6. Verify deployment success
|
|
456
|
+
|
|
457
|
+
Args:
|
|
458
|
+
project_path: Path to the project root directory
|
|
459
|
+
confirmation_required: Whether to require user approval before deployment
|
|
460
|
+
|
|
461
|
+
Returns:
|
|
462
|
+
ConfigurationResult: Complete configuration results including
|
|
463
|
+
deployed agents, validation results, and any errors
|
|
464
|
+
|
|
465
|
+
Raises:
|
|
466
|
+
FileNotFoundError: If project_path does not exist
|
|
467
|
+
PermissionError: If unable to write to project directory
|
|
468
|
+
ValidationError: If configuration validation fails critically
|
|
469
|
+
"""
|
|
470
|
+
|
|
471
|
+
@abstractmethod
|
|
472
|
+
def validate_configuration(
|
|
473
|
+
self, recommendations: List[AgentRecommendation]
|
|
474
|
+
) -> ValidationResult:
|
|
475
|
+
"""Validate proposed configuration before deployment.
|
|
476
|
+
|
|
477
|
+
Performs comprehensive validation of recommended agents:
|
|
478
|
+
- Checks for conflicting agent capabilities
|
|
479
|
+
- Verifies resource requirements are met
|
|
480
|
+
- Validates agent compatibility with project
|
|
481
|
+
- Identifies potential configuration issues
|
|
482
|
+
|
|
483
|
+
Args:
|
|
484
|
+
recommendations: List of agent recommendations to validate
|
|
485
|
+
|
|
486
|
+
Returns:
|
|
487
|
+
ValidationResult: Validation result with any warnings or errors
|
|
488
|
+
|
|
489
|
+
Raises:
|
|
490
|
+
ValueError: If recommendations list is empty or invalid
|
|
491
|
+
"""
|
|
492
|
+
|
|
493
|
+
@abstractmethod
|
|
494
|
+
def preview_configuration(self, project_path: Path) -> ConfigurationPreview:
|
|
495
|
+
"""Preview what would be configured without applying changes.
|
|
496
|
+
|
|
497
|
+
Performs analysis and recommendation without making any changes:
|
|
498
|
+
- Analyzes project toolchain
|
|
499
|
+
- Generates recommendations
|
|
500
|
+
- Validates configuration
|
|
501
|
+
- Returns preview of what would be deployed
|
|
502
|
+
|
|
503
|
+
Useful for testing and showing users what would happen before
|
|
504
|
+
committing to changes.
|
|
505
|
+
|
|
506
|
+
Args:
|
|
507
|
+
project_path: Path to the project root directory
|
|
508
|
+
|
|
509
|
+
Returns:
|
|
510
|
+
ConfigurationPreview: Preview of configuration that would be applied
|
|
511
|
+
|
|
512
|
+
Raises:
|
|
513
|
+
FileNotFoundError: If project_path does not exist
|
|
514
|
+
"""
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Project Analysis Interfaces for Claude MPM Framework
|
|
3
|
+
====================================================
|
|
4
|
+
|
|
5
|
+
WHY: This module contains interfaces for project analysis, toolchain detection,
|
|
6
|
+
and technology stack identification. These interfaces enable the auto-configuration
|
|
7
|
+
system to intelligently recommend agents based on detected project characteristics.
|
|
8
|
+
|
|
9
|
+
DESIGN DECISION: Project analysis interfaces are separated because they deal
|
|
10
|
+
with understanding the codebase structure, dependencies, and toolchain setup,
|
|
11
|
+
which requires different patterns than other service types.
|
|
12
|
+
|
|
13
|
+
Part of TSK-0054: Auto-Configuration Feature - Phase 1
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from abc import ABC, abstractmethod
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from typing import List, Optional
|
|
19
|
+
|
|
20
|
+
from ..models.toolchain import (
|
|
21
|
+
DeploymentTarget,
|
|
22
|
+
Framework,
|
|
23
|
+
LanguageDetection,
|
|
24
|
+
ToolchainAnalysis,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class IToolchainAnalyzer(ABC):
|
|
29
|
+
"""Interface for toolchain analysis operations.
|
|
30
|
+
|
|
31
|
+
WHY: Understanding project toolchain is essential for recommending appropriate
|
|
32
|
+
agents. This interface abstracts toolchain analysis to support different
|
|
33
|
+
project types, languages, and frameworks.
|
|
34
|
+
|
|
35
|
+
DESIGN DECISION: Separates language, framework, and deployment detection
|
|
36
|
+
into distinct methods to enable granular analysis and caching of results.
|
|
37
|
+
Each analysis type can be run independently based on needs.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
@abstractmethod
|
|
41
|
+
def analyze_toolchain(self, project_path: Path) -> ToolchainAnalysis:
|
|
42
|
+
"""Analyze project toolchain and dependencies.
|
|
43
|
+
|
|
44
|
+
Performs comprehensive analysis of the project's technical stack including:
|
|
45
|
+
- Primary and secondary programming languages
|
|
46
|
+
- Framework and library dependencies
|
|
47
|
+
- Build and deployment configuration
|
|
48
|
+
- Development environment requirements
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
project_path: Path to the project root directory
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
ToolchainAnalysis: Complete analysis result with confidence scores
|
|
55
|
+
|
|
56
|
+
Raises:
|
|
57
|
+
FileNotFoundError: If project_path does not exist
|
|
58
|
+
PermissionError: If project_path is not readable
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
@abstractmethod
|
|
62
|
+
def detect_language(self, project_path: Path) -> LanguageDetection:
|
|
63
|
+
"""Detect primary and secondary languages used in the project.
|
|
64
|
+
|
|
65
|
+
Analyzes source files to determine:
|
|
66
|
+
- Primary programming language (highest code volume)
|
|
67
|
+
- Secondary languages (supporting code, scripts)
|
|
68
|
+
- Language versions if detectable
|
|
69
|
+
- Confidence level for each detection
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
project_path: Path to the project root directory
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
LanguageDetection: Detected languages with confidence scores
|
|
76
|
+
|
|
77
|
+
Raises:
|
|
78
|
+
FileNotFoundError: If project_path does not exist
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
@abstractmethod
|
|
82
|
+
def detect_frameworks(self, project_path: Path) -> List[Framework]:
|
|
83
|
+
"""Detect frameworks and their versions.
|
|
84
|
+
|
|
85
|
+
Identifies frameworks by analyzing:
|
|
86
|
+
- Dependency files (package.json, requirements.txt, etc.)
|
|
87
|
+
- Import statements in source code
|
|
88
|
+
- Configuration files specific to frameworks
|
|
89
|
+
- Project structure patterns
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
project_path: Path to the project root directory
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
List[Framework]: List of detected frameworks with versions and types
|
|
96
|
+
|
|
97
|
+
Raises:
|
|
98
|
+
FileNotFoundError: If project_path does not exist
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
@abstractmethod
|
|
102
|
+
def detect_deployment_target(
|
|
103
|
+
self, project_path: Path
|
|
104
|
+
) -> Optional[DeploymentTarget]:
|
|
105
|
+
"""Detect intended deployment environment.
|
|
106
|
+
|
|
107
|
+
Analyzes configuration to identify deployment targets:
|
|
108
|
+
- Cloud platforms (AWS, GCP, Azure)
|
|
109
|
+
- Container orchestration (Kubernetes, Docker)
|
|
110
|
+
- Serverless platforms (Lambda, Cloud Functions)
|
|
111
|
+
- Traditional hosting (VPS, dedicated servers)
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
project_path: Path to the project root directory
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
Optional[DeploymentTarget]: Detected deployment target or None if unclear
|
|
118
|
+
|
|
119
|
+
Raises:
|
|
120
|
+
FileNotFoundError: If project_path does not exist
|
|
121
|
+
"""
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Core Models Package for Claude MPM Framework
|
|
3
|
+
============================================
|
|
4
|
+
|
|
5
|
+
WHY: This package contains data models used across the service layer.
|
|
6
|
+
Models are organized by domain to maintain clear boundaries and enable
|
|
7
|
+
independent evolution of different model types.
|
|
8
|
+
|
|
9
|
+
DESIGN DECISION: Models are grouped by domain (toolchain, agent_config)
|
|
10
|
+
to create logical cohesion and make it easier to understand dependencies
|
|
11
|
+
between different parts of the system.
|
|
12
|
+
|
|
13
|
+
Part of TSK-0054: Auto-Configuration Feature - Phase 1
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from .agent_config import (
|
|
17
|
+
AgentCapabilities,
|
|
18
|
+
AgentRecommendation,
|
|
19
|
+
ConfigurationPreview,
|
|
20
|
+
ConfigurationResult,
|
|
21
|
+
ValidationResult,
|
|
22
|
+
)
|
|
23
|
+
from .toolchain import (
|
|
24
|
+
ConfidenceLevel,
|
|
25
|
+
DeploymentTarget,
|
|
26
|
+
Framework,
|
|
27
|
+
LanguageDetection,
|
|
28
|
+
ToolchainAnalysis,
|
|
29
|
+
ToolchainComponent,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
__all__ = [ # noqa: RUF022 - Grouped by category with comments for clarity
|
|
33
|
+
# Toolchain models
|
|
34
|
+
"ConfidenceLevel",
|
|
35
|
+
"ToolchainComponent",
|
|
36
|
+
"LanguageDetection",
|
|
37
|
+
"Framework",
|
|
38
|
+
"DeploymentTarget",
|
|
39
|
+
"ToolchainAnalysis",
|
|
40
|
+
# Agent configuration models
|
|
41
|
+
"AgentCapabilities",
|
|
42
|
+
"AgentRecommendation",
|
|
43
|
+
"ConfigurationResult",
|
|
44
|
+
"ValidationResult",
|
|
45
|
+
"ConfigurationPreview",
|
|
46
|
+
]
|