Skip to content

v0.93.0 — /nice as a prefix

Choose a tag to compare

@ralyodio ralyodio released this 06 Sep 06:59
9d9e23c

/nice is a prefix now, which is what it should have been in 0.92.0 (#489).

/nice agents claude      # throttle this engine
/nice pnpm -r build      # …or this shell line
/nice merge              # …or any other pit command
/nice gs                 # …or one of your aliases

Why

0.92.0 shipped /nice as a toggle and nothing else. That was the weaker default. nice has always been a prefix — you put it in front of the one thing you want to yield — and a hidden global mode is not what anyone who has used it reaches for. If you have to remember you turned something on three hours ago to explain why an engine feels slow, the feature is working against you.

The toggle stays, because it is genuinely right for the other case: a box you share all day, where you would rather decide once and stop thinking about it. Both forms end in the same place, and a spawn does not need to know which one asked.

It runs anything the pit can already run

A pit command, an engine, a tool, one of your aliases, or a bare shell line. Not because there is a list of what qualifies, but because there isn't: /nice hands the rest of the line back to the top of the dispatcher, exactly as alias expansion already does. Anything the pit learns to run later is covered for free, and there is no roster to drift out of date.

The leading slash is optional, since the dispatcher strips one anyway. /nice agents claude and /nice /agents claude are the same line.

How long it lasts

Exactly as long as the line that asked for it. The next thing you type is back to normal.

That is scoped to the typed line, not to a command returning, which matters more than it sounds: one line can dispatch several times through alias expansion, and all of it is still the line you said to be nice. So /nice gs throttles whatever gs expands into, however many rounds that takes.

Two rules that are easy to get wrong and are tested:

  • A one-shot only ever adds. If you ran /nice on and then put a line through /nice, you do not silently get an unthrottled spawn out of it.
  • It keeps your levels. /nice cpu 3 followed by /nice pnpm build uses 3, not the default 10.

The one trade

The settings words — on, off, status, cpu, io, mem — and any leading flag keep the first position, so /nice on still means what it obviously means. The cost is that a program named on is not reachable through /nice. That is the right way round.

Everything from 0.92.0 is unchanged: real nice(1) and ionice(1), an optional systemd-run scope for the memory ceiling that nice cannot give you, and a clean no-op on a box that has none of them.