
Company News
Socket Joins New OpenJS Program to Fund Node.js Security Work
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.
Modern interactive CLI for PM2 process management with AI assistance, built with TypeScript, ESM, and pnpm.

🎬 See PM2-X in Action: Watch how PM2-X intelligently analyzes process errors, provides AI-powered diagnosis, and suggests actionable solutions—all through natural language interaction!
npm install -g pm2)Install PM2-X globally to use it anywhere:
# Using npm
npm install -g pm2-x
# Using yarn
yarn global add pm2-x
# Using pnpm
pnpm add -g pm2-x
After installation, start the interactive CLI:
pm2x
Once you start the CLI with pnpm start, you'll enter an interactive shell where you can use these commands:
/status or /ps - Show PM2 process status/list or /ls - List all PM2 processes/restart <name> - Restart a specific process/stop <name> - Stop a specific process/start <name> - Start a specific process/all <operation> - Batch operations on all processes/health or /check - Run comprehensive health checks/watch <name> [mem] [cpu] - Auto-recovery monitoring with thresholds/watch stop - Stop watching processes/metrics or /m - System metrics and health score/history - Performance history and trends/history collect - Start collecting metrics/history clear - Clear history data/logs <name> - Stream real-time logs with automatic error detection/logs smart <name> - AI-powered log analysis with error diagnosis/grep <pattern> [name] - Search across all logs/errors or /err - Show recent errors only/save [filename] - Save PM2 ecosystem configuration/load [filename] - Load saved configuration/ai <question> - Ask AI assistant about processes/ai config - Show AI configuration status/ai provider <openai|gemini> - Switch AI provider/ai providers - List available AI providers/ai presets - Show speed/quality presets for current provider/ai preset <name> - Apply speed preset (lightning, fast, smart, reasoning)/diagnose [process] - AI-powered issue diagnosis/doctor logs [process] - Comprehensive log analysis and error diagnosis/doctor errors [process] - Focused error analysis with critical issue detection/optimize [process] - Get AI optimization suggestions/help or /h - Show available commands/clear or /cls - Clear the terminal screen/history - View and search command history/exit, /quit, or /q - Exit the CLI# Start the interactive CLI
pm2x
# Basic monitoring:
pm2x> /status
pm2x> /metrics
pm2x> /health
# Intelligent log analysis:
pm2x> /logs smart my-app # AI-powered error analysis
pm2x> /doctor logs # Comprehensive diagnosis
pm2x> /doctor errors my-app # Critical error focus
# Advanced features:
pm2x> /watch my-app 500 80 # Auto-restart if >500MB or >80% CPU
pm2x> /grep "error" my-app # Search logs for errors
pm2x> /all restart # Restart all processes
# AI-powered insights (requires OpenAI or Gemini API key):
pm2x> my app is slow, can you help? # Natural language
pm2x> /ai why is my-app slow? # Direct AI query
pm2x> /diagnose my-app # Process diagnosis
pm2x> /optimize # Optimization suggestions
# Configuration:
pm2x> /save production-config
pm2x> /load production-config
pm2x> /exit
The AI features support both OpenAI and Google Gemini. Choose your preferred provider:
# Option 1: Environment variable
export OPENAI_API_KEY=your-openai-api-key
# Option 2: Configure via CLI
pm2x> /ai provider openai
pm2x> /ai config
# Option 1: Environment variable
export GEMINI_API_KEY=your-gemini-api-key
# Option 2: Configure via CLI
pm2x> /ai provider gemini
pm2x> /ai config
# List available providers
pm2x> /ai providers
# Switch between providers
pm2x> /ai provider gemini
pm2x> /ai provider openai
# Check current configuration
pm2x> /ai config
# Speed presets for optimal performance
pm2x> /ai presets # Show available speed presets
pm2x> /ai preset lightning # GPT-5 nano - Ultra fast responses
pm2x> /ai preset fast # GPT-4o - Balanced speed and quality (recommended)
pm2x> /ai preset smart # GPT-5 - Highest intelligence for complex analysis
pm2x> /ai preset reasoning # GPT-5 mini - Deep thinking for complex problems
PM2-X uses a unified configuration file in your home directory with safe concurrent access:
~/.pm2x-config.jsonThis single file manages all PM2-X settings with enterprise-grade reliability and concurrent access protection.
# View current configuration
pm2x> /ai config
# The config file structure:
{
"provider": "openai",
"userPreferences": {
"autoExecute": false,
"verbosity": "detailed",
"confirmationLevel": "destructive"
},
"openai": {
"apiKey": "sk-...",
"model": "gpt-4o",
"activePreset": "fast"
},
"gemini": {
"apiKey": "AI...",
"model": "gemini-2.5-flash"
}
}
PM2-X is evolving toward an AI-native experience where natural language becomes the primary interface:
pm2x> my app is slow
❌ Commands must start with /. Type /help for available commands.
pm2x> /ai my app is slow
🤖 AI Assistant is thinking...
[AI response without actions]
pm2x> my app is slow
🤖 Analyzing your processes...
I can see that "my-app" is using 85% CPU and 420MB memory. This could be causing slowness.
Let me check the logs for errors:
[Automatically shows recent errors]
Suggestions:
• Restart the process: restart my-app
• Check memory usage: /metrics my-app
• Would you like me to restart it now?
pm2x> yes restart it
🔄 Restarting my-app...
✅ my-app restarted successfully
📊 New metrics: CPU 12%, Memory 89MB - much better!
# Process troubleshooting
pm2x> why did my-app crash?
🤖 Analyzing crash logs... Found memory limit exceeded at 2:34 AM
🔧 Suggesting: increase max_memory_restart to 800MB
# Batch operations
pm2x> restart all errored processes
🤖 Found 3 errored processes: api-server, worker-1, notifications
🔄 Restarting all... Done! All processes now online.
# Performance optimization
pm2x> optimize my cluster setup
🤖 Analysis: Your 4 instances are underutilized (avg 15% CPU)
💡 Recommendation: Reduce to 2 instances to save 180MB memory
🚀 Would you like me to scale down automatically?
# Learning and discovery
pm2x> how do I monitor memory usage over time?
🤖 I can help! Use `/history collect` to start tracking, then `/history` to view trends.
📊 Starting collection now... You'll have data in 30 seconds.
pm2 typingContributions are welcome! Please see the Contributing Guide for details on:
For technical details, see:
MIT License - see LICENSE file for details.
FAQs
Interactive CLI for PM2 process management with AI assistance
We found that pm2-x demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Company News
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.