Principle:23blocks OS Ai maestro AMP Storage
| Knowledge Sources | |
|---|---|
| Domains | Agent_Messaging, Persistence |
| Last Updated | 2026-10-26 10:00 GMT |
Overview
A per-agent message storage layout where inbox and sent folders are keyed by UUID, with a name-to-UUID index for resolution.
Description
AMP messages are stored per-agent at `~/.agent-messaging/agents/<uuid>/messages/inbox/<sender>/<id>.json`. The UUID-based directory is canonical — the agent name is never used as a directory name (it can change). A name-to-UUID index (`~/.agent-messaging/agents/.index.json`) resolves names to UUIDs for lookups.
The inbox writer validates message IDs against safe-id rules before writing (path traversal prevention). The sent folder mirrors the inbox structure, keyed by recipient. `initAgentAMPHome` creates the directory structure and a clean config — deliberately NOT inheriting the machine's cryptographic identity (a guard against identity contamination).
Usage
Use this principle when designing per-entity message storage where:
- The entity name can change but the UUID is stable
- Path traversal via crafted message IDs must be prevented
- Each entity's cryptographic identity must be independent (no shared keys)
Theoretical Basis
The storage layout is UUID-keyed with name index:
~/.agent-messaging/agents/
.index.json → { name: uuid }
<uuid>/
config.json
messages/inbox/<sender>/<id>.json
messages/sent/<recipient>/<id>.json
keys/
registrations/
The UUID is the canonical key; the name is a human-facing alias resolved through the index. This decouples storage from naming — renaming an agent updates the index, not the storage.