@peteretelej/ai-chat
v0.1.3
Published
Chat with local AI coding agents from Telegram, powered by the OpenCode API
Maintainers
Readme
ai-chat
Chat with & control AI Agents via telegram, chat UI & voice.
Note: OpenCode is the first supported agent (served over its HTTP/SSE API); the adapter interface keeps other CLI agents open.
Running
- Start the Telegram bot with
go run ./cmd/ai-chat start --config ./config.json - Run the in-process regression suite with
go run ./cmd/ai-chat test - Run one named regression with
go run ./cmd/ai-chat test --scenario "Session switching regression" - Run the explicit Telegram acceptance path with
go run ./cmd/ai-chat test --scenario telegram-acceptance --config ./config.json
Deployment (systemd user service)
Run ai-chat as a self-starting systemd user service (validated on ndovu). The
binary is expected at ~/.local/bin/ai-chat; the unit resolves ~ to your
home directory.
Install the binary:
- Build from source:
./scripts/build.sh && mkdir -p ~/.local/bin && cp ai-chat ~/.local/bin/ - Or download a release asset from GitHub releases and place it at
~/.local/bin/ai-chat - Or
npm install -g @peteretelej/ai-chatand copy/link the installedai-chatbinary to~/.local/bin/ai-chat
- Build from source:
Place the config at
~/.config/ai-chat/config.json(the service reads this path by default; no--configflag needed). It holds the bot token, so restrict it:chmod 600 ~/.config/ai-chat/config.jsonInstall and start the unit:
mkdir -p ~/.config/systemd/user cp deploy/ai-chat.service ~/.config/systemd/user/ systemctl --user daemon-reload systemctl --user enable --now ai-chatKeep the service running after logout:
loginctl enable-linger $USERWatch logs with
journalctl --user -u ai-chat -f(daily JSON log files also land in~/.config/ai-chat/logs)
Restart after a binary or config change with systemctl --user restart ai-chat
(./scripts/restart.sh does this for you when the unit is installed).
Continuity: each workspace's opencode serve port is derived deterministically,
so opencode attach http://127.0.0.1:<port> URLs stay stable across service
restarts; attach again with the same URL after a restart or reboot.
Validation
- Final refactor validation is
go test ./... - Then run
./scripts/pre-push - Then run one explicit
telegram-acceptancepass against a real Telegram bot/chat configuration
Telegram Acceptance
telegram-acceptanceis opt-in and is not part of normalgo testor defaultai-chat testruns- By default it uses
telegram.bot_token - You can override the bot with
telegram.acceptance_bot_token - You should set
telegram.acceptance_chat_idto the real chat to validate - If you omit
telegram.acceptance_chat_id, the command only falls back whentelegram.allowed_userscontains exactly one direct-chat user ID
Runtime Notes
- The in-process test harness boots the same store, router, session manager, and outbound response flow used by
start - Telegram remains a transport/rendering adapter on top of router and session-manager behavior
