Hooks
Lifecycle automation that keeps OmO sessions recoverable, routed, and moving.
Hooks are the harness layer wrapped around OpenCode sessions. They inject instructions, repair malformed state, route slash commands, remind agents about category and skill rules, and resume unfinished work.
What Hooks Control
| Family | Examples | Purpose |
|---|---|---|
| Routing | auto-slash-command, keyword-detector, category-skill-reminder | Turn user intent into the right workflow. |
| Continuation | ralph-loop, todo-continuation-enforcer, task-reminder | Keep unfinished tasks from stopping silently. |
| Recovery | session-recovery, edit-error-recovery, json-error-recovery | Repair common model and tool failure modes. |
| Tool integration | interactive-bash-session, claude-code-hooks, MCP hooks | Connect tmux, external tools, and agent-specific tooling. |
| Context | directory-agents-injector, AGENTS-style injection | Add repository or directory conventions. |
Practical Model
You rarely need to memorize every hook. Think of them as four guarantees:
- The right instructions are present before work starts.
- The right specialist or category is selected for the task.
- The session can recover from tool and model glitches.
- The agent continues until todos and verification are complete.
Safe Customization
When changing hooks or experimental options:
- Change one behavior at a time.
- Run
bunx oh-my-openagent doctor --verboseafter config changes. - Keep continuation hooks enabled unless you are debugging the harness itself.
- Prefer per-project config for repository-specific behavior.
- Document any project hook assumptions in
.opencode/skills/or local docs.
Related Config
Common experimental options cover context and recovery: aggressive_truncation, auto_resume, preemptive_compaction, and truncate_all_tool_outputs. Their availability varies by installed version, so let doctor and the generated schema be the source of truth.