LoreRoom is a tool that provides encrypted, two-way local memory for the Telegram bot of Claude Code. Every session of Claude Code is "amnesiac": after a restart, the entire conversation disappears. LoreRoom captures both sides of a Telegram conversation into a whole-file-encrypted SQLite database, then hands it back to Claude as searchable memory. For example, you can ask the bot "What did I have you do last night?", and it will search LoreRoom and answer.
Purpose and Background The Telegram plugin of Claude Code delivers received messages to Claude through an internal channel push, not through any hook. What is more troublesome is that when Claude is busy, these messages are queued invisibly, and if the bot never replies, they are completely lost. Therefore, common approaches (hooks, reading the transcript) silently lose messages. LoreRoom captures at the plugin source: inbound messages are captured at the moment Telegram delivers them, before entering any queue, regardless of whether Claude is busy, crashes, or never replies; outbound messages are captured when the bot sends a reply. Both are written to a small spool file, which the ingester drains into the encrypted database. Even if the bot is unresponsive, nothing is lost—messages stuck while the bot is busy are captured when it restarts and fetches again. LoreRoom does not use Claude Code hooks, so it will not interfere with your other Claude Code work.
Main Capabilities
- Two-way capture: records both user and bot messages.
- Whole-file encryption: the database uses SQLCipher / AES-256 encryption, so copying data/memory.sqlite to another machine is unusable without the key.
- Full-text search: FTS5 trigram, supports CJK; short keywords fall back to LIKE.
- MCP tools: Claude can call get_recent_context({ hours, chat_id? }) to get messages from the last N hours, and search_tg_history({ keyword, chat_id? }) for full-text search. Both return the timestamp, sender, role, chat id, and text of each hit.
- Local-first: no cloud, no additional API key, and never touches your bot token.
How to use Prerequisite: you need a Claude Code Telegram bot that already works. If it does not yet, first prepare: Node.js 20 or newer; Claude Code (Anthropic's command-line tool); a Telegram bot connected to Claude Code (create one in Telegram via @BotFather with /newbot and copy the token, install the official Telegram plugin in Claude Code and configure it with /telegram:configure <your-bot-token>, send a message to get a pairing code and then link the account with /telegram:access pair <code>, then start a session with claude --channels plugin:telegram@claude-plugins-official and test that "hi" gets a reply).
After installation, LoreRoom captures messages by patching the plugin—this is an idempotent command, and it needs to be run again after the plugin is updated. Then restart the bot session (claude --channels …) to load the patched plugin. After that, every Telegram message is captured automatically. No action is needed for daily use; just chat with the bot as usual. When you want the bot to recall something, ask in natural language, and the bot will call the search tool in the background.
Things to note: keep one bot session running (claude --channels …); if it stops, restart it, and messages that arrive during downtime will be captured when it resumes; after updating the Telegram plugin, run node dist/patch-plugin.js once again to reapply the patch (if it is already patched, this is a no-op).
Configuration and data Everything LoreRoom owns is inside the project folder: config.json (settings and encryption key, git-ignored, chmod 600, created by init); data/memory.sqlite (encrypted database, git-ignored). The spool is a short-lived plaintext file in the plugin's own ~/.claude/channels/telegram/ state directory (mode 0700), which is continuously drained and deleted. The MCP server drains the spool at startup, every 20 seconds, and before every query, so as long as any Claude Code session is open, captures flow into the database automatically.
Security and encryption boundaries LoreRoom never handles your Telegram bot token—that belongs to the plugin, and there is no token here to leak. The only secret is the 32-byte encryption key in config.json (git-ignored, chmod 600), never committed, never logged. The database is encrypted as a whole file (SQLCipher / AES-256). This is encryption at rest for a local database, not Telegram end-to-end encryption, and it does not change Telegram itself. Decryption happens only locally, in LoreRoom's own process; the key is never given to Claude and never goes over the network. It protects against: the database file being copied off the machine / backups leaking. It does not protect against: someone who can already read files under your local account (the key is by design placed next to the database). The spool is briefly in plaintext before it is drained.
Limitations
- Requires patching the official Telegram plugin (after plugin updates, it must be reapplied via patch-plugin).
- Only keyword + time retrieval is supported; there is not yet semantic / vector RAG (a future sqlite-vec layer can be added without breaking the single-file design).
- Messages sent to Telegram by a separate script (rather than the plugin's reply path) will not be captured.
- The plugin has been tested on macOS with Node 26 and under bun; other environments may require adjustments.
- Only applies to Claude Code + the official Telegram plugin, not a general-purpose Telegram bot framework.
- Node version note: the encrypted SQLite native module is bound to a specific Node version ABI, and init will pin the exact node that runs it. If that Node is later upgraded or removed, you need to rerun npm install && npm run build and register again.