alma-memory 0.2.0__py3-none-any.whl → 0.3.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 +50 -1
- alma/domains/__init__.py +30 -0
- alma/domains/factory.py +356 -0
- alma/domains/schemas.py +434 -0
- alma/domains/types.py +268 -0
- alma/progress/__init__.py +21 -0
- alma/progress/tracker.py +601 -0
- alma/progress/types.py +254 -0
- alma/session/__init__.py +19 -0
- alma/session/manager.py +399 -0
- alma/session/types.py +287 -0
- alma/storage/sqlite_local.py +101 -0
- alma_memory-0.3.0.dist-info/METADATA +438 -0
- {alma_memory-0.2.0.dist-info → alma_memory-0.3.0.dist-info}/RECORD +16 -6
- alma_memory-0.2.0.dist-info/METADATA +0 -327
- {alma_memory-0.2.0.dist-info → alma_memory-0.3.0.dist-info}/WHEEL +0 -0
- {alma_memory-0.2.0.dist-info → alma_memory-0.3.0.dist-info}/top_level.txt +0 -0
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: alma-memory
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: Agent Learning Memory Architecture - Persistent memory for AI agents
|
|
5
|
-
Author-email: RBKunnela <aiagentsprompt@gmail.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/RBKunnela/ALMA-memory
|
|
8
|
-
Project-URL: Documentation, https://github.com/RBKunnela/ALMA-memory/tree/main/docs
|
|
9
|
-
Project-URL: Repository, https://github.com/RBKunnela/ALMA-memory
|
|
10
|
-
Project-URL: Issues, https://github.com/RBKunnela/ALMA-memory/issues
|
|
11
|
-
Keywords: ai,agents,memory,learning,llm,azure,claude
|
|
12
|
-
Classifier: Development Status :: 3 - Alpha
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
-
Requires-Python: >=3.10
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: pyyaml>=6.0
|
|
23
|
-
Requires-Dist: python-dotenv>=1.0.0
|
|
24
|
-
Provides-Extra: local
|
|
25
|
-
Requires-Dist: sentence-transformers>=2.2.0; extra == "local"
|
|
26
|
-
Requires-Dist: faiss-cpu>=1.7.4; extra == "local"
|
|
27
|
-
Provides-Extra: azure
|
|
28
|
-
Requires-Dist: azure-cosmos>=4.5.0; extra == "azure"
|
|
29
|
-
Requires-Dist: azure-identity>=1.15.0; extra == "azure"
|
|
30
|
-
Requires-Dist: azure-keyvault-secrets>=4.7.0; extra == "azure"
|
|
31
|
-
Requires-Dist: openai>=1.0.0; extra == "azure"
|
|
32
|
-
Provides-Extra: mcp
|
|
33
|
-
Requires-Dist: pydantic>=2.0.0; extra == "mcp"
|
|
34
|
-
Requires-Dist: aiohttp>=3.9.0; extra == "mcp"
|
|
35
|
-
Provides-Extra: dev
|
|
36
|
-
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
37
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
38
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
39
|
-
Requires-Dist: pytest-benchmark>=4.0.0; extra == "dev"
|
|
40
|
-
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
41
|
-
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
42
|
-
Provides-Extra: all
|
|
43
|
-
Requires-Dist: alma-memory[azure,dev,local,mcp]; extra == "all"
|
|
44
|
-
|
|
45
|
-
# ALMA - Agent Learning Memory Architecture
|
|
46
|
-
|
|
47
|
-
> A reusable harness pattern for creating AI agents that learn and improve over time through structured memory - without model weight updates.
|
|
48
|
-
|
|
49
|
-
## The Harness Pattern
|
|
50
|
-
|
|
51
|
-
ALMA isn't just agent memory - it's a **generalized framework** for any tool-using workflow:
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
55
|
-
│ 1. SETTING Fixed environment: tools, constraints │
|
|
56
|
-
├─────────────────────────────────────────────────────────────────┤
|
|
57
|
-
│ 2. CONTEXT Ephemeral per-run inputs: task, user │
|
|
58
|
-
├─────────────────────────────────────────────────────────────────┤
|
|
59
|
-
│ 3. AGENT The executor with scoped intelligence │
|
|
60
|
-
├─────────────────────────────────────────────────────────────────┤
|
|
61
|
-
│ 4. MEMORY SCHEMA Domain-specific learning structure │
|
|
62
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**The Flow:**
|
|
66
|
-
1. **Pre-run**: Inject relevant memory slices ("Past successes in similar tasks")
|
|
67
|
-
2. **Run**: Agent acts using tools, logs reflections
|
|
68
|
-
3. **Post-run**: Update memory schema
|
|
69
|
-
4. **Repeat**: Agent appears to "learn" without weight changes
|
|
70
|
-
|
|
71
|
-
## Why This Matters
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
Code exists ≠ Knowledge retained
|
|
75
|
-
Knowledge retained ≠ Knowledge scoped
|
|
76
|
-
Knowledge scoped ≠ Knowledge retrieved efficiently
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
ALMA solves all three through **scoped memory injection**. Agents get smarter via better-informed prompts, not model changes.
|
|
80
|
-
|
|
81
|
-
## Supported Domains
|
|
82
|
-
|
|
83
|
-
ALMA works for ANY tool-using workflow:
|
|
84
|
-
|
|
85
|
-
| Domain | Agents | Use Case |
|
|
86
|
-
|--------|--------|----------|
|
|
87
|
-
| **Coding** | Helena, Victor | Testing, API development |
|
|
88
|
-
| **Research** | Researcher | Market analysis, competitive intelligence |
|
|
89
|
-
| **Content** | Copywriter, Documenter | Marketing, documentation |
|
|
90
|
-
| **Operations** | Support | Customer service, automation |
|
|
91
|
-
|
|
92
|
-
## Quick Start
|
|
93
|
-
|
|
94
|
-
### Installation
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
pip install alma-memory
|
|
98
|
-
# or from source
|
|
99
|
-
pip install git+https://github.com/RBKunnela/ALMA-memory.git
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Using the Harness Pattern
|
|
103
|
-
|
|
104
|
-
```python
|
|
105
|
-
from alma import ALMA, create_harness, Context
|
|
106
|
-
|
|
107
|
-
# Initialize ALMA
|
|
108
|
-
alma = ALMA.from_config(".alma/config.yaml")
|
|
109
|
-
|
|
110
|
-
# Create a domain-specific harness
|
|
111
|
-
harness = create_harness("coding", "helena", alma)
|
|
112
|
-
|
|
113
|
-
# Define task context
|
|
114
|
-
context = Context(
|
|
115
|
-
task="Test the login form validation",
|
|
116
|
-
project_id="my-app",
|
|
117
|
-
user_id="developer-1",
|
|
118
|
-
inputs={"component": "LoginForm", "priority": "high"}
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
# Run with memory injection
|
|
122
|
-
result = harness.run(context)
|
|
123
|
-
|
|
124
|
-
# The harness automatically:
|
|
125
|
-
# 1. Retrieved relevant memories (testing strategies, past outcomes)
|
|
126
|
-
# 2. Built the prompt with injected knowledge
|
|
127
|
-
# 3. Will log the outcome for future learning
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Creating Custom Agents
|
|
131
|
-
|
|
132
|
-
```python
|
|
133
|
-
from alma import (
|
|
134
|
-
ALMA, Harness, Setting, Agent, MemorySchema, Tool, ToolType
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
# Define the environment
|
|
138
|
-
setting = Setting(
|
|
139
|
-
name="Bio Research Environment",
|
|
140
|
-
description="Tools for biological data analysis",
|
|
141
|
-
tools=[
|
|
142
|
-
Tool(
|
|
143
|
-
name="sequence_search",
|
|
144
|
-
description="Search genomic databases",
|
|
145
|
-
tool_type=ToolType.SEARCH,
|
|
146
|
-
),
|
|
147
|
-
Tool(
|
|
148
|
-
name="structure_analysis",
|
|
149
|
-
description="Analyze protein structures",
|
|
150
|
-
tool_type=ToolType.ANALYSIS,
|
|
151
|
-
),
|
|
152
|
-
],
|
|
153
|
-
global_constraints=[
|
|
154
|
-
"Cite all data sources",
|
|
155
|
-
"Note confidence levels",
|
|
156
|
-
],
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
# Define what this agent can learn
|
|
160
|
-
schema = MemorySchema(
|
|
161
|
-
domain="bioinformatics",
|
|
162
|
-
description="Patterns for biological data analysis",
|
|
163
|
-
learnable_categories=[
|
|
164
|
-
"search_refinements",
|
|
165
|
-
"analysis_patterns",
|
|
166
|
-
"data_interpretation",
|
|
167
|
-
],
|
|
168
|
-
forbidden_categories=[
|
|
169
|
-
"medical_diagnosis", # Out of scope
|
|
170
|
-
],
|
|
171
|
-
min_occurrences=5,
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
# Create the agent
|
|
175
|
-
agent = Agent(
|
|
176
|
-
name="bio_researcher",
|
|
177
|
-
role="Bioinformatics Analyst",
|
|
178
|
-
description="Expert in genomic analysis and protein structure prediction",
|
|
179
|
-
memory_schema=schema,
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
# Assemble the harness
|
|
183
|
-
alma = ALMA.from_config(".alma/config.yaml")
|
|
184
|
-
harness = Harness(setting=setting, agent=agent, alma=alma)
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Basic Memory Operations
|
|
188
|
-
|
|
189
|
-
```python
|
|
190
|
-
from alma import ALMA
|
|
191
|
-
|
|
192
|
-
alma = ALMA.from_config(".alma/config.yaml")
|
|
193
|
-
|
|
194
|
-
# Retrieve relevant memories
|
|
195
|
-
memories = alma.retrieve(
|
|
196
|
-
task="Test the login form validation",
|
|
197
|
-
agent="helena",
|
|
198
|
-
top_k=5
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
# Inject into prompt
|
|
202
|
-
prompt = f"""
|
|
203
|
-
## Your Task
|
|
204
|
-
Test the login form validation
|
|
205
|
-
|
|
206
|
-
## Relevant Knowledge (from past runs)
|
|
207
|
-
{memories.to_prompt()}
|
|
208
|
-
"""
|
|
209
|
-
|
|
210
|
-
# After task completion, learn from the outcome
|
|
211
|
-
alma.learn(
|
|
212
|
-
agent="helena",
|
|
213
|
-
task="Test login form",
|
|
214
|
-
outcome="success",
|
|
215
|
-
strategy_used="Tested empty fields, invalid email, valid submission",
|
|
216
|
-
feedback="User confirmed tests were thorough"
|
|
217
|
-
)
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
## Memory Types
|
|
221
|
-
|
|
222
|
-
| Type | What It Stores | Example |
|
|
223
|
-
|------|----------------|---------|
|
|
224
|
-
| **Heuristic** | Learned strategies | "For forms with >5 fields, test validation incrementally" |
|
|
225
|
-
| **Outcome** | Task results | "Login test succeeded using JWT token strategy" |
|
|
226
|
-
| **Preference** | User constraints | "User prefers verbose test output" |
|
|
227
|
-
| **Domain Knowledge** | Accumulated facts | "Login uses OAuth 2.0 with 24h token expiry" |
|
|
228
|
-
| **Anti-pattern** | What NOT to do | "Don't use sleep() for async waits - causes flaky tests" |
|
|
229
|
-
|
|
230
|
-
## Configuration
|
|
231
|
-
|
|
232
|
-
Create `.alma/config.yaml`:
|
|
233
|
-
|
|
234
|
-
```yaml
|
|
235
|
-
alma:
|
|
236
|
-
project_id: "my-project"
|
|
237
|
-
storage: sqlite # or "azure" for production
|
|
238
|
-
|
|
239
|
-
domains:
|
|
240
|
-
coding:
|
|
241
|
-
enabled: true
|
|
242
|
-
agents: [helena, victor]
|
|
243
|
-
research:
|
|
244
|
-
enabled: true
|
|
245
|
-
agents: [researcher]
|
|
246
|
-
|
|
247
|
-
agents:
|
|
248
|
-
helena:
|
|
249
|
-
domain: coding
|
|
250
|
-
can_learn:
|
|
251
|
-
- testing_strategies
|
|
252
|
-
- selector_patterns
|
|
253
|
-
cannot_learn:
|
|
254
|
-
- backend_logic
|
|
255
|
-
min_occurrences_for_heuristic: 3
|
|
256
|
-
|
|
257
|
-
researcher:
|
|
258
|
-
domain: research
|
|
259
|
-
can_learn:
|
|
260
|
-
- trend_patterns
|
|
261
|
-
- source_reliability
|
|
262
|
-
cannot_learn:
|
|
263
|
-
- code_implementation
|
|
264
|
-
min_occurrences_for_heuristic: 5
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
## Storage Backends
|
|
268
|
-
|
|
269
|
-
| Backend | Use Case | Vector Search |
|
|
270
|
-
|---------|----------|---------------|
|
|
271
|
-
| `azure` | Production | Cosmos DB with vector search |
|
|
272
|
-
| `sqlite` | Local dev | SQLite + FAISS |
|
|
273
|
-
| `file` | Testing | JSON files (no vector search) |
|
|
274
|
-
|
|
275
|
-
## Architecture
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
279
|
-
│ HARNESS PATTERN │
|
|
280
|
-
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
|
|
281
|
-
│ │ Setting │ │ Context │ │ Agent │ │MemorySchema │ │
|
|
282
|
-
│ │ (tools) │ │ (task) │ │(executor)│ │ (learning) │ │
|
|
283
|
-
│ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │
|
|
284
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
285
|
-
↓
|
|
286
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
287
|
-
│ ALMA CORE │
|
|
288
|
-
│ ┌────────────┐ ┌────────────┐ ┌────────────────────────┐ │
|
|
289
|
-
│ │ Retrieval │ │ Learning │ │ Storage │ │
|
|
290
|
-
│ │ Engine │ │ Protocol │ │ (Azure/SQLite/File) │ │
|
|
291
|
-
│ └────────────┘ └────────────┘ └────────────────────────┘ │
|
|
292
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
293
|
-
↓
|
|
294
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
295
|
-
│ MEMORY TYPES │
|
|
296
|
-
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌──────────┐ │
|
|
297
|
-
│ │ Heuristics │ │ Outcomes │ │Preferences │ │Anti-patt.│ │
|
|
298
|
-
│ └────────────┘ └────────────┘ └────────────┘ └──────────┘ │
|
|
299
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
## Documentation
|
|
303
|
-
|
|
304
|
-
- [PRD](docs/architecture/PRD.md) - Full product requirements
|
|
305
|
-
- [Harness Pattern](docs/guides/harness-pattern.md) - Deep dive on the pattern
|
|
306
|
-
- [API Reference](docs/api/) - Coming soon
|
|
307
|
-
|
|
308
|
-
## Status
|
|
309
|
-
|
|
310
|
-
| Phase | Description | Status |
|
|
311
|
-
|-------|-------------|--------|
|
|
312
|
-
| 1 | Core Abstractions | Done |
|
|
313
|
-
| 2 | Local Storage (SQLite + FAISS) | Done |
|
|
314
|
-
| 3 | Retrieval Engine | In Progress |
|
|
315
|
-
| 4 | Learning Protocols | Todo |
|
|
316
|
-
| 5 | Agent Integration (Helena + Victor) | Todo |
|
|
317
|
-
| 6 | Azure Cosmos DB | Todo |
|
|
318
|
-
| 7 | Cache Layer | Todo |
|
|
319
|
-
| 8 | Forgetting Mechanism | Todo |
|
|
320
|
-
|
|
321
|
-
## License
|
|
322
|
-
|
|
323
|
-
MIT
|
|
324
|
-
|
|
325
|
-
## Contributing
|
|
326
|
-
|
|
327
|
-
Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
File without changes
|
|
File without changes
|