Mailbox Runtime Contracts¶
This page explains the runtime-owned contract around mailbox configuration, manifest-backed bindings, projected skills, and agents mail request and result handling.
Mental Model¶
The runtime is the authority for mailbox attachment to a session.
- Declarative config or CLI overrides choose the mailbox transport and identity.
- The runtime resolves that into one
MailboxResolvedConfig. - The session manifest persists that resolved mailbox binding as the durable mailbox authority reused by resume and gateway transport access.
- The runtime projects the mailbox system skill into the built brain home under a visible tool-native flat Houmao-owned skill surface: Claude and Codex use top-level
skills/houmao-.../, while Gemini uses top-level.gemini/skills/houmao-.../. - Later mailbox work resolves current bindings through
pixi run houmao-mgr agents mail resolve-liveinstead of assuming the provider process's inherited mailbox env snapshot is still current. - That same command is also the runtime-owned discovery path for the attached shared-mailbox gateway facade: when a valid live gateway is attached it returns a
gatewayobject withbase_url,host,port,protocol_version, andstate_path; otherwise it returnsgateway: null.
Declarative And Resolved Config¶
The declarative mailbox payload supports these fields:
transportprincipal_idaddressfilesystem_root
Current rules:
transportis required whenmailboxis present.filesystemandstalwartare implemented in v1.- If
principal_idis omitted, the runtime derives one from the tool, role, and optional agent identity. - If
addressis omitted for an ordinary managed agent, it defaults to<agentname>@houmao.localhostwhile the principal id remains the canonicalHOUMAO-<agentname>form. - If
filesystem_rootis omitted in maintained project-aware flows, it defaults to<active-overlay>/mailbox, bootstrapping<cwd>/.houmao/mailboxwhen no overlay exists yet;HOUMAO_GLOBAL_MAILBOX_DIRor an explicitfilesystem_rootoverride still wins when supplied. stalwartbindings resolve from eitherbase_urlor explicitjmap_urlplusmanagement_url.- Persisted
stalwartbindings remain secret-free and storecredential_refinstead of inline credentials.
Representative resolved payload:
{
"transport": "filesystem",
"principal_id": "HOUMAO-research",
"address": "research@houmao.localhost",
"filesystem_root": "/abs/path/tmp/shared-mail",
"bindings_version": "2026-03-13T09:15:30.123456Z"
}
That persisted launch_plan.mailbox payload is also the durable mailbox capability contract reused by resume, refresh, and gateway-side integrations. The gateway mail transport uses that durable manifest-backed capability rather than persisting a second mailbox copy under gateway/.
Manager-Owned resolve-live Contract¶
pixi run houmao-mgr agents mail resolve-live is the supported current-mailbox discovery surface.
Top-level fields:
sourcetransportprincipal_idaddressbindings_versionmailboxgatewaygateway_availablemanaged_agent
Filesystem-specific fields:
mailbox.filesystem.rootmailbox.filesystem.sqlite_pathmailbox.filesystem.mailbox_pathmailbox.filesystem.local_sqlite_pathmailbox.filesystem.inbox_pathmailbox.filesystem.mailbox_kind
Stalwart-specific fields:
mailbox.stalwart.jmap_urlmailbox.stalwart.management_urlmailbox.stalwart.login_identitymailbox.stalwart.credential_refmailbox.stalwart.credential_file
Important rules:
- Treat the persisted manifest mailbox payload as durable authority and the resolver output as the current actionable mailbox contract.
- Resolve current mailbox bindings through
pixi run houmao-mgr agents mail resolve-livebefore direct attached-session mailbox work. Inside the owning tmux session, selectors may be omitted. Outside tmux, or when targeting a different agent, use--agent-idor--agent-name. - Mailbox-specific shell export is not part of the supported runtime contract.
- Treat
mailbox.filesystem.rootas authoritative. mailbox.filesystem.sqlite_pathremains the shared mailbox-rootindex.sqlitecatalog.mailbox.filesystem.mailbox_pathresolves the current mailbox-view directory for the addressed mailbox.mailbox.filesystem.local_sqlite_pathis the authoritative mailbox-view SQLite database for the current mailbox.mailbox.filesystem.inbox_pathfollows the active mailbox registration, so it may resolve through a symlinkedmailboxes/<address>entry into a private directory.- If
bindings_versionchanges, discard cached assumptions and reload the current bindings. mailbox.stalwart.credential_fileis session-local secret material derived from the persisted secret-freecredential_ref.
Shared Catalog Versus Mailbox-Local State¶
The filesystem transport splits durable state between a shared catalog and mailbox-local mailbox-view state.
- The shared mailbox-root
index.sqlitekeeps registrations, canonical message catalog data, projections, delivery metadata, attachment metadata, and other structural state shared across the mailbox root. - Each resolved mailbox directory owns
mailbox.sqlite, which keeps mailbox-view state that can differ per mailbox, including read or unread, starred, archived, deleted, and mailbox-local thread summaries. - Inside
mailbox.sqlite,message_staterows are keyed bymessage_idand mailbox-localthread_summariesrows are keyed bythread_id. - Because the database is already scoped to one resolved mailbox directory, mailbox-local rows do not need
registration_idas part of their primary identity. - Shared-root unread counters are no longer authoritative for mailbox-view state once mailbox-local SQLite exists.
Projected Skill Contract¶
The runtime projects one round-oriented workflow skill plus one unified mailbox communication skill into the brain home during brain build. The primary discoverable mailbox skill surface is tool-specific:
- Claude native runtime homes:
skills/houmao-process-emails-via-gateway/SKILL.mdandskills/houmao-agent-email-comms/SKILL.md - Codex runtime homes:
skills/houmao-process-emails-via-gateway/SKILL.mdandskills/houmao-agent-email-comms/SKILL.md - Gemini runtime homes:
.gemini/skills/houmao-process-emails-via-gateway/SKILL.mdand.gemini/skills/houmao-agent-email-comms/SKILL.md
For Claude, these mailbox skills live under the isolated runtime-owned CLAUDE_CONFIG_DIR and not under the launched workdir's .claude/skills/ tree.
For Gemini, Houmao-owned projection now targets .gemini/skills/..., and .agents/skills/... is only Gemini's upstream alias surface.
Shared runtime rules:
- require
houmao-mgr agents mail resolve-livefor tmux-backed same-session discovery, - prefer the live gateway
/v1/mail/*facade for shared mailbox operations when the resolver returns a livegateway.base_url, - otherwise use
houmao-mgr agents mail check|send|reply|mark-read, - treat
message_refas the shared reply and mark-read target contract, - treat
authoritative: falseas submission-only rather than mailbox truth, - present
rules/as markdown policy guidance andrules/scripts/as compatibility or implementation detail rather than the ordinary workflow contract.
Filesystem-specific rules:
- inspect
rules/README.mdandrules/protocols/filesystem-mailbox-v1.mdfor policy or repair guidance, - do not require ordinary attached-session mailbox work to invoke mailbox-owned scripts under
rules/scripts/, - treat
mailbox.filesystem.local_sqlite_pathas the source of truth for mailbox-view read or unread and thread-summary state.
Stalwart-specific rules:
- use the current
mailbox.stalwart.*fields returned by the resolver for direct transport access when no live gateway mailbox facade is available, - do not assume filesystem mailbox rules, SQLite paths, locks, or projection symlinks exist for this transport.
Managed agents mail Contract¶
Public subcommands:
resolve-livestatuschecksendreplymark-read
Selector rules:
- explicit
--agent-idor--agent-namewins, - inside the owning managed tmux session, omitted selectors resolve the current session through
HOUMAO_MANIFEST_PATHfirst andHOUMAO_AGENT_IDfallback second, - outside tmux without selectors, the command fails explicitly,
--portis only supported with an explicit selector.
Argument rules:
checkaccepts--unread-only,--limit, and--since.sendrequires at least one--to, a--subject, and exactly one of--body-fileor--body-content.replyrequires--message-refand exactly one of--body-fileor--body-content.sendandreplyaccept repeatable--attach.mark-readrequires--message-ref.- Recipients must be full mailbox addresses, not short names.
Result-strength rules:
- verified pair-owned or manager-owned execution returns
authoritative: true,status: "verified", andexecution_path: "gateway_backed"or"manager_direct", - local live-TUI fallback returns
authoritative: false,execution_path: "tui_submission", and submission-only status such assubmitted,rejected,busy,interrupted, ortui_error, - callers must verify non-authoritative outcomes through manager-owned
statusorcheck, gateway/v1/mail/*state, filesystem mailbox inspection, or transport-native mailbox state.
sequenceDiagram
participant CLI as agents mail
participant RT as Runtime
participant MB as Gateway facade<br/>or transport
participant Ses as Live session
CLI->>RT: resolve target and authority
alt Direct or gateway-backed authority available
RT->>MB: execute mailbox operation
MB-->>RT: verified mailbox result
RT-->>CLI: authoritative=true
else Local TUI fallback only
RT->>Ses: structured mailbox prompt
Ses-->>RT: submission result<br/>and optional preview
RT-->>CLI: authoritative=false
end
Low-Level Runtime Prompt Contract¶
The raw runtime module pixi run python -m houmao.agents.realm_controller mail ... still exists as the structured prompt-turn surface behind local fallback and lower-level testing. Those low-level runtime commands remain TUI-mediated surfaces and return submission-oriented envelopes rather than claiming mailbox truth on their own.
Representative submission result:
{
"address": "research@houmao.localhost",
"authoritative": false,
"execution_path": "tui_submission",
"operation": "send",
"request_id": "mailreq-20260313T091530Z-3c9f1e6ab2",
"principal_id": "HOUMAO-research",
"schema_version": 1,
"status": "submitted",
"transport": "filesystem",
"verification_required": true
}
When the runtime does recover a preview payload, it still validates that preview against the active request_id, operation, and mailbox binding before surfacing it under preview_result, but the command does not require that preview to return.
Source References¶
src/houmao/agents/mailbox_runtime_models.pysrc/houmao/agents/mailbox_runtime_support.pysrc/houmao/agents/system_skills.pysrc/houmao/agents/realm_controller/cli.pysrc/houmao/agents/realm_controller/mail_commands.pysrc/houmao/agents/brain_builder.pysrc/houmao/agents/assets/system_skills/houmao-agent-email-comms/SKILL.mdsrc/houmao/agents/assets/system_skills/houmao-agent-email-comms/references/filesystem-resolver-fields.mdsrc/houmao/agents/assets/system_skills/houmao-agent-email-comms/references/stalwart-resolver-fields.md