Harness design pipeline

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

Harness design pipeline is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > Orchestrator composing all 6 design-pipeline sub-projects into a single sequential pipeline with convergence-based remediation: FRESHEN → DETECT → FIX → AUDIT → FILL → REPORT. Produces a unified `pa

How to use this skill

Skill file

Harness Design Pipeline

Orchestrator composing all 6 design-pipeline sub-projects into a single sequential pipeline with convergence-based remediation: FRESHEN → DETECT → FIX → AUDIT → FILL → REPORT. Produces a unified pass / warn / fail verdict and a per-phase report. Mirrors harness-docs-pipeline in shape; invokes every registered verifier through the formal verifier interface, and routes each one's findings into a named bucket that REPORT counts toward the verdict.

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. -->

Relationship to Sub-Skills

| Skill | Pipeline Phase | Role |

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

| detect-design-drift | DETECT | Find token bypass + primitive-adoption drift |

| align-design-system | FIX | Apply codemods + emit suggestions for drift findings |

| audit-component-anatomy | AUDIT | Find missing required anatomy parts in components |

| audit-brand-compliance | AUDIT | Find token misuse + forbidden phrases (brand semantics) |

| harness-design-craft | FILL | Critique copy/hierarchy/polish (LLM-judgment ceiling skill) |

This orchestrator delegates to sub-skills — it never reimplements their logic. Each sub-skill retains full standalone functionality.

Iron Law

The pipeline delegates, never reimplements. If you find yourself writing drift detection logic, fix application logic, or audit logic inside the orchestrator, STOP. Delegate to the dedicated sub-skill.

Safe fixes are silent, unsafe fixes surface. v1 follows align-design-system's pre-flight classifier verdict: applied outcomes are silent successes; suggestion / skipped-unsafe / failed outcomes surface in the report. Never override the classifier from inside the orchestrator.

Flags

| Flag | Effect |

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

| --fix | Enable convergence-based auto-fix (default: detect + report only) |

| --no-freshen | Skip the FRESHEN phase |

| --no-fill | Skip the FILL phase (input bootstrap + craft polish) |

| --ci | Deprecated, no effect (every run is non-interactive, safe-only); passing it adds a notice to warnings |

| --mode <m> | Verifier mode (fast or full); default fast |

| --files <...> | Optional file/glob scope passed to each verifier |

| --design-strictness <s> | Override design.strictness |

| --json | Machine-readable output |

Shared Context Object

All phases read from and write to a shared DesignPipelineContext:

interface DesignPipelineContext {
  /** Deprecated (removed in the next major): whether graph.json exists in resolveGraphDir(path) — the project's own .harness/graph, or the main checkout's in a linked worktree with none. No verifier reads it. */
  graphAvailable: boolean;
  inputs: {
    designMdExists: boolean;
    tokensJsonExists: boolean;
    componentRegistryExists: boolean;
    brandRulesExist: boolean;
  };
  bootstrapped: { designMd; tokensJson; componentRegistry; brandRules: boolean };
  driftFindings: DriftFinding[];
  fixesApplied: FixOutcome[];
  auditFindings: { anatomy: AnatomyFinding[]; brand: BrandFinding[] };
  craftFindings: CraftFinding[];
  craftSuggestions: number;
  /** Exclude globs the DETECT walk applied (empty for an explicit `files` scope, or when unmeasured). */
  exclusions: Set<string>;
  /** false when detect-drift threw or abstained — then an empty `exclusions` means "not measured", not "none applied". */
  exclusionsMeasured: boolean;
  /** Non-fatal notices, e.g. a deprecated option that changed nothing. */
  warnings: string[];
  verifiersRun: string[];
  verifiersFailed: Array<{ name: string; error: string }>;
  verdict: 'pass' | 'warn' | 'fail';
  /** Projection of verifiersFailed the verdict was resolved against. */
  degradedBy: string[];
  /** iterationsRun = FIX-loop passes executed (one per align invocation). */
  /** fixStopReason = 'not-run' | 'detect-unavailable' | 'no-drift' | 'converged' | 'no-progress' | 'max-iterations' | 'failed' */
  summary: {
    totalFindings;
    bySeverity;
    byCode;
    fixesApplied;
    iterationsRun;
    fixStopReason;
    durationMs;
  };
}

The context is passed to sub-skills via .harness/handoff.json with a pipeline field. align-design-system v1 already supports reading pipeline.driftFindings and writing pipeline.fixesApplied; other sub-skills run in standalone mode when invoked from the orchestrator.

Process

Phase 1: FRESHEN — Input Freshness Check

Skip this phase if --no-freshen flag is set.

  1. Check input file presence:
  1. Set context.inputs.* flags. Bootstrap action is DEFERRED to FILL phase (clean phase responsibilities).

Phase 2: DETECT — Find Design Drift

  1. Invoke runDetectDrift({ path, mode, files? }).
  2. Populate context.driftFindings with all DRIFT-T* and DRIFT-P* findings, and context.exclusions with the exclude globs detect-design-drift reports it applied (meta.excludePatterns). If detect-drift fails, exclusions stays empty and exclusionsMeasured is false, so read the flag before treating an empty set as "no globs applied".
  3. Record 'detect-drift' in context.verifiersRun.
  4. On failure: push to context.verifiersFailed and continue (graceful degradation). Graceful degradation means the OTHER verifiers still run — it does not mean the run can still report pass.
  5. If design.audit.driftDetection.enabled === false in config: SKIP this phase entirely.

Phase 3: FIX — Convergence-Based Drift Remediation

This phase runs only when --fix flag is set.

Convergence Loop
previousCount = context.driftFindings.length
maxIterations = 5

while iteration < maxIterations:
  0. iteration++            (counted when the pass starts, so every stop reports it)
  1. Write pipeline.driftFindings to handoff.json
  2. Invoke align-design-system in pipeline mode
  3. Append outcomes to context.fixesApplied
  4. If applied === 0: STOP (converged)
  5. Re-run detect-design-drift
  6. newCount = remaining findings
  7. if newCount >= previousCount: STOP (no progress)
  8. previousCount = newCount

summary.iterationsRun is the number of passes that ran, including the one that converged, made no progress, or failed — so fixesApplied > 0 always comes with iterationsRun >= 1. Because of that, the count does not say why the loop stopped (a run that converged on its 5th pass also reports 5); summary.fixStopReason does. It is max-iterations only when every allowed pass ran and the last one still made progress, and detect-unavailable — not no-drift — when --fix was set but DETECT never measured (detect-drift threw or abstained), so an empty finding list is never read as "nothing to fix".

Each align run mutates source files via its safe codemods (T001/T002/T003 only). Probably-safe / unsafe / failed outcomes are recorded but never auto-applied (align's pre-flight classifier is the gate).

Phase 4: AUDIT — Rule-Based Verifier Loop

  1. Iterate the orchestrator's VerifierRegistry generically:
  1. Each verifier's failure is captured in context.verifiersFailed without aborting the loop.
  2. Iron Law: the orchestrator does NOT import per-verifier rule logic — every verifier is invoked through its registered runner, and the loop that invokes them stays generic. Findings collection is the one place AUDIT keys on verifier name: each verifier's findings land in a named bucket. So adding a 5th verifier means registering it and giving it a bucket (a field on DesignPipelineContext.auditFindings, a routing branch in phases/audit.ts, and a count in phases/report.ts). A registered verifier with no bucket is recorded in verifiersFailed and fails the verdict — that is deliberate: dropping its findings while reporting it as run would be a silent pass.

Phase 5: FILL — Bootstrap + Ceiling Polish

Skip this phase if --no-fill flag is set.

5a. Bootstrap missing inputs. For each absent input declared in Phase 1:

Set context.bootstrapped.{designMd,tokensJson,componentRegistry,brandRules} per-input.

5b. Invoke design-craft-elevator POLISH (critique phase).

  1. Call runDesignCraft({ phases: ['critique'] }).
  2. Populate context.craftFindings (REPORT counts craftSuggestions from it).
  3. Record 'design-craft-critique' in context.verifiersRun.

design-craft suggestions are surfaced in REPORT but do NOT contribute to the error/warn severity counts — they're ceiling-layer suggestions, not violations.

Phase 6: REPORT — Verdict + Summary

Compute verdict:

| Condition | Verdict |

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

| Any error-severity finding remains after FIX | fail |

| Any verifier abstained (verifiersFailed non-empty → degradedBy) | fail |

| Any warn-severity finding OR craft suggestion OR bootstrapped any input | warn |

| Any design-system input missing, whether or not FILL ran (#1960) | warn |

| Zero findings, zero suggestions, zero bootstrapped, every verifier ran, every input present | pass |

A verifier that could not run is not a pass. The verdict is resolved from

the context in one expression, and context.degradedBy is the projection of

verifiersFailed that expression resolved against — so the verdict and its

evidence cannot disagree. A non-empty degradedBy means the fail is "part of

the design surface was never examined", not "a violation was found"; both are

fail because harness design-pipeline exits non-zero only on fail.

harness check-design draws the same line, with exit code 2 for the degraded

case.

Aggregate summary.bySeverity and summary.byCode across drift + anatomy + brand findings. (Craft findings use tier, not severity — they're tracked separately.) craftSuggestions is counted from craftFindings here rather than stored beside it by FILL.

Render human-readable or JSON output.

Harness Integration

Success Criteria

See docs/changes/design-pipeline/orchestrator/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 |

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

| "Looping detect → fix → detect is slow — I'll apply every fix in one pass and skip the re-detect." | Each align pass fixes only safe codemods, and re-running detect is how the loop measures progress, detects plateau (newCount >= previousCount), and catches fix oscillation. Collapsing the loop hides non-convergence and leaves drift unmeasured. |

| "Detecting this drift inline is just a regex — I'll compute it in the orchestrator instead of invoking detect-design-drift." | Iron Law: the pipeline delegates, never reimplements. Inline detect/fix/audit logic diverges from the sub-skill's rules and defeats the whole composition contract. Invoke runDetectDrift. |

| "align classified this as a suggestion, but it looks safe to me — I'll auto-apply it from the orchestrator." | Safe fixes are silent, unsafe fixes surface. Overriding align's pre-flight classifier from the orchestrator is explicitly forbidden; suggestion / skipped-unsafe / failed outcomes surface in the report, never as writes. |

| "Only one warn-severity finding remains — I'll report pass so CI stays green." | The verdict table is fixed: any warn-severity finding OR craft suggestion OR bootstrap yields warn, never pass. Downgrading the verdict hides declared violations from the humans relying on it. |

| "I'm adding a 5th verifier — register() is all it takes, so I'll skip the findings bucket." | Registration makes the verifier _run_; it does not make its findings _count_. Without a bucket in auditFindings, a routing branch in phases/audit.ts and a count in phases/report.ts, AUDIT records the verifier as abstained and every run fails. Add the bucket; do not put rule logic in the orchestrator, and do not add a catch-all that drops findings it cannot route. |

Examples

Example: Clean project, default flags

$ harness design-pipeline

Verdict: ✓ pass

Phases:
  FRESHEN  inputs: DESIGN.md=yes tokens.json=yes registry=yes brand=yes
  DETECT   drift findings: 0
  FIX      iterations: 0, fixes applied: 0
  AUDIT    anatomy: 0, brand: 0
  FILL     bootstrapped: none, craft suggestions: 0

Summary: 0 total findings (0 error, 0 warn, 0 info) in 142ms
Verifiers run: detect-drift, audit-anatomy, audit-brand, design-craft-critique

Example: Project with drift, `--fix` enabled

$ harness design-pipeline --fix

Verdict: ⚠ warn

Phases:
  FRESHEN  inputs: DESIGN.md=yes tokens.json=yes registry=yes brand=yes
  DETECT   drift findings: 14
  FIX      iterations: 3, fixes applied: 9
  AUDIT    anatomy: 1, brand: 0
  FILL     bootstrapped: none, craft suggestions: 4

Summary: 5 total findings (0 error, 5 warn, 0 info) in 1842ms
Verifiers run: detect-drift, align-design-system, audit-anatomy, audit-brand, design-craft-critique

(9 drift fixes auto-applied in convergence loop; 5 remaining warnings + 4 craft suggestions for human review)

Example: Empty project, FILL bootstraps inputs

$ harness design-pipeline

Verdict: ⚠ warn

Phases:
  FRESHEN  inputs: DESIGN.md=no tokens.json=no registry=no brand=no
  DETECT   drift findings: 0
  FIX      iterations: 0, fixes applied: 0
  AUDIT    anatomy: 0, brand: 0
  FILL     bootstrapped: designMd, tokensJson, componentRegistry, brandRules, craft suggestions: 0

Summary: 0 total findings (0 error, 0 warn, 0 info) in 89ms

(All inputs absent; FILL wrote minimal stubs; verdict warn because bootstrap occurred — author the TODO sections to clear it.)

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.