memoryagent-lib 0.1.1__tar.gz → 0.1.3__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.3}/PKG-INFO +26 -22
  2. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/README.md +25 -21
  3. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/config.py +24 -0
  4. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/examples/export_memory.py +7 -1
  5. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/examples/memory_api_server.py +6 -0
  6. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/system.py +1 -0
  7. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent_lib.egg-info/PKG-INFO +26 -22
  8. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/pyproject.toml +1 -1
  9. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/__init__.py +0 -0
  10. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/confidence.py +0 -0
  11. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/consolidation.py +0 -0
  12. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/examples/minimal.py +0 -0
  13. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/examples/openai_agent.py +0 -0
  14. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/indexers.py +0 -0
  15. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/models.py +0 -0
  16. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/policy.py +0 -0
  17. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/retrieval.py +0 -0
  18. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/storage/base.py +0 -0
  19. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/storage/in_memory.py +0 -0
  20. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/storage/local_disk.py +0 -0
  21. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/utils.py +0 -0
  22. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent/workers.py +0 -0
  23. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent_lib.egg-info/SOURCES.txt +0 -0
  24. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent_lib.egg-info/dependency_links.txt +0 -0
  25. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent_lib.egg-info/requires.txt +0 -0
  26. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/memoryagent_lib.egg-info/top_level.txt +0 -0
  27. {memoryagent_lib-0.1.1 → memoryagent_lib-0.1.3}/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.3
4
4
  Summary: Add your description here
5
5
  Author-email: Jiawei Zheng <jw.zhengai@gmail.com>
6
6
  License: MIT
@@ -13,10 +13,8 @@ Requires-Dist: openai>=2.16.0
13
13
  Requires-Dist: pydantic>=2.0
14
14
  Requires-Dist: sqlite-vec>=0.1.6
15
15
 
16
- #
17
-
18
16
  <div align="center">
19
- <img src="https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/refs/heads/master/memoryagent_logo.jpg?token=GHSAT0AAAAAADSXDGNDXIWZF42E6S3D2XPG2MDPSDQ" alt="MemoryAgent" width="500">
17
+ <img src="https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/refs/heads/master/memoryagent_logo.jpg" alt="MemoryAgent" width="500">
20
18
  <h1>MemoryAgent: An Open, Modular Memory Framework for Agents (Beta)</h1>
21
19
  </div>
22
20
 
@@ -123,23 +121,6 @@ config = MemorySystemConfig(
123
121
  )
124
122
  ```
125
123
 
126
- ## Policies
127
- ### Conversation storage policy
128
- `HeuristicMemoryPolicy` decides whether a turn should be stored and whether it becomes episodic or semantic memory.
129
-
130
- ### Routing policy
131
- `MemoryRoutingPolicy` decides where a memory should be written:
132
- - **Hot** metadata store
133
- - **Vector index**
134
- - **Feature store** (perceptual)
135
- - **Cold** archive (via workers)
136
-
137
- ## Background Workers
138
- - `ConsolidationWorker`: working → episodic/semantic
139
- - `ArchiverWorker`: hot → cold + archive index
140
- - `RehydratorWorker`: cold → hot (based on access)
141
- - `Compactor`: cleanup/TTL
142
-
143
124
  ## Examples
144
125
  ### OpenAI Agent (CLI)
145
126
  ```bash
@@ -160,19 +141,41 @@ http://127.0.0.1:8000/memory_viz.html
160
141
 
161
142
  An example (System records semantic memory and updating working memory):
162
143
 
163
- ![Screenshot](https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/master/Memory%20Agent%20_%20Live%20Console.jpeg?token=GHSAT0AAAAAADSXDGNDWOWFKKV777VMZM6U2MDPSTQ)
144
+ ![Screenshot](https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/457c3fdadc099727b337838634b9ca3a4ec89fe8/Memory%20Agent%20_%20Live%20Console.jpeg)
164
145
 
165
146
 
166
147
  The page calls:
167
148
  - `GET /api/memory?owner=user-001`
168
149
  - `POST /api/chat`
169
150
 
151
+ ## Policies
152
+ ### Conversation storage policy
153
+ `HeuristicMemoryPolicy` decides whether a turn should be stored and whether it becomes episodic or semantic memory.
154
+
155
+ ### Routing policy
156
+ `MemoryRoutingPolicy` decides where a memory should be written:
157
+ - **Hot** metadata store
158
+ - **Vector index**
159
+ - **Feature store** (perceptual)
160
+ - **Cold** archive (via workers)
161
+
162
+ ## Background Workers
163
+ - `ConsolidationWorker`: working -> episodic/semantic
164
+ - `ArchiverWorker`: hot -> cold + archive index
165
+ - `RehydratorWorker`: cold -> hot (based on access)
166
+ - `Compactor`: cleanup/TTL
167
+
168
+
170
169
  ## Data Stores
