transcript-capture-detached-background-process-pattern

Session-close hooks must complete in under 1 second to avoid blocking Claude Code. The transcript capture hook spawns conversation-flush.py as a detached background process (nohup + subprocess.Popen with DEVNULL stdout/stderr) and exits immediately. The flush script then runs independently for 30-60 seconds extracting insights via the Agent SDK. This pattern applies to any hook that needs to do LLM work at session close.