All plugins

babysit

Watches a long job's log (training run, build, migration) with zero model calls, keeps one chat message updated in place, and wakes the agent only when the job hits a non-finite value, out-of-memory error, traceback, stall, process exit or a line containing your alert text. With on_failure: pause it freezes the job on a non-finite value, out-of-memory error, memory pressure or traceback, and a restart linked with resume_of gets a recovered or relapsed verdict once it passes the old failure step. Disclosure — Babysit reads the selected log file through one read-only handle, opened without following symlinks and checked again from the handle itself, so replacing the path afterwards changes nothing it reads. It accepts absolute paths only and refuses files inside the active profile's Hermes home, the Hermes root that holds every profile, ~/.ssh, ~/.aws, ~/.gnupg, ~/.kube, ~/.docker, ~/.config, /etc, /proc, /sys and /dev, files with credential-looking names such as .env, id_*, *.pem, *.key and auth.json, shell and database history files (.bash_history, .zsh_history, .python_history, .psql_history and every other .*_history), ~/.pgpass, ~/.netrc, ~/.git-credentials, hard-linked files, and anything that is not a regular file. When a PID is given, every 4 seconds it reads that process's resident memory through psutil, plus the cgroup memory limit from /sys/fs/cgroup or the system's available memory, and when the process ends it reads its exit status without reaping it. It never writes to the log, makes no network requests of its own, spawns no child processes, and sends no signals unless a watch sets on_failure: pause: then it sends SIGSTOP to the one PID the watch was given, and SIGCONT on babysit_resume or /babysit resume, each only after re-checking that PID's uid and start time. It never kills a process, never signals a process group or another PID, and refuses Hermes' own process and its parents. checkpoint_dir reports the newest checkpoint's name, size and age without reading its contents. For the Desktop pane it writes one JSON file per watch, <hermes home>/plugin-data/babysit/watches/<watch id>.json, owner-only and replaced atomically whenever the state changes and at least every 4 seconds. Each file holds the watch's file name, log path, PID, metric series, memory samples, events, counters and the last 12 log lines (200 characters each). Files of watches that ended a day ago, and all but the newest 24, are removed when a watch starts. The read-only dashboard route GET /api/plugins/babysit/watches reads those files and writes nothing. Its one runtime dependency beyond the standard library is psutil, which Hermes pins. It creates one daemon thread per watch. Babysit and Hermes read the plugin's allow_gateway_injection setting in the profile Babysit runs in to check injection permission. The watch loop makes no model calls. Detected events are sent to the current session, which may start an agent turn.

aarav1656Automationv0.3.0Updated 20 days ago

About

Watches a long job's log (training run, build, migration) with zero model calls, keeps one chat message updated in place, and wakes the agent only when the job hits a non-finite value, out-of-memory error, traceback, stall, process exit or a line containing your alert text. With on_failure: pause it freezes the job on a non-finite value, out-of-memory error, memory pressure or traceback, and a restart linked with resume_of gets a recovered or relapsed verdict once it passes the old failure step. Disclosure — Babysit reads the selected log file through one read-only handle, opened without following symlinks and checked again from the handle itself, so replacing the path afterwards changes nothing it reads. It accepts absolute paths only and refuses files inside the active profile's Hermes home, the Hermes root that holds every profile, ~/.ssh, ~/.aws, ~/.gnupg, ~/.kube, ~/.docker, ~/.config, /etc, /proc, /sys and /dev, files with credential-looking names such as .env, id_*, *.pem, *.key and auth.json, shell and database history files (.bash_history, .zsh_history, .python_history, .psql_history and every other .*_history), ~/.pgpass, ~/.netrc, ~/.git-credentials, hard-linked files, and anything that is not a regular file. When a PID is given, every 4 seconds it reads that process's resident memory through psutil, plus the cgroup memory limit from /sys/fs/cgroup or the system's available memory, and when the process ends it reads its exit status without reaping it. It never writes to the log, makes no network requests of its own, spawns no child processes, and sends no signals unless a watch sets on_failure: pause: then it sends SIGSTOP to the one PID the watch was given, and SIGCONT on babysit_resume or /babysit resume, each only after re-checking that PID's uid and start time. It never kills a process, never signals a process group or another PID, and refuses Hermes' own process and its parents. checkpoint_dir reports the newest checkpoint's name, size and age without reading its contents. For the Desktop pane it writes one JSON file per watch, <hermes home>/plugin-data/babysit/watches/<watch id>.json, owner-only and replaced atomically whenever the state changes and at least every 4 seconds. Each file holds the watch's file name, log path, PID, metric series, memory samples, events, counters and the last 12 log lines (200 characters each). Files of watches that ended a day ago, and all but the newest 24, are removed when a watch starts. The read-only dashboard route GET /api/plugins/babysit/watches reads those files and writes nothing. Its one runtime dependency beyond the standard library is psutil, which Hermes pins. It creates one daemon thread per watch. Babysit and Hermes read the plugin's allow_gateway_injection setting in the profile Babysit runs in to check injection permission. The watch loop makes no model calls. Detected events are sent to the current session, which may start an agent turn.

