release: v2.1.1 — index-first hooks - #30
Merged
Merged
Conversation
Agents with the skill installed still reached for Grep out of habit. Add `codebase-index install-hooks [--global]`, which merges two hooks into the Claude Code settings while keeping every other hook: - SessionStart: in an indexed repository, a one-line note naming the commands that answer code questions. - PreToolUse on Grep|Bash: the first code search of a session, before any codebase-index command has run, is sent back with the index command to use instead. Repeating the call lets it through, the first index command turns the guard off for the session, and searches over docs, logs or config, `ps | grep` pipelines and unindexed directories pass untouched. The hooks run as `codebase-index-hook`, a stdlib-only entry point (about 0.1 s per call); CBX_GUARD=0 disables the guard. The plugin registers the same hooks.
Version bump with every mirror synced (plugin.json, requirements.lock, skill stamps) and the 2.1.1 release notes.
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.
Problem
With the skill installed, Claude Code still starts most code questions with Grep: skills are only consulted when the model decides to, and grep is its habit. The 2.1.0 pilot showed the index saves ~19% tokens when it is used.
Solution
codebase-index install-hooks [--global]merges two hooks into.claude/settings.jsonor~/.claude/settings.json(other hooks are kept; idempotent;--uninstallremoves them):search/refs/impact --compact.Grep|Bash— the first code search of a session, before anycodebase-indexcommand has run, is denied with the index command to use instead. The same call repeated runs; the first index command turns the guard off for the session. Docs/log/config searches,ps | greppipelines and unindexed directories are never intercepted.CBX_GUARD=0disables it.Hooks run as
codebase-index-hook(stdlib-only, ~0.1 s). The plugin'shooks/hooks.jsonregisters the same pair.Verification
tests/test_hooks_guard.py), ruff, mypy, link check.codebase-indexcall in the session, Grep ran.Compatibility
Opt-in: nothing changes until
install-hooksis run (or the plugin is updated).