tg-cli

Sync Telegram chats into SQLite and export search results as YAML or JSON.

277|32|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/jackwener/tg-cli --skill tg-cli-jackwener
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tg-cli
Source: https://github.com/jackwener/tg-cli/tree/main
Command: npx skills add https://github.com/jackwener/tg-cli --skill tg-cli-jackwener

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

tg-cli provides a powerful, scriptable way to access Telegram data from the command line by syncing chats, indexing messages, and enabling automated queries without relying on the Telegram app.

Core Features & Use Cases

  • Sync and index Telegram chats locally into a SQLite database for quick access.
  • Search messages by keyword, with optional chat, sender, hours, and regex support; export in YAML/JSON for AI agents.
  • Listen in real time, refresh, and drive AI workflows with structured outputs.

Quick Start

Install the tg-cli tool and start by listing chats with tg chats, then fetch and search messages using the query commands.

Frequently Asked Questions about tg-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync and search Telegram chats locally from the command line?

You can sync and search Telegram chats locally by using a CLI tool that indexes messages into a SQLite database and enables automated keyword queries with optional filters like sender, chat, and hours.

Can I export Telegram messages as YAML or JSON for AI workflows?

Yes, you can export Telegram messages as YAML or JSON envelopes. This structured output is designed specifically for consumption by AI agents and automated workflows.

What is the best way to automate Telegram message indexing for agent consumption?

The best way to automate Telegram message indexing is using a scriptable CLI that fetches chats, syncs messages locally into a database, and outputs structured queryable results for agents.

Does Telegram CLI search support regex and sender filtering?

Yes, Telegram CLI search supports filtering by keyword, specific chat, sender, time in hours, and regex patterns to refine automated queries and local message indexing.

Can I listen to Telegram chats in real time and refresh the local index?

Yes, you can listen to Telegram chats in real time and refresh the local index. This allows you to continuously drive AI workflows with updated structured message outputs.