memoryagent-lib 0.1.1__tar.gz → 0.1.2__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 (27) hide show
  1. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/PKG-INFO +4 -1
  2. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/README.md +3 -0
  3. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/config.py +24 -0
  4. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/examples/export_memory.py +7 -1
  5. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/examples/memory_api_server.py +6 -0
  6. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/system.py +1 -0
  7. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent_lib.egg-info/PKG-INFO +4 -1
  8. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/pyproject.toml +1 -1
  9. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/__init__.py +0 -0
  10. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/confidence.py +0 -0
  11. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/consolidation.py +0 -0
  12. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/examples/minimal.py +0 -0
  13. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/examples/openai_agent.py +0 -0
  14. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/indexers.py +0 -0
  15. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/models.py +0 -0
  16. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/policy.py +0 -0
  17. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/retrieval.py +0 -0
  18. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/storage/base.py +0 -0
  19. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/storage/in_memory.py +0 -0
  20. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/storage/local_disk.py +0 -0
  21. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/utils.py +0 -0
  22. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent/workers.py +0 -0
  23. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent_lib.egg-info/SOURCES.txt +0 -0
  24. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent_lib.egg-info/dependency_links.txt +0 -0
  25. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent_lib.egg-info/requires.txt +0 -0
  26. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/memoryagent_lib.egg-info/top_level.txt +0 -0
  27. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memoryagent-lib
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Add your description here
5
5
  Author-email: Jiawei Zheng <jw.zhengai@gmail.com>
6
6
  License: MIT
@@ -173,6 +173,9 @@ The page calls:
173
173
  - **Features**: `.memoryagent_features.sqlite`
174
174
  - **Cold archive**: `.memoryagent_cold/records/<owner>/YYYY/MM/DD/daily_notes.json`
175
175
 
176
+ ## Data Root (Installed Usage)
177
+ The system auto-detects a project root by walking up from the current working directory and looking for `pyproject.toml` or `.git`. If it can’t find one, it uses the current directory.
178
+
176
179
  ## Configuration
177
180
  See `memoryagent/config.py` for defaults:
178
181
  - `working_ttl_seconds`
@@ -158,6 +158,9 @@ The page calls:
158
158
  - **Features**: `.memoryagent_features.sqlite`
159
159
  - **Cold archive**: `.memoryagent_cold/records/<owner>/YYYY/MM/DD/daily_notes.json`
160
160
 
161
+ ## Data Root (Installed Usage)
162
+ The system auto-detects a project root by walking up from the current working directory and looking for `pyproject.toml` or `.git`. If it can’t find one, it uses the current directory.
163
+
161
164
  ## Configuration
162
165
  See `memoryagent/config.py` for defaults:
163
166
  - `working_ttl_seconds`
@@ -20,6 +20,7 @@ class MemorySystemConfig(BaseModel):
20
20
  working_ttl_seconds: int = 3600
21
21
  retrieval_plan: RetrievalPlan = Field(default_factory=RetrievalPlan)
22
22
  consolidation: ConsolidationConfig = Field(default_factory=ConsolidationConfig)
23
+ data_root: Optional[Path] = None
23
24
  cold_store_path: Path = Field(default_factory=lambda: Path(".memoryagent_cold"))
24
25
  metadata_db_path: Path = Field(default_factory=lambda: Path(".memoryagent_hot.sqlite"))
25
26
  feature_db_path: Path = Field(default_factory=lambda: Path(".memoryagent_features.sqlite"))
@@ -33,3 +34,26 @@ class MemorySystemConfig(BaseModel):
33
34
  if self.archive_index_path is not None:
34
35
  return self.archive_index_path
35
36
  return self.cold_store_path / "archive_index.json"
