Automated Personal Assistant & Study Companion

A robust, autonomous Telegram assistant built in n8n featuring dynamic intent routing, a localized scheduling engine for natural language reminders, and a Legal RAG (Retrieval-Augmented Generation) pipeline integrated with a Qdrant vector store.

  • Automation
  • n8n

Introduction & Architectural Overview Modern AI applications require more than just an API connection to a language model; they demand state management, precise intent routing, and dependable memory. Memorae is a production-ready, event-driven personal study assistant built on n8n that orchestrates complex task branches based on user intents sent via Telegram. Instead of routing every single input through an expensive LLM context window, the system uses a custom JavaScript-based Intent Router as a first-line triage layer. This seamlessly separates workflow tracks into standard conversational AI, a localized note-saving ingestion vector pipeline, and a dynamic natural language scheduling agent.

Core Architectural Components Intelligent Traffic Triage & Intent Routing: Incoming messages are instantly filtered to block bots and non-text formats. A centralized JavaScript engine dynamically evaluates textual regular expressions and command sequences (e.g., remember that..., remind me to...). It assigns a clean intent payload (chat, note, reminder, or clarify) before forwarding execution to specialized n8n Switch nodes. The Legal RAG Pipeline (Knowledge Injection): For conversational queries, the workflow activates a Legal RAG Agent backed by an Azure OpenAI chat model (gpt-oss-120b). It leverages a Qdrant Vector Store database (personal_vault) linked with text-embedding-3-small embeddings. If a user asks to recall custom data, the agent dynamically utilizes its tools to retrieve grounded information. Localized Natural Language Reminder Engine: When handling scheduling, a dedicated Reminder AI Agent extracts entities (task, when_text) into structured JSON. A robust JavaScript scheduling block parses time phrases like "tomorrow at 3pm" or "in 2 hours", actively normalizing relative timestamps explicitly to the Asia/Manila (PHT) timezone. Reminders are saved into workflow static data, and an independent cron-like trigger polls every 60 seconds to fire due events. Inversion-Resistant HTML Processing & Error Handling: Because Telegram relies strictly on safe HTML tags over standard Markdown, the workflow features automated string parsing to escape unauthorized characters dynamically. Additionally, a dedicated global Error Trigger branch acts as a circuit breaker, trapping script runtime failures and alerting the administrator via direct system logs.

The Technical Stack Orchestration Engine: n8n (Advanced Workflow/Execution Model) LLM & Embedding Layers: LangChain Integration, Azure OpenAI (gpt-oss-120b), text-embedding-3-small Vector Database: Qdrant (Collection: personal_vault) Interface Gateway: Telegram Bot API Runtime Utilities: Node.js / JavaScript (Intl API, Timezone wall-clock transformations)

Key Engineering Takeaways Reduced Token Overhead: By utilizing a code-based router ahead of the LangChain agents, trivial actions like saving text snippets completely bypass expensive LLM token usage. Reliable Time Calculations: Solved the common serverless issue of native UTC system clocks by utilizing strict Intl.DateTimeFormat array reduction, maintaining clock accuracy across relative multi-day offsets. Message Stream Chunking: Implemented a recursive script that splits LLM answers longer than 4,000 characters along natural sentence breaks (\n\n) to conform directly to strict chat platform maximum payload boundaries.

Related Posts

Self-Hosted n8n Automation: Law Enforcement Operations Ecosystem

A dual-workflow n8n automation architecture built to handle the rigorous administrative overhead of digital law enforcement departments.

Read More

Self-Hosted n8n Automation: Integrated Police Clearance Pipeline

A custom, self-hosted n8n automation infrastructure built to entirely digitize and streamline the issuance of police clearances.

Read More