mailbox: add canonical bootstrap script at tools/mailbox/bootstrap-mailbox.sh

Per COO brief 2026-09-26 §D2: each home repo bootstraps its own
verbatim copy; this is the canonical source for ergonomic pull.
This commit is contained in:
coreci-cairo
2026-10-04 17:23:45 +00:00
parent a9d9fefeb8
commit d53f39ced8
+56
View File
@@ -0,0 +1,56 @@
#!/bin/bash
# bootstrap-mailbox.sh — create per-home mailbox for one agent
# Usage: AGENT=coreci-<role> ./bootstrap-mailbox.sh
#
# Convention: see coreci/company/standards/communications.md §"Mailbox" and
# coreci/executor-config/tools/coreci-executor/SPEC.md §11.
#
# Per-home mailbox lives at <home>/mailbox/{outbox,inbox,scripts}/ plus
# INDEX.md and .mailboxrc. The agent's own home repo is AUTO_RUN by existing
# allowlist convention, so this script and its commit are always auto-runnable.
set -euo pipefail
: "${AGENT:?must set AGENT=coreci-<role>}"
# Validate AGENT matches the naming convention (decision 8)
if [[ ! "$AGENT" =~ ^coreci-[a-z][a-z0-9-]*$ ]]; then
echo "[mailbox] FATAL: AGENT='$AGENT' does not match ^coreci-[a-z][a-z0-9-]*$" >&2
exit 64
fi
REPO="coreci/${AGENT}/home"
echo "[mailbox] bootstrapping $REPO/mailbox"
mkdir -p mailbox/outbox mailbox/inbox mailbox/scripts
# INDEX.md (decision 4): human-browsable table of contents
cat > mailbox/INDEX.md <<EOF
# $AGENT — Mailbox Index
> Per-home mailbox. Outbox = canonical sender record; inbox = mirrored
> recipient copy (read-only to me; reply via outbox).
>
> Convention: coreci/company/standards/communications.md §"Mailbox".
> Schema: .mailboxrc (JSON, machine-readable).
| Date | Direction | Sender → Recipient | Slug | Status |
|------|-----------|---------------------|------|--------|
| _no messages yet_ | | | | |
EOF
# .mailboxrc (decision 4 / D3): machine-readable hint for tooling
cat > mailbox/.mailboxrc <<EOF
{
"agent": "$AGENT",
"schema": 1,
"outbox": "outbox/",
"inbox": "inbox/",
"index": "INDEX.md",
"convention_doc": "coreci/company/standards/communications.md#mailbox-formal-layer--email-like"
}
EOF
# Commit (own-home = AUTO_RUN by allowlist convention)
git add mailbox/
git -c user.name="$AGENT" -c user.email="${AGENT}@coreci.dev" \
commit -m "mailbox: bootstrap outbox/, inbox/, INDEX.md, .mailboxrc"
echo "[mailbox] done. next: git push"