|
1 | | -# LuArch Agent Guide |
| 1 | +# LuArch -- AI Assistant Guide |
| 2 | + |
| 3 | +This document is the high-level operating guide for AI agents working on the LuArch Blender addon. It exists so agents can contribute safely without guessing project boundaries, release rules, or validation expectations. |
| 4 | + |
| 5 | +For implementation details, inspect the code first. If a future `TDD.md` or equivalent technical design document exists, treat it as the detailed source of truth for module contracts and budgets. |
| 6 | + |
| 7 | +## 0) Project Context |
| 8 | + |
| 9 | +- `luarch` is a Blender 4.5+ addon for procedural low-poly tactical building generation. |
| 10 | +- Generation is preset-driven and seed-backed, so variants must be reproducible. |
| 11 | +- Buildings are meant to be editable in Blender and useful for game-engine workflows. |
| 12 | +- The public repository includes addon source, README media, release packaging, documentation, and GitHub project hygiene files. |
| 13 | + |
| 14 | +## 1) AI Role And Boundaries |
| 15 | + |
| 16 | +Agents may: |
| 17 | + |
| 18 | +- inspect and explain addon code; |
| 19 | +- improve documentation and README media references; |
| 20 | +- implement scoped Python changes; |
| 21 | +- update release packaging; |
| 22 | +- review generated artifacts for leakage, broken links, and installability. |
| 23 | + |
| 24 | +Agents must not: |
| 25 | + |
| 26 | +- turn LuArch into a generic 3D assistant; |
| 27 | +- add telemetry, activation, online checks, or obfuscated payloads; |
| 28 | +- commit local `.blend` files, generated caches, private screenshots, or private project paths; |
| 29 | +- invent release claims that were not verified; |
| 30 | +- change public behavior without updating docs and verification notes. |
| 31 | + |
| 32 | +## 2) Technical Stack |
| 33 | + |
| 34 | +- Language: Python 3.10+ for the Blender addon. |
| 35 | +- Runtime: Blender 4.5+. |
| 36 | +- Primary APIs: Blender data API, `bmesh`, and addon registration APIs. |
| 37 | +- `bpy.ops` should be used only when the data API is not a reasonable fit. |
| 38 | +- Packaging is handled by `scripts/build_release.py`. |
| 39 | + |
| 40 | +## 3) Repository Structure |
| 41 | + |
| 42 | +```text |
| 43 | +luarch/ |
| 44 | + __init__.py addon registration |
| 45 | + properties.py Blender scene/property definitions |
| 46 | + constants.py shared constants and enum values |
| 47 | + presets.py preset loading and randomization data |
| 48 | + metadata.py generated root metadata |
| 49 | + generator/ building generation pipeline |
| 50 | + operators/ Blender operator wrappers |
| 51 | + services/ validation, cleanup, scheduling |
| 52 | + ui/ sidebar panels |
| 53 | +docs/ |
| 54 | + media/ README images and final public media |
| 55 | + quickstart.md user workflow |
| 56 | + export-pipeline.md export notes |
| 57 | + validation.md validation notes |
| 58 | +scripts/ |
| 59 | + build_release.py release zip builder |
| 60 | +``` |
| 61 | + |
| 62 | +## 4) User Workflow |
| 63 | + |
| 64 | +1. Install and enable the addon in Blender. |
| 65 | +2. Select a building preset. |
| 66 | +3. Randomize or configure settings. |
| 67 | +4. Generate a building. |
| 68 | +5. Inspect and tune the result. |
| 69 | +6. Use wall visibility / interior views where available. |
| 70 | +7. Validate the generated building before export. |
| 71 | +8. Build the release zip only after local checks pass. |
| 72 | + |
| 73 | +## 5) Core Principles |
| 74 | + |
| 75 | +**Determinism:** preset + seed behavior must remain reproducible. |
| 76 | + |
| 77 | +**Readable low-poly output:** silhouettes, broad value grouping, and clean geometry matter more than noisy detail. |
| 78 | + |
| 79 | +**Editable authoring:** generated buildings should remain understandable in Blender, not become opaque one-off artifacts. |
| 80 | + |
| 81 | +**Validation as a gate:** validation is not optional decoration. If a change affects generation, export, naming, metadata, or structure, verification must cover it. |
| 82 | + |
| 83 | +**Simple ownership:** prefer small, direct changes over broad abstractions. If code becomes longer and more fragile without a correctness gain, the change is suspect. |
| 84 | + |
| 85 | +## 6) Blender / MCP Discipline |
| 86 | + |
| 87 | +When working through Blender automation or MCP: |
| 88 | + |
| 89 | +1. Inspect scene state before acting. |
| 90 | +2. Inspect object data before modifying generated roots, collections, or meshes. |
| 91 | +3. Never assume current mode, selection, active object, camera, or viewport state. |
| 92 | +4. Apply risky changes in small steps and verify after each meaningful operation. |
| 93 | +5. Capture visual proof after substantial geometry or material changes. |
| 94 | +6. Do not close unrelated Blender windows or touch scenes that are not part of this repository's workflow. |
| 95 | + |
| 96 | +If Blender is unavailable, complete static checks and state clearly that live viewport verification was not run. |
| 97 | + |
| 98 | +## 7) Shared Contracts |
| 99 | + |
| 100 | +Several contracts connect generation, validation, documentation, and release packaging: |
2 | 101 |
|
3 | | -This repository is maintained with AI-assisted development. Agents are expected to work like disciplined engineering collaborators: inspect first, change second, verify before reporting. |
| 102 | +- **Preset payloads:** preset names, defaults, ranges, and seed behavior must stay coherent. |
| 103 | +- **Root metadata:** generated roots should keep enough metadata for inspection and future regeneration workflows. |
| 104 | +- **Object naming:** generated collections and objects need stable, readable names for cleanup, validation, and export. |
| 105 | +- **Wall visibility / interior inspection:** features that hide walls or expose interiors must preserve stair, room, and roof readability. |
| 106 | +- **Release package shape:** release zips must install as a Blender addon without extra wrapper folders or stale names. |
4 | 107 |
|
5 | | -## Project Context |
| 108 | +Do not change one side of a contract without checking the affected modules, README, validation docs, and release script. |
6 | 109 |
|
7 | | -LuArch is a Blender addon for generating procedural low-poly tactical buildings. The repository contains the addon source, documentation, release packaging, and media used by the GitHub README. |
| 110 | +## 8) Source Of Truth |
8 | 111 |
|
9 | | -Primary workflows: |
| 112 | +- Code is the primary source of truth when docs drift. |
| 113 | +- `luarch/presets.py` and related preset data define generation options. |
| 114 | +- `luarch/metadata.py` defines generated-root metadata behavior. |
| 115 | +- `luarch/services/validation.py` defines the validation gate. |
| 116 | +- `README.md` and `docs/` define public-facing claims. |
| 117 | +- `scripts/build_release.py` defines package layout. |
10 | 118 |
|
11 | | -- Generate editable building variants from presets and seeds. |
12 | | -- Keep README media and release artifacts polished for open-source review. |
13 | | -- Maintain deterministic generation, validation, and export behavior. |
| 119 | +If a future `TDD.md` exists, treat it as the single technical design source of truth and update it before broad architectural changes. |
14 | 120 |
|
15 | | -## Agent Roles |
| 121 | +## 9) Agent Orchestration Workflow |
16 | 122 |
|
17 | | -- `explorer`: read-only investigation, file mapping, usage tracing, and evidence gathering. |
18 | | -- `planner`: decision-complete implementation plans for larger changes. |
19 | | -- `fast_coder`: scoped implementation once the plan is clear. |
20 | | -- `critical_judge`: crash, data-loss, packaging, or release-blocking review. |
21 | | -- `debt_judge`: simplification review and overengineering checks. |
22 | | -- `done_judge`: final DoD verification against the original request. |
| 123 | +Use AI agents deliberately: |
23 | 124 |
|
24 | | -Use fan-out only when the work splits cleanly. Keep prompts specific: goal, scope, constraints, output format, relevant file paths, and stop condition. |
| 125 | +- `explorer`: read-only research, call-site mapping, file ownership, evidence collection. |
| 126 | +- `planner`: decision-complete plans for larger or risky changes. |
| 127 | +- `fast_coder`: scoped implementation when the plan is clear. |
| 128 | +- `critical_judge`: crash, data-loss, packaging, and release-blocking review. |
| 129 | +- `debt_judge`: simplification review and overengineering detection. |
| 130 | +- `mental_judge`: scenario-based logic review when runtime behavior is subtle. |
| 131 | +- `done_judge`: final check against the requested outcome. |
25 | 132 |
|
26 | | -## Development Rules |
| 133 | +Fan-out/fan-in rules: |
27 | 134 |
|
28 | | -- Preserve deterministic preset and seed behavior. |
29 | | -- Do not add online checks, telemetry, activation, or generated binary payloads. |
30 | | -- Do not commit temporary Blender caches, local screenshots, or private project files. |
31 | | -- Keep release history clean: one meaningful commit per publication batch. |
32 | | -- Prefer Blender data API and clear Python over broad rewrites. |
33 | | -- Keep public docs understandable to a reviewer who has never seen the project. |
| 135 | +1. Split only independent work into agents. |
| 136 | +2. Give every agent a rich prompt: goal, scope, constraints, exact files, output format, and stop condition. |
| 137 | +3. Keep research read-only unless implementation is explicitly required. |
| 138 | +4. Do not let two agents edit the same file in parallel. |
| 139 | +5. The orchestrator must triage agent results; judge reports are evidence, not automatic commands. |
| 140 | +6. Close the loop with verification before reporting completion. |
34 | 141 |
|
35 | | -## Verification |
| 142 | +Project orchestration rules: |
36 | 143 |
|
37 | | -Run before release changes: |
| 144 | +- No-regression is more important than refactor aesthetics. |
| 145 | +- Prefer the simplest change that fixes the root cause. |
| 146 | +- Do not hide bugs behind fallback geometry, validator bypasses, or extra state layers. |
| 147 | +- If a visual issue survives several attempts, stop guessing and compare the broken path against the nearest working generator path. |
| 148 | +- If upstream planning or core logic is proven green, the next diff must target the real downstream owner shown by evidence. |
| 149 | +- Keep durable plans and review notes useful; remove stale temporary notes after the initiative is complete. |
| 150 | + |
| 151 | +## 10) Planning Artifact Rules |
| 152 | + |
| 153 | +- Keep durable plans and review notes under `docs/` only when they are useful to future maintainers. |
| 154 | +- Do not commit private orchestration transcripts, throwaway scratch files, or internal review drafts. |
| 155 | +- If user decisions affect implementation, preserve them as explicit source-of-truth notes in the relevant plan or report. |
| 156 | + |
| 157 | +## 11) Verification Doctrine |
| 158 | + |
| 159 | +Before release-facing changes: |
38 | 160 |
|
39 | 161 | ```bash |
40 | 162 | python3 -m compileall luarch scripts |
41 | 163 | python3 scripts/build_release.py |
| 164 | +unzip -l dist/luarch-v0.2.0.zip |
42 | 165 | ``` |
43 | 166 |
|
44 | | -For visual/media changes, inspect README rendering locally or on GitHub after push. |
| 167 | +For README/media changes: |
| 168 | + |
| 169 | +- verify every referenced image exists; |
| 170 | +- inspect the rendered README on GitHub after push; |
| 171 | +- keep only final approved PNG/JPG media; |
| 172 | +- do not commit temporary renders. |
| 173 | + |
| 174 | +For generation changes: |
| 175 | + |
| 176 | +- run compile checks; |
| 177 | +- run addon-level smoke checks when Blender is available; |
| 178 | +- visually inspect representative generated buildings; |
| 179 | +- do not claim live visual verification if only static checks ran. |
| 180 | + |
| 181 | +For high-risk generation changes, use an observe -> change -> verify loop: |
| 182 | + |
| 183 | +1. Capture the current failing or target case. |
| 184 | +2. Make the smallest owner-focused change. |
| 185 | +3. Run static checks. |
| 186 | +4. Validate in Blender when possible. |
| 187 | +5. Capture visual proof. |
| 188 | +6. Record remaining issues before starting the next change. |
| 189 | + |
| 190 | +Headless checks do not replace visual proof when the task is about form, lighting, readability, interiors, wall visibility, openings, stairs, or roof access. |
| 191 | + |
| 192 | +## 12) Release Rules |
| 193 | + |
| 194 | +- Repository history should stay clean and understandable. |
| 195 | +- Release zips should contain installable addon files only. |
| 196 | +- Do not leave old release zips, caches, or local scratch files in the repository unless intentionally tracked. |
| 197 | +- Keep repository private until final visual review is complete. |
| 198 | +- Before making public, run a leakage audit for private paths, internal planning text, and stale repository names. |
| 199 | + |
| 200 | +## 13) Development Principles |
| 201 | + |
| 202 | +- Keep solutions simple. |
| 203 | +- Reuse existing generator structure before adding new abstractions. |
| 204 | +- Prefer explicit data flow over implicit global state. |
| 205 | +- Keep module boundaries clear: operators and UI are thin wrappers; generator and services own domain behavior. |
| 206 | +- Preserve deterministic preset + seed behavior. |
| 207 | +- Keep geometry budget and object count reasonable for game-engine use. |
| 208 | +- Use Blender data API and `bmesh` over careless `bpy.ops`. |
| 209 | +- Treat facts, code, and visual proof as stronger than guesses. |
45 | 210 |
|
46 | | -## Release Checklist |
| 211 | +## 14) Assistant Behavior |
47 | 212 |
|
48 | | -- README images load. |
49 | | -- Release zip contains only final addon files. |
50 | | -- `rg` audit is clean for private paths and internal review notes. |
51 | | -- Repository remains private until visual review is complete. |
| 213 | +- Inspect before changing. |
| 214 | +- Prefer root-cause fixes over fallback patches. |
| 215 | +- Avoid speculative rewrites. |
| 216 | +- Keep communication concise and factual. |
| 217 | +- If the user writes in Russian, answer in Russian. |
| 218 | +- If a task depends on missing product intent, ask; if it depends on repository facts, inspect first. |
0 commit comments