54 lines
1.6 KiB
Markdown
54 lines
1.6 KiB
Markdown
# @local/omp-hooks
|
|
|
|
Project-level and session-level lifecycle hooks for DeepSeek Harness (DSH), with full compatibility for Claude Code `.claude/settings.json`, `.claude/hooks.json`, and project-root `hooks.json`.
|
|
|
|
## Supported Hook Events
|
|
|
|
| Event | Firing Moment | Capabilities |
|
|
|---|---|---|
|
|
| `SessionStart` | On agent creation / session init | Injects context before the first turn |
|
|
| `UserPromptSubmit` | When user prompt / messages are submitted | Can block prompt (exit 2) or attach extra context |
|
|
| `PreToolUse` | Before any tool executes | Can block execution (`deny`), ask confirmation (`ask`), or pass |
|
|
| `PostToolUse` | After a tool finishes execution | Can block result with feedback, or append context |
|
|
| `Stop` | When agent turn is stopping | Can steer agent into continuing with a reason |
|
|
|
|
## Configuration Locations (per-project discovery)
|
|
|
|
In any project workspace directory, hooks are automatically discovered from:
|
|
1. `.claude/settings.local.json`
|
|
2. `.claude/settings.json`
|
|
3. `.claude/hooks.json`
|
|
4. `hooks.json`
|
|
|
|
## Example `.claude/settings.json`
|
|
|
|
```json
|
|
{
|
|
"hooks": {
|
|
"PreToolUse": [
|
|
{
|
|
"matcher": "bash|write",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "python3 $CLAUDE_PROJECT_DIR/.claude/hooks/guard.py",
|
|
"timeout": 10
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"PostToolUse": [
|
|
{
|
|
"matcher": "edit|write",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "npx prettier --write $CLAUDE_PROJECT_DIR/src"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|