Repository navigation
Closed
Labels
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
Description
Part of #660. The structural lever behind #662-#666: most of what SessionStart computes is identical from one start to the next, and the plugin already runs a detached phase (save-session, consolidation) that could compute it ahead of time.
What is recomputed on every start today
- Injected memory context -- six memory files read, sized, headed and concatenated (
session-start-hook.sh:1532-1549), rotated-slice listing and sizes (:1588-1631), history hint (:1465), handoff (:1322). Changes only when a memory file changes -- i.e. after a save or a consolidation, both of which run in the background already. - Flattened config --
jqmerge of up to threeconfig.jsonfiles (lib-memory-dir.sh:313) plus ajqflatten into_RCFG_*(log.sh:206). Changes only when a config file changes. - Tool verdicts --
python3 -Vprobe (detect-tools.sh:48-66),jqpresence,cygpathpresence. Change only when PATH changes. - Slug and paths --
session_dir_slugviacygpath -w+sed(lib-slug.sh:177,348),claude_projects_dirviacygpath -u(:75). Change only when the project dir changes.
lib-env-cache.sh already publishes an env cache from SessionStart for later hooks in the same session (:107,124); this issue extends the idea across sessions.
Fix shape
- Context cache: the detached phase (end of
save-session.sh, end ofrun-consolidation.sh) writes$REMEMBER_DIR/tmp/start-context.cache= the exact bytes SessionStart would inject, plus a manifest of the source files' mtimes. SessionStart validates with bash-ntagainst each source (zero spawns), and on a hit does a singlecat; on a miss falls back to today's path and rewrites the cache. Handoff and the promo line stay dynamic (they are small and cheap). - Config cache:
_config_loadwrites the flattened_RCFG_*assignments as a sourceable file keyed by the config files' mtimes; steady state issourcewith zerojq. - Tool verdicts: cache
$PYTHON/$JQ/$CYGPATHin the same sourceable file keyed by a hash of$PATH(bash${PATH}compared as a string is enough). - Slug: cache the computed slug per project dir alongside.
Steady-state SessionStart then spawns: the stdin read, one source, one cat, the marker writes. Everything else has moved to the phase that already runs after the user is busy.
Guardrails
- A stale cache must be impossible to serve silently: every source file in the manifest is
-nt-checked, and a missing manifest entry is a miss, not a hit. - The cache lives under
$REMEMBER_DIR/tmpand is world-invisible (umask 077), same as the promo marker. - Positive control: edit a memory file, start a session, the new bytes are injected (miss path); negative control: no edits, second start injects identical bytes with a spawn count pinned by a test in the shape of
tests/test_session_start_promo_spawn_budget_660.py. - Windows band:
-nton MSYS compares mtimes correctly; note the 2s FAT/exFAT mtime granularity as a reason to treat equal mtimes as a miss.
[AI-generated]
Metadata
Metadata
Assignees
Labels
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
Disable the #668 config-flatten cache in the post-tool-hook cold-path…
Cache the injected context, flattened config and tool verdicts across…
Count-guard every empty-able array loop: bash < 4.4 + set -u aborts t…
Make SessionStart's Python probe lazy, and drop always-on forks in me…
SessionStart warm-path: fix the #679 benchmark harness, remove real p…
Move the #668 flattened-config cache out of the project tree, validat…
test(#781): force whole-second cache lead in untracked-cache positive…
test(#781): force whole-second cache lead in untracked-cache positive…
fix: unquote literal quotes, guard the start cache, refuse laundering…
Fix #1003: reject Python below the supported floor instead of reporti…
Fix #1002 round 3: real wscript.exe evidence for v0.42.3, cached unus…
Fix #1002 round 3: real wscript.exe evidence for v0.42.3, stall-regre…
Fix #1086 CI: digits-only case lint, scanner case-statement, and two …
Fix #1079, #1060: stop re-bootstrapping config on every SessionStart …
Fix #1051: apply the session_start_max_bytes budget even on a day rol…
Fix #660: measure Windows SessionStart warm start via CI, confirm it …
Add session_start_files: choose which memory files load at session st…