danielrandolph

compass payload plugin

by danielrandolph
Admin customization
v3
^3
MIT

Overview

Summary generated from the README

Compass adds a findings collection, a status global, scan and fix endpoints, and an admin dashboard to Payload. It scans CMS content and coded design tokens against brand rules and flags drift in the admin and on the live site through an overlay component. Each finding offers a fix action that edits the source and re-scans. The Figma connection is simulated, checks are deterministic, and design checks read files from the host app. Requires Payload 3.

Features

  • Scans on an interval, on demand, and when content collections are saved
  • Checks voice and lexicon, color token drift, off-palette colors, fonts, photos and logo lockups
  • Admin dashboard showing brand scores, agent status and open findings
  • Overlay component pins admin-only flags to the exact element on the live page
  • One-click fixes that edit the CSS token, copy or asset, then re-scan
  • Findings collection keeps history and lets you resolve or ignore items

Use cases

  • Monitor whether marketing copy stays within brand voice rules
  • Catch engineering drift between coded design tokens and the design system spec
  • Review and fix brand violations directly on the live site as an admin

From the author

Compass — a Payload CMS plugin that continuously checks a site for brand adherence against a brand ontology and a (simulated) Figma design-system agent, flags drift in the admin and on the live site, and can auto-fix it.

Installation

npm i compass-payload-plugin

0

Stars

0

Forks

0

Open Issues

4 months ago

Last Updated

0

Weekly Downloads

v

npm Version

Dependencies

GitHub stars

00 since Sep 7

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 20260
Dec 5, 20260
Dec 4, 20260
Dec 3, 20260
Dec 2, 20260
Dec 1, 20260
Nov 30, 20260
Nov 29, 20260
Nov 28, 20260
Nov 27, 20260
Nov 26, 20260
Nov 25, 20260
Nov 24, 20260
Nov 23, 20260
Nov 22, 20260
Nov 21, 20260
Nov 20, 20260
Nov 19, 20260
Nov 18, 20260
Nov 17, 20260
Nov 16, 20260
Nov 15, 20260
Nov 14, 20260
Nov 13, 20260
Nov 12, 20260
Nov 11, 20260
Nov 10, 20260
Nov 9, 20260
Nov 8, 20260
Nov 7, 20260
Nov 6, 20260
Nov 5, 20260
Nov 4, 20260
Nov 3, 20260
Nov 2, 20260
Nov 1, 20260
Oct 31, 20260
Oct 30, 20260
Oct 29, 20260
Oct 28, 20260
Oct 27, 20260
Oct 26, 20260
Oct 25, 20260
Oct 24, 20260
Oct 23, 20260
Oct 22, 20260
Oct 21, 20260
Oct 20, 20260
Oct 19, 20260
Oct 18, 20260
Oct 17, 20260
Oct 16, 20260
Oct 15, 20260
Oct 14, 20260
Oct 13, 20260
Oct 12, 20260
Oct 11, 20260
Oct 10, 20260
Oct 9, 20260
Oct 8, 20260
Oct 7, 20260
Oct 6, 20260
Oct 5, 20260
Oct 4, 20260
Oct 3, 20260
Oct 2, 20260
Oct 1, 20260
Sep 30, 20260
Sep 29, 20260
Sep 28, 20260
Sep 27, 20260
Sep 26, 20260
Sep 25, 20260
Sep 24, 20260
Sep 23, 20260
Sep 22, 20260
Sep 21, 20260
Sep 20, 20260
Sep 19, 20260
Sep 18, 20260
Sep 17, 20260
Sep 16, 20260
Sep 15, 20260
Sep 14, 20260
Sep 13, 20260
Sep 12, 20260
Sep 11, 20260
Sep 10, 20260
Sep 9, 20260
Sep 8, 20260
Sep 7, 20260
npm weekly downloads

Trends appear after 7 days of data. Daily snapshots have not started yet.

