Hooks

7 lifecycle hooks that run automatically during your session.

Overview

Hooks are lifecycle functions that execute automatically at specific points in your Coding Friend session. They handle security, formatting, reminders, and context management without requiring manual invocation.

Hook Reference

HookTriggerPurpose
session-initSessionStartInitialize session state and load configuration
dev-rules-reminderUserPromptSubmitRemind developers of project rules before each prompt
privacy-blockPreToolUseBlock access to sensitive files (.env, .pem, SSH keys)
scout-blockPreToolUseBlock access to files matching .coding-friend/ignore patterns
statuslineSessionStartConfigure editor statusline with project info
compact-markerPreCompactMark files to compact before context summarization
context-trackerPostToolUseTrack tool usage and context for performance analysis

How Hooks Work

Hooks are executed automatically by the Coding Friend plugin at specific lifecycle events. You don't invoke them manually — they run in the background to support your workflow.

Controlling Hooks

Enable or disable hooks in .coding-friend/config.json:

{
  "hooks": {
    "privacyBlock": true,
    "scoutBlock": true,
    "devRulesReminder": true,
    "contextTracker": true
  }
}

All hooks default to enabled. Set to false to disable specific hooks for your project.

Security Hooks

privacy-block and scout-block form Coding Friend's first line of defense against accidental credential exposure and inappropriate file access.