This workplan was reviewed and registered against the local State Hub workplan
convention.
Fixes applied:
- Added ADR-001 frontmatter so State Hub can index the workstream.
- Converted the MVP work packages into `EMAIL-WP-0002-TNN` task blocks.
- Clarified that out-of-office replies are evidence signals, not proof of
reachability or awareness.
- Aligned suggested repository paths with the current repo layout.
Implementation should preserve the product rule from `INTENT.md`: email events
are evidence, not result satisfaction.
## 1. MVP Name
**Mailbox Evidence Scanner MVP**
## 2. Purpose
This MVP establishes the first practical implementation slice of `email-connect`.
Given access to a mailbox that receives bounce mails, delivery-status notifications, out-of-office replies, human replies, complaints, unsubscribe messages, and other return messages from a previous batch of emails, the system shall scan and rescan the mailbox, classify inbound messages, extract email-channel evidence, and generate timestamped CSV evidence reports.
The MVP proves the core `email-connect` value without requiring outbound sending, provider webhook integration, template management, or a full UI.
## 3. Core MVP Hypothesis
`email-connect` can provide immediate standalone value by turning an inbound return mailbox into structured, timestamped email-channel evidence.
The MVP validates:
```text
mailbox access
message scanning
rescan safety
bounce parsing
reply classification
evidence normalization
deduplication
endpoint-quality hints
CSV reporting
```
The result should be useful to humans, scripts, and future `coordination-engine` integrations.
## 4. In Scope
The MVP shall support:
* Connecting to one IMAP mailbox.
* Scanning messages in a selected folder.
* Incremental scans using a stored cursor.
* Full rescans.
* Raw message metadata extraction.
* Basic MIME parsing.
* Bounce / DSN classification.
* Out-of-office classification.
* Human reply classification.
* Unknown/unparseable message classification.
* Extraction of affected recipient address where possible.
* Extraction of SMTP status code and enhanced status code where possible.
* Evidence event candidate generation.
* Deduplication of already-seen mailbox messages.
* Deduplication of already-emitted evidence.
* Timestamped CSV report generation.
* Basic local storage for scan state and parsed evidence.
* CLI entry point.
* Minimal configuration file.
## 5. Out of Scope for MVP
The MVP does not need to support:
* Outbound email sending.
* Provider-specific webhooks.
* Multiple email providers.
* Full UI.
* OAuth mailbox login.
* Advanced deliverability analytics.
* Advanced natural-language reply interpretation.
* Full suppression management UI.
* Full endpoint quality dashboard.
* coordination-engine live integration.
* Database server deployment.
* Multi-tenant operation.
* Complex mailbox write-back actions.
* Deleting, moving, or marking mailbox messages.
* Legal delivery assessment.
## 6. MVP User Story
As an operator or developer, I want to point `email-connect` at a mailbox containing return emails from a previous outbound batch, scan and rescan it safely, and receive a timestamped CSV report showing what email-channel evidence was found for each affected address or message.
## 7. Target Workflow
```text
1. Configure mailbox access.
2. Run scanner.
3. Scanner fetches messages from selected folder.
4. Scanner parses headers, body, MIME parts, and DSN attachments.
5. Scanner classifies each message.
6. Scanner extracts evidence fields.
7. Scanner deduplicates message and evidence records.
A developer can run the scanner against a test mailbox or fixture directory.
```
## 19. MVP Milestones
### Milestone 1: Scan and Store
Goal:
```text
Connect to mailbox, fetch messages, store metadata, deduplicate.
```
Includes:
```text
T01
T02
T03
```
### Milestone 2: Parse and Classify
Goal:
```text
Parse messages and classify bounces, OOO, replies, complaints, unsubscribe.
```
Includes:
```text
T04
T05
T06
T07
```
### Milestone 3: Evidence and Reports
Goal:
```text
Generate normalized evidence candidates and timestamped CSV reports.
```
Includes:
```text
T08
T09
T10
```
### Milestone 4: Confidence and Repeatability
Goal:
```text
Add golden tests, parser versioning, and documentation.
```
Includes:
```text
T11
T12
```
## 20. MVP Acceptance Criteria
The MVP is complete when:
1. A user can configure access to one IMAP mailbox.
2. The scanner can run without modifying mailbox contents.
3. The scanner can perform incremental scans.
4. The scanner can perform full rescans.
5. Already-seen messages are deduplicated.
6. Hard bounces are classified.
7. Soft bounces are classified.
8. Delayed delivery notices are classified.
9. Out-of-office replies are classified.
10. Human replies are classified.
11. Complaints or unsubscribe messages are classified where detectable.
12. Unknown messages are preserved as unknown rather than ignored silently.
13. Evidence candidates are generated.
14. Endpoint quality is updated.
15. A timestamped CSV report is produced.
16. Golden tests cover representative sample messages.
17. The report format aligns with the `email-connect` evidence model.
18. The implementation does not overclaim email evidence.
## 21. Design Rules
### 21.1 Do Not Overclaim
The scanner must not infer more than the mailbox evidence supports.
Examples:
```text
No bounce found ≠ delivery success
Out-of-office ≠ recipient completed action
Human reply ≠ legally valid acceptance
Unknown message ≠ failure
```
### 21.2 Preserve Unknowns
Unknown and parse-failed messages should be visible in reports.
### 21.3 Prefer Evidence Over Status
The scanner should produce evidence rows, not only final statuses.
### 21.4 Make Rescans Safe
Rescans should be safe, deduplicated, and parser-version-aware.
### 21.5 Keep Raw References
Store enough raw reference data to allow later inspection.
## 22. Suggested Initial Repository Structure
```text
email-connect/
INTENT.md
spec/
ProductRequirementsDocument.md
workplans/
EMAIL-WP-0002-mvp-mailbox-evidence-scanner.md
docs/
EmailAdapterSpecification.md
src/
email_connect/
cli/
config/
mailbox/
parsing/
evidence/
reporting/
storage/
tests/
fixtures/
hard_bounce/
soft_bounce/
delayed_delivery/
out_of_office/
human_reply/
unsubscribe/
unknown/
test_mailbox_scanner.py
test_bounce_parser.py
test_evidence_mapping.py
config/
mailbox.example.yml
reports/
.gitkeep
```
## 23. Future Extensions After MVP
Possible next steps:
```text
Provider webhook ingestion
Outbound send API
Template manager
Minimal UI
Multi-mailbox scanning
OAuth mailbox access
Mailbox write-back actions
Advanced DSN parsing
Advanced German/English auto-reply classification
Natural-language reply intent extraction
Suppression export
coordination-engine evidence event push
Endpoint quality dashboard
Provider-specific bounce mappings
```
## 24. Summary
The Mailbox Evidence Scanner MVP is a strong first implementation slice for `email-connect`.
It delivers immediate practical value by converting a return mailbox into structured email-channel evidence reports. It also validates the core `email-connect` evidence model before implementing outbound sending, provider webhooks, or full coordination-engine integration.
The guiding rule is:
> Scan the mailbox, preserve the evidence, classify conservatively, report clearly, and never treat missing evidence as delivery success.