Skip to content

feat(memory): SleepGate forgetting pass + performance-floor compression predictor#2614

Merged
bug-ops merged 2 commits intomainfrom
sleepgate-forgetting-pass
Apr 4, 2026
Merged

feat(memory): SleepGate forgetting pass + performance-floor compression predictor#2614
bug-ops merged 2 commits intomainfrom
sleepgate-forgetting-pass

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Apr 4, 2026

Summary

Integration points

  • Config: [memory.forgetting] and [memory.compression.predictor]
  • CLI: zeph memory forgetting-sweep, zeph memory predictor-status
  • TUI: /forgetting-sweep, /predictor-status in command palette
  • --init wizard: prompts for both features (default: disabled)
  • --migrate-config: steps 8 and 9 in migration chain
  • Testing playbook: .local/testing/playbooks/sleepgate-compression.md
  • Coverage-status: rows added (status: Untested)

Migrations

  • 064_forgetting_sweep_index — partial index on (importance_score, last_accessed, deleted_at) for sweep efficiency
  • 065_compression_predictor — training data and weight persistence tables
  • Both SQLite and Postgres dialects provided

Test plan

  • cargo nextest run — 7660 passed, 15 skipped
  • cargo clippy -- -D warnings — zero warnings
  • cargo +nightly fmt --check — clean
  • Live session test with forgetting_enabled = true and a long conversation to verify sweep fires and prunes stale low-importance messages
  • Verify predictor table accumulates training samples once wired into summarization path (follow-up PR)

Closes #2397
Closes #2460

…on predictor

Implements two memory quality improvements:

1. SleepGate forgetting sweep (#2397)
   - Three-phase consolidation step: synaptic downscaling, selective replay,
     targeted pruning — all within a single SQLite transaction
   - Phase 2 replay scoped to Phase 1 batch IDs to prevent score inflation
   - Config: [memory.forgetting] with enabled, decay_rate, forgetting_floor,
     sweep_interval_secs, sweep_batch_size, replay_window_hours,
     protect_min_access_count fields
   - Validation at sweep entry: decay_rate in (0.0, 1.0), forgetting_floor
     in [0.0, 1.0), sweep_interval_secs >= 60
   - Background loop in runner.rs alongside eviction/consolidation

2. Compression ratio predictor (#2460)
   - Linear regression predictor trained on (ratio, probe_score) pairs
   - select_ratio() finds most aggressive ratio clearing the performance floor
   - Cold-start fallback when < 10 samples; sliding window of 200 samples
   - Data pipeline complete; integration into summarization path deferred
   - Config: [memory.compression.predictor]

Migrations: 064 (forgetting index), 065 (predictor tables) — both SQLite and
Postgres dialects.

Integration: CLI subcommands, TUI commands, --init wizard, --migrate-config
steps 7-8, testing playbook, coverage-status rows.

Closes #2397, closes #2460
@github-actions github-actions bot added documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes core zeph-core crate enhancement New feature or request size/XL Extra large PR (500+ lines) labels Apr 4, 2026
@bug-ops bug-ops enabled auto-merge (squash) April 4, 2026 02:19
PostgreSQL stores consolidated as BOOLEAN — the WHERE clause must use
NOT consolidated, not consolidated = 0 (SQLite integer comparison).
@bug-ops bug-ops merged commit a42960e into main Apr 4, 2026
27 checks passed
@bug-ops bug-ops deleted the sleepgate-forgetting-pass branch April 4, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation enhancement New feature or request memory zeph-memory crate (SQLite) rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

1 participant