feat: add proactive cron tasks and systemd timers\n\n- 10 proactive tasks: ingest with self-healing & link suggestions, daily summary, health check, archive stale, tag normalizer, predictive links, auto assign review, import context buffer\n- systemd timers for scheduling (02:00/14:00 slots, 30min intervals, weekly)\n- all tasks tested and working\n\nRefs: #1

This commit is contained in:
2026-05-31 13:53:51 +02:00
parent a261f5b9e1
commit 0c72e4d9fa
30 changed files with 1361 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
#!/usr/bin/env python3
"""Create a Second Brain topic for the evaluate_pendings automation."""
import sys
import json
from pathlib import Path
from datetime import datetime, timezone
BRAIN_DIR = Path("/root/.openclaw/workspace/second-brain")
sys.path.insert(0, str(BRAIN_DIR))
from src.store import EngramStore
from src.engram import Engram, Grounding
DB_PATH = BRAIN_DIR / "data" / "brain.sqlite"
store = EngramStore(str(DB_PATH))
content = """# Evaluate Pending Engrams Automation
**Status:** Aktiv
**Eingerichtet:** 2026-05-30 21:00
**Zweck:** Automatische Bewertung unbestätigter Engrams (true/false) nach Heuristik
## Konfiguration
- **Timer:** Systemd-Timer `openclaw-secondbrain-evaluate-pendings.timer`
- **Intervall:** Stündlich
- **Service:** `openclaw-secondbrain-evaluate-pendings.service`
- **Task-Skript:** `/root/.openclaw/workspace/second-brain/cron_tasks/evaluate_all_pendings.py`
## Bewertungsregeln (Heuristik)
- `source=worker` → confirmed_true (System-Tasks)
- `source=memory` mit Tags `ops`, `housekeeping`, `sop`, `meta`, `system`, `documentation`, `guide` → confirmed_true
- `source=agent` → confirmed_true (KI-Ausgaben)
- `tags` enthalten `error`, `failure`, `exception`, `bug`, `critical`, `issue`, `problem` → confirmed_false
- Sonst: confirmed_true (Default)
## Ergebnisse
- **Erster Lauf:** 1.263 pendings sofort bewertet (alle true)
- **Aktuell:** pending = 0 (4.976 total, 4.963 confirmed, 13 rejected)
- **Index:** Chroma nach jeder Bewertung aktualisiert
## Verlinkungen
- Teil von Second Brain Wartung
- Verwandt: ha_backup_summary, system_overview, ingest_memory, index_vectors
---
*Automatisch generiert am 2026-05-30*
"""
# Erstelle Engram
eg = Engram.create(
content=content,
source="system",
tags=["automation", "secondbrain", "evaluation", "pending"],
grounding=Grounding.ASSUMPTION,
)
store.save(eg)
print(f"Engram erstellt: ID={eg.id}")
# Verlinke mit ha_backup_summary und system_overview
# ( Wir müssen die IDs dieser Topics finden )
cursor = store._conn.execute("SELECT id FROM engrams WHERE metadata_json LIKE ?", ('%"tags":%["ha_backup_summary"%',))
row = cursor.fetchone()
if row:
target_id = row[0]
store.link(eg.id, target_id, relation="related", weight=0.8)
print(f"Linked to ha_backup_summary: {target_id[:12]}")
cursor = store._conn.execute("SELECT id FROM engrams WHERE metadata_json LIKE ?", ('%"tags":%["system_overview"%',))
row = cursor.fetchone()
if row:
target_id = row[0]
store.link(eg.id, target_id, relation="related", weight=0.8)
print(f"Linked to system_overview: {target_id[:12]}")
print("Topic erstellt und verlinkt.")