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:
40
cron_tasks/confirm_context_buffer_topics.py
Normal file
40
cron_tasks/confirm_context_buffer_topics.py
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Confirm all Engrams that originated from context-buffer topic-*.md files."""
|
||||
|
||||
import sys
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
BRAIN_DIR = Path("/root/.openclaw/workspace/second-brain")
|
||||
sys.path.insert(0, str(BRAIN_DIR))
|
||||
from src.store import EngramStore
|
||||
|
||||
DB_PATH = BRAIN_DIR / "data" / "brain.sqlite"
|
||||
store = EngramStore(str(DB_PATH))
|
||||
|
||||
# Finde alle Engrams, deren filepath "topic-" enthält
|
||||
cursor = store._conn.execute(
|
||||
"SELECT id, metadata_json FROM engrams WHERE metadata_json LIKE ?",
|
||||
('%"filepath": "%topic-%',)
|
||||
)
|
||||
rows = cursor.fetchall()
|
||||
print(f"Gefundene Context-Buffer Topics: {len(rows)}")
|
||||
|
||||
confirmed = 0
|
||||
for eid, meta_json in rows:
|
||||
try:
|
||||
meta = json.loads(meta_json)
|
||||
filepath = meta.get("filepath", "")
|
||||
if "topic-" not in filepath:
|
||||
continue
|
||||
eg = store.get(eid)
|
||||
if eg is None:
|
||||
continue
|
||||
eg.correctness.confirmed = True
|
||||
eg.correctness.verdict = "confirmed_true"
|
||||
store.save(eg)
|
||||
confirmed += 1
|
||||
except Exception as e:
|
||||
print(f"Fehler bei {eid}: {e}")
|
||||
|
||||
print(f"Bestätigte Topics: {confirmed}")
|
||||
Reference in New Issue
Block a user