superlocalmemory 3.4.38 → 3.4.39

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.4.38",
3
+ "version": "3.4.39",
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.4.38"
3
+ version = "3.4.39"
4
4
  description = "Information-geometric agent memory with mathematical guarantees"
5
5
  readme = "README.md"
6
6
  license = {text = "AGPL-3.0-or-later"}
@@ -1,3 +1,3 @@
1
1
  """SuperLocalMemory — information-geometric agent memory."""
2
2
 
3
- __version__ = "3.4.38"
3
+ __version__ = "3.4.39"
@@ -17,6 +17,7 @@ Part of Qualixar | Author: Varun Pratap Bhardwaj
17
17
  from __future__ import annotations
18
18
 
19
19
  import logging
20
+ import os
20
21
  from pathlib import Path
21
22
  from typing import Callable
22
23
 
@@ -26,17 +27,32 @@ MEMORY_DIR = Path.home() / ".superlocalmemory"
26
27
  DB_PATH = MEMORY_DIR / "memory.db"
27
28
 
28
29
 
30
+ def _get_agent_id(default: str = "mcp_client") -> str:
31
+ """Resolve the calling agent's ID for attribution.
32
+
33
+ Each Avenger (Claude, Codex, Gemini, Kimi, GLM, Qwen, etc.) sets the
34
+ ``SLM_AGENT_ID`` env var in its MCP server config so that memories,
35
+ observations, and registry entries are tagged with the actual source
36
+ agent — not the legacy ``"mcp_client"`` default.
37
+
38
+ v3.4.39+: enables proper cross-Avenger attribution in ``session_init``,
39
+ ``observe``, and event emissions.
40
+ """
41
+ return os.environ.get("SLM_AGENT_ID", default)
42
+
43
+
29
44
  def _emit_event(event_type: str, payload: dict | None = None,
30
- source_agent: str = "mcp_client") -> None: # V3.3.12: see also mcp/shared.py
45
+ source_agent: str | None = None) -> None: # V3.3.12: see also mcp/shared.py
31
46
  """Emit an event to the EventBus (best-effort, never raises).
32
47
 
33
48
  Dashboard visibility is load-bearing per the v3.4.26 user contract,
34
49
  so we log on failure rather than silently dropping the signal.
35
50
  """
51
+ resolved_agent = source_agent if source_agent is not None else _get_agent_id()
36
52
  try:
37
53
  from superlocalmemory.infra.event_bus import EventBus
38
54
  bus = EventBus.get_instance(str(DB_PATH))
39
- bus.emit(event_type, payload=payload, source_agent=source_agent,
55
+ bus.emit(event_type, payload=payload, source_agent=resolved_agent,
40
56
  source_protocol="mcp")
41
57
  except Exception as exc:
42
58
  logger.warning("event emit failed: type=%s err=%s", event_type, exc)
@@ -116,10 +132,11 @@ def register_active_tools(server, get_engine: Callable) -> None:
116
132
  "session_init feedback_count read failed: %s", exc,
117
133
  )
118
134
 
119
- # Register agent + emit event
120
- _register_agent("mcp_client", pid)
135
+ # Register agent + emit event (v3.4.39: SLM_AGENT_ID env support)
136
+ agent_id = _get_agent_id()
137
+ _register_agent(agent_id, pid)
121
138
  _emit_event("agent.connected", {
122
- "agent_id": "mcp_client",
139
+ "agent_id": agent_id,
123
140
  "project_path": project_path,
124
141
  "memory_count": len(memories),
125
142
  })
@@ -145,7 +162,7 @@ def register_active_tools(server, get_engine: Callable) -> None:
145
162
  @server.tool()
146
163
  async def observe(
147
164
  content: str,
148
- agent_id: str = "mcp_client",
165
+ agent_id: str | None = None,
149
166
  ) -> dict:
150
167
  """Observe conversation content for automatic memory capture.
151
168
 
@@ -155,7 +172,13 @@ def register_active_tools(server, get_engine: Callable) -> None:
155
172
 
156
173
  Call this after making decisions, fixing bugs, or expressing preferences.
157
174
  The system will NOT store low-confidence or irrelevant content.
175
+
176
+ v3.4.39: ``agent_id`` now defaults to the ``SLM_AGENT_ID`` env var
177
+ (set by each Avenger's MCP config) so observations carry proper
178
+ cross-Avenger attribution.
158
179
  """
180
+ if agent_id is None:
181
+ agent_id = _get_agent_id()
159
182
  try:
160
183
  from superlocalmemory.hooks.auto_capture import AutoCapture
161
184
  from superlocalmemory.hooks.rules_engine import RulesEngine
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superlocalmemory
3
- Version: 3.4.38
3
+ Version: 3.4.39
4
4
  Summary: Information-geometric agent memory with mathematical guarantees
5
5
  Author-email: Varun Pratap Bhardwaj <admin@superlocalmemory.com>
6
6
  License: AGPL-3.0-or-later