--- description: Intelligent Context and Directives for AI Agents modifying the Forms System --- # Forms System - AI Agent Context ## Intended Architecture Overview This application serves as a strictly localized web form engine. Its primary constraint is **No Database**. All states, identities, responses, and settings must be mapped dynamically to JSON files. ## Language Requirement Contract The target group operates in German context. **All front-end user interfaces, prompts, notifications, and labels must be written in informal German (Du).** ## Data Interface Contract All data payloads process through `/data`. Any newly introduced state requires modifying this abstraction carefully without abandoning `.htaccess` safeguards. ### Form Definitions Path Map: `/data/forms/{form_id}.json` Structure Schema: ```json { "id": "form_{uniqid}", "title": "String", "description": "String", "admin_email": "String", "admin_token": "String", "created_at": "ISO-8601", "questions": [ { "id": "q_{timestamp}_{index}", "type": "text | textarea | single_choice | multiple_choice | dropdown", "label": "String", "options": ["Array of Strings if applicable"], "allow_free_text": "Boolean (true/false) - for choice configurations" } ] } ``` ### Response Answers Path Map: `/data/answers/{form_id}_{answer_id}.json` Structure Schema: ```json { "answer_id": "ans_{uniqid}", "form_id": "form_{uniqid}", "respondent_name": "String", "respondent_email": "String", "submitted_at": "ISO-8601", "answers": { "q_{timestamp}_{index}": "String or Array of Strings" } } ``` ## Styling Heuristics You must refer and conform locally to `docs/style_system.md` for any interface additions. - Do not drop in Tailwind or external CSS. - New DOM elements must invoke predefined token components, primarily using the `panel`, `btn`, `alert`, and strictly adopting the internal responsive breakpoint mechanisms. ## Modification Rules 1. **Double Submission:** Allowed intentionally. The local application cache mitigates keystrokes for repeated `respondent_name` entries but does not gatekeep. Modifying `assets/js/answer.js` requires respecting this state requirement. 2. **SortableJS:** Included to fulfill the complex choice mechanisms inside the form builder. Maintain the `Sortable.js` DOM synchronization inside `assets/js/create.js`. 3. **No Dynamic Classes:** The web hosting rules dictate straightforward legacy rendering support via raw HTML endpoints (`php`). No templating engines (Blade/Twig) are attached.