All pages

Autonomy you can trust · Lesson 2.1 · 12 min

Lock the Mac and walk away

The agent lock, keeping the Mac awake, and approving from your phone.

After this lesson you can leave an agent running on your Mac with the screen covered and the keyboard dead to anyone but you, the Mac kept awake for as long as the work needs, and the agent's questions arriving on your phone.

Time: 12 minutes · Works on: macOS app, with the iPhone app for approvals.

What goes wrong when you leave

An unattended run fails in a small number of predictable ways. Plan for each before you get up, not after you come back.

  1. Someone touches the machine. A colleague, a cat or a cleaner presses a key in the pane the agent is typing into, or closes a window mid-run.
  2. The Mac sleeps. The run stops halfway, often in a state that's worse than not starting.
  3. The agent waits for an answer nobody gives. It reaches a tool that needs approval, and the run sits there until you're back. Or the request times out and is denied, and the agent works around the refusal in a way you didn't intend.
  4. The agent does something you would have stopped. You weren't there to see the card.

The first two are about the machine. The last two are about the decisions you'd normally make at the desk. Deal with the decisions first, because they're what makes a run safe, not just uninterrupted.

Decide before you leave, not while you're away

The best unattended run asks you nothing. Get there by moving decisions to the start:

  • Narrow the task so it fits one worktree and one clear finish line, such as "the test suite passes" or "a pull request is open."
  • Write the rules up front. Approve the commands you know it will need as standing rules, scoped to the worktree's folder. Anything not covered will still ask, and that's correct.
  • Name the stop conditions in the brief. "If a migration fails, stop and write down why. Don't retry it with different flags."
  • Keep the phone as a fallback, for the one or two things you couldn't foresee, not as the main way decisions get made.

A worked example

It's 6 pm. You want the agent to upgrade a dependency across a monorepo, fix what breaks and run the full suite, which takes about forty minutes.

  1. You create a worktree for the upgrade, so nothing touches your main checkout.
  2. You approve the package manager and test commands as standing rules for that folder, and leave git push asking.
  3. The brief ends: "When the suite passes, commit and stop. Don't push. If it's still failing after three attempts at the same test, stop and summarise."
  4. You make sure your phone will get approval requests, start the run, check the first few tool calls look right, and lock the desktop.
  5. On the train, your phone shows a card asking to run a command that deletes a cache folder. You read it, approve it, and the run carries on.
  6. At home you get a notification that the pane went quiet. In the morning you unlock with Touch ID and read the commit.

Do it in TRMNLY

  1. Grant the permissions once. The agent lock needs Accessibility and Input Monitoring. If either is missing when you arm it, an alert says so, with Open Accessibility… and Open Input Monitoring… buttons that take you to System Settings. Grant Accessibility before a long run in any case: without it, the lock's stuck-state rescue can notice clicks but not keystrokes.
  2. Keep the Mac awake for the right reasons. In Settings → General → Sleep, leave Keep Mac awake while tasks are running on. It holds the Mac awake while a command runs in any pane or the in-app agent is on a turn, and lets go when they finish. Keep Mac awake while a prompt queue is draining covers the gaps in an overnight queue. Neither stops the lid from sleeping the Mac, so leave the lid open or use an external display on power.
  3. Check who is holding it awake. Open the Jobs tab in the right sidebar. The Awake monitor below the job list shows each reason the Mac is being kept awake and for how long, with a Stop button per row. The agent can also hold its own claim with awake_acquire, which takes a reason, and give it back with awake_release.
  4. Send the agent's approvals to your phone. Pair the iPhone app first (see The iPhone remote). Then open Settings → AI Agent → Remote Control and find Push sidebar approvals to the phone. The default, When away, pushes once the Mac has had no input for two minutes or its screen is locked. Set it to Always for the length of an unattended run, so you never have to wonder. Requests from MCP clients such as Claude Code always go to the phone.
  5. Arm the lock. At the bottom of the left sidebar's rail, click the lock button. Its tooltip reads Lock Desktop — block physical input while the agent runs. An overlay covers every display, and keyboard, mouse, trackpad and system shortcuts such as ⌘⇥ and ⌘Q are dropped before they reach any app. The agent's own synthetic clicks and keystrokes still pass. Arming is refused while VoiceOver or Switch Control is on, because those could route around the block.
  6. Know what the lock doesn't do. It doesn't stop the agent. It stays on until you unlock it, whether the run finished an hour ago or not. While it's armed, nobody can click an approval card on the Mac, including you, which is why step 4 comes first. The panic key ⇧⌘., which locks the agent, is a different thing.
  7. Answer from the phone. A card on the phone's Now tab, or a notification when the app is closed, shows a safety badge (Read-only, Writes or Dangerous), who asked, and the arguments. A file edit shows the diff. Choose Approve or Deny. Allow for 15 min covers similar calls from that phone in that project for 15 minutes, asks for Face ID, and is never offered for a dangerous tool. A request from an MCP client that nobody answers is denied after two minutes.
  8. Get told when it's done. In the phone's Terminal tab, point it at the pane doing the work and tap the bell in the toolbar. You're notified when the pane goes quiet or its command finishes. A watch fires once and lapses after 24 hours. Now also has Keep awake, which holds the Mac awake for 1 hour or 4 hours from the phone.
  9. Unlock when you're back. Click the overlay's unlock button or press any key, then use your Mac password or Touch ID. If the system prompt doesn't appear, press Esc to type your password into the overlay itself.
  10. Trust the fail-safes, and know their edges. If TRMNLY crashes or is force-quit while the lock is armed, a separate watchdog process locks the real macOS screen. Sleeping the Mac or locking the session disarms the agent lock, because macOS's own login screen then stands in for it. Re-arm it after wake if the run is still going. The lock is a deterrent against casual hands, not protection from someone with a power button and time.

Check yourself

  • You armed the lock, confirmed a key press did nothing in the pane, and unlocked with Touch ID or your password.
  • The Awake monitor in the Jobs tab listed a running command as a reason, and the row went away when the command finished.
  • Push sidebar approvals to the phone is set the way you want it for unattended runs.
  • You approved one agent request from the phone while away from the Mac.

Go further