rotalabs-fieldmem 0.1.0__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 (103) hide show
  1. rotalabs_fieldmem-0.1.0/.coverage +0 -0
  2. rotalabs_fieldmem-0.1.0/.github/workflows/docs.yml +59 -0
  3. rotalabs_fieldmem-0.1.0/.gitignore +6 -0
  4. rotalabs_fieldmem-0.1.0/PKG-INFO +283 -0
  5. rotalabs_fieldmem-0.1.0/README.md +230 -0
  6. rotalabs_fieldmem-0.1.0/docs/api/agents.md +15 -0
  7. rotalabs_fieldmem-0.1.0/docs/api/fields.md +11 -0
  8. rotalabs_fieldmem-0.1.0/docs/api/index.md +22 -0
  9. rotalabs_fieldmem-0.1.0/docs/api/memory.md +15 -0
  10. rotalabs_fieldmem-0.1.0/docs/api/multi-agent.md +37 -0
  11. rotalabs_fieldmem-0.1.0/docs/assets/logo-icon-light.png +0 -0
  12. rotalabs_fieldmem-0.1.0/docs/assets/logo-light-full.png +0 -0
  13. rotalabs_fieldmem-0.1.0/docs/getting-started.md +99 -0
  14. rotalabs_fieldmem-0.1.0/docs/index.md +65 -0
  15. rotalabs_fieldmem-0.1.0/mkdocs.yml +87 -0
  16. rotalabs_fieldmem-0.1.0/pyproject.toml +113 -0
  17. rotalabs_fieldmem-0.1.0/site/404.html +603 -0
  18. rotalabs_fieldmem-0.1.0/site/api/agents/index.html +4299 -0
  19. rotalabs_fieldmem-0.1.0/site/api/fields/index.html +2079 -0
  20. rotalabs_fieldmem-0.1.0/site/api/index.html +743 -0
  21. rotalabs_fieldmem-0.1.0/site/api/memory/index.html +1823 -0
  22. rotalabs_fieldmem-0.1.0/site/api/multi-agent/index.html +7432 -0
  23. rotalabs_fieldmem-0.1.0/site/assets/_mkdocstrings.css +213 -0
  24. rotalabs_fieldmem-0.1.0/site/assets/images/favicon.png +0 -0
  25. rotalabs_fieldmem-0.1.0/site/assets/javascripts/bundle.f55a23d4.min.js +16 -0
  26. rotalabs_fieldmem-0.1.0/site/assets/javascripts/bundle.f55a23d4.min.js.map +7 -0
  27. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.ar.min.js +1 -0
  28. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.da.min.js +18 -0
  29. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.de.min.js +18 -0
  30. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.du.min.js +18 -0
  31. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.el.min.js +1 -0
  32. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.es.min.js +18 -0
  33. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.fi.min.js +18 -0
  34. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.fr.min.js +18 -0
  35. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.he.min.js +1 -0
  36. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.hi.min.js +1 -0
  37. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.hu.min.js +18 -0
  38. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.hy.min.js +1 -0
  39. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.it.min.js +18 -0
  40. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.ja.min.js +1 -0
  41. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.jp.min.js +1 -0
  42. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.kn.min.js +1 -0
  43. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.ko.min.js +1 -0
  44. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.multi.min.js +1 -0
  45. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.nl.min.js +18 -0
  46. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.no.min.js +18 -0
  47. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.pt.min.js +18 -0
  48. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.ro.min.js +18 -0
  49. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.ru.min.js +18 -0
  50. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.sa.min.js +1 -0
  51. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.stemmer.support.min.js +1 -0
  52. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.sv.min.js +18 -0
  53. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.ta.min.js +1 -0
  54. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.te.min.js +1 -0
  55. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.th.min.js +1 -0
  56. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.tr.min.js +18 -0
  57. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.vi.min.js +1 -0
  58. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/min/lunr.zh.min.js +1 -0
  59. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/tinyseg.js +206 -0
  60. rotalabs_fieldmem-0.1.0/site/assets/javascripts/lunr/wordcut.js +6708 -0
  61. rotalabs_fieldmem-0.1.0/site/assets/javascripts/workers/search.973d3a69.min.js +42 -0
  62. rotalabs_fieldmem-0.1.0/site/assets/javascripts/workers/search.973d3a69.min.js.map +7 -0
  63. rotalabs_fieldmem-0.1.0/site/assets/stylesheets/main.2a3383ac.min.css +1 -0
  64. rotalabs_fieldmem-0.1.0/site/assets/stylesheets/main.2a3383ac.min.css.map +1 -0
  65. rotalabs_fieldmem-0.1.0/site/assets/stylesheets/palette.06af60db.min.css +1 -0
  66. rotalabs_fieldmem-0.1.0/site/assets/stylesheets/palette.06af60db.min.css.map +1 -0
  67. rotalabs_fieldmem-0.1.0/site/getting-started/index.html +1028 -0
  68. rotalabs_fieldmem-0.1.0/site/index.html +808 -0
  69. rotalabs_fieldmem-0.1.0/site/objects.inv +0 -0
  70. rotalabs_fieldmem-0.1.0/site/search/search_index.json +1 -0
  71. rotalabs_fieldmem-0.1.0/site/sitemap.xml +31 -0
  72. rotalabs_fieldmem-0.1.0/site/sitemap.xml.gz +0 -0
  73. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/__init__.py +80 -0
  74. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/_version.py +3 -0
  75. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/agents/__init__.py +49 -0
  76. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/agents/collective.py +300 -0
  77. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/agents/coordinator.py +497 -0
  78. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/agents/coupling.py +261 -0
  79. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/agents/ftcs_agent.py +700 -0
  80. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/agents/multi_agent.py +411 -0
  81. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/fields/__init__.py +18 -0
  82. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/fields/memory_field.py +434 -0
  83. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/fields/operations.py +0 -0
  84. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/fields/optimized.py +423 -0
  85. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/fields/sparse.py +316 -0
  86. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/integrations/__init__.py +11 -0
  87. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/integrations/vertex_ai.py +0 -0
  88. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/memory/__init__.py +16 -0
  89. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/memory/consolidation.py +0 -0
  90. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/memory/forgetting.py +0 -0
  91. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/memory/importance.py +325 -0
  92. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/utils/__init__.py +38 -0
  93. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/utils/config.py +359 -0
  94. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/utils/embeddings.py +377 -0
  95. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/utils/metrics.py +521 -0
  96. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/utils/persistence.py +510 -0
  97. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/utils/schemas.py +473 -0
  98. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/viz/__init__.py +18 -0
  99. rotalabs_fieldmem-0.1.0/src/rotalabs_fieldmem/viz/plotting.py +411 -0
  100. rotalabs_fieldmem-0.1.0/tests/__init__.py +1 -0
  101. rotalabs_fieldmem-0.1.0/tests/conftest.py +101 -0
  102. rotalabs_fieldmem-0.1.0/tests/test_imports.py +95 -0
  103. rotalabs_fieldmem-0.1.0/tests/test_memory_field.py +409 -0