171
170
  - **Hot metadata**: `.memoryagent_hot.sqlite`
172
171
  - **Vector index**: `.memoryagent_vectors.sqlite` (sqlite-vec)
173
172
  - **Features**: `.memoryagent_features.sqlite`
174
173
  - **Cold archive**: `.memoryagent_cold/records/<owner>/YYYY/MM/DD/daily_notes.json`
175
174
 
175
+ ## Data Root (Installed Usage)
176
+ 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.
177
+
178
+
176
179
  ## Configuration
177
180
  See `memoryagent/config.py` for defaults:
178
181
  - `working_ttl_seconds`
@@ -184,3 +187,4 @@ See `memoryagent/config.py` for defaults:
184
187
  - Episodic/semantic memories are candidates for cold archive.
185
188
 
186
189
  ## License
190
+ MIT License
@@ -1,7 +1,5 @@
1
- #
2
-
3
1
  <div align="center">
4
- <img src="https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/refs/heads/master/memoryagent_logo.jpg?token=GHSAT0AAAAAADSXDGNDXIWZF42E6S3D2XPG2MDPSDQ" alt="MemoryAgent" width="500">
2
+ <img src="https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/refs/heads/master/memoryagent_logo.jpg" alt="MemoryAgent" width="500">
5
3
  <h1>MemoryAgent: An Open, Modular Memory Framework for Agents (Beta)</h1>
6
4
  </div>
7
5
 
@@ -108,23 +106,6 @@ config = MemorySystemConfig(
108
106
  )
109
107
  ```
110
108
 
111
- ## Policies
112
- ### Conversation storage policy
113
- `HeuristicMemoryPolicy` decides whether a turn should be stored and whether it becomes episodic or semantic memory.
114
-
115
- ### Routing policy
116
- `MemoryRoutingPolicy` decides where a memory should be written:
117
- - **Hot** metadata store
118
- - **Vector index**
119
- - **Feature store** (perceptual)
120
- - **Cold** archive (via workers)
121
-
122
- ## Background Workers
123
- - `ConsolidationWorker`: working → episodic/semantic
124
- - `ArchiverWorker`: hot → cold + archive index
125
- - `RehydratorWorker`: cold → hot (based on access)
126
- - `Compactor`: cleanup/TTL
127
-
128
109
  ## Examples
129
110
  ### OpenAI Agent (CLI)
130
111
  ```bash
@@ -145,19 +126,41 @@ http://127.0.0.1:8000/memory_viz.html
145
126
 
146
127
  An example (System records semantic memory and updating working memory):
147
128
 
148
- ![Screenshot](https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/master/Memory%20Agent%20_%20Live%20Console.jpeg?token=GHSAT0AAAAAADSXDGNDWOWFKKV777VMZM6U2MDPSTQ)
129
+ ![Screenshot](https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/457c3fdadc099727b337838634b9ca3a4ec89fe8/Memory%20Agent%20_%20Live%20Console.jpeg)
149
130
 
150
131
 
151
132
  The page calls:
152
133
  - `GET /api/memory?owner=user-001`
153
134
  - `POST /api/chat`
154
135
 
136
+ ## Policies
137
+ ### Conversation storage policy
138
+ `HeuristicMemoryPolicy` decides whether a turn should be stored and whether it becomes episodic or semantic memory.
139
+
140
+ ### Routing policy
141
+ `MemoryRoutingPolicy` decides where a memory should be written:
142
+ - **Hot** metadata store
143
+ - **Vector index**
144
+ - **Feature store** (perceptual)
145
+ - **Cold** archive (via workers)
146
+
147
+ ## Background Workers
148
+ - `ConsolidationWorker`: working -> episodic/semantic
149
+ - `ArchiverWorker`: hot -> cold + archive index
150
+ - `RehydratorWorker`: cold -> hot (based on access)
151
+ - `Compactor`: cleanup/TTL
152
+
153
+
155
154
  ## Data Stores
156
155
  - **Hot metadata**: `.memoryagent_hot.sqlite`
157
156
  - **Vector index**: `.memoryagent_vectors.sqlite` (sqlite-vec)
158
157
  - **Features**: `.memoryagent_features.sqlite`
159
158
  - **Cold archive**: `.memoryagent_cold/records/<owner>/YYYY/MM/DD/daily_notes.json`
160
159
 
160
+ ## Data Root (Installed Usage)
161
+ 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.
162
+
163
+
161
164
  ## Configuration
162
165
  See `memoryagent/config.py` for defaults:
