Usage
Hook Types
post-commit
Runs after git commits to sync changes to Mubit.post-push
Runs after git pushes to sync changes to Mubit.agent-complete
Runs when an agent coding session completes.Options
Agent provider for agent-complete hook:
codex, claude-code, or gemini-cli.Suppress output (useful for git hooks).
Working directory path. Defaults to current directory.
Install the hook into git hooks directory.
Hook Installation
Hooks are automatically installed duringcodaph init but can be manually installed:
Install post-commit hook
.git/hooks/post-commit with:
Install agent-complete hook
- Codex:
.codex/hooks/on-agent-complete - Claude Code:
.claude/hooks/on-agent-complete - Gemini CLI:
.gemini/hooks/on-agent-complete
Hook Behavior
When a hook runs:- Checks sync lock - Skips if another sync is running
- Acquires lock - Prevents concurrent syncs
- Runs sync workflow:
- Push phase: Syncs local events to Mubit
- Pull phase: Fetches remote updates (if cooldown elapsed)
- Releases lock - Allows future syncs
- Logs results - Appends to
.codaph/sync-automation-log.jsonl
Sync Triggers
Hooks are triggered by:| Hook | Trigger | When |
|---|---|---|
post-commit | Git commit | After git commit completes |
post-push | Git push | After git push completes |
agent-complete | Agent session end | When Codex/Claude/Gemini finishes |
Cooldown
Remote pulls have a cooldown to avoid excessive API calls:- Default: 300 seconds (5 minutes)
- Configurable: Set in project settings
- Always run local push
- Skip remote pull if within cooldown window
Sync Lock
The sync lock (.codaph/sync-lock.json) prevents concurrent syncs:
- Waits up to 5 seconds
- Skips if lock still held
- Removes stale locks (process not running)
Automation Log
Hook runs are logged to.codaph/sync-automation-log.jsonl:
Troubleshooting
Hook not running
-
Verify hook is installed:
-
Check hook is executable:
-
Verify automation is enabled:
Hook hangs
-
Check for stuck lock:
-
Remove stale lock:
Hook failures
-
Check automation log:
-
Run hook manually with verbose output:
Examples
Test post-commit hook
Test agent-complete for Codex
Silent execution (for git hooks)
Reinstall all hooks
Related Commands
- codaph init - Initialize with automatic hook setup
- codaph status - Check automation status
- codaph sync - Manual sync
- codaph doctor - Diagnose hook issues