Expand description
Windsurf hook adapter.
Windsurf wraps every hook payload in a common envelope keyed by
agent_action_name with a tool_info object carrying per-event
detail. The envelope also carries trajectory_id / execution_id
as session IDs and (for command-like events) a cwd.
Example stdin (post_write_code):
{
"agent_action_name": "post_write_code",
"trajectory_id": "...",
"execution_id": "...",
"timestamp": "...",
"tool_info": {
"file_path": "src/foo.ts",
"edits": [{ "old_string": "a", "new_string": "b" }]
}
}Event mapping:
| Windsurf action | Canonical event |
|---|---|
pre_user_prompt | UserPromptSubmit |
post_write_code | PostToolUse { Write } |
post_run_command | PostToolUse { Bash } |
post_mcp_tool_use | PostToolUse { mcp_* } |
post_cascade_response | Stop |
session_start / beforeAgentResponse | SessionStart |
| anything else | error (CLI no-ops) |
Windsurf exit codes: 0 = success, 2 = block (pre-hooks only). We
never block, so the adapter output is always consumed with exit 0.
Output contract: Windsurf ignores extra fields on advisory hooks,
so we ship { "continue": true } plus optional context / message
fields for downstream builds that honour them.
Structs§
- Windsurf
Adapter - Zero-sized marker — no adapter state.