Architecture overview
The IPC system is built on three core components:- Per-group namespaces - Each group gets its own IPC directory at
data/ipc/{group}/ - File-based message passing - JSON files are written to subdirectories and polled by the host
- Authorization checks - The directory name determines the source group identity
data/ipc
main
messages
tasks
input
family-chat
messages
tasks
input
errors
How it works
Starting the IPC watcher
The IPC watcher starts at application launch and runs continuously, polling for new files atIPC_POLL_INTERVAL (default: 1000ms on the host). Inside containers, the agent runner polls its own IPC input directory at 500ms intervals.
From src/ipc.ts:
Message flow
Agent writes IPC file
The agent running in a container writes a JSON file to
/workspace/ipc/messages/ or /workspace/ipc/tasks/.Example message file:The
chatJid format varies by channel: 1234567890@s.whatsapp.net for WhatsApp, tg:12345 for Telegram, discord:12345 for Discord, etc.Host polls IPC directory
The IPC watcher on the host scans
data/ipc/{group}/messages/ and finds the new JSON file.Authorization check
The host determines the source group from the directory path (
{group}) and verifies the operation is authorized.From src/ipc.ts:Execute operation
If authorized, the host executes the requested operation (send message, schedule task, etc.).
IPC operations
Send message
Allows agents to send messages to chats. File location:data/ipc/{group}/messages/message-{timestamp}.json
Format:
chatJid and text from the JSON file. Any additional fields are ignored by the core IPC handler.
Authorization:
- Main group can send to any chat
- Non-main groups can only send to their own chat
Schedule task
Creates a scheduled task that runs at specified intervals. File location:data/ipc/{group}/tasks/task-{timestamp}.json
Format:
schedule_type:cron,interval, oronceschedule_value: Cron expression, milliseconds, or ISO timestampcontext_mode:group(shared session) orisolated(fresh session)targetJid: The chat JID to associate with this task
- Main group can schedule tasks for any group
- Non-main groups can only schedule tasks for themselves
processTaskIpc function in src/ipc.ts:
Pause task
Pauses an active task. Format:Resume task
Resumes a paused task. Format:Update task
Updates an existing task’s prompt, schedule type, or schedule value. The next run time is automatically recalculated when the schedule changes. Format:taskId are optional — only include the fields you want to change.
Authorization:
- Main group can update any task
- Non-main groups can only update their own tasks
Cancel task
Deletes a task permanently. Format:Refresh groups
Forces a refresh of group metadata. Main group only. Format:src/ipc.ts:
Register group
Registers a new group for agent access. Main group only. Format:Task snapshot refresh
When a task mutation succeeds (schedule_task, pause_task, resume_task, cancel_task, or update_task), the host immediately refreshes the current_tasks.json snapshot for all registered groups. This ensures that a subsequent list_tasks call within the same agent session sees the updated task list without waiting for a container restart.
The refresh is implemented via an onTasksChanged callback in IpcDeps, keeping ipc.ts decoupled from the container and snapshot layers.
Security model
Identity verification
The source group identity is determined by the directory path, not the file contents. This prevents impersonation attacks. From the IPC watcher insrc/ipc.ts:
Mount isolation
Each container can only write to its own IPC namespace:- Main group:
/workspace/ipc→data/ipc/main/ - Other groups:
/workspace/ipc→data/ipc/{group}/
src/container-runner.ts:
Error handling
Failed IPC operations are moved todata/ipc/errors/ with a prefix identifying the source group:
From src/ipc.ts:
Debugging IPC issues
Check for failed IPC operations
Check for failed IPC operations
Monitor IPC activity
Monitor IPC activity
Verify IPC directory permissions
Verify IPC directory permissions
Test IPC manually
Test IPC manually
Performance considerations
Related pages
- Security model - Authorization and trust boundaries
- Container runtime - How agents execute in containers
- Troubleshooting - Common IPC issues