163
166
  - `working_ttl_seconds`
@@ -169,3 +172,4 @@ See `memoryagent/config.py` for defaults:
169
172
  - Episodic/semantic memories are candidates for cold archive.
170
173
 
171
174
  ## License
175
+ MIT License
@@ -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.3
4
4
  Summary: Add your description here
5
5
  Author-email: Jiawei Zheng <jw.zhengai@gmail.com>
6
6
  License: MIT
@@ -13,10 +13,8 @@ Requires-Dist: openai>=2.16.0
13
13
  Requires-Dist: pydantic>=2.0
14
14
  Requires-Dist: sqlite-vec>=0.1.6
15
15
 
16
- #
17
-
18
16
  <div align="center">
19
- <img src="https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/refs/heads/master/memoryagent_logo.jpg?token=GHSAT0AAAAAADSXDGNDXIWZF42E6S3D2XPG2MDPSDQ" alt="MemoryAgent" width="500">
17
+ <img src="https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/refs/heads/master/memoryagent_logo.jpg" alt="MemoryAgent" width="500">
20
18
  <h1>MemoryAgent: An Open, Modular Memory Framework for Agents (Beta)</h1>
21
19
  </div>
22
20
 
@@ -123,23 +121,6 @@ config = MemorySystemConfig(
123
121
  )
124
122
  ```
125
123
 
126
- ## Policies
127
- ### Conversation storage policy
128
- `HeuristicMemoryPolicy` decides whether a turn should be stored and whether it becomes episodic or semantic memory.
129
-
130
- ### Routing policy
131
- `MemoryRoutingPolicy` decides where a memory should be written:
132
- - **Hot** metadata store
133
- - **Vector index**
134
- - **Feature store** (perceptual)
135
- - **Cold** archive (via workers)
136
-
137
- ## Background Workers
138
- - `ConsolidationWorker`: working → episodic/semantic
139
- - `ArchiverWorker`: hot → cold + archive index
140
- - `RehydratorWorker`: cold → hot (based on access)
141
- - `Compactor`: cleanup/TTL
142
-
143
124
  ## Examples
144
125
  ### OpenAI Agent (CLI)
145
126
  ```bash
@@ -160,19 +141,41 @@ http://127.0.0.1:8000/memory_viz.html
160
141
 
161
142
  An example (System records semantic memory and updating working memory):
162
143
 
163
- ![Screenshot](https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/master/Memory%20Agent%20_%20Live%20Console.jpeg?token=GHSAT0AAAAAADSXDGNDWOWFKKV777VMZM6U2MDPSTQ)
144
+ ![Screenshot](https://raw.githubusercontent.com/jia-wei-zheng/MemoryAgent/457c3fdadc099727b337838634b9ca3a4ec89fe8/Memory%20Agent%20_%20Live%20Console.jpeg)
164
145
 
165
146
 
166
147
  The page calls:
167
148
  - `GET /api/memory?owner=user-001`
168
149
  - `POST /api/chat`
169
150
 
151
+ ## Policies
152
+ ### Conversation storage policy
153
+ `HeuristicMemoryPolicy` decides whether a turn should be stored and whether it becomes episodic or semantic memory.
154
+
155
+ ### Routing policy
156
+ `MemoryRoutingPolicy` decides where a memory should be written:
157
+ - **Hot** metadata store
158
+ - **Vector index**
159
+ - **Feature store** (perceptual)
160
+ - **Cold** archive (via workers)
161
+
162
+ ## Background Workers
163
+ - `ConsolidationWorker`: working -> episodic/semantic
164
+ - `ArchiverWorker`: hot -> cold + archive index
165
+ - `RehydratorWorker`: cold -> hot (based on access)
166
+ - `Compactor`: cleanup/TTL
167
+
168
+
170
169
  ## Data Stores
171
170
  - **Hot metadata**: `.memoryagent_hot.sqlite`
172
171
  - **Vector index**: `.memoryagent_vectors.sqlite` (sqlite-vec)
173
172
  - **Features**: `.memoryagent_features.sqlite`
174
173
  - **Cold archive**: `.memoryagent_cold/records/<owner>/YYYY/MM/DD/daily_notes.json`
175
174
 
175
+ ## Data Root (Installed Usage)
176
+ 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.
177
+
178
+
176
179
  ## Configuration
177
180
  See `memoryagent/config.py` for defaults:
178
181
  - `working_ttl_seconds`
@@ -184,3 +187,4 @@ See `memoryagent/config.py` for defaults:
184
187
  - Episodic/semantic memories are candidates for cold archive.
185
188
 
186
189
  ## License
190
+ MIT License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "memoryagent-lib"
3
- version = "0.1.1"
3
+ version = "0.1.3"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"