Skip to content

Commit 66eb76e

Browse files
committed
Apply strict privacy redaction to dashboards
1 parent 96d6a4a commit 66eb76e

2 files changed

Lines changed: 81 additions & 51 deletions

File tree

AI_CONTEXT.md

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,13 @@ We operate on a **"Detached Docs"** strategy to ensure security:
1919

2020
3. **Secret Redaction:** When embedding code blocks, ALWAYS replace `!secret wifi_password` with `!secret [REDACTED]`.
2121

22-
4. Person names reduction: When you find names from anywhere replace them as follows:
23-
24-
* 'Jukka' -> 'Evis'
25-
26-
* 'Alisa' -> 'Daughter'
27-
28-
* 'Piia' -> 'Grandma'
29-
30-
* 'Elias' -> 'Grandpa'
31-
32-
* 'Anton' -> 'Guest'
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'
3329

3430
## 3. Documentation Style Guide
3531

@@ -45,21 +41,26 @@ We operate on a **"Detached Docs"** strategy to ensure security:
4541

4642
* **Format:**
4743

48-
* **YAML Conversion:** When converting JSON (dashboards) to YAML, ensure **multi-line formatting** with 2-space indentation. NEVER output single-line object dumps or PowerShell artifacts (e.g. `@{...}`).
44+
* **YAML Conversion:** When converting JSON (dashboards) to YAML, ensure **multi-line formatting** with 2-space indentation. NEVER output single-line object dumps.
4945

5046
* Use Standard YAML code blocks for configuration.
5147

5248
* Use Admonitions (`!!! info`) for architectural notes.
5349

54-
## 4. Standard Operating Procedures (SOPs)
55-
56-
Refer to **`docs/system_manual/setup_guide.md`** for the specific prompts to run for:
57-
58-
* Generating Package Documentation.
50+
## 4. Coding Standards for Scripts
5951

60-
* Converting Dashboards to YAML.
52+
When creating Python or Shell scripts for this project:
6153

62-
* Updating the System Structure.
54+
1. **Naming Convention:** All helper tools must start with `ag_` (e.g., `ag_regenerate_dashboards.py`).
55+
2. **File Headers:** Every script must begin with a standard comment block:
56+
```python
57+
# -----------------------------------------------------------------------------
58+
# File: [filename]
59+
# Version: [version]
60+
# Description: [short summary]
61+
# Usage: [command to run]
62+
# -----------------------------------------------------------------------------
63+
```
6364

6465
## 5. Deployment Logic
6566

@@ -68,3 +69,22 @@ Refer to **`docs/system_manual/setup_guide.md`** for the specific prompts to run
6869
* We must push changes from the `docs_site/` directory to trigger a build.
6970

7071
* **CNAME:** Ensure `docs/CNAME` exists and contains `www.evishome.com`.
72+
73+
## 6. Project History & Architectural Decisions (ADRs)
74+
75+
*This section captures 'Silent Knowledge' and lessons learned.*
76+
77+
1. **ADR-001: Detached Documentation:**
78+
* **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.
79+
* **Why:** Home Assistant config contains too many sensitive files (secrets, logs, backups) to safely manage in a public repo without complex git-crypt setups.
80+
81+
2. **ADR-002: Dashboard Generation via Python:**
82+
* **Failure:** Using LLMs to "rewrite" JSON dashboards often results in broken YAML or single-line dumps.
83+
* **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.
84+
85+
3. **ADR-003: Samba & Git Ownership:**
86+
* **Issue:** Windows clients accessing HA via Samba see "Dubious Ownership" errors because the files are owned by `root` on the server.
87+
* **Fix:** We enforce `git config --global --add safe.directory '*'` on all dev machines.
88+
89+
4. **ADR-004: MkDocs Material Features:**
90+
* **Decision:** We explicitly enable `navigation.indexes` (folders act as pages) and `admonition` extensions to support high-quality CMDB layouts.

docs/system_manual/setup_guide.md

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# EvisHomeLab: Documentation System Manual
22

3-
**Version:** 1.7
3+
**Version:** 1.9
44
**Philosophy:** Agentic CMDB (Configuration Management Database)
55
**Strategy:** "Detached Docs" (Private Config -> Public Documentation)
66

