Skip to content

feat: Mailbox — persistent per-agent message inbox #2

Closed

Description

@EngineerProjects

Summary

Implement a mailbox system that gives each agent a persistent, async inbox.
Agents can send typed messages to each other without being co-located or running at the same time.

Depends on: #1 (AgentProfile)

Scope

  • internal/mailbox/mailbox.go — core types and Mailbox interface
  • internal/mailbox/sqlite.go — SQLite-backed implementation
  • No TUI in this issue — core layer only

Message types (proposed)

```go
type MessageKind string

const (
KindTask MessageKind = "task" // delegate a task to another agent
KindReply MessageKind = "reply" // reply to a previous message
KindBroadcast MessageKind = "broadcast" // fan-out to all agents in a team
KindEvent MessageKind = "event" // system event (agent started, finished, …)
)

type Message struct {
ID string
Kind MessageKind
FromAgent string // AgentProfile.ID
ToAgent string // AgentProfile.ID or "*" for broadcast
Subject string
Body string
ReplyTo string // parent Message.ID if this is a reply
CreatedAt time.Time
ReadAt *time.Time
}
```

Mailbox interface (proposed)

```go
type Mailbox interface {
Send(ctx context.Context, msg Message) error
Receive(ctx context.Context, agentID string) ([]Message, error) // unread messages
MarkRead(ctx context.Context, msgID string) error
History(ctx context.Context, agentID string, limit int) ([]Message, error)
}
```

Acceptance criteria

  • Message and MessageKind types exported from internal/mailbox
  • Mailbox interface defined
  • SQLite implementation with schema migration on first open
  • Broadcast fan-out expands to individual messages per recipient
  • Unit tests covering send, receive, mark-read, broadcast
  • Thread-safe (concurrent sends from multiple goroutines)

Notes

Activity

  1. added
    enhancement
    core
    multi-agent
    architecture
    on Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    architecturecoreenhancementmulti-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions