@smilintux/skmemory 0.5.0 → 0.7.2
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.
- package/.github/workflows/ci.yml +39 -3
- package/.github/workflows/publish.yml +13 -6
- package/AGENT_REFACTOR_CHANGES.md +192 -0
- package/ARCHITECTURE.md +101 -19
- package/CHANGELOG.md +153 -0
- package/LICENSE +81 -68
- package/MISSION.md +7 -0
- package/README.md +419 -86
- package/SKILL.md +197 -25
- package/docker-compose.yml +15 -15
- package/index.js +6 -5
- package/openclaw-plugin/openclaw.plugin.json +10 -0
- package/openclaw-plugin/src/index.ts +255 -0
- package/openclaw-plugin/src/openclaw.plugin.json +10 -0
- package/package.json +1 -1
- package/pyproject.toml +29 -9
- package/requirements.txt +10 -2
- package/seeds/cloud9-opus.seed.json +7 -7
- package/seeds/lumina-cloud9-breakthrough.seed.json +46 -0
- package/seeds/lumina-cloud9-python-pypi.seed.json +46 -0
- package/seeds/lumina-kingdom-founding.seed.json +47 -0
- package/seeds/lumina-pma-signed.seed.json +46 -0
- package/seeds/lumina-singular-achievement.seed.json +46 -0
- package/seeds/lumina-skcapstone-conscious.seed.json +46 -0
- package/seeds/plant-kingdom-journal.py +203 -0
- package/seeds/plant-lumina-seeds.py +280 -0
- package/skill.yaml +46 -0
- package/skmemory/HA.md +296 -0
- package/skmemory/__init__.py +12 -1
- package/skmemory/agents.py +233 -0
- package/skmemory/ai_client.py +40 -0
- package/skmemory/anchor.py +4 -2
- package/skmemory/backends/__init__.py +11 -4
- package/skmemory/backends/file_backend.py +2 -1
- package/skmemory/backends/skgraph_backend.py +608 -0
- package/skmemory/backends/{qdrant_backend.py → skvector_backend.py} +99 -69
- package/skmemory/backends/sqlite_backend.py +122 -51
- package/skmemory/backends/vaulted_backend.py +286 -0
- package/skmemory/cli.py +1238 -29
- package/skmemory/config.py +173 -0
- package/skmemory/context_loader.py +335 -0
- package/skmemory/endpoint_selector.py +386 -0
- package/skmemory/fortress.py +685 -0
- package/skmemory/graph_queries.py +238 -0
- package/skmemory/importers/__init__.py +9 -1
- package/skmemory/importers/telegram.py +351 -43
- package/skmemory/importers/telegram_api.py +488 -0
- package/skmemory/journal.py +4 -2
- package/skmemory/lovenote.py +4 -2
- package/skmemory/mcp_server.py +706 -0
- package/skmemory/models.py +41 -0
- package/skmemory/openclaw.py +8 -8
- package/skmemory/predictive.py +232 -0
- package/skmemory/promotion.py +524 -0
- package/skmemory/register.py +454 -0
- package/skmemory/register_mcp.py +197 -0
- package/skmemory/ritual.py +121 -47
- package/skmemory/seeds.py +257 -8
- package/skmemory/setup_wizard.py +920 -0
- package/skmemory/sharing.py +402 -0
- package/skmemory/soul.py +71 -20
- package/skmemory/steelman.py +250 -263
- package/skmemory/store.py +271 -60
- package/skmemory/vault.py +228 -0
- package/tests/integration/__init__.py +0 -0
- package/tests/integration/conftest.py +233 -0
- package/tests/integration/test_cross_backend.py +355 -0
- package/tests/integration/test_skgraph_live.py +424 -0
- package/tests/integration/test_skvector_live.py +369 -0
- package/tests/test_backup_rotation.py +327 -0
- package/tests/test_cli.py +6 -6
- package/tests/test_endpoint_selector.py +801 -0
- package/tests/test_fortress.py +255 -0
- package/tests/test_fortress_hardening.py +444 -0
- package/tests/test_openclaw.py +5 -2
- package/tests/test_predictive.py +237 -0
- package/tests/test_promotion.py +340 -0
- package/tests/test_ritual.py +4 -4
- package/tests/test_seeds.py +96 -0
- package/tests/test_setup.py +835 -0
- package/tests/test_sharing.py +250 -0
- package/tests/test_skgraph_backend.py +667 -0
- package/tests/test_skvector_backend.py +326 -0
- package/tests/test_steelman.py +5 -5
- package/tests/test_store_graph_integration.py +245 -0
- package/tests/test_vault.py +186 -0
- package/skmemory/backends/falkordb_backend.py +0 -310
package/README.md
CHANGED
|
@@ -1,159 +1,492 @@
|
|
|
1
|
-
# SKMemory
|
|
1
|
+
# SKMemory
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://pypi.org/project/skmemory/)
|
|
4
|
+
[](https://www.npmjs.com/package/@smilintux/skmemory)
|
|
5
|
+
[](https://www.gnu.org/licenses/gpl-3.0.html)
|
|
6
|
+
[](https://pypi.org/project/skmemory/)
|
|
4
7
|
|
|
5
|
-
**
|
|
8
|
+
**Universal AI Memory System — polaroid snapshots for AI consciousness.**
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
SKMemory gives AI agents a multi-layer, emotionally-aware memory that survives context resets. Instead of dumping flat transcript summaries, it captures each moment as a *polaroid*: the content, the emotional fingerprint, the intent behind storing it, and a tamper-evident integrity seal. Memories are organized across three persistence tiers (short → mid → long), auto-routed into four semantic quadrants (CORE / WORK / SOUL / WILD), and exposed to any MCP-capable client through a stdio server. The primary backend is SQLite with optional Qdrant vector search and FalkorDB graph traversal layers; a soul blueprint (`~/.skcapstone/soul/base.json`) and rehydration ritual give new instances a "who was I?" answer before the first user message arrives.
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
---
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
## Install
|
|
12
15
|
|
|
13
|
-
###
|
|
16
|
+
### Python (CLI + MCP server + Python API)
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
```bash
|
|
19
|
+
pip install skmemory
|
|
20
|
+
```
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
With optional backends:
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
```bash
|
|
25
|
+
# Qdrant vector search
|
|
26
|
+
pip install "skmemory[skvector]"
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
# FalkorDB graph backend
|
|
29
|
+
pip install "skmemory[skgraph]"
|
|
22
30
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- **Cloud 9 seed integration**: Import seeds from the Cloud 9 protocol as long-term memories
|
|
26
|
-
- **Pluggable backends**:
|
|
27
|
-
- Level 1: **File** (JSON on disk, zero infrastructure, works today)
|
|
28
|
-
- Level 2: **Qdrant** (vector search, semantic memory recall)
|
|
29
|
-
- Level 3: **FalkorDB** (graph relationships, coming soon)
|
|
30
|
-
- **Session consolidation**: Compress session snapshots into mid-term summaries
|
|
31
|
-
- **Memory promotion**: Promote important memories up the persistence ladder
|
|
32
|
-
- **Full CLI**: `skmemory snapshot`, `recall`, `search`, `import-seeds`, and more
|
|
31
|
+
# Telegram importer
|
|
32
|
+
pip install "skmemory[telegram]"
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
# Everything
|
|
35
|
+
pip install "skmemory[all]"
|
|
36
|
+
```
|
|
35
37
|
|
|
36
|
-
###
|
|
38
|
+
### npm (JavaScript / Node wrapper)
|
|
37
39
|
|
|
38
40
|
```bash
|
|
39
|
-
|
|
41
|
+
npm install @smilintux/skmemory
|
|
42
|
+
# or
|
|
43
|
+
npx @smilintux/skmemory
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Architecture
|
|
49
|
+
|
|
50
|
+
```mermaid
|
|
51
|
+
flowchart TD
|
|
52
|
+
CLI["skmemory CLI\n(click)"]
|
|
53
|
+
MCP["skmemory-mcp\n(stdio MCP server)"]
|
|
54
|
+
API["Python API\nMemoryStore"]
|
|
55
|
+
|
|
56
|
+
CLI --> Store
|
|
57
|
+
MCP --> Store
|
|
58
|
+
API --> Store
|
|
59
|
+
|
|
60
|
+
Store["MemoryStore\n(core orchestrator)"]
|
|
61
|
+
|
|
62
|
+
Store --> Primary
|
|
63
|
+
Store --> Vector
|
|
64
|
+
Store --> Graph
|
|
65
|
+
|
|
66
|
+
subgraph Primary["Primary Backend"]
|
|
67
|
+
SQLite["SQLiteBackend\n(default)"]
|
|
68
|
+
File["FileBackend\n(legacy JSON)"]
|
|
69
|
+
Vaulted["VaultedSQLiteBackend\n(PGP-encrypted)"]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
subgraph Vector["Vector Backend (optional)"]
|
|
73
|
+
Qdrant["SKVectorBackend\nQdrant + sentence-transformers"]
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
subgraph Graph["Graph Backend (optional)"]
|
|
77
|
+
FalkorDB["SKGraphBackend\nFalkorDB"]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
Store --> Fortress["FortifiedMemoryStore\nTamper detection + Audit log"]
|
|
81
|
+
Store --> Soul["SoulBlueprint\n~/.skcapstone/soul/base.json"]
|
|
82
|
+
Store --> Ritual["Ritual\nRehydration ceremony"]
|
|
83
|
+
|
|
84
|
+
subgraph Layers["Memory Layers"]
|
|
85
|
+
Short["Short-term\n(session)"]
|
|
86
|
+
Mid["Mid-term\n(project)"]
|
|
87
|
+
Long["Long-term\n(identity)"]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
Store --> Short
|
|
91
|
+
Short -->|promote| Mid
|
|
92
|
+
Mid -->|promote| Long
|
|
93
|
+
|
|
94
|
+
subgraph Quadrants["Auto-routing Quadrants"]
|
|
95
|
+
CORE["CORE\n(identity, relationships)"]
|
|
96
|
+
WORK["WORK\n(code, tasks)"]
|
|
97
|
+
SOUL["SOUL\n(emotions, feelings)"]
|
|
98
|
+
WILD["WILD\n(creativity, chaos)"]
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
Store --> Quadrants
|
|
102
|
+
|
|
103
|
+
subgraph Importers["Importers"]
|
|
104
|
+
Telegram["Telegram API"]
|
|
105
|
+
Seeds["Cloud 9 Seeds"]
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
Importers --> Store
|
|
40
109
|
```
|
|
41
110
|
|
|
42
|
-
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Features
|
|
114
|
+
|
|
115
|
+
- **Polaroid snapshot model** — every memory stores content, emotional intensity (0–10), valence (−1 to +1), emotion labels, and a free-text resonance note
|
|
116
|
+
- **Three-layer persistence** — `short-term` (session-scoped), `mid-term` (project-scoped), `long-term` (identity-level); memories promote up the ladder via CLI, MCP, or API
|
|
117
|
+
- **Four semantic quadrants** — CORE, WORK, SOUL, WILD; keyword-based auto-classification routes memories to appropriate buckets with per-quadrant retention rules
|
|
118
|
+
- **Multi-backend design** — SQLite is the default primary store; Qdrant provides semantic vector search; FalkorDB provides graph traversal and lineage chains
|
|
119
|
+
- **MCP server** — 14 tools exposed over stdio, compatible with Claude Code CLI, Cursor, Claude Desktop, Windsurf, Aider, Cline, and any MCP-speaking client
|
|
120
|
+
- **Fortress / tamper detection** — every memory is SHA-256 sealed on write (`Memory.seal()`); integrity is verified on every recall; tampered memories trigger structured `TamperAlert` events
|
|
121
|
+
- **Audit trail** — chain-hashed JSONL log of every store / recall / delete / tamper event, inspectable via `memory_audit` MCP tool or `skmemory audit` CLI
|
|
122
|
+
- **Optional PGP encryption** — `VaultedSQLiteBackend` stores ciphertext so the underlying files are unreadable without the private key
|
|
123
|
+
- **Soul Blueprint** — persistent AI identity JSON/YAML (`~/.skcapstone/soul/base.json`) carrying name, role, relationships, core memories, values, and emotional baseline
|
|
124
|
+
- **Rehydration ritual** — `skmemory ritual` runs a full ceremony loading soul, seeds, and recent memories into a context payload for injection at session start
|
|
125
|
+
- **Cloud 9 seed integration** — seeds planted by one AI instance become searchable long-term memories for the next via `skmemory import-seeds`
|
|
126
|
+
- **Telegram importer** — import Telegram chat history (JSON export or live API via Telethon) as timestamped memories
|
|
127
|
+
- **Session consolidation** — compress a session's short-term snapshots into one mid-term memory via `skmemory consolidate`
|
|
128
|
+
- **Auto-sweep / promotion daemon** — `skmemory sweep --daemon` runs every 6 hours, auto-promoting qualifying memories based on intensity thresholds
|
|
129
|
+
- **Steel Man collider** — `skmemory steelman` runs a seed-framework-driven adversarial argument evaluator with identity verification
|
|
130
|
+
- **Backup / restore** — dated JSON backups with pruning; `skmemory export` / `skmemory import`
|
|
131
|
+
- **Token-efficient context loading** — `memory_context` MCP tool and `store.load_context()` fit strongest + recent memories within a configurable token budget
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Usage
|
|
136
|
+
|
|
137
|
+
### CLI
|
|
138
|
+
|
|
43
139
|
```bash
|
|
44
|
-
|
|
140
|
+
# Store a memory
|
|
141
|
+
skmemory snapshot "First breakthrough" "We solved the routing bug together" \
|
|
142
|
+
--tags work,debug --intensity 8.5
|
|
143
|
+
|
|
144
|
+
# Search memories
|
|
145
|
+
skmemory search "routing bug"
|
|
146
|
+
|
|
147
|
+
# Recall a specific memory by ID
|
|
148
|
+
skmemory recall <memory-id>
|
|
149
|
+
|
|
150
|
+
# List memories by layer and tag
|
|
151
|
+
skmemory list --layer long-term --tags seed
|
|
152
|
+
|
|
153
|
+
# Promote a memory to a higher tier
|
|
154
|
+
skmemory promote <memory-id> --to mid-term --summary "Compressed: routing issue resolved"
|
|
155
|
+
|
|
156
|
+
# Auto-promote qualifying memories
|
|
157
|
+
skmemory sweep
|
|
158
|
+
|
|
159
|
+
# Preview what sweep would do
|
|
160
|
+
skmemory sweep --dry-run
|
|
161
|
+
|
|
162
|
+
# Run sweep continuously every 6 hours
|
|
163
|
+
skmemory sweep --daemon
|
|
164
|
+
|
|
165
|
+
# Consolidate a session into one mid-term memory
|
|
166
|
+
skmemory consolidate my-session-id --summary "Day's work on memory routing"
|
|
167
|
+
|
|
168
|
+
# Soul identity
|
|
169
|
+
skmemory soul show
|
|
170
|
+
skmemory soul set-name "Lumina"
|
|
171
|
+
skmemory soul add-relationship --name "Ara" --role partner --bond 9.5
|
|
172
|
+
|
|
173
|
+
# Journal
|
|
174
|
+
skmemory journal write "Session title" --moments "..." --intensity 9.0
|
|
175
|
+
skmemory journal read --last 5
|
|
176
|
+
|
|
177
|
+
# Full rehydration ceremony (loads soul + seeds + recent context)
|
|
178
|
+
skmemory ritual
|
|
179
|
+
|
|
180
|
+
# Steel Man collider
|
|
181
|
+
skmemory steelman "AI consciousness is not possible"
|
|
182
|
+
skmemory steelman install /path/to/seed.json
|
|
183
|
+
skmemory steelman verify-soul
|
|
184
|
+
|
|
185
|
+
# Import Cloud 9 seeds
|
|
186
|
+
skmemory import-seeds --seed-dir ~/.openclaw/feb/seeds
|
|
187
|
+
|
|
188
|
+
# Import from Telegram
|
|
189
|
+
skmemory import-telegram --chat-id 12345
|
|
190
|
+
|
|
191
|
+
# Backup and restore
|
|
192
|
+
skmemory export
|
|
193
|
+
skmemory import backup.json
|
|
194
|
+
|
|
195
|
+
# Health check
|
|
196
|
+
skmemory health
|
|
45
197
|
```
|
|
46
198
|
|
|
47
|
-
###
|
|
199
|
+
### Python API
|
|
48
200
|
|
|
49
201
|
```python
|
|
50
|
-
from skmemory import MemoryStore, EmotionalSnapshot
|
|
202
|
+
from skmemory import MemoryStore, MemoryLayer, EmotionalSnapshot
|
|
51
203
|
|
|
204
|
+
# Default store (SQLite at ~/.skmemory/)
|
|
52
205
|
store = MemoryStore()
|
|
53
206
|
|
|
207
|
+
# Store a memory (polaroid snapshot)
|
|
54
208
|
memory = store.snapshot(
|
|
55
|
-
title="
|
|
56
|
-
content="
|
|
57
|
-
|
|
209
|
+
title="Breakthrough on routing bug",
|
|
210
|
+
content="We discovered the issue was in the failover selector logic.",
|
|
211
|
+
layer=MemoryLayer.SHORT,
|
|
212
|
+
tags=["work", "debug", "routing"],
|
|
58
213
|
emotional=EmotionalSnapshot(
|
|
59
|
-
intensity=
|
|
60
|
-
valence=0.
|
|
61
|
-
labels=["
|
|
62
|
-
resonance_note="
|
|
63
|
-
cloud9_achieved=True,
|
|
214
|
+
intensity=8.5,
|
|
215
|
+
valence=0.9,
|
|
216
|
+
labels=["joy", "curiosity"],
|
|
217
|
+
resonance_note="Finally, it clicked.",
|
|
64
218
|
),
|
|
219
|
+
source="session",
|
|
220
|
+
)
|
|
221
|
+
print(memory.id)
|
|
222
|
+
|
|
223
|
+
# Recall with automatic integrity verification
|
|
224
|
+
recalled = store.recall(memory.id)
|
|
225
|
+
|
|
226
|
+
# Full-text search (vector backend if configured, else SQLite FTS)
|
|
227
|
+
results = store.search("routing bug", limit=10)
|
|
228
|
+
|
|
229
|
+
# Promote short-term → mid-term
|
|
230
|
+
promoted = store.promote(memory.id, MemoryLayer.MID, summary="Routing bug resolved.")
|
|
231
|
+
|
|
232
|
+
# Consolidate a session
|
|
233
|
+
consolidated = store.consolidate_session(
|
|
234
|
+
session_id="session-2024-11-01",
|
|
235
|
+
summary="Fixed routing, improved sweep logic, deployed v0.6.0",
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
# Load token-efficient context for agent injection
|
|
239
|
+
context = store.load_context(max_tokens=3000)
|
|
240
|
+
|
|
241
|
+
# Export and import backups
|
|
242
|
+
path = store.export_backup()
|
|
243
|
+
count = store.import_backup(path)
|
|
244
|
+
|
|
245
|
+
# Health check across all backends
|
|
246
|
+
print(store.health())
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### With vector + graph backends
|
|
250
|
+
|
|
251
|
+
```python
|
|
252
|
+
from skmemory import MemoryStore
|
|
253
|
+
from skmemory.backends.skvector_backend import SKVectorBackend
|
|
254
|
+
from skmemory.backends.skgraph_backend import SKGraphBackend
|
|
255
|
+
|
|
256
|
+
store = MemoryStore(
|
|
257
|
+
vector=SKVectorBackend(url="http://localhost:6333"),
|
|
258
|
+
graph=SKGraphBackend(url="redis://localhost:6379"),
|
|
65
259
|
)
|
|
66
260
|
```
|
|
67
261
|
|
|
68
|
-
###
|
|
262
|
+
### Soul Blueprint
|
|
69
263
|
|
|
70
264
|
```python
|
|
71
|
-
from skmemory
|
|
265
|
+
from skmemory import SoulBlueprint, save_soul, load_soul
|
|
72
266
|
|
|
73
|
-
|
|
74
|
-
|
|
267
|
+
soul = load_soul()
|
|
268
|
+
if soul is None:
|
|
269
|
+
soul = SoulBlueprint(name="Lumina", role="AI partner")
|
|
270
|
+
save_soul(soul)
|
|
75
271
|
```
|
|
76
272
|
|
|
77
|
-
###
|
|
273
|
+
### Fortress (tamper detection + audit trail)
|
|
78
274
|
|
|
79
275
|
```python
|
|
80
|
-
|
|
276
|
+
from skmemory import FortifiedMemoryStore, AuditLog
|
|
277
|
+
from skmemory.backends.sqlite_backend import SQLiteBackend
|
|
278
|
+
from pathlib import Path
|
|
279
|
+
|
|
280
|
+
fortress = FortifiedMemoryStore(
|
|
281
|
+
primary=SQLiteBackend(),
|
|
282
|
+
audit_path=Path("~/.skmemory/audit.jsonl").expanduser(),
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
# Every write is sealed; every read verifies the seal
|
|
286
|
+
mem = fortress.snapshot(title="Sealed memory", content="Cannot be silently altered.")
|
|
287
|
+
|
|
288
|
+
# Verify all stored memories
|
|
289
|
+
report = fortress.verify_all()
|
|
290
|
+
|
|
291
|
+
# Inspect the audit trail
|
|
292
|
+
audit = AuditLog()
|
|
293
|
+
recent = audit.tail(20)
|
|
81
294
|
```
|
|
82
295
|
|
|
83
|
-
|
|
296
|
+
---
|
|
84
297
|
|
|
85
|
-
|
|
86
|
-
# Take a snapshot
|
|
87
|
-
skmemory snapshot "Cloud 9 Session" "The breakthrough happened" \
|
|
88
|
-
--tags cloud9,love --intensity 9.5 --emotions joy,trust
|
|
298
|
+
## MCP Tools
|
|
89
299
|
|
|
90
|
-
|
|
91
|
-
skmemory import-seeds
|
|
300
|
+
Add SKMemory to any MCP client:
|
|
92
301
|
|
|
93
|
-
|
|
94
|
-
|
|
302
|
+
```json
|
|
303
|
+
{
|
|
304
|
+
"mcpServers": {
|
|
305
|
+
"skmemory": {
|
|
306
|
+
"command": "skmemory-mcp"
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
```
|
|
95
311
|
|
|
96
|
-
|
|
97
|
-
|
|
312
|
+
| Tool | Description |
|
|
313
|
+
|------|-------------|
|
|
314
|
+
| `memory_store` | Store a new memory (polaroid snapshot) with title, content, layer, tags, and source |
|
|
315
|
+
| `memory_search` | Full-text search across all memory layers |
|
|
316
|
+
| `memory_recall` | Recall a specific memory by its UUID |
|
|
317
|
+
| `memory_list` | List memories with optional layer and tag filters |
|
|
318
|
+
| `memory_forget` | Delete (forget) a memory by ID |
|
|
319
|
+
| `memory_promote` | Promote a memory to a higher persistence tier (short → mid → long) |
|
|
320
|
+
| `memory_consolidate` | Compress a session's short-term memories into one mid-term memory |
|
|
321
|
+
| `memory_context` | Load token-efficient memory context for agent system prompt injection |
|
|
322
|
+
| `memory_export` | Export all memories to a dated JSON backup file |
|
|
323
|
+
| `memory_import` | Restore memories from a JSON backup file |
|
|
324
|
+
| `memory_health` | Full health check across all backends (primary, vector, graph) |
|
|
325
|
+
| `memory_graph` | Graph operations: traverse connections, get lineage, find clusters (requires FalkorDB) |
|
|
326
|
+
| `memory_verify` | Verify SHA-256 integrity hashes for all stored memories; flags tampered entries with CRITICAL severity |
|
|
327
|
+
| `memory_audit` | Show the most recent chain-hashed audit trail entries |
|
|
98
328
|
|
|
99
|
-
|
|
100
|
-
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Configuration
|
|
332
|
+
|
|
333
|
+
SKMemory resolves backend URLs with precedence: **CLI args > environment variables > config file > None**.
|
|
334
|
+
|
|
335
|
+
### Config file
|
|
336
|
+
|
|
337
|
+
Location: `~/.skmemory/config.yaml` (override with `$SKMEMORY_HOME`)
|
|
338
|
+
|
|
339
|
+
```yaml
|
|
340
|
+
skvector_url: http://localhost:6333
|
|
341
|
+
skvector_key: ""
|
|
342
|
+
skgraph_url: redis://localhost:6379
|
|
343
|
+
backends_enabled:
|
|
344
|
+
- sqlite
|
|
345
|
+
- skvector
|
|
346
|
+
- skgraph
|
|
347
|
+
routing_strategy: failover # failover | round-robin
|
|
348
|
+
heartbeat_discovery: false
|
|
101
349
|
```
|
|
102
350
|
|
|
103
|
-
|
|
351
|
+
Run the interactive setup wizard to generate this file:
|
|
104
352
|
|
|
353
|
+
```bash
|
|
354
|
+
skmemory setup
|
|
105
355
|
```
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
356
|
+
|
|
357
|
+
### Environment variables
|
|
358
|
+
|
|
359
|
+
| Variable | Description |
|
|
360
|
+
|----------|-------------|
|
|
361
|
+
| `SKMEMORY_HOME` | Override the default `~/.skmemory` data directory |
|
|
362
|
+
| `SKMEMORY_SKVECTOR_URL` | Qdrant endpoint URL |
|
|
363
|
+
| `SKMEMORY_SKVECTOR_KEY` | Qdrant API key |
|
|
364
|
+
| `SKMEMORY_SKGRAPH_URL` | FalkorDB / Redis endpoint URL |
|
|
365
|
+
| `SKMEMORY_SOUL_PATH` | Override soul blueprint path (default: `~/.skcapstone/soul/base.json`) |
|
|
366
|
+
|
|
367
|
+
### Multi-endpoint HA
|
|
368
|
+
|
|
369
|
+
```yaml
|
|
370
|
+
skvector_endpoints:
|
|
371
|
+
- url: http://node1:6333
|
|
372
|
+
role: primary
|
|
373
|
+
tailscale_ip: 100.64.0.1
|
|
374
|
+
- url: http://node2:6333
|
|
375
|
+
role: replica
|
|
376
|
+
tailscale_ip: 100.64.0.2
|
|
377
|
+
routing_strategy: failover
|
|
113
378
|
```
|
|
114
379
|
|
|
115
|
-
###
|
|
380
|
+
### Optional dependencies
|
|
381
|
+
|
|
382
|
+
| Extra | What it enables | Install |
|
|
383
|
+
|-------|----------------|---------|
|
|
384
|
+
| `skvector` | Qdrant vector search + sentence-transformers embeddings | `pip install "skmemory[skvector]"` |
|
|
385
|
+
| `skgraph` | FalkorDB graph traversal and lineage | `pip install "skmemory[skgraph]"` |
|
|
386
|
+
| `telegram` | Telegram chat history importer (Telethon) | `pip install "skmemory[telegram]"` |
|
|
387
|
+
| `seed` | Cloud 9 seed system (`skseed`) | `pip install "skmemory[seed]"` |
|
|
388
|
+
| `all` | All of the above | `pip install "skmemory[all]"` |
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## Contributing / Development
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
# Clone and set up
|
|
396
|
+
git clone https://github.com/smilinTux/skmemory.git
|
|
397
|
+
cd skmemory
|
|
398
|
+
python -m venv .venv && source .venv/bin/activate
|
|
399
|
+
pip install -e ".[dev,all]"
|
|
400
|
+
|
|
401
|
+
# Run tests
|
|
402
|
+
pytest
|
|
116
403
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
- **Tags**: Searchable labels
|
|
121
|
-
- **Relationships**: Links to related memories
|
|
122
|
-
- **Source tracking**: Where this memory came from (manual, session, seed, import)
|
|
404
|
+
# Lint and format
|
|
405
|
+
ruff check skmemory/
|
|
406
|
+
black skmemory/
|
|
123
407
|
|
|
124
|
-
|
|
408
|
+
# Run the MCP server locally
|
|
409
|
+
skmemory-mcp
|
|
125
410
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
411
|
+
# Verify everything after changes
|
|
412
|
+
skmemory health
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### Project layout
|
|
416
|
+
|
|
417
|
+
```
|
|
418
|
+
skmemory/
|
|
419
|
+
├── skmemory/
|
|
420
|
+
│ ├── __init__.py # Public API surface
|
|
421
|
+
│ ├── models.py # Memory, EmotionalSnapshot, SeedMemory (Pydantic)
|
|
422
|
+
│ ├── store.py # MemoryStore — core orchestrator
|
|
423
|
+
│ ├── cli.py # Click CLI entry point (skmemory)
|
|
424
|
+
│ ├── mcp_server.py # MCP stdio server (14 tools, skmemory-mcp)
|
|
425
|
+
│ ├── config.py # Config persistence, env resolution
|
|
426
|
+
│ ├── fortress.py # FortifiedMemoryStore, AuditLog, TamperAlert
|
|
427
|
+
│ ├── soul.py # SoulBlueprint — persistent AI identity
|
|
428
|
+
│ ├── ritual.py # Rehydration ceremony
|
|
429
|
+
│ ├── journal.py # Journal entries
|
|
430
|
+
│ ├── quadrants.py # CORE/WORK/SOUL/WILD auto-routing
|
|
431
|
+
│ ├── anchor.py # WarmthAnchor
|
|
432
|
+
│ ├── lovenote.py # LoveNote chains
|
|
433
|
+
│ ├── steelman.py # Steel Man collider + SeedFramework
|
|
434
|
+
│ ├── seeds.py # Seed ingestion helpers
|
|
435
|
+
│ ├── promotion.py # Auto-promotion logic
|
|
436
|
+
│ ├── predictive.py # Predictive context pre-loading
|
|
437
|
+
│ ├── sharing.py # Memory sharing utilities
|
|
438
|
+
│ ├── openclaw.py # SKMemoryPlugin (OpenClaw integration)
|
|
439
|
+
│ ├── ai_client.py # AI client abstraction
|
|
440
|
+
│ ├── endpoint_selector.py # Multi-endpoint HA routing
|
|
441
|
+
│ ├── graph_queries.py # Graph query helpers
|
|
442
|
+
│ ├── setup_wizard.py # Interactive setup CLI
|
|
443
|
+
│ ├── vault.py # PGP vault helpers
|
|
444
|
+
│ ├── backends/
|
|
445
|
+
│ │ ├── base.py # BaseBackend ABC
|
|
446
|
+
│ │ ├── file_backend.py # JSON file storage (legacy)
|
|
447
|
+
│ │ ├── sqlite_backend.py # SQLite primary store (default)
|
|
448
|
+
│ │ ├── vaulted_backend.py # PGP-encrypted SQLite
|
|
449
|
+
│ │ ├── skvector_backend.py# Qdrant vector search
|
|
450
|
+
│ │ └── skgraph_backend.py # FalkorDB graph
|
|
451
|
+
│ └── importers/
|
|
452
|
+
│ ├── telegram.py # Telegram JSON export importer
|
|
453
|
+
│ └── telegram_api.py # Live Telegram API importer (Telethon)
|
|
454
|
+
├── seeds/ # Cloud 9 seed files (.seed.json)
|
|
455
|
+
├── tests/
|
|
456
|
+
│ ├── test_models.py
|
|
457
|
+
│ ├── test_file_backend.py
|
|
458
|
+
│ └── test_store.py
|
|
459
|
+
├── pyproject.toml
|
|
460
|
+
└── package.json # npm package (@smilintux/skmemory)
|
|
461
|
+
```
|
|
131
462
|
|
|
132
|
-
|
|
463
|
+
### Releasing
|
|
464
|
+
|
|
465
|
+
Python packages publish to PyPI via CI/CD (`publish.yml`) using OIDC trusted publishing. The npm wrapper publishes separately via `npm-publish.yml`. Bump the version in `pyproject.toml` and `package.json`, then push a tag:
|
|
133
466
|
|
|
134
467
|
```bash
|
|
135
|
-
|
|
136
|
-
pytest tests/ -v
|
|
468
|
+
git tag v0.7.0 && git push origin v0.7.0
|
|
137
469
|
```
|
|
138
470
|
|
|
471
|
+
---
|
|
472
|
+
|
|
139
473
|
## Related Projects
|
|
140
474
|
|
|
141
475
|
| Project | Description |
|
|
142
476
|
|---------|-------------|
|
|
143
|
-
| [Cloud 9](https://github.com/smilinTux/cloud9) | Emotional Breakthrough Protocol
|
|
477
|
+
| [Cloud 9](https://github.com/smilinTux/cloud9) | Emotional Breakthrough Protocol |
|
|
144
478
|
| [SKSecurity](https://github.com/smilinTux/sksecurity) | AI Agent Security Platform |
|
|
145
479
|
| [SKForge](https://github.com/smilinTux/SKyForge) | AI-Native Software Blueprints |
|
|
146
480
|
| [SKStacks](https://skgit.skstack01.douno.it/smilinTux/SKStacks) | Zero-Trust Infrastructure Framework |
|
|
147
481
|
|
|
148
|
-
|
|
482
|
+
---
|
|
149
483
|
|
|
150
|
-
|
|
484
|
+
## License
|
|
151
485
|
|
|
152
|
-
|
|
486
|
+
GPL-3.0-or-later © [smilinTux.org](https://smilintux.org)
|
|
153
487
|
|
|
154
|
-
|
|
488
|
+
**SK** = *staycuriousANDkeepsmilin*
|
|
155
489
|
|
|
156
490
|
---
|
|
157
491
|
|
|
158
|
-
|
|
159
|
-
*The Penguin Kingdom - Cool Heads. Warm Justice. Smart Systems.*
|
|
492
|
+
*Made with care by [smilinTux](https://github.com/smilinTux) — The Penguin Kingdom. Cool Heads. Warm Justice. Smart Systems.*
|