Skip to content

Instantly share code, notes, and snippets.

@MuhammadYossry
Created April 29, 2026 10:28
Show Gist options
  • Select an option

  • Save MuhammadYossry/6d49308b31822e4a37ccd4c17447e231 to your computer and use it in GitHub Desktop.

Select an option

Save MuhammadYossry/6d49308b31822e4a37ccd4c17447e231 to your computer and use it in GitHub Desktop.
“The power of an agent system comes from agents that compose without coupling.” — adapted for LLM multi-agent systems

LLM Agent Filesystem — Part 2: Inter-Agent Communication

“The power of UNIX comes from the ability of programs to work together.” — Brian Kernighan

“The power of an agent system comes from agents that compose without coupling.” — adapted for LLM multi-agent systems

Prerequisite: This article extends Part 1: LLM Agent Filesystem. All file ownership rules, frontmatter conventions, budgets, and pruning policies from Part 1 still apply.


Table of Contents


Introduction

In Part 1, we treated each LLM agent as a self-contained filesystem.

That model solved memory, learning, identity, and governance for a single agent.

But real systems rarely use one agent.

Modern workflows often need multiple specialists:

  • A backend engineer agent
  • A data analyst agent
  • A researcher agent
  • A QA reviewer agent
  • An orchestrator agent

Each may be excellent individually, yet the system still fails if they cannot communicate cleanly.

This article proposes a practical solution:

Use Unix-style Inter-Process Communication (IPC) as the model for Inter-Agent Communication (IAC).

Instead of processes exchanging bytes, agents exchange structured files.


The Problem: Agents Are Isolated by Design

Isolation is good.

Each agent having its own directory means:

  • No context pollution
  • Clear ownership
  • Easier debugging
  • Independent rewards and learning
  • Better specialization

But isolation creates a new challenge:

How do separate agents collaborate without reading each other’s private memory?

Example:

  • Orion knows databases and APIs.
  • Iris knows statistics and anomaly detection.

A task arrives:

“Build an April analytics pipeline and validate anomalies.”

Neither agent alone is ideal.

They must cooperate.

That is exactly the problem Unix solved for processes decades ago.


Unix IPC → Agent IAC Mapping

Unix Primitive Purpose Agent Equivalent Use Case
Pipe Sequential stream Handoff file One agent passes output to another
FIFO Named queue Shared queue file Persistent task backlog
Semaphore Lock access Lock file Prevent concurrent writes
Message Queue Typed async messages Inbox / outbox Requests, replies, notifications
Shared Memory Shared data region Shared context segment Common evolving workspace

The key insight:

Multi-agent systems need communication primitives, not ad hoc prompts.


Extended Directory Structure

agents/
├── shared/
│   └── iac/
│       ├── registry.md
│       ├── queues/
│       ├── semaphores/
│       └── segments/
│
├── orion/
│   └── iac/
│       ├── inbox.md
│       ├── outbox.md
│       └── handoffs/
│
├── iris/
│   └── iac/
│       ├── inbox.md
│       ├── outbox.md
│       └── handoffs/
│
└── orchestrator/
    └── iac/

Ownership Model

PRIVATE TO AGENT
- inbox.md
- outbox.md
- handoffs/

SHARED MEDIATION LAYER
- queues/
- semaphores/
- segments/

OPERATOR CONTROLLED
- registry.md
- schemas
- permissions

Primitive 1 — Pipes: Sequential Handoffs

Unix Idea

A pipe connects one program’s output to another program’s input.

cat data.csv | grep error | sort

Each process does one step well.

Agent Equivalent

One agent finishes work and writes a handoff file for the next agent.

Example

Orion runs a SQL query. Iris validates results.

---
type: handoff
sender: orion
receiver: iris
payload_type: query-results
status: ready
---

# Context

April events report generated.
Please validate for anomalies.

# Summary

Rows: 847
Range: 2026-04-01 to 2026-04-28

Why It Works

The receiving agent gets:

  • What happened
  • Why it matters
  • What to do next

That is more useful than raw data alone.


Primitive 2 — FIFOs: Persistent Work Queues

Unix Idea

A FIFO is a named queue.

Processes can add work and another process consumes it in order.

Agent Equivalent

Use a shared queue file.

---
type: queue
name: analytics-tasks
budget: 50
depth: 2
---

## item-002
- task: validate anomalies
- producer: iris

## item-001
- task: daily sync
- producer: orchestrator

Consumer reads oldest item first.

Best Use Cases

  • Background jobs
  • Batch processing
  • Retry backlogs
  • Shared task intake

Primitive 3 — Semaphores: Coordination Locks

Unix Idea

A semaphore prevents multiple processes from modifying the same resource simultaneously.

Agent Equivalent

Use a lock file before writing shared state.

---
type: lock
resource: project-alpha.segment
state: held
holder: orion
ttl_minutes: 10
---

