Use tgcli on the remote VPS, not locally.
Target
- Read the host from
TGCLI_SERVER. - SSH as
danil. - Prefer
ssh danil@"$TGCLI_SERVER" tgcli ...for one-off commands. - Use
ssh danil@"$TGCLI_SERVER" 'bash -lc "..."'when shell expansion or multiple commands are needed. - Treat the remote host as the only place where the Telegram session store lives.
Use
- Use this skill for remote message search, sending, sync, media download, and diagnostics.
- Keep
--jsonon machine workflows. - Prefer
--source archive|live|bothexplicitly when reading messages. - Do not use MCP here; this skill is CLI-only.
Checks
ssh danil@"$TGCLI_SERVER" 'command -v tgcli && tgcli --version'ssh danil@"$TGCLI_SERVER" 'tgcli config list'ssh danil@"$TGCLI_SERVER" 'tgcli doctor --connect'ssh danil@"$TGCLI_SERVER" 'tgcli auth status'
Common Commands
ssh danil@"$TGCLI_SERVER" tgcli messages list --chat @channel --limit 20 --source archive --json
ssh danil@"$TGCLI_SERVER" tgcli messages search "invoice" --chat @channel --source archive --json
ssh danil@"$TGCLI_SERVER" tgcli send text --to @username --message "hello" --json
ssh danil@"$TGCLI_SERVER" tgcli send file --to @channel --file ./report.pdf --caption "report" --json
ssh danil@"$TGCLI_SERVER" tgcli sync --once
ssh danil@"$TGCLI_SERVER" tgcli media download --chat @channel --id 123 --json
Failure Modes
- If
TGCLI_SERVERis unset, stop and ask for it or read it from.env.local. - If SSH host keys changed, remove the stale entry with
ssh-keygen -R "$TGCLI_SERVER"and verify the new fingerprint before continuing. - If
tgcliis missing remotely, check the remote login shellPATHfirst. - If auth is missing, run
tgcli authon the remote host asdanil; do not copy secrets back to the local machine unless explicitly requested.
Notes
- The remote store is expected under
~/.local/share/tgcli. - Keep commands narrow and explicit; the remote host is already the execution boundary.