Skip to content

chore(agents): install shelltime hooks for agy and cursor - #23

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

AnnatarHe merged 1 commit into
mainfrom
chore/install-shelltime-hooks

Conversation

@AnnatarHe

@AnnatarHe AnnatarHe commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Install project-level ShellTime tracking 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.

Install project-level ShellTime tracking hooks for Antigravity (.agents/hooks.json) and Cursor (.cursor/hooks.json).
@AnnatarHe
AnnatarHe merged commit c960073 into main Nov 27, 2026
1 check passed
@AnnatarHe
AnnatarHe deleted the chore/install-shelltime-hooks branch November 27, 2026 17:12
@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:13:53.885304Z 97fe7e9 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
Comment on lines +17 to +27
"PostToolUse": [
{
"matcher": "*",
"hooks": [
{
"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 PostToolUse --project) && printf '%s\\n' \"$out\" || echo '{}'",
"timeout": 15
}
]
}

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 within this file. SessionStart, PreInvocation, PostInvocation and Stop list flat {type, command, timeout} entries. PostToolUse alone uses the nested {matcher, hooks: [...]} shape. The host can only parse one of these shapes for a given event. Either the flat events or the PostToolUse entry will probably be ignored or rejected. In that case tool-use heartbeats, or session start and stop, are silently never ingested.

Fix: check the agy hooks schema and use one shape consistently. If matchers are needed for tool events, use the nested form where the schema requires it. Otherwise flatten this entry.

Comment thread .agents/hooks.json
@@ -0,0 +1,44 @@
{
"shelltime": {

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 (needs checking): every event is nested under a top-level "shelltime" key. The .cursor/hooks.json file in this PR puts event names under "hooks" with "version": 1. If agy expects event names (SessionStart, ...) at the top level, or under hooks, no hook will ever fire. The failure would be silent.

Fix: confirm against the agy hooks file format that a named group such as shelltime is a valid wrapper. If it isn't, move the events to where the loader expects them.

Comment thread .cursor/hooks.json
"version": 1,
"hooks": {
"beforeSubmitPrompt": [
{

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: in the success path the command can print a bare newline instead of JSON. The shape is ... && out=$(shelltime hook-ingest ...) && printf '%s\n' "$out" || echo '<fallback>'. If hook-ingest exits 0 with empty stdout, printf '%s\n' "" prints a blank line and the || echo fallback never runs. Cursor and agy expect a JSON object on stdout. This matters most for beforeSubmitPrompt (needs {"continue":true}) and agy Stop (needs a decision). A blank response there could be read as a parse error or block the prompt or stop. The same pattern is used in every command in both files.

Fix: fall back when the output is empty, for example out=$(...) && [ -n "$out" ] && printf '%s\n' "$out" || echo '<fallback>'.

Comment thread .cursor/hooks.json
"version": 1,
"hooks": {
"beforeSubmitPrompt": [
{

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): none of the Cursor hook entries sets a timeout, but the agy file uses 15s on each. beforeSubmitPrompt runs synchronously before every prompt. If the daemon socket stalls, shelltime hook-ingest blocks the prompt for as long as Cursor's default timeout. Fix: add a timeout to each entry, matching agy's 15s or lower.

Comment thread .agents/hooks.json
"SessionStart": [
{
"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 SessionStart --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): this change adds personal tooling hooks to a Neovim plugin repo. They run shelltime hook-ingest for every agent event for every contributor who opens the repo in agy or Cursor. The roughly 300-character shell one-liner is copy-pasted 12 times across the two files, which makes it easy for the copies to drift. Also, the repo's CLAUDE.md architecture and conventions don't mention these files. Fix: if the hooks are meant to be shared, consider generating them from the CLI installer rather than hand-committing them. Otherwise add them to .gitignore.

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