context-vault 3.18.0 → 3.20.0

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 (80) hide show
  1. package/bin/cli.js +673 -4
  2. package/dist/register-tools.d.ts.map +1 -1
  3. package/dist/register-tools.js +0 -2
  4. package/dist/register-tools.js.map +1 -1
  5. package/dist/server.js +78 -1
  6. package/dist/server.js.map +1 -1
  7. package/dist/tools/recall.d.ts +1 -1
  8. package/dist/tools/recall.d.ts.map +1 -1
  9. package/dist/tools/recall.js +50 -100
  10. package/dist/tools/recall.js.map +1 -1
  11. package/node_modules/@context-vault/core/dist/assemble.d.ts +22 -0
  12. package/node_modules/@context-vault/core/dist/assemble.d.ts.map +1 -0
  13. package/node_modules/@context-vault/core/dist/assemble.js +143 -0
  14. package/node_modules/@context-vault/core/dist/assemble.js.map +1 -0
  15. package/node_modules/@context-vault/core/dist/capture.d.ts.map +1 -1
  16. package/node_modules/@context-vault/core/dist/capture.js +10 -5
  17. package/node_modules/@context-vault/core/dist/capture.js.map +1 -1
  18. package/node_modules/@context-vault/core/dist/consolidation.d.ts +40 -0
  19. package/node_modules/@context-vault/core/dist/consolidation.d.ts.map +1 -0
  20. package/node_modules/@context-vault/core/dist/consolidation.js +229 -0
  21. package/node_modules/@context-vault/core/dist/consolidation.js.map +1 -0
  22. package/node_modules/@context-vault/core/dist/db.d.ts +25 -1
  23. package/node_modules/@context-vault/core/dist/db.d.ts.map +1 -1
  24. package/node_modules/@context-vault/core/dist/db.js +92 -4
  25. package/node_modules/@context-vault/core/dist/db.js.map +1 -1
  26. package/node_modules/@context-vault/core/dist/frontmatter.d.ts.map +1 -1
  27. package/node_modules/@context-vault/core/dist/frontmatter.js +26 -3
  28. package/node_modules/@context-vault/core/dist/frontmatter.js.map +1 -1
  29. package/node_modules/@context-vault/core/dist/index.d.ts.map +1 -1
  30. package/node_modules/@context-vault/core/dist/index.js +225 -184
  31. package/node_modules/@context-vault/core/dist/index.js.map +1 -1
  32. package/node_modules/@context-vault/core/dist/main.d.ts +3 -0
  33. package/node_modules/@context-vault/core/dist/main.d.ts.map +1 -1
  34. package/node_modules/@context-vault/core/dist/main.js +4 -0
  35. package/node_modules/@context-vault/core/dist/main.js.map +1 -1
  36. package/node_modules/@context-vault/core/dist/search.d.ts +6 -0
  37. package/node_modules/@context-vault/core/dist/search.d.ts.map +1 -1
  38. package/node_modules/@context-vault/core/dist/search.js +106 -5
  39. package/node_modules/@context-vault/core/dist/search.js.map +1 -1
  40. package/node_modules/@context-vault/core/dist/search.test.d.ts +2 -0
  41. package/node_modules/@context-vault/core/dist/search.test.d.ts.map +1 -0
  42. package/node_modules/@context-vault/core/dist/search.test.js +49 -0
  43. package/node_modules/@context-vault/core/dist/search.test.js.map +1 -0
  44. package/node_modules/@context-vault/core/dist/summarize.d.ts +5 -0
  45. package/node_modules/@context-vault/core/dist/summarize.d.ts.map +1 -0
  46. package/node_modules/@context-vault/core/dist/summarize.js +146 -0
  47. package/node_modules/@context-vault/core/dist/summarize.js.map +1 -0
  48. package/node_modules/@context-vault/core/dist/types.d.ts +2 -0
  49. package/node_modules/@context-vault/core/dist/types.d.ts.map +1 -1
  50. package/node_modules/@context-vault/core/package.json +13 -1
  51. package/node_modules/@context-vault/core/src/assemble.ts +187 -0
  52. package/node_modules/@context-vault/core/src/capture.ts +10 -5
  53. package/node_modules/@context-vault/core/src/consolidation.ts +356 -0
  54. package/node_modules/@context-vault/core/src/db.ts +95 -4
  55. package/node_modules/@context-vault/core/src/frontmatter.ts +25 -4
  56. package/node_modules/@context-vault/core/src/index.ts +127 -88
  57. package/node_modules/@context-vault/core/src/main.ts +7 -0
  58. package/node_modules/@context-vault/core/src/search.test.ts +59 -0
  59. package/node_modules/@context-vault/core/src/search.ts +112 -5
  60. package/node_modules/@context-vault/core/src/summarize.ts +157 -0
  61. package/node_modules/@context-vault/core/src/types.ts +2 -0
  62. package/package.json +2 -2
  63. package/scripts/validate-epipe-shutdown.mjs +183 -0
  64. package/scripts/validate-sqlite-busy-retry.mjs +243 -0
  65. package/src/register-tools.ts +0 -2
  66. package/src/server.ts +76 -1
  67. package/src/tools/recall.ts +51 -110
  68. package/.claude-plugin/README.md +0 -219
  69. package/.claude-plugin/plugin.json +0 -11
  70. package/commands/vault-cleanup.md +0 -43
  71. package/commands/vault-snapshot.md +0 -43
  72. package/commands/vault-status.md +0 -35
  73. package/dist/tools/session-start.d.ts +0 -25
  74. package/dist/tools/session-start.d.ts.map +0 -1
  75. package/dist/tools/session-start.js +0 -469
  76. package/dist/tools/session-start.js.map +0 -1
  77. package/skills/context-assembly/SKILL.md +0 -308
  78. package/skills/knowledge-capture/SKILL.md +0 -303
  79. package/skills/memory-management/SKILL.md +0 -237
  80. package/src/tools/session-start.ts +0 -527
