# Phase 5 Plan 01: NLU Cleanup Summary **Replaced Claude/NLU with keyword-based routing and persistent Telegram menu buttons** ## Frontmatter ```yaml phase: 05-polish-deploy plan: 01 subsystem: workflow-routing tags: [n8n, telegram, keyword-routing, menu] dependency-graph: requires: [04-01] provides: [keyword-router, persistent-menu, nlu-removal] affects: [] tech-stack: added: [] patterns: [keyword-switch-routing, telegram-reply-keyboard] key-files: created: [] modified: [n8n-workflow.json] decisions: - keyword-order-matters: "restart before start to avoid substring match issues" - combined-tasks: "Task 1 and Task 2 merged for atomic workflow change" - no-emojis-on-buttons: "Clean button text for reliable keyword matching" metrics: duration: 4m completed: 2026-02-01 ``` ## What Changed ### Removed Nodes (NLU/Claude) - Prepare Claude Request - Claude Intent Parser (HTTP Request to api.anthropic.com) - Parse Intent (Code node) - Intent Router (Switch node) - Send Unknown Intent - Send Intent Error - Send Stats Placeholder - Format Echo / Send Echo ### Added/Modified Nodes **Keyword Router** (renamed from Route Message) - 7 keyword rules with case-insensitive matching - Order: /start, status, restart, start, stop, update, logs - Fallback output connects to Show Menu **Show Menu** (new HTTP Request node) - Sends persistent keyboard with 6 buttons - Layout: Status solo, then paired (Start/Stop, Restart/Update, Logs) - is_persistent: true, resize_keyboard: true ### Code Updates - Parse and Match: Works with keyword routing, extracts container from message - Parse Action Command: Parses action and container from message text - Match Container: References Parse Action Command instead of Parse Intent - Parse Logs Command: Parses container name and line count from message ## Commits | Commit | Description | |--------|-------------| | a29f444 | feat(05-01): replace NLU/Claude with keyword routing | ## Verification Results All checks passed: - Zero Claude/NLU nodes remain - Zero Anthropic API references in workflow - Keyword Router handles: /start, status, restart, start, stop, update, logs - Fallback routes to Show Menu - Persistent menu has 6 buttons with is_persistent: true - All keyword routes connect to correct handler nodes ## Deviations from Plan ### Combined Tasks Tasks 1 and 2 were executed as a single atomic change because: - Show Menu node required for Keyword Router fallback connection - Keyword Router updates and Show Menu creation are interdependent - Single commit ensures workflow remains valid at all times ### Rule Order Optimization Added rule order optimization to handle substring conflicts: - `/start` before `start` (command vs keyword) - `restart` before `start` (restart contains "start") ## Next Steps The workflow now operates without Claude API dependency: - All commands work via typed keywords - Button taps trigger same keyword routes - Unknown input shows menu (not error) Ready for Phase 5 Plan 02 (if any additional polish plans exist) or deployment.