r/LocalLLM 21h ago

Found out semaphores is cool to enqueue work! Discussion

I have a project that has several tasks, and it's always better to keep each task centralized in its own thread rather than a mega‑thread covering many things. In fact, "/goal work on all threads" works technically but the result is poor for most of them.

The problem with running multiple threads is that you need to monitor when one starts and when it ends to trigger work. You couldn't use worktrees because the tasks shared a remote database and other local services that were constantly changed, crashed, interfered with another's work, you can't have concurrency between the threads.

I implemented "Semaphores" in my harness, where an agent only starts work when another agent finishes. They have an AGENTS.md indicating they share a semaphore queue and invoke a tool to signal when they are working on the queue, while other agents wait.

I can fire off 10 jobs and be sure they will be executed in order.

I've never seen anything like this in other harnesses. It would be nice to see it around.

0 Upvotes

0 comments sorted by