# Sequence templates reusable across campaigns

- **Pattern:** `ab-000603` (`campaign-orchestration-sequencing.sequence-architecture.reusable-templates`)
- **Severity:** low
- **Lifecycle:** active
- **Last modified:** 2026-04-18
- **Canonical URL:** https://auditbuffet.com/patterns/ab-000603
- **License:** CC-BY-4.0 — attribute to AuditBuffet Pattern Catalog (https://auditbuffet.com/patterns/ab-000603)

## Why it matters

When sequence steps live as a JSON blob inside a campaign record, every campaign that wants the same nurture cadence requires its own copy. Copies diverge — a fix to step 2 is applied to Campaign A but not Campaign B, the mistake is caught in production, and there is no authoritative source to determine which version is correct. iso-25010:2011 maintainability.reusability grades this failure mode: the architecture forces copy-paste duplication of business logic, making future changes error-prone and audit trails inconsistent. This is a low-severity architectural debt issue, not a runtime defect — the harm accrues gradually as sequences accumulate.

## Severity rationale

Low because the defect is an architectural coupling issue that causes maintenance burden and drift, not an immediate runtime failure or data loss.

## Remediation

Store sequence definitions as first-class rows in a `sequences` table, referenced by campaigns via a foreign key. Step logic lives in `sequence_steps`, not in campaign records.

```ts
// sequences table:       id, name, description, created_at
// sequence_steps table:  id, sequence_id (FK), step_index, template_id, delay_days, branch_conditions
// campaigns table:       id, name, sequence_id (FK to sequences)
// contact_sequences:     id, contact_id, campaign_id, sequence_id, current_step_index
```

With this schema, updating step 2 of a shared sequence propagates to every campaign referencing it — no copy-paste sync required. When a campaign needs a unique variation, clone the sequence and modify the clone rather than embedding divergent step data in the campaign row.

## Detection

- **ID:** `reusable-templates`
- **Severity:** `low`
- **What to look for:** Check whether sequence definitions are stored as reusable templates that can be attached to multiple campaigns, or whether each campaign embeds its own hard-coded sequence steps. Look for a `sequences` or `sequence_templates` table with a foreign key relationship to campaigns, rather than sequence steps being stored inline on campaign records.
- **Pass criteria:** Sequence definitions exist as discrete reusable entities. Multiple campaigns can reference the same sequence template. Cloning or re-using a sequence across campaigns does not require duplicating step definitions. Count all campaigns and enumerate which ones share a sequence template — at least 2 campaigns should be able to reference the same sequence without duplication.
- **Fail criteria:** Sequence steps are embedded directly in campaign records with no concept of a reusable template. Each campaign requires its own separate step definitions.
- **Skip (N/A) when:** The project has only one campaign or sequences are single-use by design.
- **Detail on fail:** `"Sequence steps stored as a JSON field on the campaign record — not reusable across campaigns"` or `"No sequence template table — each campaign defines its own steps in-line"`
- **Remediation:** Separate sequence definitions from campaign records:

  ```ts
  // sequences table: id, name, description, created_at
  // sequence_steps table: id, sequence_id, step_index, template_id, delay_days, branch_conditions
  // campaigns table: id, name, sequence_id (FK to sequences)
  // contact_sequences table: id, contact_id, campaign_id, sequence_id, current_step_index
  ```

---

## External references

- iso-25010 maintainability.reusability

Taxons: code-quality

HTML version: https://auditbuffet.com/patterns/ab-000603
