Let It Brew:让Mac保活跟着Agent走,先分清暂停与休眠
Let It Brew: Agent-Aware Mac Sleep and Power Rules
Let It Brew 让 Mac 的保活跟着 Agent 的实际任务走:有工作就阻止休眠,任务结束或触发电量、供电、热状态规则时撤掉保活。它适合“锁屏后让本地 Agent 继续干活”,但不是能暂停任意任务、再自动唤醒电脑的调度器。
项目 ruban-24/letitbrew 采用 Apache-2.0,要求 macOS 14+,支持 Apple silicon 与 Intel。此次固定版本 README 标注 1.0.1、build 46;我们检查源码,并直接运行核心决策函数的 15 项状态断言,没有安装后台服务或修改本机电源设置。
官方仓库:https://github.com/ruban-24/letitbrew 架构与安全模型:https://github.com/ruban-24/letitbrew/blob/main/docs/ARCHITECTURE.md 支持说明:https://github.com/ruban-24/letitbrew/blob/main/SUPPORT.md
这四个需求,它分别满足到哪一步?
| 需求 | 已有实现及边界 |
|---|---|
| 锁屏继续工作,结束后不再强行保活 | 支持已接入的本地 Agent;最后一个有效工作需求结束后释放保活,之后由系统与其他保活来源决定是否休眠 |
| 低电量时不再后台耗电 | 电池供电且电量小于或等于阈值时撤掉保活,源码默认 20%;不是向 Agent 发送暂停指令 |
| 按充电状态控制 | 可开启“仅接通电源时”规则;它判断电源来源,不等于电池必须正在增加电量 |
| 太热时暂停一下 | macOS 热压力达到 serious 或 critical 时撤掉保活;不读取可自定义的摄氏温度阈值,也不直接暂停进程 |
“自动随用随起”有两个层次。完成一次安装、接入和信任配置后,新任务的受支持事件可以自动取得保活,无需每次手动打开开关。但电脑已经睡着时,它不能保证自行唤醒系统、领取新任务并恢复任意中断作业。
同样,释放保活不等于立刻关机或立即进入睡眠。如果其他软件仍持有保活,或者用户正在操作,系统可能继续运行。任务恢复是否可靠,也取决于 Agent、网络连接及具体工具,不能从电源控制推出任务可断点续跑。

它怎样知道 Agent 正在干活?
核心来源是本地生命周期 hooks、插件或扩展,而不是只看一个进程是否存在。终端可以整晚开着,但 Agent 实际已完成;反过来,正在跑长命令的 Agent 可能没有新的输出。这正是“进程还在”和“任务还在做”不同的地方。
当前 README 列出九类接入:Claude Code、Codex、OpenCode、GitHub Copilot CLI、Pi、Cursor、Gemini CLI、Qwen Code 和 Kimi Code。支持本机的指定运行入口,不包括云端 Agent、另一台机器或 SSH 远程任务。
新装默认全部断开,开机启动也默认关闭。用户需在设置中启用想跟踪的 Agent;Codex 还要在 /hooks 中明确信任相应条目。一次性配置仍然存在,产品省掉的是后续每次任务都手动开保活的重复操作。
等待状态也不是所有 Agent 完全一致。当前文档明确说 Codex 与 Cursor 的批准等待仍保活,因为相应事件不能可靠区分手动等待与自动批准。部分其他 Agent 的等待可释放保活,获批后的命令运行还涉及进程组观察;不能笼统宣传“所有等确认都会立即休眠”。
源码还设有过期与监控租约兜底,避免丢失结束事件后永久保活。这些是有限的状态清理规则,既不是完整任务调度,也不能保证任何缺失 hook 都会被即时发现。
电量、接电与热规则怎样组合?
纯决策函数 decide 先检查安全条件,再考虑工作需求。读不到可信电源状态时,会拒绝继续持有保活,而不是猜测“已接电、100%”。开启仅接电规则后,任何电池电量都不能绕过它。
电池阈值使用小于或等于比较,默认 20% 时,20% 本身也触发释放;只有电池供电才用这条阈值。接通电源而电池只有 15%,默认规则仍允许工作,除非其他条件要求释放。是否接电与是否正在充电,不能混为一谈。
热状态来自 ProcessInfo.thermalState。fair 不会触发该热保护,serious 和 critical 会。它没有给出“CPU 到 85°C 暂停、降到 70°C 恢复”的温度控制器,因此要把这个功能称为热压力保护,而不是精确温控。
还有可选的“尊重低电量模式”。如果用户主动启用了系统低电量模式,可用它释放保活;但合盖工作时由 Let It Brew 自己设置的低电量模式有单独归属标记,避免刚保活就被自己的省电设置反向取消。

