Skip to content
Open
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
2 changes: 1 addition & 1 deletion plugin/claude-code/scripts/user-prompt-submit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Write-EmptyHookResponse {
}

function Write-ToolSearchMessage {
$message = "CRITICAL FIRST ACTION — Execute this ToolSearch NOW before responding to the user:`nselect:mcp__engram__mem_save,mcp__engram__mem_search,mcp__engram__mem_context,mcp__engram__mem_session_summary,mcp__engram__mem_session_start,mcp__engram__mem_session_end,mcp__engram__mem_get_observation,mcp__engram__mem_suggest_topic_key,mcp__engram__mem_capture_passive,mcp__engram__mem_save_prompt,mcp__engram__mem_update,mcp__engram__mem_current_project,mcp__engram__mem_judge`n`nAfter loading tools, call mem_context to check for prior session history before responding."
$message = "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_session_start,mcp__plugin_engram_engram__mem_session_end,mcp__plugin_engram_engram__mem_get_observation,mcp__plugin_engram_engram__mem_suggest_topic_key,mcp__plugin_engram_engram__mem_capture_passive,mcp__plugin_engram_engram__mem_save_prompt,mcp__plugin_engram_engram__mem_update,mcp__plugin_engram_engram__mem_current_project,mcp__plugin_engram_engram__mem_judge`n`nAfter loading tools, call mem_context to check for prior session history before responding."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve UTF-8 encoding for the non-ASCII system message.

PSScriptAnalyzer flags this file because it contains non-ASCII text without a BOM. On legacy Windows PowerShell hosts, the em dash in this string can be decoded incorrectly and corrupt the emitted systemMessage; save the script as UTF-8 with BOM or explicitly guarantee PowerShell 7+ execution.

🧰 Tools
🪛 PSScriptAnalyzer (1.25.0)

[warning] Missing BOM encoding for non-ASCII encoded file 'user-prompt-submit.ps1'

(PSUseBOMForUnicodeEncodedFile)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugin/claude-code/scripts/user-prompt-submit.ps1` at line 22, Preserve UTF-8
encoding for the non-ASCII message assigned to $message in the user-prompt
submission script by saving the file with a UTF-8 BOM. Do not alter the system
message text or require a PowerShell 7+ runtime.

Source: Linters/SAST tools

[PSCustomObject]@{ systemMessage = $message } | ConvertTo-Json -Compress
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/claude-code/scripts/user-prompt-submit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ sanitize_session_key_part() {
}

print_toolsearch_message() {
printf '%s\n' '{"systemMessage":"CRITICAL FIRST ACTION — Execute this ToolSearch NOW before responding to the user:\nselect:mcp__engram__mem_save,mcp__engram__mem_search,mcp__engram__mem_context,mcp__engram__mem_session_summary,mcp__engram__mem_session_start,mcp__engram__mem_session_end,mcp__engram__mem_get_observation,mcp__engram__mem_suggest_topic_key,mcp__engram__mem_capture_passive,mcp__engram__mem_save_prompt,mcp__engram__mem_update,mcp__engram__mem_current_project,mcp__engram__mem_judge\n\nAfter loading tools, call mem_context to check for prior session history before responding."}'
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_session_start,mcp__plugin_engram_engram__mem_session_end,mcp__plugin_engram_engram__mem_get_observation,mcp__plugin_engram_engram__mem_suggest_topic_key,mcp__plugin_engram_engram__mem_capture_passive,mcp__plugin_engram_engram__mem_save_prompt,mcp__plugin_engram_engram__mem_update,mcp__plugin_engram_engram__mem_current_project,mcp__plugin_engram_engram__mem_judge\n\nAfter loading tools, call mem_context to check for prior session history before responding."}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not hardcode the plugin MCP namespace in the ToolSearch list.

internal/setup/setup_test.go Lines 2334-2342 explicitly rejects select:mcp__plugin_engram_engram__; this change therefore fails the existing contract and test. Build the tool identifiers from the script’s current MCP server ID instead of embedding a fixed namespace.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugin/claude-code/scripts/user-prompt-submit.sh` at line 59, The ToolSearch
payload in the prompt submission script hardcodes the plugin MCP namespace,
violating the existing contract. Update the command to derive each tool
identifier from the script’s current MCP server ID, preserving the listed tool
names and mem_context follow-up behavior without embedding
mcp__plugin_engram_engram__.

}

if is_windows_bash && [ "${ENGRAM_CLAUDE_WINDOWS_BASH_SAFE_MODE:-auto}" != "0" ]; then
Expand Down