diff --git a/services/ai_surface_html_readback_service.py b/services/ai_surface_html_readback_service.py
index d06389c..e8fbb6f 100644
--- a/services/ai_surface_html_readback_service.py
+++ b/services/ai_surface_html_readback_service.py
@@ -368,6 +368,7 @@ def _iter_site_templates(root: Path) -> list[Path]:
for path in template_root.rglob("*")
if path.suffix in {".html", ".j2"}
and path.is_file()
+ and not path.name.startswith(".")
and not path.name.startswith("_")
and "components" not in path.relative_to(template_root).parts
and path.name not in {"base.html", "ewoooc_base.html", "test_base.html"}
diff --git a/tests/test_ai_automation_smoke_service.py b/tests/test_ai_automation_smoke_service.py
index d410181..1113564 100644
--- a/tests/test_ai_automation_smoke_service.py
+++ b/tests/test_ai_automation_smoke_service.py
@@ -369,6 +369,7 @@ def test_sitewide_ui_ux_agent_inventory_scans_real_pages():
issue_templates = {item["template"] for item in inventory["issue_surfaces"]}
assert "templates/base.html" not in templates
assert not any("/components/" in item for item in templates)
+ assert not any("/." in item or item.startswith("templates/.") for item in templates)
assert "templates/ai_history.html" not in issue_templates
assert "templates/ai_recommend.html" not in issue_templates
@@ -405,6 +406,7 @@ def test_sitewide_ui_ux_agent_reports_non_utf8_templates(tmp_path):
routes_dir = tmp_path / "routes"
routes_dir.mkdir()
(template_dir / "legacy_dashboard.html").write_bytes(b"\xa3 legacy dashboard")
+ (template_dir / "._legacy_dashboard.html").write_bytes(b"\xa3 apple metadata")
(routes_dir / "legacy_routes.py").write_bytes(b"\xa3 legacy route source")
inventory = build_sitewide_ui_ux_agent_inventory(root=tmp_path)
@@ -412,6 +414,7 @@ def test_sitewide_ui_ux_agent_reports_non_utf8_templates(tmp_path):
package = build_sitewide_ui_ux_repair_package(source_inventory=inventory)
assert inventory["status"] == "warning"
+ assert inventory["summary"]["template_count"] == 1
assert issue["status"] == "critical"
assert issue["findings"][0]["type"] == "template_encoding_error"
assert package["repair_items"][0]["controlled_actions"][0]["action"] == (