锁屏与合盖,为什么要分开验收?
锁屏不等于合盖,也不等于睡眠。开盖时,应用可以使用 macOS 电源 assertion 阻止闲置休眠,并允许屏幕单独休眠。合盖睡眠走不同路径,项目需要经过用户批准的特权后台服务,维护系统级 SleepDisabled 设置。
为了避免退出后留下系统改动,后台服务先记录原始值,再修改;最后一个持有者释放时恢复原值,并对异常退出、重启及恢复失败设置重试。合盖工作还可以启用低电量模式,并记录每种供电来源原来的模式用于恢复。这些是源码里的恢复设计,本次没有实测特权服务。
正常安装应使用官方签名、公证的包,并按文档放进 /Applications/Let It Brew.app,再批准后台活动。没有批准合盖服务,不等于普通开盖保活也完全不能使用。卸载也应走应用或官方说明,让电源设置与 Agent 接入先清理,再删除应用。
保活不是睡眠权限的唯一拥有者。尤其当开启可选提醒时,源码还可能为发送结束提醒短暂延后释放,最多 15 秒。对“完成后马上睡”的验收,应同时看实际 assertion、其他软件和通知设置,而非只看菜单上的一个状态。
我们实际验证了什么?
Mycelium Protocol 在提交 f609fbec6441fef9a19d771bd3fb0d185409486d 上,用 Apple Swift 6.3.3、macOS ARM 编译原始 LetItBrewCore,并把原始模块链接到一个独立的小测试程序。15 项合成状态断言全部通过:
- 工作会话保活;全部闲置或没有会话时释放;两个会话中仍有一个工作时保留。
- 电池 15% 和 20% 释放,21% 保留;接电且电池 15% 默认保留。
- 开启仅接电后,电池 90% 仍释放,接电 90% 保留。
- 热压力 serious/critical 释放,fair 保留;不可信电源状态释放。
- 没有正在执行的批准命令时,等待会话释放。
原仓库的 swift test 没有通过:本机环境报告找不到 Testing 模块,测试套件未能执行。因此上面 15 项来自我们直接调用原始纯函数的独立程序,不能写成“官方完整测试全部通过”。编译记录、源代码和输出均保留,未改动上游实现。
这次没有安装应用、注册守护服务、写入 hooks、执行 pmset 修改,也没有实际锁屏、合盖、放电、制造高温或测量耗电。纯决策正确不等于硬件行为、UI 接入或故障恢复已验收,更不能承诺节省了多少电。
与 Amphetamine 比,真正值得推荐的是什么?
不能说 Amphetamine 完全没有精细控制。它的 App Store 介绍明确列出自动触发、低电量结束会话、按应用运行保活等能力,Apple 的介绍也提到电量与接电相关自动化。两者都不是只有手动开关。
Let It Brew 更具体的差异,是把编码 Agent 的任务生命周期接进保活控制:工作、等待、结束、多个会话,以及电源与热规则共同决定是否持有保活。需要通用定时和触发的人仍可选择通用工具;长期跑受支持本地 Agent 的人,更值得试这个任务感知方案。
Amphetamine 官方介绍:https://apps.apple.com/us/app/amphetamine/id937984704 Apple 使用介绍:https://apps.apple.com/au/story/id1470456860