37
+
38
+ def resolve_paths(self) -> None:
39
+ root = self.data_root or _find_project_root()
40
+ if root is None:
41
+ return
42
+ root = Path(root)
43
+ self.data_root = root
44
+ self.cold_store_path = root / self.cold_store_path
45
+ self.metadata_db_path = root / self.metadata_db_path
46
+ self.feature_db_path = root / self.feature_db_path
47
+ self.vector_db_path = root / self.vector_db_path
48
+
49
+
50
+ def _find_project_root(start: Optional[Path] = None) -> Optional[Path]:
51
+ current = start or Path.cwd()
52
+ current = current.resolve()
53
+ for _ in range(6):
54
+ if (current / "pyproject.toml").exists() or (current / ".git").exists():
55
+ return current
56
+ if current.parent == current:
57
+ break
58
+ current = current.parent
59
+ return None
@@ -5,7 +5,13 @@ import sqlite3
5
5
  from pathlib import Path
6
6
  from typing import Any, Dict, List
7
7
 
8
- ROOT = Path(__file__).resolve().parents[2]
8
+ try:
9
+ from memoryagent.config import _find_project_root
10
+ except Exception:
11
+ _find_project_root = None
12
+
13
+ ROOT = _find_project_root() if _find_project_root else None
14
+ ROOT = ROOT or Path.cwd()
9
15
  COLD_ROOT = ROOT / ".memoryagent_cold"
10
16
  HOT_DB = ROOT / ".memoryagent_hot.sqlite"
11
17
  FEATURE_DB = ROOT / ".memoryagent_features.sqlite"
@@ -7,6 +7,7 @@ from pathlib import Path
7
7
  import os
8
8
  from memoryagent.examples.export_memory import get_memory_payload
9
9
  from uuid import uuid4
10
+ from pathlib import Path
10
11
 
11
12
  from memoryagent import (
12
13
  HeuristicMemoryPolicy,
@@ -64,6 +65,7 @@ def _get_memory_system():
64
65
  vector_dim = int(os.environ.get("OPENAI_EMBED_DIM", "1536"))
65
66
 
66
67
  config = MemorySystemConfig(
68
+ data_root=Path.cwd(),
67
69
  use_sqlite_vec=True,
68
70
  vector_dim=vector_dim,
69
71
  sqlite_vec_extension_path=os.environ.get("SQLITE_VEC_PATH"),
@@ -73,6 +75,10 @@ def _get_memory_system():
73
75
  config=config,
74
76
  embedding_fn=_openai_embedder(client, embedding_model, config.vector_dim),
75
77
  )
78
+ root = getattr(memory.config, "data_root", None)
79
+ print(
80
+ f"[memory_api] root={root} hot_db={memory.config.metadata_db_path} cold={memory.config.cold_store_path}"
81
+ )
76
82
  return memory, client, model
77
83
 
78
84
 
@@ -35,6 +35,7 @@ class MemorySystem:
35
35
  routing_policy: Optional[MemoryRoutingPolicy] = None,
36
36
  ) -> None:
37
37
  self.config = config or MemorySystemConfig()
38
+ self.config.resolve_paths()
38
39
  self.metadata_store = metadata_store or SQLiteMetadataStore(self.config.metadata_db_path)
39
40
  if vector_index is not None:
40
41
  self.vector_index = vector_index
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memoryagent-lib
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Add your description here
5
5
  Author-email: Jiawei Zheng <jw.zhengai@gmail.com>
6
6
  License: MIT
@@ -173,6 +173,9 @@ The page calls:
173
173
  - **Features**: `.memoryagent_features.sqlite`
174
174
  - **Cold archive**: `.memoryagent_cold/records/<owner>/YYYY/MM/DD/daily_notes.json`
175
175
 
176
+ ## Data Root (Installed Usage)
177
+ The system auto-detects a project root by walking up from the current working directory and looking for `pyproject.toml` or `.git`. If it can’t find one, it uses the current directory.
178
+
176
179
  ## Configuration
177
180
  See `memoryagent/config.py` for defaults:
178
181
  - `working_ttl_seconds`
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "memoryagent-lib"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"