Overview
Theaugment command enriches a search pattern with relevant context from the knowledge graph. This is primarily used internally by Claude Code PreToolUse hooks to automatically enhance grep, glob, and bash commands with architectural awareness.
This command is typically called automatically by hooks, not manually. It’s exposed as a CLI command for debugging and testing hook behavior.
Syntax
Parameters
The search pattern to augment with knowledge graph context.Can be a file path pattern, symbol name, or search query.
How it works
When you run a search command in Claude Code, the PreToolUse hook:- Intercepts the command before execution
- Calls
gitnexus augmentwith the search pattern - Receives relevant architectural context from the knowledge graph
- Injects this context into the agent’s prompt
- The agent sees both the raw search results AND the structural context
Example
- Functions/classes with that name
- What calls them (upstream dependencies)
- What they call (downstream dependencies)
- Which functional clusters they belong to
- Which execution flows they participate in
Use cases
Debugging hook behavior
If Claude Code hooks aren’t providing expected context:Testing graph queries
Preview what architectural context is available for a pattern:Hook integration
This command is automatically invoked when Claude Code hooks are configured viagitnexus setup. The hook configuration in .claude/hooks/gitnexus.json specifies:
grep, glob, or bash, the hook:
- Extracts the search pattern
- Runs
gitnexus augment <pattern> - Adds results to the agent’s context
Related commands
- gitnexus setup — Configure hooks
- gitnexus query — Direct search (not hook-based)
- gitnexus context — Get symbol context