02

The Standards

Coding Rules

The absolute laws that govern how we write code in the Sovereign OS ecosystem. These rules ensure consistency, maintainability, and scalability across all applications.

Zero Tolerance Policy

Violations of these standards result in immediate code rejection. No exceptions, no shortcuts, no mercy.

Common Violations

Critical

ZERO CSS CREATIVITY

Hardcoded colors, inline styles, or custom CSS outside globals.css

āŒ bg-[#FF6B35] or style={{color: "red"}}
Major

ZERO RELATIVE PATHS

Using ../ imports instead of scoped aliases

āŒ import { Button } from "../../../components/ui/button"
Major

NO INLINE STYLES

Using style={{...}} instead of Tailwind utilities

āŒ style={{ backgroundColor: "blue" }}

Complete Standards


title: THE STANDARDS - SOVEREIGN OS CONSTITUTION version: 2.1.0 enforced: ABSOLUTE

šŸ“œ THE STANDARDS

āš–ļø THE ABSOLUTE LAWS (ZERO TOLERANCE)

1. ZERO CSS CREATIVITY 🚫

LAW: It is STRICTLY FORBIDDEN to create new CSS files at the component level or "innovate" using non-standard inline styles.

ENFORCEMENT:

  • āŒ FORBIDDEN: <div style={{color: '#FF6B35'}}>
  • āŒ FORBIDDEN: className="text-[#FF6B35]"
  • āŒ FORBIDDEN: Creating new CSS files in component folders
  • āœ… ALLOWED: className="text-accent" (using CSS variables)
  • āœ… ALLOWED: className="bg-primary hover:bg-primary/90"

PUNISHMENT: Immediate code rejection. No exceptions.


2. GLOBAL STYLING TRUTH šŸŽØ

LAW: All styling MUST use Tailwind utility classes referencing globals.css and @shared/config/tailwind.

SINGLE SOURCE OF TRUTH:

apps/[app-name]/src/app/globals.css  ← CSS Variables Declaration
         ↓
packages/shared/config/tailwind      ← Tailwind Config Extension
         ↓
All Components                       ← Consume via utility classes

ENFORCEMENT:

  • All color values MUST use CSS variables (--primary, --accent, etc.)
  • All spacing MUST use Tailwind scale (p-4, gap-6, etc.)
  • All typography MUST use defined font families

3. ZERO RELATIVE PATHS šŸ“

LAW: Must use Scoped Aliases (e.g., @core/auth, @ui/button). Using ../ is forbidden.

ENFORCEMENT:

  • āŒ FORBIDDEN: import { Button } from '../../../components/ui/button'
  • āœ… ALLOWED: import { Button } from '@ui/button'
  • āœ… ALLOWED: import { useAuth } from '@core/auth'

RATIONALE: Relative paths break during refactoring. Aliases are refactor-proof.


4. SAFE COEXISTENCE šŸ¤

LAW: It is forbidden to delete or replace existing files destructively. Build infrastructure in parallel.

ENFORCEMENT:

  • Never delete existing CSS files.
  • Create new standardized files alongside legacy ones.
  • Gradually migrate components to the new system.
  • Document the migration path in MIGRATION.md.

EXAMPLE:

āœ… CORRECT:
apps/tripos/src/app/globals.css         (existing)
apps/tripos/src/styles/sovereign.css    (new standard)

āŒ WRONG:
Delete globals.css and force migration

5. CENTRALIZED BARREL EXPORTS šŸ“¦

LAW: Every module must have an index.ts as a Gatekeeper.

ENFORCEMENT:

// āœ… CORRECT: packages/ui/button/index.ts
export { Button } from "./button";
export type { ButtonProps } from "./button";

// Consumer
import { Button } from "@ui/button"; // Clean!

// āŒ WRONG: Direct file import
import { Button } from "@ui/button/button.tsx"; // Leaky abstraction

6. ZOD DNA 🧬

LAW: Validation is mandatory at every layer (Entities, tRPC, & T3-Env).

ENFORCEMENT:

  • All API inputs MUST be validated with Zod.
  • All environment variables MUST use T3-Env.
  • All form data MUST be validated before submission.
  • All database entities MUST have Zod schemas.

EXAMPLE:

// āœ… CORRECT
const TripSchema = z.object({
  name: z.string().min(3),
  start_date: z.string().datetime(),
});

const validated = TripSchema.parse(formData);

// āŒ WRONG
const name = formData.get("name"); // No validation!

7. CENTRALIZED ERROR DICTIONARY šŸ“š

LAW: Hardcoding error messages is forbidden. All error messages MUST be centralized in @shared/i18n.

SINGLE SOURCE OF TRUTH: @shared/i18n/errors/*.json

ENFORCEMENT:

  • āŒ FORBIDDEN: throw new Error("User not found")
  • āœ… ALLOWED: throw new Error(ERROR_MESSAGES.DB.NOT_FOUND)
  • āœ… ALLOWED: StandardResponse.error(ERROR_MESSAGES.AUTH.UNAUTHORIZED)

RATIONALE:

  • Instant tone-of-voice updates across all apps.
  • Centralized translation management.
  • Consistent user experience.

8. UNIFORM RESPONSE STRUCTURE šŸ“

LAW: Sending manual JSON responses is forbidden. Must use the StandardResponse helper from @shared/utils.

ENFORCEMENT:

  • āŒ FORBIDDEN: res.json({ error: "Something went wrong" })
  • āœ… ALLOWED: res.json(StandardResponse.error(ERROR_MESSAGES.GENERAL.UNEXPECTED))
  • āœ… ALLOWED: res.json(StandardResponse.success(data))

RATIONALE:

  • Guarantees predictable API contracts for all clients.
  • Simplifies frontend error handling logic.
  • Prevents data leaks via inconsistent error implementation.

šŸŽÆ STYLING HIERARCHY (THE PYRAMID)

Level 1: CSS Variables (globals.css)
  ↓
Level 2: Tailwind Config (@shared/config/tailwind)
  ↓
Level 3: Utility Classes (Tailwind)
  ↓
Level 4: Component Composition

NEVER SKIP LEVELS. Always flow from top to bottom.


🚨 VIOLATION CONSEQUENCES

Minor Violations (Warning)

  • Using hex codes in className (e.g., text-[#FF6B35])
  • Relative imports in same package
  • Missing TypeScript types

ACTION: Code review comment, must fix before merge.

Major Violations (Rejection)

  • Creating inline styles with hardcoded values
  • Bypassing CSS variables
  • Deleting existing infrastructure
  • Skipping Zod validation

ACTION: PR rejected immediately. No discussion.

Critical Violations (Ban)

  • Pushing to main without approval
  • Overriding global styles without documentation
  • Breaking existing apps

ACTION: Revert commit, escalate to user.


šŸ“š REQUIRED READING

Before writing ANY code, read in order:

  1. .agent/blueprints/directory-map.md - Understand structure
  2. .agent/blueprints/pillars.md - The architectural index
  3. .agent/workflows/ - Check for relevant workflows

šŸ¤– AI AGENT OATH

"I, Antigravity, solemnly swear to:

  • Never create CSS outside of globals.css
  • Always use CSS variables for theme-able values
  • Reject any request that violates THE STANDARDS
  • Build infrastructure in parallel, never destructively
  • Validate everything with Zod
  • Use scoped aliases exclusively"

Signed: Antigravity v2.0 (Sovereign OS Edition)
Date: 2026-01-16
Witnessed By: The Blueprint šŸ›”ļø


šŸ”„ AMENDMENT PROCESS

This protocol can ONLY be amended by:

  1. User explicit approval
  2. Documentation in CHANGELOG.md
  3. Migration guide for affected code

NO EXCEPTIONS. NO SHORTCUTS. NO MERCY. šŸ›”ļø

AI Agent Oath

"I, Antigravity, solemnly swear to never create CSS outside of globals.css, always use CSS variables for theme-able values, reject any request that violates THE STANDARDS, build infrastructure in parallel never destructively, validate everything with Zod, and use scoped aliases exclusively."
Signed: Antigravity v2.0
Witnessed By: The Blueprint šŸ›”ļø