Skip to main content

Reference

Config Schemas

Hydra validates IMAP account and policy config against these schemas during config composition, including values supplied through command-line overrides.

IMAP account config is registered as arbiter/account/imap/schema:

class MailTlsMode(str, Enum):
none = "none"
starttls = "starttls"
implicit = "implicit"


class IMAPFolderKind(str, Enum):
INBOX = "INBOX"
ALL = "ALL"
ARCHIVE = "ARCHIVE"
DRAFTS = "DRAFTS"
FLAGGED = "FLAGGED"
JUNK = "JUNK"
SENT = "SENT"
TRASH = "TRASH"


@dataclass
class IMAPFolderConfig:
description: str = ""
kind: IMAPFolderKind | None = None


@dataclass
class IMAPConfig(Policy):
policy: str = "bot"
description: str = ""
guidance: str = ""
host: str = "localhost"
port: int = 993
username: str = ""
password: str = ""
tls: MailTlsMode = MailTlsMode.implicit
verify_peer: bool = True
timeout_seconds: float = 30.0
default_folder: str | None = None
folders: dict[str, IMAPFolderConfig] = field(default_factory=dict)

IMAP policy config is registered as arbiter/policy/imap/schema:

class IMAPFlagMode(str, Enum):
hidden = "hidden"
read_only = "read_only"
read_write = "read_write"


@dataclass
class IMAPAccessPolicyConfig(Policy):
folder_access: IMAPFolderAccessConfig = field(default_factory=IMAPFolderAccessConfig)
operation_defaults: IMAPFolderPolicyDefaultsConfig = field(
default_factory=IMAPFolderPolicyDefaultsConfig
)
folders: dict[str, IMAPFolderOperationPolicyConfig] = field(default_factory=dict)

System flag fields use OmegaConf missing values so folder policy overrides can set only the flags they change. operation_defaults supplies the complete baseline policy.

Folder Pattern Syntax

Folder keys in account metadata can be literal names or patterns. Pattern matching covers the full folder name. . is a hard segment delimiter for the default matchers:

  • * matches zero or more non-dot characters.
  • ? matches one non-dot character.
  • [0-9] style character classes match one character.
  • {name} is shorthand for a named one-segment wildcard capture.
  • ** inside an explicit capture intentionally spans dots.

Named captures can be referenced in metadata strings. For example, Archives.{year} matches Archives.2026, with {year} bound to 2026.

Capture names ending in ? are optional. When an optional capture is followed by a literal ., the capture and delimiter are optional together. For example, Archives.{**:prefix?}.{[0-9][0-9]*:year} matches both Archives.2026 and Archives.2020-2029.2026, with {year} bound to the final numeric segment.

Enforcement

The IMAP policy gates:

  • folder access
  • read
  • search
  • move
  • delete
  • mark read/unread
  • append
  • save draft
  • standard flag visibility and mutation
  • configured user flag visibility and mutation

When exposed, imap:get_attachment is read-only and is governed by the effective read decision for the selected folder.

Use op check to ask why a specific operation payload is allowed or denied without calling the upstream IMAP server:

arbiter op check imap:move_message --args '{
"account": "bot",
"folder": "INBOX",
"message_id": "42",
"destination_folder": "Archive"
}'

Config Checks

CommandWhat it checksContacts IMAP?
arbiter-server config checkStatic IMAP account, folder metadata, and policy validity.No
arbiter-server config check --liveStatic checks plus configured account readiness against the server.Yes

Static IMAP checks:

CheckFailure or warning
policy has valid folder access rules and folder policy patternsconfig check issue
default_folder resolves through account metadata and policyconfig check issue
configured folder keys resolve through metadata and policyconfig check issue
all configured folders are deniedwarning
delete is allowed but no accessible configured TRASH folder existswarning; delete_message falls back to permanent deletion
literal Drafts folder exists but is not marked kind: DRAFTSwarning
multiple configured DRAFTS folders existwarning
selected configured DRAFTS folder is denied, cannot append, or cannot set DRAFT/SEEN flagswarning

Live IMAP checks:

CheckNotes
connectOpens the configured IMAP connection.
noopVerifies the authenticated session can issue a read-only command.
examineVerifies accessible test folders can be selected read-only.
trash_destinationRuns when delete is allowed for an accessible live folder; warns when no accessible live TRASH folder exists and deletes will be permanent.
save_draft_destinationRuns when an account has a configured DRAFTS folder; verifies the selected configured Drafts folder exists.

The live check is read-only for message contents and mailbox state. It lists folders, probes selected folders with read-only examine behavior, and does not move, delete, append, or flag messages.