feat: add structured attachments and triage contracts - #8
Merged
Conversation
This was referenced Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make high-value mailbox context usable by agents without turning heuristic judgments into parser facts.
This adds first-class inbound MIME attachment metadata and a versioned triage contract that separates deterministic message/thread evidence from optional external enrichment. MailCLI still makes no provider calls in core.
What changed
StandardMessage.attachmentsnow reports MIME part id, untrusted filename, content type, decoded size, disposition, content id, and inline status without embedding attachment bytes.mailcli triage messageandmailcli triage threadproduce compact deterministic evidence, including one fact entry per thread message so earlier unresolved requests remain visible.priority,needs_reply, deadline, and todo enrichment is strictly validated for source, timestamp, confidence, reasons, message traceability, and exactevidence_idmatch.The evidence hash is important: enrichment generated before a thread changes is rejected instead of being silently attached to newer context.
Verification
go test ./...go vet ./...go build -o /tmp/mailcli-issue-4-5 ./cmd/mailclimake demo-local-thread-checkjq empty tools/openai.json tools/anthropic.jsongit diff --checkspecability validate docs/specability/README.mdspecability reconcile docs/specability/README.mdSpecability remains aligned with its existing advisory warning about the missing
Adversarial Surfacessection.Post-Deploy Monitoring & Validation
evidence_id; current enrichment merges successfully.invalid triage enrichment,evidence_id does not match, andsource_message_id is not presentto distinguish provider contract drift from parser failures.Closes #4
Closes #5
🤖 Generated with GPT-5 (Codex context, extended reasoning) via Codex