CatalystRL

arch-validator

Compliance

Cross-stack architecture rule validation with automatic bounty generation for violations.

Overview

Arch-validator enforces architectural rules across TypeScript (catalystrl-web), Python (catalystrl-intelligence), and skill configurations. When violations are detected, it generates bounties for resolution.

Invocation

/arch-validator                     # Validate all repositories
/arch-validator --repo=web          # Validate only web repo
/arch-validator --rule=rule_008     # Check specific rule
/arch-validator --fix               # Attempt auto-fix where possible

Also triggers on: validate architecture, arch rules

Rules

RuleSeverityLanguageDescription
rule_001HIGHPrismaNo bespoke agent models
rule_002HIGHTypeScriptNo bespoke API routes
rule_004HIGHPythonNo SQLAlchemy reserved names
rule_008CRITICALTypeScriptUse Prisma singleton
rule_009HIGHAllFile token limits (2000 lines)
rule_010MEDIUMJSONNo static data in skill configs

Example: Prisma Singleton Rule

Violation

import { PrismaClient } from "@/generated/prisma";
const prisma = new PrismaClient();

Correct

import prisma from "@/lib/prisma";
// Uses singleton instance

Why: PostgreSQL has ~100 connection slots. Next.js hot-reload creates new module instances. Without singleton, connections accumulate causing "connection slots reserved for superuser" error.

Bounty Generation

When violations are detected, arch-validator creates bounties with context for resolution:

Bounty payload
{
  "type": "prisma_singleton",
  "severity": "CRITICAL",
  "points": 120,
  "autoFixable": true,
  "context": {
    "file": "src/services/user.ts",
    "line": 5,
    "violation": "new PrismaClient()",
    "recommendation": "import prisma from '@/lib/prisma'"
  }
}

Configuration

config.json (excerpt)
{
  "repositories": {
    "web": {
      "path": "${CODE_BASE}/catalystrl-web/catalyst-web",
      "language": "typescript",
      "rules": ["rule_001", "rule_002", "rule_008", "rule_009"]
    },
    "intel": {
      "path": "${CODE_BASE}/catalystrl-intelligence",
      "language": "python",
      "rules": ["rule_004", "rule_005", "rule_006", "rule_009"]
    }
  },
  "bountyGeneration": {
    "enabled": true,
    "defaultPriority": "HIGH"
  }
}

Patterns Demonstrated

  • Cross-Stack Validation - TypeScript, Python, JSON rules
  • ABES Integration - Auto-generates bounties for violations
  • Auto-Fix Support - Some violations can be fixed automatically
  • Rule Severity - CRITICAL, HIGH, MEDIUM classification