Skip to main content
DocWriter is a wrapper around the Claude Agent SDK. Hooks fire on the SDK’s standard events, configured through the hooks panel. The events most useful for writing workflows: PostToolUse is the default for most “do something after the agent edits a file” hooks. Pair it with a matcher like Edit|Write to filter to file mutations. For the full event list, JSON schemas, return-value semantics, and advanced configuration, see the Claude Agent SDK hooks reference. Anything the SDK supports works in DocWriter.

Matching on tool name

PreToolUse, PostToolUse, and PostToolUseFailure are scoped to a particular tool. Use the matcher field (a regex, case-insensitive) to narrow which tools the hook applies to: For non-tool events (Stop, UserPromptSubmit, Session*, Notification), the matcher is ignored.

Common patterns

Rebuild on every edit

Commit at the end of a turn

Lint before the agent writes

When a PreToolUse hook exits non-zero, the SDK blocks the tool call. The agent sees the failure and can adapt.

Notify on failure

Where to go next

  • Hooks. The hooks panel and how to add them.
  • Preview. Connect a hook’s output to a live preview window.