MCP ServerHooks
Auto
wt hooks gemini-cliOr enable during wt init when prompted.
What gets written
wt hooks adds the following hooks to ~/.gemini/settings.json:
| Event | Action |
|---|---|
SessionStart | Pre-loads project knowledge into context |
BeforeAgent | Searches workthin with your prompt |
AfterAgent | Reminds the AI to call create-knowledge |
SessionEnd | Same reminder at session end |
Manual
Add to ~/.gemini/settings.json:
{
"hooks": {
"SessionStart": {
"command": "wt search \"project recent solutions\" --hook 2>/dev/null || true"
},
"BeforeAgent": {
"command": "wt search \"$GEMINI_USER_PROMPT\" --hook 2>/dev/null || true"
},
"AfterAgent": {
"command": "printf '{\"systemMessage\": \"Session complete. If you solved a problem, call create-knowledge.\"}'"
},
"SessionEnd": {
"command": "printf '{\"systemMessage\": \"Session ending. If you solved a problem, call create-knowledge.\"}'"
}
}
}See the Gemini CLI hooks documentation for more details.
:::note
wt init also creates /workthin and /workthin-search skills in ~/.agents/skills/ (shared with Codex CLI). Gemini CLI auto-scans this directory.
:::