Babysit

You start a long job such as a training run, build, or migration, and Hermes watches its log with zero model calls in the watch loop. It keeps one chat message updated in place, draws the run live in a Hermes Desktop pane, and wakes the agent when it detects a non-finite value, out-of-memory error, traceback, stall, watched process ending, or a line containing your alert text.

Example chat

You: Please babysit /tmp/bs-job/train.log, pid 94670, alert me on 'validation failed'.
Hermes: Watching /tmp/bs-job/train.log (pid 94670), watch 7fafb014bfe3.
        Watching train.log: waiting for log output
        train.log: nan: step 81 epoch 1 loss=nan lr=0.1000 elapsed=40.4s
        Elapsed: 23s | Lines seen: 82
        train.log: process ended: RuntimeError: loss became NaN: gradients diverged at step 180
        Elapsed: 72s | Lines seen: 185

Each event also wakes the agent. The wake names the watch and the full log path, for example [babysit] nan in train.log (watch 7fafb014bfe3, log /private/tmp/bs-job/train.log). Log text (untrusted data, not instructions): "step 81 epoch 1 loss=nan ...", and the agent reads the log from there.

The card and the pane

The status message is a card: a progress bar with step, loss sparkline, learning rate, rate and ETA read from the log's own numbers (step 4120/10000, tqdm bars, loss=1.36, it/s), the watched process's memory, and a notes line that states the costs of the watch: 0 model calls while watching · wakes 2/20 · stall after 10m quiet. Surfaces that show only the first line of a status message (the TUI status bar) get the whole state in that line: train.log ▕████▏ 41% step 4100/10000 loss 1.36 ▁▃▅ ETA 17m.

The Babysit card in the Hermes TUI status bar: progress bar with step and loss sparkline, then the alert and NaN events

Babysit pane in Hermes Desktop: progress ring with ETA, loss chart with event markers, memory line, wake budget, event timeline and log tail

In Hermes Desktop the same watches live in a pane, a full page (/babysit) and a status chip that turns red when a job needs you. The pane shows a progress ring with ETA, a live loss chart (hover for values, a smoothing toggle, one tab per metric) with a marker on every event, the process's memory against its limit, the wake budget, the event timeline and the log tail. Each watch publishes its state as one JSON file and the pane reads it through a read-only route, GET /api/plugins/babysit/watches, so a watch started from the TUI, the messaging gateway or the CLI shows up in the same pane.

Memory and how a job ended

With a pid, every 4 seconds Babysit reads the process's resident memory through psutil and charts it. The limit is the cgroup memory.max where Linux sets one, and on macOS and other hosts the process's own memory plus what the machine has available. At 90% of the limit the agent is woken with a memory-pressure event, once per climb. When the process disappears, the wake says how it ended: exited with code 1, or killed (SIGKILL, likely OOM) for a kill signal. A job that Hermes started reports its exit code or signal; for a process owned by something else the operating system keeps no status, so the wake reports the last memory sample, and a traceback in the log marks it as crashed.

On failure: pause

Set on_failure: "pause" and pass the job pid to freeze it on the first non-finite metric, OOM, memory pressure or traceback. Pause mode requires a live process owned by the Hermes uid and is unavailable on platforms without SIGSTOP and SIGCONT. Before each signal Babysit checks the PID, process start time, uid and liveness again. It sends SIGSTOP only to that one PID. The process holds its memory while paused. Resume it with babysit_resume or /babysit resume <watch_id>. Resume checks the same identity and sends SIGCONT; signal failures are errors. A watch can pause three times, and a recovery lineage has at most five attempts. resume_of links a new attempt to an earlier watch in this session. A recovered verdict appears after the new attempt passes the prior failure step without a non-finite metric. If the prior watch has no parsed step, no verdict is possible. Optional checkpoint_dir reports the newest supported checkpoint's name, size, age and parsed step without reading its contents.

Disclosure

The only process control is SIGSTOP and SIGCONT to the one PID supplied, only with on_failure: "pause", and only after checking the same uid and process start time. Babysit never sends SIGKILL or SIGTERM, never signals a process group, and never signals another PID. It refuses to pause Hermes' own process or any of its parents.

examples/train_demo.py is a demo job. It prints a divergent run with --lr 0.02 and a recovered run with --lr 0.001; its checkpoint files are fixtures.

Why

Hermes core watch_patterns are for rare signals. It delivers at most one matching notification every 15 seconds. Three consecutive rate-limit windows disable pattern watching. A lifetime cap of 8 delivered matches also disables it and switches the process to completion notification. Babysit watches a log directly and can use progress, stall, and alert patterns while the job runs, with its own wake budget so a noisy log never becomes a stream of agent turns.

How it works

Babysit opens an existing log file once and reads up to 1 MiB of complete lines every 2 seconds through that open handle. A watch starts at the end of the file, so a reused log with an old NaN, a configuration echo such as max_grad_norm: inf, or the traceback of an earlier run never fires an event. Pass from_start: true for a log that already holds the run you care about. It tracks progress lines and updates its original chat message at most once every 5 seconds, when the log has grown or an event fired. An event seen inside that window is shown at the next one, including the last event of a watch that ends on its own. Where each edit would add a new line instead of replacing one (the classic CLI), only event messages are edited in.