@@ -70,7 +70,7 @@ Open Antigravity connected to `/config` and run this prompt in the Agent:
7070
>
7171
> 3. Commit the current state with the message 'Initial Home Assistant Backup'."
7272
73-
### 2. Establish Agent Rules (The Hard Constraints)
73+
### 2. Establish Agent Rules
7474
7575
Create a file at `.antigravity/rules.md` in the root:
7676
@@ -82,7 +82,19 @@ CRITICAL RULES:
8282
4. **Context & Persona:** Always consult `docs_site/AI_CONTEXT.md` for documentation standards, visual styles, and privacy rules before writing documentation.
8383
```
8484
85-
### 3. Scaffold Documentation Site
85+
### 3. Bootstrap Helper Tools
86+
87+
We rely on Python scripts to manage complex tasks. Create these files in your root folder:
88+
89+
**A. Create `ag_update_docs.py`**
90+
* **Purpose:** Updates this manual and the AI Context.
91+
* **How:** Ask the Agent: "Create `ag_update_docs.py` with the content provided in the System Manual Part A." (See repository history for source).
92+
93+
**B. Create `ag_regenerate_dashboards.py`**
94+
* **Purpose:** Converts JSON dashboards to YAML documentation.
95+
* **How:** Ask the Agent: "Create `ag_regenerate_dashboards.py` that reads `.storage/lovelace_dashboards`, redacts names, and outputs clean YAML blocks."
96+
97+
### 4. Scaffold Documentation Site
8698

8799
Paste this prompt into the Agent:
88100

@@ -100,15 +112,11 @@ Paste this prompt into the Agent:
100112
>
101113
> 3. Create a file `docs_site/docs/CNAME` containing: `www.evishome.com`"
102114
103-
### 4. Initialize AI Context (The Brain)
104-
105-
Paste this prompt to create the "Memory" file for the Agent:
115+
### 5. Initialize AI Context
106116

107-
> "Create a file `docs_site/AI_CONTEXT.md`.
108-
> Populate it with the Project Persona, Privacy Rules (Jukka->Evis), and Documentation Style Guide (Mermaid diagrams, YAML blocks).
109-
> This file will serve as the source of truth for all future Agent sessions."
117+
Run `python ag_update_docs.py` to generate the `AI_CONTEXT.md` file.
110118

111-
### 5. Link Docs to GitHub
119+
### 6. Link Docs to GitHub
112120

113121
Run these commands in the terminal:
114122

@@ -168,10 +176,26 @@ These settings are stored on your laptop, not the server, so you must set them a
168176

169177
# PART C: Daily Operations (The Workflow)
170178

171-
### Task: Generate Package Documentation
179+
### 1. The AI Architect Workflow (Start Here)
180+
This system relies on a two-tier workflow: **Architect (Chat)** vs **Builder (Agent)**.
181+
182+
**When starting a new Chat Session with an AI Model (like Gemini):**
183+
You must "hydrate" the AI with the project context so it can act as the Architect. Paste this prompt:
184+
185+
> "I am resuming work on the **EvisHomeLab** project.
186+
>
187+
> **Task:**
188+
> 1. Read the attached **`docs_site/AI_CONTEXT.md`** to load your Persona, Architecture constraints, and Safety Rules.
189+
> 2. Read the attached **`docs_site/docs/system_manual/setup_guide.md`** to understand the operational workflows.
190+
>
191+
> **Action:** Confirm you have loaded the context and are ready to assist with maintaining the CMDB."
192+
193+
*(Then upload/paste the content of those two files).*
172194

173-
**Use when:** You have added a new package (e.g., `solar.yaml`) and want to document it.
195+
### 2. The Agent Workflow (Execution)
196+
Once the Architect (Chat) designs a prompt, paste it into the Antigravity Agent Panel to execute it.
174197

198+
**Task: Generate Package Documentation**
175199
> "Perform a deep architectural scan of my `packages/` directory.
176200
> **For EVERY YAML file found, create a corresponding Markdown file in `docs_site/docs/smart-home/packages/` containing:**
177201
> 1. **Executive Summary:** What does this package do?
@@ -181,35 +205,21 @@ These settings are stored on your laptop, not the server, so you must set them a
181205
> 5. **Visuals:** Insert a placeholder link for a screenshot (e.g., `![View](assets/images/heating.png)`).
182206
> Finally, update `mkdocs.yml` navigation."
183207
184-
### Task: Convert Dashboard to YAML (Python Method)
185-
186-
**Use when:** You have edited the Dashboard in the UI and want to update the docs. **Requires Python on your PC.**
187-
188-
> "Write and execute a Python script to regenerate `docs_site/docs/smart-home/dashboards.md`.
189-
> 1. **Read Source:** Load `.storage/lovelace_dashboards`.
190-
> 2. **Parse & Convert:** Convert JSON to **Block-Style YAML** (`default_flow_style=False`).
191-
> 3. **Redact:** Apply name redaction rules (e.g., Jukka -> Evis) as per `AI_CONTEXT.md`.
192-
> 4. **Write Output:** Create headers for each view and embed the clean YAML code blocks."
193-
194-
### Task: Update Structure Documentation
195-
196-
**Use when:** You have added new top-level folders or changed `configuration.yaml`.
208+
**Task: Convert Dashboard to YAML (Python Method)**
209+
> "Run `python ag_regenerate_dashboards.py` in the terminal.
210+
> This script will read the raw JSON dashboards, apply strict privacy redaction (Jukka->Evis, etc.), convert everything to clean YAML, and update `dashboards.md`."
197211
212+
**Task: Update Structure Documentation**
198213
> "Update `docs_site/docs/smart-home/structure.md`.
199214
> 1. Re-scan the root directory and update the file tree structure description (Folders first, then files).
200215
> 2. Read `configuration.yaml` and update the commented code block explanation."
201216
202-
### Task: Publish This System Manual
203-
204-
**Use when:** You want to update this Setup Guide on the public website.
205-
217+
**Task: Publish This System Manual**
206218
> "Copy `EvisHomeLab_Setup_Guide.md` (from Root) to `docs_site/docs/system_manual/setup_guide.md`.
207219
> Ensure `docs_site/mkdocs.yml` has a navigation entry called **'System Manual'** pointing to `system_manual/setup_guide.md`."
208220
209-
### Publishing to the Web
210-
221+
### 3. Publishing to the Web
211222
When documentation updates are complete:
212-
213223
```bash
214224
cd docs_site
215225
git add .

0 commit comments

Comments
 (0)