# Second-Brain 2.0 (Grundversion) — Runbook This is the operational quick-reference for the shipped systemd timers/services and the optional FastAPI dashboard backend. Repository root (on host): `/root/.openclaw/workspace/second-brain` ## Systemd units (cron jobs) Unit files are shipped in `systemd/` (this repo). Install them into `/etc/systemd/system/` (symlink or copy), then reload: ```bash sudo ln -sf /root/.openclaw/workspace/second-brain/systemd/openclaw-secondbrain-*.service /etc/systemd/system/ sudo ln -sf /root/.openclaw/workspace/second-brain/systemd/openclaw-secondbrain-*.timer /etc/systemd/system/ sudo ln -sf /root/.openclaw/workspace/second-brain/systemd/openclaw-memory-archive.* /etc/systemd/system/ sudo systemctl daemon-reload ``` Enable timers: ```bash sudo systemctl enable --now openclaw-secondbrain-ingest-memory.timer sudo systemctl enable --now openclaw-secondbrain-index-vectors.timer sudo systemctl enable --now openclaw-secondbrain-review.timer sudo systemctl enable --now openclaw-secondbrain-backup.timer sudo systemctl enable --now openclaw-secondbrain-heartbeat.timer sudo systemctl enable --now openclaw-secondbrain-proactive-search.timer sudo systemctl enable --now openclaw-memory-archive.timer # Optional (Obsidian coupling) sudo systemctl enable --now openclaw-secondbrain-ingest-obsidian.timer sudo systemctl enable --now openclaw-secondbrain-export-obsidian.timer ``` Verify scheduling: ```bash sudo systemctl list-timers --all | grep -E 'openclaw-(secondbrain|memory-archive)' || true ``` Run a job once: ```bash sudo systemctl start openclaw-secondbrain-ingest-memory.service sudo systemctl status openclaw-secondbrain-ingest-memory.service --no-pager sudo journalctl -u openclaw-secondbrain-ingest-memory.service -n 200 --no-pager ``` Wrapper logs: ```bash tail -n 200 /root/.openclaw/workspace/cron_wrapper.log ``` ## FastAPI dashboard (manual start) FastAPI entrypoint: ```bash cd /root/.openclaw/workspace python3 -m pip install -r second-brain/requirements-dashboard.txt SECOND_BRAIN_WORKSPACE="/root/.openclaw/workspace/second-brain" python3 second-brain/fastapi_app.py ``` Default port is `8501` (same as Streamlit default). You can override via `SECOND_BRAIN_PORT` (or `PORT`) when starting manually. Endpoint smoke tests: ```bash curl -fsS http://127.0.0.1:8501/api/stats curl -fsS "http://127.0.0.1:8501/api/engrams?limit=1&offset=0" curl -fsS "http://127.0.0.1:8501/api/search?q=test&limit=1" ``` ## DB quick check ```bash python3 - <<'PY' import sqlite3 db="/root/.openclaw/workspace/second-brain/data/brain.sqlite" con=sqlite3.connect(db) cur=con.cursor() print(cur.execute("PRAGMA integrity_check").fetchone()[0]) print("engrams:", cur.execute("SELECT COUNT(*) FROM engrams").fetchone()[0]) con.close() PY ```