Skip to content

Commit 3c32383

Browse files
committed
feat(pinned-floor): wire UserPromptSubmit hook (Claude Code + Copilot)
Add hooks/user-prompt-submit/run.sh that delegates to `total-recall pinned-floor --host <host>` with a fail-safe || printf '{}' fallback so hook failure never blocks the user's prompt. Register it in hooks.json under UserPromptSubmit with an empty matcher (fires every turn). Copilot CLI: hooks/hooks.json is auto-discovered per the hooks reference docs (no plugin.json key required). The run.sh already detects COPILOT_CLI and passes --host copilot-cli; wiring is forward-compatible pending upstream fix for additionalContext being silently ignored (github/copilot-sdk#775 / github/copilot-cli#2142). Cursor: hooks-cursor.json left untouched; beforeSubmitPrompt cannot inject context so no UserPromptSubmit entry is added there.
1 parent 885e9df commit 3c32383

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

‎hooks/hooks.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
]
1212
}
1313
],
14+
"UserPromptSubmit": [
15+
{
16+
"matcher": "",
17+
"hooks": [
18+
{
19+
"type": "command",
20+
"command": "bash \"$CLAUDE_PLUGIN_ROOT/hooks/user-prompt-submit/run.sh\""
21+
}
22+
]
23+
}
24+
],
1425
"SessionEnd": [
1526
{
1627
"matcher": "",

‎hooks/user-prompt-submit/run.sh‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
# total-recall UserPromptSubmit hook — re-asserts pinned directives near the
3+
# live edge on an adaptive throttle. All logic lives in the CLI; this wrapper
4+
# only forwards stdin and the host flag, and must NEVER fail the user's prompt.
5+
set -uo pipefail
6+
7+
host="claude-code"
8+
if [ -n "${CURSOR_PLUGIN_ROOT:-}" ]; then
9+
host="cursor"
10+
elif [ -n "${COPILOT_CLI:-}" ]; then
11+
host="copilot-cli"
12+
fi
13+
14+
# Forward hook stdin to the command. On ANY failure, emit a no-op object.
15+
total-recall pinned-floor --host "$host" || printf '{}'
16+
exit 0

0 commit comments

Comments
 (0)