Free and open source · macOS 13+

Keep your Mac awake while AI agents work. Lid closed too.

Remote Control only works while your Mac is awake. Trinetra is a menu bar app that holds your MacBook awake exactly while Claude Code, Codex, Gemini CLI or Cursor is working, with the lid shut, on battery, then lets it sleep.

Works with Claude Code · Codex / ChatGPT · Gemini CLI · Cursor · any command

Awake when your agents need it. Asleep when they don't.

caffeinate and Amphetamine keep the Mac awake until you remember to stop them, and can't beat lid-close sleep on battery. Trinetra watches your agents instead.

👁

Agent-aware

Holds while an agent works, plus a 3-minute grace period. Nothing to turn off.

💻

Lid closed, on battery

A single-purpose helper you approve once. Normal sleep returns when the work ends.

🧭

Live agent list

Every session, its project and what it's doing: "Editing LidGuard.swift", "Waiting for your approval".

📝

Session summaries

Prompts, files edited, commands run, approvals and active time for each agent.

🔋

Battery saved

Time held awake, battery used, and an estimate of what sleeping right after the work saved.

📈

System monitor NEW

CPU, GPU, memory, temperature, power and network as live tiles, plus the CPU each agent is using.

🔔

Health alerts NEW

A notification when the Mac runs hot, throttles, or memory, disk or battery run low.

⏱

Timers and any command

30m to 4h or until you stop, and trinetra run -- ./build.sh for anything without hooks.

🛡

Safe by default

10 % battery floor, thermal cutout, 12 h cap, and a dead-man switch if the app goes quiet.

New: see what your Mac is doing while the lid is shut

Trinetra now has optional modules. The first two watch the Mac itself, so a closed MacBook running agents for hours never surprises you. Both are off until you switch them on, and a module that's off runs nothing.

  • System monitor: CPU per core, GPU, memory and pressure, temperatures, battery health and cycles, power draw, network and disk
  • CPU per agent, including the commands it started, right in the agent list
  • Menu bar readout: CPU, temperature, power, memory or network next to the eye
  • Health alerts at 90 % CPU for 2 minutes, 95 °C, thermal throttling, memory pressure, under 10 GB free disk, or 20 % battery
  • From the terminal too: trinetra stats and trinetra modules
$ trinetra modules enable system-monitor
System monitor: on. The app picks this up within a few seconds.
$ trinetra modules enable health-alerts
Health alerts: on. The app picks this up within a few seconds.

$ trinetra modules
Mac health
  system-monitor     on       CPU, GPU, memory, temperature,
                              battery, power and network
  health-alerts      on       A notification when the Mac
                              runs hot, memory or disk run
                              short, or battery gets low
# output wrapped to fit; later phases (clipboard history,
# window snapping, Finder cut and paste…) list as "phase N"

Set it up in 6 steps

Trinetra is built from source for now, so you need macOS 13 or later, Xcode 16 and a free Apple ID signing team. A notarized download is on the roadmap. The video below walks through every step, made with HyperFrames.

  1. Install the CLI

    Clones the repo and builds trinetra into ~/.local/bin.

    git clone https://github.com/animeshbasak/trinetra.git
    cd trinetra && scripts/install-cli.sh
  2. Connect your agents

    Adds Trinetra's hooks next to yours, after backing up each config. Codex asks you to trust new hooks once: run codex, then /hooks.

    trinetra hooks install claude
    trinetra hooks install codex
    trinetra hooks install gemini
    trinetra hooks install cursor
  3. Build the app and move it to Applications

    Open the project, pick your signing team on both targets and press Run. The helper registers reliably only from /Applications, so copy the build there.

    open Trinetra.xcodeproj
    pkill -x Trinetra; ditto ~/Library/Developer/Xcode/DerivedData/Trinetra-*/Build/Products/Debug/Trinetra.app /Applications/Trinetra.app && open /Applications/Trinetra.app
  4. Turn on lid mode

    Click the eye in the menu bar and switch on Keep awake with the lid closed.

  5. Allow the helper once

    In System Settings › General › Login Items › Allow in the Background, switch on Trinetra. It may be listed under your name. You never type a password per session.

  6. Turn on the monitor (optional)

    Switch modules on in the menu, or from the terminal. Allow notifications when macOS asks, so health alerts can reach you.

    trinetra modules enable system-monitor
    trinetra modules enable health-alerts

Built on your agents' own hooks

Each agent runs one tiny command at the moments that matter. It writes a line to a local file and exits 0 in milliseconds. It never blocks, never answers a permission prompt, never fails the agent.

# one command per agent, backs up your config first
trinetra hooks install claude
trinetra hooks install codex
trinetra hooks install gemini
trinetra hooks install cursor

# what each hook runs
trinetra hook claude working
  • Backs up first to <file>.trinetra.bak
  • Leaves your hooks alone. Only Trinetra's entries change
  • Idempotent, and uninstall removes every trace
  • No prompt text stored. Only labels like a file name
$ trinetra summary
Claude Code · trinetra · working
   6 prompts · 9 files edited · 14 commands · 42m active
   Edited AppModel.swift, MenuContent.swift +7 more
   Ran swift ×9, git ×4, xcodebuild
   Read 23 files · 4 searches · asked you 2×