@@ -1,237 +0,0 @@
1
- # Memory Management — Using the Vault for Persistent Memory
2
-
3
- Learn when to save information to your vault, how to organize it, and how to keep the vault healthy and retrievable.
4
-
5
- ## Core Principle: Save Decisions and Insights, Skip Transient Data
6
-
7
- The vault is for **persistent knowledge** that will be useful across future sessions and projects. It is not a chat history or temporary scratchpad.
8
-
9
- **Always Save:**
10
- - Decisions (why you chose X over Y, constraints that matter, trade-offs)
11
- - Insights (discoveries, patterns, "aha" moments)
12
- - Architectures and design rationales
13
- - Lessons learned (what worked, what didn't)
14
- - Project context (goals, stakeholders, constraints)
15
-
16
- **Skip:**
17
- - Exploratory work (debugging steps, failed hypotheses)
18
- - Task status (use task.md files instead)
19
- - Temporary notes (use your session notes, not vault)
20
- - Bulk data (use references or snapshots instead)
21
-
22
- ## Entry Kinds: Choosing the Right Category
23
-
24
- Always pick one kind when saving. The kind affects how Claude will discover and use the entry:
25
-
26
- | Kind | When to use | Example |
27
- |------|-------------|---------|
28
- | **insight** | Discoveries and aha moments. How something works, why something happened, what you learned. | "SQLite ANALYZE needed after 1M+ row inserts to keep query planner efficient" |
29
- | **decision** | Choices you made, their rationales, constraints considered, alternatives rejected. This is your decision journal. | "Chose Turso (managed SQLite) over self-hosted PostgreSQL for cost + edge compatibility" |
30
- | **pattern** | Repeated approaches, best practices, conventions, tactics. Reusable playbooks. | "Always include encoding_context in saves so entries are discoverable 6 months later" |
31
- | **reference** | External sources, URLs, docs, commands, templates. Pointers to information outside the vault. | "PostgreSQL EXPLAIN ANALYZE guide: https://..." |
32
- | **contact** | People: their roles, expertise, how to reach them. Requires identity_key (their email or ID). | Contact: Alice Chen, Product Lead, alice@acme.com |
33
- | **source** | Books, articles, papers, tools. Requires identity_key (unique name). | "The Mythical Man-Month" by Fred Brooks |
34
-
35
- ## Tag Hygiene: Organizing for Discoverability
36
-
37
- Tags are how Claude finds your entries. Use these patterns:
38
-
39
- **Project/Bucket Tags (required):** Use the `bucket:` prefix to scope entries to projects:
40
- ```
41
- bucket:autohub # For autohub project
42
- bucket:context-vault # For context-vault project
43
- bucket:platform # For platform infrastructure
44
- ```
45
-
46
- When saving: `tags: ["bucket:autohub", "authentication", "oauth"]`
47
-
48
- When retrieving: `get_context(buckets: ["autohub"])` to load only autohub entries.
49
-
50
- **Topic Tags (optional, lowercase):** Use lowercase, single-word tags for topics:
51
- ```
52
- tags: ["database", "caching", "performance"] ✓
53
- tags: ["Database Design", "User Cache"] ✗ (avoid capitals, multi-word)
54
- ```
55
-
56
- **Tiers (set via `tier` parameter, not tags):**
57
- - `working` (default): Active context, available always
58
- - `durable`: Long-term reference (decisions, architecture)
59
- - `ephemeral`: Auto-expires (session notes, temporary captures)
60
-
61
- ## Identity Keys: Deduplicating Entities
62
-
63
- For entity kinds (contact, source, project), always provide an `identity_key`. This is the unique identifier that prevents duplicates:
64
-
65
- **Contact example:**
66
- ```
67
- kind: contact
68
- identity_key: alice@acme.com
69
- title: Alice Chen
70
- meta: { role: "Product Lead", team: "Backend" }
71
- ```
72
-
73
- If you save another contact with the same `identity_key`, it updates the existing entry instead of creating a duplicate.
74
-
75
- **Source example:**
76
- ```
77
- kind: source
78
- identity_key: mythical-man-month
79
- title: The Mythical Man-Month
80
- meta: { author: "Fred Brooks", year: 1975 }
81
- ```
82
-
83
- ## Encoding Context: Making Entries Discoverable Later
84
-
85
- **Encoding context** captures the situation when you saved an entry, so Claude can find it later even if you don't remember the exact topic.
86
-
87
- Always include when saving:
88
- ```
89
- encoding_context: {
90
- project: "autohub",
91
- arc: "api-redesign",
92
- task: "implementing oauth2 flow"
93
- }
94
- ```
95
-
96
- Or as free text:
97
- ```
98
- encoding_context: "Was designing auth flow for mobile client in Q1 2026"
99
- ```
100
-
101
- **Why it matters:** Six months later, when starting a new auth project, Claude loads your old decision by context match, not just keyword search.
102
-
103
- ## Recall Ratio: Measuring Vault Health
104
-
105
- The **recall ratio** shows what fraction of your entries are actually retrieved in real usage.
106
-
107
- - Target: 0.30 (30% of entries recalled per month)
108
- - Typical: 0.07 (7% of entries recalled)
109
- - If < 0.10: Your entries are not well-organized. Use buckets, encoding_context, and snapshots to improve discoverability.
110
-
111
- **Improve recall:**
112
- 1. Use consistent bucket tags across sessions
113
- 2. Always include encoding_context (project, arc, task)
114
- 3. Create snapshots to consolidate scattered entries on the same topic
115
- 4. Use supersedes to retire old, replaced entries
116
-
117
- ## Superseding: Retiring Old Entries
118
-
119
- When you replace an entry (e.g., update a decision), don't delete the old one. Instead, save the new one with `supersedes`:
120
-
121
- ```javascript
122
- save_context({
123
- title: "OAuth 2.0 implementation — updated Q2",
124
- kind: "decision",
125
- body: "... new decision rationale ...",
126
- supersedes: ["old-oauth-entry-id"]
127
- })
128
- ```
129
-
130
- The old entry stays but is marked as superseded and hidden from future searches. This keeps your decision history intact.
131
-
132
- ## Deduplication: Checking Before You Save
133
-
134
- Before saving, always check if the entry already exists:
135
-
136
- ```javascript
137
- get_context({
138
- query: "OAuth 2.0 flow",
139
- kind: "decision",
140
- buckets: ["autohub"]
141
- })
142
- ```
143
-
144
- If you find a very similar entry (score > 0.85), update it instead of creating a new one:
145
-
146
- ```javascript
147
- save_context({
148
- id: "existing-entry-id", // Reuse the ID
149
- body: "... updated content ..."
150
- })
151
- ```
152
-
153
- ## Tier System: Lifecycle Management
154
-
155
- Entries have three tiers that affect retention:
156
-
157
- | Tier | Lifetime | Use for |
158
- |------|----------|---------|
159
- | **ephemeral** | 7-30 days | Session notes, temporary captures, exploration |
160
- | **working** (default) | Indefinite | Active decisions, current insights, patterns in use |
161
- | **durable** | Indefinite + archive | Architecture decisions, lessons learned, core reference |
162
-
163
- Set tier when saving:
164
- ```javascript
165
- save_context({
166
- body: "...",
167
- tier: "durable" // Will be archived, never deleted
168
- })
169
- ```
170
-
171
- Ephemeral entries auto-expire. Set expiry with `expires_at: "2026-04-30"`.
172
-
173
- ## Data Categories: What Gets Stored Where
174
-
175
- The vault organizes entries into three categories, each with different handling:
176
-
177
- | Category | Scope | Use | Example |
178
- |----------|-------|-----|---------|
179
- | **knowledge** | Personal or team vault | Decisions, insights, patterns, references | "SQLite + embeddings architecture for RAG" |
180
- | **entity** | Team vault only | People, projects, tools, vendors | "Alice Chen, alice@acme.com" |
181
- | **event** | Cold storage | Session logs, metrics, audit trail | "Deprecated API endpoint X on 2026-03-30" |
182
-
183
- - Knowledge and entity entries are indexed for semantic search
184
- - Events are kept separate (no search by default, access via category filter)
185
- - Only visible to the vault you saved to (personal or team)
186
-
187
- ## Workflow: Save → Search → Update → Retire
188
-
189
- **Save:**
190
- ```javascript
191
- save_context({
192
- kind: "decision",
193
- title: "Use Turso for database",
194
- body: "Chose Turso over PostgreSQL because...",
195
- tags: ["bucket:autohub", "database", "infrastructure"],
196
- encoding_context: { project: "autohub", arc: "backend-v2" },
197
- tier: "durable"
198
- })
199
- ```
200
-
201
- **Search (later):**
202
- ```javascript
203
- get_context({
204
- query: "database choice for autohub",
205
- buckets: ["autohub"]
206
- })
207
- ```
208
-
209
- **Update (when context changes):**
210
- ```javascript
211
- save_context({
212
- id: "turso-decision-id",
213
- body: "Still using Turso, but now with edge replication for..."
214
- })
215
- ```
216
-
217
- **Retire (when no longer relevant):**
218
- ```javascript
219
- save_context({
220
- title: "MySQL migration plan — SUPERSEDED",
221
- kind: "decision",
222
- body: "No longer pursuing this. Staying with Turso.",
223
- supersedes: ["mysql-migration-id"]
224
- })
225
- ```
226
-
227
- ## Quick Checklist
228
-
229
- Before saving, verify:
230
- - [ ] Is this a decision, insight, pattern, or reference? (Pick one kind)
231
- - [ ] Does it have a bucket:project tag?
232
- - [ ] Does it include encoding_context for future retrieval?
233
- - [ ] Did I check for duplicates first (get_context)?
234
- - [ ] Is the title clear and searchable?
235
- - [ ] Will I actually need this in a future session or project?
236
-
237
- If you can't answer yes to most of these, save as ephemeral or skip entirely.