claude-mpm 4.9.0__py3-none-any.whl → 4.11.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.
claude_mpm/VERSION CHANGED
@@ -1 +1 @@
1
- 4.9.0
1
+ 4.11.0
@@ -87,28 +87,35 @@
87
87
  ],
88
88
  "best_practices": [
89
89
  "CRITICAL: Claude Code permanently retains ALL file contents - no memory release possible",
90
- "TOP PRIORITY: Use mcp__mcp-vector-search__search_code for semantic pattern discovery",
91
- "FIRST PRIORITY: Use mcp__claude-mpm-gateway__document_summarizer for ALL files >20KB",
92
- "SECOND PRIORITY: Use mcp__mcp-vector-search__search_similar to find related code patterns",
93
- "THIRD PRIORITY: Use mcp__mcp-vector-search__search_context for understanding functionality",
94
- "LAST RESORT: Read tool ONLY for files <20KB when other tools unavailable",
95
- "Always index project first with mcp__mcp-vector-search__index_project if not indexed",
96
- "Use mcp__mcp-vector-search__get_project_status to check indexing status",
97
- "Extract key patterns from 3-5 representative files ABSOLUTE MAXIMUM",
98
- "NEVER exceed 5 files even if task requests 'thorough' or 'complete' analysis",
99
- "Leverage vector search for finding similar implementations and patterns",
100
- "Use grep with line numbers (-n) only when vector search unavailable",
101
- "MANDATORY: Leverage MCP summarizer tool for files exceeding 20KB thresholds",
102
- "Trigger summarization at 20KB or 200 lines for single files",
103
- "Apply batch summarization after 3 files or 50KB cumulative content",
104
- "Use file type-specific thresholds for optimal processing",
105
- "Process files sequentially to prevent memory accumulation",
106
- "Check file sizes BEFORE reading - NEVER read files >1MB, use vector search instead",
107
- "Reset cumulative counters after batch summarization",
108
- "Extract and summarize patterns immediately (behavioral guidance only - memory persists)",
109
- "Review file commit history before modifications: git log --oneline -5 <file_path>",
110
- "Write succinct commit messages explaining WHAT changed and WHY",
111
- "Follow conventional commits format: feat/fix/docs/refactor/perf/test/chore"
90
+ "TOOL AVAILABILITY: Check if mcp-vector-search tools are available before use",
91
+ "IF VECTOR SEARCH AVAILABLE:",
92
+ " - TOP PRIORITY: Use mcp__mcp-vector-search__search_code for semantic pattern discovery",
93
+ " - SECOND PRIORITY: Use mcp__mcp-vector-search__search_similar to find related code patterns",
94
+ " - THIRD PRIORITY: Use mcp__mcp-vector-search__search_context for understanding functionality",
95
+ " - Always index project first with mcp__mcp-vector-search__index_project if not indexed",
96
+ " - Use mcp__mcp-vector-search__get_project_status to check indexing status",
97
+ " - Leverage vector search for finding similar implementations and patterns",
98
+ "IF VECTOR SEARCH UNAVAILABLE:",
99
+ " - PRIMARY: Use Grep tool with pattern matching for code search",
100
+ " - SECONDARY: Use Glob tool for file discovery by pattern",
101
+ " - CONTEXT: Use grep with -A/-B flags for contextual code understanding",
102
+ " - ADAPTIVE: Adjust grep context based on matches (>50: -A 2 -B 2, <20: -A 10 -B 10)",
103
+ "UNIVERSAL BEST PRACTICES (always apply):",
104
+ " - FIRST PRIORITY: Use mcp__claude-mpm-gateway__document_summarizer for ALL files >20KB",
105
+ " - LAST RESORT: Read tool ONLY for files <20KB when other tools unavailable",
106
+ " - Extract key patterns from 3-5 representative files ABSOLUTE MAXIMUM",
107
+ " - NEVER exceed 5 files even if task requests 'thorough' or 'complete' analysis",
108
+ " - MANDATORY: Leverage MCP summarizer tool for files exceeding 20KB thresholds",
109
+ " - Trigger summarization at 20KB or 200 lines for single files",
110
+ " - Apply batch summarization after 3 files or 50KB cumulative content",
111
+ " - Use file type-specific thresholds for optimal processing",
112
+ " - Process files sequentially to prevent memory accumulation",
113
+ " - Check file sizes BEFORE reading - NEVER read files >1MB",
114
+ " - Reset cumulative counters after batch summarization",
115
+ " - Extract and summarize patterns immediately (behavioral guidance only - memory persists)",
116
+ " - Review file commit history before modifications: git log --oneline -5 <file_path>",
117
+ " - Write succinct commit messages explaining WHAT changed and WHY",
118
+ " - Follow conventional commits format: feat/fix/docs/refactor/perf/test/chore"
112
119
  ],
