added
This commit is contained in:
1 parent
eac3d5dc45
commit
2a2b00733b
83 files changed
+4840
No files matched your search
@@ -0,0 +1,241 @@
|
||||
# System Map
|
||||
|
||||
This document shows the system boundaries, replaceable module contracts, and primary operating flows for the Automation-Based Email List System.
|
||||
|
||||
## System Context
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
human["Human architect<br/>writes Markdown + gives<br/>send-and-schedule directive"]
|
||||
agent["Persistent AI operator<br/>documented skill + restricted<br/>terminal access"]
|
||||
repo[("Public Git repository<br/>Markdown, templates, schemas,<br/>code, tests, sanitized receipts")]
|
||||
|
||||
subgraph emailvm["Email-list VM"]
|
||||
container["Email-list Docker container<br/>deterministic Python application"]
|
||||
runtime[("Private persistent volume<br/>SQLite, backups, logs,<br/>detailed receipts")]
|
||||
scheduler["Cron / VM scheduler<br/>subscriber imports, welcomes,<br/>due follow-ups, reconciliation"]
|
||||
container <--> runtime
|
||||
scheduler --> container
|
||||
end
|
||||
|
||||
postmark["Postmark<br/>delivery, broadcast unsubscribe,<br/>suppression"]
|
||||
telemetry["Existing telemetry server<br/>Postmark webhook ingestion<br/>and campaign analysis"]
|
||||
recipient["Email recipient"]
|
||||
|
||||
human -->|"writes finished campaign"| repo
|
||||
human -->|"one directive authorizes initial send<br/>+ configured follow-up"| agent
|
||||
agent -->|"reads, validates, schedules,<br/>verifies, and reports"| repo
|
||||
agent -->|"runs authorized deterministic commands"| container
|
||||
repo -->|"Git deployment / checked-out content"| container
|
||||
container -->|"provider adapter"| postmark
|
||||
postmark -->|"email"| recipient
|
||||
recipient -->|"open, click, unsubscribe,<br/>complaint"| postmark
|
||||
postmark -->|"existing webhooks"| telemetry
|
||||
container <-->|"versioned telemetry contract"| telemetry
|
||||
container -->|"sanitized receipts only"| repo
|
||||
```
|
||||
|
||||
## Human Handoff and AI Operating Envelope
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
human["Human"]
|
||||
handoff["Finished Markdown + directive<br/>send now; resend apparent<br/>non-openers in 4 or 5 days"]
|
||||
agent["Authorized AI agent"]
|
||||
cli["Deterministic CLI safety boundary"]
|
||||
send["Validate + send initial campaign"]
|
||||
schedule["Create durable follow-up schedule"]
|
||||
monitor["Monitor + verify + write receipt"]
|
||||
followup["Query telemetry + recheck suppressions<br/>+ send one authorized follow-up"]
|
||||
exception["Return only unresolved exception<br/>or scope change to human"]
|
||||
|
||||
human --> handoff --> agent --> cli
|
||||
cli --> send --> schedule --> monitor --> followup --> monitor
|
||||
cli -->|"failed check, ambiguous authority,<br/>or material change required"| exception --> human
|
||||
```
|
||||
|
||||
The intended steady state has one human handoff, not one approval per mechanical step. The CLI enforces the authorization and safety boundary while the AI handles orchestration and exceptions.
|
||||
|
||||
## Application Modules and Replaceable Boundaries
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
cli["CLI contract<br/>--dry-run, --json, exit codes"]
|
||||
skill["AI skill<br/>workflow, authorization,<br/>and escalation rules"]
|
||||
scheduler["Scheduler entrypoint"]
|
||||
|
||||
cli --> usecases["Application use cases<br/>campaigns, subscribers, resends,<br/>reconciliation, backups"]
|
||||
skill --> cli
|
||||
scheduler --> cli
|
||||
|
||||
usecases --> campaign["Campaign module"]
|
||||
usecases --> subscriber["Subscriber module"]
|
||||
usecases --> authorization["Authorization guard"]
|
||||
usecases --> sendstate["Send-state module"]
|
||||
usecases --> receipt["Receipt module"]
|
||||
|
||||
campaign --> renderer{{"Renderer contract"}}
|
||||
subscriber --> store{{"Storage contract"}}
|
||||
sendstate --> provider{{"Email-provider contract"}}
|
||||
usecases --> telemetrycontract{{"Telemetry contract"}}
|
||||
|
||||
renderer --> markdown["v1: Markdown + templates"]
|
||||
store --> sqlite[("v1: SQLite")]
|
||||
provider --> postmark["v1: Postmark"]
|
||||
telemetrycontract --> telemetry["v1: existing telemetry server"]
|
||||
|
||||
migrations["Versioned migrations"] --> sqlite
|
||||
backups["Backup / restore"] --> sqlite
|
||||
schemas["Versioned schemas"] -. "validate boundaries" .-> cli
|
||||
schemas -.-> renderer
|
||||
schemas -.-> telemetrycontract
|
||||
schemas -.-> receipt
|
||||
```
|
||||
|
||||
The diamond-shaped contracts are deliberate swap points. Core campaign and subscriber rules depend on those contracts, not on Postmark, SQLite, a specific Markdown library, or the telemetry server's internal implementation.
|
||||
|
||||
## Campaign Send Flow
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Human as Human
|
||||
participant Agent as Authorized AI agent
|
||||
participant Repo as Git repository
|
||||
participant CLI as Email-list CLI
|
||||
participant Cron as Cron scheduler
|
||||
participant DB as SQLite
|
||||
participant PM as Postmark
|
||||
participant TS as Telemetry server
|
||||
|
||||
Human->>Repo: Write or revise campaign Markdown
|
||||
Human->>Agent: Send campaign and follow up in 4 to 5 days
|
||||
Agent->>CLI: Validate and preview exact campaign
|
||||
CLI->>Repo: Read exact content and template
|
||||
CLI-->>Agent: Rendered preview, checks, recipient estimate
|
||||
Agent->>CLI: Record human directive and execute authorized send
|
||||
CLI->>DB: Store authorization hashes and follow-up parameters
|
||||
CLI->>DB: Create immutable recipient snapshot
|
||||
CLI->>PM: Reconcile current suppressions
|
||||
PM-->>CLI: Current suppression result
|
||||
CLI->>DB: Exclude ineligible recipients
|
||||
loop Idempotent batches
|
||||
CLI->>PM: Submit unsent recipients
|
||||
PM-->>CLI: Request and message identifiers
|
||||
CLI->>DB: Record per-recipient acceptance or failure
|
||||
end
|
||||
Agent->>Cron: Schedule durable apparent-non-opener follow-up
|
||||
Agent->>CLI: Verify initial completion and write receipt
|
||||
PM-->>TS: Delivery and engagement webhooks
|
||||
Cron->>CLI: Run due follow-ups
|
||||
CLI->>TS: Query apparent non-openers
|
||||
TS-->>CLI: Versioned campaign telemetry response
|
||||
CLI->>PM: Recheck suppressions and send authorized follow-up
|
||||
PM-->>CLI: Follow-up request and message identifiers
|
||||
CLI->>DB: Record follow-up completion
|
||||
Agent->>CLI: Inspect status and exceptions
|
||||
CLI->>Repo: Write sanitized initial and follow-up receipts
|
||||
```
|
||||
|
||||
## Subscriber and Welcome Flow
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
request["Human appends subscribe record<br/>to private JSON / JSONL inbox"]
|
||||
cron["Cron reads inbox on schedule"]
|
||||
validate["CLI validates schema, operation ID,<br/>source, consent, and duplication"]
|
||||
apply["Transactional SQLite update<br/>with status history"]
|
||||
welcome["Exactly-once welcome send"]
|
||||
postmark["Postmark"]
|
||||
receipt["Sanitized receipt"]
|
||||
agent["AI inspects exceptions<br/>when needed"]
|
||||
|
||||
request --> cron --> validate --> apply --> welcome --> postmark
|
||||
apply --> receipt
|
||||
welcome --> receipt
|
||||
receipt --> agent
|
||||
```
|
||||
|
||||
## Unsubscribe and Suppression Flow
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
recipient["Recipient"]
|
||||
human["Human observes an external<br/>unsubscribe request"]
|
||||
inbox["Private JSON / JSONL<br/>operations inbox"]
|
||||
cron["Cron import"]
|
||||
postmark["Postmark one-click unsubscribe<br/>and Broadcast suppression"]
|
||||
telemetry["Existing telemetry server<br/>subscription-change webhook"]
|
||||
reconcile["Email-list suppression<br/>reconciliation command"]
|
||||
sqlite[("Local SQLite status mirror")]
|
||||
sendguard["Pre-batch suppression guard"]
|
||||
|
||||
recipient -->|"unsubscribe or complaint"| postmark
|
||||
human -->|"append unsubscribe operation"| inbox --> cron
|
||||
cron -->|"idempotent local suppression"| sqlite
|
||||
postmark -->|"webhook"| telemetry
|
||||
telemetry -->|"versioned query response"| reconcile
|
||||
postmark -->|"authoritative suppression query"| reconcile
|
||||
reconcile -->|"reviewed, idempotent update"| sqlite
|
||||
sqlite --> sendguard
|
||||
postmark --> sendguard
|
||||
sendguard -->|"only eligible recipients proceed"| send["Campaign send"]
|
||||
```
|
||||
|
||||
## AI Access Rights
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
identity["Dedicated AI agent identity"]
|
||||
terminal["Restricted persistent terminal<br/>or task-runner access"]
|
||||
repo["Read campaign and operational repo<br/>write only through normal Git authority"]
|
||||
commands["Allowed email-list CLI commands"]
|
||||
status["Read health, receipts,<br/>campaign and telemetry status"]
|
||||
secrets["Runtime injects scoped secrets<br/>secrets are not shown or committed"]
|
||||
blocked["Blocked boundaries<br/>no direct SQLite mutation<br/>no telemetry DB access<br/>no suppression bypass<br/>no unauthorized send"]
|
||||
|
||||
identity --> terminal
|
||||
terminal --> repo
|
||||
terminal --> commands
|
||||
terminal --> status
|
||||
secrets --> commands
|
||||
terminal -. "enforced least privilege" .-> blocked
|
||||
```
|
||||
|
||||
The model and persistent-agent implementation may change. These access boundaries remain stable and determine what any selected agent is allowed to do.
|
||||
|
||||
## Trust and Data Boundaries
|
||||
|
||||
| Boundary | May cross | Must not cross |
|
||||
| --- | --- | --- |
|
||||
| Public Git repository | Code, schemas, templates, campaign content, synthetic examples, sanitized receipts | Subscriber addresses, credentials, production databases, raw telemetry, private logs |
|
||||
| AI/human to CLI | Validated structured input and documented commands | Direct production database manipulation or authorization bypass |
|
||||
| AI agent identity to VM | Allowlisted CLI commands, required repository files, scoped runtime status, and approved network endpoints | General administrator access, unrelated applications, raw secrets, or unrestricted shell authority |
|
||||
| Email app to Postmark | Required recipient and campaign delivery data | Database credentials or unrelated telemetry |
|
||||
| Email app to telemetry server | Authenticated versioned queries and minimum necessary results | Direct access to the telemetry database |
|
||||
| Docker container to host | Declared configuration, network endpoints, persistent-volume paths | Undeclared host filesystem or shared application dependencies |
|
||||
|
||||
## Failure Boundaries
|
||||
|
||||
- A telemetry outage prevents telemetry-dependent resends but does not corrupt subscriber or send state.
|
||||
- A Postmark outage leaves recipients pending or safely retryable; it does not cause a whole-campaign resend.
|
||||
- A renderer replacement cannot approve or send email.
|
||||
- A scheduler failure can be recovered by running the same idempotent CLI command manually.
|
||||
- A container replacement preserves state through the private persistent volume.
|
||||
- A database migration is not allowed without a backup, versioned migration, and validation.
|
||||
- An unresolved suppression mismatch fails closed for the affected recipient.
|
||||
|
||||
## Deployment and Release Flow
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
dev["Isolated development<br/>implementation + tests"]
|
||||
review["Human review<br/>docs, diff, tests, receipts"]
|
||||
git["Git remote<br/>approved revision"]
|
||||
deploy["Email-list VM<br/>pull/build pinned revision"]
|
||||
migrate["Backup + versioned migration"]
|
||||
validate["Health check + test-mode send"]
|
||||
release["Validated release + version tag"]
|
||||
|
||||
dev --> review --> git --> deploy --> migrate --> validate --> release
|
||||
validate -->|"failure: roll back image and restore if needed"| deploy
|
||||
```
|
||||
Reference in new issue
Block a user