KeySwitch · macOS · Open source

KeySwitch turns the Mac keyboard into a control layer for coding agents, modelled on Codex Micro controls. How it works, how it stays safe, and how it shipped.

When you run several coding agents at once, a lot of your time goes to small, repeated actions: switch to agent three, approve that command, reject this one, submit. Codex’s desktop app has Micro controls for exactly this, a compact layout of six agent keys, action keys like Approve and Reject, a stick, and a dial.

KeySwitch gives you that layout on the keyboard you already have. It is a native macOS menu-bar app, free and open source under the MIT licence, and its source is on GitHub (opens in a new tab).

How it feels

Hold Fn + Control and your keyboard becomes a control layer. Let go, and you are back to normal typing. The default mapping puts the controls where your hands already are:

  • 1 to 6 select agents one to six.
  • Q is fast mode, W approves, E rejects, and R forks.
  • Space is push to talk, and Right Command submits.
  • I, J, K, and L are the stick, and Tab, the backtick key, and Left Shift work the dial.

Every mapping and the activation shortcut can be changed, including a toggle mode instead of hold. While the layer is active, a frosted heads-up display shows the layout in the top-right corner of the screen. It never takes keyboard focus, so it cannot swallow your typing. A strip in the menu bar shows the state of all six agents, using shapes as well as colour so it still reads without colour perception.

How it works

KeySwitch is written in Swift and split into parts that can fail on their own without taking the others down. A keyboard engine owns the macOS event tap and the layer’s state machine: it recognises the activation shortcut, turns mapped keys into control presses, and stops those keys from reaching other apps while the layer is on.

A separate bridge talks to Codex. With your permission during setup, KeySwitch restarts the Codex desktop app with a debugging port on 127.0.0.1, connects to it, reads the Micro layout and the six agents’ states, and sends the same key, stick, and dial events Codex already understands. Which action each slot performs still comes from Codex. It is not a USB device emulator, just an adapter that speaks to the app on your own machine.

Built to fail safe

A tool that intercepts your keyboard has to be careful, so much of KeySwitch is about what happens when something goes wrong:

  • Escape always exits the layer unless you made it the activation key, and the layer also exits on its own after a period of inactivity.
  • The bridge connects only to the loopback address it was configured with, and rejects redirects, other hosts, and unexpected ports.
  • It is designed so that if Codex goes away, Codex actions stop working, but the keyboard is never left stuck in the layer.
  • Settings live in macOS’s standard preferences storage. There is no account, no keystroke history, and no analytics or telemetry.

KeySwitch needs the Accessibility permission to capture the keyboard, and its setup assistant walks through granting it. Release builds are signed and notarised by Apple, run on both Apple silicon and Intel Macs, and update themselves through Sparkle with signed update files.

How it shipped

KeySwitch 0.1.0 was released as open source on 7 August 2026. The following week was spent on the rough edges that only show up in real use, and the release history (opens in a new tab) shows fourteen releases between 7 and 15 August. Version 0.3.2 allowed any standard key, with or without modifiers, as the activation shortcut. Version 0.3.3, the latest, added a step to practise the shortcut during setup before connecting to Codex.

An honest caveat

KeySwitch is an independent, experimental project. It is not affiliated with or endorsed by OpenAI. Its Codex connection relies on desktop-app behaviour that is not a documented, stable API, so a Codex update can break it until KeySwitch catches up.

Try it

KeySwitch needs macOS 14 Sonoma or later and, for the Codex connection, the Codex desktop app. Download the universal installer (opens in a new tab), drag it to Applications, and the setup assistant takes it from there. There is an interactive showcase at mohit-patil.github.io/keyswitch (opens in a new tab), and issues and ideas are welcome on GitHub (opens in a new tab).

Keep reading