superlocalmemory 3.3.8 → 3.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superlocalmemory",
3
- "version": "3.3.8",
3
+ "version": "3.3.9",
4
4
  "description": "Information-geometric agent memory with mathematical guarantees. 4-channel retrieval, Fisher-Rao similarity, zero-LLM mode, EU AI Act compliant. Works with Claude, Cursor, Windsurf, and 17+ AI tools.",
5
5
  "keywords": [
6
6
  "ai-memory",
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "superlocalmemory"
3
- version = "3.3.8"
3
+ version = "3.3.9"
4
4
  description = "Information-geometric agent memory with mathematical guarantees"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -63,8 +63,14 @@ def _std_normal_cdf(x: float) -> float:
63
63
  def _compute_lloyd_max_gaussian(
64
64
  sigma: float, n_levels: int, max_iter: int = 100, tol: float = 1e-10,
65
65
  ) -> NDArray:
66
- """Lloyd-Max optimal codebook for N(0, sigma^2). Deterministic (HR-CB-01)."""
67
- lo, hi = -5.0 * sigma, 5.0 * sigma
66
+ """Lloyd-Max optimal codebook for N(0, sigma^2) on [-1, 1]. Deterministic (HR-CB-01).
67
+
68
+ The codebook boundaries extend to [-1, 1] (full unit-sphere coordinate range)
69
+ rather than [-5*sigma, 5*sigma], because after rotation, unit vector coordinates
70
+ CAN have extreme values (up to ±1). The Gaussian distribution determines
71
+ centroid placement, but the boundary range must cover all possible values.
72
+ """
73
+ lo, hi = -1.0, 1.0 # Full unit-sphere coordinate range
68
74
  boundaries = np.linspace(lo, hi, n_levels + 1)
69
75
  centroids = np.zeros(n_levels)
70
76
  for k in range(n_levels):
@@ -78,6 +84,9 @@ def _compute_lloyd_max_gaussian(
78
84
  denom = _std_normal_cdf(b_k) - _std_normal_cdf(a_k)
79
85
  if denom > 1e-15:
80
86
  centroids[k] = sigma * (_std_normal_pdf(a_k) - _std_normal_pdf(b_k)) / denom
87
+ else:
88
+ # Tail region: use midpoint (values here are rare but must be handled)
89
+ centroids[k] = 0.5 * (boundaries[k] + boundaries[k + 1])
81
90
  for k in range(1, n_levels):
82
91
  boundaries[k] = 0.5 * (centroids[k - 1] + centroids[k])
83
92
  if float(np.max(np.abs(centroids - old))) < tol: