These are optional but strongly recommended steps. A well-configured environment means your agent survives reboots, recovers from crashes, and stays accessible no matter where you are.
Keep the agent running with PM2
By default,remoteagent start launches a background process that dies if the server reboots. To make it survive reboots automatically, use PM2:
sudo env PATH=... pm2 startup systemd -u ...) to register it with your init system.
To check status and logs:
Install Git
Most AI coding runners (Claude Code, Aider, Gemini) will try to rungit commands. Make sure Git is installed before pairing:
Set a default project directory
Always runremoteagent init from the root of your project. The working directory is saved in the agent config and used as the base path for every command. Using ~/ or /tmp as the project path will confuse the runner.
A good layout:
Keep your runner authenticated
RemoteAgent doesn’t store your AI credentials — the runner must be authenticated on the machine. Claude Code (OAuth): tokens expire after 1 year. You can generate a long-lived token duringremoteagent init or refresh it later:
~/.remoteagent/agents/{agentId}.json). Rotate it when needed:
GEMINI_API_KEY, ANTHROPIC_API_KEY, etc.) is set in the shell profile (~/.bashrc or ~/.zshrc) so it’s available on every session.
Use a dedicated low-privilege user
Avoid running RemoteAgent asroot. Create a dedicated system user with access only to your project directories:
Protect your config files
The agent config files contain your API key and agent token in plain text. Ensure only your user can read them:remoteagent init, but worth verifying if you’ve moved files manually.
Set up a swap file (low-memory servers)
AI runners (especially Claude SDK and Aider) can use significant memory. On VPS instances with 1 GB RAM or less, adding swap prevents out-of-memory crashes:Keep RemoteAgent up to date
New versions ship bug fixes and runner improvements. Update with the same install command:Test the connection before going remote
Before relying on RemoteAgent from your phone, verify the full loop works locally:- Start the agent:
remoteagent start - Open Telegram and send
/statusto the bot - Send a simple prompt:
"echo hello world" - Confirm you see the output in Telegram
/status shows the agent as online and you get a response, the setup is solid.