Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 4.48 KB

AGENTS.md

File metadata and controls

16 lines (13 loc) · 4.48 KB

Instructions for AI agents

This repository is the public core of Keep Mac Awake: the root helper and watchdog that change and restore the macOS SleepDisabled setting, their session and supervision logic, the restoration journal, the XPC protocol, the installer scripts and the recovery reader. The menu bar app, the per-user coordinator and the keepmacawake command are not here. The plugin for AI agents is in plugins/keep-mac-awake (an Agent Skill and a read-only session-start hook, under the MIT License), with the marketplace manifests in .claude-plugin/ (Claude Code, Codex, Copilot CLI) and .cursor-plugin/ (Cursor), the plugin's own manifests in plugins/keep-mac-awake/ (.claude-plugin/, .codex-plugin/, .cursor-plugin/, .antigravity-plugin/) and the Gemini CLI extension manifest gemini-extension.json at the root, which loads the skill as the extension's context. The MCP server for the same command is in mcp/ (Node.js, MIT, the npm package keepmacawake-mcp, with server.json for the MCP Registry and glama.json at the root).

  • Keeping a session alive that should continue comes first; restoring the sleep setting after any failure comes second; lightness third. Do not trade the first two for the third.
  • Never change power settings from a build, a test or a script. Tests use fakes; hardware checks are run by a person, on purpose.
  • The helper accepts only status, start, renew and stop, from a client whose code hash is in the root-owned trust file. Do not add commands, paths or arguments that the helper would run or open.
  • Everything is English. Plain Markdown, relative links, no U+2014 or U+2013 dashes. scripts/scan-public-content.sh must pass.
  • No network code. No logging of user activity.
  • The agent plugin and the MCP server only call the public keepmacawake command. The server has three tools (status, start, stop), no network code and no telemetry; test it with npm ci && npm test in mcp/, which uses a fake command. Keep version equal in mcp/package.json and mcp/server.json.
  • The agent plugin only calls the public keepmacawake command. Its hook stays read only: no network, no start, stop or settings change, and it never reads the user's prompts or files. Check it with claude plugin validate --strict plugins/keep-mac-awake and claude plugin validate --strict ..
  • The integrations in integrations/ (an Alfred workflow, Apple Shortcuts, a Hammerspoon Spoon, the Pi extension @keepmacawake/pi, the Python package keepmacawake and a JetBrains IDE plugin, MIT) only call the public keepmacawake command too, with start, status and stop. Their tests use a fake command and never run the real one: integrations/alfred/test.sh, integrations/shortcuts/test.sh, lua test.lua in integrations/hammerspoon, npm test in integrations/pi, python -m pytest in integrations/python and ./gradlew test in integrations/jetbrains. The Pi extension never starts a session without a time limit, ends a session only when the user runs /awake stop (the command has no session identity, so it cannot prove a session is its own), and leaves the first session on a Mac (which starts the free trial) to the user. The Python package never starts a session without a time limit, never searches PATH for the command, and ends a session only when the code calls stop(), uses %keepmacawake off, or sets stop_on_exit=True on a session() block that started it and whose session still has the same hours and end time. It never changes the battery settings; when Run on battery turned itself on (config.battery_chosen false) it warns that the session may run on battery, and its README tells an AI agent to ask the user first, the same rule as the MCP server. The JetBrains plugin ends only the session it started in the same IDE process, recognised by its hours and end time; any other session is left running. It never changes the battery settings, and while Run on battery turned itself on (config.battery_chosen false) it never starts a session without the user's yes: Start asks first, and its run hold starts nothing until that yes, the same rule as the MCP server.
  • Every commit here is an export from the maintainer's development tree. Do not commit, tag or push here by hand, and never force push: a change made here is lost at the next export.
  • Pull requests from others are not accepted for now; see CONTRIBUTING.md.

Start with README.md, docs/ARCHITECTURE.md and docs/FAILURE-MODES.md.