Skip to content

Commit ea1acda

Browse files
fix(dashboard): show current cloud browser state
Merge dashboard current-state read model and Windows Claude hook hardening.
2 parents cacd08d + 3d0039b commit ea1acda

8 files changed

Lines changed: 646 additions & 47 deletions

File tree

docs/AGENT-SETUP.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,31 @@ Add to your `.claude/settings.json` (project) or `~/.claude/settings.json` (glob
116116

117117
With bare MCP, add a [Surviving Compaction](#surviving-compaction-recommended) prompt to your `CLAUDE.md` so the agent remembers to use Engram after context resets.
118118

119-
> **Windows note:** The Claude Code plugin hooks use bash scripts. On Windows, Claude Code runs hooks through Git Bash (bundled with [Git for Windows](https://gitforwindows.org/)) or WSL. If hooks don't fire, ensure `bash` is available in your `PATH`. Alternatively, use **Option C (Bare MCP)** which works natively on Windows without any shell dependency.
119+
> **Windows note:** The Claude Code plugin hooks use bash scripts. On Windows, Claude Code runs hooks through Git Bash (bundled with [Git for Windows](https://gitforwindows.org/)) or WSL. The `UserPromptSubmit` hook automatically switches to a fork-light safe path under Git Bash/MSYS2: the first-prompt ToolSearch still runs, while later save-reminder checks are skipped so prompt submission does not block. If Git Bash itself is blocked by Defender/EDR, the plugin also ships `scripts/user-prompt-submit.ps1` as a native PowerShell fallback for local override/testing. **Option C (Bare MCP)** remains the no-hook fallback and works natively on Windows without any shell dependency.
120+
121+
PowerShell fallback test and local override example:
122+
123+
```powershell
124+
'{"session_id":"edr/test:1"}' | pwsh -NoProfile -ExecutionPolicy Bypass -File "C:\path\to\engram\plugin\claude-code\scripts\user-prompt-submit.ps1"
125+
```
126+
127+
```json
128+
{
129+
"hooks": {
130+
"UserPromptSubmit": [
131+
{
132+
"hooks": [
133+
{
134+
"type": "command",
135+
"command": "pwsh -NoProfile -ExecutionPolicy Bypass -File \"C:\\path\\to\\engram\\plugin\\claude-code\\scripts\\user-prompt-submit.ps1\"",
136+
"timeout": 2
137+
}
138+
]
139+
}
140+
]
141+
}
142+
}
143+
```
120144

121145
See [Plugins → Claude Code Plugin](PLUGINS.md#claude-code-plugin) for details on what the plugin provides.
122146

docs/PLUGINS.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ plugin/claude-code/
9999
├── scripts/
100100
│ ├── session-start.sh # Ensures server, creates session, imports chunks, injects context
101101
│ ├── post-compaction.sh # Injects previous context + recovery instructions
102+
│ ├── user-prompt-submit.sh # Loads MCP tools on first prompt; Windows Git Bash safe mode
103+
│ ├── user-prompt-submit.ps1 # Optional Windows-native fallback for locked-down endpoints
102104
│ ├── subagent-stop.sh # Passive capture trigger on subagent completion
103105
│ └── session-stop.sh # Logs end-of-session event
104106
└── skills/memory/SKILL.md # Memory Protocol (when to save, search, close, recover)
@@ -117,6 +119,37 @@ plugin/claude-code/
117119
2. Tells the agent: "FIRST ACTION REQUIRED — call `mem_session_summary` with this content before doing anything else"
118120
3. This ensures no work is lost when context is compressed
119121

122+
**On user prompt submit**:
123+
1. The first prompt injects a ToolSearch instruction so Claude Code loads Engram MCP tools before responding.
124+
2. Later prompts may inject a save reminder if the local Engram API is fast and available.
125+
3. On Windows Git Bash/MSYS2, the hook uses a bash-builtin-only safe path to avoid fork-heavy helpers (`jq`, `git`, `curl`, `date`). In that mode first-prompt ToolSearch still works, but later save reminders degrade to `{}` so prompt submission stays fast.
126+
127+
If Git Bash itself is blocked by enterprise security tooling, `scripts/user-prompt-submit.ps1` is provided as a native PowerShell fallback for manual hook testing or local override.
128+
129+
PowerShell local override/testing example for locked-down Windows endpoints:
130+
131+
```powershell
132+
# Test the native fallback directly. First run emits ToolSearch; second run emits {}.
133+
'{"session_id":"edr/test:1"}' | pwsh -NoProfile -ExecutionPolicy Bypass -File "C:\path\to\engram\plugin\claude-code\scripts\user-prompt-submit.ps1"
134+
135+
# Local Claude Code override in .claude/settings.json or user settings:
136+
{
137+
"hooks": {
138+
"UserPromptSubmit": [
139+
{
140+
"hooks": [
141+
{
142+
"type": "command",
143+
"command": "pwsh -NoProfile -ExecutionPolicy Bypass -File \"C:\\path\\to\\engram\\plugin\\claude-code\\scripts\\user-prompt-submit.ps1\"",
144+
"timeout": 2
145+
}
146+
]
147+
}
148+
]
149+
}
150+
}
151+
```
152+
120153
**Memory Protocol skill** (always available):
121154
- Strict rules for **when to save** (mandatory after bugfixes, decisions, discoveries)
122155
- **When to search** memory (reactive + proactive)

0 commit comments

Comments
 (0)