Sleep mode
Long Magic Coder sessions can run for tens of minutes — sometimes hours — without you actively typing. Most operating systems would happily put your machine to sleep in that window, which would interrupt the agent. Magic Coder handles this with a small sleep mode setting that controls when the system is allowed to sleep.
The three modes
Section titled “The three modes”| Value | What it does |
|---|---|
no | Never inhibit sleep. The OS handles sleep on its normal schedule. |
auto (default) | Inhibit sleep only while the agent is actively working. Idle conversations don’t keep your machine awake. |
always | Inhibit sleep for the entire duration of the Magic Coder session. The machine stays awake until you exit. |
auto is the right default for almost everyone. The machine stays awake when work is in progress and goes to sleep normally when nothing is happening.
Configuring it
Section titled “Configuring it”Edit ~/.magic/config.toml:
[generation]sleep_mode = "auto"Replace "auto" with "no" or "always" as needed.
When to choose each mode
Section titled “When to choose each mode”auto (the default)
You want the agent to finish long-running tasks reliably, but you want your machine to suspend when there’s nothing to do. This is the right answer most of the time.
always
You’re running an unattended session — --automagic overnight, a benchmark, a long evaluation — and you’d rather the machine stay awake the whole time than risk a sleep at a moment Magic Coder thinks is “idle.” Or you’re on a desktop machine where sleep doesn’t matter to you anyway.
no
You don’t want Magic Coder messing with your power management at all. Maybe you’ve got a separate process keeping the machine awake, or you’re on hardware where sleep inhibition is unreliable. Magic Coder gets out of the way.
How sleep inhibition works
Section titled “How sleep inhibition works”Magic Coder uses the cross-platform keepawake crate to ask the OS to stay awake. It registers as app Magic Coder with the reason Generating a response (so it shows up that way in pmset -g on macOS, in systemd-inhibit --list on Linux, etc.). Both display sleep and system sleep are inhibited while the assertion is active.
If the underlying OS API isn’t available, sleep inhibition is a no-op — the setting still parses, it just doesn’t do anything. Magic Coder won’t crash on a system without inhibition support; it logs a warning and moves on.
When sleep mode does not matter
Section titled “When sleep mode does not matter”- During interactive idle time, in
automode — your machine sleeps normally. - During headless runs that complete quickly — there’s no time for sleep to kick in.
- If your system has sleep already disabled at the OS level — Magic Coder doesn’t second-guess it.
Verifying
Section titled “Verifying”You can check what mode Magic Coder thinks it’s in by looking at ~/.magic/config.toml. If the key isn’t set, the default (auto) is used.
There’s no slash command to toggle sleep mode mid-session today; edit the config file and start a fresh session if you need a different mode.