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:
| System | Description |
|---|---|
| MX Build Vertical SaaS | A 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 Compiler | An 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
| Dimension | Detail |
|---|---|
| Users | Construction trade contractors (W-2 technicians and office managers) |
| Environment | Multi-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 / Path | Purpose |
|---|---|
CLAUDE.md / AGENTS.md | Define 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:
| Flag | Purpose | Constraint |
|---|---|---|
--target=package | Generates the standard .mda deployment package | — |
--target=sbom | Generates a CycloneDX Software Bill of Materials | Use -o flag for output path |
--target=portable-app-package | Generates 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:
| Component | Role |
|---|---|
| Eclipse Temurin JDK 21 | Primary Java compiler |
| Node.js | Frontend asset processor |
| Docker-in-Docker | Isolates 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 Code | Meaning | GitHub Action State |
|---|---|---|
0 | Success | Proceed to Deployment |
1 | Validation Errors | Fail — Report Model Inconsistencies |
-1 | Error | Fail — 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
| Rule | Requirement |
|---|---|
| ⛔ Architectural Guardrail | Direct manipulation of base Atlas theme files is strictly prohibited |
| Custom Design Properties | All UI modifications must be implemented through custom design properties and layouts to ensure maintainability |
| Migration Awareness | Agents 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 () within a single row must exactly equal 12:
5. Construction-Specific Financial Logic & Workflows
Financial Automation Engine
The agent must implement the "Proposal-to-Payment" lifecycle across five phases:
| Phase | Description |
|---|---|
| Estimate | Digital proposals with integrated electronic signatures |
| Book / Dispatch | Automated crew scheduling and mobile technician dispatch |
| Track / Approve | Milestone tracking and digital field approval capture |
| Invoice / Pay | Automated billing via ACH, check, or virtual card |
| Spend Control | Real-time expense validation via the MX Build Card |
Gross Margin Protected Calculations
AI agents must implement domain model logic to protect Project Gross Margin () using the following formula:
| Variable | Description |
|---|---|
| Project Revenue | |
| Materials Cost | |
| Labor Cost | |
| Subcontractor 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-Pattern | Requirement |
|---|---|
| ⛔ Commits inside loops | Collect objects in a list and perform a single list commit after the loop |
| High-volume operations | Agents must run processes in batches of 1,000 items to optimize memory footprint and transactional efficiency |
Domain Model Optimization
| Area | Guideline |
|---|---|
| Attribute Selection | Prioritize "Stored" attributes. "Calculated" attributes must be minimized — they execute on every retrieve, creating severe computational overhead |
| Indexing Strategy | Mandatory 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
| Issue | Resolution |
|---|---|
| OpenSSL 3.0+ Exceptions | Set 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.