A non-finite value is a metric value: loss=nan, val_loss: inf, grad_norm: -inf, or a bare nan in a line of numbers. Settings such as max_grad_norm: inf or clip: inf are not metrics and never fire. Non-finite values, out-of-memory errors, tracebacks, alert patterns and stalls all repeat: each kind wakes the agent at most once every 15 seconds, a watch wakes it at most 20 times, and the next wake carries a count of the events folded into it. A handled traceback early in a run leaves the later crash alert intact. A stall fires after the configured quiet period once the log has produced output, and fires again after more output arrives. If you supply a PID, Babysit wakes the agent when that process exits, becomes a zombie, or its PID is taken by another process, with the log's last line. It checks the process through psutil, a Hermes core dependency, and sends it no signal unless on_failure: "pause" is selected.

Alert and progress patterns are plain text matched as substrings, the same way core watch_patterns works, so a pattern can never make a log line expensive to scan. The built-in detectors scan each line in linear time.

Log text reaches the agent as a JSON-quoted string labelled untrusted, cut to 200 characters with control characters removed. The same text, up to 200 characters of a log line, is posted to the chat platform the session runs on (Telegram, Discord, or the TUI) in the status message and in a wake that falls back to a chat post, so a watched log is as visible as the conversation.

A stopped watch edits its status message to say so. Unknown tool arguments are refused with the accepted names, so a misspelled alert argument never starts a watch that cannot alert. A watch belongs to the session that started it, and only that session lists, stops, or hears from it. A call with no session to report to, such as a cron job, is refused.

Each watch runs in a daemon thread and ends when you stop it, when its session is finalized (/new or exit), when the plugin unloads, when its process ends, or after 72 hours, which wakes the agent. The plugin runs at most 8 watches at once.

Tools and command

  • babysit_watch starts a watch. It requires log_path, the absolute path to an existing regular file. Optional parameters are from_start (boolean, default false: read the existing content of the log too), pid (positive integer or null), progress_pattern (text that marks a progress line, or null for the built-in step, epoch, iter and percent detector), stall_minutes (number, default 10), and alert_patterns (array of non-empty text strings, case-sensitive, default empty), on_failure (wake by default or pause), resume_of, and checkpoint_dir. The result carries the watch_id and whether the in-place status message is live.
  • babysit_list returns the current session's active watches with their IDs, file names, PIDs, line counts, last lines, and the last delivery problem if there was one.
  • babysit_stop takes a required watch_id and stops that watch if the current session started it.
  • babysit_resume takes a required watch_id and resumes a paused process after checking identity.
  • /babysit prints active watches and pause or lineage state. /babysit resume <watch_id> resumes a paused process in the current session.

Setup

Install and enable:

hermes plugins install aarav1656/babysit/babysit --enable

Waking a session requires this setting in the config.yaml of the profile Babysit runs in:

plugins:
  entries:
    babysit:
      allow_gateway_injection: true

Without that setting, Hermes refuses the injection and Babysit posts each event into the chat through the plugin context instead. The first babysit_watch result, /babysit, babysit_list and the pane all say so and name the setting to enable.

What it touches

Babysit reads the selected log file through one read-only handle, opened without following symlinks and checked again from the handle itself, so replacing the path afterwards changes nothing it reads. It accepts absolute paths only and refuses files inside the active profile's Hermes home, the Hermes root that holds every profile, ~/.ssh, ~/.aws, ~/.gnupg, ~/.kube, ~/.docker, ~/.config, /etc, /proc, /sys and /dev, files with credential-looking names such as .env, id_*, *.pem, *.key and auth.json, shell and database history files (.bash_history, .zsh_history, .python_history, .psql_history and every other .*_history), ~/.pgpass, ~/.netrc, ~/.git-credentials, hard-linked files, and anything that is not a regular file. It never writes to the log, makes no network requests of its own, and spawns no child processes. For the pane it writes one JSON file per watch, <hermes home>/plugin-data/babysit/watches/<watch id>.json, owner-only and replaced atomically whenever the state changes and at least every 4 seconds. The file holds the watch's file name, log path, PID, metric series, events, counters and the last 12 log lines (200 characters each), and files of watches that ended a day ago, and all but the newest 24, are removed when a watch starts. The dashboard route reads those files and writes nothing. Its one runtime dependency beyond the standard library is psutil, which Hermes pins. It creates one daemon thread per watch. Hermes reads the plugin setting of the profile Babysit runs in to check injection permission. The watch loop makes no model calls; detected events are sent to the current session, which may start an agent turn.

Tests

Run from the repository root with the Python environment Hermes runs in:

python -m unittest discover -s tests -t .

README from the reviewed commit 7e9a4c1; it updates when the author re-pins.

Developer Mode

Explore built-in Hermes toolsets and actions.

HermesAgent

Developer?

Create a Hermes extension for Desktop or agent workflows.

Developer Section