Binary file
@@ -0,0 +1,59 @@
1
+ name: Deploy Documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - 'docs/**'
9
+ - 'src/**'
10
+ - 'mkdocs.yml'
11
+ - '.github/workflows/docs.yml'
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: read
16
+ pages: write
17
+ id-token: write
18
+
19
+ concurrency:
20
+ group: "pages"
21
+ cancel-in-progress: false
22
+
23
+ jobs:
24
+ build:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - name: Checkout
28
+ uses: actions/checkout@v4
29
+
30
+ - name: Setup Python
31
+ uses: actions/setup-python@v5
32
+ with:
33
+ python-version: '3.11'
34
+
35
+ - name: Install dependencies
36
+ run: |
37
+ pip install -e ".[docs]"
38
+
39
+ - name: Build documentation
40
+ run: mkdocs build
41
+
42
+ - name: Setup Pages
43
+ uses: actions/configure-pages@v4
44
+
45
+ - name: Upload artifact
46
+ uses: actions/upload-pages-artifact@v3
47
+ with:
48
+ path: site
49
+
50
+ deploy:
51
+ environment:
52
+ name: github-pages
53
+ url: ${{ steps.deployment.outputs.page_url }}
54
+ runs-on: ubuntu-latest
55
+ needs: build
56
+ steps:
57
+ - name: Deploy to GitHub Pages
58
+ id: deployment
59
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,6 @@
1
+ dist/
2
+ build/
3
+ *.egg-info/
4
+ __pycache__/
5
+ .venv/
6
+ *.pyc
@@ -0,0 +1,283 @@
1
+ Metadata-Version: 2.4
2
+ Name: rotalabs-fieldmem
3
+ Version: 0.1.0
4
+ Summary: Field-Theoretic Memory System - PDE-based memory for AI agents with natural diffusion and thermodynamic forgetting
5
+ Project-URL: Homepage, https://rotalabs.ai
6
+ Project-URL: Repository, https://github.com/rotalabs/rotalabs-fieldmem
7
+ Project-URL: Documentation, https://rotalabs.github.io/rotalabs-fieldmem/
8
+ Author-email: Subhadip Mitra <subhadip@rotalabs.ai>, Rotalabs Research <research@rotalabs.ai>
9
+ License-Expression: MIT
10
+ Keywords: agent-memory,ai-memory,collective-intelligence,field-theory,jax,pde,temporal-memory
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.9
22
+ Requires-Dist: jax>=0.4.0
23
+ Requires-Dist: jaxlib>=0.4.0
24
+ Requires-Dist: numpy>=1.24.0
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: scipy>=1.10.0
27
+ Provides-Extra: all
28
+ Requires-Dist: google-cloud-aiplatform>=1.38.0; extra == 'all'
29
+ Requires-Dist: google-generativeai>=0.3.0; extra == 'all'
30
+ Requires-Dist: matplotlib>=3.7.0; extra == 'all'
31
+ Requires-Dist: seaborn>=0.12.0; extra == 'all'
32
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'all'
33
+ Provides-Extra: dev
34
+ Requires-Dist: black>=23.0.0; extra == 'dev'
35
+ Requires-Dist: mypy>=1.5.0; extra == 'dev'
36
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
37
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
38
+ Requires-Dist: pytest>=7.4.0; extra == 'dev'
39
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
40
+ Provides-Extra: docs
41
+ Requires-Dist: mkdocs-material>=9.4.0; extra == 'docs'
42
+ Requires-Dist: mkdocs>=1.5.0; extra == 'docs'
43
+ Requires-Dist: mkdocstrings[python]>=0.24.0; extra == 'docs'
44
+ Provides-Extra: embeddings
45
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'embeddings'
46
+ Provides-Extra: gcp
47
+ Requires-Dist: google-cloud-aiplatform>=1.38.0; extra == 'gcp'
48
+ Requires-Dist: google-generativeai>=0.3.0; extra == 'gcp'
49
+ Provides-Extra: viz
50
+ Requires-Dist: matplotlib>=3.7.0; extra == 'viz'
51
+ Requires-Dist: seaborn>=0.12.0; extra == 'viz'
52
+ Description-Content-Type: text/markdown
53
+
54
+ # rotalabs-fieldmem
55
+
56
+ Field-Theoretic Memory System - Field-theoretic memory for AI agents with natural decay and consolidation.
57
+
58
+ [![PyPI version](https://badge.fury.io/py/rotalabs-fieldmem.svg)](https://badge.fury.io/py/rotalabs-fieldmem)
59
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
60
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
61
+
62
+ ## Overview
63
+
64
+ FieldMem implements a physics-inspired approach to AI memory, treating memories as continuous fields that evolve according to partial differential equations. This enables:
65
+
66
+ - **Natural forgetting**: Memories decay over time following thermodynamic principles
67
+ - **Semantic diffusion**: Related memories influence each other spatially
68
+ - **Importance-weighted retention**: Important memories resist decay
69
+ - **Collective intelligence**: Multi-agent memory sharing through field coupling
70
+
71
+ Based on the heat equation:
72
+
73
+ ```
74
+ ∂u/∂t = α∇²u - γu + η(t)
75
+ ```
76
+
77
+ Where:
78
+ - `u`: Memory field state
79
+ - `α`: Diffusion rate (memory spreading)
80
+ - `γ`: Decay rate (natural forgetting)
81
+ - `η(t)`: Thermal noise (stochastic fluctuations)
82
+
83
+ ## Installation
84
+
85
+ ```bash
86
+ pip install rotalabs-fieldmem
87
+ ```
88
+
89
+ ### Optional dependencies
90
+
91
+ ```bash
92
+ # For sentence-transformers embeddings
93
+ pip install rotalabs-fieldmem[embeddings]
94
+
95
+ # For visualization
96
+ pip install rotalabs-fieldmem[viz]
97
+
98
+ # For Google Cloud/Vertex AI integration
99
+ pip install rotalabs-fieldmem[gcp]
100
+
101
+ # All optional dependencies
102
+ pip install rotalabs-fieldmem[all]
103
+ ```
104
+
105
+ ## Quick Start
106
+
107
+ ### Basic Memory Field
108
+
109
+ ```python
110
+ from rotalabs_fieldmem import MemoryField, FieldConfig
111
+
112
+ # Create a memory field
113
+ config = FieldConfig(
114
+ shape=(128, 128),
115
+ diffusion_rate=0.01,
116
+ temperature=0.05,
117
+ )
118
+ field = MemoryField(config)
119
+
120
+ # Inject a memory
121
+ import jax.numpy as jnp
122
+ embedding = jnp.ones(64) # Example embedding
123
+ field.inject_memory(embedding, position=(64, 64), importance=0.8)
124
+
125
+ # Evolve the field (memories diffuse and decay)
126
+ field.step()
127
+
128
+ # Query memories
129
+ values, positions = field.query_memories(embedding, k=5)
130
+ ```
131
+
132
+ ### FTCS Agent
133
+
134
+ ```python
135
+ from rotalabs_fieldmem import FTCSAgent, AgentConfig
136
+
137
+ # Create an agent with field-theoretic memory
138
+ config = AgentConfig(
139
+ memory_field_shape=(128, 128),
140
+ diffusion_rate=0.003,
141
+ temperature=0.05,
142
+ )
143
+ agent = FTCSAgent(agent_id="agent_1", config=config)
144
+
145
+ # Store memories
146
+ agent.store_memory("The capital of France is Paris.", importance=0.9)
147
+ agent.store_memory("Python is a programming language.", importance=0.7)
148
+
149
+ # Retrieve relevant memories
150
+ results = agent.retrieve_memories("What European capitals do you know?")
151
+ for memory in results:
152
+ print(f"- {memory['content']} (score: {memory['combined_score']:.2f})")
153
+ ```
154
+
155
+ ### Importance Scoring
156
+
157
+ ```python
158
+ from rotalabs_fieldmem import SemanticImportanceAnalyzer, QuickImportanceScorer
159
+
160
+ # Detailed semantic analysis
161
+ analyzer = SemanticImportanceAnalyzer()
162
+ scores = analyzer.analyze("URGENT: Meeting tomorrow at 3 PM!")
163
+ print(f"Total importance: {scores.total:.2f}")
164
+ print(f"Temporal score: {scores.temporal:.2f}")
165
+
166
+ # Quick scoring for real-time use
167
+ scorer = QuickImportanceScorer()
168
+ importance = scorer.compute_importance("Remember to call John Smith.")
169
+ ```
170
+
171
+ ## Key Features
172
+
173
+ ### 1. Field-Theoretic Memory
174
+
175
+ Memories are stored as energy distributions in a continuous field that evolves over time:
176
+
177
+ - **Diffusion**: Memories spread to nearby regions, creating semantic neighborhoods
178
+ - **Decay**: Low-importance memories fade naturally
179
+ - **Noise**: Thermal fluctuations add stochastic forgetting
180
+
181
+ ### 2. Importance-Weighted Dynamics
182
+
183
+ The `SemanticImportanceAnalyzer` scores memories based on:
184
+
185
+ - **Entity detection**: Names, dates, locations
186
+ - **Causal relationships**: "because", "therefore", "leads to"
187
+ - **Temporal markers**: Deadlines, urgency, recurring events
188
+ - **Instructional content**: How-to, step-by-step procedures
189
+ - **Emotional significance**: Personal preferences, strong opinions
190
+
191
+ ### 3. Multi-Agent Collective Intelligence
192
+
193
+ ```python
194
+ from rotalabs_fieldmem import MultiAgentSystem, MultiAgentConfig
195
+
196
+ # Create a multi-agent system
197
+ config = MultiAgentConfig(
198
+ num_agents=4,
199
+ consensus_threshold=0.6,
200
+ )
201
+ system = MultiAgentSystem(config)
202
+
203
+ # Agents share knowledge through field coupling
204
+ response = system.collective_query("What do we know about machine learning?")
205
+ ```
206
+
207
+ ### 4. Field Coupling Topologies
208
+
209
+ - **Fully Connected**: All agents share equally
210
+ - **Nearest Neighbor**: Spatial locality
211
+ - **Small World**: Local + random long-range connections
212
+ - **Adaptive**: Coupling strength based on semantic similarity
213
+
214
+ ## Architecture
215
+
216
+ ```
217
+ src/rotalabs_fieldmem/
218
+ ├── fields/ # Core field implementations
219
+ │ ├── memory_field.py # PDE-based memory field
220
+ │ ├── sparse.py # Sparse optimization (42x memory reduction)
221
+ │ └── operations.py # Field operations
222
+ ├── agents/ # FieldMem-enabled agents
223
+ │ ├── ftcs_agent.py # Single agent
224
+ │ ├── multi_agent.py # Multi-agent system
225
+ │ ├── coordinator.py # Agent coordination
226
+ │ ├── collective.py # Collective memory pool
227
+ │ └── coupling.py # Field coupling
228
+ ├── memory/ # Memory processing
229
+ │ ├── importance.py # Semantic importance scoring
230
+ │ ├── consolidation.py # Memory consolidation
231
+ │ └── forgetting.py # Thermodynamic forgetting
232
+ ├── utils/ # Utilities
233
+ │ ├── metrics.py # Quality metrics
234
+ │ ├── embeddings.py # Embedding management
235
+ │ └── persistence.py # State persistence
236
+ └── viz/ # Visualization (optional)
237
+ └── plotting.py # Field visualization
238
+ ```
239
+
240
+ ## Benchmark Results
241
+
242
+ Evaluated on standard long-context conversation benchmarks:
243
+
244
+ ### LongMemEval (ICLR 2025)
245
+
246
+ | Memory Ability | FieldMem | Baseline | Improvement | Significance |
247
+ |----------------|----------|----------|-------------|--------------|
248
+ | Multi-session | 0.042 F1 | 0.020 F1 | **+116%** | p<0.01, d=3.06 |
249
+ | Temporal reasoning | 0.120 F1 | 0.084 F1 | **+43.8%** | p<0.001, d=9.21 |
250
+ | Preference tracking | 0.268 F1 | 0.168 F1 | **+59.1%** | p<0.001, d=8.96 |
251
+ | Knowledge update | 0.147 recall | 0.115 recall | **+27.8%** | p<0.001 |
252
+
253
+ ### LoCoMo (ACL 2024)
254
+
255
+ | Category | FieldMem | Baseline | Improvement |
256
+ |----------|----------|----------|-------------|
257
+ | Category 3 (F1) | 0.017 | 0.016 | +9.5%* (p<0.05) |
258
+ | Category 4 (EM) | 0.271 | 0.256 | +6.1% |
259
+
260
+ ### Computational Performance
261
+
262
+ | Metric | FieldMem | Traditional |
263
+ |--------|----------|-------------|
264
+ | Memory efficiency | 42x reduction | baseline |
265
+ | JAX JIT speedup | 518x | baseline |
266
+ | Multi-agent sharing | Native | Manual |
267
+
268
+ ## Scientific Background
269
+
270
+ FieldMem builds on the Field-Theoretic Context System (FTCS) published in [Technical Disclosure Commons](https://www.tdcommons.org/dpubs_series/8022/). The full methodology and benchmark analysis are available in our arXiv paper.
271
+
272
+ ## Links
273
+
274
+ - **Paper**: [arXiv:cs.ET](https://arxiv.org/) (FieldMem: Field-Theoretic Memory for AI Agents)
275
+ - **Prior Work**: [FTCS Technical Disclosure](https://www.tdcommons.org/dpubs_series/8022/)
276
+ - Website: https://rotalabs.ai
277
+ - GitHub: https://github.com/rotalabs/rotalabs-fieldmem
278
+ - Documentation: https://rotalabs.github.io/rotalabs-fieldmem/
279
+ - Contact: research@rotalabs.ai
280
+
281
+ ## License
282
+
283
+ MIT License - see LICENSE for details.
@@ -0,0 +1,230 @@
1
+ # rotalabs-fieldmem
2
+
3
+ Field-Theoretic Memory System - Field-theoretic memory for AI agents with natural decay and consolidation.
4
+
5
+ [![PyPI version](https://badge.fury.io/py/rotalabs-fieldmem.svg)](https://badge.fury.io/py/rotalabs-fieldmem)
6
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## Overview
10
+
11
+ FieldMem implements a physics-inspired approach to AI memory, treating memories as continuous fields that evolve according to partial differential equations. This enables:
12
+
13
+ - **Natural forgetting**: Memories decay over time following thermodynamic principles
14
+ - **Semantic diffusion**: Related memories influence each other spatially
15
+ - **Importance-weighted retention**: Important memories resist decay
16
+ - **Collective intelligence**: Multi-agent memory sharing through field coupling
17
+
18
+ Based on the heat equation:
19
+
20
+ ```
21
+ ∂u/∂t = α∇²u - γu + η(t)
22
+ ```
23
+
24
+ Where:
25
+ - `u`: Memory field state
26
+ - `α`: Diffusion rate (memory spreading)
27
+ - `γ`: Decay rate (natural forgetting)
28
+ - `η(t)`: Thermal noise (stochastic fluctuations)
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install rotalabs-fieldmem
34
+ ```
35
+
36
+ ### Optional dependencies
37
+
38
+ ```bash
39
+ # For sentence-transformers embeddings
40
+ pip install rotalabs-fieldmem[embeddings]
41
+
42
+ # For visualization
43
+ pip install rotalabs-fieldmem[viz]
44
+
45
+ # For Google Cloud/Vertex AI integration
46
+ pip install rotalabs-fieldmem[gcp]
47
+
48
+ # All optional dependencies
49
+ pip install rotalabs-fieldmem[all]
50
+ ```
51
+
52
+ ## Quick Start
53
+
54
+ ### Basic Memory Field
55
+
56
+ ```python
57
+ from rotalabs_fieldmem import MemoryField, FieldConfig
58
+
59
+ # Create a memory field
60
+ config = FieldConfig(
61
+ shape=(128, 128),
62
+ diffusion_rate=0.01,
63
+ temperature=0.05,
64
+ )
65
+ field = MemoryField(config)
66
+
67
+ # Inject a memory
68
+ import jax.numpy as jnp
69
+ embedding = jnp.ones(64) # Example embedding
70
+ field.inject_memory(embedding, position=(64, 64), importance=0.8)
71
+
72
+ # Evolve the field (memories diffuse and decay)
73
+ field.step()
74
+
75
+ # Query memories
76
+ values, positions = field.query_memories(embedding, k=5)
77
+ ```
78
+
79
+ ### FTCS Agent
80
+
81
+ ```python
82
+ from rotalabs_fieldmem import FTCSAgent, AgentConfig
83
+
84
+ # Create an agent with field-theoretic memory
85
+ config = AgentConfig(
86
+ memory_field_shape=(128, 128),
87
+ diffusion_rate=0.003,
88
+ temperature=0.05,
89
+ )
90
+ agent = FTCSAgent(agent_id="agent_1", config=config)
91
+
92
+ # Store memories
93
+ agent.store_memory("The capital of France is Paris.", importance=0.9)
94
+ agent.store_memory("Python is a programming language.", importance=0.7)
95
+
96
+ # Retrieve relevant memories
97
+ results = agent.retrieve_memories("What European capitals do you know?")
98
+ for memory in results:
99
+ print(f"- {memory['content']} (score: {memory['combined_score']:.2f})")
100
+ ```
101
+
102
+ ### Importance Scoring
103
+
104
+ ```python
105
+ from rotalabs_fieldmem import SemanticImportanceAnalyzer, QuickImportanceScorer
106
+
107
+ # Detailed semantic analysis
108
+ analyzer = SemanticImportanceAnalyzer()
109
+ scores = analyzer.analyze("URGENT: Meeting tomorrow at 3 PM!")
110
+ print(f"Total importance: {scores.total:.2f}")
111
+ print(f"Temporal score: {scores.temporal:.2f}")
112
+
113
+ # Quick scoring for real-time use
114
+ scorer = QuickImportanceScorer()
115
+ importance = scorer.compute_importance("Remember to call John Smith.")
116
+ ```
117
+
118
+ ## Key Features
119
+
120
+ ### 1. Field-Theoretic Memory
121
+
122
+ Memories are stored as energy distributions in a continuous field that evolves over time:
123
+
124
+ - **Diffusion**: Memories spread to nearby regions, creating semantic neighborhoods
125
+ - **Decay**: Low-importance memories fade naturally
126
+ - **Noise**: Thermal fluctuations add stochastic forgetting
127
+
128
+ ### 2. Importance-Weighted Dynamics
129
+
130
+ The `SemanticImportanceAnalyzer` scores memories based on:
131
+
132
+ - **Entity detection**: Names, dates, locations
133
+ - **Causal relationships**: "because", "therefore", "leads to"
134
+ - **Temporal markers**: Deadlines, urgency, recurring events
135
+ - **Instructional content**: How-to, step-by-step procedures
136
+ - **Emotional significance**: Personal preferences, strong opinions
137
+
138
+ ### 3. Multi-Agent Collective Intelligence
139
+
140
+ ```python
141
+ from rotalabs_fieldmem import MultiAgentSystem, MultiAgentConfig
142
+
143
+ # Create a multi-agent system
144
+ config = MultiAgentConfig(
145
+ num_agents=4,
146
+ consensus_threshold=0.6,
147
+ )
148
+ system = MultiAgentSystem(config)
149
+
150
+ # Agents share knowledge through field coupling
151
+ response = system.collective_query("What do we know about machine learning?")
152
+ ```
153
+
154
+ ### 4. Field Coupling Topologies
155
+
156
+ - **Fully Connected**: All agents share equally
157
+ - **Nearest Neighbor**: Spatial locality
158
+ - **Small World**: Local + random long-range connections
159
+ - **Adaptive**: Coupling strength based on semantic similarity
160
+
161
+ ## Architecture
162
+
163
+ ```
164
+ src/rotalabs_fieldmem/
165
+ ├── fields/ # Core field implementations
166
+ │ ├── memory_field.py # PDE-based memory field
167
+ │ ├── sparse.py # Sparse optimization (42x memory reduction)
168
+ │ └── operations.py # Field operations
169
+ ├── agents/ # FieldMem-enabled agents
170
+ │ ├── ftcs_agent.py # Single agent
171
+ │ ├── multi_agent.py # Multi-agent system
172
+ │ ├── coordinator.py # Agent coordination
173
+ │ ├── collective.py # Collective memory pool
174
+ │ └── coupling.py # Field coupling
175
+ ├── memory/ # Memory processing
176
+ │ ├── importance.py # Semantic importance scoring
177
+ │ ├── consolidation.py # Memory consolidation
178
+ │ └── forgetting.py # Thermodynamic forgetting
179
+ ├── utils/ # Utilities
180
+ │ ├── metrics.py # Quality metrics
181
+ │ ├── embeddings.py # Embedding management
182
+ │ └── persistence.py # State persistence
183
+ └── viz/ # Visualization (optional)
184
+ └── plotting.py # Field visualization
185
+ ```
186
+
187
+ ## Benchmark Results
188
+
189
+ Evaluated on standard long-context conversation benchmarks:
190
+
191
+ ### LongMemEval (ICLR 2025)
192
+
193
+ | Memory Ability | FieldMem | Baseline | Improvement | Significance |
194
+ |----------------|----------|----------|-------------|--------------|
195
+ | Multi-session | 0.042 F1 | 0.020 F1 | **+116%** | p<0.01, d=3.06 |
196
+ | Temporal reasoning | 0.120 F1 | 0.084 F1 | **+43.8%** | p<0.001, d=9.21 |
197
+ | Preference tracking | 0.268 F1 | 0.168 F1 | **+59.1%** | p<0.001, d=8.96 |
198
+ | Knowledge update | 0.147 recall | 0.115 recall | **+27.8%** | p<0.001 |
199
+
200
+ ### LoCoMo (ACL 2024)
201
+
202
+ | Category | FieldMem | Baseline | Improvement |
203
+ |----------|----------|----------|-------------|
204
+ | Category 3 (F1) | 0.017 | 0.016 | +9.5%* (p<0.05) |
205
+ | Category 4 (EM) | 0.271 | 0.256 | +6.1% |
206
+
207
+ ### Computational Performance
208
+
209
+ | Metric | FieldMem | Traditional |
210
+ |--------|----------|-------------|
211
+ | Memory efficiency | 42x reduction | baseline |
212
+ | JAX JIT speedup | 518x | baseline |
213
+ | Multi-agent sharing | Native | Manual |
214
+
215
+ ## Scientific Background
216
+
217
+ FieldMem builds on the Field-Theoretic Context System (FTCS) published in [Technical Disclosure Commons](https://www.tdcommons.org/dpubs_series/8022/). The full methodology and benchmark analysis are available in our arXiv paper.
218
+
219
+ ## Links
220
+
221
+ - **Paper**: [arXiv:cs.ET](https://arxiv.org/) (FieldMem: Field-Theoretic Memory for AI Agents)
222
+ - **Prior Work**: [FTCS Technical Disclosure](https://www.tdcommons.org/dpubs_series/8022/)
223
+ - Website: https://rotalabs.ai
224
+ - GitHub: https://github.com/rotalabs/rotalabs-fieldmem
225
+ - Documentation: https://rotalabs.github.io/rotalabs-fieldmem/
226
+ - Contact: research@rotalabs.ai
227
+
228
+ ## License
229
+
230
+ MIT License - see LICENSE for details.
@@ -0,0 +1,15 @@
1
+ # Agents
2
+
3
+ FTCS agents with field-theoretic memory capabilities.
4
+
5
+ ## AgentConfig
6
+
7
+ ::: rotalabs_ftms.agents.ftcs_agent.AgentConfig
8
+
9
+ ## MemoryEntry
10
+
11
+ ::: rotalabs_ftms.agents.ftcs_agent.MemoryEntry
12
+
13
+ ## FTCSAgent
14
+
15
+ ::: rotalabs_ftms.agents.ftcs_agent.FTCSAgent
@@ -0,0 +1,11 @@
1
+ # Fields
2
+
3
+ Memory field implementations based on PDE solvers.
4
+
5
+ ## FieldConfig
6
+
7
+ ::: rotalabs_ftms.fields.memory_field.FieldConfig
8
+
9
+ ## MemoryField
10
+
11
+ ::: rotalabs_ftms.fields.memory_field.MemoryField
@@ -0,0 +1,22 @@
1
+ # API Reference
2
+
3
+ This section contains the complete API reference for rotalabs-ftms, auto-generated from the source code docstrings.
4
+
5
+ ## Package Structure
6
+
7
+ ```
8
+ rotalabs_ftms/
9
+ ├── fields/ # Memory field implementations
10
+ ├── agents/ # FTCS agents and multi-agent systems
11
+ ├── memory/ # Importance scoring and analysis
12
+ ├── utils/ # Utilities and helpers
13
+ ├── integrations/ # External integrations
14
+ └── viz/ # Visualization tools
15
+ ```
16
+
17
+ ## Quick Links
18
+
19
+ - [Fields](fields.md) - Memory field implementations (MemoryField, SparseMemoryField)
20
+ - [Agents](agents.md) - FTCS agent and configuration
21
+ - [Memory](memory.md) - Importance scoring and analysis
22
+ - [Multi-Agent](multi-agent.md) - Multi-agent coordination systems
@@ -0,0 +1,15 @@
1
+ # Memory
2
+
3
+ Importance scoring and memory analysis utilities.
4
+
5
+ ## ImportanceScores
6
+
7
+ ::: rotalabs_ftms.memory.importance.ImportanceScores
8
+
9
+ ## SemanticImportanceAnalyzer
10
+
11
+ ::: rotalabs_ftms.memory.importance.SemanticImportanceAnalyzer
12
+
13
+ ## QuickImportanceScorer
14
+
15
+ ::: rotalabs_ftms.memory.importance.QuickImportanceScorer
@@ -0,0 +1,37 @@
1
+ # Multi-Agent Systems
2
+
3
+ Multi-agent coordination, field coupling, and collective memory.
4
+
5
+ ## MultiAgentConfig
6
+
7
+ ::: rotalabs_ftms.agents.multi_agent.MultiAgentConfig
8
+
9
+ ## MultiAgentSystem
10
+
11
+ ::: rotalabs_ftms.agents.multi_agent.MultiAgentSystem
12
+
13
+ ## Field Coupling
14
+
15
+ ### CouplingTopology
16
+
17
+ ::: rotalabs_ftms.agents.coupling.CouplingTopology
18
+
19
+ ### CouplingConfig
20
+
21
+ ::: rotalabs_ftms.agents.coupling.CouplingConfig
22
+
23
+ ### FieldCoupler
24
+
25
+ ::: rotalabs_ftms.agents.coupling.FieldCoupler
26
+
27
+ ## Collective Memory
28
+
29
+ ### CollectiveMemoryPool
30
+
31
+ ::: rotalabs_ftms.agents.collective.CollectiveMemoryPool
32
+
33
+ ## Coordination
34
+
35
+ ### MultiAgentCoordinator
36
+
37
+ ::: rotalabs_ftms.agents.coordinator.MultiAgentCoordinator