Visual Studio Code Agent hook for auditing your AL coding sessions.
Explains VS Code Agent Hooks (in preview) as deterministic shell commands that run at agent lifecycle events, as opposed to skills that the model decides to use. The author shares a hook for AL projects that logs SessionStart, PreToolUse and PostToolUse events to a Markdown audit file, which records reads, commands and session context that Git history misses.

post Stefano Demiliani
"Hooks enable you to execute custom shell commands at key lifecycle points during agent sessions."
Key points
- Hooks fire at lifecycle events without model judgment, while skills are loaded only when the model thinks they are relevant
- VS Code supports eight hook events, configured as JSON files that map events to commands
- The shared audit hook goes in the .github folder of an AL project and writes timestamp, session id, event, tool and detail rows to an audit log
- An environment variable in the hook config controls which events get logged
- Unlike Git diffs, the log captures file reads, terminal commands, uncommitted actions and session context
Quotes
- “Hooks enable you to execute custom shell commands at key lifecycle points during agent sessions.” (Explains the core mechanism of agent hooks for automation and control during AI-assisted coding.)
Context
- Features: Agent Hooks lifecycle events, SessionStart hook, PreToolUse hook, PostToolUse hook, PreCompact hook, SubagentStart hook, SubagentStop hook, Stop hook
Source: Stefano Demiliani, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.