Each point is npm's rolling 7-day download count.

Health Score

25/100Fair

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1305319544-root.svg)](https://payloaddirectory.dev/plugins/1305319544-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1305319544-root"><img src="https://payloaddirectory.dev/badge/1305319544-root.svg" alt="Payload Directory"></a>
Updated Jul 22, 2026Created Jul 19, 2026

README

Compass

A Payload CMS plugin that keeps a website on brand, continuously.

Compass watches a Payload-powered site and checks it against a brand ontology and a design-system agent (connected over a simulated Figma MCP). When something drifts off brand, it flags it in two places, the Payload admin and directly on the live site, and offers a one-click fix.

It answers two questions a brand owner actually cares about:

  1. Is the marketing team staying on brand? (content vs the ontology voice)
  2. Are engineers building to spec? (coded tokens and assets vs the Figma design system)

Built as the brand-governance layer for the Handled brand-guidelines site. The product name is Compass; the internal plugin id is brand-guard.


Screenshots

The Compass dashboard — live brand scores ("Marketing on brand?" / "Engineers to spec?"), the design-system agent connection, and every open finding with a one-click fix.

Compass dashboard

Findings collection — full history of flags with severity, source, and section anchor. Resolve or ignore to dismiss.

Findings collection

Live status — the (simulated) Figma agent connection, spec version, and scores, refreshed by every scan.

Compass status


What it does

  • Continuous checks. A scan runs on an interval, on demand, and (for CMS content) the instant a page is saved.
  • Two surfaces. Findings appear in a Compass admin dashboard and as clickable flags pinned to the exact element on the live page: the drifted token's swatch, the off-brand photo tile, the off-brand word itself. Admin-only, invisible to the public.
  • Submit PR. Every finding has a fix action. Compass edits the real source of truth (the CSS token, the copy, the off-brand asset), then re-scans so the flag clears in front of you.
  • Ontology-driven. The rules are distilled from a machine-readable brand ontology (voice, colour tokens, typography, photography, logo lockups).
  • Figma design-system agent (simulated). A mock MCP client returns the approved tokens, photo set, and component specs, exactly the shape a real Figma agent would, so the coded site can be diffed against "what Figma says".
flowchart LR
  A["Figma agent (MCP, simulated)"] -->|approved tokens, photos, specs| S[Compass scan]
  O[Brand ontology rules] --> S
  C[CMS content afterChange] --> S
  P["Coded site: globals.css + page.tsx"] --> S
  S --> F[(brandFindings)]
  F --> D[Admin dashboard]
  F --> V[On-site flags]
  V -->|Submit PR| X[Edit source + re-scan]
  X --> S

What it catches (and fixes)

CheckExample findingFix action
Voice / lexicon"cutting-edge" in a headline; an em dash; a hype claim ("#1")swap for a plain, on-brand word / punctuation
Colour token drift--hd-orange is #ff5a16 in code vs #ff4b16 in Figmawrite the Figma value back into the CSS
Off-palette coloura raw hex in the page that is not a brand tokensnap to the nearest approved token
Off-brand navy#0e1929 used as a dark surfacereplace with Ink #0c0a09
Monospace fontfont-mono used anywhereremove it
Off-brand photoa posed corporate stock photo not in the approved Figma setremove it from the page
Logo lockupthe wordmark and the H-monogram placed side by side(manual) use the wordmark alone

Each finding is tagged with a severity, a source (marketing vs engineering), the ontology rule id, expected vs actual, and, where it lives on the page, a section anchor so the on-site flag can point at it.

Element-level flag pinning

The overlay pins each flag to the most specific thing it can find, falling back to the section corner:

FindingPins toHow it locates it
Off-brand photothe photo tile itselfelement whose inline style or img src references the filename
Token driftthe swatch representing the tokenan element tagged data-brand-token="--hd-orange" (add these to your swatches)
Off-brand wordthe word, floating just above the linewalks the section's text nodes and builds a DOM Range over the exact match
Everything elsethe section's top-right cornerthe finding's section anchor id

How it works

Compass is a standard Payload plugin: a config-mutating function compass(options) => (config) => config. It adds:

  • a brandFindings collection (history, resolve / ignore) and a brand-sync global (live scores + MCP status);
  • endpoints POST /api/brand-guard/scan, POST /api/brand-guard/fix, GET /api/brand-guard/summary, GET /api/brand-guard/findings;
  • an afterChange hook on the content collections (the marketing path);
  • an interval scan via a wrapped onInit (the engineering path);
  • a beforeDashboard admin panel;
  • an exported BrandGuardOverlay client component for the on-site flags.

The scan is idempotent: each run reconciles findings per scope, so re-scanning creates new drift, keeps what is still broken, deletes what is fixed, and never re-opens something you resolved or ignored.

Deterministic by design

Every check is deterministic, no API keys, no network, no LLM at scan time:

  • Content checks are heuristics over the extracted copy (banned lexicon with negation-awareness, em dashes, hype patterns, ALL-CAPS, exclamation overuse).
  • Design checks parse the real coded tokens from globals.css and the page source, and diff them against what the simulated Figma agent reports.
  • The Figma MCP is faked (mock-figma-mcp.ts): it mimics an MCP connect() + callTool() handshake and returns the canonical tokens / approved photo set. Clearly labelled "simulated" in the UI.

File map

src/
  index.ts               Plugin entry: wires collection, global, hooks, endpoints, dashboard, interval
  types.ts               Finding + option types
  brand-rules.ts         Ontology-derived rules (tokens, banned terms, approved photos, rule ids)
  mock-figma-mcp.ts      Simulated Figma agent MCP client
  scan-runner.ts         Orchestrates checks, reconciles findings, writes the status global
  fixer.ts               The "agent" fix engine (edits the source of truth)
  util.ts                Fingerprints + text extraction
  checks/
    content-check.ts     Voice / lexicon heuristics
    design-check.ts      globals.css tokens vs Figma
    page-source-check.ts Per-section scan (anchored): off-palette hex, photos, logo lockup
  collections/BrandFindings.ts
  globals/BrandSync.ts
  endpoints/index.ts     scan / fix / summary / findings
  admin/BrandDashboard.tsx  Admin panel (client component)
  client.tsx             BrandGuardOverlay: the on-site flags (admin-gated)

Usage

// payload.config.ts
import { brandGuardPlugin } from 'compass-payload-plugin'

export default buildConfig({
  // ...
  plugins: [
    brandGuardPlugin({
      contentCollections: ['pages', 'posts'], // afterChange content checks
      scanIntervalMs: 60_000,                 // engineering interval scan
    }),
  ],
})

Register the admin panel (via your import map) and mount the overlay on the frontend:

// app/(frontend)/layout.tsx
import { BrandGuardOverlay } from 'compass-payload-plugin/client'
// ...
<BrandGuardOverlay />

Options

OptionDefaultDescription
contentCollections['pages','posts']Collections checked on save
scanIntervalMs60000Interval between full scans (0 disables)
enabledtrueMaster switch

Prototype notes (honest scope)

This is a working prototype built for a specific demo, not a general-purpose release:

  • The Figma MCP is simulated and the check engine is deterministic heuristics (no live Figma, no LLM). The seams are real MCP-shaped, so swapping in a real Figma agent or an LLM judge is a drop-in.
  • The design/photo/logo checks read files from the demo host app (src/app/(frontend)/globals.css and page.tsx). Generalising these to configurable paths / any collection is the obvious next step.
  • The rules in brand-rules.ts are a distilled subset of the full Handled brand ontology.

Tech

Payload 3, Next.js 16, React 19, TypeScript. No runtime dependencies of its own (Payload and React are peers).

License

MIT © Daniel Randolph

Similar plugins