Skip to content

bloat: BASELINE block fires once per CC session (v1.69.0) - #314

Merged
BaseInfinity merged 2 commits into
mainfrom
bloat/baseline-fires-once
May 5, 2026
Merged

bloat: BASELINE block fires once per CC session (v1.69.0)#314
BaseInfinity merged 2 commits into
mainfrom
bloat/baseline-fires-once

Conversation

@BaseInfinity

Copy link
Copy Markdown
Owner

Summary

  • hooks/sdlc-prompt-check.sh BASELINE block (~250 tokens) was firing on every UserPromptSubmit — pure duplication after the SDLC skill auto-invokes. ~12K tokens/session wasted for users with >3 prompts.
  • Now gated on a per-session_id sentinel under $SDLC_WIZARD_CACHE_DIR/baseline-shown-<id>, atomic-claimed via subshell set -C (noclobber). N parallel fires emit exactly once. SETUP-not-complete + EFFORT-bump warnings still fire every prompt (dynamic state).
  • Discovered during ROADMAP roadmap(#217): loud WARNING below xhigh — max preferred, xhigh floor #236 functional-bloat audit. Other hooks (model-effort-check, precompact-seam-check, token-spike-check) audited and earned their keep — silent at healthy state.

Behavior matrix

Scenario BASELINE emits?
First prompt of CC session
Subsequent prompt, same session_id ❌ (suppressed)
New CC session, different session_id ✅ (re-emits)
No session_id in stdin (legacy/test) ✅ every fire (back-compat)
Cache dir unwritable ✅ every fire (best-effort fallback)
SETUP NOT COMPLETE warning ✅ every fire (dynamic state)
EFFORT BUMP REQUIRED nudge ✅ every fire (dynamic state)

Cross-model review

Codex round 1 (gpt-5.5 xhigh) caught 2 P1s:

  1. Concurrency race — 50 parallel same-session fires emitted BASELINE 13× because sentinel was written after the cat block. Fixed with atomic (set -C; : > sentinel) claim.
  2. session_id ignored when jq missing — extraction was jq-coupled. Decoupled to grep | head | sed so the gate works without jq. Prompt parsing still uses jq (multi-line content).

Round 2: CERTIFIED 9/10, no blocking findings. Round-1/round-2 reviews archived under .reviews/baseline-fires-once-001/.

Test plan

  • tests/test-baseline-fires-once.sh (new) — 10 cases, 8/8 baseline + 2 P1 regressions: 50-parallel concurrency + restricted-PATH-no-jq
  • tests/test-hooks.sh — 154/154 pass (no regression)
  • tests/test-prompt-hook-fires-once.sh — 6/6 pass (ROADMAP fix(#226): honest labeling for judge-CI vs true N-trial CI #224 instrumentation regression including byte-identical assertion)
  • tests/test-audit-session-load.sh — 9/9 pass (skills/update/SKILL.md still under 5K-token threshold after changelog entry)
  • tests/test-cli.sh — 78/78 pass
  • tests/test-plugin.sh — 25/25 pass
  • tests/test-doc-consistency.sh — 35/35 pass

Files

  • hooks/sdlc-prompt-check.sh — atomic-claim sentinel + jq-decoupled session_id extraction
  • tests/test-baseline-fires-once.sh (new — 10 cases)
  • .github/workflows/ci.yml — wires new test into validate job
  • CHANGELOG.md, SDLC.md, skills/update/SKILL.md, package.json, .claude-plugin/plugin.json + marketplace.json, CLAUDE_CODE_SDLC_WIZARD.md (1.68.0 → 1.69.0)
  • .reviews/preflight-baseline-fires-once-001.md, .reviews/baseline-fires-once-001/round-{1,2}-review.md (force-added past .reviews/ gitignore for repo history)

hooks/sdlc-prompt-check.sh emitted a ~250-token static SDLC BASELINE
block on every UserPromptSubmit. After the SDLC skill auto-invokes,
that block is duplicate context — ~12K tokens/session wasted for any
user with >3 prompts.

Now gated on a per-session_id sentinel under
\$SDLC_WIZARD_CACHE_DIR/baseline-shown-<id>, atomic-claimed via subshell
'set -C' (noclobber) so N parallel fires emit exactly once. Pruned at
7d. SETUP-not-complete + EFFORT-bump warnings still fire every prompt.
No-session_id stdin keeps current emit-every-fire behavior (legacy CC
+ direct shell tests).

Codex round 1 caught two P1s, both fixed: (a) concurrency race in
naive 'check then write-after-emit' pattern; (b) session_id extraction
was jq-coupled — now uses grep+sed so the gate works without jq.
Round 2 CERTIFIED 9/10. Regression tests: 50-parallel + restricted-
PATH-no-jq.

Discovered during ROADMAP #236 functional-bloat audit. Audit method:
measure cost x frequency, judge value — not blind delete-and-see.
Other hooks audited (model-effort-check, precompact-seam-check,
token-spike-check) earned their keep — silent at healthy state.
test-workflow-triggers.sh asserts CONTRIBUTING.md lists every test
script that CI runs. Adding the new test was missed in the v1.69.0
commit.
@BaseInfinity
BaseInfinity merged commit 25390ae into main May 5, 2026
3 checks passed
@BaseInfinity
BaseInfinity deleted the bloat/baseline-fires-once branch May 5, 2026 06:17
BaseInfinity added a commit that referenced this pull request May 5, 2026
* bloat: BASELINE block fires once per CC session (v1.69.0)

hooks/sdlc-prompt-check.sh emitted a ~250-token static SDLC BASELINE
block on every UserPromptSubmit. After the SDLC skill auto-invokes,
that block is duplicate context — ~12K tokens/session wasted for any
user with >3 prompts.

Now gated on a per-session_id sentinel under
\$SDLC_WIZARD_CACHE_DIR/baseline-shown-<id>, atomic-claimed via subshell
'set -C' (noclobber) so N parallel fires emit exactly once. Pruned at
7d. SETUP-not-complete + EFFORT-bump warnings still fire every prompt.
No-session_id stdin keeps current emit-every-fire behavior (legacy CC
+ direct shell tests).

Codex round 1 caught two P1s, both fixed: (a) concurrency race in
naive 'check then write-after-emit' pattern; (b) session_id extraction
was jq-coupled — now uses grep+sed so the gate works without jq.
Round 2 CERTIFIED 9/10. Regression tests: 50-parallel + restricted-
PATH-no-jq.

Discovered during ROADMAP #236 functional-bloat audit. Audit method:
measure cost x frequency, judge value — not blind delete-and-see.
Other hooks audited (model-effort-check, precompact-seam-check,
token-spike-check) earned their keep — silent at healthy state.

* ci: list test-baseline-fires-once.sh in CONTRIBUTING.md

test-workflow-triggers.sh asserts CONTRIBUTING.md lists every test
script that CI runs. Adding the new test was missed in the v1.69.0
commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant