Searches Telegram messages globally or within a specific chat using a CLI script. Supports filtering by sender, limiting results, and JSON output.
Ships in tlg. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Search messages globally across all chats or within a specific chat.
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
~/.local/share/gramjs/<profile>.session
/tlg:setup first/usr/bin/env bash << 'EOF'
ROOT="$(cc-plugin-root tlg)"
SCRIPT="$ROOT/scripts/tg-cli.ts"
# Global search (all chats)
bun "$SCRIPT" search "search term" -n 20
# Search in specific chat
bun "$SCRIPT" search "keyword" --chat 2124832490
# Filter by sender
bun "$SCRIPT" search "topic" --from @username
# Combined: search in chat from specific sender
bun "$SCRIPT" search "query" --chat @groupname --from @sender -n 10
EOF
| Parameter | Type | Description |
|---|---|---|
| query | string | Search text (required) |
--chat | string/int | Limit to specific chat (omit for global) |
--from | string/int | Filter by sender |
-n/--limit | int | Max results (default: 20) |
--preview | int | Truncate each body to N chars (default: full text, multi-line indented). |
--json | flag | JSON records (the dump fields, plus chat_id/chat_name globally) |
--utc | flag | Times in UTC instead of the local zone |
Default (full text, multi-line indented):
[YYYY-MM-DD HH:MM:SS PCT] (id:12345) Sender: {Chat Name -1001234567890} ↩12001 First line of body
continuation line 1 (indented under header)
continuation line 2
The {chat} marker appears in global search only (a message id means nothing without its chat); with --chat it is left out. The other markers (↩N, ❝quote❞, [photo], album:, (edited), [fwd from …]) are those of read: see the list-dialogs skill, "What a listed line shows". Use the chat id from {…} with read <chat> --around <id> or thread <chat> <id>.
With --preview 100:
[YYYY-MM-DD HH:MM:SS PCT] (id:12345) Sender: First line of body ⏎ continuation collapsed onto…
Use --preview N only for high-volume scans where you want one row per
message. Default = full text — long bodies are no longer silently
truncated at 150 chars (the prior default forced manual workarounds when
content actually mattered).
After this skill completes, check before closing:
Only update if the issue is real and reproducible — not speculative.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
/tlg:search-messagesfrom tlg
npx claudepluginhub terrylica/cc-skills --plugin tlg16 skills in this plugin
/cleanup-deleteduser wants to clean up Telegram by purging deleted or ghost accounts from their dialog list and contacts, or removing spam ghosts that clutter./create-groupUse when user wants to create a new Telegram group, supergroup, or channel, optionally inviting members on creation./delete-messagesUse when user wants to delete, remove, or unsend Telegram messages from a chat, either for everyone or just for themselves./download-mediaUse when user wants to download, save, or extract media files such as photos, videos, and documents from Telegram messages.