Add option to flush session JSONL on each message turn

Resolved 💬 4 comments Opened Mar 28, 2026 by dhruv-anand-aintech Closed Apr 30, 2026

Summary

Claude Code currently batches writes to ~/.claude/projects/**/*.jsonl, flushing at certain points (end of turn, tool result, etc.) rather than after every message append. This makes it difficult to build live session viewers or tooling that monitors the JSONL in real time.

Requested change

Add a config option in settings.json (e.g. flushJSONLOnWrite: true) that causes Claude Code to flush the JSONL file to disk immediately after each message entry is appended.

Use case

  • Live session viewers (e.g. a web dashboard that tails the JSONL via fs.watch and streams updates to a browser)
  • Debugging tools that monitor conversation state in real time
  • Any tooling that relies on fs.watch / inotify / FSEvents to react to new messages as they happen

Current workaround

Tools must either poll the file on a short interval (unreliable, CPU-wasteful) or wait for Claude Code's natural flush points, which means updates only appear at turn boundaries rather than as messages stream in.

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