graph-mind-memory 0.1.3__tar.gz → 0.1.4__tar.gz

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.
Files changed (32) hide show
  1. {graph_mind_memory-0.1.3/graph_mind_memory.egg-info → graph_mind_memory-0.1.4}/PKG-INFO +1 -1
  2. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/graph_mind_mcp_server.py +3 -2
  3. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4/graph_mind_memory.egg-info}/PKG-INFO +1 -1
  4. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/install.py +18 -5
  5. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/local_embedder.py +23 -2
  6. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/pyproject.toml +1 -1
  7. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/LICENSE +0 -0
  8. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/README.md +0 -0
  9. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/associative_memory.py +0 -0
  10. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/automatic_capture.py +0 -0
  11. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/automatic_capture_cli.py +0 -0
  12. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/brain_log.py +0 -0
  13. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/clock.py +0 -0
  14. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/coding_memory.py +0 -0
  15. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/conversation_memory.py +0 -0
  16. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/development_memory.py +0 -0
  17. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/development_paths.py +0 -0
  18. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/embedding_warmup.py +0 -0
  19. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/entity_timeline.py +0 -0
  20. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/graph_mind_memory.egg-info/SOURCES.txt +0 -0
  21. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/graph_mind_memory.egg-info/dependency_links.txt +0 -0
  22. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/graph_mind_memory.egg-info/entry_points.txt +0 -0
  23. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/graph_mind_memory.egg-info/requires.txt +0 -0
  24. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/graph_mind_memory.egg-info/top_level.txt +0 -0
  25. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/local_brain.py +0 -0
  26. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/semantic_llm_extractor.py +0 -0
  27. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/semantic_memory.py +0 -0
  28. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/semantic_recall.py +0 -0
  29. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/setup.cfg +0 -0
  30. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/temporal_resolver.py +0 -0
  31. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/universal_personal_memory.py +0 -0
  32. {graph_mind_memory-0.1.3 → graph_mind_memory-0.1.4}/vector_cache.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph-mind-memory
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Local-first memory for AI coding assistants: verbatim, on your own PC, no LLM calls at write time.
5
5
  Author-email: Yohan Ko <goyohan0611@gmail.com>
6
6
  License-Expression: AGPL-3.0-only
