Background daemon¶
askshd is an optional local Unix-socket daemon that receives shell telemetry, runs background LLM tasks, and polls watched commands for failures.
Managing askshd¶
The daemon listens on ~/.local/share/asksh/askshd.sock (mode 0600) and writes its PID to ~/.local/share/asksh/askshd.pid. If the socket path exceeds 96 bytes (the Unix sun_path limit), asksh automatically falls back to /tmp/askshd-<uid>.sock.
To run the daemon in the foreground instead of detaching (for example under systemd or launchd), use asksh daemon serve.
Background tasks (asksh bg)¶
Queue a headless task to run in the background on askshd:
Pass --target <uri> to run against a remote host or container, or --dir <path> to set the working directory:
Background jobs use your config.toml, permissions.toml, skills, and memory settings, and persist job state to ~/.local/share/asksh/jobs/<job-id>.json.
Watching commands (asksh watch)¶
Poll a command on an interval and diagnose failures automatically when it breaks:
asksh watch --cmd "curl -fsS https://api.greendale.edu/health" --interval 30s --on-fail "check why the health endpoint failed"
Watch job behavior:
--intervaldefaults to5s(minimum1s).- Stdout and stderr from each tick are each capped at 64 KB.
- When diagnosis runs:
askshdinvokes the LLM whenever a watched command transitions from exit code0to non-zero. If you pass--on-fail <prompt>, it also diagnoses a failure on the very first check. Consecutive failures while already failing do not trigger repeated LLM calls until the command recovers to exit0and fails again.
Inspecting and cancelling jobs¶
asksh jobs logs <id> prints the job status, target, command or prompt, exit code, error, output, and any generated diagnosis.
Shell prompt badge¶
Run asksh prompt in your shell prompt configuration to display active background jobs, watches, and alerts:
Alerts count failed jobs and active watch jobs whose most recent exit code is non-zero. asksh prompt exits within 50ms and outputs nothing when askshd is stopped or all counts are zero. See Shell integration for zsh, bash, and fish snippets.