alma-memory 0.4.0__py3-none-any.whl → 0.5.0__py3-none-any.whl
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.
- alma/__init__.py +88 -44
- alma/confidence/__init__.py +1 -1
- alma/confidence/engine.py +92 -58
- alma/confidence/types.py +34 -14
- alma/config/loader.py +3 -2
- alma/consolidation/__init__.py +23 -0
- alma/consolidation/engine.py +678 -0
- alma/consolidation/prompts.py +84 -0
- alma/core.py +15 -15
- alma/domains/__init__.py +6 -6
- alma/domains/factory.py +12 -9
- alma/domains/schemas.py +17 -3
- alma/domains/types.py +8 -4
- alma/events/__init__.py +75 -0
- alma/events/emitter.py +284 -0
- alma/events/storage_mixin.py +246 -0
- alma/events/types.py +126 -0
- alma/events/webhook.py +425 -0
- alma/exceptions.py +49 -0
- alma/extraction/__init__.py +31 -0
- alma/extraction/auto_learner.py +264 -0
- alma/extraction/extractor.py +420 -0
- alma/graph/__init__.py +81 -0
- alma/graph/backends/__init__.py +18 -0
- alma/graph/backends/memory.py +236 -0
- alma/graph/backends/neo4j.py +417 -0
- alma/graph/base.py +159 -0
- alma/graph/extraction.py +198 -0
- alma/graph/store.py +860 -0
- alma/harness/__init__.py +4 -4
- alma/harness/base.py +18 -9
- alma/harness/domains.py +27 -11
- alma/initializer/__init__.py +1 -1
- alma/initializer/initializer.py +51 -43
- alma/initializer/types.py +25 -17
- alma/integration/__init__.py +9 -9
- alma/integration/claude_agents.py +10 -10
- alma/integration/helena.py +32 -22
- alma/integration/victor.py +57 -33
- alma/learning/__init__.py +27 -27
- alma/learning/forgetting.py +198 -148
- alma/learning/heuristic_extractor.py +40 -24
- alma/learning/protocols.py +62 -14
- alma/learning/validation.py +7 -2
- alma/mcp/__init__.py +4 -4
- alma/mcp/__main__.py +2 -1
- alma/mcp/resources.py +17 -16
- alma/mcp/server.py +102 -44
- alma/mcp/tools.py +174 -37
- alma/progress/__init__.py +3 -3
- alma/progress/tracker.py +26 -20
- alma/progress/types.py +8 -12
- alma/py.typed +0 -0
- alma/retrieval/__init__.py +11 -11
- alma/retrieval/cache.py +20 -21
- alma/retrieval/embeddings.py +4 -4
- alma/retrieval/engine.py +114 -35
- alma/retrieval/scoring.py +73 -63
- alma/session/__init__.py +2 -2
- alma/session/manager.py +5 -5
- alma/session/types.py +5 -4
- alma/storage/__init__.py +41 -0
- alma/storage/azure_cosmos.py +101 -31
- alma/storage/base.py +157 -4
- alma/storage/chroma.py +1443 -0
- alma/storage/file_based.py +56 -20
- alma/storage/pinecone.py +1080 -0
- alma/storage/postgresql.py +1452 -0
- alma/storage/qdrant.py +1306 -0
- alma/storage/sqlite_local.py +376 -31
- alma/types.py +62 -14
- alma_memory-0.5.0.dist-info/METADATA +905 -0
- alma_memory-0.5.0.dist-info/RECORD +76 -0
- {alma_memory-0.4.0.dist-info → alma_memory-0.5.0.dist-info}/WHEEL +1 -1
- alma_memory-0.4.0.dist-info/METADATA +0 -488
- alma_memory-0.4.0.dist-info/RECORD +0 -52
- {alma_memory-0.4.0.dist-info → alma_memory-0.5.0.dist-info}/top_level.txt +0 -0
alma/integration/helena.py
CHANGED
|
@@ -14,18 +14,18 @@ This module provides Helena-specific memory categories, prompts, and utilities.
|
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
import logging
|
|
17
|
-
from typing import Optional, Dict, Any, List
|
|
18
17
|
from dataclasses import dataclass, field
|
|
18
|
+
from typing import Any, Dict, List, Optional
|
|
19
19
|
|
|
20
20
|
from alma.core import ALMA
|
|
21
|
-
from alma.types import MemorySlice
|
|
22
21
|
from alma.harness.domains import CodingDomain
|
|
23
22
|
from alma.integration.claude_agents import (
|
|
23
|
+
AgentType,
|
|
24
24
|
ClaudeAgentHooks,
|
|
25
25
|
TaskContext,
|
|
26
26
|
TaskOutcome,
|
|
27
|
-
AgentType,
|
|
28
27
|
)
|
|
28
|
+
from alma.types import MemorySlice
|
|
29
29
|
|
|
30
30
|
logger = logging.getLogger(__name__)
|
|
31
31
|
|
|
@@ -55,6 +55,7 @@ class UITestContext(TaskContext):
|
|
|
55
55
|
|
|
56
56
|
Extends TaskContext with UI testing-specific fields.
|
|
57
57
|
"""
|
|
58
|
+
|
|
58
59
|
component_type: Optional[str] = None
|
|
59
60
|
page_url: Optional[str] = None
|
|
60
61
|
viewport: Optional[Dict[str, int]] = None
|
|
@@ -89,6 +90,7 @@ class UITestOutcome(TaskOutcome):
|
|
|
89
90
|
|
|
90
91
|
Extends TaskOutcome with UI testing-specific results.
|
|
91
92
|
"""
|
|
93
|
+
|
|
92
94
|
selectors_used: List[str] = field(default_factory=list)
|
|
93
95
|
accessibility_issues: List[Dict[str, Any]] = field(default_factory=list)
|
|
94
96
|
visual_diffs: List[str] = field(default_factory=list)
|
|
@@ -148,11 +150,13 @@ class HelenaHooks(ClaudeAgentHooks):
|
|
|
148
150
|
patterns = []
|
|
149
151
|
for h in memories.heuristics:
|
|
150
152
|
if "selector" in h.condition.lower():
|
|
151
|
-
patterns.append(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
patterns.append(
|
|
154
|
+
{
|
|
155
|
+
"pattern": h.strategy,
|
|
156
|
+
"confidence": h.confidence,
|
|
157
|
+
"occurrences": h.occurrence_count,
|
|
158
|
+
}
|
|
159
|
+
)
|
|
156
160
|
|
|
157
161
|
return patterns
|
|
158
162
|
|
|
@@ -171,11 +175,13 @@ class HelenaHooks(ClaudeAgentHooks):
|
|
|
171
175
|
strategies = []
|
|
172
176
|
for h in memories.heuristics:
|
|
173
177
|
if any(kw in h.condition.lower() for kw in ["form", "validation", "input"]):
|
|
174
|
-
strategies.append(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
strategies.append(
|
|
179
|
+
{
|
|
180
|
+
"condition": h.condition,
|
|
181
|
+
"strategy": h.strategy,
|
|
182
|
+
"confidence": h.confidence,
|
|
183
|
+
}
|
|
184
|
+
)
|
|
179
185
|
|
|
180
186
|
return strategies
|
|
181
187
|
|
|
@@ -194,18 +200,22 @@ class HelenaHooks(ClaudeAgentHooks):
|
|
|
194
200
|
patterns = []
|
|
195
201
|
for h in memories.heuristics:
|
|
196
202
|
if any(kw in h.condition.lower() for kw in ["access", "aria", "keyboard"]):
|
|
197
|
-
patterns.append(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
203
|
+
patterns.append(
|
|
204
|
+
{
|
|
205
|
+
"condition": h.condition,
|
|
206
|
+
"strategy": h.strategy,
|
|
207
|
+
"confidence": h.confidence,
|
|
208
|
+
}
|
|
209
|
+
)
|
|
202
210
|
|
|
203
211
|
for dk in memories.domain_knowledge:
|
|
204
212
|
if dk.domain == "accessibility_testing":
|
|
205
|
-
patterns.append(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
213
|
+
patterns.append(
|
|
214
|
+
{
|
|
215
|
+
"fact": dk.fact,
|
|
216
|
+
"source": dk.source,
|
|
217
|
+
}
|
|
218
|
+
)
|
|
209
219
|
|
|
210
220
|
return patterns
|
|
211
221
|
|
alma/integration/victor.py
CHANGED
|
@@ -14,18 +14,18 @@ This module provides Victor-specific memory categories, prompts, and utilities.
|
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
import logging
|
|
17
|
-
from typing import Optional, Dict, Any, List
|
|
18
17
|
from dataclasses import dataclass, field
|
|
18
|
+
from typing import Any, Dict, List, Optional
|
|
19
19
|
|
|
20
20
|
from alma.core import ALMA
|
|
21
|
-
from alma.types import MemorySlice
|
|
22
21
|
from alma.harness.domains import CodingDomain
|
|
23
22
|
from alma.integration.claude_agents import (
|
|
23
|
+
AgentType,
|
|
24
24
|
ClaudeAgentHooks,
|
|
25
25
|
TaskContext,
|
|
26
26
|
TaskOutcome,
|
|
27
|
-
AgentType,
|
|
28
27
|
)
|
|
28
|
+
from alma.types import MemorySlice
|
|
29
29
|
|
|
30
30
|
logger = logging.getLogger(__name__)
|
|
31
31
|
|
|
@@ -55,6 +55,7 @@ class APITestContext(TaskContext):
|
|
|
55
55
|
|
|
56
56
|
Extends TaskContext with API/backend testing-specific fields.
|
|
57
57
|
"""
|
|
58
|
+
|
|
58
59
|
endpoint: Optional[str] = None
|
|
59
60
|
method: str = "GET"
|
|
60
61
|
expected_status: Optional[int] = None
|
|
@@ -91,6 +92,7 @@ class APITestOutcome(TaskOutcome):
|
|
|
91
92
|
|
|
92
93
|
Extends TaskOutcome with API/backend testing-specific results.
|
|
93
94
|
"""
|
|
95
|
+
|
|
94
96
|
response_status: Optional[int] = None
|
|
95
97
|
response_time_ms: Optional[int] = None
|
|
96
98
|
response_body: Optional[Dict[str, Any]] = None
|
|
@@ -153,12 +155,14 @@ class VictorHooks(ClaudeAgentHooks):
|
|
|
153
155
|
patterns = []
|
|
154
156
|
for h in memories.heuristics:
|
|
155
157
|
if "api" in h.condition.lower() or "endpoint" in h.condition.lower():
|
|
156
|
-
patterns.append(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
patterns.append(
|
|
159
|
+
{
|
|
160
|
+
"pattern": h.strategy,
|
|
161
|
+
"condition": h.condition,
|
|
162
|
+
"confidence": h.confidence,
|
|
163
|
+
"occurrences": h.occurrence_count,
|
|
164
|
+
}
|
|
165
|
+
)
|
|
162
166
|
|
|
163
167
|
return patterns
|
|
164
168
|
|
|
@@ -176,12 +180,16 @@ class VictorHooks(ClaudeAgentHooks):
|
|
|
176
180
|
|
|
177
181
|
patterns = []
|
|
178
182
|
for h in memories.heuristics:
|
|
179
|
-
if any(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
if any(
|
|
184
|
+
kw in h.condition.lower() for kw in ["error", "exception", "validation"]
|
|
185
|
+
):
|
|
186
|
+
patterns.append(
|
|
187
|
+
{
|
|
188
|
+
"condition": h.condition,
|
|
189
|
+
"strategy": h.strategy,
|
|
190
|
+
"confidence": h.confidence,
|
|
191
|
+
}
|
|
192
|
+
)
|
|
185
193
|
|
|
186
194
|
return patterns
|
|
187
195
|
|
|
@@ -199,19 +207,26 @@ class VictorHooks(ClaudeAgentHooks):
|
|
|
199
207
|
|
|
200
208
|
strategies = []
|
|
201
209
|
for h in memories.heuristics:
|
|
202
|
-
if any(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
210
|
+
if any(
|
|
211
|
+
kw in h.condition.lower()
|
|
212
|
+
for kw in ["performance", "cache", "query", "slow"]
|
|
213
|
+
):
|
|
214
|
+
strategies.append(
|
|
215
|
+
{
|
|
216
|
+
"condition": h.condition,
|
|
217
|
+
"strategy": h.strategy,
|
|
218
|
+
"confidence": h.confidence,
|
|
219
|
+
}
|
|
220
|
+
)
|
|
208
221
|
|
|
209
222
|
for dk in memories.domain_knowledge:
|
|
210
223
|
if dk.domain in ["performance_optimization", "caching_strategies"]:
|
|
211
|
-
strategies.append(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
224
|
+
strategies.append(
|
|
225
|
+
{
|
|
226
|
+
"fact": dk.fact,
|
|
227
|
+
"source": dk.source,
|
|
228
|
+
}
|
|
229
|
+
)
|
|
215
230
|
|
|
216
231
|
return strategies
|
|
217
232
|
|
|
@@ -229,12 +244,17 @@ class VictorHooks(ClaudeAgentHooks):
|
|
|
229
244
|
|
|
230
245
|
patterns = []
|
|
231
246
|
for h in memories.heuristics:
|
|
232
|
-
if any(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
247
|
+
if any(
|
|
248
|
+
kw in h.condition.lower()
|
|
249
|
+
for kw in ["auth", "token", "permission", "jwt"]
|
|
250
|
+
):
|
|
251
|
+
patterns.append(
|
|
252
|
+
{
|
|
253
|
+
"condition": h.condition,
|
|
254
|
+
"strategy": h.strategy,
|
|
255
|
+
"confidence": h.confidence,
|
|
256
|
+
}
|
|
257
|
+
)
|
|
238
258
|
|
|
239
259
|
return patterns
|
|
240
260
|
|
|
@@ -318,11 +338,15 @@ class VictorHooks(ClaudeAgentHooks):
|
|
|
318
338
|
sections.append(f"- **Task Type**: {test_context.task_type}")
|
|
319
339
|
|
|
320
340
|
if test_context.endpoint:
|
|
321
|
-
sections.append(
|
|
341
|
+
sections.append(
|
|
342
|
+
f"- **Endpoint**: {test_context.method} {test_context.endpoint}"
|
|
343
|
+
)
|
|
322
344
|
if test_context.expected_status:
|
|
323
345
|
sections.append(f"- **Expected Status**: {test_context.expected_status}")
|
|
324
346
|
if test_context.request_body:
|
|
325
|
-
sections.append(
|
|
347
|
+
sections.append(
|
|
348
|
+
f"- **Request Body**: {len(test_context.request_body)} fields"
|
|
349
|
+
)
|
|
326
350
|
|
|
327
351
|
if test_context.is_auth_test:
|
|
328
352
|
sections.append("- **Focus**: Authentication/Authorization")
|
alma/learning/__init__.py
CHANGED
|
@@ -4,46 +4,46 @@ ALMA Learning Protocols.
|
|
|
4
4
|
Provides learning, validation, forgetting, and heuristic extraction.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
from alma.learning.protocols import LearningProtocol
|
|
8
|
-
from alma.learning.validation import (
|
|
9
|
-
ScopeValidator,
|
|
10
|
-
ValidationResult,
|
|
11
|
-
ValidationReport,
|
|
12
|
-
TaskTypeValidator,
|
|
13
|
-
validate_learning_request,
|
|
14
|
-
)
|
|
15
7
|
from alma.learning.forgetting import (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
CleanupJob,
|
|
9
|
+
CleanupResult,
|
|
10
|
+
# Cleanup Scheduling
|
|
11
|
+
CleanupScheduler,
|
|
12
|
+
# Confidence Decay
|
|
13
|
+
ConfidenceDecayer,
|
|
22
14
|
# Decay Functions
|
|
23
15
|
DecayFunction,
|
|
16
|
+
DecayResult,
|
|
24
17
|
ExponentialDecay,
|
|
18
|
+
# Forgetting Engine
|
|
19
|
+
ForgettingEngine,
|
|
20
|
+
HealthAlert,
|
|
21
|
+
HealthThresholds,
|
|
25
22
|
LinearDecay,
|
|
26
|
-
|
|
27
|
-
NoDecay,
|
|
28
|
-
# Confidence Decay
|
|
29
|
-
ConfidenceDecayer,
|
|
30
|
-
DecayResult,
|
|
23
|
+
MemoryHealthMetrics,
|
|
31
24
|
# Memory Health Monitoring
|
|
32
25
|
MemoryHealthMonitor,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
CleanupResult,
|
|
26
|
+
NoDecay,
|
|
27
|
+
PrunePolicy,
|
|
28
|
+
PruneReason,
|
|
29
|
+
PruneResult,
|
|
30
|
+
PruneSummary,
|
|
31
|
+
StepDecay,
|
|
40
32
|
)
|
|
41
33
|
from alma.learning.heuristic_extractor import (
|
|
34
|
+
ExtractionResult,
|
|
42
35
|
HeuristicExtractor,
|
|
43
36
|
PatternCandidate,
|
|
44
|
-
ExtractionResult,
|
|
45
37
|
extract_heuristics_from_outcome,
|
|
46
38
|
)
|
|
39
|
+
from alma.learning.protocols import LearningProtocol
|
|
40
|
+
from alma.learning.validation import (
|
|
41
|
+
ScopeValidator,
|
|
42
|
+
TaskTypeValidator,
|
|
43
|
+
ValidationReport,
|
|
44
|
+
ValidationResult,
|
|
45
|
+
validate_learning_request,
|
|
46
|
+
)
|
|
47
47
|
|
|
48
48
|
__all__ = [
|
|
49
49
|
# Core Protocol
|