@@ -38,8 +38,9 @@ RecordableEventType = Literal[
38
38
  # hub over the network whether a newer revision exists, every time it loads. That made the first
39
39
  # save of a session take ~95 s and sent requests off the machine for no reason. Once the model is
40
40
  # on disk, stay offline.
41
- if (Path.home() / ".cache" / "huggingface" / "hub"
42
- / "models--sentence-transformers--paraphrase-multilingual-MiniLM-L12-v2").is_dir():
41
+ from local_embedder import model_on_disk # noqa: E402
42
+
43
+ if model_on_disk():
43
44
  os.environ.setdefault("HF_HUB_OFFLINE", "1")
44
45
  os.environ.setdefault("TRANSFORMERS_OFFLINE", "1")
45
46
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph-mind-memory
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Local-first memory for AI coding assistants: verbatim, on your own PC, no LLM calls at write time.
5
5
  Author-email: Yohan Ko <goyohan0611@gmail.com>
6
6
  License-Expression: AGPL-3.0-only
@@ -159,21 +159,34 @@ def capture_service(start: bool) -> str:
159
159
 
160
160
  def embedding_model():
161
161
  sys.path.insert(0, str(HERE))
162
- from local_embedder import LOCAL_MODEL
162
+ from local_embedder import LOCAL_MODEL, own_model_cache
163
163
  try:
164
164
  from transformers import AutoModel, AutoTokenizer
165
- AutoTokenizer.from_pretrained(LOCAL_MODEL)
166
- AutoModel.from_pretrained(LOCAL_MODEL)
167
165
  except OSError as error:
166
+ if "1114" not in str(error):
167
+ raise
168
168
  # WinError 1114 on c10.dll: PyTorch needs the Microsoft Visual C++ runtime, which a fresh
169
169
  # Windows often lacks. Everything else is installed; recall uses word search until then.
170
- if platform.system() != "Windows":
171
- raise
172
170
  sys.exit(f"\n{error}\n\nPyTorch could not load. Install the Microsoft Visual C++ "
173
171
  "Redistributable (x64), restart, and run this again:\n"
174
172
  " https://aka.ms/vs/17/release/vc_redist.x64.exe\n"
175
173
  "The apps are already connected; until then recall works by word search only.")
176
174
 
175
+ def download(cache_dir):
176
+ AutoTokenizer.from_pretrained(LOCAL_MODEL, cache_dir=cache_dir)
177
+ AutoModel.from_pretrained(LOCAL_MODEL, cache_dir=cache_dir)
178
+ try:
179
+ download(None)
180
+ except OSError as error:
181
+ # ~/.cache refused (access denied): keep the model in Graph-MIND's own folder instead,
182
+ # where the server looks too (local_embedder.model_cache)
183
+ if "PermissionError" not in str(error) and not isinstance(error.__cause__, PermissionError):
184
+ raise
185
+ own = own_model_cache()
186
+ own.mkdir(parents=True, exist_ok=True)
187
+ step(f"the usual model folder is not writable; using {own}")
188
+ download(str(own))
189
+
177
190
 
178
191
  def main(argv=None):
179
192
  parser = argparse.ArgumentParser(description="Install Graph-MIND on this PC.")
@@ -8,6 +8,7 @@ from __future__ import annotations
8
8
  from pathlib import Path
9
9
  import hashlib
10
10
  import math
11
+ import os
11
12
  import threading
12
13
 
13
14
  from associative_memory import _terms
@@ -18,6 +19,24 @@ ACTIVATE = dict(seed_limit=12, hops=2, fanout=8, max_nodes=24, limit=8) # froze
18
19
  SEED_LIMIT = ACTIVATE["seed_limit"]
19
20
 
20
21
 
22
+ def own_model_cache() -> Path:
23
+ from development_paths import graph_mind_home
24
+ return graph_mind_home() / "models"
25
+
26
+
27
+ def model_cache():
28
+ """None means Hugging Face's usual cache. Graph-MIND's own folder once the installer had to
29
+ use it: on one fresh Windows profile ~/.cache could not be written (access denied)."""
30
+ own = own_model_cache()
31
+ return str(own) if own.is_dir() else None
32
+
33
+
34
+ def model_on_disk() -> bool:
35
+ name = "models--" + LOCAL_MODEL.replace("/", "--")
36
+ usual = Path(os.environ.get("HF_HOME") or Path.home() / ".cache" / "huggingface") / "hub"
37
+ return (usual / name).is_dir() or (own_model_cache() / name).is_dir()
38
+
39
+
21
40
  class LocalEmbedder:
22
41
  """On-device multilingual embeddings via raw transformers (mean pooling, L2-normalized).
23
42
  No text leaves the machine — required by the user-owned local-brain promise."""
@@ -42,8 +61,10 @@ class LocalEmbedder:
42
61
  if LocalEmbedder._model is None:
43
62
  import torch
44
63
  from transformers import AutoModel, AutoTokenizer
45
- LocalEmbedder._tok = AutoTokenizer.from_pretrained(self.model_name)
46
- LocalEmbedder._model = AutoModel.from_pretrained(self.model_name).eval()
64
+ cache = model_cache()
65
+ LocalEmbedder._tok = AutoTokenizer.from_pretrained(self.model_name, cache_dir=cache)
66
+ LocalEmbedder._model = AutoModel.from_pretrained(self.model_name,
67
+ cache_dir=cache).eval()
47
68
  LocalEmbedder._torch = torch
48
69
 
49
70
  def _key(self, text):
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "graph-mind-memory"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "Local-first memory for AI coding assistants: verbatim, on your own PC, no LLM calls at write time."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"