A small CLI for running and managing long-lived background processes — like pueue plus per-process PTY attach, in a single static Go binary.
godo runs a command as a supervised background process that survives shell logout. Listing, restarting, stopping, and tailing logs all go through one local daemon over a Unix socket. The daemon auto-spawns the first time you run anything, so installation is just dropping the binary on $PATH.
v1 feature-complete on Linux and macOS. v2 (live job-to-job piping, remote / agent-oriented surfaces, ...) starts after a dogfooding window — see Roadmap.
Shell completions (installed automatically by the brew formula; manually otherwise):
godo completion zsh # also: bash, fish, powershell — pipe into your rcHomebrew (prebuilt binaries + shell completions installed):
brew install uhryniuk/tap/godoOne-liner (Go 1.25+ required):
go install github.com/uhryniuk/godo@latestThis fetches, builds, and drops godo into $GOPATH/bin (typically ~/go/bin). Make sure that's on your $PATH:
export PATH="$PATH:$(go env GOPATH)/bin"From source:
git clone https://github.com/uhryniuk/godo
cd godo
go install .# Run a command in the background. Returns the job id and pid.
godo sh -c "while true; do date; sleep 1; done"
# d2a91e0c pid=12345 sh -c while true; do date; sleep 1; done
# List everything the daemon knows about.
godo list
# ID NAME STATE PID UPTIME EXIT
# d2a91e0c sh -c while true; do date; sleep 1; done running 12345 4s -
# Tail the combined output (PTY merges stdout + stderr).
godo logs d2a91e0c
godo logs -f d2a91e0c # follow: replays + streams live; Ctrl+C to detach
# Drop into the job's PTY. Type to send to its stdin; see what it prints.
# Default detach is Ctrl+X then d (chosen to avoid tmux/screen/zellij mode
# prefixes). Override with $GODO_DETACH, e.g. GODO_DETACH="Ctrl+B,d" if you
# prefer the tmux convention.
godo attach d2a91e0c
# Attach is shared by default (like a tmux shared pane): a second client
# sees the same output and input interleaves — attach from two terminals
# and try it. `godo attach --steal` hands the session over instead:
# existing clients get a clean EOF and the job keeps running.
godo attach --steal d2a91e0c
# `godo list` shows an ATTACHED count per running job; the TUI marks
# attached jobs with ⏺. Set attach_steal = true in config.toml to make
# take-over the default.
# Stop, restart, remove.
godo stop d2a91e0c # SIGTERM, marks Cancelled
godo restart d2a91e0c # same hash, fresh PID
godo rm d2a91e0c # only when stopped; deletes the log dir
# (--force stops a running/paused job first)
# (--force stops a running/paused job first)
# Environment: jobs capture YOUR shell's environment at launch (sudo -E
# style) — not the daemon's stale env. Opt out with `--env-daemon` or
# `copy_env = false` in config.toml; `--env K=V` layers on top.
# godo does NOT shell-tokenize: don't quote the whole command.
# bad: godo "python3 -m http.server" ← passed as one filename, exec fails
# good: godo python3 -m http.server ← shell tokenizes, godo passes through
# good: godo sh -c "python3 -m http.server" ← when you need shell features
# Name an ad-hoc command — pass --name (or -n) BEFORE the command. Anything
# after the command name is passed to the child untouched, so a --name in
# the child's own args is preserved.
godo --name web sh -c "python3 -m http.server 8888"
godo rm web
# For richer flags (--restart / --nice / --env / --working-dir), use the
# explicit form — `--` separates godo flags from the child's:
godo run --name web --restart on-failure -- node server.js --port 8080
# Schedule the first start — the job sits pending until the time arrives.
# Survives daemon restarts; stop/rm cancels the schedule.
godo run --delay 30m --name nightly -- sh -c 'backup.sh'
godo run --at 03:00 --name backup -- backup.sh
# Then target by name:
godo stop web
godo logs -f web
# Start a registered service by name (service must exist in ~/.godo/services/):
godo start my-svc
# Scaffold a new declarative service file (opens it in $EDITOR):
godo template my-svc
# List all installed service files:
godo services # or: godo svc / godo svcs / godo service
# JSON output for scripting:
godo list -o json | jq '.[] | select(.state=="running") | .name'
# With CPU/memory for live jobs (sampled every 2s):
godo list --metrics
# Replace the running daemon with a freshly built godo (kills running jobs).
# Subsequent CLI calls also print a dim notice when the supervisor binary
# doesn't match the CLI build, prompting an upgrade.
godo upgrade
# Shut everything down (no respawn until the next godo invocation):
godo shutdownTargets accept either an exact name or a hash prefix.
CLI invocation Supervisor daemon (auto-spawned)
┌─────────────┐ Unix socket ┌──────────────────────────────┐
│ godo run … │ ─────────────────► │ accept → dispatch → respond │
└─────────────┘ length-prefixed │ │
JSON │ Registry Runner Reaper │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ registry.json /bin/sh ... │
│ │ PTY │
│ ▼ │
│ Multiplexer ────┐│
│ ├─► output.log ││
│ └─► logs -f tail││
└──────────────────────────────┘
- One daemon per user, listening on
~/.godo/state/godo.sock. - First
godoinvocation acquires a flock on~/.godo/state/godo.sock.lock, double-forksgodo supervisorwithSetsid, and polls until the socket is ready. Concurrent invocations spawn exactly one daemon. - Children run under a real PTY (
creack/pty) so jobs see a TTY, and stdout/stderr land in one combinedoutput.log. - The output Multiplexer fans PTY reads out to the log writer plus any active
logs -fandattachclients. The on-disk log writer uses backpressure — the log file is always complete, even under burst output — while live viewers use drop-on-full with a byte counter (surfaced vialist -o jsonand a footer onlogs -fexit) so a slow terminal never blocks the producer. - An InputMerger sits in front of the PTY master for the input direction. Today only
attachregisters a source; the v2godo pipewill register sending jobs as additional sources without touching the write path. - Daemon state persists to
~/.godo/state/registry.json(atomic write, corrupt-tolerant load) so a restarted daemon remembers what was previously running. Children themselves do not yet survive a daemon restart. - Logout-only by design: jobs survive your shell exit but are gone after a reboot. No system-level installation required.
| Command | Behavior |
|---|---|
godo [--name X] <cmd> [args...] |
Run <cmd> as a supervised job. --name/-n (before the command) labels the job for stop/rm/etc. Auto-spawns the daemon. |
godo list [-o table|json] / godo ls / godo ps |
Print all jobs as a table (default) or full JSON records. |
godo stop <id|name> |
SIGTERM the job's process group; sets cancelled. Sends SIGCONT first so paused jobs unfreeze and receive the signal. |
godo restart <id|name> |
Stop, wait for actual exit (escalating to SIGKILL after a grace window), then start again with the same spec and hash. |
godo pause <id|name> / godo resume <id|name> |
Freeze a running job (SIGSTOP) / continue a paused one (SIGCONT). The process holds its memory, fds, and ports while paused — handy for "let me check something" without losing state. |
godo rm <id|name> |
Drop a stopped job from the registry and delete its log dir. Refuses running/paused jobs; --force stops the live process first (TERM → KILL). |
godo logs <id|name> |
Print the job's combined output. |
godo logs -f <id|name> |
Stream the log: replays existing content then forwards live writes. |
godo attach <id|name> |
Take over the job's PTY. Default detach: Ctrl+X then d ($GODO_DETACH overrides). |
godo load <file.toml> |
Import a service file into ~/.godo/services/ and register it. |
godo reload |
Rescan ~/.godo/services/; new files autostart, removed files stop. |
godo start <name> |
Universal start: launches a registered service, or re-runs a finished job with its recorded spec (same hash, fresh run). Running/paused targets are refused — use godo restart. All job verbs (stop, restart, logs, attach, send, …) also accept service names. |
godo template <name> |
Scaffold ~/.godo/services/<name>.toml and open it in $EDITOR. --force overwrites; --no-edit skips the editor. |
godo services (aliases: svc, svcs, service) |
List all installed service files as a table showing command, autostart, restart policy, cron schedule, and parse status. |
godo wait <targets...> |
Block until jobs reach a terminal state. Exit 0 success / 1 failure / 124 timeout. --any returns on the first; --until "pattern" returns the moment the log matches (readiness check); --timeout accepts bare seconds. |
godo monit / godo -i |
Bubble Tea dashboard. j/k move, r restart, p pause/resume, K kill, d remove (confirm with y), Enter attaches a running job or opens the persisted log for a non-running one (j/k/g/G/PgUp/PgDn to scroll, q back). |
godo run [flags] -- <cmd>... |
Explicit form with flags (--name, --restart, --nice, --env). |
godo upgrade |
Stop the running supervisor so the next CLI call spawns the new binary. Lists running jobs that will die and prompts (--yes / --force). |
godo shutdown |
Tell the daemon to stop all children, persist state, and exit. |
godo version |
Print the daemon version and build SHA. |
godo daemon |
Run the supervisor in the foreground (debug / dev). |
The old top-level shutdown / upgrade / daemon spellings still work as
hidden deprecated aliases (notice on stderr; removal at v2.0).
Hidden: godo supervisor is the double-fork target invoked by auto-spawn;
godo daemon run --fg runs the supervisor in the foreground for debugging.
For long-lived workloads it's nicer to declare them than to remember the godo run … command line. Drop a TOML file in ~/.godo/services/ and the daemon picks it up on boot.
The fastest way to author one is godo template <name>, which writes a fully-commented starter and opens it in $EDITOR. The editor is resolved as $EDITOR → editor = "..." in ~/.godo/config.toml → vim.
# ~/.godo/services/web.toml
name = "web" # optional; defaults to filename without .toml
command = "node"
args = ["server.js"]
working_dir = "/srv/web"
autostart = true # start on daemon boot / reload
restart = "on-failure" # no | on-failure | always
nice = 5 # POSIX priority
[env]
PORT = "8080"
[cron] # optional
schedule = "0 4 * * *" # 5-field cron OR @hourly / @daily / @every 5m
overlap = false # default: skip a tick if a prior run is still activegodo load /path/to/file.toml imports a file from anywhere into the services dir (the destination basename is derived from name, so source paths from temp dirs / version control are normalized cleanly). godo reload rescans the dir and applies the diff:
- New file → registered, autostarted if flagged.
- Removed file → matching job is stopped (kept in the registry as
cancelledso logs are still readable;godo rmto drop). - Modified file → in-memory spec updated, but not auto-restarted. Run
godo restart <name>when you're ready for the new spec to take effect (matches systemd'sdaemon-reloadsemantics).
Service identity is the file path. A given file always maps to the same registry entry across daemon restarts, so log dirs and short hashes stay stable.
The supervisor process is the binary that was running when it first auto-spawned — installing a newer godo doesn't replace it in place. To pick up new behavior:
godo upgrade # confirms, lists jobs that'll die, shuts the daemon downThe next godo call auto-spawns the new binary. While the CLI and daemon disagree, every non-management godo command prints a dim one-line stderr notice with the two build hashes and a hint to run godo upgrade. Both sides identify themselves by vcs.revision (with a +dirty suffix when the working tree was modified at build time), so locally hacked binaries don't accidentally compare equal to their parent commit.
Service files can declare a schedule and the daemon's internal scheduler fires the command on each tick. Each fire creates a fresh registry entry named <service>@<unix-second> so multiple runs don't collide. By default overlap = false suppresses a new tick if the previous instance is still running — bump to true for fan-out workloads.
# ~/.godo/services/cleanup.toml
name = "cleanup"
command = "/usr/local/bin/prune-old-logs"
[cron]
schedule = "0 3 * * *" # 3am every day@every 30s, @hourly, and @daily work too.
Services can wait on each other:
# ~/.godo/services/db.toml — an init-style migration job
name = "db"
command = "flyway"
args = ["migrate"]
autostart = true# ~/.godo/services/web.toml
name = "web"
command = "node"
args = ["server.js"]
autostart = true
depends_on = ["db"]
depends_conditions = { db = "exited" } # started (default) | healthy | exited
[health]
log = "Listening on" # or tcp = "127.0.0.1:3000"
timeout_secs = 30A dependent with unmet dependencies sits pending with
blocked_on: db in godo list until every dependency satisfies its
condition; the daemon re-checks twice a second and promotes it
automatically. godo service up starts services plus their whole
dependency graph; godo service down [names] stops in reverse order
(dependents before dependencies). Unknown dependencies, cycles, and
probe-less [health] tables are reported by godo service ls and at
boot.
Ad-hoc jobs capture the launching shell's environment at godo run
time (like sudo -E / pueue) — so export API_KEY=… && godo python job.py
just works, even if the daemon was spawned days ago from another shell.
--env K=V layers on top; --env-daemon (or copy_env = false in
config.toml) restores the legacy daemon-environment behavior. The recorded
environment is stored with the job, so restarts are deterministic — edit a
service file and godo restart to refresh a service's env. Shell function
exports and >64 KiB variables are scrubbed; the snapshot caps at 256 KiB.
Jobs with a restart policy don't respawn in a tight loop when they keep
crashing. After each consecutive fast failure the next attempt is delayed
by 100ms → 500ms → 2.5s → 12.5s → 30s (±20% jitter so crash loops don't
synchronize). The streak resets once a job stays up for
backoff_reset_secs, and a manual godo restart always clears it.
After restart_max consecutive failures (default 20) the daemon gives up
and marks the job restarts_exhausted — it stays failed until you restart
it. Both knobs live in ~/.godo/config.toml:
restart_max = 20 # auto-restart budget (0 = default, <0 = unlimited)
backoff_reset_secs = 60 # stable-run time that resets the failure streak
attach_replay_lines = 1000 # history replayed on attach / TUI log viewer (0 = unlimited)godo list -o json exposes fail_streak and restarts_exhausted.
Ad-hoc jobs can be scheduled (godo run --delay 30m … or --at HH:MM /
RFC3339) — the job sits pending with a WHEN column in godo list until its
time arrives; the schedule survives daemon restarts, and stop/rm cancels
it. godo wait makes godo scriptable end-to-end:
godo run --name etl ./etl.sh
godo wait etl --timeout 1h && godo run --name load ./load.sh
# readiness: return the moment the server logs its listening line
godo wait srv --until "Listening on" --timeout 30The daemon can run commands when jobs reach a terminal state — desktop notifications, webhooks, incident tickets:
# ~/.godo/config.toml (global)
[hooks]
on_exit = "~/bin/notify-godo %n %s %e" # every terminal state
on_fail = "osascript -e 'display notification "%n failed (%e)" with title "godo"'"
on_success = "~/bin/backup-ok %n"
only_final = true # skip while a restart policy is respawning (default true)# ~/.godo/services/backup.toml (per-service overrides the global hook)
[hooks]
on_success = "~/bin/backup-ok %n"Tokens: %n name, %h short hash, %e exit code, %s state, %L log
path — the same values export as GODO_JOB_NAME, GODO_JOB_HASH,
GODO_EXIT_CODE, GODO_STATE, GODO_LOG_PATH. Hooks run via sh -c
with a 10s timeout; failures are logged, never fatal. With
only_final = true a crash-looping job notifies once (at backoff
exhaustion) instead of once per crash. godo stop fires on_exit but
never on_fail.
Every cron fire creates a new registry entry, and finished jobs accumulate —
without limits, godo list drowns and registry.json grows forever. The
[retention] config above bounds it: cron-fired history is capped by default
(keep 500, drop after 14 days); ad-hoc jobs are only swept if you set
max_jobs / max_age_days. Running, paused, and pending jobs are never
touched. A boot-time orphan sweep also deletes hash-named log dirs whose
registry entry is gone.
godo prune reports what would go (dry run by default); godo prune --apply
executes. godo list shows live jobs plus the 20 newest finished ones —
godo list -a shows everything, and -o json is always complete for
scripting.
godo is built for the pair: an agent starts and drives background work;
a human attaches interactively whenever they want. The whole loop is
documented in docs/AGENT_WORKFLOW.md and verified
end-to-end by docs/verify_agent_workflow.sh:
# agent (no TTY needed) # human (TTY)
godo run --name srv ./server.sh godo attach srv
godo wait srv --until "Listening" godo send srv "answer" # agent
godo send srv "y" godo monit # ⏺ = attached
godo wait srv --timeout 5mv1.x is feature-complete and hardened. What's next lives in docs/ROADMAP_V2.md — the full design doc with prior art, tradeoffs, and an implementation plan for:
- v1.6 candidates (small, no decisions needed): log rotation, Homebrew tap
- shell completions, process-tree metrics, real ionice
- v2 bets (need a scope decision after the dogfooding window): queue semantics (#18), `godo pipe` live job-to-job piping, remote daemon access (TLS + shared secret), live upgrade preserving running jobs
- v2.0: removal of the deprecated command aliases (RFC #13 migration end)
Design questions or feedback from dogfooding → open an issue referencing the relevant ROADMAP_V2 section.
~/.godo/
├── config.toml # user-level defaults (Step 7)
├── services/ # one declarative service per file (Step 7)
└── state/
├── godo.sock # daemon listener
├── godo.sock.lock # auto-spawn flock
├── registry.json # snapshotted registry
└── <hash>/
└── output.log # PTY-merged stdout + stderr
go test -race ./... # unit + functional, with race detector
go vet ./...
gofmt -l . # exits clean if everything is formattedCI on push runs all four on Linux + macOS. See .github/workflows/test.yml.