Sleep Inhibit
Prevent Linux sleep while OpenCode agents are working.
0
426
68 in 7 days
36.1
Multi-signal model
11 hours ago
2026-10-04
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-sleep-inhibit@2.0.1"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-sleep-inhibit@2.0.1"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-sleep-inhibitOpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
Prevent suspend and hibernation while OpenCode agents are working on Linux.
Long-running agents should not be interrupted because your laptop suspends. This plugin prevents sleep while OpenCode is busy, then restores normal power management when the work finishes.
It also covers subagents, retries, tool approvals, permissions, and questions waiting for your response.
Install
You need Linux with systemd and OpenCode 2.0.14 or newer. Add the package to your project or global OpenCode configuration:
{
"$schema": "https://opencode.ai/config.json",
"plugins": [
{
"package": "opencode-sleep-inhibit",
"options": { "mode": "sleep", "cooldownMinutes": 0 }
}
]
}
OpenCode installs and caches published packages automatically. Until the v2 release is published, use the path to a built checkout as package instead.
Choose a Mode
Allow locking (recommended)
"sleep" prevents suspend and hibernation while still allowing your screen to turn off and lock normally.
{ "mode": "sleep" }
Keep the screen awake
"sleep-and-idle" also asks your desktop to keep the screen on and unlocked. Only use this when leaving the computer unlocked is acceptable.
{ "mode": "sleep-and-idle" }
Support for idle inhibition depends on your desktop environment.
Keep It Awake After Work
By default, the inhibitor is released as soon as all agent work becomes idle. Set cooldownMinutes to keep the computer awake for a follow-up window:
{ "mode": "sleep", "cooldownMinutes": 60 }
New work during the cooldown cancels the pending release. The cooldown starts again when all work becomes idle. Keep the default value of 0 to release the inhibitor immediately.
Check It
While OpenCode is working, run:
systemd-inhibit --list
An OpenCode entry should appear while work is active and disappear after it finishes (or after the configured cooldown).
Development
bun install --frozen-lockfile
bun run check
bun run test
npm pack --dry-run
License
MIT
Similar plugins
Stay Awake
opencode-stay-awake
OpenCode v2 plugin that keeps your computer awake and blocks system sleep while any session is generating (macOS caffeinate, Linux systemd-inhibit)
Cursor To Opencode
@0ct0s3c/cursor-to-opencode
Use Cursor .cursor/rules in OpenCode with dynamic rule injection, diagnostics, and stats.
Goal
opencode-goal-plugin
Durable, guarded goal workflows for OpenCode.