Added new section "Gateway Stability Infrastructure" covering:
- Multi-layer stability design (system, PM2, startup hooks, health monitoring)
- All monitoring commands with examples
- Recovery scenarios and automated responses
- What problems this prevents
This comprehensive infrastructure ensures:
- No more crashes from Telegram message processing
- Automatic detection and recovery from hangs
- Prevention of inotify exhaustion hangs
- Memory limit protection
- Clean lock file management
- Full visibility into gateway health
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Removed conflicting systemd service files (moltbot-gateway.service, moltbot-health-check.*)
- Removed redundant health-check script (PM2 handles restarts natively)
- Updated README_Tech.md to document PM2 as actual process manager
- Clarified that inotify fix (524288 limit) is permanent solution
- Documented PM2 commands for troubleshooting and monitoring
- Added safety note: Never use systemd for moltbot-gateway (causes port conflicts)
- Fixed architecture documentation to reflect PM2 daemon isolation model
Gateway now running cleanly via PM2 (PID 661291) without systemd interference.
Inotify limit verified at 524288 (prevents file watcher exhaustion).
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Major Changes:
- Implement task-type router (src/agents/task-type-router.ts) for intelligent model routing
* Detects task type from user message (file-analysis, creative, debugging, cli, general)
* Routes to optimal models: Gemini Flash (file analysis), Llama 3.3 70B (creative),
Claude Sonnet 4.5 (debugging), Mistral Devstral 2 (CLI/general)
* Integrated into model selection pipeline for seamless routing
- Integrate task-type routing into model resolution (src/agents/model-selection.ts)
* Pass userMessage to resolveDefaultModelForAgent for context-aware routing
* Maintain fallback chain for model availability
- Update attempt runner (src/agents/pi-embedded-runner/run/attempt.ts)
* Pass prompt context to enable task-type based model selection
- Enhanced security and development (.gitignore)
* Added comprehensive rules for sensitive files (.env variants, credentials)
* Excluded API keys, runtime logs, test files, auto-generated skills directories
* Properly ignored ecosystem.config, build artifacts, package manager locks
- Add technical documentation (README_Tech.md)
* Process architecture (systemd Gateway, PM2 Dashboard, PM2 AI Product Visualizer)
* Management commands and troubleshooting guide
* Configuration summary and deployment checklist
* Problem log with 6 documented issues and solutions
Result:
- Bot now intelligently routes user requests to optimal models based on message type
- Production-ready with systemd isolation, preventing PM2 conflicts
- Comprehensive documentation for future maintenance and troubleshooting
- Secure version control with quality .gitignore
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>