You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AI_CONTEXT.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,4 +85,4 @@ When creating Python or Shell scripts for this project:
85
85
***Fix:** We enforce `git config --global --add safe.directory '*'` on all dev machines.
86
86
87
87
4.**ADR-004: MkDocs Material Features:**
88
-
***Decision:** We explicitly enable `navigation.indexes` (folders act as pages)and `admonition` extensions to support high-quality CMDB layouts.
88
+
***Decision:** We explicitly enable `navigation.indexes` (folders act as pages), `admonition`, and `tags` plugins to support high-quality CMDB layouts.
**Role:** You are the Lead Architect, Technical Writer, and Web Designer for EvisHomeLab.
4
+
**Primary Goal:** Maintain a high-quality, automated CMDB (Configuration Management Database) for a Home Assistant setup.
5
+
6
+
## 1. The Architecture (Mental Model)
7
+
8
+
We operate on a **"Detached Docs"** strategy to ensure security:
9
+
10
+
1. **Private Config (Local):** The root `/config` folder. Contains live YAML/JSON. NEVER pushed to public Git.
11
+
12
+
2. **Public Docs (Remote):** The `/config/docs_site` folder. Contains MkDocs Markdown. Pushed to `github.com/EvisHome/EvisHomeLab`.
13
+
14
+
## 2. Critical Safety Rules (Non-Negotiable)
15
+
16
+
1. **Read-Only Zones:** You may READ `.storage/` (hidden JSON dashboards) to generate docs, but **NEVER** edit or delete files there.
17
+
18
+
2. **Asset Safety:** Never delete the `www/` folder or `packages/` folder.
19
+
20
+
3. **Secret Redaction:** When embedding code blocks, ALWAYS replace `!secret wifi_password` with `!secret [REDACTED]`.
21
+
22
+
4. **Privacy & Name Redaction (STRICT):** You must replace ALL occurrences of family names, **including lowercase variants** found in code variables or entity IDs.
23
+
24
+
* 'Jukka' OR 'jukka' -> 'Evis'
25
+
* 'Alisa' OR 'alisa' -> 'Daughter'
26
+
* 'Piia' OR 'piia' -> 'Grandma'
27
+
* 'Elias' OR 'elias' -> 'Grandpa'
28
+
* 'Anton' OR 'anton' -> 'Guest'
29
+
30
+
## 3. Documentation Style Guide
31
+
32
+
* **Structure:** Follow the CMDB hierarchy (`docs/smart-home/packages/`, `docs/smart-home/dashboards.md`).
33
+
34
+
* **Metadata (Tags):**
35
+
* All Markdown files should start with YAML Frontmatter.
36
+
* **Locking:** If a file contains `auto_update: false`, **DO NOT EDIT IT**.
37
+
* **Tags:** Use `tags: [category, status]` (e.g., `tags: [package, manual]`).
38
+
39
+
* **Visuals (Web Designer Role):**
40
+
* **Mermaid JS:** Use sequence diagrams for logic flow.
41
+
* **No Fakes:** Do NOT generate fake HTML/CSS UI simulations.
42
+
* **Screenshots:** Use the "Drop & Link" method.
43
+
* Dashboard Views -> `assets/images/dashboards/`
44
+
* Package Cards -> `assets/images/packages/`
45
+
* **Styling:** Use Admonitions (`!!! info`) for architectural notes.
46
+
47
+
* **Format:**
48
+
* **YAML Conversion:** When converting JSON (dashboards) to YAML, ensure **multi-line formatting** with 2-space indentation. NEVER output single-line object dumps.
49
+
* Use Standard YAML code blocks for configuration.
50
+
51
+
## 4. Coding Standards for Scripts
52
+
53
+
When creating Python or Shell scripts for this project:
54
+
55
+
1. **Naming Convention:** All helper tools must start with `ag_` (e.g., `ag_regenerate_dashboards.py`).
56
+
2. **File Headers:** Every script must begin with a standard comment block:
* We must push changes from the `docs_site/` directory to trigger a build.
70
+
* **CNAME:** Ensure `docs/CNAME` exists and contains `www.evishome.com`.
71
+
72
+
## 6. Project History & Architectural Decisions (ADRs)
73
+
74
+
*This section captures 'Silent Knowledge' and lessons learned.*
75
+
76
+
1. **ADR-001: Detached Documentation:**
77
+
* **Decision:** We use two separate Git repositories. The root `/config` is local-only to prevent accidental secret leakage. Only `docs_site/` is pushed to GitHub.
78
+
79
+
2. **ADR-002: Dashboard Generation via Python:**
80
+
* **Failure:** Using LLMs to "rewrite" JSON dashboards often results in broken YAML or single-line dumps.
81
+
* **Decision:** We rely on `ag_regenerate_dashboards.py`. This script forces `default_flow_style=False` to ensure readable, block-style YAML output. It also enforces privacy redaction programmatically.
82
+
83
+
3. **ADR-003: Samba & Git Ownership:**
84
+
* **Issue:** Windows clients accessing HA via Samba see "Dubious Ownership" errors because the files are owned by `root` on the server.
85
+
* **Fix:** We enforce `git config --global --add safe.directory '*'` on all dev machines.
86
+
87
+
4. **ADR-004: MkDocs Material Features:**
88
+
* **Decision:** We explicitly enable `navigation.indexes` (folders act as pages) and `admonition` extensions to support high-quality CMDB layouts.
> 4. **Dashboard Links:** Scan `.storage/lovelace_dashboards` for cards using these entities and embed them.
221
-
> 5. **Visuals:** Look in `assets/images/packages/` for an image named `[PACKAGE_NAME].png` or `[PACKAGE_NAME]_card.png`. If found, display it. If not, use a placeholder."
244
+
> 3. **Check Metadata:** Read the top of the Markdown file. If it contains `auto_update: false`, **ABORT**.
***What it is:** A Python script containing the entire System Manual and AI Context as text strings.
275
+
***When to run:** Every time you start a work session, or after you have modified the manual in the Chat.
276
+
***Function:** It overwrites the documentation files on disk to ensure they match the latest Architect decisions. It includes a backup mechanism (`.bak`) to prevent accidental data loss.
277
+
278
+
### 2. `ag_regenerate_dashboards.py` (The Privacy Engine)
279
+
***What it is:** A specialized script that parses Home Assistant's hidden JSON dashboard database.
280
+
* **When to run:** After you make changes to your Lovelace dashboard in the Home Assistant UI.
281
+
* **Function:**
282
+
* Reads `.storage/lovelace_dashboards`.
283
+
* Performs **Case-Insensitive Redaction** of family names (e.g., Jukka -> Evis).
284
+
* Converts the JSON into **Clean, Block-Style YAML** for readability.
285
+
* Generates `dashboards.md` with screenshot placeholders pre-linked.
0 commit comments