From 37c53f6a67146b6c05b5a571b73f9fc954b307f6 Mon Sep 17 00:00:00 2001 From: hoangqnguyen Date: Mon, 13 Jul 2026 12:36:24 +0700 Subject: [PATCH 1/2] fix(telegram): include the replied-to / quoted message in the prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a user replied to or quoted a message, handleMessage() only read the replied message's id and sender, never its content, and ignored Telegram's quote field entirely. The prompt handed to Claude contained only the user's new message, so the quoted context was silently dropped — Claude never saw what the user was replying to. Capture reply_to_message.text/caption and quote.text (the highlighted excerpt for partial quotes), and prepend them to the prompt as untrusted context ("In reply to your own earlier message: ..." / "a message from : ..."), capped at 2000 chars like other external input. The TelegramMessage type is extended accordingly. tsc --noEmit clean. Co-Authored-By: Claude Opus 4.8 (1M context) --- .claude-plugin/marketplace.json | 2 +- .claude-plugin/plugin.json | 2 +- src/commands/telegram.ts | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index f5430793..9e7b9047 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -8,7 +8,7 @@ "name": "claudeclaw", "source": "./", "description": "Cron-like daemon that runs Claude prompts on a schedule", - "version": "1.0.40", + "version": "1.0.43", "keywords": [ "cron", "heartbeat", diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 2688e3ab..fea3a87e 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,5 +1,5 @@ { "name": "claudeclaw", - "version": "1.0.40", + "version": "1.0.43", "description": "Cron-like daemon that runs Claude prompts on a schedule" } diff --git a/src/commands/telegram.ts b/src/commands/telegram.ts index fd7584cd..9be6251f 100644 --- a/src/commands/telegram.ts +++ b/src/commands/telegram.ts @@ -88,7 +88,8 @@ interface TelegramUser { interface TelegramMessage { message_id: number; from?: TelegramUser; - reply_to_message?: { message_id?: number; from?: TelegramUser }; + reply_to_message?: { message_id?: number; from?: TelegramUser; text?: string; caption?: string }; + quote?: { text?: string }; chat: { id: number; type: string }; message_thread_id?: number; text?: string; @@ -1385,6 +1386,18 @@ async function handleMessage(message: TelegramMessage): Promise { const promptParts = [`[Telegram from ${label}]`]; if (threadId) promptParts.push(`[thread:${threadId}]`); + // Include the message being replied to / quoted so Claude has the context. + // Telegram puts the full original in reply_to_message; quote.text holds the + // specific highlighted excerpt when the user quotes only part of a message. + const repliedText = message.reply_to_message?.text ?? message.reply_to_message?.caption; + const quotedExcerpt = message.quote?.text; + if (quotedExcerpt || repliedText) { + const fromBot = botId != null && message.reply_to_message?.from?.id === botId; + const who = fromBot + ? "your own earlier message" + : `a message from ${message.reply_to_message?.from?.first_name ?? "someone"}`; + promptParts.push(`In reply to ${who}: ${wrapUntrusted("replied-message", quotedExcerpt ?? repliedText!, 2000)}`); + } if (skillContext) { // Strip the slash command from the message text and pass remaining args const args = text.trim().slice(command!.length).trim(); From a9a8066786b4c51dc5c12607c781f45d070b513f Mon Sep 17 00:00:00 2001 From: TerrysPOV Date: Sun, 19 Jul 2026 17:48:51 +0100 Subject: [PATCH 2/2] chore(release): bump plugin and marketplace to 1.0.44 --- .claude-plugin/marketplace.json | 2 +- .claude-plugin/plugin.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 9e7b9047..888422e7 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -8,7 +8,7 @@ "name": "claudeclaw", "source": "./", "description": "Cron-like daemon that runs Claude prompts on a schedule", - "version": "1.0.43", + "version": "1.0.44", "keywords": [ "cron", "heartbeat", diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index fea3a87e..644babac 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,5 +1,5 @@ { "name": "claudeclaw", - "version": "1.0.43", + "version": "1.0.44", "description": "Cron-like daemon that runs Claude prompts on a schedule" }