← Battalion|Product Requirements
Docs/Agentic AI Dev Stack & CSS Strategy

Product Requirements Document

Agentic AI Development Stack & CSS Strategy (Battalion Build)

Version: 1.0
Date: 2026-06-24


1. Executive Context & System Overview

Dual Nature of "MX Build"

Architectural precision is required to distinguish between two technically distinct but unified systems in this environment:

SystemDescription
MX Build Vertical SaaSA Dallas-headquartered, AI-powered fintech and field service platform built for construction trades (HVAC, plumbing, roofing, etc.). Automates the full financial lifecycle from estimating to cash collection.
Mendix MxBuild CompilerAn enterprise-grade command-line tool used to generate runtime deployment packages (.mda) or portable archives (.zip) from Mendix application models.

Mission Directive

The core objective is to transition Battalion Build to an open-source, agentic development architecture. This system will automate construction financial workflows, grounded in proven business impact.

Business Justification: Field deployments (e.g., Epic Wood Work) have demonstrated that this architecture can reject over $10,000 in unauthorized or incorrect transactions within a single month, protecting corporate liquidity before funds exit the account.

Target Audience & Operational Environment

DimensionDetail
UsersConstruction trade contractors (W-2 technicians and office managers)
EnvironmentMulti-tenant cloud infrastructure leveraging Mendix low-code and Kubernetes orchestration

2. The Agentic AI Development Stack

Primary Development Agent (Claude Code)

Claude Code is the lead orchestrator for application modeling. It interacts with the model via mxcli to scaffold the environment and perform headless modifications.

Agentic Configuration Files

Architectural compliance requires the following mandatory configuration files:

File / PathPurpose
CLAUDE.md / AGENTS.mdDefine core logic guidelines and MDL syntax patterns
.ai-context/skills/Reusable trade-specific logic

Mandatory Skill Pattern: Agents must utilize the "standard HVAC tax logic" pattern for all mechanical trade financial modules.

The Modeling Language (MDL)

Mendix Definition Language (MDL) serves as the textual interface for Claude Code. This allows the agent to edit visual microflows, pages, and domain models directly as text, bypassing the Studio Pro graphical interface to enable high-velocity iteration.

Operational AI Integration (Gemini)

Gemini powers front-end operational features (e.g., real-time user-facing assistants), keeping operational AI separate from the development-focused modeling handled by Claude Code.


3. Open-Source CI/CD Architecture (GitHub Actions)

Transition Framework

We are migrating from Tekton-based Kubernetes pipelines to a streamlined GitHub Actions architecture to centralize agentic deployment workflows.

Headless Compilation via MxBuild

MxBuild must be executed via command line with the following flags for the GitHub Actions runner:

FlagPurposeConstraint
--target=packageGenerates the standard .mda deployment package
--target=sbomGenerates a CycloneDX Software Bill of MaterialsUse -o flag for output path
--target=portable-app-packageGenerates a portable archive⚠️ The -o output path must include the .zip extension to prevent compilation failures

Environment Virtualization

The CI/CD pipeline utilizes Dev Containers for isolation. Prerequisites:

ComponentRole
Eclipse Temurin JDK 21Primary Java compiler
Node.jsFrontend asset processor
Docker-in-DockerIsolates the AI agent and local compilations from the host

Diagnostic Mapping

The following exit codes are the only valid schemas for the MxBuild compiler. All other codes must be treated as system exceptions.

Exit CodeMeaningGitHub Action State
0SuccessProceed to Deployment
1Validation ErrorsFail — Report Model Inconsistencies
-1ErrorFail — System / Internal Exception

4. CSS and UI Styling Strategy: Mendix Atlas UI

Atlas UI Framework Integration

Agents must interact with the Mendix Atlas UI framework to maintain visual standardization across the Battalion Build ecosystem.

Styling Protocols for AI Agents

RuleRequirement
⛔ Architectural GuardrailDirect manipulation of base Atlas theme files is strictly prohibited
Custom Design PropertiesAll UI modifications must be implemented through custom design properties and layouts to ensure maintainability
Migration AwarenessAgents must proactively monitor for "Theme Styling Inconsistencies." Migration-based failures are typically caused by unsupported design properties (e.g., deprecated spacing) within the Atlas framework

Visual Constraints

Structural integrity of the Layout Grid must be maintained. The sum of individual column weights (WiW_i) within a single row must exactly equal 12:

i=1nWi=12\sum_{i=1}^{n} W_i = 12


5. Construction-Specific Financial Logic & Workflows

Financial Automation Engine

The agent must implement the "Proposal-to-Payment" lifecycle across five phases:

PhaseDescription
EstimateDigital proposals with integrated electronic signatures
Book / DispatchAutomated crew scheduling and mobile technician dispatch
Track / ApproveMilestone tracking and digital field approval capture
Invoice / PayAutomated billing via ACH, check, or virtual card
Spend ControlReal-time expense validation via the MX Build Card

Gross Margin Protected Calculations

AI agents must implement domain model logic to protect Project Gross Margin (MgM_g) using the following formula:

Mg=Rp(Cm+Cl+Cs)RpM_g = \frac{R_p - (C_m + C_l + C_s)}{R_p}

VariableDescription
RpR_pProject Revenue
CmC_mMaterials Cost
ClC_lLabor Cost
CsC_sSubcontractor Expenses

Spend Control Integration

The agent must configure AI-powered transaction classification. Incoming MX Build Card expenses must be matched directly against project cost codes to prevent unauthorized overhead leakage.


6. Technical Guardrails & Performance Optimization

Microflow & Loop Efficiency

Architectural "Don'ts" for agentic logic:

Anti-PatternRequirement
⛔ Commits inside loopsCollect objects in a list and perform a single list commit after the loop
High-volume operationsAgents must run processes in batches of 1,000 items to optimize memory footprint and transactional efficiency

Domain Model Optimization

AreaGuideline
Attribute SelectionPrioritize "Stored" attributes. "Calculated" attributes must be minimized — they execute on every retrieve, creating severe computational overhead
Indexing StrategyMandatory for entities exceeding 10,000 records. Prioritize selective attributes used in XPath search and sort queries (limit 3–5 attributes per index)

7. Implementation Roadmap & Diagnostic Protocols

Scaffolding Phase

Environment initialization begins with mxcli init. This scaffolds the local workspace and populates the .devcontainer and AI context files.

Troubleshooting Environment Obstacles

IssueResolution
OpenSSL 3.0+ ExceptionsSet OPENSSL_ENABLE_SHA1_SIGNATURES=1 if cryptographic exceptions occur due to deprecated SHA-1 signatures in modern Linux distros
Path Syntax Violations (Windows)Ensure consistent backslash styling. The agent must verify that --java-exe-path points to the specific java.exe binary, not the parent directory

Validation Benchmarks

The Best Practice Recommender is the final automated gate. No agent-generated modification shall be merged until it passes a scan for architectural anti-patterns and performance risks.