Overview
Genie Helper runs multiple services managed by PM2 (Process Manager 2). This guide covers monitoring service health, analyzing logs, and debugging common issues.Service Architecture
PM2 Quick Reference
Check Service Status
Restart Services
View Logs
Start/Stop Services
Log Analysis
AnythingLLM Logs
- MCP server boot messages
- Agent tool execution
- WebSocket connection status
- LLM inference timing
- Action Runner intercepts
Media Worker Logs
- BullMQ job processing
- Stagehand session status
- FFmpeg/ImageMagick output
- Platform scrape results
- HITL session creation
Directus Logs
- API request errors
- Database connection issues
- Flow execution status
- File upload errors
- RBAC sync webhook calls
Stagehand Logs
- Browser session creation
- Navigation timing
- Cookie injection status
- Screenshot captures
- Page interaction errors
Service Health Checks
Manual Health Checks
Expected Responses
Common Issues & Solutions
High Memory Usage
Symptoms:pm2 statusshows high memory- System becomes sluggish
- Services crash with OOM errors
- Restart memory-heavy service:
pm2 restart anything-llm - Check for memory leaks in logs
- Reduce concurrent Stagehand sessions
- Upgrade server RAM (current ceiling: ~33 concurrent browser sessions)
Slow LLM Response
Symptoms:- Chat responses take >30 seconds
- Agent actions timeout
- First token delay excessive
- Current setup: CPU-only inference, dolphin3:8b stalls
- Workaround: Use qwen-2.5:latest (33s first token acceptable)
- Long-term: Upgrade to GPU-enabled VPS
- Check: Ollama service not overloaded
MCP Server Not Starting
Symptoms:- Agent can’t use tools
- “Tool not found” errors
- MCP connection failures
- Check MCP config exists:
- Verify MCP scripts exist:
- Check Node.js version:
- Restart AnythingLLM:
Stagehand Session Stuck
Symptoms:- Scrape jobs never complete
- “Browser session timeout” errors
- Memory usage climbs over time
- Restart Stagehand:
- Check browser process:
- Review session management in media-worker logs
- Implement session timeout in job processing
Dashboard Not Updating
Symptoms:- Code changes not reflected
- Old version still serving
- 404 on new routes
HITL Sessions Not Created
Symptoms:- No yellow banner on dashboard
- Scrape fails silently
- No entries in
hitl_sessions
- Check
platform_sessionsfor existing cookies: - Verify media-worker detecting missing cookies
- Check Directus permissions on
hitl_sessionscollection - Review system prompt includes HITL instructions
Performance Monitoring
CPU Usage
- Idle: Less than 5% total
- LLM inference: 80-100% single core, 2-5 seconds
- FFmpeg clip: 80-100% single core, approximately 30 seconds
- Stagehand session: 20-40% per active browser
Disk Space
Network Monitoring
Debugging Workflows
Debug LLM Agent Issues
1
Check agent logs
2
Verify MCP tools available
Check boot sequence for MCP server initialization
3
Test tool manually
Use AnythingLLM UI (localhost:3001) to test tool directly
4
Review Action Runner
Check
agent_audits collection for execution logs5
Check system prompt
Verify workspace prompt includes required instructions
Debug Media Processing
1
Check job queue
2
Verify BullMQ jobs
Check
media_jobs collection in Directus for job status3
Test FFmpeg/ImageMagick
Run commands manually to isolate issue
4
Check file permissions
Ensure media-worker can read/write storage directory
5
Review Stagehand session
Check session cleanup, screenshot captures
Debug Platform Scraping
1
Check platform sessions
Verify cookies exist in
platform_sessions collection2
Test cookie freshness
Cookies expire, may need HITL re-authentication
3
Review Stagehand logs
Check navigation, selectors, timeout errors
4
Check HITL flow
If cookies missing, verify HITL session created
5
Test manually
Use browser to verify platform accessible, not blocking
Alerting & Notifications
Alerting system not yet implemented. Consider adding:
- Service down alerts: Email/SMS when PM2 process crashes
- Disk space warnings: Alert at 80% capacity
- Memory thresholds: Alert when service exceeds limits
- Job failures: Notify when BullMQ jobs fail repeatedly
- HITL requests: Alert admin when human intervention needed
Admin Access
For direct service access:Related Resources
- PM2 documentation: https://pm2.keymetrics.io/docs/usage/quick-start/
- Nginx logs:
/var/log/nginx/(Plesk managed) - System logs:
journalctl -u <service-name> - Redis monitoring:
redis-cli INFO
