Track Cursor and Antigravity with ShellTime
Cursor and Google Antigravity have no OpenTelemetry export, so ShellTime reads their hooks. Add them to a repository and every session shows up, cloud agents too.
ShellTime tracks Claude Code and Codex through the OpenTelemetry data they export. Cursor and Google Antigravity export none, so ShellTime reads their hooks instead: small commands the agent runs at each step of a session, with the step's details as JSON. Each agent then gets its own page under Coding Agent: sessions, prompts, tool calls, failed tool calls and file edits per day, the tools the agent used most, and every session's timeline.
Hooks don't see tokens or cost, so those two stay with Claude Code and Codex.
How it works
The hooks live in your repository: .cursor/hooks.json for Cursor and .agents/hooks.json for Antigravity, both at the repository's root. That is the file the agents' cloud runs read too. Cursor Cloud Agents never read your home folder's ~/.cursor/hooks.json, and Antigravity runs a workspace's hooks ahead of its global ones. So you add them per repository and commit the file.
Each hook is one shell command, the same on every machine that checks the repository out:
- Where the
shelltimeCLI andshelltime-daemonare installed, it hands the event to ShellTime, which records it on that machine's ShellTime account. - Anywhere else it just answers the agent and exits. A teammate without ShellTime sees no failing hooks, and nothing is recorded for them.
The hooks need macOS or Linux, where the ShellTime daemon runs.
The hooks never block, deny or change anything the agent does. They read the agent's prompts, replies and tool calls, but never a tool's output.
Set it up
- Install ShellTime
If you don't have ShellTime yet, install the CLI and run
shelltime init. It signs you in and starts the daemon, which sends events in batches.bash curl -sSL https://shelltime.xyz/i | bash shelltime initAlready have it? Update first, since adding the hooks to a repository needs a recent CLI:
bash shelltime update - Add the hooks to your repository
In the repository you use the agent in, run the command for it. Any folder inside the repository works: the hooks go to its root.
bash shelltime cursor install # Cursor: the IDE, cursor-agent and Cloud Agents shelltime agy install # Antigravity: the app, the agy CLI and its sandboxYour other hooks in the file stay as they are. If an older ShellTime version installed hooks in
~/.cursor/hooks.jsonor~/.gemini/config/hooks.json, they stay and keep tracking your other folders; the repository's hooks leave events to them, so nothing is counted twice.shelltime cursor uninstall(oragy uninstall) removes both. - Commit the hook file
bash git add .cursor/hooks.json .agents/hooks.json git commit -m "chore: track Cursor and Antigravity with ShellTime"Committing it is what lets the agents' cloud runs find it. Teammates who use ShellTime get their own sessions on their own accounts, and for everyone else nothing changes.
- Restart the agent and use it
Restart Cursor (the IDE and any running
cursor-agent) or Antigravity (the app and any runningagy), then work as usual. Within a few seconds of your first prompt, the session shows up under Coding Agent in ShellTime, on the Cursor or Antigravity tab.
Cursor Cloud Agents
Cloud Agents run in a virtual machine Cursor hosts, and they pick up the committed .cursor/hooks.json from the repository by themselves. The machine needs ShellTime too, set up in the cloud agent's environment (see Cursor's Cloud Environment Setup):
-
Add two secrets, which Cursor passes to the agent as environment variables:
SHELLTIME_TOKEN: an API token from ShellTime, created for this environment alone so you can revoke it on its own.SHELLTIME_CLOUD:true. It marks every event from this machine as a cloud session, and keeps ShellTime from recording anything else about the machine.
-
Install ShellTime in the environment's install step:
bash curl -sSL https://shelltime.xyz/i | bash -
Sign in and start the daemon each time the machine starts, in the environment's start step:
bash ~/.shelltime/bin/shelltime auth --token "$SHELLTIME_TOKEN" nohup ~/.shelltime/bin/shelltime-daemon >/dev/null 2>&1 &
Cloud agents sometimes start with a few read-only turns while they explore, and Cursor runs no hooks during those, so a session's first moments may be missing. Without SHELLTIME_CLOUD, ShellTime still marks a Cloud Agent's session as cloud when Cursor's session start says it is a background agent, but only the variable marks every event.
The Antigravity agent in the Gemini API
The Antigravity agent you run through the Gemini API works in a sandbox that reads .agents/hooks.json from the repository it mounts. ShellTime recognizes the sandbox by the user it runs as, antigravity, and marks its sessions as cloud sessions without any variable.
The sandbox needs ShellTime installed, signed in and its daemon running, with the same commands as above. Pass your token in the environment's variables as SHELLTIME_TOKEN, and reuse the environment by its id so the installed CLI stays in place between interactions.
What the hooks send
For each event: its type and time, the session, the workspace folder and its git repository, the machine and the model. For prompts and replies, their text. For tool calls, the tool's name and input, the shell command or file path, the result, how long it took and any error. Never a tool's output.
Your exclude patterns and data masking apply. To keep the text of prompts, replies, tool input and errors out, and send only the activity:
shelltime config disable agentHooks.sendContentNothing showing up?
- Run
shelltime doctorin the repository. It checks the repository's hook file and that the hooks can find bothshelltimeandshelltime-daemon, on your PATH or in~/.shelltime/bin,/opt/homebrew/binor/usr/local/bin. If they can't, the hooks skip every event on that machine. - Restart the agent. A running Cursor or Antigravity keeps the hooks it loaded.
- Is the daemon running? Events wait in
~/.shelltime/agent-hooks.pending.jsonlwhile it isn't, and go out once it runs again. - Cloud runs need the file in the repository. A hook file that isn't committed and pushed doesn't reach a Cloud Agent or a sandbox.
Questions or ideas? Email us at [email protected].
- #cursor
- #antigravity
- #cloud
- #getting-started
Start tracking in a minute
Install the ShellTime CLI to see your shell commands, AI coding sessions and editor time in one place.
Install ShellTime