Personal account
Login, reading, search, files, sending, archive and your account settings.
This reference covers personal-account commands. Use it to find the exact command, arguments and options for login, reading, searching, files and sending.
Login, reading, search, files, sending, archive and your account settings.
Options for every command
| Option | What it does |
|---|---|
-V, --version | output the version number. |
-v, --verbose | more detail in what is shown: -v ids, -vv everything we know. Default: 0. |
--json | machine-readable output: one JSON value on stdout, nothing else. |
--jsonl | machine-readable output: one JSON object per line, for streaming and jq. |
--quiet | diagnostics off; a failure is still said. |
--trace | the connection's own log lines on stderr — never message content. |
--timeout <duration> | give up on the whole command after this — 30s, 2m, 500ms. |
--offline | answer from what was recorded and never connect; fails if nothing was. |
--no-input | never prompt or open interactive login; piped input remains available. |
--max-input-bytes <bytes> | maximum buffered input bytes (default: 16777216). |
--max-output-bytes <bytes> | maximum machine output bytes (default: 4194304; 0 disables). |
--fields <paths> | comma-separated item or object fields: id,text; preserve pagination and operation ids. |
--dry-run | preview parsed arguments and permissions before running the action. |
--yes | go ahead without the question an ask level puts before a write. |
--record | keep this run — ids and timings, never message content. |
--no-record | do not keep it, whatever the configuration says. |
Commands
tg session
log this profile in to Telegram, or out
tg session start
log in by QR code (default) or by phone number, code and 2FA password
tg session start [method] [options]| Argument | Requirement | What it is |
|---|---|---|
method | optional | how to log in. One of: qr, phone. Default: qr. |
| Option | What it does |
|---|---|
--app <how> | the first time only: how to get this profile's app from my.telegram.org. One of: browser, auto. Default: browser. |
--qr-file <png> | write the QR code to this PNG instead of drawing it, for an agent to pass on. |
--sms | phone login: ask Telegram to send the code by SMS, not to the app; Telegram may still refuse. |
tg session end
log this profile out on Telegram's side and forget the session here
Changes something in Telegram.
tg session endtg setup
set up Telegram and connect your agent
Changes something in Telegram.
tg setup [options]| Option | What it does |
|---|---|
--agent <agent> | install the skill for this agent; asks at a terminal, otherwise none. One of: none, codex, cursor, claude, gemini, all. |
--app <how> | how to get your Telegram app credentials the first time. One of: auto, browser. Default: auto. |
--method <method> | how to log in when there is no session. One of: qr, phone. Default: qr. |
--qr-file <png> | write a temporary login QR image for an agent; needs stored app credentials without a terminal. |
tg account
the logged-in account
tg account list
every profile on this computer, and the account each is logged in as; asks the messenger nothing
tg account listtg account show
who this profile is logged in as; the phone number shows its last four digits
tg account show [options]| Option | What it does |
|---|---|
--show-phone | print the whole phone number. |
tg account update
change the name, the description or the photo everyone sees on your profile
Changes something in Telegram.
tg account update [options]| Option | What it does |
|---|---|
--first-name <name> | your first name. |
--last-name <name> | your last name. |
--description <text> | about you. |
--photo <file> | a new profile photo — an image file. |
tg account sessions
where else this account is logged in — not tg session, which is this tool's own login
tg account sessions list
every device and app logged in to this account; nothing is ended
tg account sessions listtg account sessions end
log out every other device, your phone included; this one stays
Changes something in Telegram.
tg account sessions end [options]| Option | What it does |
|---|---|
--others | every session but this one. |
tg chats
the account's chats
tg chats list
chats, newest first, archived ones included
tg chats list [options]| Option | What it does |
|---|---|
--limit <n> | how many to show. |
--page <n> | which page, starting at 1. |
--all | every row, no paging. |
--search <text> | only chats whose name contains this; at least 3 characters. |
--kind <kind> | only chats of this kind: dialog, group, channel, saved. |
--unread | only chats with unread messages. |
tg chats events
who joined, left, was added or removed, and by whom — from the chat's service messages
tg chats events <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--since-time <time> | ISO 8601, or 2h / 1d ago; 7 days ago if not given. |
--type <names> | only these, comma-separated: join, leave, add, remove, create, title, pin. |
tg chats inspect
what an invite or public link leads to, without joining it
tg chats inspect <link>| Argument | Requirement | What it is |
|---|---|---|
link | required | an invite link or a public one. |
tg chats show
one chat: its kind, unread count, last message time and who is in it
tg chats show <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg chats send-as
who this account may post as in a chat; changes no saved choice
tg chats send-as <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg chats mark-read
mark a chat read; the other side sees that you read it
Changes something in Telegram.
tg chats mark-read <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--until <message> | only up to this message id; the newest by default. |
--topic <id> | mark only this forum topic read; unsupported by messengers without topics. |
tg chats tracking
the chats whose member lists serve fetches daily into the local store — chats members fetch --track adds one
tg chats tracking list
every tracked chat: since when, and its last member count
tg chats tracking listtg chats tracking show
one chat: whether it is tracked, and its member count per day for the last 30 days
tg chats tracking show <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg chats tracking add
fetch this chat's member list daily while serve runs, from its next run
tg chats tracking add <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg chats tracking remove
stop fetching it daily; the history already kept stays
tg chats tracking remove <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg chats join
join a group or channel by its link; the others in it see that you joined
Changes something in Telegram.
tg chats join <link>| Argument | Requirement | What it is |
|---|---|---|
link | required | an invite link, or a public one. |
tg chats leave
leave a group or channel; the others in it see that you left
Changes something in Telegram.
tg chats leave <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg chats folders
your chat folders
tg chats folders list
your chat folders, in the order the app shows them
tg chats folders listtg chats folders show
one chat folder, with the names of the chats in it
tg chats folders show <folder>| Argument | Requirement | What it is |
|---|---|---|
folder | required | the folder's id, or its title exactly. |
tg chats folders create
create a chat folder
Changes something in Telegram.
tg chats folders create <title> [options]| Argument | Requirement | What it is |
|---|---|---|
title | required | the folder's name; the app may refuse a long one. |
| Option | What it does |
|---|---|
--chat <chat> | a chat to put in it, by id or name; repeat it for more. |
--include <kinds> | every chat of these kinds: contacts, non-contacts, groups, channels, bots. |
--skip <which> | leave out chats that are muted, read, archived. |
--exclude-chat <chat> | never show this chat in it; repeat it for more. |
--pin <chat> | pin this chat at the top of the folder; repeat it for more. |
--emoji <emoji> | the folder's icon. |
tg chats folders update
rename a folder, or change which chats are in it
Changes something in Telegram.
tg chats folders update <folder> [options]| Argument | Requirement | What it is |
|---|---|---|
folder | required | folder id, or its title exactly. |
| Option | What it does |
|---|---|
--title <title> | a new name. |
--add <chat> | put a chat in it; repeat it for more. |
--remove <chat> | take a chat out of it, and off its excluded and pinned lists; repeat it for more. |
--include <kinds> | every chat of these kinds: contacts, non-contacts, groups, channels, bots; replaces what it had, none clears it. |
--skip <which> | leave out chats that are muted, read, archived; replaces what it had, none clears it. |
--exclude-chat <chat> | never show this chat in it; repeat it for more. |
--pin <chat> | pin this chat at the top of the folder; repeat it for more. |
--emoji <emoji> | the folder's icon. |
tg chats folders delete
delete a folder; the chats in it stay
Changes something in Telegram.
tg chats folders delete <folder>| Argument | Requirement | What it is |
|---|---|---|
folder | required | folder id, or its title exactly. |
tg chats folders order
put folders in this order; the ones not named keep theirs after them
Changes something in Telegram.
tg chats folders order <folders>| Argument | Requirement | What it is |
|---|---|---|
folders | required | folder ids, or titles exactly, first one first. |
tg chats folders join
add a folder someone shared by a link; joins every chat in it, and the others there see you joined
Changes something in Telegram.
tg chats folders join <link>| Argument | Requirement | What it is |
|---|---|---|
link | required | the folder's link, as t.me/addlist/…. |
tg chats rules
what chats moderate judges a group by, kept in a file of this profile
tg chats rules show
the group's rules; the defaults, marked not saved, if it has none yet
tg chats rules show <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg chats rules set
change one rule; the group's first change writes every rule with its default
Changes something on this computer only.
tg chats rules set <chat> <key> <value>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
key | required | one of: trusted, blocked, blockedNames, links, invites, forwards, blockedPeople, flood.messages, flood.minutes, flood.action, newAccount.days, newAccount.action, consent.delete, consent.remove. |
value | required | the new value; a list is comma-separated. |
tg chats rules unset
put one rule back to its default
Changes something on this computer only.
tg chats rules unset <chat> <key>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
key | required | one of: trusted, blocked, blockedNames, links, invites, forwards, blockedPeople, flood.messages, flood.minutes, flood.action, newAccount.days, newAccount.action, consent.delete, consent.remove. |
tg contacts
people this account has a one-to-one chat with
tg contacts list
people you have a one-to-one chat with
tg contacts list [options]| Option | What it does |
|---|---|
--limit <n> | how many to show. |
--page <n> | which page, starting at 1. |
--all | every row, no paging. |
--order <recent|name> | newest conversation first, or alphabetical. Default: recent. |
--search <text> | only people whose name, local alias or @username contains this. |
--search-notes <text> | only people whose private notes contain this text. |
tg contacts show
one person and the chats you share with them
tg contacts show <person> [options]| Argument | Requirement | What it is |
|---|---|---|
person | required | their id, @username, or part of their name. |
| Option | What it does |
|---|---|
--with-notes | include your private notes, subject to contacts.notes.list permission. |
tg contacts profile
everything the messenger says about one person — handles, flags, last seen, when they registered — and how many of their messages the store holds in each chat you share, the first and the last, and the earlier names and usernames the store saw them with
tg contacts profile <person> [options]| Argument | Requirement | What it is |
|---|---|---|
person | required | their id, @username, or part of their name. |
| Option | What it does |
|---|---|
--show-phone | print the whole phone number. |
tg contacts context
what the local store holds about a person; --chat --refresh explicitly asks Telegram first
tg contacts context <person> [options]| Argument | Requirement | What it is |
|---|---|---|
person | required | their id, @username, or part of their name. |
| Option | What it does |
|---|---|
--limit <n> | at most this many messages in each list; 10 if not given. |
--since-time <time> | nothing older than this ISO 8601 time, or 2h / 1d ago. |
--chat <chat> | a chat, by id or name; repeat it for more — then their newest messages in each, 20 unless --limit, short unless -v. |
--refresh | with --chat, read their newest messages in each from the messenger first. |
tg contacts check
whether one person looks like a bot, a fake or a spammer: their profile, what they wrote in the store, and the public ban lists (Combot Anti-Spam (CAS), lols.bot), which are sent their id — a hint, never a verdict
tg contacts check <person> [options]| Argument | Requirement | What it is |
|---|---|---|
person | required | their id, @username, or part of their name. |
| Option | What it does |
|---|---|
--no-registries | skip public ban lists; still ask Telegram for the profile and photos unless --offline. |
tg contacts link
record that two people in the store are one person — the same name is never enough
tg contacts link <person> <other>| Argument | Requirement | What it is |
|---|---|---|
person | required | their id, @username, or part of their name. |
other | required | the same in another messenger of the store, as : — max:Ana. |
tg contacts unlink
undo contacts link for one identity: it is a person of its own again
tg contacts unlink <person>| Argument | Requirement | What it is |
|---|---|---|
person | required | their id, @username, or part of their name; : for another messenger. |
tg contacts lookup
who has this phone number — asks for it, or reads it from stdin; never an argument
tg contacts lookuptg contacts sync
take the whole contact list from the messenger into the local store
tg contacts synctg contacts alias
a private local display name in the selected account
tg contacts alias set
Changes something on this computer only.
tg contacts alias set <person> <alias>| Argument | Requirement | What it is |
|---|---|---|
person | required | |
alias | required |
tg contacts alias rm
Changes something on this computer only.
tg contacts alias rm <person>| Argument | Requirement | What it is |
|---|---|---|
person | required |
tg contacts notes
your private notes on a stored contact, the same in every account that sees them
tg contacts notes list
tg contacts notes list <person>| Argument | Requirement | What it is |
|---|---|---|
person | required |
tg contacts notes show
tg contacts notes show <person> <id>| Argument | Requirement | What it is |
|---|---|---|
person | required | |
id | required |
tg contacts notes add
Changes something on this computer only.
tg contacts notes add <person> [options]| Argument | Requirement | What it is |
|---|---|---|
person | required |
| Option | What it does |
|---|---|
--file <path> | read note text from a file; omitted or - reads stdin. |
tg contacts notes edit
Changes something on this computer only.
tg contacts notes edit <person> <id> [options]| Argument | Requirement | What it is |
|---|---|---|
person | required | |
id | required |
| Option | What it does |
|---|---|
--file <path> | read note text from a file; omitted or - reads stdin. |
--revision <number> | the revision you read before editing. |
tg contacts notes remove
Changes something on this computer only.
tg contacts notes remove <person> <id>| Argument | Requirement | What it is |
|---|---|---|
person | required | |
id | required |
tg contacts add
add a person to your contacts — contacts list still shows only people you have a dialog with
Changes something in Telegram.
tg contacts add <person>| Argument | Requirement | What it is |
|---|---|---|
person | required | person id — contacts lookup finds one — or part of a known name. |
tg contacts remove
remove a person from your contacts; the chat stays, a name you gave them may not
Changes something in Telegram.
tg contacts remove <person>| Argument | Requirement | What it is |
|---|---|---|
person | required | person id — contacts lookup finds one — or part of a known name. |
tg contacts block
stop a person from writing to you — they need not be a contact
Changes something in Telegram.
tg contacts block <person>| Argument | Requirement | What it is |
|---|---|---|
person | required | person id — contacts lookup finds one — or part of a known name. |
tg contacts unblock
let a blocked person write to you again
Changes something in Telegram.
tg contacts unblock <person>| Argument | Requirement | What it is |
|---|---|---|
person | required | person id — contacts lookup finds one — or part of a known name. |
tg contacts rename
rename the contact in the messenger address book; use contacts alias for a private local name
Changes something in Telegram.
tg contacts rename <person> <first-name> [last-name]| Argument | Requirement | What it is |
|---|---|---|
person | required | person id — contacts lookup finds one — or part of a known name. |
first-name | required | the name you want to see for them. |
last-name | optional |
tg contacts import
upload phone numbers and add the people the messenger has under them
Changes something in Telegram.
tg contacts import <file>| Argument | Requirement | What it is |
|---|---|---|
file | required | one person per line: number, then a comma, a tab or a semicolon, then the name. |
tg messages
read and send messages
tg messages evidence
a bounded evidence packet from stored messages, newest first
tg messages evidence <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--limit <n> | how many, 1–100. |
--before-id <id> | only messages older than this message id. |
tg messages list
a chat's messages, oldest to newest
tg messages list <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--limit <n> | how many. |
--before-id <id> | only messages older than this message id. |
--before-time <time> | only messages older than this ISO 8601 time, or 2h / 1d ago. |
--after-id <id> | only messages newer than this message id. |
--after-time <time> | only messages newer than this ISO 8601 time, or 2h / 1d ago. |
--topic <id> | only this forum topic; read back from its newest message or --before-id. |
--transcribe | turn voice messages not heard yet into text — by the messenger, or a model on this machine; can take minutes. |
--model <id> | which downloaded speech model hears them, with --transcribe; models audio list shows them. |
--mark-read | also mark the chat read up to the newest message shown; the other person sees it. |
tg messages send
send a text message; without [text], the text is read from stdin
Changes something in Telegram.
tg messages send <chat> [text] [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
text | optional | the message. |
| Option | What it does |
|---|---|
--topic <id> | send to this forum topic; unsupported by messengers without topics. |
--reply-to <message> | answer this message, by its id in the same chat. |
--comment-to <post> | comment on this post of the channel; it goes to the post's discussion group. |
--send-as <id> | post as one of the identities chats send-as lists; required where the chat posts as someone else by default. |
--send-id <id> | repeat a send whose outcome was unknown, without risking a second copy. |
--silent | deliver without a notification. |
--no-preview | no preview card for a link in the text. |
--md | read this messenger's Markdown; see its formatting guide for supported syntax. |
--file <file> | attach a file; the text becomes its caption. |
--photo <file> | attach a .jpg, .png or .webp as a photo; the text becomes its caption. |
--as-file | send the --file as a file to download, a video included. |
--voice <file> | send an Ogg Opus file as a voice message, alone, with no text. |
--allow-any-file | send a file even from a hidden folder, ~/.ssh or this CLI's own folders. |
--at-time <time> | let the messenger send it later, even with this machine off: 2026-09-25T09:00 (local time), or 30m, 2h, 1d from now. |
--spoiler | hide the --photo or video behind a spoiler until tapped. |
--caption-above | show the text above the --photo or --file, not below it. |
--filename <name> | the name others see for the --file, instead of its name on disk. |
--html | the text is HTML: , , , . |
tg messages show
one message, by its chat and id or by its msg: locator
tg messages show <chat> [message]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages; or a msg: locator, with no message id after it. |
message | optional | the message id. |
tg messages context
a message and what came either side of it, oldest first
tg messages context <chat> [message] [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages; or a msg: locator, with no message id after it. |
message | optional | the message id. |
| Option | What it does |
|---|---|
--thread | the stored reply chain and replies instead of time neighbours; falls back when no graph exists. |
--thread-hops <n> | at most this many links from the hit (default: 8). |
--thread-messages <n> | at most this many messages in each thread context (default: 50). |
--thread-bytes <n> | at most this many bytes of whole messages and links in each context (default: 65536). |
--thread-within <duration> | messages within this long either side of the hit (default: 1d). |
--before-n <n> | how many before it. Default: 5. |
--after-n <n> | how many after it. Default: 5. |
tg messages download
save a message's photos, files, videos and voice notes to a folder — or a whole chat's with --all
tg messages download <chat> [message] [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | optional | the message id; left out with --all. |
| Option | What it does |
|---|---|
--output-dir <dir> | where to save them; created if missing. Default: .. |
--all | every file of the chat, newest first; run it again to continue where it stopped. |
--pause <duration> | with --all, a pause between pages, to stay under the provider's limits. Default: 1s. |
--extract | read text layers from the files this download maps into the local content index. |
tg messages transcribe
a voice message as text — by Telegram where it can, else by a model on this machine
tg messages transcribe <chat> <message> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the id of a voice message. |
| Option | What it does |
|---|---|
--local | use the model on this machine, never the messenger. |
--model <id> | which downloaded model; implies --local (models audio list). |
tg messages edit
change the text of your own message; the other side may have read it already
Changes something in Telegram.
tg messages edit <chat> <message> [text] [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the id of your own message. |
text | optional | the new text; without it, read from stdin. |
| Option | What it does |
|---|---|
--md | read this messenger's Markdown; see its formatting guide for supported syntax. |
--html | the text is HTML: , , , . |
tg messages delete
delete messages for you only; with --for-everyone, for everyone in the chat
Changes something in Telegram.
tg messages delete <chat> <messages> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
messages | required | the message ids, at most 10. |
| Option | What it does |
|---|---|
--for-everyone | delete for everyone in the chat, not only for you — they cannot get it back. |
--allow-dangerous | go ahead without the question an ask level puts before a deletion. |
tg messages forward
forward one message to another chat
Changes something in Telegram.
tg messages forward <chat> <message> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | the chat the message is in: a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the message id. |
| Option | What it does |
|---|---|
--to <chat> | where it goes: a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--silent | deliver it without a notification. |
--send-as <id> | post as one of the identities chats send-as lists for the --to chat; required where the chat posts as someone else by default. |
--send-id <id> | repeat a forward whose outcome was unknown, without risking a second copy. |
--topic <id> | forward into this forum topic of the --to chat. |
tg messages pin
pin a message in a chat, quietly unless --notify
Changes something in Telegram.
tg messages pin <chat> <message> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the message id. |
| Option | What it does |
|---|---|
--notify | tell the chat's members about the pin. |
tg messages unpin
unpin a message in a chat
Changes something in Telegram.
tg messages unpin <chat> <message>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the message id. |
tg messages scheduled
messages waiting to be sent later in a chat, soonest first; cancel one in the app
tg messages scheduled <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg messages link
a message permalink when supported, and its account-scoped locator
tg messages link <chat> [message]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages; or a msg: locator, with no message id after it. |
message | optional | the message id. |
tg messages comments
the comments under a channel post, oldest to newest; they live in its discussion group
tg messages comments <chat> <post> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | the channel: a chat: its title or part of it, its id, @username, or me for Saved Messages. |
post | required | the post's message id in the channel. |
| Option | What it does |
|---|---|
--limit <n> | how many. |
--before-id <id> | only comments older than this comment id. |
tg messages links
why a message is in its conversation: each link it has, and the chain of answers back to the start
tg messages links <chat> <message>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the message id. |
tg reactions
react to messages
tg reactions add
put your reaction on a message; it replaces the one you had
Changes something in Telegram.
tg reactions add <chat> <message> <emoji>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the message id. |
emoji | required | one emoji, for example 👍. |
tg reactions remove
take your reaction off a message
Changes something in Telegram.
tg reactions remove <chat> <message>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the message id. |
tg polls
read a poll, vote in it, close your own, create one
tg polls show
a poll and its answer ids, as the message carries it now
tg polls show <chat> <message>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the id of the message that carries the poll. |
tg polls voters
who voted for what, newest first; not in an anonymous poll
tg polls voters <chat> <message> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the id of the message that carries the poll. |
| Option | What it does |
|---|---|
--answer <id> | only those who chose this answer, as polls show prints it. |
--limit <n> | how many. |
tg polls vote
vote in a poll, or take your vote back; the others see it unless the poll is anonymous
Changes something in Telegram.
tg polls vote <chat> <message> [answers] [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the id of the message that carries the poll. |
answers | optional | answer ids, as polls show prints them. |
| Option | What it does |
|---|---|
--retract | take your vote back. |
tg polls close
close your own poll; nobody can vote after that, and it cannot be reopened
Changes something in Telegram.
tg polls close <chat> <message>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | the id of your own message that carries the poll. |
tg polls create
send a poll to a chat, as a message of its own; public unless --anonymous
Changes something in Telegram.
tg polls create <chat> <question> <answers> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
question | required | the question. |
answers | required | two answers or more. |
| Option | What it does |
|---|---|
--topic <id> | send to this forum topic; unsupported by messengers without topics. |
--multiple | people may pick several answers. |
--anonymous | nobody sees who voted for what. |
--revote | people may change their vote. |
--silent | send without a notification. |
--send-as <id> | post as one of the identities chats send-as lists; required where the chat posts as someone else by default. |
--send-id <id> | repeat a create whose outcome was unknown, without risking a second poll. |
--quiz | a quiz: one answer is right, and a vote is final. |
--correct <n> | with --quiz: the right answer's position, from 1. |
--solution <text> | with --quiz: what people see once they answered. |
--close-time <delay> | it closes by itself this long after sending: 5s to 10m, like 90s or 5m. |
tg models
models that run on this machine
tg models audio
speech models for transcribing voice messages
tg models audio list
the speech models, most suitable first, which are downloaded, and which one is the default
tg models audio listtg models audio download
download a speech model once, checked against the sha256 this version expects
tg models audio download <model>| Argument | Requirement | What it is |
|---|---|---|
model | required | a model id from models audio list. |
tg models text
embedding models for searching conversations by meaning
tg models text list
the embedding models, most suitable first, which are downloaded, and which one is the default
tg models text listtg models text download
download an embedding model once, checked against the sha256 this version expects
tg models text download <model> [options]| Argument | Requirement | What it is |
|---|---|---|
model | required | a model id from models text list. |
| Option | What it does |
|---|---|
--accept-terms | accept the model's licence terms, for a model that has its own. |
tg models text key
API keys for embedding and analysis providers
tg models text key set
store a key, typed at a hidden prompt or piped on stdin — never as an argument
tg models text key set <provider>| Argument | Requirement | What it is |
|---|---|---|
provider | required | openai, anthropic, or the host of a --base-url server that wants a key. |
tg models text key remove
forget a stored key
tg models text key remove <provider>| Argument | Requirement | What it is |
|---|---|---|
provider | required | openai, anthropic, or a server's host. |
tg inbox
other people's unread messages in every chat; --new for what arrived since the last check
tg inbox [options]| Option | What it does |
|---|---|
--new | what arrived since the last check, each message once — for scheduled runs. |
--since-time <time> | what arrived after this ISO 8601 time, or 2h / 1d ago; the saved point stays put. |
--limit <n> | at most this many per chat, the newest. |
--all | muted and archived chats too — left out unless they mention you or reply to you. |
--kind <kinds> | only chats of these kinds, comma-separated: dialog, group, channel, saved. |
--transcribe | turn voice messages not heard yet into text — by the messenger, or a model on this machine; can take minutes. |
--model <id> | which downloaded speech model hears them, with --transcribe; models audio list shows them. |
--mark-read | also mark each chat shown read, up to the newest message shown; the other side sees it. |
--no-mark-read | do not, whatever the catchUpMarksRead setting says. |
tg review
every message, yours too, in chats that changed since a point — for reviewing who owes what
tg review [options]| Option | What it does |
|---|---|
--since-time <time> | where the last review ended — ISO 8601, or 2h / 1d ago; 3 days ago if not given. |
--chat <chat> | only this chat: a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--kind <kinds> | only chats of these kinds, comma-separated: dialog, group, channel, saved. |
--unanswered [duration] | only questions to you or a group's admins that nobody answered, asked at least this long ago — 4h, 1d; 24h if not given. |
--all | muted and archived chats too — left out unless they mention you or reply to you. |
--transcribe | turn voice messages not heard yet into text — by the messenger, or a model on this machine; can take minutes. |
--model <id> | which downloaded speech model hears them, with --transcribe; models audio list shows them. |
--new | what changed since the last review --new, a point per chat — for scheduled runs. |
--mark-read | also mark each chat shown read, up to the newest message shown; the other side sees it. |
--no-mark-read | do not, whatever the catchUpMarksRead setting says. |
tg topics
the topics of a forum group
tg topics list
a forum group's topics, newest activity first
tg topics list <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--limit <n> | how many to show. |
--page <n> | which page, starting at 1. |
--all | every row, no paging. |
tg topics show
one forum topic: its title, state and last activity
tg topics show <chat> <topic>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
topic | required | the topic id, from topics list. |
tg topics enable
enable forum topics; only the owner, with an explicit upgrade for a basic group
Changes something in Telegram.
tg topics enable <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--upgrade | upgrade a basic group to a supergroup first; its chat id changes. |
tg topics create
create a named topic in an existing forum; never enable or upgrade a group implicitly
Changes something in Telegram.
tg topics create <chat> <title> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
title | required | the topic title, at most 128 UTF-8 bytes. |
| Option | What it does |
|---|---|
--send-id <id> | identify this creation attempt; an already sent or unknown id is refused. |
tg topics edit
rename, close or reopen a forum topic
Changes something in Telegram.
tg topics edit <chat> <topic> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
topic | required | the topic id, from topics list. |
| Option | What it does |
|---|---|
--title <title> | the new title, at most 128 UTF-8 bytes. |
--closed <on|off> | on closes the topic to new messages, off reopens it. |
--pinned <on|off> | on pins the topic at the top of the list, off unpins it. |
--hidden <on|off> | on hides the General topic from the topic list, off shows it. |
tg topics delete
delete a forum topic and every message in it, for everyone; it cannot be undone
Changes something in Telegram.
tg topics delete <chat> <topic> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
topic | required | the topic id, from topics list. |
| Option | What it does |
|---|---|
--allow-dangerous | go ahead without the question an ask level puts before a deletion. |
tg topics order
put the pinned topics in this order; it pins and unpins nothing
Changes something in Telegram.
tg topics order <chat> <topic>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
topic | required | the pinned topics' ids, first to last. |
tg watch
print new messages as they arrive, until Ctrl-C or --timeout (either ends it normally)
tg watch [options]| Option | What it does |
|---|---|
--events | also edits, deletions and reactions; every line then names its event. |
tg serve
keep the local store current until stopped — what a systemd or launchd unit runs
tg servetg server
tg serve in the background: start, stop, restart, status, logs; install adds a systemd or launchd unit
tg server start
start serve in the background — through the unit if one is installed — and answer once it connects
tg server starttg server stop
stop this profile's serve — through the unit if it runs under one
tg server stoptg server restart
stop it and start it again
tg server restarttg server status
whether serve runs for this profile, since when, who started it, and the unit if there is one
tg server statustg server logs
serve's latest log lines — from the journal under systemd, else its log file
tg server logs [options]| Option | What it does |
|---|---|
-n, --lines <n> | how many lines. Default: 50. |
tg server install
write a systemd user unit or a launchd agent for this profile; starts nothing
tg server installtg server uninstall
remove this profile's unit; stop it first
tg server uninstalltg store
the local store of messages
tg store status
per chat: messages stored, the oldest and newest, and the stretches held completely
tg store status [chat]| Argument | Requirement | What it is |
|---|---|---|
chat | optional | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg store fetch
fetch a chat's history into the local store, newest first; run it again to continue; --all fetches every chat
tg store fetch [chat] [options]| Argument | Requirement | What it is |
|---|---|---|
chat | optional | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--all | every chat, most recently active first — what search needs; the last 90d unless --since-time or --last. |
--limit <n> | at most this many messages in this run, per chat with --all; 1000 if not given. |
--page-size <n> | how many messages one request asks for; 100 if not given. |
--pause <duration> | pause between pages, to stay under the provider's limits. Default: 1s. |
--since-time <time> | stop once it reaches messages older than this: ISO 8601, or 2h / 1d ago. |
--last <n> | stop once the newest n messages are held. |
--catch-up | prepare local search after fetch; overrides searchCatchUp. |
--no-catch-up | skip local preparation after this fetch. |
--catch-up-chunks <n> | at most this many local vector chunks. |
--catch-up-messages <n> | skip a graph rebuild larger than this many messages. |
--catch-up-time <duration> | local preparation time budget, 30s by default. |
--background | run as a job that outlives this command; store jobs show follows it. |
--estimate | only estimate how many messages, requests and minutes a full fetch would still take — from the store, no request. |
tg store gaps
inspect recorded interior coverage gaps and explicitly fetch them
tg store gaps plan
local coverage plan; missing message ids alone do not imply missing history
tg store gaps plan <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg store gaps repair
fetch bounded interior gaps and recheck coverage; never delete unseen messages
tg store gaps repair <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--limit <n> | total messages in this repair, 500 by default. |
--max-gaps <n> | at most this many gaps, 5 by default. |
--repair-time <duration> | time budget for the repair, 30s by default. Default: 30s. |
--page-size <n> | messages per provider page. |
--pause <duration> | provider pause between pages. Default: 1s. |
--fingerprint <hash> | refuse if this previously inspected coverage plan changed. |
--catch-up | prepare local search after repair; overrides searchCatchUp. |
--no-catch-up | skip local search preparation after repair. |
--catch-up-chunks <n> | maximum local chunks prepared. |
--catch-up-messages <n> | maximum stored messages read for preparation. |
--catch-up-time <duration> | preparation time within the repair's remaining budget. |
--background | repair as an existing store job; inspect store jobs show. |
tg store jobs
background fetch jobs
tg store jobs list
background fetch jobs, newest first
tg store jobs list [options]| Option | What it does |
|---|---|
--state <state> | only jobs in this state. One of: running, done, failed, cancelled, died. |
tg store jobs show
one background job — the newest when none is named — and what the store now holds of its chat
tg store jobs show [job]| Argument | Requirement | What it is |
|---|---|---|
job | optional | the job id store fetch --background printed. |
tg store jobs cancel
stop a running background job after its current page; a later fetch resumes where it stopped
tg store jobs cancel <job>| Argument | Requirement | What it is |
|---|---|---|
job | required | the job id. |
tg store jobs retry
start a failed or died job again, as a new job; the fetch resumes where the store stopped
tg store jobs retry [job] [options]| Argument | Requirement | What it is |
|---|---|---|
job | optional | the job id. |
| Option | What it does |
|---|---|
--failed | every chat whose newest job failed or died. |
tg store jobs clear
forget finished jobs and remove their logs; a running job is kept
Changes something on this computer only.
tg store jobs cleartg store export
a chat's stored messages as JSON lines, oldest first; never asks the messenger
tg store export [chats] [options]| Argument | Requirement | What it is |
|---|---|---|
chats | optional | a chat: its title or part of it, its id, @username, or me for Saved Messages; several with --to. |
| Option | What it does |
|---|---|
--format <format> | jsonl (the default): one message per line; markdown: a transcript with a heading per day, replies and forwards quoted. |
--since-time <time> | only from this ISO 8601 time, or 30m / 2h / 1d ago, on. |
--output <file> | write JSON lines, or the transcript, to this new file, readable only by you. |
--to <dir> | write into this folder, a file per chat and a manifest; run again on it for only what changed since. |
--kind <kinds> | with --to: every stored chat of these kinds, comma-separated: dialog, group, channel, saved. |
--all | with --to: every stored chat of this account. |
--encrypt | compress and encrypt with a password, typed at a hidden prompt or piped on stdin; it is never kept — lose it and the file cannot be opened. |
tg store clear
delete from the store the chats this account has left, with their messages
tg store clear [options]| Option | What it does |
|---|---|
--left | the chats this account has left — the only thing this clears. |
--allow-dangerous | yes, delete — it cannot be undone, and a chat you left cannot be fetched again. |
tg store info
the store file: where it is, its size, its schema and how many rows it holds; changes nothing
tg store infotg store check
whether the store is healthy — integrity, search indexes, disk, and which chats are behind
tg store checktg store migrate
bring the store up to this build's schema, then normalize, index and stem the messages and notes stored before it
tg store migratetg store reindex
rebuild the word index, its typo vocabulary, the stems, the files' word index and the notes' indexes from what is stored; loses nothing
tg store reindextg store backup
copy the store into a new file, while it is in use; never overwrites a file
tg store backup <file> [options]| Argument | Requirement | What it is |
|---|---|---|
file | required | the new file. |
| Option | What it does |
|---|---|
--encrypt | compress and encrypt with a password, typed at a hidden prompt or piped on stdin; it is never kept — lose it and the file cannot be opened. |
tg store restore
put a backup in place of the store; the store it replaces is kept beside it, never deleted
tg store restore <file>| Argument | Requirement | What it is |
|---|---|---|
file | required | a file store backup wrote; one written with --encrypt asks for its password. |
tg store decrypt
open a file written with --encrypt into a new file; asks for its password
tg store decrypt <file> [options]| Argument | Requirement | What it is |
|---|---|---|
file | required | a file store backup --encrypt or store export --encrypt wrote. |
| Option | What it does |
|---|---|
--output <file> | the new file, readable only by you. |
tg store repair
bring every table to this build's shape, deleting nothing: a table of the wrong shape is kept as a copy beside a new one
tg store repair [options]| Option | What it does |
|---|---|
--dry-run | say what it would do, and change nothing. |
tg store copies
the tables store repair kept as copies
tg store copies delete
delete one copy store repair kept, named exactly; refuses any other table
tg store copies delete <name>| Argument | Requirement | What it is |
|---|---|---|
name | required | the copy's name, as store repair printed it. |
tg conversations
the conversations inside a chat, found in the stored messages by replies, mentions and who wrote next
tg conversations build
find a chat's conversations in what the store holds, replacing the last build; without --chat, every chat that changed since its build and every group never built; never asks the messenger
tg conversations build [options]| Option | What it does |
|---|---|
--chat <chat> | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--analyze | link batches using the configured analysis provider; requires --chat and remembers consent for this chat/provider. |
--provider <provider> | analysis: agent, openai or anthropic. |
--model <model> | analysis model; overrides analysisModel. |
--base-url <url> | analysis API endpoint; overrides analysisBaseUrl. |
--size <n> | analysis answer messages per batch, 10–200; default 50. |
--max-tokens <n> | analysis input/output reservation cap per run; default 100000. |
--max-chats <n> | at most this many chats in one run; 20 if not given. |
tg conversations list
a chat's conversations, the newest first: when, how many messages, how many people
tg conversations list [options]| Option | What it does |
|---|---|
--chat <chat> | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--since-time <time> | only those that started at this ISO 8601 time, or 30m / 2h / 1d ago, or later. |
--limit <n> | how many. |
tg conversations show
one conversation's messages, oldest first — by its id, or the one a message is in
tg conversations show <conversation> [message]| Argument | Requirement | What it is |
|---|---|---|
conversation | required | a conversation id from conversations list; or a chat: its title or part of it, its id, @username, or me for Saved Messages, with a message. |
message | optional | a message id in that chat: show the conversation it is in. |
tg conversations related
the conversations nearest in meaning to the one a message is in, in every built chat, best first — from the vectors conversations embed stored; runs no model
tg conversations related <chat> <message> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
message | required | a message id in that chat. |
| Option | What it does |
|---|---|
--limit <n> | how many. |
--model <model> | local: a model id from models text list (default: e5-small); remote: the provider's model. |
--provider <provider> | embedding provider: local or openai; flags override profile settings. |
--base-url <url> | a server with OpenAI's /v1/embeddings: Gemini, Jina, or Ollama and LM Studio on this machine. |
--dims <n> | remote: the vector size — needed with --base-url; shortens an OpenAI model's. |
tg conversations status
how fresh each built chat's conversations and vectors are: messages the build has not seen, chunks with a current, stale or missing vector
tg conversations status [options]| Option | What it does |
|---|---|
--chat <chat> | only this chat: a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--model <model> | local: a model id from models text list (default: e5-small); remote: the provider's model. |
--provider <provider> | embedding provider: local or openai; flags override profile settings. |
--base-url <url> | a server with OpenAI's /v1/embeddings: Gemini, Jina, or Ollama and LM Studio on this machine. |
--dims <n> | remote: the vector size — needed with --base-url; shortens an OpenAI model's. |
tg conversations batches
windows of a chat for your own AI agent to link: which earlier message each one answers
tg conversations batches status
how many messages still wait for an answer, in how many batches, and how much text
tg conversations batches status [options]| Option | What it does |
|---|---|
--chat <chat> | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--size <n> | messages to answer per batch, 10–200; 50 by default. |
tg conversations batches next
the next window to answer, with the messages before it; message text goes to stdout only
tg conversations batches next [options]| Option | What it does |
|---|---|
--chat <chat> | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--size <n> | messages to answer per batch, 10–200; 50 by default. |
tg conversations links
your agent's answers: which earlier message each message of a batch answers
tg conversations links add
store your agent's answer to a batch, read as JSON from stdin: { "model", "answers": [{ "message", "parent", "confidence" }] }; all or nothing
tg conversations links add [options]| Option | What it does |
|---|---|
--batch <id> | the batch id conversations batches next printed. |
tg conversations links clear
drop your agent's answers for a chat, or only one model's; messages are never touched
tg conversations links clear [options]| Option | What it does |
|---|---|
--chat <chat> | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--model <model> | only the answers this model gave. |
tg conversations consents
remembered analysis permissions for this account's chats and provider endpoints
tg conversations consents list
tg conversations consents listtg conversations consents revoke
tg conversations consents revoke [options]| Option | What it does |
|---|---|
--chat <chat> | revoke only this chat's consents; defaults to every chat. |
--provider <identity> | exact provider identity from consents list; defaults to every provider. |
tg conversations embed
compute a vector for each chunk of a chat's conversations for search by meaning — on this machine, or with --provider through a service and your key; resumes where it stopped; without --chat, every built chat with chunks left, on this machine only
tg conversations embed [options]| Option | What it does |
|---|---|
--chat <chat> | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--model <model> | local: a model id from models text list (default: e5-small); remote: the provider's model. |
--provider <provider> | embedding provider: local or openai; flags override profile settings. |
--base-url <url> | a server with OpenAI's /v1/embeddings: Gemini, Jina, or Ollama and LM Studio on this machine. |
--dims <n> | remote: the vector size — needed with --base-url; shortens an OpenAI model's. |
--workers <n> | local: sessions in parallel, each with its own copy of the model (~0.7 GB each). |
--threads <n> | local: threads in all (default: min(8, cores)). |
--concurrency <n> | remote: requests at once (default: 4). |
--max-tokens <n> | remote: stop before a run that could send more tokens than this. |
--max-chats <n> | at most this many chats in one run; 20 if not given. |
--max-chunks <n> | at most this many chunks embedded in one run; 2000 if not given, and no limit with --chat. |
tg conversations embed status
how many chunks of a chat have a vector of the model, how many are left, and what is left costs
tg conversations embed status [options]| Option | What it does |
|---|---|
--chat <chat> | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--model <model> | local: a model id from models text list (default: e5-small); remote: the provider's model. |
--provider <provider> | embedding provider: local or openai; flags override profile settings. |
--base-url <url> | a server with OpenAI's /v1/embeddings: Gemini, Jina, or Ollama and LM Studio on this machine. |
--dims <n> | remote: the vector size — needed with --base-url; shortens an OpenAI model's. |
tg conversations embed clear
drop a chat's vectors, or only one model's; messages and conversations are never touched
tg conversations embed clear [options]| Option | What it does |
|---|---|
--chat <chat> | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--model <model> | local: a model id from models text list (default: e5-small); remote: the provider's model. |
--provider <provider> | embedding provider: local or openai; flags override profile settings. |
--base-url <url> | a server with OpenAI's /v1/embeddings: Gemini, Jina, or Ollama and LM Studio on this machine. |
--dims <n> | remote: the vector size — needed with --base-url; shortens an OpenAI model's. |
tg attachments
the files of stored messages: their text in the local store, for content: in a search
tg attachments extract
read the text of downloaded files — text, PDF/DOCX text layers, ODT/ODS/XLSX/PPTX/EPUB — into the local store, for content: in a search
tg attachments extract [options]| Option | What it does |
|---|---|
--chat <chat> | only this chat's files; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--from-dir <dir> | match files in this nonrecursive directory; needs --chat. |
--cursor <cursor> | continue from the cursor returned by a bounded extraction. |
--download | first save the files no download saved yet, from the messenger, into --output-dir. |
--output-dir <dir> | with --download, where to save them; created if missing. |
--limit <n> | read at most this many files; run it again to continue. |
--ocr | explicitly call models.ocr for bulk image and scanned-PDF text extraction. |
--concurrency <n> | remote: requests at once (default: 4). |
tg attachments list
files of stored messages, where each was saved and whether its text is held — never the text
tg attachments list [options]| Option | What it does |
|---|---|
--chat <chat> | only this chat's files; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--needs-text | only files saved here whose text nobody has yet: what an agent reads and writes back. |
--limit <n> | how many to show. |
--page <n> | which page, starting at 1. |
--all | every row, no paging. |
tg attachments show
read a bounded chunk of one retained attachment; JSON includes base64 bytes
tg attachments show <chat> [message] [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages; or a msg: locator alone. |
message | optional | the message id. |
| Option | What it does |
|---|---|
--attachment <n> | file position from 1; required for several files. |
--page <n> | render one PDF page as PNG, from 1; optional unpdf/canvas, no OCR. |
--offset-bytes <n> | byte offset from 0. |
--chunk-bytes <n> | bytes to return, 1–1048576 (default524288). |
--if-sha256 <hash> | require the whole file SHA-256 from the preceding chunk. |
tg attachments text
the text of one file, as an agent read it
tg attachments text set
keep the text an agent read from a file — a scan, a photo — so content: finds it; nothing is sent
tg attachments text set <chat> [message] [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages; or a msg: locator, with no message id after it. |
message | optional | the message id. |
| Option | What it does |
|---|---|
--attachment <n> | which file of the message, from 1; needed when it has more than one. |
--text-file <path> | read the text from this file; - or none reads stdin. |
tg tags
your own labels on chats, people and messages, kept in the local store and never sent; tag: in a search finds them
tg tags auto
derive local group/channel tags from cached metadata using keyword rules
Changes something on this computer only.
tg tags auto [options]| Option | What it does |
|---|---|
--chat <chat> | a stored group/channel; repeat to select several. Default: ``. |
--limit <number> | process at most 1–500 chats. Default: 50. |
--refresh-metadata | read current descriptions from the messenger before classifying. |
--dry-run | preview cached classification without changing the store. |
tg tags add
put tags on one chat, person or message
Changes something on this computer only.
tg tags add <tag> [options]| Argument | Requirement | What it is |
|---|---|---|
tag | required | one or more tags: 1–32 letters a–z, digits and hyphens; upper case is lowered. |
| Option | What it does |
|---|---|
--chat <chat> | the chat to tag, or the chat of --message; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--contact <person> | the person to tag: their id, @username or name, as the local store knows them. |
--message <message> | the message to tag: its id in --chat, or a msg: locator alone. |
tg tags remove
take tags off one chat, person or message
Changes something on this computer only.
tg tags remove <tag> [options]| Argument | Requirement | What it is |
|---|---|---|
tag | required | one or more tags: 1–32 letters a–z, digits and hyphens; upper case is lowered. |
| Option | What it does |
|---|---|
--chat <chat> | the chat to untag, or the chat of --message; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--contact <person> | the person to untag: their id, @username or name, as the local store knows them. |
--message <message> | the message to untag: its id in --chat, or a msg: locator alone. |
--source <manual|auto> | remove only this ownership claim. |
tg tags list
what is tagged: this account's chats and messages, and the people of its messenger
tg tags list [options]| Option | What it does |
|---|---|
--tag <tag> | only this tag. |
--source <manual|auto> | only labels with this ownership claim. |
--type <names> | only what is tagged of this type: chat, contact or message. |
tg metadata
cached group/channel descriptions for local automatic tags
tg metadata get
tg metadata get [options]| Option | What it does |
|---|---|
--chat <chat> | a stored chat. |
tg metadata refresh
Changes something on this computer only.
tg metadata refresh [options]| Option | What it does |
|---|---|
--chat <chat> | stored group/channel; repeat for several. Default: ``. |
--only-missing | only chats with no metadata yet; without --chat, every stored group/channel. |
--limit <number> | process at most 1–500 chats. Default: 50. |
tg stats
statistics about messages, chats and their authors
tg stats messages
message statistics from the local store
tg stats messages show
how many stored messages match, by chat, sender, day or hour — the local store only; optionally fetches new messages with --sync-first
tg stats messages show [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | a strict Lucene query, as for search messages; none counts every stored message; with --saved, more words AND-ed to it. |
| Option | What it does |
|---|---|
--sync-first | first fetch new messages within the chat, time and message bounds. |
--max-chats <n> | refresh at most this many chats (default: 5). |
--sync-time <duration> | stop fetching after this long (default: 30s). |
--max-messages <n> | fetch at most this many messages total (default: 500). |
--by <chat|sender|day|hour> | what to count by (default: chat). |
--chat <chat> | only this chat — the same as chat: in the query; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <messenger> | every account of this messenger held in the store; personal, bots or all — the same as in: in the query. |
--limit <n> | how many rows. |
--timezone <zone> | the IANA timezone for calendar days and hours. |
--exact | bare words and quotes match their exact form only, as exact:word does; text: still matches every form. |
--saved <name|id> | count what a saved search or an earlier run matches; options typed here replace its own. |
tg stats messages counters
per-counter observations and bounded remote refresh
tg stats messages counters show
show saved counter values and their observation freshness
tg stats messages counters show [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | strict Lucene query over stored messages. |
| Option | What it does |
|---|---|
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <messenger> | held accounts of this messenger; refresh uses the active account. |
--exact | bare words match exact forms. |
--timezone <zone> | IANA timezone for query dates. |
--selection <json> | pinned counter-targets selection from counters show; conflicts with query and scope. |
--counters <names> | distinct views,reactions,comments fields; all three by default. |
--limit <n> | messages, 1–100; 20 by default. |
--max-age <duration> | maximum fresh observation age; 24h by default. |
tg stats messages counters refresh
read authoritative counters for bounded messages and update their local observations
Changes something on this computer only.
tg stats messages counters refresh [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | strict Lucene query over stored messages. |
| Option | What it does |
|---|---|
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <messenger> | held accounts of this messenger; refresh uses the active account. |
--exact | bare words match exact forms. |
--timezone <zone> | IANA timezone for query dates. |
--selection <json> | pinned counter-targets selection from counters show; conflicts with query and scope. |
--counters <names> | distinct views,reactions,comments fields; all three by default. |
--limit <n> | messages, 1–100; 20 by default. |
--max-messages <n> | maximum messages to refresh, 1–100. |
--sync-time <duration> | remote refresh budget; 30s by default, maximum 5m. |
--dry-run | preview exact stored targets and counter capabilities without connecting. |
tg stats messages unanswered
oldest detected questions without an observed qualifying explicit reply
tg stats messages unanswered [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | a strict Lucene query; none selects every stored message. |
| Option | What it does |
|---|---|
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <messenger> | every held account of this messenger; personal, bots or all. |
--exact | bare words match exact forms rather than stems. |
--saved <name|id> | run a saved report of this kind; typed report options replace stored options. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
--limit <n> | report rows, 1–100; 20 if not given. |
--answerer <person> | stored name, alias, @username, ID or person:provider/account/id; ambiguous names require a choice; repeat for more. |
--older-than <duration> | minimum age of a question without an observed qualifying answer. |
tg stats messages discussion
viewed posts with little recorded discussion
tg stats messages discussion [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | a strict Lucene query; none selects every stored message. |
| Option | What it does |
|---|---|
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <messenger> | every held account of this messenger; personal, bots or all. |
--exact | bare words match exact forms rather than stems. |
--saved <name|id> | run a saved report of this kind; typed report options replace stored options. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
--limit <n> | report rows, 1–100; 20 if not given. |
--min-views <n> | minimum known cumulative views. |
--max-replies <n> | maximum observed discussion replies. |
tg stats messages top
rank stored messages by a measure or explainable score; counters are snapshots with per-field observation freshness
tg stats messages top [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | a strict Lucene query; none selects every stored message. |
| Option | What it does |
|---|---|
--sync-first | first fetch new messages within the chat, time and message bounds. |
--max-chats <n> | refresh at most this many chats (default: 5). |
--sync-time <duration> | stop fetching after this long (default: 30s). |
--max-messages <n> | fetch at most this many messages total (default: 500). |
--measure <name> | the ranking metric; not with score or weights. One of: views, reactions, forwards, comments, replies, thread-size. |
--score <preset> | helpful/active for authors; engaging for either target. One of: helpful, active, engaging. |
--weights <json> | the complete component weights; replaces preset weights. |
--message-kind <kind> | select proven all, posts or comments before ranking. One of: all, posts, comments. |
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <messenger> | every held account of this messenger; personal, bots or all. |
--timezone <zone> | the IANA timezone for dates and active days. |
--exact | bare words match exact forms rather than stems. |
--limit <n> | ranked rows, 1–100. |
--saved <name|id> | run a saved query or ranking run; typed options replace stored options. |
tg stats messages evidence
bounded messages, answer pairs or retention members from an exact drilldown selection
tg stats messages evidence <message> [options]| Argument | Requirement | What it is |
|---|---|---|
message | required | the canonical message locator, or retention cohort reference, from drilldown. |
| Option | What it does |
|---|---|
--selection <json> | the resolved ranking selection returned in drilldown. |
--component <name> | the exposed ranking component. |
--limit <n> | evidence rows, 1–100; 20 if not given. |
--cursor <cursor> | continue the same component and stored-evidence fingerprint. |
tg stats contacts
statistics about human authors
tg stats contacts responses
counts and median/p90 latency for selected human answering identities
tg stats contacts responses [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | a strict Lucene query; none selects every stored message. |
| Option | What it does |
|---|---|
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <messenger> | every held account of this messenger; personal, bots or all. |
--exact | bare words match exact forms rather than stems. |
--saved <name|id> | run a saved report of this kind; typed report options replace stored options. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
--limit <n> | report rows, 1–100; 20 if not given. |
--answerer <person> | stored name, alias, @username, ID or person:provider/account/id; ambiguous names require a choice; repeat for more. |
tg stats contacts top
rank the human authors of stored messages by a measure or explainable score; counters are snapshots with per-field observation freshness
tg stats contacts top [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | a strict Lucene query; none selects every stored message. |
| Option | What it does |
|---|---|
--sync-first | first fetch new messages within the chat, time and message bounds. |
--max-chats <n> | refresh at most this many chats (default: 5). |
--sync-time <duration> | stop fetching after this long (default: 30s). |
--max-messages <n> | fetch at most this many messages total (default: 500). |
--measure <name> | the ranking metric; not with score or weights. One of: messages, words, reactions, replies, answers, answer-time, threads, active-days. |
--score <preset> | helpful/active for authors; engaging for either target. One of: helpful, active, engaging. |
--weights <json> | the complete component weights; replaces preset weights. |
--message-kind <kind> | select proven all, posts or comments before ranking. One of: all, posts, comments. |
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <messenger> | every held account of this messenger; personal, bots or all. |
--timezone <zone> | the IANA timezone for dates and active days. |
--exact | bare words match exact forms rather than stems. |
--limit <n> | ranked rows, 1–100. |
--saved <name|id> | run a saved query or ranking run; typed options replace stored options. |
--min-messages <n> | minimum selected messages per author; 1, or 5 for engaging. |
tg stats contacts evidence
bounded messages, answer pairs or retention members from an exact drilldown selection
tg stats contacts evidence <person> [options]| Argument | Requirement | What it is |
|---|---|---|
person | required | the exact native person id from the ranking row. |
| Option | What it does |
|---|---|
--selection <json> | the resolved ranking selection returned in drilldown. |
--component <name> | the exposed ranking component. |
--limit <n> | evidence rows, 1–100; 20 if not given. |
--cursor <cursor> | continue the same component and stored-evidence fingerprint. |
tg stats chats
statistics about one chat
tg stats chats show
a group's or channel's numbers for a period: messages, active members, replies, reactions, questions answered, joins and leaves — counted from the local store; joins and leaves are asked of the messenger
tg stats chats show <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--since-time <time> | ISO 8601, or 2h / 1d ago; 7 days ago if not given. |
--by <day|week> | also one row per calendar day or week (weeks start on Monday). |
--timezone <zone> | the IANA timezone for calendar days. |
tg stats chats newcomers
known-join members and their help within a join window
tg stats chats newcomers <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--since-time <time> | from this ISO 8601 time, or 2h / 1d ago; 30d ago if not given. |
--until-time <time> | through this ISO 8601 time, or 2h / 1d ago. |
--within <duration> | the help window after a known newcomer join. |
--saved <name|id> | run a saved report of this kind; typed report options replace stored options. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
--limit <n> | report rows, 1–100; 20 if not given. |
--answerer <person> | stored name, alias, @username, ID or person:provider/account/id; ambiguous names require a choice; repeat for more. |
tg stats chats retention
joining cohorts and observed checkpoint membership from saved roster observations
tg stats chats retention <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--since-time <time> | joining period starts at ISO 8601 or a relative time; last 90 days by default. |
--until-time <time> | joining period ends at this time; now by default. |
--checkpoints <durations> | up to 10 increasing joining ages, comma separated; 1d,7d,30d by default. |
--within <duration> | activity and early departure window after joining; 7d by default. |
--by <day|week> | group joining dates by calendar day or Monday week. One of: day, week. |
--timezone <zone> | IANA timezone for joining cohorts. |
--limit <n> | cohorts and member evidence, 1–100. |
tg stats chats official
what Telegram itself computed for a group or channel you administer: totals against the previous period, top people and every graph as JSON series; the messenger picks the period
tg stats chats official <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg stats tasks
task statistics
tg stats tasks show
per chat: how many tasks are open, the oldest open one, the median time to close
tg stats tasks show [options]| Option | What it does |
|---|---|
--chat <chat> | only this chat; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--type <name> | only this type: question, request, mention or promise. |
tg stats charts
a chart's data from a chat's statistics, and optionally a dark SVG or PNG image
tg stats charts <chat> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
| Option | What it does |
|---|---|
--chart-kind <messages|active|membership> | what to draw: messages, active authors, or joins and leaves. Default: messages. |
--by <day|week> | one point per calendar day or week (weeks start on Monday). Default: day. |
--since-time <time> | ISO 8601, or 2h / 1d ago; 7 days ago if not given. |
--timezone <zone> | the IANA timezone for calendar days. |
--output <file> | write a dark image to a new .svg or .png file. |
tg tasks
what waits on you — unanswered questions, mentions, requests, promises — kept in the local store; review and serve add them
tg tasks list
tasks, oldest first, with their message or note source
tg tasks list [options]| Option | What it does |
|---|---|
--state <state> | only tasks in this state: open, done or dismissed. |
--chat <chat> | only this chat's tasks; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--type <names> | only these types, comma-separated: question, request, mention, promise. |
--before-time <time> | only tasks opened before this ISO 8601 time, or 2h / 1d ago. |
--limit <n> | how many. |
tg tasks add
add a task for a stored message or note — a promise, a request
tg tasks add <message> [options]| Argument | Requirement | What it is |
|---|---|---|
message | required | a message locator, msg:///, or note:. |
| Option | What it does |
|---|---|
--type <name> | the task's type: question, request, mention or promise. |
tg tasks close
close a task: done, or dismissed when it needs no answer; a closed task stays closed
tg tasks close <task> [options]| Argument | Requirement | What it is |
|---|---|---|
task | required | the task's id, as tasks list shows it. |
| Option | What it does |
|---|---|
--as <state> | how it is closed: done, or dismissed — it needs no answer. |
--reason <text> | why, kept with the task — no-reply-needed, for example. |
tg search
find things by text: search all for everything the local store holds, or one resource
tg search all
search everything the local store holds — messenger messages, mail and notes — best match first; start here when you do not know where something was written
tg search all <query> [options]| Argument | Requirement | What it is |
|---|---|---|
query | required | strict Lucene query: words, "phrases", AND/OR/NOT, field groups and date ranges. |
| Option | What it does |
|---|---|
--only <resources> | only these, separated by commas: messages, mail, notes. |
--limit <n> | how many. |
--exact | bare words and quotes match their exact form only, as exact:word does. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
tg search messages
search messenger messages in the local store and on the messenger's server (--backend); optionally fetches new messages with --sync-first
tg search messages [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | strict Lucene query: words, "phrases", AND/OR/NOT, field groups and date ranges; --language legacy keeps discovery; with --saved, more words AND-ed to it. |
| Option | What it does |
|---|---|
--sync-first | first fetch new messages within the chat, time and message bounds. |
--max-chats <n> | refresh at most this many chats (default: 5). |
--sync-time <duration> | stop fetching after this long (default: 30s). |
--max-messages <n> | fetch at most this many messages total (default: 500). |
--thread | the stored reply chain and replies instead of time neighbours; falls back when no graph exists. |
--thread-hops <n> | at most this many links from the hit (default: 8). |
--thread-messages <n> | at most this many messages in each thread context (default: 50). |
--thread-bytes <n> | at most this many bytes of whole messages and links in each context (default: 65536). |
--thread-within <duration> | messages within this long either side of the hit (default: 1d). |
--backend <archive|server|both> | where to search: the local archive, the messenger's server, or both (default: both). |
--server-time <duration> | stop waiting for the server after this long (default: 5s). |
--chat <chat> | only this chat — the same as chat: in the query; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <messenger> | every account of this messenger held in the store; personal, bots or all — the same as in: in the query. |
--type <text|voice|file> | only messages of this type: text alone, a voice message, or a file. |
--limit <n> | how many. |
--newest | newest first instead of best first. |
--exact | bare words and quotes match their exact form only, as exact:word does; text: still matches every form. |
--context <n> | messages before and after each hit; 2 in the terminal, 0 otherwise. |
--language <lucene|legacy> | the query language: strict Lucene or legacy discovery. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
--regex | the words are one regular expression, case-insensitive, tested against every stored text. |
--saved <name|id> | run a saved search or an earlier run; options typed here replace its own. |
tg search mail
search the mail imported into the local store — memo mail import brings it in
tg search mail [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | strict Lucene query: words, "phrases", AND/OR/NOT, field groups and date ranges. |
| Option | What it does |
|---|---|
--chat <chat> | only this mail thread, by id or subject. |
--limit <n> | how many. |
--newest | newest first instead of best first. |
--exact | bare words and quotes match their exact form only, as exact:word does; text: still matches every form. |
--context <n> | messages before and after each hit; 2 in the terminal, 0 otherwise. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
tg search notes
search the notes — written in memo, or imported from a notes folder — by words and, with the local text model, by meaning; each hit says which found it and what it links to
tg search notes <query> [options]| Argument | Requirement | What it is |
|---|---|---|
query | required | strict Lucene query: words, "phrases", AND/OR/NOT, tag: and date ranges. |
| Option | What it does |
|---|---|
--type <internal|file> | only notes written in memo, or only notes from a folder. |
--folder <id> | only this notes folder, by its id; repeat it for more. |
--tag <tag> | only notes with this tag. |
--filter <query> | a query every hit must also match; it does not change the search by meaning. |
--limit <n> | how many. |
--offset <n> | skip this many, for the next page. |
--exact | words as written only; meaning is not searched. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
tg search conversations
the conversations nearest to a query in meaning and in words, best first, in one chat or every one — meaning after conversations embed; runs on this machine
tg search conversations <query> [options]| Argument | Requirement | What it is |
|---|---|---|
query | required | what to look for, in your own words, in any language the model reads. |
| Option | What it does |
|---|---|
--model <model> | local: a model id from models text list (default: e5-small); remote: the provider's model. |
--provider <provider> | embedding provider: local or openai; flags override profile settings. |
--base-url <url> | a server with OpenAI's /v1/embeddings: Gemini, Jina, or Ollama and LM Studio on this machine. |
--dims <n> | remote: the vector size — needed with --base-url; shortens an OpenAI model's. |
--max-chats <n> | at most this many chats; 5 with --sync-first, 20 with --refresh if not given. |
--max-chunks <n> | at most this many chunks embedded in one run; 2000 if not given. |
--sync-first | first fetch new messages within the chat, time and message bounds. |
--sync-time <duration> | stop fetching after this long (default: 30s). |
--max-messages <n> | fetch at most this many messages total (default: 500). |
--chat <chat> | only this chat: a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--since-time <time> | only those still going at this ISO 8601 time, or 30m / 2h / 1d ago, or later. |
--filter <query> | strict Lucene filter: any message in a conversation must match; does not change the meaning query. |
--source <source> | accounts to search: personal, bots, all, or a provider; defaults to the active account. |
--timezone <zone> | IANA timezone for filter dates; system timezone by default. |
--limit <n> | how many. |
--refresh | first build and embed, on this machine, the chats in scope that changed or were never built — within --max-chats and --max-chunks. |
tg search topics
a forum group's topics whose title matches
tg search topics <chat> <text> [options]| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
text | required | words from the topic's title. |
| Option | What it does |
|---|---|
--limit <n> | how many to show. |
--page <n> | which page, starting at 1. |
--all | every row, no paging. |
tg searches
saved searches and the history of search messages and stats messages show, kept in the local store; --saved runs one
tg searches create
save a search under a name without running it; search messages --saved runs it
tg searches create <name> [query] [options]| Argument | Requirement | What it is |
|---|---|---|
name | required | up to 64 letters a–z, digits and hyphens, not only digits. |
query | optional | the query, as for search messages; none matches every stored message. |
| Option | What it does |
|---|---|
--chat <chat> | only this chat — the same as chat: in the query; a chat: its title or part of it, its id, @username, or me for Saved Messages. |
--source <messenger> | every account of this messenger held in the store; personal, bots or all — the same as in: in the query. |
--limit <n> | how many. |
--newest | newest first instead of best first. |
--exact | bare words and quotes match their exact form only, as exact:word does; text: still matches every form. |
--context <n> | messages before and after each hit. |
--language <lucene|legacy> | the query language: strict Lucene or legacy discovery. |
--timezone <zone> | the IANA timezone for calendar date boundaries. |
--regex | the words are one regular expression, case-insensitive, tested against every stored text. |
--by <chat|sender|day|hour> | what stats messages show --saved counts by. |
--selection <json> | save the resolved parent ranking query and options from a drilldown. |
--replace | overwrite a saved search of the same name. |
tg searches show
one saved search or earlier run: its query, options and how often it ran
tg searches show <name|id>| Argument | Requirement | What it is |
|---|---|---|
name|id | required | a saved search's name, or the id of any row of searches history. |
tg searches list
the saved searches, by name
tg searches listtg searches history
the searches and counts that ran, newest first — saved ones included; never their results
tg searches history [options]| Option | What it does |
|---|---|
--limit <n> | how many. |
tg searches delete
delete a saved search, or one run from the history
tg searches delete <name|id>| Argument | Requirement | What it is |
|---|---|---|
name|id | required | a saved search's name, or the id of any row of searches history. |
tg searches clear
empty the history; saved searches stay
tg searches cleartg flood
the waits Telegram asked this profile to keep, and a hold on its writes
tg flood clear
forget them, lift the hold and the profile's pace, once Telegram no longer limits the account; changes nothing there
tg flood cleartg replies
rules that answer messages for you, kept in a file of this profile
tg replies add
add a rule with every default written out, off until you edit and enable it
Changes something on this computer only.
tg replies add <id>| Argument | Requirement | What it is |
|---|---|---|
id | required | lower-case letters, digits and -; unique in this profile. |
tg replies on
enable one reply rule; its template must be ready
Changes something on this computer only.
tg replies on <id>| Argument | Requirement | What it is |
|---|---|---|
id | required | the rule's id. |
tg replies off
disable one reply rule
Changes something on this computer only.
tg replies off <id>| Argument | Requirement | What it is |
|---|---|---|
id | required | the rule's id. |
tg replies edit
change only the named fields of a reply rule; lists replace the whole list
Changes something on this computer only.
tg replies edit <id> [options]| Argument | Requirement | What it is |
|---|---|---|
id | required | the rule's id. |
| Option | What it does |
|---|---|
--do <actions> | actions: reply, task, or both, comma-separated. |
--kinds <kinds> | chat kinds: dialog, group; comma-separated, empty for any. |
--chats <ids> | only these chat ids, comma-separated; empty for any. |
--not-chats <ids> | leave these chat ids out, comma-separated; empty clears. |
--words <words> | match any of these whole words, comma-separated; empty clears. |
--question | match only questions. |
--no-question | do not require a question. |
--mentions-me | require a mention of you or a reply to you. |
--no-mentions-me | do not require a mention of you or a reply to you. |
--people <ids> | only these sender ids, comma-separated; empty for any. |
--not-people <ids> | leave these sender ids out, comma-separated; empty clears. |
--contacts-only | match only contacts. |
--no-contacts-only | do not require a contact. |
--template <text> | the reply template. |
--model <mode> | legacy template mode: fill-only or may-reword; use ai blocks instead. |
--as-reply | send as a reply to the matched message. |
--no-as-reply | send without linking to the matched message. |
--per-chat <limit> | at most this many per chat, such as 1/12h. |
--per-person <limit> | at most this many per person, such as 1/1d. |
--outside <hours> | answer outside this 24-hour window, such as 09:00-19:00. |
--days <days> | days of the working window, such as mon-fri or sat,sun. |
--timezone <zone> | the IANA timezone for the working window. |
--no-hours | clear the working window. |
tg replies audience
show the profile's reply audience, or replace its named fields; testers still limit answers
Changes something on this computer only.
tg replies audience [options]| Option | What it does |
|---|---|
--reply <mode> | answer all or only listed senders and chats: all, listed. |
--allow-people <ids> | replace allowed sender ids, comma-separated; empty clears. |
--allow-chats <ids> | replace allowed chat ids, comma-separated; empty clears. |
--deny-people <ids> | replace denied sender ids, comma-separated; empty clears; deny wins. |
--deny-chats <ids> | replace denied chat ids, comma-separated; empty clears; deny wins. |
tg replies consents
consent for reply models once per profile and endpoint, with chat opt-outs
tg replies consents show
show the reply model consent and chat opt-outs; never calls a model
tg replies consents showtg replies consents grant
allow incoming message data to go to the configured reply model for this profile; chat opt-outs remain
Changes something on this computer only.
tg replies consents granttg replies consents revoke
revoke the profile's reply model consent immediately; chat opt-outs remain
Changes something on this computer only.
tg replies consents revoketg replies consents deny
keep this chat's incoming data away from the reply model
Changes something on this computer only.
tg replies consents deny <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | the native chat id, used as written; never resolved over the network. |
tg replies consents allow
remove this chat's model opt-out; does not grant profile consent
Changes something on this computer only.
tg replies consents allow <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | the native chat id, used as written; never resolved over the network. |
tg replies test
what the rules would have answered in the stored messages, to whom and why — sends nothing, changes nothing, never connects
tg replies test [rule] [options]| Argument | Requirement | What it is |
|---|---|---|
rule | optional | only this rule, by its id; every rule in file order if not given. |
| Option | What it does |
|---|---|
--since-time <time> | from this ISO 8601 time, or 2h / 1d ago; 7d ago if not given. |
--ai | call the configured reply model with stored message data; requires reply consent, otherwise uses fallback. |
tg replies pause
stop every reply rule of this profile at once, a running serve too; resume undoes it
tg replies pausetg replies resume
let the reply rules answer again after pause
tg replies resumetg replies status
whether the rules may send, which are on, and who they may answer
tg replies statustg recipients
the chats this profile may send to, when the list is on
tg recipients list
the chats on the list; empty and off until the first add
tg recipients listtg recipients add
allow sending to this chat; the first add turns the list on
Changes something on this computer only.
tg recipients add <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | a chat: its title or part of it, its id, @username, or me for Saved Messages. |
tg recipients remove
stop allowing this chat; the list stays on
Changes something on this computer only.
tg recipients remove <chat>| Argument | Requirement | What it is |
|---|---|---|
chat | required | chat id, or the title as the list shows it. |
tg recipients clear
delete the list, which turns it off: this profile may send to any chat again
Changes something on this computer only.
tg recipients cleartg sends
every attempt to send from this profile — never the text
tg sends list
attempts to send, newest first: sent, refused, failed, or not known
tg sends list [options]| Option | What it does |
|---|---|
--limit <n> | how many to show. |
tg runs
recorded runs — what this tool did, and when
tg runs list
recorded runs, newest first
tg runs list [options]| Option | What it does |
|---|---|
--limit <n> | how many to show. Default: 20. |
tg runs show
one run: what it was, and one line per operation
tg runs show <run-id>| Argument | Requirement | What it is |
|---|---|---|
run-id | required | an id from tg runs list. |
tg runs path
the directory holding one run
tg runs path <run-id>| Argument | Requirement | What it is |
|---|---|---|
run-id | required | an id from tg runs list. |
tg config
the settings in force, and where each one came from
tg config migrate
replace legacy access settings with permissions, preserving this file's effective levels
Changes something on this computer only.
tg config migrate [options]| Option | What it does |
|---|---|
--dry-run | show the migration without writing the file. |
tg config show
the profile, the profiles that exist, and each setting with where it came from
tg config show [options]| Option | What it does |
|---|---|
--bot | the settings a bot command on this profile gets, rather than the personal account's. |
tg config set
save a setting to the configuration file
Changes something on this computer only.
tg config set <setting> <value> [options]| Argument | Requirement | What it is |
|---|---|---|
setting | required | one of: limit, timeoutMs, color, senderColors, record, keepRunsForDays, readOnly, allow, permissions, sendsPerHour, requestsPerMinute, transcribeWith, speechModel, catchUpMarksRead, searchCatchUp, embeddingProvider, embeddingModel, embeddingBaseUrl, embeddingDims, analysisProvider, analysisModel, analysisBaseUrl, models, proxy, readOtherBots, updateCheck, skillHint, searchStemmers.cyrillic, searchStemmers.latin. |
value | required | a number, true or false, or for allow a list like send,reaction. |
| Option | What it does |
|---|---|
--defaults | change what every profile gets, rather than this profile. |
--personal | only for personal accounts — the personal section of the file. |
--bot | only for bots — the bot section of the file. |
tg config unset
remove a setting from the configuration file
Changes something on this computer only.
tg config unset <setting> [options]| Argument | Requirement | What it is |
|---|---|---|
setting | required | one of: limit, timeoutMs, color, senderColors, record, keepRunsForDays, readOnly, allow, permissions, sendsPerHour, requestsPerMinute, transcribeWith, speechModel, catchUpMarksRead, searchCatchUp, embeddingProvider, embeddingModel, embeddingBaseUrl, embeddingDims, analysisProvider, analysisModel, analysisBaseUrl, models, proxy, readOtherBots, updateCheck, skillHint, searchStemmers.cyrillic, searchStemmers.latin. |
| Option | What it does |
|---|---|
--defaults | change what every profile gets, rather than this profile. |
--personal | only for personal accounts — the personal section of the file. |
--bot | only for bots — the bot section of the file. |
tg doctor
the state this installation is in, without connecting unless --online
tg doctor [options]| Option | What it does |
|---|---|
--online | also connect once and read the account; sends nothing. |
tg doctor report
what a problem report holds; writes nothing
tg doctor report create
write a problem report to a file, and say where to send it
tg doctor report create [options]| Option | What it does |
|---|---|
--run <id> | the run the report is about; the newest failed one if not given. |
--output <file> | where to write it; a new file in this directory if not given. |
tg commands
commands, options and exit codes as JSON — inspect one command path per call
tg commands schema
one command's argv and result schemas, effects, permissions and retry guidance
tg commands schema <path>| Argument | Requirement | What it is |
|---|---|---|
path | required | one command path, for example: stats messages show. |
tg complete
shell completion: tg complete zsh prints the script to source
tg complete [words]| Argument | Requirement | What it is |
|---|---|---|
words | optional |
tg upgrade
upgrade tg with the package manager that installed it; --check only looks
tg upgrade [options]| Option | What it does |
|---|---|
--check | say whether a newer version exists, and install nothing. |
tg mcp
serve this profile to an agent over MCP, on stdin and stdout — claude mcp add tg -- tg mcp
tg mcp [options]| Option | What it does |
|---|---|
--permission <key=level> | override a permission for this server only; repeat for more keys. |
--confirm-send | no longer used — writes show no form; the profile's permissions decide. |
--allow-dangerous | no longer used — writes show no form; the profile's permissions decide. |
--allow-send | no longer used — the profile's permissions decide; kept so an old setup still starts. |
--allow-mark-read | no longer used — the profile's permissions decide. |
--allow-delete | no longer used — the profile's permissions decide. |
--http | serve over HTTP on 127.0.0.1 for ChatGPT and Claude in the browser, behind your tunnel. |
--http-confirmation <mode> | no longer used — writes show no form; the profile's permissions decide. |
--port <port> | the local port for --http (default 8765). |
--public-url <url> | the tunnel's https address the browser apps use, e.g. https://.ts.net. |
--revoke | forget every login given to a browser app; each must log in again. |
tg mcp config
print the mcpServers entry for Claude Desktop, Cursor and others, with full paths; writes nothing
tg mcp config [options]| Option | What it does |
|---|---|
--permission <key=level> | override a permission for this server only; repeat for more keys. |
--confirm-send | no longer used — writes show no form; the profile's permissions decide. |
--allow-dangerous | no longer used — writes show no form; the profile's permissions decide. |
--allow-send | no longer used — the profile's permissions decide; kept so an old setup still starts. |
--allow-mark-read | no longer used — the profile's permissions decide. |
--allow-delete | no longer used — the profile's permissions decide. |
tg mcp setup
add this profile's local MCP server to Codex or Claude Code
Changes something on this computer only.
tg mcp setup <client> [options]| Argument | Requirement | What it is |
|---|---|---|
client | required | codex or claude-code. |
| Option | What it does |
|---|---|
--allow-writes | acknowledge that this profile offers writing tools. |
--permission <key=level> | override a permission for this server only; repeat for more keys. |
--confirm-send | no longer used — writes show no form; the profile's permissions decide. |
--allow-dangerous | no longer used — writes show no form; the profile's permissions decide. |
--allow-send | no longer used — the profile's permissions decide; kept so an old setup still starts. |
--allow-mark-read | no longer used — the profile's permissions decide. |
--allow-delete | no longer used — the profile's permissions decide. |
tg mcp doctor
check this profile's local MCP handshake and tool list
tg mcp doctor [options]| Option | What it does |
|---|---|
--permission <key=level> | override a permission for this server only; repeat for more keys. |
--confirm-send | no longer used — writes show no form; the profile's permissions decide. |
--allow-dangerous | no longer used — writes show no form; the profile's permissions decide. |
--allow-send | no longer used — the profile's permissions decide; kept so an old setup still starts. |
--allow-mark-read | no longer used — the profile's permissions decide. |
--allow-delete | no longer used — the profile's permissions decide. |
tg skill
the instructions an agent is given for this tool
tg skill show
print SKILL.md — tg skill install puts it where Claude Code, Codex and Gemini CLI look for it
tg skill show [name]| Argument | Requirement | What it is |
|---|---|---|
name | optional | one of the skills shipped for a task: link-conversations. |
tg skill install
write SKILL.md to ~/.claude/skills/tg-cli/ (Claude Code) and ~/.agents/skills/tg-cli/ (Codex, Gemini CLI)
tg skill install [options]| Option | What it does |
|---|---|
--for <agents> | which agents to install for. One of: claude, agents, all. Default: all. |
Exit codes
Branch on the code, not on the text: the text can change, the code does not.
| Code | When |
|---|---|
0 | it worked |
2 | validation_error |
3 | configuration_error |
4 | authentication_error |
5 | permission_error |
6 | not_found |
7 | confirmation_required |
8 | rate_limited |
9 | timeout |
10 | network_error |
11 | provider_error |
12 | provider_unavailable |
13 | invalid_response |
14 | outcome_unknown |
130 | cancelled |
1 | anything else |
0 and only 0 means the operation was done. 14 (outcome_unknown) means a message may
have gone: repeat it only with the same --send-id, which Telegram uses to drop a second copy.