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
{{ message }}
Repository navigation
SessionStart: fork tax -- $(config) x13, lib-slug sed build x22, log's printf|tr -- replace with builtins (Part of #660) #665
filed-by-loopFiled by the maintainer loop, not by a human. Sets the author axis in dispatch_rank.lane-capturein-session hooks and the summarizer — post-tool, prompt, session-start/end, haiku.py, prompts/priority:highBlocks work or has already caused damage
Under MSYS fork is emulated, so a $( ) command substitution costs real time even when it wraps a builtin. The foreground SessionStart path carries roughly 60-70 such forks that exec nothing:
$(config key) x13 (log.sh:414,426,455,459,467,469, dispatch :1037,1040,1050, hook :696,902,978,999,1529). Each costs two forks: the substitution plus the ( LC_ALL=C; [[ … =~ … ]] ) subshell at log.sh:286. 26 forks.
lib-slug.sh:37-52_remember_build_slug_sed: $(printf '\2xx') x22 to build the sed program. 22 forks, once per process -- and also once per PostToolUse hook.
log() (log.sh:532,553): $(_remember_date) + $(printf | tr) per call -- 2 forks + 1 exec every time anything logs.
3x $(_remember_forward_slash), 4x $(_stdin_json_string), $(printf %q) at bootstrap-dirs.sh:169, two $(trap -p | sed) at lib-memory-dir.sh:356 / bootstrap-dirs.sh:200.
The repo already did this swap once: lib-clock.sh replaced date with bash's printf '%(FMT)T' builtin. This issue is the same move applied everywhere else on the hot path.
Cost
Estimated 0.6-2s per start on Windows/Git Bash (reasoned, not measured).
Fix shape
config_into VAR key default that assigns via printf -v and checks the key with a case glob (or saves/restores LC_ALL inline, as lib-slug.sh:321-326 already does) -- zero forks; migrate the 13 call sites.
Build _REMEMBER_SLUG_SED with $'\200' ANSI-C quoting: zero forks.
log: ${message//[[:cntrl:]]/ } instead of printf | tr; printf -v for the timestamp (lib-clock already offers _remember_date_into-style assignment at lib-clock.sh:119).
_remember_forward_slash, _stdin_json_string: add _into VAR variants using printf -v / parameter expansion.
$(trap -p | sed): capture with trap -p into a variable and strip with parameter expansion.
Positive control: existing slug/config/log tests unchanged; negative: a fork-count test (count $( substitutions executed via BASH_SUBSHELL/set -x trace, or strace -f -e fork where available) pinning the config path at zero forks.
filed-by-loopFiled by the maintainer loop, not by a human. Sets the author axis in dispatch_rank.lane-capturein-session hooks and the summarizer — post-tool, prompt, session-start/end, haiku.py, prompts/priority:highBlocks work or has already caused damage
Activity
Cut $( ) subshell forks on SessionStart's config/timestamp/slug paths (…
fix(#747): anchor the #721 tracked-handoff guard on MEMORY_PROJECT_DI…
Fix #447 tests: follow post-tool-hook.sh's extractor rename to _stdin…
Fix #1029: remove three unconditional subshell forks per post-tool-ho…