Code Quality & Rules
Relevant source files
The following files were used as context for generating this wiki page:
Code quality in the LV.AI project is governed by strict compliance with construction industry standards (GAEB, VOB, ÖNORM, SIA), technical linting and testing requirements, and specific AI interaction protocols. These rules ensure that the autonomous AVA-Copilot generates legally sound and technically accurate construction documents for the D/A/CH region.
Project Core Rules
The LV.AI project operates under five primary mandates that dictate architectural and functional requirements.
- GAEB-Konformität: All Bill of Quantities (LV) data must follow the GAEB DA XML structure (X81–X86).
- D/A/CH-Compliance: The system performs automatic adjustments based on the target country's legal framework (VOB for Germany, ÖNORM for Austria, SIA for Switzerland).
- Projekt = Chat: Every chat session represents a specific construction project containing associated metadata.
- Dual Memory: Persistence is managed through a combination of project-scope and global-scope memory via
mem0. - Deutsche Fachsprache: All user interface elements and AI responses utilize professional German construction terminology.
Sources: CLAUDE.md:29-34, README.md:14-22
Verification Procedures (LV.AI-Prüfverfahren)
Before completing any task or code change, developers must follow a mandatory 19-point verification process. The last five points are specific to the LV.AI domain:
| Step | Rule | Target Component |
|---|---|---|
| 15 | GAEB-Konformität | lib/gaeb/, preisspiegel-actions, bieter-actions |
| 16 | mem0-Scope Integrity | Memory layer, mem0-mcp |
| 17 | Legal Correctness | lv-queries, preisspiegel-actions, bieter-client |
| 18 | Data Integrity | lv-queries-offers |
| 19 | Infrastructure | Hostinger connectors, DNS, VPS |
Sources: CLAUDE.md:68-75
AI Interaction & Prompt Rules
The system utilizes modularized prompts to maintain consistency and optimize token usage. Prompts are split into stable parts (roles, trades, language) and dynamic parts (request hints, project context).
Prompt Constraints
The AI system follows strict operational rules when interacting with artifacts and documents:
- Single Tool Execution: The AI must call only one tool per response and stop immediately after.
- No Content Duplication: After creating or editing an artifact, the AI does not output the content in the chat.
- German Language: Titles must be 2-5 German words without prefixes or formatting.
Sources: lib/ai/prompts.ts:34-43, lib/ai/prompts.ts:168-181
AI Architecture Flow
This diagram illustrates how request hints and project context are integrated into the system prompt generation.
Sources: lib/ai/prompts.ts:77-100
Technical Standards & Testing
The project employs a modern tech stack with specific tools for linting, fixing, and testing to maintain code health.
Development Scripts
Key scripts defined in package.json enforce code quality:
pnpm check: Runsultracite checkfor linting.pnpm fix: Runsultracite fixfor automatic formatting.pnpm test: Executes unit tests viavitest.pnpm test:e2e: Executes end-to-end tests viaplaywright.
Sources: package.json:8-23
Testing Coverage
The testing suite is divided into unit/integration tests and E2E tests to verify API behavior and UI state.
Sources: tests/e2e/api.test.ts:6-40
Database Schema Constraints
Data integrity is maintained through specific Enums and table structures that reflect construction industry requirements.
Legal & Format Enums
The database schema enforces valid data entry for regional compliance and file formats:
- landEnum: Restricted to
['DE', 'AT', 'CH']. - gaebFormatEnum: Supports formats
X81throughX89. - projektStatusEnum: Covers phases
entwurf,ausschreibung,vergabe,ausfuehrung,abrechnung, andabgeschlossen.
Sources: lib/db/schema.test.ts:37-65
Core Data Models
| Table | Description | Key Fields |
|---|---|---|
Project | Root entity for construction projects | id, land, status |
LvDocument | Represents a GAEB document | id, projectId, gaebFormat |
LvPosition | Individual line items in an LV | oz, menge, einheit, kurztext |
Offer | Bidder submissions | id, bieterStatus |
Sources: lib/db/schema.test.ts:98-119
Conclusion
Code quality in LV.AI is a synthesis of technical linting and deep domain-specific compliance. By enforcing GAEB standards and regional legal frameworks through both the database schema and the AI prompting logic, the system ensures that autonomous operations remain within the boundaries of construction industry regulations. Accuracy is further verified by a mandatory 19-point check before any deployment.