from @unified-product-graph/core/intelligence · re-exported by @sdk
Intelligence
v0.4 anti-patterns and heuristics.
70 exports · 15 const · 7 type · 25 interface · 23 fn
Since v0.4.0Quick import
import { UPG_ANTI_PATTERNS, UPG_RELATIONSHIP_BENCHMARKS } from '@unified-product-graph/core'Example
// Walk the anti-pattern catalogue
import { UPG_ANTI_PATTERNS } from '@unified-product-graph/core'
for (const pattern of UPG_ANTI_PATTERNS) {
console.log(`${pattern.id} — ${pattern.severity}`)
}v0.4 anti-patterns and heuristics. The rules a graph is validated against: UPG_ANTI_PATTERNS for cross-domain health checks, domain guides for per-domain authoring guidance, and benchmarks for stage-appropriate coverage targets. These are the rules the MCP get_anti_pattern and list_anti_patterns tools surface.
Exports
Constants
readonly ["concept", "validation", "build", "beta", "launch", "growth", "mature", "maintenance", "sunset"]Types
type IntelligenceCondition = | { check: | EntityCheck | RelationshipCheck | BenchmarkCheck | TotalEntityCountCheck | DomainCountCheck | DomainPopu...A structured, machine-evaluable condition for intelligence prompts.
type UPGAntiPatternConcern = 'product_spine' | 'universal' | 'operating'The concern family an anti-pattern belongs to — the axis a per-member-kind profile switches on.
type UPGAntiPatternSeverity = 'high' | 'medium' | 'low'Severity tier for a curated anti-pattern.
type UPGBenchmarkSource = | { kind: 'book'; citation: string } /** Attributed to a specific practitioner or method author. */ | { kind: 'practi...Where a benchmark's range or expectation comes from.
type UPGMemberKindKey = 'product' | 'org_rollup' | 'watched' | 'operating_function'Member-kind keys for the profile table.
Interfaces
interface AntiPatternViolationOne fired anti-pattern, lifted from the catalog with prose attached.
interface EdgeCountVsPropertyCheckCount entities whose EDGE COUNT stands in a stated relation to one of their own NUMERIC PROPERTIES (0.29.0).
interface ProductStageCoercionResult of a soft-coercion attempt on a product `stage` value.
interface UPGCuratedAntiPatternA curated, cross-domain anti-pattern with a machine-evaluable detector.
interface UPGEdgeCountSpecOne `edge_count_vs_property` check declared somewhere in `UPG_ANTI_PATTERNS`, flattened for collectors (0.29.0).
interface UPGEntityFilterSpecOne `entity_count` filter declared somewhere in `UPG_ANTI_PATTERNS`, flattened for collectors (0.29.0).
interface UPGPresenceExceptSpecOne `{ property, present, except_property, except_value }` filter declared somewhere in `UPG_ANTI_PATTERNS`, flattened for collectors.
Functions
(check: EdgeCountVsPropertyCheck) => UPGEdgeCountSpecNormalise one `edge_count_vs_property` check into its spec.
(filter: Record<string, unknown>) => "presence" | "value" | "status" | "unrecognized"Which of the recognised `EntityCheck.filter` shapes this is.
(value: unknown) => ProductStageCoercionSoft-coerce a stage value to canonical UPGProductStage, falling back to the documented mapping for known legacy values.
(cond: IntelligenceCondition | undefined) => string[]Walk the condition and return the unique entity-type strings it references.
(kind: string | undefined, concern: UPGAntiPatternConcern) => booleanIs an anti-pattern of this concern EVALUATED (run + reported) for this kind?
(antiPatternId: string) => UPGAntiPatternConcernThe concern family for a curated anti-pattern id (default `product_spine`).
(kind: string | undefined, concern: UPGAntiPatternConcern) => booleanDoes a fired violation of this concern GATE `valid` for this kind?
(spec: UPGEdgeCountSpec) => stringCanonical key for one edge-count spec, shared by the collectors that build `nodesByEdgeCountSpec` and the evaluator that reads it.
(entityType: string, filter: Record<string, unknown>) => stringCanonical key for one `entity_count` filter, shared by the collectors that build `nodesByEntityFilter` and the evaluator that reads it (0.29.0).
(inputs: AntiPatternInputs, options?: EvaluateAntiPatternsOptions) => AntiPatternViolation[]Evaluate the curated anti-pattern catalog against a graph's pre-computed stats.
(domainId: UPGDomainId | string) => UPGEntityType | undefinedGet the anchor entity for a domain (the entity you create first).
(id: string) => UPGCuratedAntiPattern | undefinedLook up a curated anti-pattern by its slug id.
() => { domain: "design_system" | "business_model" | "portfolio" | "workspace" | "strategy" | "user" | "discovery" | "validation" | "market_intelligence" | "user_research" | "ux_design" | ... 25 more ... | "foundations"; anti_pattern: UPGAntiPattern; }[]Get all anti-patterns across all domains, flattened and tagged by domain.
(severity: UPGAntiPatternSeverity) => readonly UPGCuratedAntiPattern[]Filter the curated set by severity tier.
(stage: UPGProductStage) => readonly UPGCuratedAntiPattern[]Filter the curated set to anti-patterns relevant at a given product stage.
(entityType: UPGEntityType | string, stage: UPGProductStage) => StageRangeLook up the expected range for a type at a given stage.
(domain: UPGDomainId | string) => CountBenchmark[]Get all benchmarks for a given domain.
(domainId: UPGDomainId | string) => UPGDomainUsageGuide | undefinedLook up the usage guide for a domain.
(antiPatternId: string, totalEntityCount: number) => booleanTrue when a fired coverage anti-pattern should be advisory (not gating) because the graph is still too thin to expect breadth.
(property: string, exceptProperty: string, exceptValue: string) => stringCanonical key for an except-qualified presence count, shared by the collectors that build `countsByTypeAndPropertyPresenceExcept` and the evaluator that reads it.