Supported Tools
Only tools with lifecycle hook support can fire these events:| Tool | Hooks Supported | Hook Format |
|---|---|---|
| Cursor | ✓ | ~/.cursor/hooks.json |
| Claude Code | ✓ | ~/.claude/settings.json |
| Gemini CLI | ✓ | ~/.gemini/settings.json |
| OpenCode | ✓ | ~/.config/opencode/plugins/oobo.ts |
| Codex CLI | — | Time-window inference only |
| Aider | — | Time-window inference only |
| GitHub Copilot Chat | — | Time-window inference only |
| Windsurf | — | Time-window inference only |
| Zed | — | Time-window inference only |
| Trae | — | Time-window inference only |
Tools without hook support fall back to time-window inference: oobo links sessions to commits based on temporal proximity (sessions active within a time window before the commit).
What Hooks Do
Lifecycle hooks track agent session state:Session Start
When an agent session begins, the tool fires a Oobo writes a state file to
session-start event:.git/oobo-sessions/<session_id>.json:Commit
When a commit happens, oobo reads all active sessions from
.git/oobo-sessions/ and links them to the commit anchor.The anchor records link_type: "hook" to indicate explicit linking:Hook Installation
Hooks are installed duringoobo setup:
- Detects installed AI tools
- Installs lifecycle hooks for supported tools
- Installs git hooks (post-commit, pre-push) for each project
Hook installation is non-destructive. Oobo merges its hooks into existing config files without overwriting user settings.
Manual Installation
If you skipped setup or want to reinstall hooks:Cursor
Edit or create~/.cursor/hooks.json:
Claude Code
Edit or create~/.claude/settings.json:
Gemini CLI
Edit or create~/.gemini/settings.json:
OpenCode
Create~/.config/opencode/plugins/oobo.ts:
Verifying Hook Installation
Check which tools have hooks installed:Hook Events
Oobo recognizes three lifecycle events:session-start
Fired when an agent session begins. Records the active session. Payload:session_id: Unique session identifier
agent: Tool name (e.g.cursor,claude,opencode)model: Model identifier (e.g.claude-opus-4)cwd: Working directory (defaults to current directory)
stop
Fired when an agent turn completes (but session continues). Updates the session timestamp. Payload:session_id: Unique session identifier
session-end
Fired when an agent session terminates. Removes the active session state. Payload:session_id: Unique session identifier
How Hooks Are Called
Hooks receive JSON payloads via stdin:Multi-Worktree Support
When using git worktrees (multiple working directories for the same repo), oobo tracks which worktree each session belongs to:/Users/dev/myapp, oobo only links sessions that belong to that worktree.
This enables parallel agent sessions across worktrees without conflicts:
- Agent A works in main worktree
/Users/dev/myapp - Agent B works in feature worktree
/Users/dev/myapp-feature - Commits in each worktree link only to their respective sessions
Sessions without a
worktree field (from older oobo versions) are included in all worktrees for backward compatibility.Hooks vs Time-Window Inference
Oobo uses two methods to link sessions to commits:| Method | Link Type | How It Works | Tools |
|---|---|---|---|
| Lifecycle Hooks | hook | Explicit tracking via session-start/end events | Cursor, Claude Code, Gemini CLI, OpenCode |
| Time-Window Inference | window | Sessions active within 5 minutes before commit | All tools |
- Accuracy: No false positives from unrelated sessions
- Multi-agent support: Correct attribution when multiple agents work in parallel
- Worktree isolation: Sessions link only to commits in their worktree
Session State Files
Active session state is stored in.git/oobo-sessions/:
- Created on
session-start - Updated on
stop(turn completed) - Deleted on
session-end - Auto-cleaned if stale (older than 24 hours)
Git Hooks
Oobo also installs per-repo git hooks to handle commits and pushes:post-commit
Installed at.git/hooks/post-commit:
- Read active sessions from
.git/oobo-sessions/ - Build anchor metadata (commit + sessions + tokens + attribution)
- Write anchor to local DB and orphan branch
- Clean up stale session files
pre-push
Installed at.git/hooks/pre-push:
- Push the
oobo/anchors/v1orphan branch - Retry any pending anchor syncs
Hooks are installed per-project during
oobo setup or when oobo first intercepts a commit in a new repo. If a hook already exists, oobo chains with it by creating a backup and calling both.Troubleshooting
Hooks not firing
Check if hooks are installed:hooks_installed check fails, reinstall:
Sessions not linking to commits
Check for active sessions:oobo commands.
Stale session files
Oobo auto-cleans files older than 24 hours. To clean manually:Next Steps
JSON Output
Complete reference for parsing anchor metadata
Skill File
How agents discover oobo capabilities
