Repository navigation
Description
Summary
On Windows (Git Bash hooks), session-start-hook.sh averages ~12.5 s per session start — measured across 36 real session starts over 14 days on v0.29.1. This is steady-state latency, not the intermittent consolidation block from #646: it's paid on essentially every start.
Measurements
Taken from Claude Code's own transcript hook records (durationMs on hook attachments), aggregated across all sessions in the window:
| Hook | n | avg | max |
|---|---|---|---|
session-start-hook.sh (SessionStart) |
36 | 12,491 ms | 114,379 ms |
user-prompt-hook.sh (UserPromptSubmit) |
502 | 1,046 ms | 7,107 ms |
For contrast, other SessionStart hooks in the same sessions (plain bash scripts, similar size) average 0.5–1.3 s, so this isn't generic shell overhead — though Windows process-spawn cost is a plausible multiplier (each subprocess/jq invocation under Git Bash costs ~50–200 ms, so a hook that shells out dozens of times pays for it roughly 10× harder than on Unix).
Caveats stated honestly:
- The 114 s max may be the SessionStart hook blocks ~99s on consolidation, exceeding the VS Code extension's 60s subprocess-init timeout #646 consolidation path or a laptop suspend/resume inflating wall-clock time — I'm not leaning on it. The 12.5 s average across 36 starts is the report.
- One non-blocking failure in the window:
session-start-hook: ERROR -- failed to source <plugin>/scripts/log.sh(single occurrence, didn't recur).
Environment
- Plugin:
rememberv0.29.1 via theclaude-plugins-officialmarketplace (pinned sha1f5d3f9) - Claude Code 2.1.268, native install
- Windows 11 (ARM64), hooks executed under Git Bash
- Heavily used install (the plugin works well — this is purely about start latency)
Ask
Whatever the fix shape is — fewer subprocess invocations on the hot path, batching the jq reads, or pushing more of the start work into the backgrounded phase the #646 fix established — a Windows-representative timing budget for the foreground portion of session start would be the win. Happy to run instrumented builds or provide more granular timings from this machine if useful.
Measured and drafted with Claude Code session diagnostics; posted by the account owner.
Activity
Log the class-B finding from the independent oss:auditor review as a …
Cut SessionStart promo's jq forks 10->4, and add a gated star ask (#660…
fdaviddpt commentedon Sep 11, 2026
Fewer jq forks on the promo path landed in #661 (10 -> 4 per session start, measured on macOS). It does not close this issue -- that reduction is one part of the hook's foreground path, not the whole ~12.5s average this issue measured, so #660 stays open pending a Windows-representative re-measure.
@blakeh8 if you're up for it, a re-measure on the next release (once the star-ask/promo change from #661 ships) would help confirm whether the promo path was actually the bulk of the hot-path cost on Git Bash, or whether there's more to account for elsewhere in the hook.
[AI-generated]
Cache the injected context, flattened config and tool verdicts across…
Add a Windows/Git-Bash benchmark for session-start-hook.sh (#669) (#671)
jqit-ricky commentedon Sep 12, 2026
We measured the SessionStart hook against a real, populated memory store. Environment: Windows 11 (Git for Windows), Claude Code 2.1.269, VS Code extension 2.1.269, remember plugin 0.30.0 from the marketplace.
Exit code was 0 every time. We traced the hook with
PS4='+$EPOCHREALTIME ' bash -x: about 1,400 forked commands per run. On this machine a Git Bash fork costs 90 ms idle, 263 ms under load (normal is 10-30 ms). Fork count drives most of the wall-clock time, and it gets worse exactly when the machine is busiest. The single largest gap was a 6.95 swaitinside thebefore_session_startdispatch (hooks.d/before_session_start/50-git-restore.sh). That step's own header budgets only 0.17-0.22 s for itself.This collides with the VS Code extension's hard-coded 60,000 ms subprocess initialisation limit (see #646), which has no setting or variable to raise it. Under load, this hook alone exceeds that limit threefold. The resulting error is
Subprocess initialization did not complete within 60000ms - check authentication and network connectivity, which misleadingly points at authentication or network rather than the hook's own runtime.One concrete suggestion: declare the SessionStart hook
"async": trueinhooks.json. The CLI already supports async hooks on SessionStart. Claude Code's own default SessionStart timeout is 600 s, ten times the extension's budget, so long runs are already expected (hooks guide, Limitations). Async would let memory context arrive on the first turn instead of blocking initialisation.If async isn't preferred, a smaller fallback exists. Stop awaiting the
before_session_startdispatch, or at least50-git-restore.sh, in the foreground. That step is where the largest single delay sits relative to its own stated budget.Happy to share the full trace if useful.
JQiT Pty Ltd
Make SessionStart's Python probe lazy, and drop always-on forks in me…
Fix jq-less _jq_fallback dropping --arg, spurious recovery re-save on…
Cut $( ) subshell forks on SessionStart's config/timestamp/slug paths (…
SessionStart: 50-git-restore.sh no longer re-sources the whole config…
48 remaining items
Fix #447 tests: follow post-tool-hook.sh's extractor rename to _stdin…
Fix #1029: remove three unconditional subshell forks per post-tool-ho…
erdogan-deniz commentedon Oct 19, 2026
A data point from another Windows box on 0.43.1, in case it helps narrow or close this.
Environment: Windows 11 Pro build 26300, x64 (Ryzen 5 5600H), Defender real-time on, store on local NTFS. Claude Code 2.1.286 (VS Code extension), Git Bash 5.2.26, jq 1.8.2,
remember0.43.1 fromclaude-plugins-official(pinnedccd4506).1. The hook alone. I ran
session-start-hook.shdirectly against a copy of a real store (about 0.8 MB of.remember) with a synthetic SessionStart payload, traced withBASH_XTRACEFD. Two runs, both 2.6 s wall. The trace has about 3,700 lines and no single step above 0.07 s. By file:log.sh0.87 s,lib-memory-context.sh0.38 s,session-start-hook.sh0.30 s,lib-memory-dir.sh0.28 s. That is in line with your CI numbers.2. In situ. Hook
durationMsfrom Claude Code transcripts on 18–19 Oct, 547 starts (startup, resume and compact combined): p50 3.8 s, p75 6.0 s, p90 10.3 s, max 138 s. The other SessionStart hooks in the same sessions have p50 0.5–0.9 s.3. The tail. The slow starts cluster where several sessions start at once. In one project, three starts fell within the same second, probably the editor restoring sessions. The plugin's own
session-start tooklines show 11–12 s for each of them.Caveat: until 19 Oct this machine was hitting the #1034 / #1036 PostToolUse bug, because the marketplace still serves 0.43.1. Hung post-tool hooks were each spinning a core during that time, so the in-situ tail above is inflated. After I dropped 0.43.2's
post-tool-hook.shin locally there have been only 6 starts (p50 9.0 s, mostly resumes while other sessions were open). That is too few to conclude anything.Takeaway: I found nothing new inside the hook. The foreground cost is about 2.5 s of Git Bash forks, and the user-visible tail comes from concurrent starts. The
"async": trueidea from the 12 Sep comment would target exactly that tail. Separately, the marketplace pin is still at 0.43.1, so other Windows users with long transcripts keep getting the 600 s PostToolUse stalls until it moves to 0.43.2.fdaviddpt commentedon Oct 19, 2026
Thank you @erdogan-deniz — this is the clearest picture yet: the hook alone is ~2.6 s with no slow step, and the tail comes from concurrent starts.
On
"async": true: we checked Claude Code's hook docs. An async hook'sadditionalContextis delivered "on the next conversation turn", so Claude's first answer in every session would come without your memory — that breaks remember's core promise. Interactive sessions already run SessionStart in the background (you can type immediately; only Claude's first response waits for the context), so the remaining cost is that first-response wait, and it grows when several sessions start in the same second and compete for Git Bash forks. The lever there is fewer forks on the foreground path, not async.Your caveat matters too: 0.43.1's PostToolUse stall (#1034/#1036) was spinning cores during your sample. 0.43.2 fixes it; the marketplace bump is pending at anthropics/claude-plugins-official#6802. Once you're on it, a re-measure of concurrent starts would tell us how much of the tail is left.
[AI-generated]
kheirou commentedon Oct 22, 2026
Data point, Windows 11 Home build 26300, Claude Code 2.1.308, Git Bash, remember 0.43.1 → 0.44.1. Startup measured as the slowest SessionStart hook, median of 5–7 runs, empty project dir:
FAIL(notWARN) on Windows.features.plugin_promos: false: 1.6 s → 1.4 s.Like @erdogan-deniz, I found no single slow step in the trace. What's left is about 35 process starts at about 37 ms each.
Fix #1056 round 2: gate SessionEnd's retry on a dedicated exit code, …
Fix #660: the #669 benchmark summary never reached CI's own log
Add changelog fragment for #660, citing the CI-measured numbers
Fix #1056: fewer forks and a bounded retry on SessionEnd's flush (#1095)
fdaviddpt commentedon Nov 1, 2026
Closing with measurements. On Windows (GitHub's windows-latest runner, Git Bash, Python 3.9 to 3.12), SessionStart now takes about 1.0 to 1.6 s on an ordinary start (middle of 3 runs) and about 1.4 to 1.9 s on the very first start, down from the ~12.5 s you measured on v0.29.1. That comes from the work done since (fewer helper processes, a cached memory section, background work moved out of the way). #1096 keeps this measurement in our Windows tests so it cannot quietly get slow again.
These are CI numbers, not a real PC, so if your own machine is still noticeably slow on a recent version, please reopen with your timings and we will dig in.
[AI-generated]
Fix Digital-Process-Tools#660: measure Windows SessionStart warm star…