claude-mpm 5.6.4__py3-none-any.whl → 5.6.30__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/VERSION +1 -1
- claude_mpm/agents/PM_INSTRUCTIONS.md +8 -3
- claude_mpm/cli/commands/commander.py +174 -4
- claude_mpm/cli/commands/skill_source.py +51 -2
- claude_mpm/cli/commands/skills.py +5 -3
- claude_mpm/cli/parsers/commander_parser.py +43 -10
- claude_mpm/cli/parsers/skill_source_parser.py +4 -0
- claude_mpm/cli/parsers/skills_parser.py +5 -0
- claude_mpm/cli/startup.py +140 -20
- claude_mpm/cli/startup_display.py +2 -1
- claude_mpm/commander/__init__.py +6 -0
- claude_mpm/commander/adapters/__init__.py +32 -3
- claude_mpm/commander/adapters/auggie.py +260 -0
- claude_mpm/commander/adapters/base.py +98 -1
- claude_mpm/commander/adapters/claude_code.py +32 -1
- claude_mpm/commander/adapters/codex.py +237 -0
- claude_mpm/commander/adapters/example_usage.py +310 -0
- claude_mpm/commander/adapters/mpm.py +389 -0
- claude_mpm/commander/adapters/registry.py +204 -0
- claude_mpm/commander/api/app.py +32 -16
- claude_mpm/commander/api/errors.py +21 -0
- claude_mpm/commander/api/routes/messages.py +11 -11
- claude_mpm/commander/api/routes/projects.py +20 -20
- claude_mpm/commander/api/routes/sessions.py +37 -26
- claude_mpm/commander/api/routes/work.py +86 -50
- claude_mpm/commander/api/schemas.py +4 -0
- claude_mpm/commander/chat/cli.py +42 -3
- claude_mpm/commander/config.py +5 -3
- claude_mpm/commander/core/__init__.py +10 -0
- claude_mpm/commander/core/block_manager.py +325 -0
- claude_mpm/commander/core/response_manager.py +323 -0
- claude_mpm/commander/daemon.py +215 -10
- claude_mpm/commander/env_loader.py +59 -0
- claude_mpm/commander/frameworks/base.py +4 -1
- claude_mpm/commander/instance_manager.py +124 -11
- claude_mpm/commander/memory/__init__.py +45 -0
- claude_mpm/commander/memory/compression.py +347 -0
- claude_mpm/commander/memory/embeddings.py +230 -0
- claude_mpm/commander/memory/entities.py +310 -0
- claude_mpm/commander/memory/example_usage.py +290 -0
- claude_mpm/commander/memory/integration.py +325 -0
- claude_mpm/commander/memory/search.py +381 -0
- claude_mpm/commander/memory/store.py +657 -0
- claude_mpm/commander/registry.py +10 -4
- claude_mpm/commander/runtime/monitor.py +32 -2
- claude_mpm/commander/work/executor.py +38 -20
- claude_mpm/commander/workflow/event_handler.py +25 -3
- claude_mpm/config/skill_sources.py +16 -0
- claude_mpm/core/claude_runner.py +152 -0
- claude_mpm/core/config.py +30 -22
- claude_mpm/core/config_constants.py +74 -9
- claude_mpm/core/constants.py +56 -12
- claude_mpm/core/interactive_session.py +5 -4
- claude_mpm/core/logging_utils.py +4 -2
- claude_mpm/core/network_config.py +148 -0
- claude_mpm/core/oneshot_session.py +7 -6
- claude_mpm/core/output_style_manager.py +37 -7
- claude_mpm/core/socketio_pool.py +13 -5
- claude_mpm/hooks/claude_hooks/__pycache__/__init__.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/auto_pause_handler.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/correlation_manager.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/event_handlers.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/hook_handler.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/memory_integration.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/response_tracking.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/__pycache__/tool_analysis.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/auto_pause_handler.py +30 -31
- claude_mpm/hooks/claude_hooks/event_handlers.py +22 -0
- claude_mpm/hooks/claude_hooks/hook_handler.py +6 -6
- claude_mpm/hooks/claude_hooks/installer.py +43 -2
- claude_mpm/hooks/claude_hooks/memory_integration.py +31 -22
- claude_mpm/hooks/claude_hooks/response_tracking.py +40 -59
- claude_mpm/hooks/claude_hooks/services/__pycache__/__init__.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/connection_manager_http.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/duplicate_detector.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/state_manager.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/__pycache__/subagent_processor.cpython-311.pyc +0 -0
- claude_mpm/hooks/claude_hooks/services/connection_manager.py +25 -30
- claude_mpm/hooks/claude_hooks/services/connection_manager_http.py +24 -28
- claude_mpm/hooks/claude_hooks/services/state_manager.py +25 -38
- claude_mpm/hooks/claude_hooks/services/subagent_processor.py +49 -75
- claude_mpm/hooks/session_resume_hook.py +22 -18
- claude_mpm/hooks/templates/pre_tool_use_simple.py +6 -6
- claude_mpm/hooks/templates/pre_tool_use_template.py +16 -8
- claude_mpm/scripts/claude-hook-handler.sh +8 -8
- claude_mpm/services/agents/agent_selection_service.py +2 -2
- claude_mpm/services/agents/single_tier_deployment_service.py +4 -4
- claude_mpm/services/command_deployment_service.py +44 -26
- claude_mpm/services/pm_skills_deployer.py +3 -2
- claude_mpm/services/skills/git_skill_source_manager.py +79 -8
- claude_mpm/services/skills/selective_skill_deployer.py +28 -0
- claude_mpm/services/skills/skill_discovery_service.py +17 -1
- claude_mpm/services/skills_deployer.py +31 -5
- claude_mpm/skills/__init__.py +2 -1
- claude_mpm/skills/bundled/pm/mpm-session-pause/SKILL.md +170 -0
- claude_mpm/skills/registry.py +295 -90
- {claude_mpm-5.6.4.dist-info → claude_mpm-5.6.30.dist-info}/METADATA +5 -3
- {claude_mpm-5.6.4.dist-info → claude_mpm-5.6.30.dist-info}/RECORD +103 -71
- {claude_mpm-5.6.4.dist-info → claude_mpm-5.6.30.dist-info}/WHEEL +0 -0
- {claude_mpm-5.6.4.dist-info → claude_mpm-5.6.30.dist-info}/entry_points.txt +0 -0
- {claude_mpm-5.6.4.dist-info → claude_mpm-5.6.30.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-5.6.4.dist-info → claude_mpm-5.6.30.dist-info}/licenses/LICENSE-FAQ.md +0 -0
- {claude_mpm-5.6.4.dist-info → claude_mpm-5.6.30.dist-info}/top_level.txt +0 -0
|
@@ -16,6 +16,7 @@ Trade-offs:
|
|
|
16
16
|
- Flexibility: Easy to extend with skills-specific features
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
|
+
import os
|
|
19
20
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
20
21
|
from datetime import datetime, timezone
|
|
21
22
|
from pathlib import Path
|
|
@@ -32,6 +33,46 @@ from claude_mpm.services.skills.skill_discovery_service import SkillDiscoverySer
|
|
|
32
33
|
logger = get_logger(__name__)
|
|
33
34
|
|
|
34
35
|
|
|
36
|
+
def _get_github_token(source: Optional[SkillSource] = None) -> Optional[str]:
|
|
37
|
+
"""Get GitHub token with source-specific override support.
|
|
38
|
+
|
|
39
|
+
Priority: source.token > GITHUB_TOKEN > GH_TOKEN
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
source: Optional SkillSource to check for per-source token
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
GitHub token if found, None otherwise
|
|
46
|
+
|
|
47
|
+
Token Resolution:
|
|
48
|
+
1. If source has token starting with "$", resolve as env var
|
|
49
|
+
2. If source has direct token, use it (not recommended for security)
|
|
50
|
+
3. Fall back to GITHUB_TOKEN env var
|
|
51
|
+
4. Fall back to GH_TOKEN env var
|
|
52
|
+
5. Return None if no token found
|
|
53
|
+
|
|
54
|
+
Security Note:
|
|
55
|
+
Token is never logged or printed to avoid exposure.
|
|
56
|
+
Direct tokens in config are discouraged - use env var refs ($VAR_NAME).
|
|
57
|
+
|
|
58
|
+
Example:
|
|
59
|
+
>>> source = SkillSource(..., token="$PRIVATE_TOKEN")
|
|
60
|
+
>>> token = _get_github_token(source) # Resolves $PRIVATE_TOKEN from env
|
|
61
|
+
>>> token = _get_github_token() # Falls back to GITHUB_TOKEN
|
|
62
|
+
"""
|
|
63
|
+
# Priority 1: Per-source token (env var reference or direct)
|
|
64
|
+
if source and source.token:
|
|
65
|
+
if source.token.startswith("$"):
|
|
66
|
+
# Env var reference: $VAR_NAME -> os.environ.get("VAR_NAME")
|
|
67
|
+
env_var_name = source.token[1:]
|
|
68
|
+
return os.environ.get(env_var_name)
|
|
69
|
+
# Direct token (not recommended but supported)
|
|
70
|
+
return source.token
|
|
71
|
+
|
|
72
|
+
# Priority 2-3: Global environment variables
|
|
73
|
+
return os.environ.get("GITHUB_TOKEN") or os.environ.get("GH_TOKEN")
|
|
74
|
+
|
|
75
|
+
|
|
35
76
|
class GitSkillSourceManager:
|
|
36
77
|
"""Manages multiple Git-based skill sources with priority resolution.
|
|
37
78
|
|
|
@@ -217,9 +258,21 @@ class GitSkillSourceManager:
|
|
|
217
258
|
)
|
|
218
259
|
|
|
219
260
|
# Discover skills in cache
|
|
261
|
+
self.logger.debug(f"Scanning cache path for skills: {cache_path}")
|
|
220
262
|
discovery_service = SkillDiscoveryService(cache_path)
|
|
221
263
|
discovered_skills = discovery_service.discover_skills()
|
|
222
264
|
|
|
265
|
+
# Log discovery results
|
|
266
|
+
if len(discovered_skills) == 0:
|
|
267
|
+
self.logger.info(
|
|
268
|
+
f"No SKILL.md files found in {cache_path}. "
|
|
269
|
+
"Ensure your skill source has SKILL.md files with valid frontmatter."
|
|
270
|
+
)
|
|
271
|
+
else:
|
|
272
|
+
self.logger.debug(
|
|
273
|
+
f"Successfully parsed {len(discovered_skills)} skills from {cache_path}"
|
|
274
|
+
)
|
|
275
|
+
|
|
223
276
|
# Build result
|
|
224
277
|
result = {
|
|
225
278
|
"synced": True,
|
|
@@ -469,7 +522,7 @@ class GitSkillSourceManager:
|
|
|
469
522
|
# Step 1: Discover all files via GitHub Tree API (single request)
|
|
470
523
|
# This discovers the COMPLETE repository structure (272 files for skills)
|
|
471
524
|
all_files = self._discover_repository_files_via_tree_api(
|
|
472
|
-
owner_repo, source.branch
|
|
525
|
+
owner_repo, source.branch, source
|
|
473
526
|
)
|
|
474
527
|
|
|
475
528
|
if not all_files:
|
|
@@ -504,7 +557,7 @@ class GitSkillSourceManager:
|
|
|
504
557
|
raw_url = f"https://raw.githubusercontent.com/{owner_repo}/{source.branch}/{file_path}"
|
|
505
558
|
cache_file = cache_path / file_path
|
|
506
559
|
future = executor.submit(
|
|
507
|
-
self._download_file_with_etag, raw_url, cache_file, force
|
|
560
|
+
self._download_file_with_etag, raw_url, cache_file, force, source
|
|
508
561
|
)
|
|
509
562
|
future_to_file[future] = file_path
|
|
510
563
|
|
|
@@ -533,7 +586,7 @@ class GitSkillSourceManager:
|
|
|
533
586
|
return files_updated, files_cached
|
|
534
587
|
|
|
535
588
|
def _discover_repository_files_via_tree_api(
|
|
536
|
-
self, owner_repo: str, branch: str
|
|
589
|
+
self, owner_repo: str, branch: str, source: Optional[SkillSource] = None
|
|
537
590
|
) -> List[str]:
|
|
538
591
|
"""Discover all files in repository using GitHub Git Tree API.
|
|
539
592
|
|
|
@@ -596,9 +649,17 @@ class GitSkillSourceManager:
|
|
|
596
649
|
)
|
|
597
650
|
self.logger.debug(f"Fetching commit SHA from {refs_url}")
|
|
598
651
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
)
|
|
652
|
+
# Build headers with authentication if token available
|
|
653
|
+
headers = {"Accept": "application/vnd.github+json"}
|
|
654
|
+
token = _get_github_token(source)
|
|
655
|
+
if token:
|
|
656
|
+
headers["Authorization"] = f"token {token}"
|
|
657
|
+
if source and source.token:
|
|
658
|
+
self.logger.debug(f"Using source-specific token for {source.id}")
|
|
659
|
+
else:
|
|
660
|
+
self.logger.debug("Using GitHub token for authentication")
|
|
661
|
+
|
|
662
|
+
refs_response = requests.get(refs_url, headers=headers, timeout=30)
|
|
602
663
|
|
|
603
664
|
# Check for rate limiting
|
|
604
665
|
if refs_response.status_code == 403:
|
|
@@ -621,7 +682,7 @@ class GitSkillSourceManager:
|
|
|
621
682
|
self.logger.debug(f"Fetching recursive tree from {tree_url}")
|
|
622
683
|
tree_response = requests.get(
|
|
623
684
|
tree_url,
|
|
624
|
-
headers=
|
|
685
|
+
headers=headers, # Reuse headers with auth from Step 1
|
|
625
686
|
params=params,
|
|
626
687
|
timeout=30,
|
|
627
688
|
)
|
|
@@ -652,7 +713,11 @@ class GitSkillSourceManager:
|
|
|
652
713
|
return all_files
|
|
653
714
|
|
|
654
715
|
def _download_file_with_etag(
|
|
655
|
-
self,
|
|
716
|
+
self,
|
|
717
|
+
url: str,
|
|
718
|
+
local_path: Path,
|
|
719
|
+
force: bool = False,
|
|
720
|
+
source: Optional[SkillSource] = None,
|
|
656
721
|
) -> bool:
|
|
657
722
|
"""Download file from URL with ETag caching (thread-safe).
|
|
658
723
|
|
|
@@ -660,6 +725,7 @@ class GitSkillSourceManager:
|
|
|
660
725
|
url: Raw GitHub URL
|
|
661
726
|
local_path: Local file path to save to
|
|
662
727
|
force: Force download even if cached
|
|
728
|
+
source: Optional SkillSource for token resolution
|
|
663
729
|
|
|
664
730
|
Returns:
|
|
665
731
|
True if file was updated, False if cached
|
|
@@ -692,6 +758,11 @@ class GitSkillSourceManager:
|
|
|
692
758
|
if cached_etag and not force:
|
|
693
759
|
headers["If-None-Match"] = cached_etag
|
|
694
760
|
|
|
761
|
+
# Add GitHub authentication if token available
|
|
762
|
+
token = _get_github_token(source)
|
|
763
|
+
if token:
|
|
764
|
+
headers["Authorization"] = f"token {token}"
|
|
765
|
+
|
|
695
766
|
try:
|
|
696
767
|
response = requests.get(url, headers=headers, timeout=30)
|
|
697
768
|
|
|
@@ -50,6 +50,22 @@ logger = get_logger(__name__)
|
|
|
50
50
|
# Deployment tracking index file
|
|
51
51
|
DEPLOYED_INDEX_FILE = ".mpm-deployed-skills.json"
|
|
52
52
|
|
|
53
|
+
# Core PM skills that should always be deployed
|
|
54
|
+
# These are referenced in PM_INSTRUCTIONS.md with [SKILL: name] markers
|
|
55
|
+
# Without these skills, PM only sees placeholders, not actual content
|
|
56
|
+
PM_CORE_SKILLS = {
|
|
57
|
+
"mpm-delegation-patterns",
|
|
58
|
+
"mpm-verification-protocols",
|
|
59
|
+
"mpm-tool-usage-guide",
|
|
60
|
+
"mpm-git-file-tracking",
|
|
61
|
+
"mpm-pr-workflow",
|
|
62
|
+
"mpm-ticketing-integration",
|
|
63
|
+
"mpm-teaching-mode",
|
|
64
|
+
"mpm-bug-reporting",
|
|
65
|
+
"mpm-circuit-breaker-enforcement",
|
|
66
|
+
"mpm-session-management",
|
|
67
|
+
}
|
|
68
|
+
|
|
53
69
|
# Core skills that are universally useful across all projects
|
|
54
70
|
# These are deployed when skill mapping returns too many skills (>60)
|
|
55
71
|
# Target: ~25-30 core skills for balanced functionality
|
|
@@ -376,6 +392,18 @@ def get_required_skills_from_agents(agents_dir: Path) -> Set[str]:
|
|
|
376
392
|
"(converted slashes to dashes)"
|
|
377
393
|
)
|
|
378
394
|
|
|
395
|
+
# Always include PM core skills to ensure PM_INSTRUCTIONS.md markers are resolved
|
|
396
|
+
# These skills are referenced in PM_INSTRUCTIONS.md and must be deployed
|
|
397
|
+
# for PM to see actual content instead of [SKILL: name] placeholders
|
|
398
|
+
before_pm_skills = len(normalized_skills)
|
|
399
|
+
normalized_skills = normalized_skills | PM_CORE_SKILLS
|
|
400
|
+
pm_skills_added = len(normalized_skills) - before_pm_skills
|
|
401
|
+
|
|
402
|
+
if pm_skills_added > 0:
|
|
403
|
+
logger.info(
|
|
404
|
+
f"Added {pm_skills_added} PM core skills to ensure PM_INSTRUCTIONS.md markers resolve"
|
|
405
|
+
)
|
|
406
|
+
|
|
379
407
|
return normalized_skills
|
|
380
408
|
|
|
381
409
|
|
|
@@ -188,6 +188,15 @@ class SkillDiscoveryService:
|
|
|
188
188
|
f"and {len(legacy_md_files)} legacy .md files in {self.skills_dir}"
|
|
189
189
|
)
|
|
190
190
|
|
|
191
|
+
# Log first few file paths for debugging
|
|
192
|
+
if all_skill_files:
|
|
193
|
+
sample_files = [
|
|
194
|
+
str(f.relative_to(self.skills_dir)) for f in all_skill_files[:5]
|
|
195
|
+
]
|
|
196
|
+
self.logger.debug(f"Sample skill files: {sample_files}")
|
|
197
|
+
else:
|
|
198
|
+
self.logger.debug(f"No SKILL.md or .md files found in {self.skills_dir}")
|
|
199
|
+
|
|
191
200
|
# Track deployment names to detect collisions
|
|
192
201
|
deployment_names = {}
|
|
193
202
|
|
|
@@ -226,7 +235,14 @@ class SkillDiscoveryService:
|
|
|
226
235
|
except Exception as e:
|
|
227
236
|
self.logger.warning(f"Failed to parse skill {skill_file}: {e}")
|
|
228
237
|
|
|
229
|
-
|
|
238
|
+
# Summary logging
|
|
239
|
+
parsed_count = len(skills)
|
|
240
|
+
failed_count = len(all_skill_files) - parsed_count
|
|
241
|
+
self.logger.info(
|
|
242
|
+
f"Discovered {parsed_count} skills from {self.skills_dir.name} "
|
|
243
|
+
f"({len(all_skill_files)} files found, {failed_count} failed to parse)"
|
|
244
|
+
)
|
|
245
|
+
|
|
230
246
|
return skills
|
|
231
247
|
|
|
232
248
|
def _parse_skill_file(self, skill_file: Path) -> Optional[Dict[str, Any]]:
|
|
@@ -28,7 +28,7 @@ References:
|
|
|
28
28
|
import json
|
|
29
29
|
import platform
|
|
30
30
|
import shutil
|
|
31
|
-
import subprocess
|
|
31
|
+
import subprocess # nosec B404 - subprocess needed for safe git operations
|
|
32
32
|
from pathlib import Path
|
|
33
33
|
from typing import Any, Dict, List, Optional
|
|
34
34
|
|
|
@@ -653,7 +653,7 @@ class SkillsDeployerService(LoggerMixin):
|
|
|
653
653
|
f"Updating existing collection '{collection_name}' at {target_dir}"
|
|
654
654
|
)
|
|
655
655
|
try:
|
|
656
|
-
result = subprocess.run(
|
|
656
|
+
result = subprocess.run( # nosec B603 B607 - Safe: hardcoded git command
|
|
657
657
|
["git", "pull"],
|
|
658
658
|
cwd=target_dir,
|
|
659
659
|
capture_output=True,
|
|
@@ -684,7 +684,7 @@ class SkillsDeployerService(LoggerMixin):
|
|
|
684
684
|
f"Installing new collection '{collection_name}' to {target_dir}"
|
|
685
685
|
)
|
|
686
686
|
try:
|
|
687
|
-
result = subprocess.run(
|
|
687
|
+
result = subprocess.run( # nosec B603 B607 - Safe: hardcoded git command
|
|
688
688
|
["git", "clone", repo_url, str(target_dir)],
|
|
689
689
|
capture_output=True,
|
|
690
690
|
text=True,
|
|
@@ -773,6 +773,32 @@ class SkillsDeployerService(LoggerMixin):
|
|
|
773
773
|
if isinstance(skills_data, dict):
|
|
774
774
|
flat_skills = []
|
|
775
775
|
|
|
776
|
+
# Define valid top-level categories
|
|
777
|
+
VALID_CATEGORIES = {"universal", "toolchains"}
|
|
778
|
+
|
|
779
|
+
# Check for unknown categories and warn user
|
|
780
|
+
unknown_categories = set(skills_data.keys()) - VALID_CATEGORIES
|
|
781
|
+
if unknown_categories:
|
|
782
|
+
# Count skills in unknown categories
|
|
783
|
+
skipped_count = 0
|
|
784
|
+
for cat in unknown_categories:
|
|
785
|
+
cat_data = skills_data.get(cat, [])
|
|
786
|
+
if isinstance(cat_data, list):
|
|
787
|
+
skipped_count += len(cat_data)
|
|
788
|
+
elif isinstance(cat_data, dict):
|
|
789
|
+
# If it's a dict like toolchains, count nested skills
|
|
790
|
+
for skills_list in cat_data.values():
|
|
791
|
+
if isinstance(skills_list, list):
|
|
792
|
+
skipped_count += len(skills_list)
|
|
793
|
+
|
|
794
|
+
self.logger.warning(
|
|
795
|
+
f"Unknown categories in manifest will be skipped: "
|
|
796
|
+
f"{', '.join(sorted(unknown_categories))} ({skipped_count} skills)"
|
|
797
|
+
)
|
|
798
|
+
self.logger.info(
|
|
799
|
+
f"Valid top-level categories: {', '.join(sorted(VALID_CATEGORIES))}"
|
|
800
|
+
)
|
|
801
|
+
|
|
776
802
|
# Add universal skills
|
|
777
803
|
universal_skills = skills_data.get("universal", [])
|
|
778
804
|
if isinstance(universal_skills, list):
|
|
@@ -1022,12 +1048,12 @@ class SkillsDeployerService(LoggerMixin):
|
|
|
1022
1048
|
"""
|
|
1023
1049
|
try:
|
|
1024
1050
|
if platform.system() == "Windows":
|
|
1025
|
-
result = subprocess.run(
|
|
1051
|
+
result = subprocess.run( # nosec B603 B607 - Safe: hardcoded tasklist command
|
|
1026
1052
|
["tasklist"], check=False, capture_output=True, text=True, timeout=5
|
|
1027
1053
|
)
|
|
1028
1054
|
return "claude" in result.stdout.lower()
|
|
1029
1055
|
# macOS and Linux
|
|
1030
|
-
result = subprocess.run(
|
|
1056
|
+
result = subprocess.run( # nosec B603 B607 - Safe: hardcoded ps command
|
|
1031
1057
|
["ps", "aux"], check=False, capture_output=True, text=True, timeout=5
|
|
1032
1058
|
)
|
|
1033
1059
|
# Look for "Claude Code" or "claude-code" process
|
claude_mpm/skills/__init__.py
CHANGED
|
@@ -24,7 +24,7 @@ Legacy System (maintained for compatibility):
|
|
|
24
24
|
from .agent_skills_injector import AgentSkillsInjector
|
|
25
25
|
|
|
26
26
|
# Legacy System (maintained for compatibility)
|
|
27
|
-
from .registry import Skill, SkillsRegistry, get_registry
|
|
27
|
+
from .registry import Skill, SkillsRegistry, get_registry, validate_agentskills_spec
|
|
28
28
|
from .skill_manager import SkillManager
|
|
29
29
|
from .skills_registry import SkillsRegistry as SkillsRegistryHelper
|
|
30
30
|
from .skills_service import SkillsService
|
|
@@ -39,4 +39,5 @@ __all__ = [
|
|
|
39
39
|
# New Skills Integration System
|
|
40
40
|
"SkillsService",
|
|
41
41
|
"get_registry",
|
|
42
|
+
"validate_agentskills_spec",
|
|
42
43
|
]
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mpm-session-pause
|
|
3
|
+
description: Pause session and save current work state for later resume
|
|
4
|
+
user-invocable: true
|
|
5
|
+
version: "1.0.0"
|
|
6
|
+
category: mpm-command
|
|
7
|
+
tags: [mpm-command, session, pm-recommended]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /mpm-pause
|
|
11
|
+
|
|
12
|
+
Pause the current session and save all work state for later resume.
|
|
13
|
+
|
|
14
|
+
## What This Does
|
|
15
|
+
|
|
16
|
+
When invoked, this skill:
|
|
17
|
+
1. Captures current work state (todos, git status, context summary)
|
|
18
|
+
2. Creates session file at `.claude-mpm/sessions/session-{timestamp}.md`
|
|
19
|
+
3. Updates `.claude-mpm/sessions/LATEST-SESSION.txt` pointer
|
|
20
|
+
4. Optionally commits session state to git
|
|
21
|
+
5. Shows user the session file path for later resume
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
/mpm-pause [optional message describing current work]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Examples:**
|
|
30
|
+
```
|
|
31
|
+
/mpm-pause
|
|
32
|
+
/mpm-pause Working on authentication refactor, about to test login flow
|
|
33
|
+
/mpm-pause Need to context switch to urgent bug fix
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Implementation
|
|
37
|
+
|
|
38
|
+
**Execute the following Python code to pause the session:**
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from pathlib import Path
|
|
42
|
+
from claude_mpm.services.cli.session_pause_manager import SessionPauseManager
|
|
43
|
+
|
|
44
|
+
# Optional: Get message from user's command
|
|
45
|
+
# If user provided message after /mpm-pause, extract it
|
|
46
|
+
# Otherwise, message = None
|
|
47
|
+
|
|
48
|
+
# Create session pause manager
|
|
49
|
+
manager = SessionPauseManager(project_path=Path.cwd())
|
|
50
|
+
|
|
51
|
+
# Create pause session
|
|
52
|
+
session_id = manager.create_pause_session(
|
|
53
|
+
message=message, # Optional context message
|
|
54
|
+
skip_commit=False, # Will commit to git if in a repo
|
|
55
|
+
export_path=None, # No additional export needed
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Report success to user
|
|
59
|
+
print(f"✅ Session paused successfully!")
|
|
60
|
+
print(f"")
|
|
61
|
+
print(f"Session ID: {session_id}")
|
|
62
|
+
print(f"Session files:")
|
|
63
|
+
print(f" - .claude-mpm/sessions/{session_id}.md (human-readable)")
|
|
64
|
+
print(f" - .claude-mpm/sessions/{session_id}.json (machine-readable)")
|
|
65
|
+
print(f" - .claude-mpm/sessions/{session_id}.yaml (config format)")
|
|
66
|
+
print(f"")
|
|
67
|
+
print(f"Quick resume:")
|
|
68
|
+
print(f" /mpm-resume")
|
|
69
|
+
print(f"")
|
|
70
|
+
print(f"View session context:")
|
|
71
|
+
print(f" cat .claude-mpm/sessions/LATEST-SESSION.txt")
|
|
72
|
+
print(f" cat .claude-mpm/sessions/{session_id}.md")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## What Gets Saved
|
|
76
|
+
|
|
77
|
+
**Session State:**
|
|
78
|
+
- Session ID and timestamp
|
|
79
|
+
- Current working directory
|
|
80
|
+
- Git branch, recent commits, and file status
|
|
81
|
+
- Primary task and current phase
|
|
82
|
+
- Context message (if provided)
|
|
83
|
+
|
|
84
|
+
**Resume Instructions:**
|
|
85
|
+
- Quick-start commands
|
|
86
|
+
- Validation commands
|
|
87
|
+
- Files to review
|
|
88
|
+
|
|
89
|
+
**File Formats:**
|
|
90
|
+
- `.md` - Human-readable markdown (for reading)
|
|
91
|
+
- `.json` - Machine-readable (for tooling)
|
|
92
|
+
- `.yaml` - Human-readable config (for editing)
|
|
93
|
+
|
|
94
|
+
## Session File Location
|
|
95
|
+
|
|
96
|
+
All session files are stored in:
|
|
97
|
+
```
|
|
98
|
+
.claude-mpm/sessions/
|
|
99
|
+
├── LATEST-SESSION.txt # Pointer to most recent session
|
|
100
|
+
├── session-YYYYMMDD-HHMMSS.md
|
|
101
|
+
├── session-YYYYMMDD-HHMMSS.json
|
|
102
|
+
└── session-YYYYMMDD-HHMMSS.yaml
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Token Budget
|
|
106
|
+
|
|
107
|
+
**Token usage:** ~5-10k tokens to execute (2-5% of context budget)
|
|
108
|
+
|
|
109
|
+
**Benefit:** Saves all remaining context for future resume, allowing you to:
|
|
110
|
+
- Context switch to urgent tasks
|
|
111
|
+
- Take a break and resume later
|
|
112
|
+
- Archive current work state before major changes
|
|
113
|
+
|
|
114
|
+
## Resume Later
|
|
115
|
+
|
|
116
|
+
To resume this session:
|
|
117
|
+
```
|
|
118
|
+
/mpm-resume
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Or manually:
|
|
122
|
+
```bash
|
|
123
|
+
cat .claude-mpm/sessions/LATEST-SESSION.txt
|
|
124
|
+
cat .claude-mpm/sessions/session-YYYYMMDD-HHMMSS.md
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Git Integration
|
|
128
|
+
|
|
129
|
+
If in a git repository, the session will be automatically committed with message:
|
|
130
|
+
```
|
|
131
|
+
session: pause at YYYY-MM-DD HH:MM:SS
|
|
132
|
+
|
|
133
|
+
Session ID: session-YYYYMMDD-HHMMSS
|
|
134
|
+
Context: [your optional message]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Use Cases
|
|
138
|
+
|
|
139
|
+
**Context switching:**
|
|
140
|
+
```
|
|
141
|
+
/mpm-pause Switching to urgent production bug
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**End of work session:**
|
|
145
|
+
```
|
|
146
|
+
/mpm-pause Completed API refactor, ready for testing tomorrow
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Before major changes:**
|
|
150
|
+
```
|
|
151
|
+
/mpm-pause Saving state before attempting risky refactor
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**When approaching context limit:**
|
|
155
|
+
```
|
|
156
|
+
/mpm-pause Hit 150k tokens, starting fresh session
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Related Commands
|
|
160
|
+
|
|
161
|
+
- `/mpm-resume` - Resume from most recent paused session
|
|
162
|
+
- `/mpm-init resume` - Alternative resume command
|
|
163
|
+
- See `docs/features/session-auto-resume.md` for auto-pause behavior
|
|
164
|
+
|
|
165
|
+
## Notes
|
|
166
|
+
|
|
167
|
+
- Session files are project-local (not synced across machines)
|
|
168
|
+
- Git commit is optional (automatically skipped if not a repo)
|
|
169
|
+
- LATEST-SESSION.txt always points to most recent session
|
|
170
|
+
- Session format compatible with auto-pause feature (70% context trigger)
|