This repository has been archived on 2026-06-13. You can view files and clone it, but cannot push or open issues or pull requests.
anvillm/services/sysvinit
Levi Neely 50ae1d0dad Add approval gates: beads schema, Conductor, notification daemon, init scripts
Implements bd-i4h (Approval Gates / Human in the Loop):

beads schema (bd-i4h.4):
- Add StatusPendingApproval/StatusPendingReview local status constants
- Add pending-approval, pending-review, resume ctl commands
- Add agent/beads/pending read endpoint
- Document requires-approval/requires-review label conventions
- Update BEADS.md with full Approval Gates section

Conductor bot (bd-i4h.2):
- Read context prompt from stdin when not a terminal (custom prompt support)
- Extend default prompt with approval gate workflow instructions

Human notification daemon (bd-i4h.1):
- Add scripts/anvillm-inbox-notify: streams agent/events, fires notify-send
  for configurable message types (default: APPROVAL_REQUEST, REVIEW_REQUEST)
- Add services/inbox-notify-runit/: runit service
- Add services/systemd/anvillm-inbox-notify.service: systemd user service
- Add services/sysvinit/anvillm-inbox-notify: SysV LSB init script
- Add services/sysvinit/rc.anvillm-inbox-notify: Slackware rc script

anvilsrv init scripts:
- Add services/sysvinit/anvilsrv: SysV LSB init script
- Add services/sysvinit/rc.anvilsrv: Slackware rc script

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 18:47:23 +01:00
..
README.md Add approval gates: beads schema, Conductor, notification daemon, init scripts 2026-02-22 18:47:23 +01:00
anvillm-inbox-notify Add approval gates: beads schema, Conductor, notification daemon, init scripts 2026-02-22 18:47:23 +01:00
anvilsrv Add approval gates: beads schema, Conductor, notification daemon, init scripts 2026-02-22 18:47:23 +01:00
rc.anvillm-inbox-notify Add approval gates: beads schema, Conductor, notification daemon, init scripts 2026-02-22 18:47:23 +01:00
rc.anvilsrv Add approval gates: beads schema, Conductor, notification daemon, init scripts 2026-02-22 18:47:23 +01:00

README.md

SysV init scripts

SysV init scripts for AnviLLM services, in two flavours:

File Style Install at
anvilsrv Generic SysV + LSB INIT INFO header /etc/init.d/anvilsrv
rc.anvilsrv Slackware rc /etc/rc.d/rc.anvilsrv
anvillm-inbox-notify Generic SysV + LSB INIT INFO header /etc/init.d/anvillm-inbox-notify
rc.anvillm-inbox-notify Slackware rc /etc/rc.d/rc.anvillm-inbox-notify

anvilsrv — AnviLLM backend server

anvilsrv is the core backend daemon. It exposes the agent/ 9P filesystem used by Claude Code sessions, bots, the beads task store, and the event bus.

The binary (~/bin/anvilsrv) handles daemonization, PID file management, and a status subcommand itself, so these init scripts delegate to anvilsrv start, anvilsrv stop, and anvilsrv status rather than doing their own process tracking. The PID file lives at $NAMESPACE/anvilsrv.pid.

Generic SysV (/etc/init.d/anvilsrv)

# Install
sudo install -m 755 services/sysvinit/anvilsrv /etc/init.d/

# Configure — set the user to run as
sudo sh -c 'echo "ANVILSRV_USER=yourlogin" > /etc/default/anvilsrv'
# Optionally override NAMESPACE (defaults to /tmp/ns.$ANVILSRV_USER):
# echo "NAMESPACE=/tmp/ns.yourlogin.:0" >> /etc/default/anvilsrv

# Register with the init system
sudo update-rc.d anvilsrv defaults   # Debian / Ubuntu
# -or-
sudo chkconfig --add anvilsrv        # Red Hat / CentOS

# Manage
sudo service anvilsrv start
sudo service anvilsrv stop
sudo service anvilsrv restart
sudo service anvilsrv status

Slackware (/etc/rc.d/rc.anvilsrv)

# Install binary (built from source or downloaded)
install -m 755 /path/to/anvilsrv /home/yourlogin/bin/

# Install rc script
install -m 755 services/sysvinit/rc.anvilsrv /etc/rc.d/

# Set the user — edit ANVILSRV_USER= at the top of the script, or pass it:
ANVILSRV_USER=yourlogin /etc/rc.d/rc.anvilsrv start

Enable/disable (Slackware convention):

chmod 755 /etc/rc.d/rc.anvilsrv   # enable
chmod 644 /etc/rc.d/rc.anvilsrv   # disable

Add to /etc/rc.d/rc.local to start at boot:

if [ -x /etc/rc.d/rc.anvilsrv ]; then
  /etc/rc.d/rc.anvilsrv start
fi

Add to /etc/rc.d/rc.local_shutdown to stop cleanly:

if [ -x /etc/rc.d/rc.anvilsrv ]; then
  /etc/rc.d/rc.anvilsrv stop
fi

anvillm-inbox-notify — inbox notification daemon

anvillm-inbox-notify streams the AnviLLM event bus and fires notify-send desktop notifications when messages of configured types (default: APPROVAL_REQUEST, REVIEW_REQUEST) arrive in the user's inbox. Configure in ~/.config/anvillm/notifications.yaml.

Because this daemon needs a graphical session (DISPLAY, DBUS_SESSION_BUS_ADDRESS), both scripts auto-detect those values from /proc/<pid>/environ for ANVILLM_USER. See the note at the end of this file.

Generic SysV (/etc/init.d/anvillm-inbox-notify)

# Install daemon and init script
sudo install -m 755 scripts/anvillm-inbox-notify /usr/local/bin/
sudo install -m 755 services/sysvinit/anvillm-inbox-notify /etc/init.d/

# Configure
sudo sh -c 'echo "ANVILLM_USER=yourlogin" > /etc/default/anvillm-inbox-notify'

# Register
sudo update-rc.d anvillm-inbox-notify defaults
# -or-
sudo chkconfig --add anvillm-inbox-notify

# Manage
sudo service anvillm-inbox-notify start
sudo service anvillm-inbox-notify stop
sudo service anvillm-inbox-notify restart
sudo service anvillm-inbox-notify status

Slackware (/etc/rc.d/rc.anvillm-inbox-notify)

# Install daemon
install -m 755 scripts/anvillm-inbox-notify /usr/local/bin/

# Install rc script
install -m 755 services/sysvinit/rc.anvillm-inbox-notify /etc/rc.d/

# Set user: edit ANVILLM_USER= at the top, or pass it:
ANVILLM_USER=yourlogin /etc/rc.d/rc.anvillm-inbox-notify start

Enable/disable and rc.local hooks follow the same pattern as rc.anvilsrv above.


Note on DISPLAY / DBUS (inbox-notify only)

anvillm-inbox-notify fires desktop notifications and therefore needs the target user's X11 DISPLAY and DBUS_SESSION_BUS_ADDRESS. Both scripts discover these automatically by scanning /proc/<pid>/environ for processes owned by ANVILLM_USER, falling back to DISPLAY=:0 and the systemd user bus path (/run/user/<uid>/bus) if nothing is found.

If the X session hasn't started when the script runs the daemon will use the fallback values; notify-send will connect successfully for a standard single- seat setup where X is already running.

For a fully session-integrated approach (no guesswork), prefer the systemd user service or the runit service.