Documentation
¶
Overview ¶
Package agenthooks detects which AI agent platforms a user works with and registers BearDrive's sync hooks in each platform's own hook config, so files sync at turn boundaries no matter which agent edits them.
Every supported platform runs command hooks the same way — spawn a shell command, pipe event JSON (with a session_id) on stdin — so one hook command works everywhere; only the config file format and event names differ:
claude .claude/settings.json UserPromptSubmit / PostToolUse (project) codex .codex/hooks.json UserPromptSubmit / PostToolUse (project) gemini .gemini/settings.json BeforeAgent / AfterTool (project) hermes ~/.hermes/config.yaml pre_llm_call / post_tool_call (user)
The hook syncs the project and stamps changes with "<agent> session <id>" (see `bdrive sync --note`), so hub history links every change to the agent session that made it. A third hook on each platform's read-tool matcher runs `bdrive read-log`, queueing agent file reads for the hub's read heatmap (drained on the next sync — the hook itself never touches the network). Hooks are fast no-ops outside bdrive projects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Agents = []string{"claude", "codex", "gemini", "hermes"}
Agent names, in the order they are reported.
Functions ¶
func ConfigPath ¶
ConfigPath returns where an agent's hooks are (or would be) registered.
func Detect ¶
Detect reports which agent platforms are in use, judged by their config dirs existing in the project or the home directory.
func Registered ¶
Registered reports whether an agent's config already carries our hooks.