Expand description
Hook CLI command.
Provides the subcog hook subcommand for Claude Code integration.
Hooks are invoked by Claude Code at specific lifecycle events to
inject context, detect signals, and capture memories.
§Supported Hooks
| Hook | Trigger | Purpose |
|---|---|---|
session-start | Session begins | Inject relevant memories into context |
user-prompt-submit | User sends message | Detect search intent, surface memories |
post-tool-use | Tool execution completes | Surface related memories |
pre-compact | Before context compaction | Auto-capture important content |
stop | Session ends | Analyze session, sync to remote |
§Usage
# Called by Claude Code hooks configuration
subcog hook session-start
subcog hook user-prompt-submit --prompt "How do I implement auth?"
subcog hook post-tool-use --tool-name "Read" --result "..."
subcog hook pre-compact --context "..."
subcog hook stop§Configuration
Hooks are configured in .claude/settings.json:
{
"hooks": {
"SessionStart": [{ "type": "command", "command": "subcog hook session-start" }],
"UserPromptSubmit": [{ "type": "command", "command": "subcog hook user-prompt-submit" }]
}
}Structs§
- Hook
Command - Hook command handler (DOC-H1).