runtime-memory 3.0.0__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.
Files changed (90) hide show
  1. runtime_memory-3.0.0/.gitignore +74 -0
  2. runtime_memory-3.0.0/LICENSE +21 -0
  3. runtime_memory-3.0.0/PKG-INFO +497 -0
  4. runtime_memory-3.0.0/README.md +435 -0
  5. runtime_memory-3.0.0/pyproject.toml +212 -0
  6. runtime_memory-3.0.0/src/runtime_memory/__init__.py +28 -0
  7. runtime_memory-3.0.0/src/runtime_memory/claude_code/__init__.py +48 -0
  8. runtime_memory-3.0.0/src/runtime_memory/claude_code/commands.py +698 -0
  9. runtime_memory-3.0.0/src/runtime_memory/claude_code/daemon.py +852 -0
  10. runtime_memory-3.0.0/src/runtime_memory/claude_code/hooks.py +722 -0
  11. runtime_memory-3.0.0/src/runtime_memory/cli/__init__.py +8 -0
  12. runtime_memory-3.0.0/src/runtime_memory/cli/main.py +1936 -0
  13. runtime_memory-3.0.0/src/runtime_memory/core/__init__.py +216 -0
  14. runtime_memory-3.0.0/src/runtime_memory/core/config.py +473 -0
  15. runtime_memory-3.0.0/src/runtime_memory/core/embeddings.py +908 -0
  16. runtime_memory-3.0.0/src/runtime_memory/core/engine.py +1007 -0
  17. runtime_memory-3.0.0/src/runtime_memory/core/exceptions.py +547 -0
  18. runtime_memory-3.0.0/src/runtime_memory/core/legacy_env.py +39 -0
  19. runtime_memory-3.0.0/src/runtime_memory/core/logging.py +160 -0
  20. runtime_memory-3.0.0/src/runtime_memory/core/models.py +1051 -0
  21. runtime_memory-3.0.0/src/runtime_memory/core/observability.py +725 -0
  22. runtime_memory-3.0.0/src/runtime_memory/core/paths.py +30 -0
  23. runtime_memory-3.0.0/src/runtime_memory/core/resilience.py +511 -0
  24. runtime_memory-3.0.0/src/runtime_memory/core/retrieval.py +819 -0
  25. runtime_memory-3.0.0/src/runtime_memory/core/storage.py +1105 -0
  26. runtime_memory-3.0.0/src/runtime_memory/extraction/__init__.py +36 -0
  27. runtime_memory-3.0.0/src/runtime_memory/extraction/extractor.py +1143 -0
  28. runtime_memory-3.0.0/src/runtime_memory/hermes/__init__.py +39 -0
  29. runtime_memory-3.0.0/src/runtime_memory/hermes/_base.py +154 -0
  30. runtime_memory-3.0.0/src/runtime_memory/hermes/bridge.py +119 -0
  31. runtime_memory-3.0.0/src/runtime_memory/hermes/plugin.yaml +13 -0
  32. runtime_memory-3.0.0/src/runtime_memory/hermes/provider.py +536 -0
  33. runtime_memory-3.0.0/src/runtime_memory/hermes/tools.py +230 -0
  34. runtime_memory-3.0.0/src/runtime_memory/hermes/trace.py +177 -0
  35. runtime_memory-3.0.0/src/runtime_memory/plugin/__init__.py +646 -0
  36. runtime_memory-3.0.0/src/runtime_memory/sdk/__init__.py +97 -0
  37. runtime_memory-3.0.0/src/runtime_memory/sdk/client.py +1577 -0
  38. runtime_memory-3.0.0/src/runtime_memory/server/__init__.py +75 -0
  39. runtime_memory-3.0.0/src/runtime_memory/server/api.py +1665 -0
  40. runtime_memory-3.0.0/src/runtime_memory/server/mcp.py +1574 -0
  41. runtime_memory-3.0.0/src/runtime_memory/server/static/css/styles.css +1110 -0
  42. runtime_memory-3.0.0/src/runtime_memory/server/static/index.html +264 -0
  43. runtime_memory-3.0.0/src/runtime_memory/server/static/js/api.js +294 -0
  44. runtime_memory-3.0.0/src/runtime_memory/server/static/js/app.js +771 -0
  45. runtime_memory-3.0.0/src/runtime_memory/tasks/__init__.py +114 -0
  46. runtime_memory-3.0.0/src/runtime_memory/tasks/adapter.py +501 -0
  47. runtime_memory-3.0.0/src/runtime_memory/tasks/claude_code_adapter.py +495 -0
  48. runtime_memory-3.0.0/src/runtime_memory/tasks/claude_code_parser.py +339 -0
  49. runtime_memory-3.0.0/src/runtime_memory/tasks/cli_bridge.py +415 -0
  50. runtime_memory-3.0.0/src/runtime_memory/tasks/linking.py +397 -0
  51. runtime_memory-3.0.0/src/runtime_memory/tasks/models.py +520 -0
  52. runtime_memory-3.0.0/src/runtime_memory/tasks/outcomes.py +320 -0
  53. runtime_memory-3.0.0/src/runtime_memory/tasks/parser.py +305 -0
  54. runtime_memory-3.0.0/src/runtime_memory/tasks/unified_adapter.py +661 -0
  55. runtime_memory-3.0.0/tests/__init__.py +0 -0
  56. runtime_memory-3.0.0/tests/conftest.py +51 -0
  57. runtime_memory-3.0.0/tests/functional/__init__.py +0 -0
  58. runtime_memory-3.0.0/tests/integration/__init__.py +0 -0
  59. runtime_memory-3.0.0/tests/integration/test_engine_integration.py +419 -0
  60. runtime_memory-3.0.0/tests/integration/test_extractor_integration.py +366 -0
  61. runtime_memory-3.0.0/tests/performance/__init__.py +0 -0
  62. runtime_memory-3.0.0/tests/security/__init__.py +0 -0
  63. runtime_memory-3.0.0/tests/uat/__init__.py +0 -0
  64. runtime_memory-3.0.0/tests/uat/test_uat.py +790 -0
  65. runtime_memory-3.0.0/tests/unit/__init__.py +0 -0
  66. runtime_memory-3.0.0/tests/unit/test_api.py +1229 -0
  67. runtime_memory-3.0.0/tests/unit/test_beads.py +889 -0
  68. runtime_memory-3.0.0/tests/unit/test_claude_code_tasks.py +734 -0
  69. runtime_memory-3.0.0/tests/unit/test_cli.py +1027 -0
  70. runtime_memory-3.0.0/tests/unit/test_commands.py +785 -0
  71. runtime_memory-3.0.0/tests/unit/test_config.py +367 -0
  72. runtime_memory-3.0.0/tests/unit/test_config_validation.py +661 -0
  73. runtime_memory-3.0.0/tests/unit/test_daemon.py +597 -0
  74. runtime_memory-3.0.0/tests/unit/test_embeddings.py +777 -0
  75. runtime_memory-3.0.0/tests/unit/test_engine.py +800 -0
  76. runtime_memory-3.0.0/tests/unit/test_exceptions.py +381 -0
  77. runtime_memory-3.0.0/tests/unit/test_extractor.py +829 -0
  78. runtime_memory-3.0.0/tests/unit/test_hermes_provider.py +622 -0
  79. runtime_memory-3.0.0/tests/unit/test_hooks.py +635 -0
  80. runtime_memory-3.0.0/tests/unit/test_legacy_compat.py +90 -0
  81. runtime_memory-3.0.0/tests/unit/test_mcp.py +1211 -0
  82. runtime_memory-3.0.0/tests/unit/test_models.py +685 -0
  83. runtime_memory-3.0.0/tests/unit/test_observability.py +456 -0
  84. runtime_memory-3.0.0/tests/unit/test_plugin.py +473 -0
  85. runtime_memory-3.0.0/tests/unit/test_resilience.py +533 -0
  86. runtime_memory-3.0.0/tests/unit/test_retrieval.py +728 -0
  87. runtime_memory-3.0.0/tests/unit/test_sdk.py +998 -0
  88. runtime_memory-3.0.0/tests/unit/test_setup.py +173 -0
  89. runtime_memory-3.0.0/tests/unit/test_storage.py +777 -0
  90. runtime_memory-3.0.0/tests/unit/test_v2_models.py +727 -0
