← Back to Research

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

What This Is

AfterSMTP is a pre-alpha Go prototype for encrypted AMP messaging and an SMTP bridge. It uses X25519/Ed25519, DIDs (did:aftersmtp:domain:user), a Substrate adapter with SQLite fallback, QUIC, and gRPC. It has durable local trusted-delivery controls, but is not production mail-hosting software: public gRPC TLS, recipient control APIs, and wired outbound delivery remain incomplete.

Module: github.com/aftersmtp/aftersmtp (Go 1.25). Note: /Users/ryan/development/aftersmtp is a symlink to msgs.global/research/aftersmtp.

Commands

# Build the gateway server and CLI
go build -o aftersmtp ./cmd/aftersmtp
go build -o aftersmtp-cli ./cmd/aftersmtp-cli

# Tests
go test ./...
go test ./internal/security/dane/            # single package
go test ./internal/config/ -run TestConfig   # single test
go test ./internal/trust ./internal/storage ./internal/protocol/legacy

# Bootstrap the SQLite fallback ledger (when no Substrate node is available)
./aftersmtp-cli db init
./aftersmtp-cli keygen msgs.global ryan   # generate a DID + keys
./aftersmtp-cli db list

Root-level test_delivery.py, test_secure_delivery.py, test_fails_unauth.py are ad-hoc Python integration scripts run against a live server.

Architecture

Two binaries:

  • cmd/aftersmtp — the monolithic gateway server.
  • cmd/aftersmtp-cli — identity management (keygen, db) and messaging CLI.

The gateway's core pipeline: ingress (native AMP over gRPC/QUIC in internal/protocol, or legacy SMTP on-ramp that encapsulates MIME into AMP) → trusted-delivery admission → internal/pipeline/internal/queue/internal/routing → local encrypted inbox. The OffRamp exists but Pipeline.OutboundDeliver is not wired by cmd/aftersmtp.

Cross-cutting pieces:

  • internal/crypto — X25519/Ed25519 payload sealing primitives (see CRYPTO_REVIEW.md; the global SECURITY-RULES.md applies to any change here).
  • internal/identity + internal/ledger — DID resolution and the Substrate blockchain client, with graceful degradation to a SQLite fallback ledger (fallback_ledger.db).
  • internal/dns — DANE/DNSSEC resolution.
  • internal/trust — durable SQLite consent, reputation, request, and emergency-admission primitives.
  • internal/protocol/{amp,client}/*.proto — protobuf source definitions. No released cross-language SDK directory exists yet.

Docs Worth Reading

PROTOCOL.md (AMP mechanics, DNS mapping, crypto layout), INTEGRATION.md (bridging Postfix/Exchange), REPUTATION_MODEL.md, CRYPTO_REVIEW.md, ARCHITECTURE_REVIEW.md. sieve2mailscript.py converts Sieve filters to MailScript.