Telegram CLI setup and maintenance commands
Login, profiles, configuration, the background server, the local store, diagnostics, agent connection and updates.
This reference covers setup and maintenance commands. Use it to look up login, profiles, configuration, the background server, the local store, diagnostics and agent connection.
Login, profiles, configuration, the background server, the local store, diagnostics, agent connection and updates.
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; --json=id,text keeps only those fields. |
--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. |
--debug | on a failure, its whole record — cause and stack — in place of the short line. |
--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). |
--brief | found messages as reference, title, time, sender and excerpt only. |
--full | found messages with their whole text and every provider field. |
--compact | one line per item for an agent: reference first, text last, paging and next steps as # lines. |
--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 even where the config says record false; record_input false leaves the typed words out. |
--no-record | do not keep this run, even if it fails. |
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
Changes something in Telegram.
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. |
--sms | phone login: ask Telegram to send the code by SMS, not to the app; Telegram may still refuse. |
--answer-stdin | with --json and no terminal: print each question as a needs line on stderr and read its answer, one line, from stdin. |
Returns: log in by QR code (default) or by phone number, code and 2FA password
Example: tg personal session start
tg session end
log this profile out on Telegram's side and forget the session here
Changes something in Telegram.
tg session endReturns: log this profile out on Telegram's side and forget the session here
Example: tg personal session end
tg 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. |
Returns: set up Telegram and connect your agent
Example: tg personal setup
tg account
the logged-in account
tg account list
every account profile on this computer, and the account each is logged in as; a name that is only a bot is left out (bot list has it), one that is a bot too says bot: true; asks the messenger nothing
tg account list [query]| Argument | Requirement | What it is |
|---|---|---|
query | optional | field:value terms that narrow the list — the fields are below. |
Returns: account profile — profile, current, account, name, signed_in, bot; every field: tg commands info account list
Example: tg personal account list
tg account show
who this profile is logged in as, with the phone number
tg account show [options]| Option | What it does |
|---|---|
--hide-phone | leave the phone number out. |
Returns: account — provider, id, name, username, phone, scope; every field: tg commands info account show
Example: tg personal account show
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. |
--hide-phone | leave the phone number out of the answer. |
Returns: account change — operation_id, account; every field: tg commands info account update
Example: tg personal account update --first-name Alex
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 list [query]| Argument | Requirement | What it is |
|---|---|---|
query | optional | field:value terms; this list filters by none yet. |
Returns: account session — current, client, device, location, last_active_at, created_at; every field: tg commands info account sessions list
Example: tg personal account sessions list
tg 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. |
Returns: ended account sessions — operation_id, sessions; every field: tg commands info account sessions end
Example: tg personal account sessions end --others
tg account remove
sign the profile out, then forget it on this computer: its settings, its saved sign-in and its files; --keep-data leaves its messages in the store, where search still finds them, --delete-data deletes them; asks first, or --yes
Changes something in Telegram.
tg account remove [options]| Option | What it does |
|---|---|
--keep-data | leave what the store holds of this account, still searchable. |
--delete-data | delete what the store and the tool's own files hold of this account. |
--dry-run | list what it would remove and keep, and change nothing. |
Returns: account removal — profile, data, dry_run, account, revoked, config_file, removed, kept; every field: tg commands info account remove
Example: tg personal account remove --keep-data --dry-run, tg personal account remove --delete-data --yes
tg models
models that run on this machine
tg models keys
API keys for embedding and analysis providers
tg models keys set
store a key, typed at a hidden prompt or piped on stdin — never as an argument
Changes something on this computer only.
tg models keys set <provider>| Argument | Requirement | What it is |
|---|---|---|
provider | required | openai, anthropic, or the host of a --base-url server that wants a key. |
Returns: model key stored — provider, stored; every field: tg commands info models keys set
Example: tg personal models keys set openai
tg models keys remove
forget a stored key
Changes something on this computer only.
tg models keys remove <provider>| Argument | Requirement | What it is |
|---|---|---|
provider | required | openai, anthropic, or a server's host. |
Returns: model key removed — provider, removed; every field: tg commands info models keys remove
Example: tg personal models keys remove openai
tg models list
speech, embedding and reranker models: downloaded or not, each kind's default
tg models list [query]| Argument | Requirement | What it is |
|---|---|---|
query | optional | field:value terms that narrow the list — the fields are below. |
Returns: model — id, kind, title, languages, size_bytes, downloaded, default, path, and 6 more; every field: tg commands info models list
Next usually: tg models download <model>, tg models set <model>, tg images models download <model>
Example: tg personal models list, tg personal models list kind:audio
tg models download
download and verify one speech, embedding or reranker model: tens to hundreds of MB, each size in models list
Reads from an outside service.
tg models download <model> [options]| Argument | Requirement | What it is |
|---|---|---|
model | required | a model id from models list. |
| Option | What it does |
|---|---|
--accept-terms | no longer needed; kept so older scripts still run. |
Returns: model — id, kind, title, languages, size_bytes, downloaded, default, path, and 6 more; every field: tg commands info models download
Next usually: tg models set <model>, tg images models download <model>
Example: tg personal models download embeddinggemma, tg personal models download mmarco
tg models set
make a downloaded text model the one every embed and every search by meaning uses, in every WireCat CLI. Each model keeps its own vectors: the next syncs embed what the new one lacks, and switching back is instant
Changes something on this computer only.
tg models set <model>| Argument | Requirement | What it is |
|---|---|---|
model | required | a downloaded text model id from models list. |
Returns: model chosen — id, kind, title, languages, size_bytes, downloaded, default, path, and 9 more; every field: tg commands info models set
Next usually: tg models download <model>, tg images models download <model>
Example: tg personal models set e5-large
tg models add
add an ONNX embedding model from Hugging Face, pinned and checked by sha256
Reads from an outside service.
tg models add <id> [options]| Argument | Requirement | What it is |
|---|---|---|
id | required | the id to give it: a-z, 0-9, . _ -. |
| Option | What it does |
|---|---|
--payload <json> | where the model is and how to run it, as JSON (below). |
Returns: model — id, kind, title, languages, size_bytes, downloaded, default, path, and 6 more; every field: tg commands info models add
Next usually: tg models download <model>, tg models set <model>, tg images models download <model>
Example: tg personal models add e5-base --payload '{"repository":"Xenova/multilingual-e5-base","onnx":"onnx/model_quantized.onnx","dims":768,"pooling":"mean","prefix":{"query":"query: ","passage":"passage: "}}'
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 | include changes and receipts; each item names its event. |
Returns: watch item — ref, id, chat_id, sender_id, sender_name, sender_is_me, timestamp, edited_at, and 32 more; every field: tg commands info watch
Example: tg personal watch --jsonl --timeout 30s
tg serve
keep the local store current until stopped — what a systemd or launchd unit runs
Changes something in Telegram.
tg serveReturns: serve summary — profile, started_at, stopped_at, kept, replies, members, stems, caught_up, and 1 more; every field: tg commands info serve
Example: tg personal serve
tg 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
Changes something on this computer only.
tg server startReturns: start this profile's background server
Example: tg personal server start
tg server stop
stop this profile's serve — through the unit if it runs under one
Changes something on this computer only.
tg server stopReturns: stop this profile's serve — through the unit if it runs under one
Example: tg personal server stop
tg server restart
stop it and start it again
Changes something on this computer only.
tg server restartReturns: stop it and start it again
Example: tg personal server restart
tg server status
whether serve runs for this profile, since when, who started it, and the unit if there is one
tg server statusReturns: this profile's background-server status
Example: tg personal server status
tg 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, --limit <n> | how many lines. Default: 50. |
Returns: serve's latest log lines — from the journal under systemd, else its log file
Example: tg personal server logs --limit 20
tg server install
write a systemd user unit or a launchd agent for this profile and have it start at every login; starts nothing now
Changes something on this computer only.
tg server installReturns: install this profile's background server to start at every login
Example: tg personal server install
tg server uninstall
remove this profile's unit, so it no longer starts at login; stop it first
Changes something on this computer only.
tg server uninstallReturns: remove this profile's unit, so it no longer starts at login; stop it first
Example: tg personal server uninstall
tg 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. |
Returns: store chat status — chat_id, title, kind, messages, oldest_at, newest_at, last_stored_at, held; every field: tg commands info store status
Example: tg personal store status "Book club"
tg store chats
the account's chats as the store holds them
tg store chats status
over this account's searchable chats of every kind, channels included: fetched (back to the first message, up to date, no gaps), partial, never (no fetch recorded and no message held), and the oldest message held; reads the store only
tg store chats statusReturns: chat coverage — chats, fetched, partial, never, oldest_message_at; every field: tg commands info store chats status
Example: tg personal store chats status
tg store gaps
inspect recorded interior coverage gaps and explicitly fetch them
tg store gaps show
local coverage plan; missing message ids alone do not imply missing history
tg store gaps 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. |
Returns: store gap plan — version, scope, account, chat, ordering, held, gaps, unknown, and 2 more; every field: tg commands info store gaps show
Example: tg personal store gaps show "Book club"
tg store gaps repair
fetch bounded interior gaps and recheck coverage; never delete unseen messages
Changes something on this computer only.
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 search_catch_up. |
--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. |
Returns: store gap repair — job, pid, chat, log, version, scope, before, after, and 6 more; every field: tg commands info store gaps repair
Example: tg personal store gaps repair "Book club" --limit 100
tg store jobs
background sync jobs
tg store jobs list
background sync jobs, newest first
tg store jobs list [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | field:value terms that narrow the list — the fields are below. |
| Option | What it does |
|---|---|
--limit <n> | how many to show. |
--page <n> | which page, starting at 1. |
--all | every row, no paging. |
Returns: job — id, chat, state, pid, started_at, fetched, finished_at, message_limit, and 5 more; every field: tg commands info store jobs list
Example: tg personal store jobs list
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]Returns: store job details — chat, state, pid, started_at, fetched, job, profile, progress, and 11 more; every field: tg commands info store jobs show
Example: tg personal store jobs show
tg store jobs cancel
stop a running background job after its current page; a later sync resumes where it stopped
Changes something on this computer only.
tg store jobs cancel <job>| Argument | Requirement | What it is |
|---|---|---|
job | required | the job id. |
Returns: store job cancel — job, cancelled; every field: tg commands info store jobs cancel
Example: tg personal store jobs cancel job-101
tg store jobs retry
start a partial, failed or died job again, as a new job; the sync resumes where the store stopped
Changes something on this computer only.
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 partial, failed or died. |
Returns: store job retry — job, pid, chat, log, retried, error; every field: tg commands info store jobs retry
Example: tg personal store jobs retry --failed
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 clearReturns: store job clear — cleared; every field: tg commands info store jobs clear
Example: tg personal store jobs clear
tg store export
a chat's stored messages, oldest first: --jsonl one message per line, --json the list envelope of messages; never asks the messenger
Changes something on this computer only.
tg store export [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; several with --output-dir. |
| Option | What it does |
|---|---|
--format <format> | jsonl: one message per line, the default with --output; 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. |
--output-dir <dir> | write into this folder, a file per chat and a manifest; run again on it for only what changed since. |
--include <kinds> | with --output-dir: every stored chat of these kinds, comma-separated: dialog, group, channel, saved. |
--all | with --output-dir: 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. |
Returns: store export — ref, id, chat_id, sender_id, sender_name, sender_is_me, timestamp, edited_at, and 36 more; every field: tg commands info store export
Example: tg personal store export "Book club" --output ./messages.jsonl
tg store clear
delete from the store the chats this account has left, with their messages
Changes something on this computer only.
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. |
--dry-run | list the chats it would delete, and delete nothing. |
Returns: store clear — cleared, chats, messages, left, dry_run; every field: tg commands info store clear
Example: tg personal store clear --left --dry-run
tg store import
load a JSON file marked "synthetic": true (account, people, chats, members, messages) into this profile's account in the local store, as a sync would save them; the same file twice adds nothing and a changed message is updated in place. Refuses the owner's real store. Without --yes, says what it would load and changes nothing
Changes something on this computer only.
tg store import <file>| Argument | Requirement | What it is |
|---|---|---|
file | required | the JSON file to load. |
Returns: store import — store, profile, account, imported, file, added; every field: tg commands info store import
Example: tg personal store import ./synthetic-chats.json --yes
tg store info
the store file: where it is, its size, its schema against the one this tool speaks, which tools used it and how many rows it holds, by provider, chat kind, account, year (UTC) and attachment kind, over every account; changes nothing
tg store infoReturns: store info — path, exists, schema, opens, error, bytes, journal_mode, pages, and 12 more; every field: tg commands info store info
Example: tg personal store info
tg store check
whether the store is healthy — integrity, search indexes, disk, and which chats are behind
tg store checkReturns: store check — path, exists, ok, opens, error, checks, schema, integrity, and 11 more; every field: tg commands info store check
Example: tg personal store check
tg store migrate
bring the store up to this build's schema, then normalize, index and stem the messages and notes stored before it
Changes something on this computer only.
tg store migrateReturns: store migration — path, exists, from, to, normalized, indexed, terms, stemmed, and 1 more; every field: tg commands info store migrate
Example: tg personal store migrate
tg store rebuild
rebuild the word index, its typo vocabulary, the stems, the files' word index, the notes' indexes and who took part in what, from what is stored, and drop the vectors no stored text uses; loses nothing
Changes something on this computer only.
tg store rebuildReturns: store reindex — path, exists, normalized, indexed, terms, stemmed, notes_indexed, file_texts, and 2 more; every field: tg commands info store rebuild
Example: tg personal store rebuild
tg store backup
copy the store into a new file, while it is in use; never overwrites a file
Changes something on this computer only.
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. |
Returns: store backup — path, from, bytes, schema, rows, encrypted; every field: tg commands info store backup
Example: tg personal store backup ./backup.db
tg store restore
put a backup in place of the store; the store it replaces is kept beside it, never deleted. Given a rollback copy (backups/-rollback-schema--.db, kept for a day before an upgrade older tools cannot open), put its tables back in the store and return it to that version instead
Changes something on this computer only.
tg store restore <file>| Argument | Requirement | What it is |
|---|---|---|
file | required | a file store backup wrote, or a rollback copy; one written with --encrypt asks for its password. |
Returns: store restore — path, restored_from, kept_at, schema, rolled_back, was, tables, rebuilt, and 1 more; every field: tg commands info store restore
Example: tg personal store restore ./backup.db
tg store decrypt
open a file written with --encrypt into a new file; asks for its password
Changes something on this computer only.
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. |
Returns: store decrypt — path, from, bytes; every field: tg commands info store decrypt
Example: tg personal store decrypt ./backup.enc --output ./restored.db
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
Changes something on this computer only.
tg store repair [options]| Option | What it does |
|---|---|
--dry-run | say what it would do, and change nothing. |
Returns: store repair — path, exists, dry_run, repaired, indexes_created, triggers_created, mismatches, foreign_key_violations, and 1 more; every field: tg commands info store repair
Example: tg personal store repair --dry-run
tg store reset
back the store up beside itself, then delete it and start an empty one at this build's schema; asks first, or --yes
Changes something on this computer only.
tg store reset [options]| Option | What it does |
|---|---|
--no-backup | delete the store without backing it up first. |
--dry-run | list every table it would empty, with its rows, and delete nothing. |
Returns: store reset — path, exists, reset, dry_run, files, bytes, schema, tables, and 4 more; every field: tg commands info store reset
Example: tg personal store reset
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
Changes something on this computer only.
tg store copies delete <name>Returns: store copy removal — path, deleted; every field: tg commands info store copies delete
Example: tg personal store copies delete messages_copy_1
tg store tables
the tables of the local archive
tg store tables list
every table of the local archive: its kind (data, search index, part of a search index, internal) and its rows, a search index's rows not counted; --full adds each table's size on disk, which reads the whole file (about ten seconds for 3 GB); changes nothing
tg store tables list [query]| Argument | Requirement | What it is |
|---|---|---|
query | optional | field:value terms that narrow the list — the fields are below. |
Returns: store table — name, kind, rows, bytes; every field: tg commands info store tables list
Example: tg personal store tables list, tg personal store tables list kind:data, tg personal store tables list --full --json
tg store recover
check every page and search index of the store, say what is damaged, what it means and the commands that recover it; changes nothing
tg store recover run
copy every readable row into a new file with the sqlite3 program, rebuild the search indexes, mentions and vector index, check it, and put it in place of the store; the damaged file is kept beside it. Refuses while a WireCat timer or process has the store
Changes something on this computer only.
tg store recover runReturns: rebuild a damaged store from every row it can read
Example: tg personal store recover run
tg search runs
search recorded diagnostic metadata and events; literal words and field:value terms joined by AND; no message contents
tg search runs [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | field:value terms that narrow the list — the fields are below. |
| Option | What it does |
|---|---|
--limit <n> | matches per page, at most 100. Default: 20. |
--page <n> | result page. Default: 1. |
Returns: run hit — run_id, command, started_at, status, cli_version, events, events_truncated, profile, and 21 more; every field: tg commands info search runs
Example: tg personal search runs timeout status:failed --limit 10
tg 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
Changes something on this computer only.
tg flood clearReturns: clear a profile's stored rate-limit hold
Example: tg personal flood clear
tg runs
recorded runs — what this tool did, and when
tg runs list
recorded runs, newest first
tg runs list [query] [options]| Argument | Requirement | What it is |
|---|---|---|
query | optional | field:value terms that narrow the list — the fields are below. |
| Option | What it does |
|---|---|
--limit <n> | how many to show. Default: 20. |
--page <n> | which page, starting at 1. Default: 1. |
Returns: run — run_id, command, started_at, status, cli_version, profile, completed_at, requests, and 23 more; every field: tg commands info runs list
Example: tg personal runs list --limit 10
tg runs show
one run: what it was, how it ended, and every event it logged
tg runs show <run-id> [options]| Option | What it does |
|---|---|
--problems | only failed responses, warnings and crashes. |
Returns: run details — run_id, command, started_at, status, cli_version, directory, event_count, events, and 22 more; every field: tg commands info runs show
Example: tg personal runs show run-101
tg runs path
the directory holding one run
tg runs path <run-id>Returns: run location — path; every field: tg commands info runs path
Example: tg personal runs path run-101
tg config
the settings in force, and where each one came from
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. |
Returns: the profile, the profiles that exist, and each setting with where it came from
Example: tg personal config show
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, timeout_ms, color, sender_colors, record, record_input, keep_runs_for_days, keep_successful_runs_for_days, keep_store_runs_for_days, runs_size_limit_mb, permissions, sends_per_hour, requests_per_minute, transcribe_with, speech_model, search_catch_up, history_dialog_days, history_group_days, history_group_members_max, history_muted, picture_search, search_reranker, embedding_provider, embedding_model, embedding_base_url, embedding_dims, models, proxy, read_other_bots, update_check, skill_hint, search_stemmers.cyrillic, search_stemmers.latin, owner_languages, phone_countries, task_categories., task_agent_close, task_agent_close_min, task_first_pass_per_chat, account_groups., crm.:.links, crm.:.company-types, crm.:.scope, crm.:.unassigned, crm.:.self. |
value | required | a number, true or false; for a group tg:work,max:Alice,email:me@x. |
| 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. |
Returns: save a setting to the configuration file
Example: tg personal config set limit 20
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, timeout_ms, color, sender_colors, record, record_input, keep_runs_for_days, keep_successful_runs_for_days, keep_store_runs_for_days, runs_size_limit_mb, permissions, sends_per_hour, requests_per_minute, transcribe_with, speech_model, search_catch_up, history_dialog_days, history_group_days, history_group_members_max, history_muted, picture_search, search_reranker, embedding_provider, embedding_model, embedding_base_url, embedding_dims, models, proxy, read_other_bots, update_check, skill_hint, search_stemmers.cyrillic, search_stemmers.latin, owner_languages, phone_countries, task_categories., task_agent_close, task_agent_close_min, task_first_pass_per_chat, account_groups., crm.:.links, crm.:.company-types, crm.:.scope, crm.:.unassigned, crm.:.self. |
| 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. |
Returns: remove a setting from the configuration file
Example: tg personal config unset limit
tg config migrate
write each setting the file lacks at its default, keeping yours
Changes something on this computer only.
tg config migrateReturns: write each setting the file lacks at its default, keeping yours
tg config repair
fix broken JSON syntax in the settings file — comments, a missing or extra comma, unquoted keys, single quotes, missing closing brackets at the end — keeping every value, with a backup beside it; refuses anything with more than one reading and changes nothing then
Changes something on this computer only.
tg config repair [options]| Option | What it does |
|---|---|
--dry-run | say what it would fix, and change nothing. |
Returns: fix the settings file's JSON syntax, keeping every value
Example: tg config repair, tg config repair --dry-run
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 reports
problem reports
tg doctor reports show
what a problem report holds; writes nothing
tg doctor reports showReturns: what a problem report holds; writes nothing
Example: tg personal doctor reports show
tg doctor reports create
write a problem report to a file, and say where to send it
Changes something on this computer only.
tg doctor reports 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. |
Returns: write a problem report to a file, and say where to send it
Example: tg personal doctor reports create --output ./problem-report.json
tg commands
every command by section; --json prints its contract, one path per call
tg commands info
one command contract, or all schemas, error reasons and explicit overrides
tg commands info [path]| Argument | Requirement | What it is |
|---|---|---|
path | optional | one command path; without one, export schemas, error reasons and explicit overrides. |
Returns: one command contract, or all schemas, error reasons and explicit overrides
Example: tg commands info messages list
tg complete
shell completion: tg complete zsh prints the script to source
tg complete [words]| Argument | Requirement | What it is |
|---|---|---|
words | optional | zsh for the shell script, or command words to complete. |
Returns: shell completion: tg complete zsh prints the script to source
tg upgrade
upgrade tg with the package manager that installed it; --check only looks
Changes something on this computer only.
tg upgrade [options]| Option | What it does |
|---|---|
--check | say whether a newer version exists, and install nothing. |
Returns: upgrade tg with the package manager that installed it; --check only looks
tg mcp
serve this profile to an agent over MCP and set it up — claude mcp add tg -- tg <profile> mcp serve
tg mcp serve
serve this profile to an agent over MCP, on stdin and stdout — claude mcp add tg -- tg <profile> mcp serve; tg mcp serve --profiles a,b or --profiles all serves those profiles from one server and each tool asks which
Changes something in Telegram.
tg mcp serve [options]| Option | What it does |
|---|---|
--permission <key=level> | make a permission stricter for this server only, like messages.send=deny; it never loosens the profile; repeat for more keys. |
--profiles <names|all> | serve several profiles from one server instead of one: names, comma-separated, or all for every profile. |
--http | serve over HTTP on 127.0.0.1 for ChatGPT and Claude in the browser, behind your tunnel; 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 or https://.ts.net/tg. |
Returns: serve this profile's commands to an AI agent
Example: tg personal mcp serve, tg mcp serve --profiles work,personal, tg personal mcp serve --http --public-url https://laptop.example.ts.net
tg mcp revoke
forget every login mcp serve --http gave a browser app, of this profile or of the server --profiles names; each app must log in again
Changes something on this computer only.
tg mcp revoke [options]| Option | What it does |
|---|---|
--profiles <names|all> | serve several profiles from one server instead of one: names, comma-separated, or all for every profile. |
Returns: forget every login given to a browser app
Example: tg personal mcp revoke, tg mcp revoke --profiles all
tg mcp server
start, stop and check mcp serve --http in the background; status shows the login code for a browser app
tg mcp server start
start mcp serve --http apart from this shell and answer once it listens, with its login code
Changes something on this computer only.
tg mcp server start [options]Returns: start the HTTP MCP server in the background
Example: tg personal mcp server start --public-url https://laptop.example.ts.net
tg mcp server stop
stop mcp serve --http — only one that mcp server start started
Changes something on this computer only.
tg mcp server stop [options]| Option | What it does |
|---|---|
--profiles <names|all> | the server of several profiles that mcp serve --profiles serves: names, comma-separated, or all. |
Returns: stop the background HTTP MCP server
Example: tg personal mcp server stop
tg mcp server status
whether mcp serve --http runs, on which port and address, the login code for a new browser app, and the apps logged in
tg mcp server status [options]| Option | What it does |
|---|---|
--profiles <names|all> | the server of several profiles that mcp serve --profiles serves: names, comma-separated, or all. |
Returns: whether the HTTP MCP server runs, its login code and the apps logged in
Example: tg personal mcp server status --json
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> | make a permission stricter for this server only, like messages.send=deny; it never loosens the profile; repeat for more keys. |
--profiles <names|all> | serve several profiles from one server instead of one: names, comma-separated, or all for every profile. |
Returns: print the local MCP configuration of this profile, or of those --profiles names
Example: tg personal mcp config, tg mcp config --profiles all
tg mcp add
add this profile's local MCP server to Codex or Claude Code
Changes something on this computer only.
tg mcp add <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> | make a permission stricter for this server only, like messages.send=deny; it never loosens the profile; repeat for more keys. |
Returns: add this profile's local MCP server to Codex or Claude Code
Example: tg personal mcp add codex --allow-writes
tg mcp check
check this profile's local MCP handshake and tool list
tg mcp check [options]| Option | What it does |
|---|---|
--permission <key=level> | make a permission stricter for this server only, like messages.send=deny; it never loosens the profile; repeat for more keys. |
Returns: check this profile's local MCP handshake and tool list
Example: tg personal mcp check
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, Gemini CLI and OpenClaw look for it, and where Hermes does on request; --for prints the copy already there
tg skill show [name] [options]| Argument | Requirement | What it is |
|---|---|---|
name | optional | one of the skills shipped for a task: follow-ups, link-conversations. |
| Option | What it does |
|---|---|
--for <agents> | print the copy installed for these agents instead of this version's. One of: claude, agents. |
Returns: print the tool's instructions for AI agents
Example: tg skill show, tg skill show follow-ups
tg skill install
write SKILL.md to ~/.claude/skills/tg-cli/ (Claude Code) and ~/.agents/skills/tg-cli/ (Codex, Gemini CLI, OpenClaw); --for hermes also has Hermes read ~/.agents/skills, which changes Hermes's own settings, so all leaves it out
Changes something on this computer only.
tg skill install [options]| Option | What it does |
|---|---|
--for <agents> | which agents to install for. One of: claude, agents, hermes, all. Default: all. |
Returns: install the tool's instructions for AI agents
Example: tg skill install --for agents
tg skill status
for each place tg skill install writes to, and for the copy Hermes reads: the path, the version installed there, and whether it is current, stale, missing or unversioned
tg skill statusReturns: whether the installed instructions for AI agents match this version
Example: tg skill status, tg skill status --json
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 |
15 | conflict |
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 --operation-id, which Telegram uses to drop a second copy.