@@ -0,0 +1,74 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+
27
+ # Virtual environments
28
+ .venv/
29
+ venv/
30
+ ENV/
31
+ env/
32
+
33
+ # IDE
34
+ .idea/
35
+ .vscode/
36
+ *.swp
37
+ *.swo
38
+ *~
39
+
40
+ # Testing
41
+ .pytest_cache/
42
+ .coverage
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+
47
+ # Mypy
48
+ .mypy_cache/
49
+ .dmypy.json
50
+ dmypy.json
51
+
52
+ # Ruff
53
+ .ruff_cache/
54
+
55
+ # Database files
56
+ *.db
57
+ *.sqlite
58
+ *.sqlite3
59
+
60
+ # Logs
61
+ *.log
62
+ logs/
63
+
64
+ # Environment variables
65
+ .env
66
+ .env.local
67
+ .env.*.local
68
+
69
+ # OS files
70
+ .DS_Store
71
+ Thumbs.db
72
+
73
+ # Memory Layer specific
74
+ ~/.memory-layer/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Runtime Notes
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,497 @@
1
+ Metadata-Version: 2.5
2
+ Name: runtime-memory
3
+ Version: 3.0.0
4
+ Summary: Persistent memory for AI coding agents with outcome-based learning
5
+ Project-URL: Homepage, https://github.com/runtimenoteslabs/memory-layer
6
+ Project-URL: Documentation, https://github.com/runtimenoteslabs/memory-layer#readme
7
+ Project-URL: Repository, https://github.com/runtimenoteslabs/memory-layer
8
+ Project-URL: Issues, https://github.com/runtimenoteslabs/memory-layer/issues
9
+ Project-URL: Changelog, https://github.com/runtimenoteslabs/memory-layer/blob/main/CHANGELOG.md
10
+ Author: exitcode42
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: ai,claude,coding-agents,mcp,memory
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: aiosqlite>=0.19.0
22
+ Requires-Dist: click>=8.1.0
23
+ Requires-Dist: httpx>=0.25.0
24
+ Requires-Dist: numpy>=1.24.0
25
+ Requires-Dist: pydantic-settings>=2.0.0
26
+ Requires-Dist: pydantic>=2.5.0
27
+ Requires-Dist: watchdog>=3.0.0
28
+ Provides-Extra: all
29
+ Requires-Dist: anthropic>=0.18.0; extra == 'all'
30
+ Requires-Dist: fastapi>=0.109.0; extra == 'all'
31
+ Requires-Dist: mcp>=1.0.0; extra == 'all'
32
+ Requires-Dist: rich>=13.0.0; extra == 'all'
33
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'all'
34
+ Requires-Dist: uvicorn>=0.27.0; extra == 'all'
35
+ Provides-Extra: dev
36
+ Requires-Dist: black>=24.1.0; extra == 'dev'
37
+ Requires-Dist: httpx>=0.25.0; extra == 'dev'
38
+ Requires-Dist: mypy>=1.8.0; extra == 'dev'
39
+ Requires-Dist: pre-commit>=3.6.0; extra == 'dev'
40
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
41
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
42
+ Requires-Dist: pytest>=7.4.0; extra == 'dev'
43
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
44
+ Provides-Extra: embedding
45
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'embedding'
46
+ Provides-Extra: extraction
47
+ Requires-Dist: anthropic>=0.18.0; extra == 'extraction'
48
+ Provides-Extra: phase1
49
+ Requires-Dist: anthropic>=0.18.0; extra == 'phase1'
50
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'phase1'
51
+ Provides-Extra: phase2
52
+ Requires-Dist: fastapi>=0.109.0; extra == 'phase2'
53
+ Requires-Dist: mcp>=1.0.0; extra == 'phase2'
54
+ Requires-Dist: rich>=13.0.0; extra == 'phase2'
55
+ Requires-Dist: uvicorn>=0.27.0; extra == 'phase2'
56
+ Provides-Extra: server
57
+ Requires-Dist: fastapi>=0.109.0; extra == 'server'
58
+ Requires-Dist: mcp>=1.0.0; extra == 'server'
59
+ Requires-Dist: rich>=13.0.0; extra == 'server'
60
+ Requires-Dist: uvicorn>=0.27.0; extra == 'server'
61
+ Description-Content-Type: text/markdown
62
+
63
+ # Runtime Memory
64
+
65
+ Persistent memory for AI coding agents with outcome-based learning.
66
+
67
+ > **New to Runtime Memory?** See the [User Guide](https://github.com/runtimenoteslabs/memory-layer/blob/main/USER_GUIDE.md) for an introduction to using Runtime Memory with Claude Code.
68
+
69
+ ## What It Does
70
+
71
+ Runtime Memory stores knowledge from your coding sessions and learns which memories actually help. When advice works, it gets boosted (+0.2). When it fails, it gets penalized (-0.3). Over time, good memories rise to the top.
72
+
73
+ ## Installation
74
+
75
+ ```bash
76
+ pip install runtime-memory
77
+ ```
78
+
79
+ Or from source:
80
+
81
+ ```bash
82
+ pip install git+https://github.com/runtimenoteslabs/memory-layer.git
83
+ ```
84
+
85
+ For development:
86
+
87
+ ```bash
88
+ git clone https://github.com/runtimenoteslabs/memory-layer.git
89
+ cd memory-layer
90
+ pip install -e ".[dev]"
91
+ ```
92
+
93
+ The distribution is `runtime-memory` and the import is `runtime_memory`. The
94
+ repository is still named memory-layer, which is where the project started; the
95
+ package was renamed in 3.0. An unrelated package holds `memory-layer` on PyPI,
96
+ so `pip install memory-layer` fetches that one instead of this project.
97
+
98
+ **Note:** First run downloads an embedding model (~100MB) for semantic search. This happens once and is cached. Subsequent operations are fast (<100ms).
99
+
100
+ ## Quick Start
101
+
102
+ ### Python SDK
103
+
104
+ ```python
105
+ from runtime_memory.sdk import MemoryClient
106
+
107
+ async with MemoryClient() as client:
108
+ # Store a memory
109
+ memory = await client.add(
110
+ content="Use async/await for I/O operations",
111
+ category="pattern",
112
+ )
113
+
114
+ # Search memories
115
+ results = await client.search("async patterns", limit=5)
116
+
117
+ # Record feedback
118
+ await client.record_outcome(memory.id, "worked")
119
+
120
+ # Get context for your project
121
+ context = await client.get_context()
122
+ ```
123
+
124
+ ### Synchronous Client
125
+
126
+ ```python
127
+ from runtime_memory.sdk import SyncMemoryClient
128
+
129
+ with SyncMemoryClient() as client:
130
+ client.add("Always validate user input", category="convention")
131
+ results = client.search("input validation")
132
+ ```
133
+
134
+ ### CLI
135
+
136
+ ```bash
137
+ # Add a memory
138
+ mem add "Use type hints for better IDE support" -c convention
139
+
140
+ # Search memories
141
+ mem search "type hints"
142
+
143
+ # Record outcome
144
+ mem outcome <memory-id> worked
145
+
146
+ # Get context
147
+ mem context
148
+
149
+ # Start REST API server
150
+ mem serve --rest --port 8080
151
+
152
+ # Start MCP server
153
+ mem serve --mcp
154
+ ```
155
+
156
+ ### REST API
157
+
158
+ ```bash
159
+ # Start server
160
+ mem serve --rest --port 8080
161
+
162
+ # Add a memory
163
+ curl -X POST http://localhost:8080/memories \
164
+ -H "Content-Type: application/json" \
165
+ -d '{"content": "Always use pytest", "category": "convention"}'
166
+
167
+ # Search
168
+ curl -X POST http://localhost:8080/memories/search \
169
+ -H "Content-Type: application/json" \
170
+ -d '{"query": "testing"}'
171
+ ```
172
+
173
+ ### MCP Server
174
+
175
+ For multi-agent setups, Runtime Memory provides an MCP server:
176
+
177
+ ```bash
178
+ mem serve --mcp
179
+ ```
180
+
181
+ Configure in your MCP client:
182
+
183
+ ```json
184
+ {
185
+ "memory-layer": {
186
+ "command": "mem",
187
+ "args": ["serve", "--mcp"]
188
+ }
189
+ }
190
+ ```
191
+
192
+ #### Multi-Agent Configurations
193
+
194
+ All agents share the same memory store. Memories created in Claude Code appear in Cursor, feedback from OpenCode improves results everywhere.
195
+
196
+ **OpenCode** (`~/.opencode/config.json`):
197
+ ```json
198
+ {
199
+ "mcpServers": {
200
+ "memory-layer": {
201
+ "command": "mem",
202
+ "args": ["serve", "--mcp"]
203
+ }
204
+ }
205
+ }
206
+ ```
207
+
208
+ **Cursor** (`~/.cursor/mcp.json`):
209
+ ```json
210
+ {
211
+ "mcpServers": {
212
+ "memory-layer": {
213
+ "command": "mem",
214
+ "args": ["serve", "--mcp"]
215
+ }
216
+ }
217
+ }
218
+ ```
219
+
220
+ **Windsurf** (`~/.windsurf/mcp.json`):
221
+ ```json
222
+ {
223
+ "mcpServers": {
224
+ "memory-layer": {
225
+ "command": "mem",
226
+ "args": ["serve", "--mcp"]
227
+ }
228
+ }
229
+ }
230
+ ```
231
+
232
+ ### Claude Code Integration
233
+
234
+ Runtime Memory integrates with Claude Code via hooks and skills. For a beginner-friendly walkthrough, see the [User Guide](https://github.com/runtimenoteslabs/memory-layer/blob/main/USER_GUIDE.md).
235
+
236
+ **Installation:**
237
+
238
+ ```bash
239
+ pip install runtime-memory
240
+
241
+ # Go to your project directory
242
+ cd your-project
243
+
244
+ # Install Claude Code plugin
245
+ mem install-plugin
246
+
247
+ # Start Claude Code
248
+ claude
249
+ ```
250
+
251
+ The `mem install-plugin` command creates:
252
+ - `.claude/settings.json` - Hooks for SessionStart, SessionEnd, PostToolUse
253
+ - `.claude/commands/` - Slash commands (/remember, /recall, /outcome, etc.)
254
+ - `.claude/skills/` - Agent skills (memory-retrieval, outcome-feedback, coding-patterns)
255
+ - `.claude-plugin/plugin.json` - Plugin manifest
256
+ - `.mcp.json` - MCP server configuration
257
+
258
+ **What happens automatically:**
259
+
260
+ - **SessionStart hook**: Loads relevant memories when you start Claude Code
261
+ - **PreCompact hook**: Extracts learnings before context compaction (prevents losing insights)
262
+ - **PostToolUse hook**: Tracks files you edit for context
263
+ - **SessionEnd hook**: Generates session summary when you exit
264
+ - **Skills**: Auto-retrieval when you ask "what's our convention...", feedback detection when you say "thanks, that worked!"
265
+
266
+ **Slash commands in Claude Code:**
267
+
268
+ ```
269
+ /remember <content> # Store a memory
270
+ /remember category:gotcha <content> # Store with category
271
+ /recall <query> # Search memories
272
+ /memories # List all memories
273
+ /outcome <id> worked|failed # Record feedback
274
+ /forget <id> # Archive a memory
275
+ /memory-context # Get project context
276
+ ```
277
+
278
+ ### Task Integration (Beads + Claude Code)
279
+
280
+ Runtime Memory integrates with task trackers to automatically learn from task outcomes.
281
+
282
+ **Supported sources:**
283
+ - [Beads](https://github.com/steveyegge/beads) - `.beads/` directory
284
+ - Claude Code Tasks - `~/.claude/todos/` directory
285
+
286
+ **How it works:**
287
+ 1. You work on a task, Claude searches for relevant memories
288
+ 2. Those memories get linked to your task
289
+ 3. When you mark the task done, linked memories are automatically boosted
290
+
291
+ ```bash
292
+ # Unified task commands (all sources)
293
+ mem tasks # List all tasks
294
+ mem tasks --source beads # Filter by source
295
+ mem tasks --source claude # Claude Code tasks only
296
+ mem tasks-sync # Sync outcomes
297
+ mem tasks-context # Get task context with memories
298
+ mem tasks-stats # View statistics
299
+
300
+ # Legacy Beads-specific commands (still supported)
301
+ mem beads-sync
302
+ mem beads-context
303
+ mem beads-stats
304
+ ```
305
+
306
+ No setup required - Runtime Memory auto-detects both `.beads/` and `~/.claude/todos/` directories.
307
+
308
+ **Environment variables:**
309
+ - `CLAUDE_CODE_TASK_LIST_ID` - Filter to specific task list
310
+ - `CLAUDE_CODE_TODOS_DIR` - Custom todos directory location
311
+
312
+ ### Hermes Agent Integration
313
+
314
+ Runtime Memory can serve as Hermes Agent's memory provider, replacing its capped
315
+ note file with retrieval over the same store Claude Code and MCP clients use.
316
+
317
+ ```bash
318
+ # Install into the environment Hermes runs in
319
+ ~/.hermes/hermes-agent/venv/bin/python -m pip install \
320
+ git+https://github.com/runtimenoteslabs/memory-layer.git
321
+
322
+ hermes config set memory.provider runtimememory
323
+ ```
324
+
325
+ Hermes finds the provider through the `hermes_agent.memory_providers` entry
326
+ point, so you do not edit its code or config files by hand. See
327
+ [docs/hermes.md](https://github.com/runtimenoteslabs/memory-layer/blob/main/docs/hermes.md) for configuration, the tool surface, and the
328
+ evaluation trace format.
329
+
330
+ ### Web UI
331
+
332
+ Runtime Memory includes a web interface for browsing and managing memories.
333
+
334
+ ```bash
335
+ # Start server with Web UI
336
+ mem serve --rest --port 8080
337
+
338
+ # Open http://localhost:8080
339
+ ```
340
+
341
+ **Features:**
342
+ - Dashboard with category statistics
343
+ - Memory list with filtering and search
344
+ - Semantic and keyword search modes
345
+ - Task viewer (Beads + Claude Code)
346
+ - Add/edit memories
347
+ - Record outcomes
348
+ - Light/dark theme
349
+
350
+ ## Memory Categories
351
+
352
+ | Category | Use For | Example |
353
+ |----------|---------|---------|
354
+ | `architecture` | System design | "Microservices with event sourcing" |
355
+ | `convention` | Coding standards | "Use snake_case for Python" |
356
+ | `decision` | Technical choices | "Chose Postgres for ACID compliance" |
357
+ | `pattern` | Reusable solutions | "Repository pattern for data access" |
358
+ | `gotcha` | Pitfalls to avoid | "Don't use mutable default arguments" |
359
+ | `workaround` | Temporary fixes | "Redis reconnect hack for timeout bug" |
360
+ | `troubleshooting` | Error solutions | "Clear cache if tests fail randomly" |
361
+ | `command` | Useful commands | "npm run test:coverage" |
362
+ | `preference` | User preferences | "Prefer functional style" |
363
+
364
+ ## Outcome Scoring
365
+
366
+ | Outcome | Score Change | When to Use |
367
+ |---------|--------------|-------------|
368
+ | `worked` | +0.2 | Advice solved the problem |
369
+ | `failed` | -0.3 | Advice was wrong or unhelpful |
370
+ | `partial` | +0.05 | Advice was on the right track |
371
+
372
+ The asymmetric scoring is intentional: bad advice wastes debugging time and erodes trust, so it's penalized more heavily.
373
+
374
+ ## How Retrieval Works
375
+
376
+ Runtime Memory uses a 5-signal hybrid retrieval system that combines multiple relevance signals:
377
+
378
+ | Signal | Weight | Description |
379
+ |--------|--------|-------------|
380
+ | Semantic | 35% | Vector similarity to your query |
381
+ | Outcome | 25% | Learned effectiveness from feedback |
382
+ | Recency | 15% | Recent memories weighted higher (30-day half-life) |
383
+ | Frequency | 15% | Frequently used memories rise |
384
+ | Confidence | 10% | Extraction confidence score |
385
+
386
+ Two of the five signals, outcome and frequency, come from how memories have
387
+ performed rather than from the query, so ranking changes as feedback accumulates.
388
+
389
+ ### Category Boosting
390
+
391
+ When you ask about errors, troubleshooting memories get a 1.5x boost. Query intent is detected and the right category is prioritized:
392
+
393
+ | Query Pattern | Boosted Category | Multiplier |
394
+ |---------------|------------------|------------|
395
+ | "What went wrong..." | troubleshooting | 1.5x |
396
+ | "Watch out for..." | gotcha | 1.4x |
397
+ | "Why did we choose..." | decision | 1.4x |
398
+ | "How should I structure..." | pattern, convention | 1.3x |
399
+ | "System design..." | architecture | 1.2x |
400
+
401
+ ## Results
402
+
403
+ After 12 weeks of use:
404
+
405
+ | Metric | Improvement |
406
+ |--------|-------------|
407
+ | Retrieval precision | 70% → 90% |
408
+ | Session start context | 54% token savings |
409
+ | Post-compaction recovery | 84% token savings |
410
+ | Search latency (P95) | <150ms |
411
+
412
+ ## Configuration
413
+
414
+ ### Environment Variables
415
+
416
+ | Variable | Description | Default |
417
+ |----------|-------------|---------|
418
+ | `ANTHROPIC_API_KEY` | For LLM-based extraction | Required for extraction features |
419
+ | `MEMORY_LAYER_DB` | Database location | `~/.runtime-memory/memories.db` |
420
+ | `MEMORY_LAYER_ENV` | Environment (development/testing/production) | development |
421
+ | `MEMORY_LAYER_LOG_LEVEL` | Logging level | WARNING |
422
+ | `CLAUDE_CODE_TASK_LIST_ID` | Filter Claude Code tasks | None |
423
+ | `CLAUDE_CODE_TODOS_DIR` | Custom todos directory | `~/.claude/todos/` |
424
+
425
+ ### Data Location
426
+
427
+ ```
428
+ ~/.runtime-memory/
429
+ └── memories.db # SQLite database
430
+ ```
431
+
432
+ ## Project Structure
433
+
434
+ ```
435
+ memory-layer/
436
+ ├── src/runtime_memory/
437
+ │ ├── core/ # Storage, retrieval, models, config, resilience
438
+ │ ├── extraction/ # LLM-based memory extraction
439
+ │ ├── server/ # MCP server, REST API, Web UI
440
+ │ ├── tasks/ # Task integration (Beads, Claude Code)
441
+ │ ├── cli/ # Command-line interface
442
+ │ └── sdk/ # Python SDK
443
+ └── tests/
444
+ ├── unit/
445
+ ├── integration/
446
+ └── ...
447
+ ```
448
+
449
+ ## Security
450
+
451
+ Runtime Memory is designed for local, single-user use:
452
+
453
+ - **Local storage**: All data stored in `~/.runtime-memory/` (SQLite database)
454
+ - **No external transmission**: Memories never leave your machine (except for LLM extraction if enabled)
455
+ - **Parameterized queries**: All database operations use parameterized SQL (no injection risk)
456
+ - **Input validation**: Pydantic models validate all API inputs
457
+ - **Server binding**: REST API binds to `127.0.0.1` by default (localhost only)
458
+
459
+ **API Keys**: If using LLM extraction features, set `ANTHROPIC_API_KEY` as an environment variable. Never commit API keys to version control.
460
+
461
+ **Multi-user warning**: The REST API and MCP server are not designed for multi-user/production deployment. For shared use, deploy behind an authentication proxy.
462
+
463
+ ## Development
464
+
465
+ ```bash
466
+ # Install dev dependencies
467
+ pip install -e ".[dev]"
468
+
469
+ # Run tests
470
+ pytest
471
+
472
+ # Run linting
473
+ ruff check src tests
474
+ mypy src
475
+ ```
476
+
477
+ ## License
478
+
479
+ MIT
480
+
481
+ ## Acknowledgments
482
+
483
+ Runtime Memory was inspired by studying 11 existing AI memory systems:
484
+
485
+ - [claude-mem](https://github.com/thedotmack/claude-mem) - UX patterns, progressive disclosure, web viewer
486
+ - [Claude Diary](https://github.com/rlancemartin/claude-diary) - Reflection synthesis, minimal viable memory
487
+ - [Mem0](https://github.com/mem0ai/mem0) - Hybrid storage patterns, community building
488
+ - [Graphiti/Zep](https://github.com/getzep/graphiti) - Bi-temporal modeling, research-grade benchmarks
489
+ - [CORE](https://github.com/RedPlanetHQ/core) - Knowledge graph architecture, temporal modeling
490
+ - [Supermemory](https://github.com/supermemoryai/supermemory) - Relationship types, temporal decay
491
+ - [Memvid](https://github.com/memvid/memvid) - Single-file portability, embedded WAL
492
+ - [Beads](https://github.com/steveyegge/beads) - Task integration, git-native tracking
493
+ - [Roampal](https://github.com/roampal-ai/roampal) - Independent validation of outcome-based learning
494
+
495
+ And thank you to Anthropic for CLAUDE.md - the right foundation for project memory.
496
+
497
+ The key insight: none of these systems learn from outcomes. Runtime Memory adds a feedback loop so memories that actually help rise to the top.