wingmirror Download
Docs Cursor

Docs · Agents

Connecting Cursor

This is a first version: it shows Cursor's sessions and what they are doing, and answers for them only as far as described below. It is written from Cursor's hooks reference and from reading the code of the Cursor that was installed on the Mac it was written on. No Cursor session has been run with it; see Status and known limits.

The Cursor lines are in the setup window and the menu only if the folder ~/.cursor exists. The connection is for the agent in the Cursor editor. Cursor's command line tool reads the same file, so its sessions can appear too, with less on the card (see below). Cursor's cloud agents do not read the file in your home folder and never appear.

What is written

Press Connect in the setup window, or choose Connect Cursor… in the menu and confirm. Wingmirror's entries are added to ~/.cursor/hooks.json, beside whatever is there. That file is shared: you and other tools write hooks in it, so only entries whose command names Wingmirror's script are ever added, replaced or removed, and they go after anyone else's. If there is no file one is made; "version": 1 is added if the file has none, because Cursor does not load a file without it.

Before every change a copy of the file is kept in Wingmirror's hooks folder, never in Cursor's. While connected the file is rewritten with its keys sorted, so its layout changes; nothing in it is lost. A file that is not valid JSON, or whose hooks is not laid out as Cursor reads it, is refused and left alone.

There is one entry for each of seven events. Each runs /bin/sh '~/Library/Application Support/Wingmirror/hooks/cursor-hook.sh' <path> (with the full path written out), which posts the event to http://127.0.0.1:7317/hooks/cursor/<path>, gives up after a second, prints nothing and always ends with status 0. Cursor is told to give each five seconds.

EventPathWhat it is for
sessionStartsession-startThe session appears, idle, with its project and model
sessionEndsession-endThe session is taken off the panel
beforeSubmitPromptpromptWorking when a prompt is sent
stopstopIdle when the turn ends, however it ended
preToolUsetool-startThe tool that is about to run, as the line that says what the session is doing
postToolUse, postToolUseFailuretool-doneThe tool that has just finished, whether it ran, failed or was refused

Cursor reads what a hook prints as its answer. Printing nothing is no answer, and Cursor goes on as if the hook were not there: that holds for beforeSubmitPrompt, which could stop a prompt, and for preToolUse, which could refuse a tool. Only output that is not the JSON Cursor expects, or an exit status of 2, refuses anything, and the script produces neither; if the script itself has gone, the shell ends with 127, which Cursor lets through. No entry sets failClosed.

Cursor refuses the whole file, everyone's hooks with it, if one event in it has a name it does not know. The seven names above, and the eighth below, are accepted by both the editor and the command line tool that were read.

What a Cursor card shows

A Cursor session shows from the moment its conversation is made, with its project (the first folder of the workspace), its model, whether it is running or idle, the tool it is running now and the last few it finished. A tool that Cursor marks as called by a subagent is shown on the helpers line, not as the session's own.

What it does not do:

  • It does not say when Cursor is waiting for you. Cursor has no event for its own approval prompt, so a card reads as running, with the command in hand, while Cursor waits at the keyboard. The card moves on when the tool finishes or is refused.
  • Approve and Deny only if you switch it on, only for risky shell commands, and Approve does not run anything. Tick Ask on the Panel Before Risky Commands under Cursor in the menu and an eighth entry is written, for beforeShellExecution, with a time limit of five minutes. Cursor runs that hook before every shell command and before its own rules; there is no event only for the commands it would have asked about. The bus answers at once with nothing, which leaves the command to Cursor, unless it looks destructive (the same fixed list as for GitHub Copilot: rm, sudo, git push, git reset --hard, --force, a deploy or a publish, and the like). Those wait up to five minutes for a tap. Deny refuses the command, and Cursor tells the session it was denied on the panel. Approve answers allow, which the Cursor that was read treats exactly as no answer: the command then goes to Cursor's own allowlist and run mode, which run it or ask again at the keyboard. So the card is badged Advisory approval: on the panel you can stop a risky command, not wave one through. With no answer, or with the app not running, nothing is printed and Cursor decides alone. Only shell commands are covered: not file edits, not file reads, not MCP tools. Keep Cursor's own settings as the real guard.
  • No context figure. No hook that is used carries one.
  • A session from the command line tool may show less. The one that was read (January 2026) sends the tool events and none for a session starting, a prompt, a turn ending or a session ending. Its card appears at the first tool, reads as running, and goes after ten minutes without a tool. A later one may send the rest.
  • Every open conversation may have a card. Cursor says a session starts when a conversation is made and ends when it is closed; whether a chat left open in a tab for days stays on the panel that long has not been seen. A session is kept through its silences until it says it has ended, or for a day without a word.
  • The Git widget does not follow Cursor sessions, and Terminal on a card brings a terminal app forward, which is not where an editor session lives.

Things to know about Cursor's side:

  • Cursor watches the file and reloads it when it changes; its reference says to restart Cursor if hooks do not load. Its reference asks for a trusted workspace only for a project's own hooks file, not for the one in the home folder. The Hooks tab in Customize and the Hooks output channel show what is loaded and what ran.
  • Cursor waits for each hook: with the app running every event costs it the few milliseconds the post takes, and with the app not running the post is refused at once.
  • What Cursor sends with each event includes the email address of the signed-in user and, after a tool, the tool's output. The bus reads neither. A capture folder set with WINGMIRROR_CAPTURE_DIR would hold both.
  • Cursor also loads Claude Code's hooks from ~/.claude/settings.json, unless that is switched off under Third-Party Imports in its settings. Wingmirror's Claude Code hooks are HTTP hooks, and Cursor takes only command and prompt hooks from that file, so they do not run from Cursor and a Cursor session does not also appear as a Claude Code one. That was read in the code of the editor and the command line tool, not watched.

Updating the Cursor connection

LineWhat to do
Cursor: ConnectedNothing.
Cursor: Connection Out of DateUpdate Cursor Connection…. Wingmirror's entries are not what this version writes: one is missing, they were left by another version, or the risky-commands entry does not match the menu. They are replaced; everything else in the file stays.
Cursor: Not ConnectedConnect Cursor…

The app does not ask about this when it opens; the menu line is where it shows. The script the hooks run is brought up to date by itself.

Disconnecting Cursor

Choose Disconnect Cursor. Wingmirror's entries are taken out, and an event that held only them goes too. If nothing else in the file has changed since Wingmirror connected, the file is put back byte for byte as it was found; if Wingmirror made the file and nothing else is in it, the file is deleted; otherwise it is written without Wingmirror's entries and everything else kept. From a terminal:

/Applications/Wingmirror.app/Contents/MacOS/Wingmirror hooks install cursor
/Applications/Wingmirror.app/Contents/MacOS/Wingmirror hooks uninstall cursor

With the app not running, Cursor behaves as if nothing were installed.

Edit source on GitHub README.md#connecting-cursor