tractatus/email-templates/README.md
TheFlow a4db3e62ec
Some checks are pending
CI / Run Tests (push) Waiting to run
CI / Lint Code (push) Waiting to run
CI / CSP Compliance Check (push) Waiting to run
chore(vendor-policy): sweep project-self GitHub URLs to Codeberg (partial)
Addresses the documentation-layer gap after Phase A/B moved the git REMOTE from
GitHub to Codeberg but left ~100 project-self GitHub URLs embedded in markdown,
HTML, JS, and Python files. The remote-layer migration was generalised as
"GitHub is gone from the codebase" without verifying the content layer.

22 files swept in this commit. 27 additional files hold pre-existing inst_016/017/018
or inst_084 debt that would transfer on touch (hook whole-file scan). Those
await a companion hygiene-first commit before their GitHub->Codeberg flip
can land cleanly.

Sweep scope this commit:
  - README.md, SECURITY.md
  - 3 For-Claude-Web bundle files (GitHub URLs noted as "separate concern" in
    today's earlier licence-swap commits)
  - docs/markdown/deployment-guide.md
  - docs/AUTOMATED_SYNC_SETUP, PLURALISM_CHECKLIST, github/AGENT_LIGHTNING_README
  - docs/business-intelligence/governance-bi-tools
  - docs/outreach/EXECUTIVE-BRIEF-BI-GOVERNANCE (+ v2)
  - docs/research/ARCHITECTURAL-SAFEGUARDS-*
  - email-templates/README.md, base-template.html
  - 3 scripts/seed-*-blog-post.js (blog-seeding scripts)
  - scripts/upload-document.js
  - SESSION_HANDOFF_2025-10-23_FRAMEWORK_ANALYSIS.md
  - SECURITY_INCIDENT_POST_MORTEM_2025-10-21.md

Pattern swaps (longest-first):
  github.com/AgenticGovernance/tractatus-framework/issues -> codeberg.org/mysovereignty/tractatus-framework/issues
  github.com/AgenticGovernance/tractatus-framework/discussions -> .../issues (Codeberg has no discussions feature)
  github.com/AgenticGovernance/tractatus-framework.git -> codeberg.org/mysovereignty/tractatus-framework.git
  github.com/AgenticGovernance/tractatus-framework -> codeberg.org/mysovereignty/tractatus-framework
  git@github.com:AgenticGovernance/... -> git@codeberg.org:mysovereignty/...
  github.com/AgenticGovernance/tractatus (old org/repo path) -> codeberg.org/mysovereignty/tractatus-framework
  AgenticGovernance/tractatus-framework (bare) -> mysovereignty/tractatus-framework

Hook validator update (scripts/hook-validators/validate-credentials.js):
  PROTECTED_VALUES.github_org:  'AgenticGovernance'  -> 'mysovereignty'
  PROTECTED_VALUES.license:     'Apache License 2.0' -> EUPL-1.2 long form
  URL detection regex:          /github\.com\/.../   -> /codeberg\.org\/.../
  Placeholder checks + error messages updated to reflect Codeberg as
  authoritative post-migration host. Key names (e.g. `github_org`) retained
  for backward compatibility with validate-file-edit.js.

Held back from this commit (27 files total, documented reasons):

  11 historical session handoffs / closedown docs / incident reports
    (2025-10 through 2026-02) — modifying them rewrites the record to contain
    URLs that did not exist at the time of writing, AND ownership of their
    pre-existing inst_084 exposures transfers on touch.

  8 live-content docs with pre-existing inst_084 debt (port/API-endpoint/
    file-path exposures): docs/markdown/case-studies.md, technical-architecture,
    introduction-to-the-tractatus-framework, implementation-guide-v1.1,
    docs/plans/integrated-implementation-roadmap-2025, docs/governance/*,
    docs/ANTHROPIC_*, docs/GOVERNANCE_SERVICE_*, docs/RESEARCH_DOCUMENTATION_*,
    deployment-quickstart/*.

  8 live-content docs with pre-existing inst_016/017/018 debt:
    CHANGELOG.md, CONTRIBUTING.md, docs/LAUNCH_ANNOUNCEMENT, LAUNCH_CHECKLIST,
    PHASE_4_REPOSITORY_ANALYSIS, PHASE_6_SUMMARY, docs/plans/research-enhancement-
    roadmap-2025, docs/case-studies/pre-publication-audit-oct-2025.

  Also NOT in this commit (separate concerns):
  - scripts/add-inst-084-github-url-protection.js (detection-rule logic needs
    framework-level decision on post-migration semantics).
  - .claude/* (framework state).
  - docs/PRODUCTION_DOCUMENTS_EXPORT.json (DB dump).
  - package-lock.json (npm sponsor URLs, third-party).
  - .git/config embedded credentials (requires out-of-band rotation on both
    remote hosts + auth-strategy decision; user-action task).

Context: today's EUPL-1.2 sweep closed the licence-text-content layer
(5c386d0d / 6d49bfbf / ab0a6af4 / 4c1a26e8). This commit starts closing the
matching vendor-URL-content layer. Next: hygiene-first pass on the 16
live-content docs held back, then a second URL-flip pass on them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 10:53:13 +12:00

134 lines
4.4 KiB
Markdown

# Email Templates for Newsletter Tiers
This directory contains HTML email templates for the four newsletter subscription tiers:
1. **research-updates.html** - Monthly research insights (scholarly audience)
2. **implementation-notes.html** - Bi-weekly implementation guidance (practitioners)
3. **governance-discussions.html** - Sporadic values/governance topics (stakeholders)
4. **project-updates.html** - Quarterly project milestones (general audience)
## Template Variables
All templates use Mustache-style {{variables}} for dynamic content:
- `{{name}}` - Subscriber name
- `{{unsubscribe_link}}` - Unsubscribe URL
- `{{preferences_link}}` - Preferences management URL
- `{{website_link}}` - https://agenticgovernance.digital
- `{{docs_link}}` - https://agenticgovernance.digital/docs.html
- `{{github_link}}` - https://codeberg.org/mysovereignty/tractatus-framework
- Content-specific variables documented in each template
## Usage
Templates are loaded by the newsletter admin UI and processed with a template engine (e.g., Handlebars, Mustache) before sending via email service.
## Design Principles
- Inline CSS for email client compatibility
- Responsive design (mobile-friendly)
- Accessible (semantic HTML, sufficient contrast)
- Brand-consistent (blue gradient header, clean typography)
- Clear CTA buttons with good hit targets
- Unsubscribe link always visible in footer
## Template Usage
### Base Template (`base-template.html`)
The base template provides the outer HTML structure with header, footer, and styling. It uses these placeholders:
- `{{email_title}}` - Email subject (for <title> tag)
- `{{header_title}}` - Main header text (e.g., "Tractatus Research Updates")
- `{{header_subtitle}}` - Subtitle text (e.g., "Monthly insights from AI governance research")
- `{{name}}` - Subscriber name
- `{{content_body}}` - HTML content injected here
- `{{tier_name}}` - Newsletter tier name (for footer)
- `{{unsubscribe_link}}` - Unsubscribe URL
- `{{preferences_link}}` - Preferences management URL
### Content Modules
Content modules are HTML snippets that get injected into `{{content_body}}`. Example:
- `research-updates-content.html` - Research Updates tier content structure
### Implementation with Template Engine
```javascript
const Handlebars = require('handlebars');
const fs = require('fs');
// Load templates
const baseTemplate = fs.readFileSync('email-templates/base-template.html', 'utf8');
const contentModule = fs.readFileSync('email-templates/research-updates-content.html', 'utf8');
// Compile
const compiledContent = Handlebars.compile(contentModule);
const compiledBase = Handlebars.compile(baseTemplate);
// Render content
const renderedContent = compiledContent({
highlight_1_title: "...",
highlight_1_summary: "...",
// ... all other variables
});
// Render final email
const finalEmail = compiledBase({
email_title: "Tractatus Research Updates - November 2025",
header_title: "Tractatus Research Updates",
header_subtitle: "Monthly insights from AI governance research",
name: subscriber.name || "there",
content_body: renderedContent,
tier_name: "Research Updates",
unsubscribe_link: `https://agenticgovernance.digital/api/newsletter/unsubscribe?token=${subscriber.token}`,
preferences_link: `https://agenticgovernance.digital/newsletter/preferences?token=${subscriber.token}`
});
```
### Plain Text Version
Always generate a plain-text version alongside HTML for accessibility and spam filtering:
```javascript
const htmlToText = require('html-to-text');
const plainText = htmlToText.convert(finalEmail, {
wordwrap: 80,
ignoreImages: true
});
```
### Testing
Test emails with [Litmus](https://www.litmus.com/) or [Email on Acid](https://www.emailonacid.com/) across:
- Gmail (desktop, mobile)
- Outlook (2016+, 365)
- Apple Mail (macOS, iOS)
- Yahoo Mail
- Thunderbird
### Sending
Use a transactional email service:
- **SendGrid**: https://sendgrid.com/
- **Mailgun**: https://www.mailgun.com/
- **AWS SES**: https://aws.amazon.com/ses/
Example with SendGrid:
```javascript
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
await sgMail.send({
to: subscriber.email,
from: 'research@agenticgovernance.digital',
subject: 'Tractatus Research Updates - November 2025',
html: finalEmail,
text: plainText,
trackingSettings: {
clickTracking: { enable: true },
openTracking: { enable: true }
}
});
```