How Hallmark Enforces Structural Variety in Generated UIs: 6 Architectural Mechanisms
Hallmark guarantees structural variety by selecting from a curated catalog of 21 macrostructures and enforcing diversification rules that prevent consecutive builds from using the same layout family.
Hallmark is an open-source UI generation engine by Nutlope that produces distinct page layouts for every build. Unlike template-based generators that merely swap colors on a fixed layout, Hallmark enforces structural variety in generated UIs through a macrostructure-first architecture. This article examines the six technical mechanisms—from diversification rules to automated quality gates—that prevent layout repetition.
The Macrostructure Catalog: 21 Distinct Page Architectures
At the core of Hallmark's variety system is a curated catalog of 21 named macrostructures defined in /skills/hallmark/references/macrostructures.md. Each macrostructure—such as Bento Grid, Marquee Hero, Stat-Led, or Split Studio—specifies a complete fingerprint of heading placement, content composition, navigation style, footer type, and optional hero enrichments. This catalog ensures that every generated UI starts from a fundamentally different structural foundation rather than minor variations of a single template.
The Diversification Rule: Preventing Consecutive Duplication
Hallmark implements a strict diversification rule that reads the comment stamp /* Hallmark · macrostructure: <name> … */ from the most recent output before generating a new page. As documented in /skills/hallmark/references/macrostructures.md, the system must select a different macrostructure for every build; two consecutive outputs can never share the same macrostructure family. This rule is enforced regardless of user prompts or theme selections, ensuring that running hallmark build twice produces categorically different layouts.
Slop-Test Gates: Automated Structural Validation
The quality assurance layer in /skills/hallmark/references/slop-test.md contains 57 automated gates that validate structural uniqueness:
- Gate 40 scans for the macrostructure stamp in existing files or reads
.hallmark/log.jsonto flag reuse of the same macrostructure from a previous Hallmark run. - Gate 83 ensures that even when reusing the same archetype, at least one variation knob—such as tile count or accent style—must differ from previous generations.
These gates run automatically during the build process and reject outputs that fail structural variety requirements before they reach the file system.
Stamp-Based Verification and Auditing
Every generated CSS file begins with a machine-readable stamp that records the chosen macrostructure, genre, theme, enrichment, navigation, and footer configuration. According to /skills/hallmark/references/hero-enrichment.md, this stamp follows the format:
/* Hallmark · genre: modern-minimal · macrostructure: Bento Grid · theme: garden · enrichment: none · nav: N3 · footer: Ft2 */
The hallmark audit command, documented in /skills/hallmark/references/verbs/audit.md, validates that the actual markup matches the stamped macrostructure and flags any structural drift between the stamp and the implementation.
Fallback Selection for New Projects
When no prior stamp exists in a project, Hallmark reads the input brief to derive a domain cue—such as "SaaS" or "fashion"—and offers three categorically different macrostructures to the user. As specified in /skills/hallmark/references/structure.md, the system recommends the option most distant from any macrostructures previously used by that specific user, ensuring variety even in first-time project setups.
Preserving Variety with Custom Themes
Even when users request bespoke visual styling, Hallmark maintains structural diversity. The workflow in /skills/hallmark/references/custom-theme.md applies custom palettes on top of the selected macrostructure rather than constraining the layout to a single template. This macrostructure-first approach ensures that a custom theme does not default to repetitive structures while still allowing bespoke visual styling.
Practical Implementation Examples
Checking the current macrostructure in generated CSS:
import fs from 'fs';
const css = fs.readFileSync('site/example.css', 'utf8');
const stamp = css.match(/\/\* Hallmark · .* macrostructure: (\w+).* \*\//);
console.log('Current macrostructure:', stamp?.[1] ?? 'none');
Auditing a page for structural drift:
hallmark audit ./site/example.css
# Validates the stamp and reports "macrostructure drift" if duplication is detected.
Forcing a specific macrostructure via CLI:
hallmark build --macrostructure="Split Studio" --theme="cobalt"
Summary
- Hallmark maintains 21 distinct macrostructures that define complete page architectures rather than cosmetic variations.
- The diversification rule prohibits consecutive builds from using the same macrostructure family by scanning for the
/* Hallmark · macrostructure: ... */stamp. - Slop-Test Gates 40 and 83 automatically reject builds that repeat structures or fail to vary key layout knobs.
- Stamp-based verification embeds structural metadata in generated CSS files, enabling the
hallmark auditcommand to detect drift. - For new projects, the system selects macrostructures maximally distant from the user's prior selections based on domain cues.
- Custom themes apply visual changes atop diverse macrostructures, preserving structural variety while allowing bespoke styling.
Frequently Asked Questions
What is a macrostructure in Hallmark?
A macrostructure is a named page architecture—such as Bento Grid or Split Studio—that defines the complete structural fingerprint of a generated UI, including heading placement, navigation type, footer style, and content composition. Hallmark maintains 21 of these macrostructures in /skills/hallmark/references/macrostructures.md to ensure each build starts from a unique layout foundation.
How does Hallmark prevent generating the same layout twice in a row?
Hallmark enforces a diversification rule that reads the macrostructure stamp from the previous build (stored in CSS comments or .hallmark/log.json) and explicitly selects a different macrostructure for the next generation. Gate 40 in the slop-test suite automatically flags any attempt to reuse the same macrostructure consecutively.
Can I force Hallmark to use a specific macrostructure?
Yes. You can bypass the automatic selection by using the --macrostructure CLI flag followed by the specific macrostructure name, such as hallmark build --macrostructure="Marquee Hero". However, subsequent builds will still be required to select a different macrostructure to maintain variety.
Does using a custom theme reduce structural variety?
No. According to /skills/hallmark/references/custom-theme.md, custom themes apply color and typography changes on top of the selected macrostructure. The system still enforces the diversification rules and macrostructure catalog, ensuring that custom-styled UIs remain structurally distinct from one another.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →