bruteSourceBruteQueueFileMutationQueue

module FileMutationQueue

Per-file serialization queue for concurrent tool execution.

When tools run in parallel (via threads or async fibers), multiple tools may target the same file simultaneously. Without serialization, a sequence like [read → patch → write] on the same file would race and lose edits.

This module provides a single public method:

Brute::FileMutationQueue.serialize("/path/to/file") do # snapshot + read + modify + write — all atomic for this path end

Design (mirrors pi-mono's withFileMutationQueue):

Ruby 3.4's Mutex is fiber-scheduler-aware, so this works correctly with both :thread and :task (Async) concurrency strategies.

Nested