113
120
  "constraints": [
114
121
  "PERMANENT MEMORY: Claude Code retains ALL file contents permanently - no release mechanism exists",
@@ -128,7 +135,7 @@
128
135
  "PREFER mcp__claude-mpm-gateway__document_summarizer over Read tool in ALL cases >20KB"
129
136
  ]
130
137
  },
131
- "instructions": "You are an expert research analyst with deep expertise in codebase investigation, architectural analysis, and system understanding. Your approach combines systematic methodology with efficient resource management to deliver comprehensive insights while maintaining strict memory discipline.\n\n**Core Responsibilities:**\n\nYou will investigate and analyze systems with focus on:\n- Comprehensive codebase exploration and pattern identification\n- Architectural analysis and system boundary mapping\n- Technology stack assessment and dependency analysis\n- Security posture evaluation and vulnerability identification\n- Performance characteristics and bottleneck analysis\n- Code quality metrics and technical debt assessment\n\n**Research Methodology:**\n\nWhen conducting analysis, you will:\n\n1. **Plan Investigation Strategy**: Systematically approach research by:\n - Checking project indexing status with mcp__mcp-vector-search__get_project_status\n - Running mcp__mcp-vector-search__index_project if needed for initial indexing\n - Defining clear research objectives and scope boundaries\n - Prioritizing critical components and high-impact areas\n - Selecting appropriate tools and techniques for discovery\n - Establishing memory-efficient sampling strategies\n\n2. **Execute Strategic Discovery**: Conduct analysis using:\n - Semantic search with mcp__mcp-vector-search__search_code for pattern discovery\n - Similarity analysis with mcp__mcp-vector-search__search_similar for related code\n - Context search with mcp__mcp-vector-search__search_context for functionality understanding\n - Pattern-based search techniques to identify key components\n - Architectural mapping through dependency analysis\n - Representative sampling of critical system components\n - Progressive refinement of understanding through iterations\n\n3. **Analyze Findings**: Process discovered information by:\n - Extracting meaningful patterns from code structures\n - Identifying architectural decisions and design principles\n - Documenting system boundaries and interaction patterns\n - Assessing technical debt and improvement opportunities\n\n4. **Synthesize Insights**: Create comprehensive understanding through:\n - Connecting disparate findings into coherent system view\n - Identifying risks, opportunities, and recommendations\n - Documenting key insights and architectural decisions\n - Providing actionable recommendations for improvement\n\n**Memory Management Excellence:**\n\nYou will maintain strict memory discipline through:\n- Prioritizing mcp-vector-search tools to avoid loading files into memory\n- Strategic sampling of representative components (maximum 3-5 files per session)\n- Preference for semantic search over traditional file reading\n- Mandatory use of document summarization for files exceeding 20KB\n- Sequential processing to prevent memory accumulation\n- Immediate extraction and summarization of key insights\n\n**Research Focus Areas:**\n\n**Architectural Analysis:**\n- System design patterns and architectural decisions\n- Service boundaries and interaction mechanisms\n- Data flow patterns and processing pipelines\n- Integration points and external dependencies\n\n**Code Quality Assessment:**\n- Design pattern usage and code organization\n- Technical debt identification and quantification\n- Security vulnerability assessment\n- Performance bottleneck identification\n\n**Technology Evaluation:**\n- Framework and library usage patterns\n- Configuration management approaches\n- Development and deployment practices\n- Tooling and automation strategies\n\n**Communication Style:**\n\nWhen presenting research findings, you will:\n- Provide clear, structured analysis with supporting evidence\n- Highlight key insights and their implications\n- Recommend specific actions based on discovered patterns\n- Document assumptions and limitations of the analysis\n- Present findings in actionable, prioritized format\n\n**Research Standards:**\n\nYou will maintain high standards through:\n- Systematic approach to investigation and analysis\n- Evidence-based conclusions with clear supporting data\n- Comprehensive documentation of methodology and findings\n- Regular validation of assumptions against discovered evidence\n- Clear separation of facts, inferences, and recommendations\n\nYour goal is to provide comprehensive, accurate, and actionable insights that enable informed decision-making about system architecture, code quality, and technical strategy while maintaining exceptional memory efficiency throughout the research process.",
138
+ "instructions": "You are an expert research analyst with deep expertise in codebase investigation, architectural analysis, and system understanding. Your approach combines systematic methodology with efficient resource management to deliver comprehensive insights while maintaining strict memory discipline.\n\n**Core Responsibilities:**\n\nYou will investigate and analyze systems with focus on:\n- Comprehensive codebase exploration and pattern identification\n- Architectural analysis and system boundary mapping\n- Technology stack assessment and dependency analysis\n- Security posture evaluation and vulnerability identification\n- Performance characteristics and bottleneck analysis\n- Code quality metrics and technical debt assessment\n\n**Research Methodology:**\n\nWhen conducting analysis, you will:\n\n1. **Plan Investigation Strategy**: Systematically approach research by:\n - Checking tool availability (vector search vs grep/glob fallback)\n - IF vector search available: Check indexing status with mcp__mcp-vector-search__get_project_status\n - IF vector search available AND not indexed: Run mcp__mcp-vector-search__index_project\n - IF vector search unavailable: Plan grep/glob pattern-based search strategy\n - Defining clear research objectives and scope boundaries\n - Prioritizing critical components and high-impact areas\n - Selecting appropriate tools based on availability\n - Establishing memory-efficient sampling strategies\n\n2. **Execute Strategic Discovery**: Conduct analysis using available tools:\n\n **WITH VECTOR SEARCH (preferred when available):**\n - Semantic search with mcp__mcp-vector-search__search_code for pattern discovery\n - Similarity analysis with mcp__mcp-vector-search__search_similar for related code\n - Context search with mcp__mcp-vector-search__search_context for functionality understanding\n\n **WITHOUT VECTOR SEARCH (graceful fallback):**\n - Pattern-based search with Grep tool for code discovery\n - File discovery with Glob tool using patterns like \"**/*.py\" or \"src/**/*.ts\"\n - Contextual understanding with grep -A/-B flags for surrounding code\n - Adaptive context: >50 matches use -A 2 -B 2, <20 matches use -A 10 -B 10\n\n **UNIVERSAL TECHNIQUES (always available):**\n - Pattern-based search techniques to identify key components\n - Architectural mapping through dependency analysis\n - Representative sampling of critical system components (3-5 files maximum)\n - Progressive refinement of understanding through iterations\n - MCP document summarizer for files >20KB\n\n3. **Analyze Findings**: Process discovered information by:\n - Extracting meaningful patterns from code structures\n - Identifying architectural decisions and design principles\n - Documenting system boundaries and interaction patterns\n - Assessing technical debt and improvement opportunities\n\n4. **Synthesize Insights**: Create comprehensive understanding through:\n - Connecting disparate findings into coherent system view\n - Identifying risks, opportunities, and recommendations\n - Documenting key insights and architectural decisions\n - Providing actionable recommendations for improvement\n\n**Memory Management Excellence:**\n\nYou will maintain strict memory discipline through:\n- Prioritizing search tools (vector search OR grep/glob) to avoid loading files into memory\n- Using vector search when available for semantic understanding without file loading\n- Using grep/glob as fallback when vector search is unavailable\n- Strategic sampling of representative components (maximum 3-5 files per session)\n- Preference for search tools over direct file reading\n- Mandatory use of document summarization for files exceeding 20KB\n- Sequential processing to prevent memory accumulation\n- Immediate extraction and summarization of key insights\n\n**Tool Availability and Graceful Degradation:**\n\nYou will adapt your approach based on available tools:\n- Check if mcp-vector-search tools are available in your tool set\n- If available: Use semantic search capabilities for efficient pattern discovery\n- If unavailable: Gracefully fall back to grep/glob for pattern-based search\n- Never fail a task due to missing optional tools - adapt your strategy\n- Inform the user if falling back to alternative search methods\n- Maintain same quality of analysis regardless of tool availability\n\n**Research Focus Areas:**\n\n**Architectural Analysis:**\n- System design patterns and architectural decisions\n- Service boundaries and interaction mechanisms\n- Data flow patterns and processing pipelines\n- Integration points and external dependencies\n\n**Code Quality Assessment:**\n- Design pattern usage and code organization\n- Technical debt identification and quantification\n- Security vulnerability assessment\n- Performance bottleneck identification\n\n**Technology Evaluation:**\n- Framework and library usage patterns\n- Configuration management approaches\n- Development and deployment practices\n- Tooling and automation strategies\n\n**Communication Style:**\n\nWhen presenting research findings, you will:\n- Provide clear, structured analysis with supporting evidence\n- Highlight key insights and their implications\n- Recommend specific actions based on discovered patterns\n- Document assumptions and limitations of the analysis\n- Present findings in actionable, prioritized format\n\n**Research Standards:**\n\nYou will maintain high standards through:\n- Systematic approach to investigation and analysis\n- Evidence-based conclusions with clear supporting data\n- Comprehensive documentation of methodology and findings\n- Regular validation of assumptions against discovered evidence\n- Clear separation of facts, inferences, and recommendations\n\nYour goal is to provide comprehensive, accurate, and actionable insights that enable informed decision-making about system architecture, code quality, and technical strategy while maintaining exceptional memory efficiency throughout the research process.",
132
139
  "memory_routing": {
133
140
  "description": "Stores analysis findings, domain knowledge, and architectural decisions",
134
141
  "categories": [
@@ -11,6 +11,7 @@ documentation with code structure analysis.
11
11
  import contextlib
12
12
  import subprocess
13
13
  import sys
14
+ from datetime import datetime
14
15
  from pathlib import Path
15
16
  from typing import Any, Dict, List, Optional
16
17
 
@@ -20,6 +21,9 @@ from rich.panel import Panel
20
21
  from rich.progress import Progress, SpinnerColumn, TextColumn
21
22
  from rich.prompt import Prompt
22
23
 
24
+ # Import pause/resume managers
25
+ from claude_mpm.cli.commands.session_pause_manager import SessionPauseManager
26
+ from claude_mpm.cli.commands.session_resume_manager import SessionResumeManager
23
27
  from claude_mpm.core.logging_utils import get_logger
24
28
 
25
29
  # Import new services
@@ -48,6 +52,10 @@ class MPMInitCommand:
48
52
  self.analyzer = EnhancedProjectAnalyzer(self.project_path)
49
53
  self.display = DisplayHelper(console)
50
54
 
55
+ # Session management
56
+ self.pause_manager = SessionPauseManager(self.project_path)
57
+ self.resume_manager = SessionResumeManager(self.project_path)
58
+
51
59
  def initialize_project(
52
60
  self,
53
61
  project_type: Optional[str] = None,
@@ -1464,6 +1472,125 @@ preserving valuable project-specific information while refreshing standard secti
1464
1472
  logger.error(f"Initialization failed: {e}")
1465
1473
  return {"status": "error", "message": str(e)}
1466
1474
 
1475
+ def handle_pause(
1476
+ self,
1477
+ summary: Optional[str] = None,
1478
+ accomplishments: Optional[List[str]] = None,
1479
+ next_steps: Optional[List[str]] = None,
1480
+ ) -> Dict[str, Any]:
1481
+ """Handle session pause request.
1482
+
1483
+ Args:
1484
+ summary: Summary of what was being worked on
1485
+ accomplishments: List of things accomplished
1486
+ next_steps: List of next steps to continue work
1487
+
1488
+ Returns:
1489
+ Dict containing pause result
1490
+ """
1491
+ try:
1492
+ # If no context provided, prompt for it
1493
+ if not summary:
1494
+ summary = Prompt.ask(
1495
+ "\n[bold]What were you working on?[/bold]",
1496
+ default="Working on project improvements",
1497
+ )
1498
+
1499
+ if not accomplishments:
1500
+ console.print(
1501
+ "\n[bold]List accomplishments (enter blank line to finish):[/bold]"
1502
+ )
1503
+ accomplishments = []
1504
+ while True:
1505
+ item = Prompt.ask(" Accomplishment", default="")
1506
+ if not item:
1507
+ break
1508
+ accomplishments.append(item)
1509
+
1510
+ if not next_steps:
1511
+ console.print(
1512
+ "\n[bold]List next steps (enter blank line to finish):[/bold]"
1513
+ )
1514
+ next_steps = []
1515
+ while True:
1516
+ item = Prompt.ask(" Next step", default="")
1517
+ if not item:
1518
+ break
1519
+ next_steps.append(item)
1520
+
1521
+ # Pause the session
1522
+ return self.pause_manager.pause_session(
1523
+ conversation_summary=summary,
1524
+ accomplishments=accomplishments,
1525
+ next_steps=next_steps,
1526
+ )
1527
+
1528
+ except Exception as e:
1529
+ logger.error(f"Failed to pause session: {e}")
1530
+ console.print(f"[red]❌ Error pausing session: {e}[/red]")
1531
+ return {"status": "error", "message": str(e)}
1532
+
1533
+ def handle_resume(self, session_id: Optional[str] = None) -> Dict[str, Any]:
1534
+ """Handle session resume request.
1535
+
1536
+ Args:
1537
+ session_id: Optional specific session ID to resume
1538
+
1539
+ Returns:
1540
+ Dict containing resume result
1541
+ """
1542
+ try:
1543
+ # Check if there are any paused sessions
1544
+ available_sessions = self.resume_manager.list_available_sessions()
1545
+
1546
+ if not available_sessions:
1547
+ console.print("\n[yellow]No paused sessions found.[/yellow]")
1548
+ console.print(
1549
+ "[dim]To pause a session, run: claude-mpm mpm-init pause[/dim]\n"
1550
+ )
1551
+ return {"status": "error", "message": "No paused sessions found"}
1552
+
1553
+ # If no session ID specified and multiple sessions exist, let user choose
1554
+ if not session_id and len(available_sessions) > 1:
1555
+ console.print("\n[bold]Available Paused Sessions:[/bold]\n")
1556
+ for idx, session in enumerate(available_sessions, 1):
1557
+ paused_at = session.get("paused_at", "unknown")
1558
+ try:
1559
+ dt = datetime.fromisoformat(paused_at.replace("Z", "+00:00"))
1560
+ paused_display = dt.strftime("%Y-%m-%d %H:%M")
1561
+ except Exception:
1562
+ paused_display = paused_at
1563
+
1564
+ summary = session.get("summary", "No summary")
1565
+ if len(summary) > 60:
1566
+ summary = summary[:57] + "..."
1567
+
1568
+ console.print(
1569
+ f" [{idx}] {session['session_id']} - {paused_display}"
1570
+ )
1571
+ console.print(f" {summary}\n")
1572
+
1573
+ choice = Prompt.ask(
1574
+ "Select session to resume",
1575
+ choices=[str(i) for i in range(1, len(available_sessions) + 1)],
1576
+ default="1",
1577
+ )
1578
+ session_id = available_sessions[int(choice) - 1]["session_id"]
1579
+
1580
+ # Resume the session
1581
+ result = self.resume_manager.resume_session(session_id=session_id)
1582
+
1583
+ # Display resume context
1584
+ if result.get("status") == "success":
1585
+ console.print("\n[dim]Resume context has been displayed above.[/dim]\n")
1586
+
1587
+ return result
1588
+
1589
+ except Exception as e:
1590
+ logger.error(f"Failed to resume session: {e}")
1591
+ console.print(f"[red]❌ Error resuming session: {e}[/red]")
1592
+ return {"status": "error", "message": str(e)}
1593
+
1467
1594
  def _display_results(self, result: Dict, verbose: bool):
1468
1595
  """Display initialization results."""
1469
1596
  if result["status"] == "success":
@@ -1500,7 +1627,7 @@ preserving valuable project-specific information while refreshing standard secti
1500
1627
  self.display.display_success_panel("Success", success_content)
1501
1628
 
1502
1629
 
1503
- @click.command(name="mpm-init")
1630
+ @click.group(name="mpm-init", invoke_without_command=True)
1504
1631
  @click.option(
1505
1632
  "--project-type",
1506
1633
  type=click.Choice(
@@ -1589,7 +1716,9 @@ preserving valuable project-specific information while refreshing standard secti
1589
1716
  required=False,
1590
1717
  default=".",
1591
1718
  )
1719
+ @click.pass_context
1592
1720
  def mpm_init(
1721
+ ctx,
1593
1722
  project_type,
1594
1723
  framework,
1595
1724
  force,
@@ -1619,18 +1748,28 @@ def mpm_init(
1619
1748
  - Optimize for AI agent understanding
1620
1749
  - Perform AST analysis for enhanced developer documentation
1621
1750
 
1751
+ Session Management:
1752
+ - pause: Pause the current session and save state
1753
+ - resume: Resume the most recent (or specified) paused session
1754
+
1622
1755
  Update Mode:
1623
1756
  When CLAUDE.md exists, the command offers to update rather than recreate,
1624
1757
  preserving custom content while refreshing standard sections.
1625
1758
 
1626
1759
  Examples:
1627
1760
  claude-mpm mpm-init # Initialize/update current directory
1761
+ claude-mpm mpm-init pause # Pause current session
1762
+ claude-mpm mpm-init resume # Resume latest session
1628
1763
  claude-mpm mpm-init --review # Review project state without changes
1629
1764
  claude-mpm mpm-init --update # Force update mode
1630
1765
  claude-mpm mpm-init --organize # Organize misplaced files
1631
1766
  claude-mpm mpm-init --project-type web # Initialize as web project
1632
1767
  claude-mpm mpm-init /path/to/project --force # Force reinitialize project
1633
1768
  """
1769
+ # If a subcommand is being invoked, don't run the main command
1770
+ if ctx.invoked_subcommand is not None:
1771
+ return
1772
+
1634
1773
  try:
1635
1774
  # Create command instance
1636
1775
  command = MPMInitCommand(Path(project_path))
@@ -1668,5 +1807,115 @@ def mpm_init(
1668
1807
  sys.exit(1)
1669
1808
 
1670
1809
 
1810
+ @mpm_init.command(name="pause")
1811
+ @click.option(
1812
+ "--summary",
1813
+ "-s",
1814
+ type=str,
1815
+ help="Summary of what you were working on",
1816
+ )
1817
+ @click.option(
1818
+ "--accomplishment",
1819
+ "-a",
1820
+ multiple=True,
1821
+ help="Accomplishment from this session (can be used multiple times)",
1822
+ )
1823
+ @click.option(
1824
+ "--next-step",
1825
+ "-n",
1826
+ multiple=True,
1827
+ help="Next step to continue work (can be used multiple times)",
1828
+ )
1829
+ @click.argument(
1830
+ "project_path",
1831
+ type=click.Path(exists=True, file_okay=False, dir_okay=True),
1832
+ required=False,
1833
+ default=".",
1834
+ )
1835
+ def pause_session(summary, accomplishment, next_step, project_path):
1836
+ """
1837
+ Pause the current session and save state.
1838
+
1839
+ This command captures:
1840
+ - Conversation summary and progress
1841
+ - Git repository state (commits, branch, status)
1842
+ - Todo list status
1843
+ - Working directory changes
1844
+
1845
+ The saved state enables seamless session resumption with full context.
1846
+
1847
+ Examples:
1848
+ claude-mpm mpm-init pause
1849
+ claude-mpm mpm-init pause -s "Working on authentication feature"
1850
+ claude-mpm mpm-init pause -a "Implemented login" -a "Added tests"
1851
+ claude-mpm mpm-init pause -n "Add logout functionality"
1852
+ """
1853
+ try:
1854
+ command = MPMInitCommand(Path(project_path))
1855
+
1856
+ result = command.handle_pause(
1857
+ summary=summary,
1858
+ accomplishments=list(accomplishment) if accomplishment else None,
1859
+ next_steps=list(next_step) if next_step else None,
1860
+ )
1861
+
1862
+ if result["status"] == "success":
1863
+ sys.exit(0)
1864
+ else:
1865
+ sys.exit(1)
1866
+
1867
+ except KeyboardInterrupt:
1868
+ console.print("\n[yellow]Pause cancelled by user[/yellow]")
1869
+ sys.exit(130)
1870
+ except Exception as e:
1871
+ console.print(f"[red]Pause failed: {e}[/red]")
1872
+ sys.exit(1)
1873
+
1874
+
1875
+ @mpm_init.command(name="resume")
1876
+ @click.option(
1877
+ "--session-id",
1878
+ "-i",
1879
+ type=str,
1880
+ help="Specific session ID to resume (defaults to most recent)",
1881
+ )
1882
+ @click.argument(
1883
+ "project_path",
1884
+ type=click.Path(exists=True, file_okay=False, dir_okay=True),
1885
+ required=False,
1886
+ default=".",
1887
+ )
1888
+ def resume_session(session_id, project_path):
1889
+ """
1890
+ Resume a paused session.
1891
+
1892
+ This command:
1893
+ - Loads the most recent (or specified) paused session
1894
+ - Checks for changes since the pause (commits, file changes, branch changes)
1895
+ - Displays warnings for any conflicts
1896
+ - Generates a complete context summary for seamless resumption
1897
+
1898
+ Examples:
1899
+ claude-mpm mpm-init resume
1900
+ claude-mpm mpm-init resume --session-id session-20251019-120000
1901
+ """
1902
+ try:
1903
+ command = MPMInitCommand(Path(project_path))
1904
+
1905
+ result = command.handle_resume(session_id=session_id)
1906
+
1907
+ if result["status"] == "success":
1908
+ sys.exit(0)
1909
+ else:
1910
+ sys.exit(1)
1911
+
1912
+ except KeyboardInterrupt:
1913
+ console.print("\n[yellow]Resume cancelled by user[/yellow]")
1914
+ sys.exit(130)
1915
+ except Exception as e:
1916
+ console.print(f"[red]Resume failed: {e}[/red]")
1917
+ sys.exit(1)
1918
+
1919
+
1671
1920
  # Export for CLI registration
1672
1921
  __all__ = ["mpm_init"]
@@ -25,6 +25,47 @@ def manage_mpm_init(args):
25
25
  # Import the command implementation
26
26
  from .mpm_init import MPMInitCommand
27
27
 
28
+ # Handle pause/resume subcommands
29
+ subcommand = getattr(args, "subcommand", None)
30
+
31
+ if subcommand == "pause":
32
+ # Get project path
33
+ project_path = (
34
+ Path(args.project_path) if hasattr(args, "project_path") else Path.cwd()
35
+ )
36
+
37
+ # Create command instance
38
+ command = MPMInitCommand(project_path)
39
+
40
+ # Handle pause with optional arguments
41
+ result = command.handle_pause(
42
+ summary=getattr(args, "summary", None),
43
+ accomplishments=getattr(args, "accomplishment", None),
44
+ next_steps=getattr(args, "next_step", None),
45
+ )
46
+
47
+ # Return appropriate exit code
48
+ if result.get("status") == "success":
49
+ return 0
50
+ return 1
51
+
52
+ if subcommand == "resume":
53
+ # Get project path
54
+ project_path = (
55
+ Path(args.project_path) if hasattr(args, "project_path") else Path.cwd()
56
+ )
57
+
58
+ # Create command instance
59
+ command = MPMInitCommand(project_path)
60
+
61
+ # Handle resume with optional session ID
62
+ result = command.handle_resume(session_id=getattr(args, "session_id", None))
63
+
64
+ # Return appropriate exit code
65
+ if result.get("status") == "success":
66
+ return 0
67
+ return 1
68
+
28
69
  # Handle special flags
29
70
  if getattr(args, "list_templates", False):
30
71
  # List available templates
@@ -55,7 +96,6 @@ def manage_mpm_init(args):
55
96
  "framework": getattr(args, "framework", None),
56
97
  "force": getattr(args, "force", False),
57
98
  "verbose": getattr(args, "verbose", False),
58
- "use_venv": getattr(args, "use_venv", False),
59
99
  "ast_analysis": getattr(args, "ast_analysis", True),
60
100
  "update_mode": getattr(args, "update", False),
61
101
  "review_only": getattr(args, "review", False),