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.
Files changed (77) hide show
  1. alma/__init__.py +99 -29
  2. alma/confidence/__init__.py +47 -0
  3. alma/confidence/engine.py +540 -0
  4. alma/confidence/types.py +351 -0
  5. alma/config/loader.py +3 -2
  6. alma/consolidation/__init__.py +23 -0
  7. alma/consolidation/engine.py +678 -0
  8. alma/consolidation/prompts.py +84 -0
  9. alma/core.py +15 -15
  10. alma/domains/__init__.py +6 -6
  11. alma/domains/factory.py +12 -9
  12. alma/domains/schemas.py +17 -3
  13. alma/domains/types.py +8 -4
  14. alma/events/__init__.py +75 -0
  15. alma/events/emitter.py +284 -0
  16. alma/events/storage_mixin.py +246 -0
  17. alma/events/types.py +126 -0
  18. alma/events/webhook.py +425 -0
  19. alma/exceptions.py +49 -0
  20. alma/extraction/__init__.py +31 -0
  21. alma/extraction/auto_learner.py +264 -0
  22. alma/extraction/extractor.py +420 -0
  23. alma/graph/__init__.py +81 -0
  24. alma/graph/backends/__init__.py +18 -0
  25. alma/graph/backends/memory.py +236 -0
  26. alma/graph/backends/neo4j.py +417 -0
  27. alma/graph/base.py +159 -0
  28. alma/graph/extraction.py +198 -0
  29. alma/graph/store.py +860 -0
  30. alma/harness/__init__.py +4 -4
  31. alma/harness/base.py +18 -9
  32. alma/harness/domains.py +27 -11
  33. alma/initializer/__init__.py +37 -0
  34. alma/initializer/initializer.py +418 -0
  35. alma/initializer/types.py +250 -0
  36. alma/integration/__init__.py +9 -9
  37. alma/integration/claude_agents.py +10 -10
  38. alma/integration/helena.py +32 -22
  39. alma/integration/victor.py +57 -33
  40. alma/learning/__init__.py +27 -27
  41. alma/learning/forgetting.py +198 -148
  42. alma/learning/heuristic_extractor.py +40 -24
  43. alma/learning/protocols.py +62 -14
  44. alma/learning/validation.py +7 -2
  45. alma/mcp/__init__.py +4 -4
  46. alma/mcp/__main__.py +2 -1
  47. alma/mcp/resources.py +17 -16
  48. alma/mcp/server.py +102 -44
  49. alma/mcp/tools.py +174 -37
  50. alma/progress/__init__.py +3 -3
  51. alma/progress/tracker.py +26 -20
  52. alma/progress/types.py +8 -12
  53. alma/py.typed +0 -0
  54. alma/retrieval/__init__.py +11 -11
  55. alma/retrieval/cache.py +20 -21
  56. alma/retrieval/embeddings.py +4 -4
  57. alma/retrieval/engine.py +114 -35
  58. alma/retrieval/scoring.py +73 -63
  59. alma/session/__init__.py +2 -2
  60. alma/session/manager.py +5 -5
  61. alma/session/types.py +5 -4
  62. alma/storage/__init__.py +41 -0
  63. alma/storage/azure_cosmos.py +107 -31
  64. alma/storage/base.py +157 -4
  65. alma/storage/chroma.py +1443 -0
  66. alma/storage/file_based.py +56 -20
  67. alma/storage/pinecone.py +1080 -0
  68. alma/storage/postgresql.py +1452 -0
  69. alma/storage/qdrant.py +1306 -0
  70. alma/storage/sqlite_local.py +376 -31
  71. alma/types.py +62 -14
  72. alma_memory-0.5.0.dist-info/METADATA +905 -0
  73. alma_memory-0.5.0.dist-info/RECORD +76 -0
  74. {alma_memory-0.3.0.dist-info → alma_memory-0.5.0.dist-info}/WHEEL +1 -1
  75. alma_memory-0.3.0.dist-info/METADATA +0 -438
  76. alma_memory-0.3.0.dist-info/RECORD +0 -46
  77. {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.3.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
- from alma.types import (
22
- Heuristic,
23
- Outcome,
24
- UserPreference,
25
- DomainKnowledge,
26
- AntiPattern,
27
- MemorySlice,
28
- MemoryScope,
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
- MemorySchema,
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
- SessionOutcome,
107
+ SessionHandoff,
64
108
  SessionManager,
109
+ SessionOutcome,
65
110
  )
66
-
67
- # Domain Memory Factory (Phase 10)
68
- from alma.domains import (
69
- DomainSchema,
70
- EntityType,
71
- RelationshipType,
72
- DomainMemoryFactory,
73
- get_coding_schema,
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
+ ]