fix(preamble): echo SESSIONS count so CLAUDE.md rules can read it (#1651 Defect A)#1747
Open
0xDevNinja wants to merge 1 commit into
Open
fix(preamble): echo SESSIONS count so CLAUDE.md rules can read it (#1651 Defect A)#17470xDevNinja wants to merge 1 commit into
0xDevNinja wants to merge 1 commit into
Conversation
- _SESSIONS=$(find ~/.gstack/sessions -mmin -120) was computed but never echoed; CLAUDE.md rules pointing at "the preamble's session count" had no value to read - Add `echo "SESSIONS: $_SESSIONS"` next to BRANCH/PROACTIVE/etc. - Add invariant test that every SKILL.md including the preamble echoes the value (locks Defect A from garrytan#1651) Closes garrytan#1651 Defect A. Defect B (marker mtime refresh via PreToolUse hook) needs hook-infra work — leaving for a follow-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/resolvers/preamble/generate-preamble-bash.ts:23computes_SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f | wc -l | tr -d ' ')but never echoes it. Every other preamble state value (BRANCH, PROACTIVE, SKILL_PREFIX, REPO_MODE, TELEMETRY, EXPLAIN_LEVEL, QUESTION_TUNING, LEARNINGS, ARTIFACTS_SYNC, ...) is echoed for the calling agent to read; SESSIONS is the lone hole.echo "SESSIONS: $_SESSIONS"next to the existing BRANCH/PROACTIVE/SKILL_PREFIX block in the preamble, plus an invariant test intest/gen-skill-docs.test.tsthat fails if any SKILL.md containing the_SESSIONS=$(findcomputation no longer echoes the value.Closes #1651 Defect A only.
Out of scope (Defect B)
The reporter's Defect B — marker mtime falling outside the 2h window for long-running sessions that don't invoke a gstack skill in that span — needs hook-infra work (
PreToolUserefresh on every tool call) and is a separate change with broader surface area. Leaving it for a follow-up so this PR stays small and safe to land.Diff shape
bun run gen:skill-docs)Tests
The 7 failures are the pre-existing
--dry-run freshness checkcases on non-Claude hosts that reproduce onupstream/mainwith this branch's changes stashed — unrelated.Verification
A user-side rule like
now has a value to read instead of having to inline the
finditself.