Repository navigation
chore: install shelltime agy and cursor hooks - #98
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| "Stop": [ | ||
| { | ||
| "type": "command", | ||
| "command": "PATH=${PATH:+$PATH:}$HOME/.shelltime/bin:/opt/homebrew/bin:/usr/local/bin; command -v shelltime >/dev/null 2>&1 && command -v shelltime-daemon >/dev/null 2>&1 && out=$(shelltime hook-ingest --agent agy --event Stop --project) && printf '%s\\n' \"$out\" || echo '{\"decision\":\"allow\"}'", |
There was a problem hiding this comment.
Important: the Stop hook can emit a blank line instead of JSON. If shelltime hook-ingest exits 0 with empty stdout, printf '%s\n' "$out" prints just a newline. The || echo '{"decision":"allow"}' fallback only runs when the command fails, so a successful empty run gives the agent no valid decision payload. The same applies to every other command in this file and in .cursor/hooks.json; the cursor beforeSubmitPrompt hook, which expects {"continue":true}, is the riskiest. Fix: make the fallback depend on empty output, e.g. out=$(...) ; [ -n "$out" ] && printf '%s\n' "$out" || echo '<default>'.
| ], | ||
| "PostToolUse": [ | ||
| { | ||
| "matcher": "*", |
There was a problem hiding this comment.
Important: the hook schema is inconsistent in this file. PostToolUse uses the nested {matcher, hooks:[{type, command, timeout}]} form, while SessionStart, PreInvocation, PostInvocation and Stop use flat {type, command, timeout} entries. The top-level "shelltime" wrapper key is also unusual. If the agy loader expects one shape, the other events are silently ignored or the file is rejected. Fix: check this against the agy hooks schema and use one consistent shape, or document why the mix is intended.
| "hooks": { | ||
| "beforeSubmitPrompt": [ | ||
| { | ||
| "command": "PATH=${PATH:+$PATH:}$HOME/.shelltime/bin:/opt/homebrew/bin:/usr/local/bin; command -v shelltime >/dev/null 2>&1 && command -v shelltime-daemon >/dev/null 2>&1 && out=$(shelltime hook-ingest --agent cursor --event beforeSubmitPrompt --project) && printf '%s\\n' \"$out\" || echo '{\"continue\":true}'" |
There was a problem hiding this comment.
Nit (optional): unlike the agy hooks, none of the Cursor hooks set a timeout. Every prompt submit, tool use and stop synchronously runs a shell pipeline that calls shelltime hook-ingest. If the daemon hangs, beforeSubmitPrompt can stall the user's prompt until Cursor's default timeout. Fix: add an explicit short timeout, as .agents/hooks.json does with 15.
| "hooks": { | ||
| "beforeSubmitPrompt": [ | ||
| { | ||
| "command": "PATH=${PATH:+$PATH:}$HOME/.shelltime/bin:/opt/homebrew/bin:/usr/local/bin; command -v shelltime >/dev/null 2>&1 && command -v shelltime-daemon >/dev/null 2>&1 && out=$(shelltime hook-ingest --agent cursor --event beforeSubmitPrompt --project) && printf '%s\\n' \"$out\" || echo '{\"continue\":true}'" |
There was a problem hiding this comment.
Nit (optional): these hooks use --project and forward every prompt, tool call and response to the local shelltime daemon for every contributor who has shelltime installed. This is a public repository, and the command is repeated in about 12 places. A contributor who has shelltime installed gets their sessions in this repo tracked without opting in per repo. Fix: confirm this is intended for a public repo. Otherwise keep the hooks in user-level config, or gitignore .cursor/hooks.json and .agents/hooks.json.
| { | ||
| "command": "PATH=${PATH:+$PATH:}$HOME/.shelltime/bin:/opt/homebrew/bin:/usr/local/bin; command -v shelltime >/dev/null 2>&1 && command -v shelltime-daemon >/dev/null 2>&1 && out=$(shelltime hook-ingest --agent cursor --event sessionEnd --project) && printf '%s\\n' \"$out\" || echo '{}'" | ||
| } | ||
| ] |
There was a problem hiding this comment.
Nit (optional): the full hook shell pipeline is copy-pasted 12 times across the two files. The only differences are the agent, the event and the fallback payload. Any fix, such as to the PATH handling, has to be made in each copy, and the 12 copies can drift apart. Fix: call a small wrapper script, or let shelltime generate and own these files, and note in the repo docs that the files are generated.
Install ShellTime hooks for Antigravity (
.agents/hooks.json) and Cursor (.cursor/hooks.json).Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.