strawberry/docs/store-reduction.md
trvon 1ee208fb4b
Stage 7e: scheduled stop->reduce->start telemetry-reduction maintenance (opt-in)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-11 13:21:13 -07:00

2.3 KiB

Scheduled telemetry reduction

strawberry store reduce rewrites sealed telemetry segments and drops dead, benign process subtrees (stage 7a). Evidence (findings, detections and their provenance chains) is untouched. On the measured corpus it cut execs by about 91% and windows by about 92% (replay and correlation roughly 11x cheaper) with all detections preserved.

store reduce needs exclusive access to the store, so it refuses while the daemon is running. The scheduled path automates stop, reduce, start:

  • strawberry-reduce.timer fires weekly (randomized by up to 1 hour).
  • strawberry-reduce.service runs /usr/local/lib/strawberry/strawberry-reduce.sh.
  • The wrapper checks store_reduce_enabled in /etc/strawberry/strawberry.conf. If it is not true/1, it prints strawberry-reduce: disabled (store_reduce_enabled) and exits 0 without touching the daemon.
  • Otherwise it stops strawberry.service, runs store reduce --yes --json under nice -n 19, and starts the daemon again. An EXIT trap restarts the daemon on every exit path (reduce failure, signal, error). Only kill -9 of the wrapper itself can bypass it. The wrapper's exit code is the reduce exit code, so a failed run shows as a failed unit in systemctl/journalctl -u strawberry-reduce.

The scheduled path is 7a only: no --skeleton or --merge. A manual strawberry store reduce is never gated and always available.

Before you enable it

  • Monitoring gap. The daemon is stopped for the length of each run, and no live telemetry or detections are recorded during it.
  • Retention change. Reduction permanently drops benign telemetry. Run the recall gate against a copy of your store first to confirm detections survive.
  • The unit is intentionally less sandboxed than strawberry-update.service: it must reach systemd to stop and start the daemon and rewrite the store.

Enable

The installer places the units and wrapper but enables nothing.

# 1. in /etc/strawberry/strawberry.conf
store_reduce_enabled=true
# 2. start the timer
sudo systemctl enable --now strawberry-reduce.timer
# one-off run: sudo systemctl start strawberry-reduce.service

To turn it off, systemctl disable --now strawberry-reduce.timer (or set store_reduce_enabled=false, which makes any fired run a no-op).