Skip to content

feat: add context-efficient backpressure hooks#16

Merged
prosdev merged 1 commit intomainfrom
feat/context-backpressure
Mar 28, 2026
Merged

feat: add context-efficient backpressure hooks#16
prosdev merged 1 commit intomainfrom
feat/context-backpressure

Conversation

@prosdev
Copy link
Copy Markdown
Contributor

@prosdev prosdev commented Mar 28, 2026

Summary

  • scripts/run_silent.sh — wraps test/lint/build commands; prints ✓ cmd (12 tests, 3s) on success, filtered output on failure. VERBOSE=1 bypasses.
  • .claude/hooks/command-interceptor.sh (PreToolUse) — intercepts Bash commands matching test/lint/build patterns, rewrites them through run_silent, injects fail-fast flags (--bail 1 for vitest, -x for pytest), auto-approves. Rejects shell metacharacters ($(, backticks, pipes, redirects).
  • .claude/hooks/auto-lint.sh (PostToolUse on Write|Edit) — auto-runs biome (TS) or ruff (Python) after file edits. Blocks Claude on lint errors, creating a self-healing fix loop.

Test plan

  • run_silent.sh passes with echo hello✓ echo hello (0s)
  • run_silent.sh fails with false✗ false (exit 1, 0s)
  • run_silent.sh wraps real pnpm typecheck → single line output
  • command-interceptor wraps pnpm test → JSON with run_silent path
  • command-interceptor skips git status → empty output (passthrough)
  • command-interceptor skips compound pnpm test && pnpm lint → passthrough
  • command-interceptor skips pipe pnpm test | head → passthrough
  • command-interceptor skips $(...) substitution → passthrough
  • command-interceptor injects --bail 1 for vitest run
  • command-interceptor injects -x for pytest
  • Code review passed (security, logic, quality reviewers)

🤖 Generated with Claude Code

Keep Claude in the "smart zone" by deterministically controlling tool
output. Three-layer system: run_silent.sh wrapper suppresses verbose
success output (with test count extraction for vitest/pytest),
command-interceptor PreToolUse hook wraps test/lint/build commands and
injects fail-fast flags, auto-lint PostToolUse hook runs biome/ruff
after every Write/Edit with self-healing error loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@prosdev prosdev merged commit 9affed2 into main Mar 28, 2026
2 checks passed
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