Memex Admin

Mem-Client: Async Store Cleanup

Repository: mem-labs/mem

activeUpdated Feb 18, 2026, 8:57 PM

Policy ID js77pavsb92et1bd3tq8ta4t1x81d44r

Mem-client async side-effect cleanup rule.

Scope:
- Applies when adding/changing store-side effects in `domains/frontend/mem-client/src/store/**`.

Trigger:
- Added/changed code creates long-lived side effects, including:
  - `reaction(`
  - `autorun(`
  - `setInterval(`
  - `setTimeout(` used as recurring polling/retry loop
  - `addEventListener(`

Hard requirements:
1) Each triggered side effect must include explicit teardown in the same lifecycle path.
2) Teardown must call one of:
   - `dispose()` / returned disposer
   - `unsubscribe()`
   - `abort()`
   - `clearInterval()` / `clearTimeout()`
   - `removeEventListener()`
3) Do not add new long-lived side effects without a reachable teardown path.

Decision:
- Return NOT APPROVED when trigger is met and teardown requirements are missing.