The SessionStart hook manages TDD Guard's session data and ensures a clean slate for each Claude Code session.
- Test results from previous sessions
- Lint reports and code quality checks
- Other temporary validation data
- Creates the customizable instructions file if it doesn't exist
- Preserves your custom rules if already configured
- See Custom Instructions for details
Note: The guard's enabled/disabled state is preserved across sessions.
To enable session management, you need to add the SessionStart hook to your Claude Code configuration.
You can set this up either through the interactive /hooks command or by manually editing your settings file. See Settings File Locations to choose the appropriate location.
- Type
/hooksin Claude Code - Select
SessionStart - When a new session is started - Select
+ Add new matcher… - Enter matcher:
startup|resume|clear - Select
+ Add new hook… - Enter command:
tdd-guard - Choose where to save
Add the following to your chosen settings file:
{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume|clear",
"hooks": [
{
"type": "command",
"command": "tdd-guard"
}
]
}
]
}
}Note: Your configuration file may already have other hooks configured.
Simply add the SessionStart section to your existing hooks object.
The SessionStart hook triggers when:
- Claude Code starts up (
startup) - A session is resumed (
resume) - The
/clearcommand is used (clear)
When triggered, TDD Guard clears all transient data while preserving the guard state and your custom validation rules.
- No manual intervention needed - clearing happens automatically
- To toggle the guard on/off, use the quick commands
- For debugging, check
.claude/tdd-guard/to see stored data