warmbox/docs/01-current-state-and-gaps.md

79 lines
3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Current State & Gap Analysis
## What exists today (MVP)
### Data layer
| Model | Purpose |
|-------|---------|
| `Inbox` | Flat mailbox record (no role) |
| `WarmupLog` | Message lifecycle: sent → rescued_from_spam → replied → complete |
| `Setting` | Global key-value config |
### Jobs
| Job | Behavior |
|-----|----------|
| Dispatcher | Random sender/receiver from all active inboxes; AI email; SMTP send |
| Rescuer | Spam folder scan; move to INBOX; flag; AI reply (~100% reply when found) |
| Ramp bump | Midnight `currentRamp += 2` up to `dailyLimit` |
### API
- Inbox CRUD + connection test
- Paginated logs
- Global settings (cron, industries)
### Strengths
- Working SMTP/IMAP connector with encrypted credentials
- Spam rescue on Gmail/Yahoo/Outlook folder names
- AI via OpenRouter (free models)
- Error inbox marking (`status: error`)
- Prisma 7 + SQLite portability
## Gap matrix
| Feature | Current | Target | Priority |
|---------|---------|--------|----------|
| Primary vs satellite roles | All equal | Role-based pairing | P0 |
| Multiple primaries | Implicit | Explicit campaigns per primary | P0 |
| Grow recipe | Partial ramp | Named recipe engine | P0 |
| Flat recipe | Missing | Constant daily volume | P0 |
| Randomized recipe | Missing | Daily variance algorithm | P1 |
| Custom recipe | Missing | Per-day schedule editor | P1 |
| Warmup duration 3045d | Missing | Campaign start/end | P0 |
| Min emails/day (1) | Missing | Enforced floor | P0 |
| Max emails/day (4050) | Partial | Validated cap | P0 |
| Reply rate 30% | ~100% | Probabilistic sampling | P0 |
| Per-primary statistics | Missing | Dashboard API | P0 |
| Spam count per primary | Partial (per log) | Aggregated metrics | P0 |
| AI placeholder blocking | Prompt only | Post-generation validation | P0 |
| Send time jitter | Missing | Human-like windows | P1 |
| Web UI | Missing | Full operator console | P1 |
| Multi-tenant | Missing | Org/workspace model | P2 |
| Peer network | Missing | Optional phase 3 | P3 |
| DNS/auth checks | Missing | SPF/DKIM/DMARC validation | P1 |
| Auto-pause on bad signals | Partial (auth only) | Spam/bounce thresholds | P1 |
| Tests | Missing | Unit + integration | P1 |
## Architectural debt
1. **Flat inbox pool** — Dispatcher treats every inbox as equal; primaries can email each other.
2. **Global ramp** — Not tied to campaign start date or recipe.
3. **SQLite** — Fine for self-hosted; need Postgres path for SaaS.
4. **No schedule entity** — "Planned sends today" is implicit, not queryable.
5. **Spam rescue granularity** — Marks all pending logs from sender, not per UID.
6. **No idempotency** — Cron overlap could double-send without locks.
## Recommended migration path
```
Phase A: Schema + roles + recipes (backend only)
Phase B: Statistics API + reply rate engine
Phase C: Web UI (self-hosted)
Phase D: Hardening (jitter, validation, auto-pause)
Phase E: Multi-tenant + optional peer network
```
See [16-roadmap.md](./16-roadmap.md) for sprint breakdown.