Audit brand compliance

From Intense-Visions/harness-engineering · View interactive version

Audit brand compliance is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > Rule-based brand-semantics audit. Detects (a) tokens used in forbidden contexts per their `$extensions.harness.brand.forbidden_contexts` metadata (BRAND-T001) and (b) UI copy containing phrases list

How to use this skill

Skill file

Audit Brand Compliance

Rule-based brand-semantics audit. Detects (a) tokens used in forbidden contexts per their $extensions.harness.brand.forbidden_contexts metadata (BRAND-T001) and (b) UI copy containing phrases listed in DESIGN.md ## Brand Rules → voice.forbidden_phrases (BRAND-V001). The 4th composed verifier in harness check-design, alongside audit-component-anatomy, design-craft critique, and detect-design-drift.

When to Use

Capability Roles

<!-- Capability seam: this skill participates in a real extension point whose three roles are named and concrete. A seam with only one role filled is accidental single-implementation lock-in. See harness-skill-authoring Phase 1C. -->

Process

Phase 1: LOAD — Parse the two input sources

  1. Read project configuration. Check harness.config.json for:
  1. Load design-system/DESIGN.md ## Brand Rules. The parser extracts:
  1. Load design-system/tokens.json $extensions.harness.brand. Walks the DTCG token tree capturing per-token role, approved_contexts, forbidden_contexts. Returns null when no token carries the extension → BRAND-T\* silently skips.

Phase 2: SCAN — Apply the two rule families

  1. BRAND-T001 — token misuse (regex-based). For each token whose forbidden_contexts is non-empty:
  1. BRAND-V001 — forbidden phrases (TS Compiler API). For each .tsx/.jsx file:

Phase 3: REPORT — Aggregate and surface

  1. Severity from design.strictness (uses severityFor):
  1. Aggregate bySeverity and byCode into the standard Verifier shape: { findings, summary, catalog, meta }.
  1. Persist findings to the graph (when composed by check-design). check-design routes brand findings through DesignConstraintAdapter.recordFindings() alongside anatomy / craft / drift. v1 uses the shared VIOLATES_design edge; v1.x may add a brand-specific edge.

Harness Integration

Success Criteria

See docs/changes/design-pipeline/audit-brand-compliance/proposal.md for the full 34 success criteria. Highlights:

Rationalizations to Reject

These are common rationalizations that sound reasonable but lead to incorrect results. When you catch yourself thinking any of these, stop and follow the documented process instead.

| Rationalization | Why It Is Wrong |

| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| "This copy says 'world-class' which sounds off-brand, so I'll flag it even though it isn't in forbidden_phrases." | BRAND-V001 fires ONLY on phrases declared in DESIGN.md ## Brand Rules → voice.forbidden_phrases. Inventing violations beyond the declared list is editorializing, not auditing. If the phrase should be banned, that is a DESIGN.md authoring change (via harness-design), not an audit finding. |

| "This token is clearly used decoratively, so I'll flag it even though decorative isn't in its forbidden_contexts." | BRAND-T001 fires only when a matched context keyword is in that token's declared forbidden_contexts, and honors approved_contexts. The policy lives in the token metadata — do not substitute your own judgment for the declared contract. |

| "This .ts file has a forbidden phrase in a string, so I'll flag it." | BRAND-V001 scans only .jsx/.tsx — user-visible JSX text and string-typed JSX attributes. .ts/.js and .md copy are a different audience and explicitly out of scope. |

| "## Brand Rules is missing from DESIGN.md, but I can infer the brand voice, so I'll audit anyway." | The DESIGN.md parser returns null when the section is absent, and BRAND-V001 silently skips. Likewise BRAND-T\* skips when no token carries $extensions.harness.brand. No findings without parsed inputs — a null resolver is not a verifier failure. |

| "This copy looks like an error state, so I'll infer the tone-by-context and flag a mismatch." | Tone-by-context inference is deferred to v1.x. v1 matches only the explicit context-vocabulary keywords against adjacent source text. Do not simulate component-state inference the audit does not yet perform. |

Examples

Example: Token used in forbidden context

Input:

design-system/tokens.json:

{
  "color": {
    "brand": {
      "500": {
        "$type": "color",
        "$value": "#3b82f6",
        "$extensions": {
          "harness": {
            "brand": {
              "role": "primary",
              "approved_contexts": ["cta", "selection", "focus"],
              "forbidden_contexts": ["data-visualization", "decorative"]
            }
          }
        }
      }
    }
  }
}

src/Chart.tsx:

// data-visualization color palette
const palette = [tokens.color.brand.500, ...];

Output:

BRAND-T001 [error] src/Chart.tsx:2 — Token "color.brand.500" is used in forbidden context "data-visualization"
  Fix: Token "color.brand.500" is not approved for the "data-visualization" context.
       Use an approved token (allowed contexts: cta, selection, focus), or update
       tokens.json $extensions.harness.brand if the policy is wrong.

Example: Forbidden phrase in UI copy

Input:

DESIGN.md:

## Brand Rules

### Voice

forbidden_phrases:

- "click here"
- "best-in-class"

src/Cta.tsx:

export const Cta = () => <a href="/x">Click here</a>;

Output:

BRAND-V001 [warn] src/Cta.tsx:1 — UI copy contains forbidden phrase "click here" — declared at DESIGN.md ## Brand Rules → Voice → forbidden_phrases
  Fix: Rewrite to avoid "click here". If the phrase is unavoidable for this context,
       remove it from voice.forbidden_phrases (or scope the audit) — but the default
       policy is that brand voice trumps convenience.

Gates

Escalation

Status

v1 — in implementation. See:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.