This release includes breaking changes for platform teams planning a safe upgrade.
✓ No known CVEs patched in this version
Topics
+14 more
Summary
AI summaryBatch SQL methods and cache consolidation deliver up to 500× speedup for decay on large stores.
Full changelog
Addresses issue #13 (darval) in full
The telemetry patch in v3.10.1 (commit `69d81fb`) gave per-stage observability. This release is the substantive follow-up: the five pathologies identified by the agent+genius audit of darval's 35-min run on a 66K-memory store.
Phase A — Set-based SQL batching (100–500× speedup on decay)
Per-row UPDATE/DELETE loops with per-row commits were the dominant cost. New batch methods on both `PgMemoryStore` and `SqliteMemoryStore`:
- `update_memories_heat_batch` — single `UPDATE … FROM UNNEST` replaces 62K per-row `UPDATE + COMMIT`
- `update_entities_heat_batch`, `archive_entities_batch`
- `update_relationships_weight_batch`, `delete_relationships_batch`
- `insert_stage_transitions_batch`
Converted callers: `decay`, `plasticity`, `pruning`, `cascade`. Erlang analysis predicts the decay stage drops from ~1100 s → 3–10 s on a 66K store.
Phase B — Consolidation-scoped memory cache
`store.get_all_memories_for_decay()` was called 6× per run (decay, compression, memify, homeostatic, sleep, emergence). Now loaded once at handler entry and threaded through every stage that needs it. Stages retain a fallback load when called standalone.
Phase C — Plasticity co-access starvation fixed
Previous `get_hot_memories(limit=50)` sampled 0.5% of a 10k-entity store → 99.95% LTD was distribution collapse, not biology. Sample cap raised 50 → 2000; reuses Phase B cache; precomputes lowercase entity-name index once; exception handler surfaces errors instead of swallowing them.
Phase D — CLS causal-edge signal gate
`_discover_causal_edges` previously hard-capped at 500 episodic on a 25K store (2% sample) and produced 0 edges by construction. Episodic cap raised 500 → 2000; adds an early-exit gate that skips the O(E²) PC pass when too few entities clear the minimum-observations threshold; restricts the PC vocabulary to qualifying entities so the matrix is `E_qualifying²` not `E_all²`.
Phase E — Cascade heartbeat skip + payload trim
Cascade was writing a heartbeat `UPDATE` on every scanned memory (~2000) even when nothing advanced, each with its own commit; and per-transition `INSERT + commit` for stage_transitions (503 fsyncs); and returning the full 503-transition list in the response. Now:
- Heartbeat skipped when `|Δhours| < 1` (the previous value was noise)
- `stage_transitions` INSERTs batched into one statement
- Response payload: `transitions_preview` (first 50) + `transitions_count`
- Exception handler now surfaces errors
- Response adds `scanned / heartbeats_written / heartbeats_skipped` counters
SQLite parity
Cowork mode previously lacked `stage_transitions` / `stage_entered_at` — cascade would error silently. Schema now has the table + column migration so cowork installs get the same cascade behavior as CLI.
Reviewed by
- `code-reviewer` — APPROVE
- `test-engineer` — 2188 tests pass
- `genius:erlang` — queuing theory on the 66K store
- `genius:feinstein` — differential diagnosis of all 6 findings
- `genius:feynman` — independent rederivation from first principles
Breaking changes
None. Stage functions gained an optional `memories=` parameter; all existing callers continue to work. MCP tool schemas unchanged. Response payload adds new fields (non-breaking).
Install
```
/plugin marketplace update
```
Weekly OSS security release digest.
The CVE patches and breaking changes that affected production tools this week. One email, every Sunday.
No spam, unsubscribe anytime.
Share this release
About cdeust/Cortex
Persistent memory for Claude Code grounded in computational neuroscience (41 cited papers)
Related context
Beta — feedback welcome: [email protected]