Why This Matters

Without locks:

  • Orion writes version A
  • Iris writes version B simultaneously
  • Data becomes inconsistent

Locks prevent race conditions.


Primitive 4 — Message Queues: Async Inbox Communication

Unix Idea

Processes send typed messages asynchronously.

Agent Equivalent

Each agent gets an inbox.

## msg-007
- type: review-request
- sender: iris
- priority: high
- subject: Validate ETL gap cause

The sender continues working immediately.

No need to block.

Good Uses

  • Review requests
  • Capability checks
  • Escalations
  • Notifications
  • Delegation

Primitive 5 — Shared Memory: Shared Context Segments

Unix Idea

Multiple processes access one memory region.

Agent Equivalent

A shared markdown file acts as a collaborative workspace.

---
type: shared-segment
name: project-alpha
version: 7
---

## [ORCHESTRATOR]
Goal: Ship April analytics dashboard

## [ORION]
Indexes created.
Pipeline query complete.

## [IRIS]
Detected zero-event days on Apr 14 and Apr 21.

Why It Helps

Every agent sees the latest agreed context.

No repeated explanations needed.


A Complete Multi-Agent Example

Let’s combine everything into one realistic workflow.

Scenario

A company needs an April events dashboard.

Tasks:

  1. Extract backend data
  2. Detect anomalies
  3. Confirm root cause
  4. Approve release

Agents

  • Orchestrator → routes work
  • Orion → backend + SQL
  • Iris → analytics + anomaly detection

Communication Flow

flowchart TD
    A[New Dashboard Request] --> B[Queue Item Created]

    B --> C[Orchestrator Dequeues Task]

    C --> D[Message to Orion: Build Query]
    D --> E[Orion Runs SQL]
    E --> F[Handoff File to Iris]

    F --> G[Iris Validates Data]
    G --> H{Anomalies Found?}

    H -->|No| I[Message to Orchestrator: Approved]
    H -->|Yes| J[Review Request to Orion]

    J --> K[Orion Confirms ETL Failure]
    K --> L[Shared Segment Updated]

    L --> M[Orchestrator Blocks Release]
Loading

What Actually Happened

Step 1 — Queue

The orchestrator receives a new dashboard request.

It adds work to analytics.queue.

Step 2 — Delegation

The orchestrator sends Orion:

Build April events query.

Step 3 — Pipe / Handoff

Orion finishes and hands results to Iris.

Step 4 — Validation

Iris notices two dates with zero events.

Step 5 — Message Queue

Iris asks Orion:

Are Apr 14 and Apr 21 expected gaps?

Step 6 — Shared Memory

Orion confirms ETL failure and updates shared project segment.

Step 7 — Decision

Orchestrator pauses dashboard release.


Why This Example Matters

No agent needed another agent’s private files.

Communication was:

  • Structured
  • Auditable
  • Replaceable
  • Explainable

That is scalable collaboration.


Failure Modes and Recovery

Pipe Not Consumed

Receiver never reads handoff.

Fix: Use TTL and reroute.


Queue Overflow

Too many tasks waiting.

Fix: Apply backpressure. Producers retry later.


Stale Lock

Agent crashes while holding lock.

Fix: TTL expires, next agent reclaims lock.


Message Ignored

Inbox grows unacknowledged.

Fix: Alert orchestrator or auto-escalate.


Shared Segment Conflict

Two writes race.

Fix: Require lock + version checks.


Design Rules for Reliable Communication

Keep Payloads Small

Use references to larger files instead of giant inbox messages.

Use Typed Messages

Examples:

  • review-request
  • task-delegation
  • capability-query
  • alert

Prefer Single Responsibility

Each primitive should do one job:

  • Queue = pending work
  • Inbox = communication
  • Segment = shared state
  • Lock = coordination

Add Time Limits

Every transient file should expire eventually.

Preserve Audit Trails

Outboxes, lock history, and version numbers matter.


Why This Model Works

Unix IPC succeeded because it gave independent programs a common language.

This model does the same for agents.

Instead of custom prompts and brittle glue logic, agents interact through stable conventions.

Benefits:

Modularity

Replace Iris with another analyst agent without redesigning Orion.

Observability

Every message and handoff is inspectable.

Recoverability

Failures are visible and retryable.

Scalability

More agents can join by registering endpoints.

Explainability

Humans can understand the workflow by reading files.


Closing Thoughts

Single-agent systems solve narrow tasks.

Multi-agent systems solve real workflows.

But adding more agents without communication design only creates chaos.

The solution is not magical orchestration.

It is disciplined interfaces.

Unix taught us that independent components become powerful when connected through simple primitives.

LLM systems can use the same lesson:

Pipes for handoffs. Queues for work. Locks for coordination. Messages for requests. Shared segments for common truth.

That is how agents collaborate without coupling.


Previous Parts of the LLM Agent Filesystem series

License: MIT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment