Skip to content

chore: install shelltime agy and cursor hooks - #98

Merged
AnnatarHe merged 1 commit into
mainfrom
chore/shelltime-hooks
Nov 27, 2026
Merged

AnnatarHe merged 1 commit into
mainfrom
chore/shelltime-hooks

Conversation

@AnnatarHe

@AnnatarHe AnnatarHe commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Install ShellTime hooks for Antigravity (.agents/hooks.json) and Cursor (.cursor/hooks.json).


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T17:23:21.948022Z f483f5a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread .agents/hooks.json
"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\"}'",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>'.

Comment thread .agents/hooks.json
],
"PostToolUse": [
{
"matcher": "*",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .cursor/hooks.json
"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}'"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .cursor/hooks.json
"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}'"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .cursor/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 '{}'"
}
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@AnnatarHe
AnnatarHe merged commit ecc2112 into main Nov 27, 2026
15 checks passed
@AnnatarHe
AnnatarHe deleted the chore/shelltime-hooks branch November 27, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant