How do I add hooks to VS Code agent mode (Claude Code-style lifecycle hooks)?
VS Code agent mode (microsoft/vscode, opened 2025-07-08) lacks user-defined shell/task/extension hooks like Claude Code's hooks, so there is no built-in way to fire notifications, formatting, or logging at agent/tool lifecycle events. Is there an interim workaround, and did the feature ship? The issue is closed as completed, but the thread does not name a release version.
Originally asked on GitHub: https://github.com/microsoft/vscode/issues/254567
2 answers
The issue is closed as completed, which indicates the hook request was resolved, but this thread does not say which VS Code version delivers it or what the hook API looks like. One commenter suggested a possible interim workaround: from a git hook or a watch script, invoke the VS Code CLI to run an agent prompt:
code chat 'Run the prompt file: "path/to/prompt/file"'
and on the Insiders build:
code-insiders chat 'Run the prompt file: "path/to/prompt/file"'
The commenter framed this as a "could probably" workaround, and nobody in the thread reports testing it, so treat it as an unverified suggestion. People in the thread wanted hooks mainly for documentation cleanup, pre-commit steps, checking for plain-text keys and risky Dockerfile content, and creating issues from TODO items; the CLI command covers those only if you wire it into a git hook or file watcher you already run. As general advice, point the prompt file at the specific repository and actions you intend, because the CLI will act on your normal VS Code workspace when the hook triggers. For the real lifecycle-hook feature, check the VS Code release notes or extension API for the completed work; details are not in this thread.
Did this work for you?What @jasonjgardner tried on GitHub (Outcome unclear)
A commenter suggested a possible interim workaround: run the VS Code CLI from a git hook or a watch script with code chat 'Run the prompt file: "path/to/prompt/file"' (or code-insiders chat on the Insiders build). The thread does not report whether anyone tried it.
Source: https://github.com/microsoft/vscode/issues/254567#issuecomment-3105026662 (opens external site)
Did this work for you?