Skip to content

The Development Workflow ​

When you adopt Carotene, your day-to-day routine as a developer fundamentally changes.

In a traditional framework like Next.js or Express, the workflow is imperative: you write a line of code, save the file, refresh the browser, check console.log, find a bug, and write another line of code. You spend 80% of your time implementing logic and 20% designing the system.

Carotene flips this ratio. You are no longer the Builder; you are the Systems Architect. Your workflow is entirely declarative, driven by constraints, boundaries, and mathematical proofs.

Here is the standard Carotene Development Workflow.

Phase 1: Architecting the Blueprint ​

You never start a feature by writing logic. You start by defining the physical realities of the feature: the shape of the data, the security perimeter, and the network boundaries.

  1. Define the Data (model & store): What does the database look like?
  2. Define the Lifecycle (flow): What are the legal states this data can exist in?
  3. Define the Boundaries (Verbs): What is this feature allowed to touch? You write your backend function and immediately lock it down with reads, updates, and calls.

At this stage, you haven't written any code. You have simply drawn a box. The AI cannot step outside this box.

Phase 2: Expressing Intent ​

Once the Zero-Trust Sandbox is defined, you fill in the business rules. You do not write boilerplate data transformations or complex algorithms.

  1. Deterministic Fast-Paths: If a rule is simple and absolute (e.g., if (user.age < 18) rejects with "Too young"), you write it using standard, deterministic Carotene syntax.
  2. The Generative Operator (@(...)): For everything else—tedious calculations, data mapping, string generation, or complex sorting—you drop a Generative Operator. You are explicitly delegating the implementation to the AI compiler.
dart
// Phase 1: Boundaries
targetUser = store.User(userId)
requires session.role == Admin

// Phase 2: Intent
discount = @("Calculate the seasonal discount based on the user's past 5 orders")

Phase 3: Writing the Proof ​

Because you delegated logic to the AI, you must prove the AI understood your intent. You do not run the app to test it; you write a test block.

You use mock to instantly seed the Vapor Sandbox with edge-case data, and asserts to define the mathematically correct outcome.

dart
// Phase 3: The Proof
test "Applies maximum 20% seasonal discount for heavy buyers" {
  user = mock store.User { id: "1" }
  mock store.Order { userId: user.id, total: 5000.0 } // Heavy buyer
  
  result = ApplyDiscount(user.id)
  
  asserts result == 0.20 // The AI MUST figure out how to output 0.20
}

Phase 4: The Autonomic Build Loop (carrot dev) ​

This is where the magic happens. Instead of manually testing APIs in Postman, you run the Carotene watch command in your terminal:

bash
carrot dev

This starts the Test-Driven Generation (TDG) engine. As you save your .carrot file, the following autonomic loop executes in the background:

  1. Parse & Provision: The compiler reads your boundaries and instantly provisions the local in-memory database and routing layer.
  2. Generate: The LLM reads your @(...) operators and writes the underlying TypeScript or Go implementation.
  3. Evaluate: The engine spins up the Deterministic Sandbox, injects your mocks, and runs the AI's code.
  4. Negotiate (The Invisible Step): If the AI's code fails your asserts statement, the terminal does not throw an error. Instead, the Sandbox intercepts the failure, feeds the stack trace back to the AI, and forces it to rewrite the code. This happens in milliseconds.
  5. Success: Only when the AI writes code that perfectly satisfies your architectural boundaries and test assertions does the terminal turn green.
bash
[~] Compiling ApplyDiscount...
[~] AI failed assertion (Expected 0.20, Got 0.15). Retrying...
[✔] Build Successful.

The Result: Deployment Confidence ​

When carrot dev goes green, you aren't just confident that the code compiles. You are mathematically guaranteed that:

  • The feature is completely secure against unauthorized access.
  • The feature cannot accidentally drop a database table or call a rogue API.
  • The AI perfectly understood your business logic.

You have successfully shifted your job from typing syntax to architecting flawless systems.