Today: held awake 3h 10m over 4 holds, used 21 % battery
Slept 5h 40m as soon as work ended ≈ 34 % battery saved
AgentConfigWorkingWaiting for youIdle / ended
Claude Code~/.claude/settings.jsonUserPromptSubmit PreToolUseNotificationStop SessionEnd
Codex / ChatGPT~/.codex/hooks.jsonUserPromptSubmit PreToolUse PostToolUsePermissionRequestStop Interrupt SessionEnd
Gemini CLI~/.gemini/settings.jsonBeforeAgent BeforeTool AfterToolNotificationAfterAgent SessionEnd
Cursor~/.cursor/hooks.jsonbeforeSubmitPrompt afterFileEdit afterShellExecution–stop sessionEnd
WorkingHeld awake, lid closed too. Activity shown live.
WaitingHeld awake so you can approve from your phone.
IdleReleased after the 3-minute grace period.
EndedReleased. Summary kept for 24 hours.

Lid-closed mode without a sudoers rule

On battery, macOS sleeps on lid close no matter what. The only switch is pmset disablesleep, which needs root. Trinetra's helper exposes exactly that switch and nothing else.

What it is, why it exists, how it was made

What

A small macOS menu bar app and CLI that holds your Mac awake, lid closed included, exactly while your AI agents are working, then lets it sleep.

It also tells you what each agent did and what the Mac was doing while you were away.

Why

Remote Control lets you drive Claude Code or Codex from your phone, but only while the Mac is awake. Close the lid and the session dies.

caffeinate and Amphetamine don't know when your agents finish and can't stop lid-close sleep on battery. Some lid tools rely on a sudoers rule. I wanted something that watches the agents and holds the narrowest possible privilege.

How

Swift and SwiftUI, a pure, unit-tested decision function, the agents' own hooks, and a single-purpose root helper approved once through SMAppService.

Designed and directed by me, built with Claude Code: the same kind of agent Trinetra keeps awake.

The idea and the spike

Tested what actually keeps a MacBook awake. A power assertion, the thing caffeinate uses, holds idle sleep but not a closed lid on battery. Only pmset disablesleep does, and it needs root.

v0.1

Menu bar app with the animated third eye, Claude Code and Codex hooks, timers, trinetra run, and one pure Reconciler function that decides awake or asleep.

Lid mode done properly

Replaced an admin script with a signed helper: fixed pmset commands only, code-signature checked, reverts on disconnect and after 2 minutes without a heartbeat. Added Gemini CLI and Cursor, session summaries, the battery-saved estimate and CI on every push.

System monitor, health alerts, this site

Optional modules for CPU, GPU, heat, power and network with alerts, demos made with HyperFrames, and this page on its own subdomain.

~5,000lines of Swift
90unit tests, run in CI on every push
4coding agents supported
0telemetry, sudoers rules or passwords

What you get

Sessions that survive the walk away

Start a long task, close the lid, keep driving it from your phone. Remote Control and agent sessions stay alive.

Battery you don't waste

No "until I stop" guesswork. The Mac sleeps 3 minutes after the work ends, and Trinetra shows how much that saved.

Knowing what happened

Every session leaves a summary: prompts, files, commands, approvals, time. Open the menu and catch up in seconds.

No surprises in the bag

Heat, throttling, memory, disk and battery alerts, plus a battery floor and thermal cutout that can't be switched off.

Privilege you can audit

One root helper with four fixed methods, checked against the app's signature. It reverts on its own if anything goes wrong.

Private and open

No telemetry, no prompt text stored, MIT licensed. Read every line on GitHub.

FAQ

How do I keep my MacBook awake with the lid closed without an external display?

Turn on Keep awake with the lid closed in Trinetra and approve its helper once in System Settings › General › Login Items. While an agent is working or a timer runs, closing the lid won't sleep the Mac, on battery too. When the work ends, normal sleep comes back by itself.

Does Claude Code Remote Control keep working when I close the lid?

Only while the Mac is awake. A sleeping Mac drops the session. With lid mode on, Remote Control and similar sessions keep running with the lid shut while the agent works.

How is Trinetra different from Amphetamine, Caffeine or caffeinate?

Those keep the Mac awake until you stop them and can't block lid-close sleep on battery. Trinetra holds only while your agents are working, covers the lid, then releases, so it doesn't drain your battery overnight.

Is it safe to run a closed MacBook?

It uses power and makes heat. Use a hard, ventilated surface, never a closed bag. Trinetra's 10 % battery floor and thermal cutout can't be turned off.

What does the system monitor show, and does it cost battery?

CPU per core, GPU, memory and pressure, temperatures, battery health and power draw, network and disk, plus the CPU each agent uses. It samples every 10 seconds in the background and every 2 seconds while the menu is open or a menu bar readout is on. Switched off, it runs nothing.

Why build from source instead of downloading an app?

Shipping a ready-made download needs Apple notarization, which needs a paid developer account. Until then, the six steps above build it in Xcode with a free signing team.

Does Trinetra read my prompts or code?

No. Hooks record the agent, the project folder name, the state and a short label such as a file name. No telemetry, no network calls.

Made by Animesh Basak

Frontend engineer building AI tools in the open. Trinetra is one of the projects on my portfolio.