Documentation
¶
Overview ¶
Package hook defines hook names, event lifecycle stages, decision values, and prefixes.
Index ¶
Constants ¶
View Source
const ( // BlockDangerousCommands is the hook name for blocking dangerous commands. BlockDangerousCommands = "block-dangerous-commands" // BlockNonPathCtx is the hook name for blocking non-PATH ctx invocations. BlockNonPathCtx = "block-non-path-ctx" // CheckBackupAge is the hook name for backup staleness checks. CheckBackupAge = "check-backup-age" // CheckCeremonies is the hook name for ceremony usage checks. CheckCeremonies = "check-ceremonies" // CheckContextSize is the hook name for context window size checks. CheckContextSize = "check-context-size" // CheckFreshness is the hook name for technology constant freshness checks. CheckFreshness = "check-freshness" // CheckJournal is the hook name for journal health checks. CheckJournal = "check-journal" // CheckKnowledge is the hook name for knowledge file health checks. CheckKnowledge = "check-knowledge" // CheckMapStaleness is the hook name for architecture map staleness checks. CheckMapStaleness = "check-map-staleness" // CheckMemoryDrift is the hook name for memory drift checks. CheckMemoryDrift = "check-memory-drift" // CheckPersistence is the hook name for context persistence nudges. CheckPersistence = "check-persistence" // CheckReminders is the hook name for session reminder checks. CheckReminders = "check-reminders" // CheckResources is the hook name for resource usage checks. CheckResources = "check-resources" // CheckTaskCompletion is the hook name for task completion nudges. CheckTaskCompletion = "check-task-completion" // CheckVersion is the hook name for version mismatch checks. CheckVersion = "check-version" // Heartbeat is the hook name for session heartbeat events. Heartbeat = "heartbeat" // PostCommit is the hook name for post-commit nudges. PostCommit = "post-commit" // QAReminder is the hook name for QA reminder gates. QAReminder = "qa-reminder" // SpecsNudge is the hook name for specs directory nudges. SpecsNudge = "specs-nudge" // VersionDrift is the hook name for version drift nudges. VersionDrift = "version-drift" )
Hook name constants: used for LoadMessage, NewTemplateRef, notify.Send, and log.Append to avoid magic strings.
View Source
const ( ToolAider = "aider" ToolClaude = "claude" ToolClaudeCode = "claude-code" ToolCopilot = "copilot" ToolCursor = "cursor" ToolWindsurf = "windsurf" )
Supported integration tool names for ctx hook command.
View Source
const ( DirGitHub = ".github" FileCopilotInstructions = "copilot-instructions.md" )
Copilot integration paths.
View Source
const ( // StdinReadTimeout is the maximum time to wait for hook JSON on stdin // before returning a zero-value input. StdinReadTimeout = 2 // PrefixMemoryDriftThrottle is the state file prefix for per-session // memory drift nudge tombstones. PrefixMemoryDriftThrottle = "memory-drift-nudged-" // PrefixPauseMarker is the state file prefix for session pause markers. PrefixPauseMarker = "ctx-paused-" // LabelPaused is the short status label emitted while hooks are paused. LabelPaused = "ctx:paused" )
Prefixes
View Source
const ( // EventPreToolUse is the hook event for pre-tool-use hooks. EventPreToolUse = "PreToolUse" // EventPostToolUse is the hook event for post-tool-use hooks. EventPostToolUse = "PostToolUse" )
Hook event names (Claude Code hook lifecycle stages).
View Source
const ( // NotifyChannelHeartbeat is the notification channel for heartbeat events. NotifyChannelHeartbeat = "heartbeat" // NotifyChannelNudge is the notification channel for nudge messages. NotifyChannelNudge = "nudge" // NotifyChannelRelay is the notification channel for relay messages. NotifyChannelRelay = "relay" )
Notification channel names.
View Source
const ( // VariantMidSudo selects the mid-command sudo block message. VariantMidSudo = "mid-sudo" // VariantMidGitPush selects the mid-command git push block message. VariantMidGitPush = "mid-git-push" // VariantCpToBin selects the cp/mv to bin block message. VariantCpToBin = "cp-to-bin" // VariantInstallToLocalBin selects the install to ~/.local/bin block message. VariantInstallToLocalBin = "install-to-local-bin" // VariantDotSlash selects the relative path (./ctx) block message. VariantDotSlash = "dot-slash" // VariantGoRun selects the go run block message. VariantGoRun = "go-run" // VariantAbsolutePath selects the absolute path block message. VariantAbsolutePath = "absolute-path" // VariantBoth selects the template for both ceremonies missing. VariantBoth = "both" // VariantRemember selects the template for missing /ctx-remember. VariantRemember = "remember" // VariantWrapup selects the template for missing /ctx-wrap-up. VariantWrapup = "wrapup" // VariantUnexported selects the unexported journal entries variant. VariantUnexported = "unexported" // VariantUnenriched selects the unenriched journal entries variant. VariantUnenriched = "unenriched" // VariantWarning selects the generic warning variant. VariantWarning = "warning" // VariantAlert selects the alert variant. VariantAlert = "alert" // VariantBilling selects the billing threshold variant. VariantBilling = "billing" // VariantCheckpoint selects the checkpoint variant. VariantCheckpoint = "checkpoint" // VariantGate selects the gate variant. VariantGate = "gate" // VariantKeyRotation selects the key rotation variant. VariantKeyRotation = "key-rotation" // VariantMismatch selects the version mismatch variant. VariantMismatch = "mismatch" // VariantNudge selects the generic nudge variant. VariantNudge = "nudge" // VariantOversize selects the oversize threshold variant. VariantOversize = "oversize" // VariantPulse selects the heartbeat pulse variant. VariantPulse = "pulse" // VariantReminders selects the reminders variant. VariantReminders = "reminders" // VariantStale selects the staleness variant. VariantStale = "stale" // VariantWindow selects the context window variant. VariantWindow = "window" )
Hook variant constants: template selectors passed to LoadMessage and NewTemplateRef to choose the appropriate message for each trigger type.
View Source
const (
// DecisionBlock is the decision value that prevents tool execution.
DecisionBlock = "block"
)
Hook decision constants: JSON values returned by PreToolUse hooks.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.