-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Summary
It would be very useful if anna gateway supported running as a background daemon directly, without requiring external tools like tmux, nohup, or manually managed process supervisors.
I’d like to propose:
anna gateway -danna gateway --daemon
And also a small lifecycle command group:
anna gateway startanna gateway stopanna gateway restartanna gateway status
Motivation
Right now, running anna gateway persistently is a bit awkward.
Typical needs are:
- start gateway in the background
- check whether it is running
- restart it after config changes
- stop it cleanly
At the moment this usually requires extra shell scripting or tools like:
tmuxnohupsystemdlaunchd
That works, but for a CLI like anna, built-in process management would make the UX much smoother.
Proposed UX
Option 1: daemon flag
anna gateway --daemon
anna gateway -dExpected behavior:
- starts gateway in background
- writes pid file
- optionally writes logs to a default location
- prints useful metadata such as PID / log path
- exits immediately after successful launch
Example output:
anna gateway started in background
PID: 12345
Log: ~/.anna/logs/gateway.log
Option 2: lifecycle subcommands
anna gateway start
anna gateway stop
anna gateway restart
anna gateway statusExpected behavior:
start: launch gateway if not runningstop: terminate existing gateway process gracefullyrestart: stop then startstatus: show whether gateway is running, PID, uptime, log path, and maybe configured channels
Possible examples:
anna gateway start --daemon
anna gateway status
anna gateway restart
anna gateway stopWhy this matters
This would make anna feel much more complete as a local assistant runtime.
Common workflows become much easier:
- keep Telegram / other gateways online after login shell exits
- recover from config changes quickly
- avoid ad hoc tmux sessions
- simplify scripting and onboarding
Implementation notes
A few things that may help:
- pid file management
- lock / single-instance protection
- graceful shutdown handling
- log file location convention
- clear error message when a gateway instance is already running
statusshould ideally detect stale pid files
Nice-to-have
Potential future additions:
anna gateway logsanna gateway start --log-file <path>anna gateway stop --forceanna gateway status --json
Current workaround
Right now I’m using tmux to keep anna gateway alive, but this feels like something anna could handle natively.
Thanks — this would significantly improve day-to-day usability.