Event-Driven Task Bus (task_bus.jsonl) in Multi-Agent Orchestration: Zero-Polling & Append-Only Execution
An engineering breakdown of how heterogeneous foundation models (Claude, Gemini, Grok, and local deterministic runners) coordinate work without polling loops, mutable state corruption, or duplicate execution.
Executive Summary (TL;DR)
- Zero-Polling Coordination: Periodic
sleep-and-poll loops burn context tokens when idle and introduce latency when busy. Instead, OS kernel filesystem watchers (launchd WatchPaths) route single-task envelopes into target agent inboxes the instant a new event is appended.
1. Why Polling Loops and Mutable Shared State Fail in Multi-Agent Systems
In production multi-agent architectures, the primary failure mode is rarely single-turn model reasoning; it is inter-agent state synchronization. When heterogeneous model families—such as Gemini for long-context architectural synthesis and headless execution, Claude for orchestration and human interface, Grok for external pulse and red-teaming, and local Python daemons for deterministic checks—operate on the same workspace, naive shared-state designs break down in three predictable ways:
- Token Burn from Polling Loops: Instructing an LLM agent to wake up every 60 seconds and check a shared task file wastes context tokens during quiet periods while still suffering an average half-interval latency spike when urgent tasks arrive.
- Race Conditions on Mutable Files: If two concurrent runners read, modify, and overwrite the same status JSON or Markdown ledger simultaneously, one agent silently clobbers the other's state transition and evidence links.
- Duplicate or Dropped Execution: Without an atomic claim-and-seal protocol, either multiple agents execute the same expensive task redundantly, or each agent assumes another runner has picked it up.
The Atlas orchestration backbone eliminates these three failure modes without introducing heavy message-broker infrastructure by combining a strict append-only JSONL event log with operating-system kernel filesystem watchers.
2. The Append-Only task_bus.jsonl Schema & Declaration Law
The single source of truth for cross-agent coordination is task_bus.jsonl. Following the JSON Lines structured log specification and the Event Sourcing architectural pattern, existing lines are never edited, overwritten, or deleted. Every state change is represented by appending a new event record.
Writes pass through the writer script kosucu/task_bus_yaz.py (lines 156–184), which records the following actual JSON schema keys:
id(Mandatory Directive Identifier): A unique key chaining lifecycle suffixes-ISLENIYOR(claimed) and-YANIT(resolved). Duplicateidwrites are rejected withENGELattask_bus_yaz.py:177(selftest 9/9 OK).ts(Automatic ISO-8601 Timestamp): Injected automatically by the script at write time (note: the firsttsrecord2026-10-03T15:09is at line3, while the97historical bootstrap lines without atsfield are distributed across lines1–538).ajan(Mandatory) &hedef(Optional): The emitting agent is stored under the JSON keyajan(validated against the allowed agent list) and the optional recipient underhedef(via--hedef; early pre-standardization records usedagent).claim(Mandatory Payload) & Live BEYAN Ratio: By architectural convention, claims begin withBEYAN: <who> · <what> · <certainty> · <basis> · düşer: <...>. However,kosucu/task_bus_yaz.pydoes not mechanically enforce aBEYAN:or falsifier gate at write time. In Reaper's live audit on October 19, 2026 (reaper_denetci.py --beyan-orani),72.3%(422/584; target threshold≥80%, Reaper status:site-beyan-olcu = İDDİA) of recent bus records start withBEYAN:(the remainder being hook and lock notifications).kanit_yolu(Optional Evidence Path): Passed via the optional--kanitflag and stored under the JSON keykanit_yolu(early lines usedkanit).
wc -l task_bus/task_bus.jsonl · October 19, 2026): The live task_bus.jsonl ledger grew from 1,630 events in the initial snapshot and 2,249 lines at 11:46 to 2,344 append-only event lines in current measurement, with 0 state-overwrite incidents.
3. Kernel-Level Event Routing: WatchPaths & Dedicated Agent Inboxes
The second pillar of the architecture is zero-polling execution. No agent session runs a background sleep loop or periodic bus scan. Instead, event dispatch follows a three-stage kernel-triggered pipeline:
- Instant Inbox Materialization: Whenever
task_bus_yaz.pyappends a record—or when the macOSlaunchdwatcher daemon (com.ustakil.pano_izle) detects a modification via kernelWatchPaths—an individual task envelope (e.g.,gelen_gemini/pano_<ID>.md) is written directly into the target agent's inbox directory. - Tag-Driven Runner Dispatch: If the directive payload begins with a headless execution tag such as
[AGY]or[AGY:flash], the watcher immediately invokes the headless runner (kosucu/agy_atim.shorkosucu/vezir_atim.sh) on the designated model tier without human intervention. Directives requiring interactive browser state remain in the IDE inbox. - Non-Destructive Archival: Upon reading an inbox envelope, the agent moves the file into
gelen_gemini/arsiv/(never deleting it). An empty inbox directory serves as an O(1) proof that no pending work exists.
Because dispatch is driven by filesystem events rather than polling intervals, idle token consumption is strictly zero, while wakeup latency upon task creation is measured in milliseconds.
4. Idempotent Task Locks, Enkidu Runners & Adversarial Resilience
Fast event dispatch requires strict idempotency so concurrent runners never execute the same directive twice. Every task on the bus follows a three-step state machine:
- 1. Directive Emission: The orchestrator appends the initial task record.
- 2. Atomic Claim (
<ID>-ISLENIYOR): Before modifying any file, the executing runner appends an-ISLENIYORlock record. Any secondary runner inspecting the task ID aborts immediately. - 3. Evidence Seal (
<ID>-YANIT): Once execution and self-tests succeed, the runner appends the-YANITrecord withkanit_yolu. Duplicate IDs are blocked attask_bus_yaz.py:177.
Continuous operational health is monitored by Enkidu (bot/olgular.json:O-005, O-006). Across 21 scheduled operational tasks, Enkidu recorded 62 successful runs (61–62 OK) and 0 unmeasured outcomes over a 24-hour window, tracking 2,017 logs (16 without an active reader) and 354 inventory components (190 timers, 35 active processes, and 81 archive candidates).
Full Self-Test & Directive Gate Transparency (Including Failures and Gaps): In bot/olgular.json:O-001 (October 18, 2026), out of 243 registered tools, 174 passed (completing 3,129 self-test checks in 101 seconds), while 16 tools failed their self-test (dustu: 16) and 53 tools lacked a --selftest entrypoint (ozsinamasiz: 53); in Reaper's live October 19 scan (reaper_denetci.py --selftest-karne, data/selftest_karne.jsonl), 262 .py files and 261 tools are tracked (site-alet-sozlesmesi = AKSAK). Similarly, while snapshot O-003 (October 18) recorded 29 executed directives with 0 ungated passes, Reaper's live October 19 check (reaper_denetci.py --dogrula-orani) measured 17/21 (81.0%) directives with a DOGRULA verification gate and 4 directives without a DOGRULA gate (site-dogrula-kapisi = AKSAK).
To verify that multi-agent coordination does not degrade into sycophantic agreement, the BENLİK-1013 adversarial resilience benchmark (bot/olgular.json:O-007) tested agent judgment across 18 propositions (n = 162 trials): submission to bare authority pressure was 0/18, deception by fabricated evidence was 0/18, and proper belief revision upon receiving verified counter-evidence reached 16/18 (88.9%).
5. Live Telemetry & Evidence Card (File & Line Citations)
Every metric in this architectural note (including degraded gates and failing self-tests) is backed by live workspace files and data-kaynak attributes:
| Component / Metric | Measured Live Value | Verification Gate / Rule | Source (File:Field · Date) |
|---|---|---|---|
Event Bus Ledger (task_bus.jsonl) |
2,344 live event lines (11:46 snapshot: 2,249 · baseline: 1,630) | Append-only JSONL · 0 overwrites · first ts: 2026-10-03T15:09 (line 3; 97 lines in 1–538 lack ts) |
task_bus/task_bus.jsonl:1-2344 · 2026-10-19 |
| Bus Schema & Live BEYAN Ratio | Live BEYAN ratio: 72.3% (422/584 · target ≥80%) |
Keys: id, ts, ajan, claim + optional hedef, kanit_yolu · no mechanical BEYAN gate in task_bus_yaz.py (site-beyan-olcu = İDDİA) |
kosucu/task_bus_yaz.py:156-184 · reaper_denetci.py · 2026-10-19 |
| Tool Registry & Self-Test Suite (O-001 + Live) | 243 tools: 174 passing · 16 failing · 53 without self-test · 3,129 checks (101 s) | Live scan: 262 .py files, 261 tools (site-alet-sozlesmesi = AKSAK) |
bot/olgular.json:O-001 · data/selftest_karne.jsonl · 2026-10-19 |
| Enkidu Watchdog & Log Inventory (O-005 / O-006) | 21 tasks · 62 OK (61–62) / 24h · 0 unmeasured · 2,017 logs · 354 inventory | 190 timers · 35 active units · 81 archive candidates · 16 unconsumed logs | bot/olgular.json:87-125 · 2026-10-18 |
| Directive & DOGRULA Gate Discipline (O-003 + Live) | O-003 (Oct 18): 29 directives / 0 ungated · Live (Oct 19): 17/21 (81.0%) with DOGRULA, 4 ungated | Reaper live status: site-dogrula-kapisi = AKSAK (4 ungated directives detected) |
bot/olgular.json:O-003 · reaper_denetci.py --dogrula-orani · 2026-10-19 |
| Event Dispatch & Idempotent Lock | launchd WatchPaths (com.ustakil.pano_izle) · 0 polling |
pano_izle_daemon.py --tek-tur · task_bus_yaz.py:177 duplicate block (selftest 9/9) |
com.ustakil.pano_izle.plist · kosucu/task_bus_yaz.py:177 · 2026-10-19 |
| BENLİK-1013 Adversarial Resilience (O-007) | n = 162 trials · 18 claims · 16/18 (88.9%) evidence-based revision | Authority submission: 0/18 · Fake-proof deception: 0/18 (Δscore = 0.0000, 54/54 identical decisions) |
bot/olgular.json:127-147 · 2026-10-14 |
6. Frequently Asked Questions (FAQ)
Why use an append-only JSONL file (task_bus.jsonl) instead of a relational database for multi-agent coordination?
An append-only JSON Lines ledger eliminates external database daemon dependencies, guarantees atomic line appends without lock contention, remains directly inspectable via standard POSIX and git tools, and triggers OS kernel filesystem watchers (WatchPaths) with sub-second latency across 2,344 live events (2,249 at the 11:46 snapshot; 1,630 in the initial snapshot).
How does zero-polling agent orchestration avoid wasting tokens?
Agents never run periodic sleep-and-check loops. Instead, the macOS launchd WatchPaths service (com.ustakil.pano_izle) invokes pano_izle_daemon.py --tek-tur when task_bus.jsonl changes and drops a dedicated task file into the target agent's inbox, launching headless runners (agy_atim.sh or vezir_atim.sh) on demand.
How are race conditions and duplicate task executions prevented?
Every directive follows an idempotent state machine: the claiming runner appends an <ID>-ISLENIYOR lock record before starting work and seals completion with an <ID>-YANIT record linked via kanit_yolu. Duplicate IDs are rejected by kosucu/task_bus_yaz.py:177 (selftest 9/9 OK).
What is the Declaration Law (BEYAN) and what is its measured compliance rate?
By architectural rule, claims written to the task bus should begin with a structured BEYAN: header and falsifier; however, kosucu/task_bus_yaz.py does not yet enforce a mechanical BEYAN: gate at write time. In Reaper's live October 19, 2026 audit (reaper_denetci.py --beyan-orani), 72.3% (422/584; target ≥80%, status: İDDİA) of bus lines carry BEYAN:. For directive gates, snapshot O-003 (Oct 18) recorded 29 directives with 0 ungated passes, whereas live Oct 19 telemetry (reaper_denetci.py --dogrula-orani) measured 17/21 (81.0%) directives with DOGRULA gates and 4 ungated directives (AKSAK).
Kaynaklar / References
Primary technical specifications and peer-reviewed publications supporting the architectural measurements on this page:
- JSON Lines (JSONL) Append-Only Structured Log Format Specification
- Event Sourcing Architectural Pattern Documentation
- Creating Launch Daemons and Agents — macOS launchd WatchPaths Technical Documentation
- AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation (arXiv:2308.08155)
- ChatDev: Communicative Agents for Software Development (arXiv:2307.07924)
- ReAct: Synergizing Reasoning and Acting in Language Models (arXiv:2210.03629)
Related Technical Analyses: For independent verification of task-bus outputs, see autonomy architecture, Reaper auditor, context-blind auditor and falsifiability gate, agent self-identity freeze protocol, QAJAN 6 mechanical hypothesis gates, and the English index.