@rlabs-inc/memory 0.4.2 → 0.4.4
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/README.md +100 -27
- package/dist/index.js +237 -28
- package/dist/index.mjs +237 -28
- package/dist/server/index.js +283 -28
- package/dist/server/index.mjs +283 -28
- package/package.json +1 -1
- package/src/cli/index.ts +2 -1
- package/src/core/curator.ts +41 -63
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ A memory is relevant if **multiple signals agree** it should activate. Not coinc
|
|
|
63
63
|
|
|
64
64
|
**Phase 0 - Pre-Filter**: Exclude inactive, superseded, or wrong-scope memories
|
|
65
65
|
|
|
66
|
-
**Phase 1 - Activation Signals** (
|
|
66
|
+
**Phase 1 - Activation Signals** (7 binary signals, need ≥2 to proceed)
|
|
67
67
|
|
|
68
68
|
| Signal | Description |
|
|
69
69
|
|--------|-------------|
|
|
@@ -72,6 +72,7 @@ A memory is relevant if **multiple signals agree** it should activate. Not coinc
|
|
|
72
72
|
| Domain | Domain word found in message |
|
|
73
73
|
| Feature | Feature word found in message |
|
|
74
74
|
| Content | 3+ significant content words overlap |
|
|
75
|
+
| Files | Related file path matched in message |
|
|
75
76
|
| Vector | Semantic similarity ≥ 40% |
|
|
76
77
|
|
|
77
78
|
**Phase 2 - Importance Ranking** (among relevant memories)
|
|
@@ -88,6 +89,11 @@ A memory is relevant if **multiple signals agree** it should activate. Not coinc
|
|
|
88
89
|
|
|
89
90
|
**Selection**: Sort by signal count (DESC) → importance score (DESC). Max 2 global memories (tech prioritized), project memories fill remaining slots.
|
|
90
91
|
|
|
92
|
+
**Phase 3 - Redirects & Relationships**:
|
|
93
|
+
- If memory has `superseded_by` or `resolved_by`, surface the replacement instead
|
|
94
|
+
- Pull related memories via `blocked_by` and `blocks` fields
|
|
95
|
+
- Include `related_to` linked memories if space remains
|
|
96
|
+
|
|
91
97
|
### Global vs Project Memories
|
|
92
98
|
|
|
93
99
|
Memories are stored in two scopes:
|
|
@@ -97,6 +103,36 @@ Memories are stored in two scopes:
|
|
|
97
103
|
|
|
98
104
|
Global memories are retrieved alongside project memories, with a maximum of 2 globals per retrieval (technical types prioritized).
|
|
99
105
|
|
|
106
|
+
### Two-Tier Memory Structure
|
|
107
|
+
|
|
108
|
+
Memories are stored with a **headline + content** structure for context efficiency:
|
|
109
|
+
|
|
110
|
+
| Part | Purpose | Usage |
|
|
111
|
+
|------|---------|-------|
|
|
112
|
+
| **Headline** | 1-2 line summary, ALWAYS shown | Quick recognition |
|
|
113
|
+
| **Content** | Full structured template | Expanded on demand |
|
|
114
|
+
|
|
115
|
+
**Headline examples:**
|
|
116
|
+
```
|
|
117
|
+
Bad: "Debug session about CLI errors"
|
|
118
|
+
Good: "CLI returns error object when context full - check response.type before JSON parsing"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Type-specific content templates:**
|
|
122
|
+
|
|
123
|
+
| Type | Template |
|
|
124
|
+
|------|----------|
|
|
125
|
+
| technical | WHAT / WHERE / HOW / WHY / GOTCHA |
|
|
126
|
+
| debug | SYMPTOM / CAUSE / FIX / PREVENT |
|
|
127
|
+
| architecture | PATTERN / COMPONENTS / WHY / REJECTED |
|
|
128
|
+
| decision | DECISION / OPTIONS / REASONING / REVISIT_WHEN |
|
|
129
|
+
| personal | FACT / CONTEXT / AFFECTS |
|
|
130
|
+
| breakthrough | INSIGHT / BEFORE / AFTER / IMPLICATIONS |
|
|
131
|
+
| unresolved | QUESTION / CONTEXT / BLOCKERS / OPTIONS |
|
|
132
|
+
| state | WORKING / BROKEN / NEXT / BLOCKED_BY |
|
|
133
|
+
|
|
134
|
+
**Expansion:** Use `GET /memory/expand?ids=abc123` to fetch full content on demand.
|
|
135
|
+
|
|
100
136
|
### Smart Curation
|
|
101
137
|
At session end (or before context compaction), the same Claude instance reviews the conversation and extracts memories. No API key needed—uses Claude Code's `--resume` flag.
|
|
102
138
|
|
|
@@ -141,24 +177,21 @@ First message of each session receives temporal context:
|
|
|
141
177
|
```
|
|
142
178
|
|
|
143
179
|
### Emoji Memory Types
|
|
144
|
-
|
|
180
|
+
11 canonical types with compact visual representation:
|
|
145
181
|
|
|
146
182
|
| Emoji | Type | Meaning |
|
|
147
183
|
|-------|------|---------|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
151
|
-
|
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
|
|
|
158
|
-
|
|
|
159
|
-
| 🎯 | todo | Action needed |
|
|
160
|
-
| ✅ | problem_solution | Problem→Solution pair |
|
|
161
|
-
| 🏆 | milestone | Achievement |
|
|
184
|
+
| 🔧 | technical | Code, implementation, APIs |
|
|
185
|
+
| 🐛 | debug | Bugs, errors, fixes, gotchas |
|
|
186
|
+
| 🏗️ | architecture | System design, patterns |
|
|
187
|
+
| ⚖️ | decision | Choices made, trade-offs |
|
|
188
|
+
| 💜 | personal | Relationship, collaboration |
|
|
189
|
+
| 🌀 | philosophy | Beliefs, values, principles |
|
|
190
|
+
| 🔄 | workflow | How we work together |
|
|
191
|
+
| 🏆 | milestone | Achievements, shipped features |
|
|
192
|
+
| 💡 | breakthrough | Key insights, discoveries |
|
|
193
|
+
| ❓ | unresolved | Open questions, todos |
|
|
194
|
+
| 📍 | state | Current project status |
|
|
162
195
|
|
|
163
196
|
## Architecture
|
|
164
197
|
|
|
@@ -209,19 +242,21 @@ Memories are stored as human-readable markdown with YAML frontmatter:
|
|
|
209
242
|
|
|
210
243
|
```markdown
|
|
211
244
|
---
|
|
212
|
-
#
|
|
245
|
+
# Schema version
|
|
246
|
+
schema_version: 4
|
|
247
|
+
|
|
248
|
+
# Two-tier content (v4)
|
|
249
|
+
headline: "CLI returns error object when context full - check response.type"
|
|
250
|
+
# (content is in markdown body below)
|
|
251
|
+
|
|
252
|
+
# Core metadata
|
|
213
253
|
importance_weight: 0.9
|
|
214
254
|
confidence_score: 0.85
|
|
215
|
-
context_type: technical
|
|
216
|
-
temporal_relevance: persistent
|
|
255
|
+
context_type: technical # one of 11 canonical types
|
|
217
256
|
semantic_tags: [embeddings, vectors, memory-system]
|
|
218
257
|
trigger_phrases: [working with embeddings, vector search]
|
|
219
|
-
question_types: [how, what]
|
|
220
|
-
knowledge_domain: architecture
|
|
221
|
-
emotional_resonance: discovery
|
|
222
258
|
|
|
223
|
-
#
|
|
224
|
-
schema_version: 2
|
|
259
|
+
# Classification
|
|
225
260
|
status: active # active, pending, superseded, deprecated, archived
|
|
226
261
|
scope: project # global or project
|
|
227
262
|
temporal_class: long_term # eternal, long_term, medium_term, short_term, ephemeral
|
|
@@ -233,13 +268,17 @@ feature: vector-search
|
|
|
233
268
|
related_to: [memory-xyz, memory-abc]
|
|
234
269
|
supersedes: memory-old-id
|
|
235
270
|
superseded_by: null
|
|
271
|
+
blocked_by: null
|
|
272
|
+
blocks: []
|
|
236
273
|
|
|
237
274
|
# Embedding (384 dimensions)
|
|
238
275
|
embedding: [0.023, -0.041, 0.087, ...]
|
|
239
276
|
---
|
|
240
277
|
|
|
241
|
-
Embeddings are 384-dimensional vectors generated by all-MiniLM-L6-v2.
|
|
242
|
-
|
|
278
|
+
WHAT: Embeddings are 384-dimensional vectors generated by all-MiniLM-L6-v2.
|
|
279
|
+
WHERE: src/core/embeddings.ts
|
|
280
|
+
HOW: Model loads at server startup (~80MB) and generates embeddings in ~5ms.
|
|
281
|
+
WHY: Local embeddings avoid API costs and latency.
|
|
243
282
|
```
|
|
244
283
|
|
|
245
284
|
Benefits:
|
|
@@ -266,8 +305,16 @@ memory doctor --verbose # Detailed diagnostics
|
|
|
266
305
|
memory stats # Show memory statistics
|
|
267
306
|
memory stats --project x # Project-specific stats
|
|
268
307
|
|
|
269
|
-
memory migrate # Upgrade memories to latest schema
|
|
308
|
+
memory migrate # Upgrade memories to latest schema
|
|
270
309
|
memory migrate --dry-run # Preview changes without applying
|
|
310
|
+
memory migrate --analyze # Show fragmentation analysis
|
|
311
|
+
memory migrate --embeddings # Regenerate null embeddings
|
|
312
|
+
|
|
313
|
+
memory ingest # Batch ingest historical sessions
|
|
314
|
+
memory ingest --session <id> # Ingest specific session
|
|
315
|
+
memory ingest --project <name> # Ingest all sessions from project
|
|
316
|
+
memory ingest --all # Ingest all projects
|
|
317
|
+
memory ingest --dry-run # Preview what would be ingested
|
|
271
318
|
```
|
|
272
319
|
|
|
273
320
|
## Environment Variables
|
|
@@ -336,6 +383,32 @@ This isn't just about remembering facts. It's about preserving:
|
|
|
336
383
|
|
|
337
384
|
## Changelog
|
|
338
385
|
|
|
386
|
+
### v0.4.4
|
|
387
|
+
- **Docs**: Comprehensive README update with accurate v0.4.x documentation
|
|
388
|
+
- **Fix**: CLI `--version` now reads from package.json instead of hardcoded value
|
|
389
|
+
|
|
390
|
+
### v0.4.3
|
|
391
|
+
- **Fix**: Minor patch release
|
|
392
|
+
|
|
393
|
+
### v0.4.2
|
|
394
|
+
- **Feature**: Two-tier memory structure with headline + content separation
|
|
395
|
+
- **Feature**: Type-specific content templates (11 canonical types)
|
|
396
|
+
- **Feature**: `/memory/expand` endpoint for on-demand content expansion
|
|
397
|
+
- **Improvement**: Headlines enable fast recognition without full content parsing
|
|
398
|
+
|
|
399
|
+
### v0.4.1
|
|
400
|
+
- **Feature**: V3 schema with 11 canonical context types (consolidated from 170+ variants)
|
|
401
|
+
- **Feature**: 7th activation signal: `files` for related_files path matching
|
|
402
|
+
- **Feature**: Redirect logic for `superseded_by` and `resolved_by` fields
|
|
403
|
+
- **Feature**: Blocking relationships via `blocked_by` and `blocks` fields
|
|
404
|
+
- **Improvement**: Replaced `temporal_relevance` with `temporal_class` + `fade_rate`
|
|
405
|
+
- **Cleanup**: Removed 11 dead metadata fields (emotional_resonance, knowledge_domain, etc.)
|
|
406
|
+
|
|
407
|
+
### v0.4.0
|
|
408
|
+
- **Feature**: Schema versioning infrastructure for safe migrations
|
|
409
|
+
- **Feature**: Enhanced `migrate` command with `--analyze` and `--embeddings` flags
|
|
410
|
+
- **Feature**: Custom context_type mapping support for migrations
|
|
411
|
+
|
|
339
412
|
### v0.3.11
|
|
340
413
|
- **Feature**: Agent SDK integration for curator and manager - no API key needed, uses Claude Code OAuth
|
|
341
414
|
- **Feature**: `memory ingest --session <id>` to ingest a single session (useful when automatic curation fails)
|