From 2504327e35a07fcc6d6ffa74ee194ae7ceffd6bb Mon Sep 17 00:00:00 2001 From: Otto Date: Sun, 31 May 2026 14:10:12 +0200 Subject: [PATCH] refactor: event-driven tuning\n\n- ingest: switch to path unit (inotify) for immediate trigger\n- auto-review: every 30min + ExecStartPost after ingest\n- health-check: every 30min\n- import-context-buffer: every 15min\n\nRefs: #25 --- systemd/openclaw-secondbrain-auto-review.timer | 4 ++-- systemd/openclaw-secondbrain-health-check.timer | 4 ++-- .../openclaw-secondbrain-import-context-buffer.timer | 4 ++-- systemd/openclaw-secondbrain-ingest-memory.path | 10 ++++++++++ systemd/openclaw-secondbrain-ingest-memory.service | 2 ++ 5 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 systemd/openclaw-secondbrain-ingest-memory.path diff --git a/systemd/openclaw-secondbrain-auto-review.timer b/systemd/openclaw-secondbrain-auto-review.timer index da29825..41b4f07 100644 --- a/systemd/openclaw-secondbrain-auto-review.timer +++ b/systemd/openclaw-secondbrain-auto-review.timer @@ -1,9 +1,9 @@ [Unit] -Description=Run auto assign review daily at 14:30 +Description=Run auto assign review every 30 minutes PartOf=openclaw-secondbrain.target [Timer] -OnCalendar=*-*-* 14:30:00 +OnUnitActiveSec=30min Persistent=true [Install] diff --git a/systemd/openclaw-secondbrain-health-check.timer b/systemd/openclaw-secondbrain-health-check.timer index 92e6db0..7610798 100644 --- a/systemd/openclaw-secondbrain-health-check.timer +++ b/systemd/openclaw-secondbrain-health-check.timer @@ -1,9 +1,9 @@ [Unit] -Description=Run health check at 02:00 and 14:00 daily +Description=Run health check every 30 minutes PartOf=openclaw-secondbrain.target [Timer] -OnCalendar=*-*-* 02,14:00:00 +OnUnitActiveSec=30min Persistent=true [Install] diff --git a/systemd/openclaw-secondbrain-import-context-buffer.timer b/systemd/openclaw-secondbrain-import-context-buffer.timer index bbd027a..183a005 100644 --- a/systemd/openclaw-secondbrain-import-context-buffer.timer +++ b/systemd/openclaw-secondbrain-import-context-buffer.timer @@ -1,9 +1,9 @@ [Unit] -Description=Import Context Buffer every 4 hours +Description=Import Context Buffer every 15 minutes PartOf=openclaw-secondbrain.target [Timer] -OnCalendar=*-*-* 02,06,10,14,18,22:00:00 +OnUnitActiveSec=15min Persistent=true [Install] diff --git a/systemd/openclaw-secondbrain-ingest-memory.path b/systemd/openclaw-secondbrain-ingest-memory.path new file mode 100644 index 0000000..5679b37 --- /dev/null +++ b/systemd/openclaw-secondbrain-ingest-memory.path @@ -0,0 +1,10 @@ +[Unit] +Description=Watch memory/ directory for changes to trigger ingest +PartOf=openclaw-secondbrain.target + +[Path] +PathModified=/root/.openclaw/workspace/memory +DirectoryNotEmpty=true + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/systemd/openclaw-secondbrain-ingest-memory.service b/systemd/openclaw-secondbrain-ingest-memory.service index ef5480a..956dfbf 100644 --- a/systemd/openclaw-secondbrain-ingest-memory.service +++ b/systemd/openclaw-secondbrain-ingest-memory.service @@ -6,3 +6,5 @@ OnFailure=openclaw-secondbrain-notify@%n.service Type=oneshot WorkingDirectory=/root/.openclaw/workspace ExecStart=/bin/bash -lc 'flock -n /tmp/%n.lock /usr/bin/python3 /root/.openclaw/workspace/openclaw_cron_wrapper.py ingest_memory' +# Trigger auto-review after each ingest +ExecStartPost=/bin/systemctl start openclaw-secondbrain-auto-review.service