第一次试用,怎么确认它适合自己?
先用一个无副作用的短任务:确认菜单出现 Working,锁屏后让它正常结束,再检查最后一个会话是否释放保活。接着单独测试等待确认和并发会话,最后再按官方步骤测试合盖。不要一上来就把昂贵长任务当作第一次验收。
如果你的硬需求是“低电量保存检查点、暂停作业、冷却后自动唤醒继续”,还需要任务系统、应用级暂停接口与系统唤醒机制。Let It Brew 能管好自己是否阻止睡眠,这已经解决一个真实痛点,但不能替代这整条调度链。
常见问题
每次发任务都要手动打开吗?
完成接入且应用正在运行后,受支持任务事件会自动控制保活。新装默认不接任何 Agent,开机启动也需自行启用;Codex 的 hooks 信任步骤不能省略。
它能按具体温度暂停模型吗?
当前实现按 macOS 热压力等级释放保活,没有直接暂停模型进程,也不是可设置摄氏温度的控制器。
低电量后会自动保存任务、唤醒重跑吗?
没有这项通用保证。撤掉保活只是允许系统休眠,任务检查点、恢复和电脑从睡眠中唤醒需要另外的能力。
隐私说明:https://github.com/ruban-24/letitbrew/blob/main/docs/PRIVACY.md
默认不启用提醒;当前版本若配置手机提醒,会向 ntfy 发送提醒文字,可能含 Agent 与项目名,可开启隐藏项目名。核心会话处理在本地,不应把“没有遥测”扩写成启用所有功能后完全不联网;更新检查也访问 GitHub。
© 2026 Author: Mycelium Protocol. 本文采用 CC BY 4.0 授权——欢迎转载和引用,须注明作者姓名及原文链接,不得去除署名后以原创发布。
Let It Brew makes a Mac’s keep-awake hold follow actual coding-agent work. It releases that hold when work ends or a power, battery or thermal rule applies. This is useful for local agents working while the screen is locked; it is not a universal process-pausing and computer-waking scheduler.
ruban-24/letitbrew is Apache-2.0 software for macOS 14+, on Apple silicon and Intel. The pinned README identifies version 1.0.1, build 46. We reviewed source and ran 15 assertions against its original pure decision function, without installing the app or changing system power settings.
Repository: https://github.com/ruban-24/letitbrew Architecture: https://github.com/ruban-24/letitbrew/blob/main/docs/ARCHITECTURE.md Support: https://github.com/ruban-24/letitbrew/blob/main/SUPPORT.md
How closely does it meet the four requirements?
| Requirement | Implementation and boundary |
|---|---|
| Work while locked; stop keeping awake after completion | Supported local lifecycle events control its hold; releasing it allows normal sleep, rather than forcing sleep |
| Stop consuming battery below a floor | On battery, charge at or below the threshold releases the hold; default 20%, not a process-pause command |
| Work only with external power | Optional connected-power-only gate; external power is not the same as the battery actively charging |
| Pause when too hot | Serious or critical macOS thermal pressure releases the hold; no configurable degrees-Celsius controller or direct task suspension |
After one-time setup, supported work can automatically acquire a hold without a manual toggle per task. A sleeping computer cannot be assumed to wake itself, pick up a new task and resume arbitrary interrupted work. Other applications may also retain sleep assertions after Let It Brew releases its own.

How does it recognize real work?
It uses local lifecycle hooks, plugins or extensions rather than treating an open process as proof of ongoing work. A terminal can remain open after completion; long work can also be silent.
The current README lists nine integrations: Claude Code, Codex, OpenCode, GitHub Copilot CLI, Pi, Cursor, Gemini CLI, Qwen Code and Kimi Code. These are supported local entry points, not remote SSH sessions, cloud agents or another computer.
Fresh installations connect no agents and do not enable launch at login. Users must enable integrations; Codex additionally requires explicit trust through /hooks. These are one-time setup requirements, not a promise of zero configuration.
Waiting behavior differs. Codex and Cursor approval waits retain the hold because their events do not reliably distinguish manual waits from automatic approvals. Some other agents release during waits; detecting an approved running command also involves observing its process group. Missing events have stale-record and monitoring-lease backstops, not instantaneous universal recovery.
What do battery and thermal gates actually decide?
The pure decide function applies safety gates before active demand. Untrusted battery readings refuse a hold instead of pretending the Mac is plugged in at full charge. Connected-only mode releases on battery regardless of remaining charge.
The battery comparison is inclusive: default 20% releases at 20%, while 21% can still hold. This floor applies on battery; 15% while connected to power can still hold if no other rule blocks it.
Thermal control reads ProcessInfo.thermalState. Fair is permitted; serious and critical release. This is thermal-pressure protection, not an 85°C pause and 70°C resume controller. An optional setting respects user-selected Low Power Mode; Low Power Mode owned by Let It Brew for closed-lid work is distinguished so it does not cancel its own hold.

