You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(plugin): align claude-code hooks with upstream
user-prompt-submit.sh: add Windows Git Bash/MSYS2 safe mode (builtin-only
fast path avoids EDR-related fork hangs), extract parse_epoch helper with
full RFC3339 timezone normalization, defer project detection to after first-
message path. Keep mcp__plugin_engram_engram__* tool prefix for this fork.
SKILL.md: update fallback instructions to reference engram setup claude-code
instead of manual ToolSearch snippet; update line 124 to match upstream.
# Windows Git Bash/MSYS2 can fail while forking helper processes under
17
+
# enterprise Defender/EDR, which makes Claude Code wait on prompt submission.
18
+
# Keep the Windows path bash-builtin-only: no jq, git, curl, date, dirname, cat,
19
+
# touch, or command substitutions. It preserves first-message tool loading and
20
+
# degrades subsequent save nudges to a fast no-op instead of risking a hang.
21
+
is_windows_bash() {
22
+
case"${OSTYPE:-}"in
23
+
msys*|cygwin*|win32*) return 0 ;;
24
+
esac
25
+
[ -n"${MSYSTEM:-}" ] || [ -n"${MINGW_PREFIX:-}" ]
26
+
}
27
+
28
+
set_json_string_value() {
29
+
local key="$1"
30
+
local json="$2"
31
+
local pattern='"'"$key"'"[[:space:]]*:[[:space:]]*"([^"]*)"'
32
+
JSON_VALUE=""
33
+
if [[ "$json"=~$pattern ]];then
34
+
JSON_VALUE="${BASH_REMATCH[1]}"
35
+
fi
36
+
}
37
+
38
+
sanitize_session_key_part() {
39
+
local raw="$1"
40
+
local safe=""
41
+
local i char
42
+
for(( i=0; i<${#raw}; i++));do
43
+
char="${raw:i:1}"
44
+
if [[ "$char"=~ [a-zA-Z0-9_-] ]];then
45
+
safe+="$char"
46
+
else
47
+
safe+="_"
48
+
fi
49
+
done
50
+
JSON_VALUE="$safe"
51
+
}
52
+
53
+
print_toolsearch_message() {
54
+
printf'%s\n''{"systemMessage":"CRITICAL FIRST ACTION — Execute this ToolSearch NOW before responding to the user:\nselect:mcp__plugin_engram_engram__mem_save,mcp__plugin_engram_engram__mem_search,mcp__plugin_engram_engram__mem_context,mcp__plugin_engram_engram__mem_session_summary,mcp__plugin_engram_engram__mem_get_observation,mcp__plugin_engram_engram__mem_save_prompt\n\nAfter loading tools, call mem_context to check for prior session history before responding."}'
55
+
}
56
+
57
+
if is_windows_bash && [ "${ENGRAM_CLAUDE_WINDOWS_BASH_SAFE_MODE:-auto}"!="0" ];then
@@ -50,18 +156,19 @@ if [ ! -f "$STATE_FILE" ]; then
50
156
touch "$STATE_FILE"2>/dev/null ||true
51
157
52
158
# Inject ToolSearch + mem_context instruction.
53
-
# Use --arg so jq handles all escaping; use printf to avoid echo interpreting \n.
54
-
TOOL_MSG="CRITICAL FIRST ACTION — Execute this ToolSearch NOW before responding to the user:"$'\n'"select:mcp__plugin_engram_engram__mem_save,mcp__plugin_engram_engram__mem_search,mcp__plugin_engram_engram__mem_context,mcp__plugin_engram_engram__mem_session_summary,mcp__plugin_engram_engram__mem_get_observation,mcp__plugin_engram_engram__mem_save_prompt"$'\n\n'"After loading tools, call mem_context to check for prior session history before responding."
@@ -121,4 +121,4 @@ If you see a message about compaction or context reset:
121
121
3. Only THEN continue working
122
122
123
123
Do not skip step 1. Without it, everything done before compaction is lost from memory.
124
-
All core tools are loaded automatically by the hook at session start — use the fallback ToolSearch above if they are unexpectedly missing.
124
+
All core tools are loaded automatically by the hook at session start. If they are unexpectedly missing, rerun `engram setup claude-code` and restart Claude Code.
0 commit comments