Skip to main content

Module extract

Module extract 

Source
Expand description

Pull out structured metadata (request id, model, usage) from raw request/response shapes.

Functions§

extract_cwd
Extract the Claude Code working-directory marker from a request body’s system field. Looks for a line starting with Primary working directory: (case-sensitive, anchored to line start) and returns the trimmed path. Handles both system: "..." (string) and system: [{"type":"text","text":"..."}] (block list) shapes.
extract_model_from_request_body
extract_request_id