Skip to content

bloat: TDD CHECK nudge fires once per CC session (v1.70.0) - #315

Merged
BaseInfinity merged 1 commit into
mainfrom
bloat/tdd-pretool-fires-once
May 5, 2026
Merged

bloat: TDD CHECK nudge fires once per CC session (v1.70.0)#315
BaseInfinity merged 1 commit into
mainfrom
bloat/tdd-pretool-fires-once

Conversation

@BaseInfinity

Copy link
Copy Markdown
Owner

Summary

Phase 2 of ROADMAP #236 functional-bloat audit. hooks/tdd-pretool-check.sh was emitting a ~50-token JSON nudge on every Write/Edit/MultiEdit touching src/**. After SDLC skill auto-invokes (already covers TDD RED/GREEN), per-Edit nudge is duplicate. Typical session has 10-30 src Edits = ~0.5-1.5K wasted tokens.

Now gated on per-session_id sentinel via the same atomic-noclobber pattern proven in v1.69.0 (BASELINE gate). New sentinel at $SDLC_WIZARD_CACHE_DIR/tdd-shown-<id>.

Combined savings (v1.69.0 + v1.70.0): ~13.5K tokens on a 50-prompt + 20-Edit session.

Behavior matrix

Scenario TDD CHECK emits?
First src/ edit of CC session
Subsequent src/ edit, same session_id ❌ (suppressed)
New CC session (different session_id) ✅ (re-emits)
Non-src/ file (README.md etc.) ❌ (existing behavior)
Non-src/ edit BEFORE first src/ edit ❌ for non-src/, ✅ for src/ (sentinel not pre-consumed — Test 6)
50 parallel src/ Edits, same session ✅ exactly once (atomic claim)
No session_id stdin (legacy/test) ✅ every fire (back-compat)

Cross-model review

Codex round 1 caught 1 P1: new test file untracked at review time. Fixed by staging before round 2. Round 2 CERTIFIED 9/10.

Test plan

  • tests/test-tdd-pretool-fires-once.sh (new) — 9 cases
  • tests/test-hooks.sh — 154/154 pass (no regression)
  • tests/test-baseline-fires-once.sh — 10/10 pass (v1.69.0 sibling untouched)
  • tests/test-prompt-hook-fires-once.sh — 6/6 pass
  • tests/test-audit-session-load.sh — 9/9 pass (SKILL.md under 5K)
  • tests/test-cli.sh — 78/78 pass
  • tests/test-plugin.sh — 25/25 pass
  • tests/test-doc-consistency.sh — 35/35 pass
  • tests/test-workflow-triggers.sh — 169/169 pass (CONTRIBUTING.md + ci.yml wiring verified locally)

Files

  • hooks/tdd-pretool-check.sh — atomic-claim sentinel + jq-decoupled session_id extraction
  • tests/test-tdd-pretool-fires-once.sh (new — 9 cases including 50-parallel concurrency, non-src/-doesn't-consume-sentinel, suppressed-fire-empty)
  • .github/workflows/ci.yml, CONTRIBUTING.md — wires new test
  • CHANGELOG.md, SDLC.md, skills/update/SKILL.md, package.json, .claude-plugin/plugin.json + marketplace.json, CLAUDE_CODE_SDLC_WIZARD.md (1.69.0 → 1.70.0)
  • .reviews/preflight-*.md, .reviews/tdd-pretool-fires-once-001/round-{1,2}-review.md (force-added past .reviews/ gitignore)

hooks/tdd-pretool-check.sh emitted a ~50-token JSON nudge ('TDD CHECK:
Are you writing IMPLEMENTATION before a FAILING TEST?') on every
Write/Edit/MultiEdit touching src/**. After the SDLC skill auto-invokes
(which already covers TDD RED/GREEN), the per-Edit nudge is duplicate
context. Typical SDLC session has 10-30 src Edits = ~0.5-1.5K wasted
tokens.

Same atomic-noclobber sentinel pattern proven in v1.69.0 (BASELINE gate),
applied to the TDD CHECK output. New sentinel at \$SDLC_WIZARD_CACHE_DIR/
tdd-shown-<session_id>. Non-src/ files still produce zero output and
crucially DO NOT consume the sentinel slot (Test 6).

Codex round 1 caught one P1 (new test file untracked at review time);
fixed by staging before round 2. Round 2 CERTIFIED 9/10.

ROADMAP #236 phase 2. Combined v1.69.0 + v1.70.0 saves ~13.5K tokens
on a 50-prompt + 20-Edit session.
@BaseInfinity
BaseInfinity merged commit c088e0a into main May 5, 2026
3 checks passed
@BaseInfinity
BaseInfinity deleted the bloat/tdd-pretool-fires-once branch May 5, 2026 06:57
BaseInfinity added a commit that referenced this pull request May 5, 2026
hooks/tdd-pretool-check.sh emitted a ~50-token JSON nudge ('TDD CHECK:
Are you writing IMPLEMENTATION before a FAILING TEST?') on every
Write/Edit/MultiEdit touching src/**. After the SDLC skill auto-invokes
(which already covers TDD RED/GREEN), the per-Edit nudge is duplicate
context. Typical SDLC session has 10-30 src Edits = ~0.5-1.5K wasted
tokens.

Same atomic-noclobber sentinel pattern proven in v1.69.0 (BASELINE gate),
applied to the TDD CHECK output. New sentinel at \$SDLC_WIZARD_CACHE_DIR/
tdd-shown-<session_id>. Non-src/ files still produce zero output and
crucially DO NOT consume the sentinel slot (Test 6).

Codex round 1 caught one P1 (new test file untracked at review time);
fixed by staging before round 2. Round 2 CERTIFIED 9/10.

ROADMAP #236 phase 2. Combined v1.69.0 + v1.70.0 saves ~13.5K tokens
on a 50-prompt + 20-Edit session.
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