Why distinguish screen lock from closing the lid?
Locking, display sleep, system sleep and lid closure are different conditions. Open-lid operation uses macOS power assertions. Closed-lid operation needs an approved privileged background service managing the system-wide SleepDisabled setting.
The daemon records the exact baseline before changing it, restores it when the final holder releases, and reconciles outstanding restoration records after faults or reboot. Closed-lid Low Power Mode similarly records per-source settings for restoration. These are source-level mechanisms, not hardware recovery results measured here.
Use the official signed/notarized package and documented /Applications location. Approve background activity for closed-lid behavior. Uninstall through the app or the documented procedure so service, settings and integrations are cleaned up in order.
Releasing a hold does not override another application’s assertion. Optional phone alerts can also retain a previous hold briefly while a message is sent or dropped, up to 15 seconds. “Finished” is therefore not a guarantee of immediate system sleep.
What did we actually test?
At commit f609fbec6441fef9a19d771bd3fb0d185409486d, Mycelium Protocol built the original LetItBrewCore with Apple Swift 6.3.3 on macOS ARM, then linked that unchanged module to a separate assertion program. All 15 synthetic snapshot checks passed:
- Working holds; idle and absent sessions release; one remaining working session retains the hold.
- Battery charge 15% and 20% release, while 21% holds. Connected power at 15% holds by default.
- Connected-only mode releases at 90% on battery, and permits the hold at 90% on external power.
- Serious and critical thermal pressure release; fair permits; untrusted power readings release.
- A waiting session without a running approved command releases.
The original swift test suite did not run successfully: this environment reported a missing Testing module. The 15 checks are our direct calls into the original pure function, not a claim that the official suite passed. Source and outputs are preserved.
We did not install the app, register its service, change hooks or pmset settings, lock the screen, close a lid, discharge a battery, generate heat, or measure energy use. Pure logic checks do not validate hardware sleep behavior, live integrations, UI or fault recovery.
Is Amphetamine really missing all fine control?
No. Its App Store description already advertises automatic triggers, low-battery session termination and application-based holding. Apple also describes battery and external-power automation. It would be inaccurate to call it a manual-only switch.
Let It Brew’s more specific distinction is integrating supported coding-agent lifecycle states with power rules: actual work, waits, completion and concurrent sessions. General timers and triggers remain useful for other jobs; local agent work is the reason to evaluate this more specialized tool.
Amphetamine listing: https://apps.apple.com/us/app/amphetamine/id937984704 Apple overview: https://apps.apple.com/au/story/id1470456860

How should you try it?
Begin with a harmless short task. Confirm Working appears, lock the screen, let the task finish, and verify release after the final demand ends. Test approval waits and concurrent sessions separately before closed-lid operation.
If the requirement is to save checkpoints, suspend on low battery, wake after cooling and resume reliably, additional task and system scheduling mechanisms are needed. Managing whether this app prevents sleep is a narrower, useful responsibility.
FAQ
Is a manual toggle needed for every task?
Not after supported integrations are enabled and the app is running. Initial setup, login launch and agent trust still require attention.
Can it pause a model at a chosen temperature?
It releases its hold at serious or critical macOS thermal pressure. It does not directly suspend the model or expose a Celsius-based control loop.
Does it guarantee checkpointing and automatic wake-and-resume?
No. Releasing a hold only permits normal sleep. Saving progress, resuming tools and waking a sleeping computer need separate support.
Privacy: https://github.com/ruban-24/letitbrew/blob/main/docs/PRIVACY.md
Alerts are initially disabled. Configured phone alerts send text through ntfy and can include agent/project names; a setting hides project names. Local session handling and no telemetry do not mean every optional feature is offline. Update checks contact GitHub.
© 2026 Author: Mycelium Protocol. Licensed under CC BY 4.0 — free to share and adapt with attribution. You must credit the author and link to the original; removing attribution and republishing as original is not permitted.
关于本站 · 免责声明
🍄 Mushroom Research Blog 是非营利、免费公开的个人科技观察博客与公众号 XStack18,不接受商业合作、不代表任何企业或机构立场,也不谋求商业利益。我们以个人视角客观中立地记录和分析 AI、Web3 等领域的最新模型发布与技术动态——不止转述新闻标题或二手信息,而是给出有独立思考的深入分析,希望帮更多人获得有价值的一手科技认知。
⚠️ 文中介绍的开源代码与模型,仅供学习交流与技术借鉴。它们大多仍处于早期阶段,有待进一步研究和验证,请勿直接用于工作或生产环境;如需采用,请先自行充分测试,并核实其许可证与安全性。
Open-source code and models featured here are shared for learning and reference only. Most are early-stage and still need further study and verification — please don't use them directly in your work or in production. Test them thoroughly and check their licenses and security first.
- 本站文章均为作者基于公开信息的个人研究与观点整理,不代表文中提及的任何公司、产品、模型的官方立场,未与其构成商业关联或合作关系。
- 科技行业信息更新极快,我们尽力保证内容准确、及时,但不对完整性、实时性做绝对保证,具体请以相关企业/项目官方公告为准。
- 文中引用的第三方商标、产品名称、图片、数据等版权归原权利人所有,我们会尽量注明来源;如你认为存在版权疑问或侵权,请通过下方邮箱联系我们,收到通知后会尽快核实处理(更正、加注来源或删除)。
- 文章内容仅为技术科普与个人观点,不构成投资、法律或其他专业建议,据此进行任何决策的后果需自行判断和承担。
📮 侵权 / 勘误 / 合作咨询:[email protected]
💬 评论与讨论
使用 GitHub 账号登录后发表评论