alma-memory 0.3.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 +99 -29
- alma/confidence/__init__.py +47 -0
- alma/confidence/engine.py +540 -0
- alma/confidence/types.py +351 -0
- 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 +37 -0
- alma/initializer/initializer.py +418 -0
- alma/initializer/types.py +250 -0
- 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 +107 -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.3.0.dist-info → alma_memory-0.5.0.dist-info}/WHEEL +1 -1
- alma_memory-0.3.0.dist-info/METADATA +0 -438
- alma_memory-0.3.0.dist-info/RECORD +0 -46
- {alma_memory-0.3.0.dist-info → alma_memory-0.5.0.dist-info}/top_level.txt +0 -0
alma/__init__.py
CHANGED
|
@@ -14,66 +14,108 @@ This makes any tool-using agent appear to "learn" by injecting relevant
|
|
|
14
14
|
memory slices before each run and updating memory after.
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
|
-
__version__ = "0.
|
|
17
|
+
__version__ = "0.4.0"
|
|
18
18
|
|
|
19
19
|
# Core
|
|
20
|
+
# Confidence Engine (Phase 12)
|
|
21
|
+
from alma.confidence import (
|
|
22
|
+
ConfidenceEngine,
|
|
23
|
+
ConfidenceSignal,
|
|
24
|
+
OpportunitySignal,
|
|
25
|
+
RiskSignal,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Consolidation Engine (Phase 13)
|
|
29
|
+
from alma.consolidation import (
|
|
30
|
+
ConsolidationEngine,
|
|
31
|
+
ConsolidationResult,
|
|
32
|
+
)
|
|
20
33
|
from alma.core import ALMA
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
|
|
35
|
+
# Domain Memory Factory (Phase 10)
|
|
36
|
+
from alma.domains import (
|
|
37
|
+
DomainMemoryFactory,
|
|
38
|
+
DomainSchema,
|
|
39
|
+
EntityType,
|
|
40
|
+
RelationshipType,
|
|
41
|
+
get_coding_schema,
|
|
42
|
+
get_general_schema,
|
|
43
|
+
get_research_schema,
|
|
44
|
+
get_sales_schema,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# Event System (Phase 19)
|
|
48
|
+
from alma.events import (
|
|
49
|
+
EventEmitter,
|
|
50
|
+
MemoryEvent,
|
|
51
|
+
MemoryEventType,
|
|
52
|
+
WebhookConfig,
|
|
53
|
+
WebhookManager,
|
|
54
|
+
get_emitter,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Exceptions
|
|
58
|
+
from alma.exceptions import (
|
|
59
|
+
ALMAError,
|
|
60
|
+
ConfigurationError,
|
|
61
|
+
EmbeddingError,
|
|
62
|
+
ExtractionError,
|
|
63
|
+
RetrievalError,
|
|
64
|
+
ScopeViolationError,
|
|
65
|
+
StorageError,
|
|
29
66
|
)
|
|
30
67
|
|
|
31
68
|
# Harness Pattern
|
|
32
69
|
from alma.harness.base import (
|
|
33
|
-
Setting,
|
|
34
|
-
Context,
|
|
35
70
|
Agent,
|
|
36
|
-
|
|
71
|
+
Context,
|
|
37
72
|
Harness,
|
|
73
|
+
MemorySchema,
|
|
74
|
+
RunResult,
|
|
75
|
+
Setting,
|
|
38
76
|
Tool,
|
|
39
77
|
ToolType,
|
|
40
|
-
RunResult,
|
|
41
78
|
)
|
|
42
79
|
from alma.harness.domains import (
|
|
43
80
|
CodingDomain,
|
|
44
|
-
ResearchDomain,
|
|
45
81
|
ContentDomain,
|
|
46
82
|
OperationsDomain,
|
|
83
|
+
ResearchDomain,
|
|
47
84
|
create_harness,
|
|
48
85
|
)
|
|
49
86
|
|
|
87
|
+
# Session Initializer (Phase 11)
|
|
88
|
+
from alma.initializer import (
|
|
89
|
+
CodebaseOrientation,
|
|
90
|
+
InitializationResult,
|
|
91
|
+
RulesOfEngagement,
|
|
92
|
+
SessionInitializer,
|
|
93
|
+
)
|
|
94
|
+
|
|
50
95
|
# Progress Tracking (Phase 10)
|
|
51
96
|
from alma.progress import (
|
|
52
|
-
WorkItem,
|
|
53
|
-
WorkItemStatus,
|
|
54
97
|
ProgressLog,
|
|
55
98
|
ProgressSummary,
|
|
56
99
|
ProgressTracker,
|
|
100
|
+
WorkItem,
|
|
101
|
+
WorkItemStatus,
|
|
57
102
|
)
|
|
58
103
|
|
|
59
104
|
# Session Management (Phase 10)
|
|
60
105
|
from alma.session import (
|
|
61
|
-
SessionHandoff,
|
|
62
106
|
SessionContext,
|
|
63
|
-
|
|
107
|
+
SessionHandoff,
|
|
64
108
|
SessionManager,
|
|
109
|
+
SessionOutcome,
|
|
65
110
|
)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
get_research_schema,
|
|
75
|
-
get_sales_schema,
|
|
76
|
-
get_general_schema,
|
|
111
|
+
from alma.types import (
|
|
112
|
+
AntiPattern,
|
|
113
|
+
DomainKnowledge,
|
|
114
|
+
Heuristic,
|
|
115
|
+
MemoryScope,
|
|
116
|
+
MemorySlice,
|
|
117
|
+
Outcome,
|
|
118
|
+
UserPreference,
|
|
77
119
|
)
|
|
78
120
|
|
|
79
121
|
__all__ = [
|
|
@@ -121,4 +163,32 @@ __all__ = [
|
|
|
121
163
|
"get_research_schema",
|
|
122
164
|
"get_sales_schema",
|
|
123
165
|
"get_general_schema",
|
|
166
|
+
# Session Initializer
|
|
167
|
+
"CodebaseOrientation",
|
|
168
|
+
"InitializationResult",
|
|
169
|
+
"RulesOfEngagement",
|
|
170
|
+
"SessionInitializer",
|
|
171
|
+
# Confidence Engine
|
|
172
|
+
"ConfidenceEngine",
|
|
173
|
+
"ConfidenceSignal",
|
|
174
|
+
"OpportunitySignal",
|
|
175
|
+
"RiskSignal",
|
|
176
|
+
# Consolidation Engine
|
|
177
|
+
"ConsolidationEngine",
|
|
178
|
+
"ConsolidationResult",
|
|
179
|
+
# Event System
|
|
180
|
+
"MemoryEvent",
|
|
181
|
+
"MemoryEventType",
|
|
182
|
+
"EventEmitter",
|
|
183
|
+
"get_emitter",
|
|
184
|
+
"WebhookConfig",
|
|
185
|
+
"WebhookManager",
|
|
186
|
+
# Exceptions
|
|
187
|
+
"ALMAError",
|
|
188
|
+
"ConfigurationError",
|
|
189
|
+
"ScopeViolationError",
|
|
190
|
+
"StorageError",
|
|
191
|
+
"EmbeddingError",
|
|
192
|
+
"RetrievalError",
|
|
193
|
+
"ExtractionError",
|
|
124
194
|
]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ALMA Confidence Module.
|
|
3
|
+
|
|
4
|
+
Forward-looking confidence signals for strategies.
|
|
5
|
+
Not just "this worked before" but "this will likely work now."
|
|
6
|
+
|
|
7
|
+
Inspired by Ilya Sutskever's insight: emotions are forward-looking value functions,
|
|
8
|
+
while reinforcement learning is backward-looking.
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
from alma.confidence import ConfidenceEngine, ConfidenceSignal
|
|
12
|
+
|
|
13
|
+
engine = ConfidenceEngine(alma)
|
|
14
|
+
|
|
15
|
+
# Assess a strategy
|
|
16
|
+
signal = engine.assess_strategy(
|
|
17
|
+
strategy="Use incremental validation for forms",
|
|
18
|
+
context="Testing a registration form with 5 fields",
|
|
19
|
+
agent="Helena",
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
print(f"Confidence: {signal.confidence_score:.0%}")
|
|
23
|
+
print(f"Recommendation: {signal.recommendation}")
|
|
24
|
+
|
|
25
|
+
# Rank multiple strategies
|
|
26
|
+
rankings = engine.rank_strategies(
|
|
27
|
+
strategies=["Strategy A", "Strategy B"],
|
|
28
|
+
context="Current context",
|
|
29
|
+
agent="Helena",
|
|
30
|
+
)
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
from alma.confidence.engine import ConfidenceEngine
|
|
34
|
+
from alma.confidence.types import (
|
|
35
|
+
ConfidenceSignal,
|
|
36
|
+
OpportunitySignal,
|
|
37
|
+
Recommendation,
|
|
38
|
+
RiskSignal,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
"ConfidenceSignal",
|
|
43
|
+
"ConfidenceEngine",
|
|
44
|
+
"OpportunitySignal",
|
|
45
|
+
"Recommendation",
|
|
46
|
+
"RiskSignal",
|
|
47
|
+
]
|