Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .agents/hooks.json
Original file line number Diff line number Diff line change
@@ -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: every hook is nested under a custom top-level "shelltime" key, while the Cursor file puts events directly under hooks with a version field. If agy reads events from the top level (or a hooks key), nothing here is ever loaded, and the agy integration does nothing. Fix: verify the file layout agy actually reads, and move the events to that location, or drop the shelltime wrapper.

"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 '{}'",
"timeout": 15
}
],
"PreInvocation": [
{
"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 PreInvocation --project) && printf '%s\\n' \"$out\" || echo '{}'",
"timeout": 15
}
],
"PostToolUse": [
{
"matcher": "*",
"hooks": [

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 PostToolUse entry uses a different schema from the other four events in this file. SessionStart, PreInvocation, PostInvocation and Stop are flat {type, command, timeout} objects. PostToolUse is nested as {matcher, hooks: [...]}. If agy expects one shape for all events, either PostToolUse or the other four will be silently ignored or rejected, and tool-use tracking (or session and invocation tracking) won't work. Fix: confirm against the agy hooks schema and use one shape for every event, or generate the file from the same template the shelltime installer uses.

{
"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
}
]
}
],
"PostInvocation": [
{
"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 PostInvocation --project) && printf '%s\\n' \"$out\" || echo '{}'",
"timeout": 15
}
],
"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\"}'",
"timeout": 15
}
]
}
}
40 changes: 40 additions & 0 deletions .cursor/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{

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 hooks sets a timeout, although the agy file uses 15 s for each. If shelltime hook-ingest blocks (for example on a hung daemon socket), beforeSubmitPrompt can stall every prompt until Cursor's default timeout. Fix: add a timeout to each entry. Also, these files are checked into a JetBrains plugin repo and make every contributor's agent session (prompts and tool calls) get sent to the ShellTime daemon. Confirm that is intended, and consider documenting it in CLAUDE.md or the README.

"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: the command can print an empty line on the success path. When shelltime hook-ingest exits 0 with no stdout, out is empty and printf '%s\n' "$out" emits a blank line. The || echo '{...}' fallback only runs on a non-zero exit. Cursor then gets empty output instead of JSON. For beforeSubmitPrompt that means no {"continue":true}, and the prompt may be blocked or the hook reported as failed. The same applies to every hook in .agents/hooks.json (Stop expects {"decision":"allow"}). Fix: fall back when $out is empty, for example [ -n "$out" ] && printf ... || echo '{...}'. Or have the command always end with the default 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 beforeSubmitPrompt --project) && printf '%s\\n' \"$out\" || echo '{\"continue\":true}'"
}
],
"postToolUse": [
{
"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 postToolUse --project) && printf '%s\\n' \"$out\" || echo '{}'"
}
],
"postToolUseFailure": [
{
"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 postToolUseFailure --project) && printf '%s\\n' \"$out\" || echo '{}'"
}
],
"afterAgentResponse": [
{
"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 afterAgentResponse --project) && printf '%s\\n' \"$out\" || echo '{}'"
}
],
"stop": [
{
"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 stop --project) && printf '%s\\n' \"$out\" || echo '{}'"
}
],
"sessionStart": [
{
"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 sessionStart --project) && printf '%s\\n' \"$out\" || echo '{}'"
}
],
"sessionEnd": [
{
"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 '{}'"
}
]
}
}
Loading