A lightweight LM Studio plugin that fetches, caches, and performs lexical RAG (Retrieval-Augmented Generation) search over public Telegram channel messages.
It uses Telegram's public web preview (t.me/s/<channel>), so no API keys or authentication are required. Messages are cached locally as pure JSON files, and search is powered by a custom TF-IDF cosine similarity implementation.
~/.lmstudio/plugin-data/telegram-rag-cache/. No external databases required.fs, path, os, https); schema validation uses zod via the LM Studio SDK.In LM Studio, open the plugin settings to configure:
| Setting | Description | Default |
|---|---|---|
| History Window | How far back to cache and search | 1 Month |
| Max Cached Messages | Upper bound on messages stored on disk per channel | 5,000 |
| Default Fetch Pages | Pages to fetch per sync (~20 messages/page) | 5 |
| Search Result Limit | Maximum number of search results returned | 10 |
| Tool Name | Description |
|---|---|
telegram_fetch_channel | Fetches recent messages for a channel and merges them into the local cache. |
telegram_search | Searches the local cache using cosine similarity over term-frequency vectors. |
telegram_watchlist_add | Adds a channel to watchlist.json for regular syncing. |
telegram_watchlist_remove | Removes a channel from the watchlist. |
telegram_watchlist_sync | Fetches and updates the cache for every channel in the watchlist. |
telegram_cache_stats | Returns statistics (total cached, in-window count, date range) for a channel. |
telegram_get_recent | Returns the most recent N cached messages for a channel. |
telegram_list_channels | Lists all channels that have cached data on disk. |
telegram_clear_cache | Deletes the local cache file for a specific channel. |
telegram_ping | Health check. Returns plugin status and the data directory. |
Just talk to your LLM in LM Studio. Make sure the plugin is enabled in the Tools menu.
Setting up a watchlist
"Please add the channels
durovandtelegramto my Telegram watchlist."
Syncing data
"Sync my Telegram watchlist now."
The LLM fetches every channel in watchlist.json and caches their messages.
Searching (RAG)
"Search the
durovchannel for messages about AI or technology."
The LLM searches the local cache and returns the most relevant messages with direct t.me links.
Checking stats
"Show me the cache stats for the
telegramchannel."
~/.lmstudio/plugin-data/telegram-rag-cache/cache_<channel>.json~/.lmstudio/plugin-data/telegram-rag-cache/watchlist.jsonThis plugin adheres to the LM Studio SDK architecture rules:
Install dependencies and type-check:
A lightweight LM Studio plugin that fetches, caches, and performs lexical RAG (Retrieval-Augmented Generation) search over public Telegram channel messages.
It uses Telegram's public web preview (t.me/s/<channel>), so no API keys or authentication are required. Messages are cached locally as pure JSON files, and search is powered by a custom TF-IDF cosine similarity implementation.
~/.lmstudio/plugin-data/telegram-rag-cache/. No external databases required.fs, path, os, https); schema validation uses zod via the LM Studio SDK.In LM Studio, open the plugin settings to configure:
| Setting | Description | Default |
|---|---|---|
| History Window | How far back to cache and search | 1 Month |
| Max Cached Messages | Upper bound on messages stored on disk per channel | 5,000 |
| Default Fetch Pages | Pages to fetch per sync (~20 messages/page) | 5 |
| Search Result Limit | Maximum number of search results returned | 10 |
| Tool Name | Description |
|---|---|
telegram_fetch_channel | Fetches recent messages for a channel and merges them into the local cache. |
telegram_search | Searches the local cache using cosine similarity over term-frequency vectors. |
telegram_watchlist_add | Adds a channel to watchlist.json for regular syncing. |
telegram_watchlist_remove | Removes a channel from the watchlist. |
telegram_watchlist_sync | Fetches and updates the cache for every channel in the watchlist. |
telegram_cache_stats | Returns statistics (total cached, in-window count, date range) for a channel. |
telegram_get_recent | Returns the most recent N cached messages for a channel. |
telegram_list_channels | Lists all channels that have cached data on disk. |
telegram_clear_cache | Deletes the local cache file for a specific channel. |
telegram_ping | Health check. Returns plugin status and the data directory. |
Just talk to your LLM in LM Studio. Make sure the plugin is enabled in the Tools menu.
Setting up a watchlist
"Please add the channels
durovandtelegramto my Telegram watchlist."
Syncing data
"Sync my Telegram watchlist now."
The LLM fetches every channel in watchlist.json and caches their messages.
Searching (RAG)
"Search the
durovchannel for messages about AI or technology."
The LLM searches the local cache and returns the most relevant messages with direct t.me links.
Checking stats
"Show me the cache stats for the
telegramchannel."
~/.lmstudio/plugin-data/telegram-rag-cache/cache_<channel>.json~/.lmstudio/plugin-data/telegram-rag-cache/watchlist.jsonThis plugin adheres to the LM Studio SDK architecture rules:
Install dependencies and type-check:
src/index.ts entry point exporting async function main(context)."type": "module" in package.json (bundles to CommonJS).manifest.json contains only type, runner, owner, name, description, revision.createConfigSchematics with only select or numeric fields.tool() helper with plain Zod object parameters.__dirname / os.homedir() instead of import.meta.url.npm install
npm run typecheck
src/index.ts entry point exporting async function main(context)."type": "module" in package.json (bundles to CommonJS).manifest.json contains only type, runner, owner, name, description, revision.createConfigSchematics with only select or numeric fields.tool() helper with plain Zod object parameters.__dirname / os.homedir() instead of import.meta.url.npm install
npm run typecheck