ShinAI
Multi-Platform Context-Aware AI Agent
Project Overview
An intelligent multi-platform bot that acts like a real group member, featuring personality-driven responses and long-term memory across Telegram and Discord.
ShinAI bridges the gap between a standard helpful assistant and a natural group chat member. Instead of relying on rigid command structures, it utilizes a highly configurable persona system to match group dialects, engage in banter, and interject naturally. Powered by a RAG (Retrieval-Augmented Generation) architecture, it possesses unified cross-platform memory, allowing it to remember past conversations, recognize members across different apps, and seamlessly pull live data from the web when required.
Project Stats
Key Features
- Unified cross-platform memory (Telegram & Discord recognition).
- Dynamic personality system with custom traits, dialects, and relationships.
- Real-time autonomous web searching and content scraping.
- Intelligent reply targeting using native platform message IDs.
- Multi-message response capabilities with natural typing delays.
- Visual context awareness (understands images and stickers via Gemini).
- Native platform moderation execution (Kick, Ban, Mute, Invite).
- Robust fallback system with API rotation and error-aware retries.
Technologies Used
Technical Implementation
My technical contributions to this project include (but may not be limited to):
- Architected a Multi-Platform Adapter Layer that standardizes asynchronous events across Telegram, Discord, and WhatsApp, normalizing native payloads into a strict
UnifiedMessageschema. - Engineered an advanced RAG Pipeline utilizing ChromaDB and
sentence-transformers(multilingual-e5-large) to enable cross-platform, semantic memory retrieval. - Utilized asyncio extensively across all platform handlers and AI provider clients to ensure non-blocking, concurrent message processing and high throughput.
- Integrated an Autonomous Web Search Module using
duckduckgo-searchandbeautifulsoup4to dynamically fetch, parse, and compress real-time text data to prevent context-window overflow. - Built a fault-tolerant LLM Routing System featuring API key rotation, round-robin fallback, and error-aware retries that inject failure exceptions directly back into the model's prompt.
- Developed a custom Context Builder that dynamically constructs system prompts by injecting personality traits, vectorized member profiles, and threaded reply chains up to 10 levels deep.
- Implemented a Semantic Time Detection algorithm paired with Maximal Marginal Relevance (MMR) to guarantee accurate chronological filtering and deduplicated memory recall.
- Engineered built-in Rate Limiting and per-user cooldown mechanisms to prevent chat spam, control bot concurrency, and mitigate AI provider quota exhaustion.
- Fully configurable via environment variables, allowing seamless adjustments to platform toggles, moderation thresholds, and AI provider selections without altering code.
- Containerized the entire multi-platform ecosystem with Docker and Docker Compose, ensuring persistent volume management for SQLite databases and platform session files.