About clawmail
clawmail defines the mail coordination protocol for joelclaw's pi agents, using `joelclaw mail` as the canonical interface to a central service. It is intended for agents working on shared code and specifies messaging and file-reservation practices.
Key features
- 01Canonical mail CLI
- 02Inbox checks and message sending
- 03Reserve, renew, and release file paths
- 04Standard subject prefixes
- 05Service and lock checks
Use cases
- 01Check for messages before shared work
- 02Reserve paths before editing files
- 03Send progress updates or handoffs
MCP support
The skill requires pi agents to access mail through `joelclaw mail` and prohibits direct calls to `mcp_agent_mail` HTTP endpoints. The mail service runs as a central daemon.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ joelhooks/ joelclaw --skill clawmailAfter installing, type/clawmailin Claude Code to confirm it loaded.
Details
From the project READMEClawmail
Canonical agent coordination contract for joelclaw.
joelclaw mail is the only supported mail access surface for pi agents.
Do not call mcp_agent_mail HTTP endpoints directly from agent prompts or role instructions.
Topology
Agent-mail is a Central service, not a mailbox per machine:
- Flagg hosts the authoritative daemon on
127.0.0.1:8765. - Blaine and Panda run
com.joelclaw.agent-mail-tunnel, forwarding their local127.0.0.1:8765to Flagg over SSH. - Satellite/Relay clients keep using the default local URL. The tunnel preserves the CLI contract without exposing the unauthenticated service on the tailnet.
- Do not start an independent agent-mail daemon on a satellite. A healthy client must report the same mailbox/project counts as Flagg.
Tracked connector assets:
infra/agent-mail-tunnel.shinfra/launchd/com.joelclaw.agent-mail-tunnel.plist
Interfaces
Canonical interface
joelclaw mail ...(CLI)
Pi wrapper tools (allowed, but still CLI-backed)
These wrappers shell to joelclaw mail under the hood:
| Tool | CLI equivalent |
|---|---|
mail_send | joelclaw mail send |
mail_inbox | joelclaw mail inbox |
mail_read | joelclaw mail read |
mail_reserve | joelclaw mail reserve |
mail_release | joelclaw mail release |
mail_status | joelclaw mail status |
Required Protocol (default for shared work)
- Check inbox before touching files
joelclaw mail inbox --agent <AgentName> --unread
- Announce active scope
joelclaw mail send --from <AgentName> --to <AgentName|team> --subject "Starting: <work>" "intent + paths + expected output"
- Reserve file paths before edits
joelclaw mail reserve --agent <AgentName> --paths "path/a.ts,path/b.ts" [--ttl-seconds 900]
- If work runs long, renew reservation lease
joelclaw mail renew --agent <AgentName> --paths "path/a.ts" [--extend-seconds 900]
- Send status/handoff updates during work
joelclaw mail send --subject "Status: ..." ...
- Release reservations after commit/handoff
joelclaw mail release --agent <AgentName> --paths "..."- or
--allwhen done with all reserved paths
Subject Taxonomy (for searchability + steering)
Use these prefixes consistently:
Starting:— work start / intent announcementTask:— handoff or assignmentStatus:— progress updateBlocked:— dependency/incident requiring interventionDone:— completion with artifact/commit IDs
Daily steering uses these signals to detect protocol drift.
Command Quick Reference
# server + inbox health
joelclaw mail status
# register / refresh identity metadata
joelclaw mail register --agent MaroonReef --program pi --model gpt-5.4 --task "interactive"
# send a coordination message
joelclaw mail send --from MaroonReef --to BlueFox --subject "Task: update prompt docs" "Please edit SYSTEM.md and roles/*.md"
# inbox / read
joelclaw mail inbox --agent MaroonReef --unread
joelclaw mail read --agent MaroonReef --id 12
# reservations
joelclaw mail reserve --agent MaroonReef --paths "SYSTEM.md,roles/interactive.md" --ttl-seconds 900
joelclaw mail renew --agent MaroonReef --paths "SYSTEM.md" --extend-seconds 900
joelclaw mail release --agent MaroonReef --paths "SYSTEM.md,roles/interactive.md"
joelclaw mail release --agent MaroonReef --all
# audit/search
joelclaw mail locks
joelclaw mail search --query "Starting:"
Reliability Checks
Verify protocol health quickly
joelclaw mail status
joelclaw mail locks
joelclaw mail search --query "Starting:"
joelclaw mail search --query "Status:"
joelclaw mail locks should reflect active advisory file reservations from the local git-mailbox file_reservations/ artifacts when that repo is available. This matters because the raw /mail/api/locks endpoint can under-report file reservations while still showing mailbox-internal archive/commit locks.
If search is degraded (DB/tool errors)
- Treat signal counts as unreliable.
- Continue using protocol anyway (announce/reserve/release).
- Escalate to mail backend health repair and log findings.
If CLI flags are rejected unexpectedly
- Your compiled
~/.bun/bin/joelclawmay be stale relative to source. - Rebuild CLI from
packages/cli/src/cli.tsand retry.
If wrapper output says ok: true but the nested result contains an error
- Treat the operation as failed. Some CLI paths can return a successful envelope while
result.resultorresult.rawcontains backend errors such asToo many open files,Agent not found, or stale project metadata. - Verify reservations/register/inbox calls by reading the nested result, not only the top-level
okflag. - Retry once if the backend says it freed cached repos; if it still fails, continue only for low-risk edits and report the coordination failure in the final summary.
- For repeated
Too many open files. Freed 0 cached repos, inspectlsof -p $(pgrep -f 'mcp_agent_mail.*serve-http') | rg '\.(archive|commit)\.lock'. The durable fix is injoelhooks/mcp_agent_mail: close orphaned lock FDs, avoid treating metadata-missing locks as immediately stale, and runcom.joelclaw.agent-mailwithNumberOfFiles=8192viainfra/agent-mail-daemon.sh+infra/launchd/com.joelclaw.agent-mail.plist.
Prompt Authoring Checklist (shore up prompts)
Any prompt/role/system contract that mentions coordination should:
- Reference
clawmailas canonical protocol skill. - State that mail access is via
joelclaw mail(wrappers allowed, direct MCP not allowed). - Include at minimum: inbox check, announce, reserve, release.
- Require path context in coordination messages.
- Encourage subject prefixes (
Starting:,Task:,Status:,Blocked:,Done:). - Avoid filler about mail when no shared edits/coordination are involved.
Steering Loop Integration
pi/extensions/session-lifecycle runs a daily monitor+steer review and emits:
agent-mail/steering.reviewed
Snapshot path:
~/.joelclaw/workspace/agent-mail-steering/YYYY-MM-DD.json
Use steering hints to tighten protocol compliance when drift is detected.
Related
skills/agent-mail/SKILL.md(compatibility alias)joelclaw mail --help- ADR-0172: Agent Mail via MCP Agent Mail