.\" Man page for moadim.
.\" Mirrors the built-in `moadim --help` output (src/cli/mod.rs::print_help).
.\" View with: man ./docs/moadim.1 or install into share/man/man1/.
.TH MOADIM 1 "2026-07-21" "moadim 1.6.0" "Moadim Manual"
.SH NAME
moadim \- routine scheduler with an MCP/REST API and a web control panel
.SH SYNOPSIS
.B moadim
.RI [ MODE ]
.br
.B moadim
.I COMMAND
.RI [ args ...]
.SH DESCRIPTION
.B moadim
is a loop engine for AI agents: it runs scheduled routines
and exposes them over a REST API, an MCP server, and a web control panel.
.PP
Run with no arguments,
.B moadim
starts the server in the background and returns control to your shell.
Once running, manage it from the web client (the STOP button) or with
.BR "moadim stop" .
.SH MODES
.TP
.B (default)
Start the server in the background and exit.
.TP
.BR \-i ", " \-\-interactive ", " \-f ", " \-\-foreground
Run in the foreground, attached to the terminal (Ctrl-C to stop).
.TP
.BR \-b ", " \-\-background ", " \-d ", " \-\-detach ", " \-\-daemon
Start the server detached in the background (the explicit default).
.SH COMMANDS
.TP
.BR "restart " [ \-\-json "] [" \-q "] [" \-i ]
Stop a running server (if any) and start a fresh one.
.B \-q
/
.B \-\-quiet
prints only the
.B "restarted: pid <old> -> <new>"
rotation line, suppressing the preamble and the reach/manage hint block.
.B \-i
/
.B \-\-interactive
brings the fresh instance up in the foreground instead of detached.
.TP
.BR "stop " [ \-\-json "] [" \-q ]
Stop a running background server.
.B \-q
/
.B \-\-quiet
suppresses the human-readable status line.
Only stops the daemon process: a routine agent already running in its own
detached tmux session keeps running until it finishes on its own or a later
.B moadim
start reaps it.
.TP
.BR "status " [ \-\-json "] [" "\-\-wait" [ = SECS ]]
Show whether a server is running.
.B \-\-wait
polls
.B GET /api/v1/health
until the server answers or
.I SECS
elapses (default 30) instead of checking once, so scripts can block on
startup instead of sleeping blindly.
.TP
.BR "cleanup " [ \-\-json ]
Reap finished, expired routine workbenches now.
.TP
.B "trigger <id>"
Trigger a routine to run now, outside its schedule.
.TP
.B "logs <id>"
Print a routine's newest run log
.RI ( agent.log )
to stdout.
.TP
.B install
Register moadim as an OS service (launchd / systemd user).
.TP
.B uninstall
Remove the OS service registration and the managed crontab block.
.TP
.B machine <show|set|list>
Show or set this machine's identity, or list the machines referenced by
routines.
.TP
.B "completions <shell>"
Print a completion script for
.BR bash ", " zsh ", " fish ", " powershell ", or " elvish
(e.g.
.BR "moadim completions zsh > _moadim" ).
.TP
.BR "help" ", " \-h ", " \-\-help
Show usage help.
.TP
.BR "version" ", " \-V ", " \-\-version
Show the version.
.SH DATA COMMANDS
These talk to the running server over HTTP. Pass
.B \-\-help
to any of them (e.g.
.BR "moadim routines create --help" )
for the full flag list.
.TP
.B routines <create|list|get|update|replace|delete|trigger|logs|ical> ...
Manage routines (alias:
.BR routine ).
.TP
.B schedule trigger <id>
Trigger a routine by ID (invoked directly from the routine's crontab
entry).
.TP
.BR "enable <routine> " [ \-\-json ]
Turn a routine on (set enabled=true) by id or slug.
.TP
.BR "disable <routine> " [ \-\-json ]
Turn a routine off (set enabled=false) by id or slug.
.TP
.B agents
List available agent keys.
.SH OPTIONS
.TP
.B \-\-json
Pass to
.BR restart ", " stop ", " status ", or " cleanup
for a single-line, machine-readable object on stdout.
.TP
.BR \-q ", " \-\-quiet
Pass to
.B stop
to suppress its human-readable status line, or to
.B restart
to print only the rotation line.
.TP
.BR "\-\-wait" [ = SECS ]
Pass to
.B status
to poll for a server to come up (default 30s) instead of checking once.
.SH EXIT STATUS
.B status
,
.B cleanup
, and
.B stop
exit
.B 0
when a server is running and
.B 3
when none is, so scripts can branch on
.B $?
without parsing stdout.
.SH ENVIRONMENT
.TP
.B MOADIM_BIND_ADDR
Address the server binds to and that client commands target. Defaults to
.BR 127.0.0.1:5784 .
Set it (e.g.
.BR 127.0.0.1:8080 )
before starting the server, and point client commands at the same address.
.SH FILES
.TP
.B ~/.config/moadim/
Configuration tree (routines, agents).
.SH WEB INTERFACE
Once running, the control panel is served at
.B http://127.0.0.1:5784
(or the
.B MOADIM_BIND_ADDR
override).
.SH SEE ALSO
Project documentation and the REST/MCP API reference:
.I https://github.com/moadim-io/daemon
.SH AUTHOR
Moadim contributors.