cuemap 0.6.1__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.
cuemap-0.6.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 CueMap
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ recursive-include cuemap *.py
5
+ recursive-include examples *.py
6
+ prune tests
7
+ prune __pycache__
8
+ global-exclude *.pyc
cuemap-0.6.1/PKG-INFO ADDED
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: cuemap
3
+ Version: 0.6.1
4
+ Summary: CueMap Python SDK - High-performance temporal-associative memory
5
+ Author-email: CueMap Team <hello@cuemap.dev>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/cuemap-dev/sdks
8
+ Project-URL: Documentation, https://github.com/cuemap-dev/sdks/blob/main/python/README.md
9
+ Project-URL: Repository, https://github.com/cuemap-dev/sdks
10
+ Project-URL: Issues, https://github.com/cuemap-dev/sdks/issues
11
+ Project-URL: Engine, https://github.com/cuemap-dev/engine
12
+ Keywords: ai,memory,agents,temporal,associative,llm,rag
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: httpx>=0.25.0
28
+ Requires-Dist: pydantic>=2.0.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
31
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
32
+ Requires-Dist: build>=1.0.0; extra == "dev"
33
+ Requires-Dist: twine>=4.0.0; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ # CueMap Python SDK
37
+
38
+ **High-performance temporal-associative memory store** that mimics the brain's recall mechanism.
39
+
40
+ ## Overview
41
+
42
+ CueMap implements a **Continuous Gradient Algorithm** inspired by biological memory:
43
+
44
+ 1. **Intersection (Context Filter)**: Triangulates relevant memories by overlapping cues
45
+ 2. **Pattern Completion (Associative Recall)**: Automatically infers missing cues from co-occurrence history, enabling recall from partial inputs.
46
+ 3. **Recency & Salience (Signal Dynamics)**: Balances fresh data with salient, high-signal events prioritized by the Amygdala-inspired salience module.
47
+ 4. **Reinforcement (Hebbian Learning)**: Frequently accessed memories gain signal strength, staying "front of mind".
48
+ 5. **Autonomous Consolidation**: Periodically merges overlapping memories into summaries, mimicking systems consolidation.
49
+
50
+ ## Installation
51
+
52
+ ```bash
53
+ pip install cuemap
54
+ ```
55
+
56
+ ## Quick Start
57
+
58
+ ### 1. Start the Engine
59
+
60
+ ```bash
61
+ docker run -p 8080:8080 cuemap/engine:latest
62
+ ```
63
+
64
+ ### 2. Basic Usage
65
+
66
+ ```python
67
+ from cuemap import CueMap
68
+
69
+ client = CueMap()
70
+
71
+ # Add a memory (auto-cue generation by default using internal Semantic Engine)
72
+ client.add("The server password is abc123")
73
+
74
+ # Recall by natural language (resolves via Lexicon)
75
+ results = client.recall("server credentials")
76
+ print(results[0].content)
77
+ # Output: "The server password is abc123"
78
+ ```
79
+
80
+ ## Core API
81
+
82
+ ### Add Memory
83
+
84
+ ```python
85
+ # Manual cues
86
+ client.add(
87
+ "Meeting with John at 3pm",
88
+ cues=["meeting", "john", "calendar"]
89
+ )
90
+
91
+ # Auto-cues (Semantic Engine)
92
+ client.add("The payments service is down due to a timeout")
93
+ ```
94
+
95
+ ### Recall Memories
96
+
97
+ ```python
98
+ # Natural Language Search (Brain-Inspired)
99
+ results = client.recall(
100
+ "payments failure",
101
+ limit=10,
102
+ explain=True # See how the query was expanded
103
+ )
104
+
105
+ print(results[0].explain)
106
+ # Shows normalized cues, expanded synonyms, etc.
107
+
108
+ # Explicit Cue Search
109
+ results = client.recall(
110
+ cues=["meeting", "john"],
111
+ min_intersection=2
112
+ )
113
+ ```
114
+
115
+ ### Grounded Recall (Hallucination Guardrails)
116
+
117
+ Get verifiable context for LLMs with a strict token budget.
118
+
119
+ ```python
120
+ response = client.recall_grounded(
121
+ query="Why is the payment failing?",
122
+ token_budget=500
123
+ )
124
+
125
+ print(response["verified_context"])
126
+ # [VERIFIED CONTEXT] ...
127
+ print(response["proof"])
128
+ # Cryptographic proof of context retrieval
129
+ ```
130
+
131
+ ### Context Expansion (v0.6.1)
132
+
133
+ Explore related concepts from the cue graph to expand a user's query.
134
+
135
+ ```python
136
+ response = client.context_expand("server hung 137", limit=5)
137
+ # {
138
+ # "query_cues": ["server", "hung", "137"],
139
+ # "expansions": [
140
+ # { "term": "out_of_memory", "score": 25.0, "co_occurrence_count": 12 },
141
+ # { "term": "SIGKILL", "score": 22.0, "co_occurrence_count": 8 }
142
+ # ]
143
+ # }
144
+ ```
145
+
146
+ ### Cloud Backup (v0.6.1)
147
+
148
+ Manage project snapshots in the cloud (S3, GCS, Azure).
149
+
150
+ ```python
151
+ # Upload current project snapshot
152
+ client.backup_upload("default")
153
+
154
+ # Download and restore snapshot
155
+ client.backup_download("default")
156
+
157
+ # List available backups
158
+ backups = client.backup_list()
159
+ ```
160
+
161
+ ### Ingestion (v0.6+)
162
+
163
+ Ingest content from various sources directly.
164
+
165
+ ```python
166
+ # Ingest URL
167
+ client.ingest_url("https://example.com/docs")
168
+
169
+ # Ingest File (PDF, DOCX, etc.)
170
+ client.ingest_file("/path/to/document.pdf")
171
+
172
+ # Ingest Raw Content
173
+ client.ingest_content("Raw text content...", filename="notes.txt")
174
+ ```
175
+
176
+ ### Lexicon Management (v0.6+)
177
+
178
+ Inspect and wire the brain's associations manually.
179
+
180
+ ```python
181
+ # Inspect a cue's relationships
182
+ data = client.lexicon_inspect("service:payment")
183
+ print(f"Synonyms: {data['outgoing']}")
184
+ print(f"Triggers: {data['incoming']}")
185
+
186
+ # Manually wire a token to a concept
187
+ client.lexicon_wire("stripe", "service:payment")
188
+
189
+ # Get synonyms via WordNet
190
+ synonyms = client.lexicon_synonyms("payment")
191
+ ```
192
+
193
+ ### Job Status (v0.6+)
194
+
195
+ Check the progress of background ingestion tasks.
196
+
197
+ ```python
198
+ status = client.jobs_status()
199
+ print(f"Ingested: {status['writes_completed']} / {status['writes_total']}")
200
+ ```
201
+
202
+ ### Advanced Brain Control
203
+
204
+ Disable specific brain modules for deterministic debugging.
205
+
206
+ ```python
207
+ results = client.recall(
208
+ "urgent issue",
209
+ disable_pattern_completion=True, # No associative inference
210
+ disable_salience_bias=True, # No emotional weighting
211
+ disable_systems_consolidation=True, # No gist summaries
212
+ disable_temporal_chunking=True # No episodic grouping
213
+ )
214
+ ```
215
+
216
+ ## Async Support
217
+
218
+ ```python
219
+ from cuemap import AsyncCueMap
220
+
221
+ async with AsyncCueMap() as client:
222
+ await client.add("Note")
223
+ await client.recall(["note"])
224
+ ```
225
+
226
+ ## Performance
227
+
228
+ - **Write Latency**: ~2ms (O(1) complexity)
229
+ - **Read Latency**: ~5-10ms (Raw vs Smart Recall)
230
+
231
+ ## License
232
+
233
+ MIT
cuemap-0.6.1/README.md ADDED
@@ -0,0 +1,198 @@
1
+ # CueMap Python SDK
2
+
3
+ **High-performance temporal-associative memory store** that mimics the brain's recall mechanism.
4
+
5
+ ## Overview
6
+
7
+ CueMap implements a **Continuous Gradient Algorithm** inspired by biological memory:
8
+
9
+ 1. **Intersection (Context Filter)**: Triangulates relevant memories by overlapping cues
10
+ 2. **Pattern Completion (Associative Recall)**: Automatically infers missing cues from co-occurrence history, enabling recall from partial inputs.
11
+ 3. **Recency & Salience (Signal Dynamics)**: Balances fresh data with salient, high-signal events prioritized by the Amygdala-inspired salience module.
12
+ 4. **Reinforcement (Hebbian Learning)**: Frequently accessed memories gain signal strength, staying "front of mind".
13
+ 5. **Autonomous Consolidation**: Periodically merges overlapping memories into summaries, mimicking systems consolidation.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install cuemap
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ ### 1. Start the Engine
24
+
25
+ ```bash
26
+ docker run -p 8080:8080 cuemap/engine:latest
27
+ ```
28
+
29
+ ### 2. Basic Usage
30
+
31
+ ```python
32
+ from cuemap import CueMap
33
+
34
+ client = CueMap()
35
+
36
+ # Add a memory (auto-cue generation by default using internal Semantic Engine)
37
+ client.add("The server password is abc123")
38
+
39
+ # Recall by natural language (resolves via Lexicon)
40
+ results = client.recall("server credentials")
41
+ print(results[0].content)
42
+ # Output: "The server password is abc123"
43
+ ```
44
+
45
+ ## Core API
46
+
47
+ ### Add Memory
48
+
49
+ ```python
50
+ # Manual cues
51
+ client.add(
52
+ "Meeting with John at 3pm",
53
+ cues=["meeting", "john", "calendar"]
54
+ )
55
+
56
+ # Auto-cues (Semantic Engine)
57
+ client.add("The payments service is down due to a timeout")
58
+ ```
59
+
60
+ ### Recall Memories
61
+
62
+ ```python
63
+ # Natural Language Search (Brain-Inspired)
64
+ results = client.recall(
65
+ "payments failure",
66
+ limit=10,
67
+ explain=True # See how the query was expanded
68
+ )
69
+
70
+ print(results[0].explain)
71
+ # Shows normalized cues, expanded synonyms, etc.
72
+
73
+ # Explicit Cue Search
74
+ results = client.recall(
75
+ cues=["meeting", "john"],
76
+ min_intersection=2
77
+ )
78
+ ```
79
+
80
+ ### Grounded Recall (Hallucination Guardrails)
81
+
82
+ Get verifiable context for LLMs with a strict token budget.
83
+
84
+ ```python
85
+ response = client.recall_grounded(
86
+ query="Why is the payment failing?",
87
+ token_budget=500
88
+ )
89
+
90
+ print(response["verified_context"])
91
+ # [VERIFIED CONTEXT] ...
92
+ print(response["proof"])
93
+ # Cryptographic proof of context retrieval
94
+ ```
95
+
96
+ ### Context Expansion (v0.6.1)
97
+
98
+ Explore related concepts from the cue graph to expand a user's query.
99
+
100
+ ```python
101
+ response = client.context_expand("server hung 137", limit=5)
102
+ # {
103
+ # "query_cues": ["server", "hung", "137"],
104
+ # "expansions": [
105
+ # { "term": "out_of_memory", "score": 25.0, "co_occurrence_count": 12 },
106
+ # { "term": "SIGKILL", "score": 22.0, "co_occurrence_count": 8 }
107
+ # ]
108
+ # }
109
+ ```
110
+
111
+ ### Cloud Backup (v0.6.1)
112
+
113
+ Manage project snapshots in the cloud (S3, GCS, Azure).
114
+
115
+ ```python
116
+ # Upload current project snapshot
117
+ client.backup_upload("default")
118
+
119
+ # Download and restore snapshot
120
+ client.backup_download("default")
121
+
122
+ # List available backups
123
+ backups = client.backup_list()
124
+ ```
125
+
126
+ ### Ingestion (v0.6+)
127
+
128
+ Ingest content from various sources directly.
129
+
130
+ ```python
131
+ # Ingest URL
132
+ client.ingest_url("https://example.com/docs")
133
+
134
+ # Ingest File (PDF, DOCX, etc.)
135
+ client.ingest_file("/path/to/document.pdf")
136
+
137
+ # Ingest Raw Content
138
+ client.ingest_content("Raw text content...", filename="notes.txt")
139
+ ```
140
+
141
+ ### Lexicon Management (v0.6+)
142
+
143
+ Inspect and wire the brain's associations manually.
144
+
145
+ ```python
146
+ # Inspect a cue's relationships
147
+ data = client.lexicon_inspect("service:payment")
148
+ print(f"Synonyms: {data['outgoing']}")
149
+ print(f"Triggers: {data['incoming']}")
150
+
151
+ # Manually wire a token to a concept
152
+ client.lexicon_wire("stripe", "service:payment")
153
+
154
+ # Get synonyms via WordNet
155
+ synonyms = client.lexicon_synonyms("payment")
156
+ ```
157
+
158
+ ### Job Status (v0.6+)
159
+
160
+ Check the progress of background ingestion tasks.
161
+
162
+ ```python
163
+ status = client.jobs_status()
164
+ print(f"Ingested: {status['writes_completed']} / {status['writes_total']}")
165
+ ```
166
+
167
+ ### Advanced Brain Control
168
+
169
+ Disable specific brain modules for deterministic debugging.
170
+
171
+ ```python
172
+ results = client.recall(
173
+ "urgent issue",
174
+ disable_pattern_completion=True, # No associative inference
175
+ disable_salience_bias=True, # No emotional weighting
176
+ disable_systems_consolidation=True, # No gist summaries
177
+ disable_temporal_chunking=True # No episodic grouping
178
+ )
179
+ ```
180
+
181
+ ## Async Support
182
+
183
+ ```python
184
+ from cuemap import AsyncCueMap
185
+
186
+ async with AsyncCueMap() as client:
187
+ await client.add("Note")
188
+ await client.recall(["note"])
189
+ ```
190
+
191
+ ## Performance
192
+
193
+ - **Write Latency**: ~2ms (O(1) complexity)
194
+ - **Read Latency**: ~5-10ms (Raw vs Smart Recall)
195
+
196
+ ## License
197
+
198
+ MIT
@@ -0,0 +1,36 @@
1
+ """
2
+ CueMap: Redis for AI Agents
3
+
4
+ A high-performance, temporal-associative memory store.
5
+ You give us the cues, we give you the right memory at the right time.
6
+
7
+ Example:
8
+ >>> from cuemap import CueMap
9
+ >>>
10
+ >>> client = CueMap()
11
+ >>>
12
+ >>> # Add a memory with cues
13
+ >>> client.add("The server password is abc123", cues=["server", "password"])
14
+ >>>
15
+ >>> # Recall by cues
16
+ >>> results = client.recall(["server", "password"])
17
+ >>> print(results[0].content)
18
+ """
19
+
20
+ from .client import CueMap, AsyncCueMap
21
+ from .models import Memory, RecallResult
22
+ from .exceptions import CueMapError, ConnectionError, AuthenticationError
23
+ from .grounding import CueMapGroundingRetriever, AsyncCueMapGroundingRetriever
24
+
25
+ __version__ = "0.2.0"
26
+ __all__ = [
27
+ "CueMap",
28
+ "AsyncCueMap",
29
+ "Memory",
30
+ "RecallResult",
31
+ "CueMapError",
32
+ "ConnectionError",
33
+ "AuthenticationError",
34
+ "CueMapGroundingRetriever",
35
+ "AsyncCueMapGroundingRetriever",
36
+ ]