@cchez/memory-mcp 1.0.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.
- package/DESIGN.md +188 -0
- package/README.md +484 -0
- package/db/.env.example +16 -0
- package/db/docker-compose.yml +33 -0
- package/dist/embedding.js +54 -0
- package/dist/index.js +60 -0
- package/dist/qdrant.js +349 -0
- package/dist/server.js +67 -0
- package/dist/tools/correct.js +57 -0
- package/dist/tools/delete.js +12 -0
- package/dist/tools/episode.js +65 -0
- package/dist/tools/list.js +37 -0
- package/dist/tools/search.js +98 -0
- package/dist/tools/store.js +71 -0
- package/package.json +66 -0
- package/skills/memory-correct/SKILL.md +83 -0
- package/skills/memory-save/SKILL.md +209 -0
- package/skills/memory-search/SKILL.md +156 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memory-search
|
|
3
|
+
description: >
|
|
4
|
+
Search the memory mcp knowledge base when information might already be stored
|
|
5
|
+
there. Triggers when the agent needs context about team decisions,
|
|
6
|
+
coding rules, past discussions, project facts, or any question that could
|
|
7
|
+
be answered from prior learnings. Also triggers when the user asks to
|
|
8
|
+
"check memory", "look up", "do we have anything on", or "what do we know about".
|
|
9
|
+
Use BEFORE asking the user for context that might already be stored. If a
|
|
10
|
+
result is corrected by the user or contradicted by new evidence, hand off to
|
|
11
|
+
correct_memory so the stale record is superseded.
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Memory Search Skill
|
|
15
|
+
|
|
16
|
+
## Purpose
|
|
17
|
+
|
|
18
|
+
Before asking the user for context, check the knowledge base. This avoids
|
|
19
|
+
re-explaining things the system already knows, and surfaces relevant rules,
|
|
20
|
+
decisions, and facts that should inform the current work.
|
|
21
|
+
|
|
22
|
+
**Announce at start:** "Checking memory for relevant context."
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## When to Trigger
|
|
27
|
+
|
|
28
|
+
**Automatic triggers (invoke without being asked):**
|
|
29
|
+
- Starting work on a feature or bug fix — check for relevant coding rules
|
|
30
|
+
- Discussing architecture — check for prior decisions
|
|
31
|
+
- Mentioning a team, project, or integration name — check for facts and context
|
|
32
|
+
- A question arises that sounds like "we've probably figured this out before"
|
|
33
|
+
|
|
34
|
+
**Manual triggers (user explicitly asks):**
|
|
35
|
+
- "Check memory for X"
|
|
36
|
+
- "Do we have anything on X"
|
|
37
|
+
- "What do we know about X"
|
|
38
|
+
- "Look up X in the knowledge base"
|
|
39
|
+
|
|
40
|
+
**Do NOT trigger when:**
|
|
41
|
+
- The question is clearly general knowledge (not project-specific)
|
|
42
|
+
- Memory was already searched this session for the same topic
|
|
43
|
+
- The user is asking to *save* something (use memory-save instead)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Step 1 — Identify Search Intent
|
|
48
|
+
|
|
49
|
+
Determine what to search for based on context:
|
|
50
|
+
|
|
51
|
+
| Situation | Search query direction |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Writing code in a specific domain | "coding rules constraints [domain]" |
|
|
54
|
+
| Architecture question | "decision [component/system name]" |
|
|
55
|
+
| Team process question | "team process [topic]" |
|
|
56
|
+
| Integration with external system | "[system name] integration configuration" |
|
|
57
|
+
| Error or known issue | "[error/symptom] known issue workaround" |
|
|
58
|
+
|
|
59
|
+
Form 1–2 focused queries. Broad queries return noise; specific queries return signal.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Step 2 — Choose Collections and Filters
|
|
64
|
+
|
|
65
|
+
Pick the right scope:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
coding rules, constraints, architecture decisions
|
|
69
|
+
→ collections: ["coding"]
|
|
70
|
+
→ memory_type: "rule" or "decision"
|
|
71
|
+
|
|
72
|
+
team discussions, Slack decisions, project facts
|
|
73
|
+
→ collections: ["workspace"]
|
|
74
|
+
→ memory_type: "fact" or "summary"
|
|
75
|
+
|
|
76
|
+
not sure / cross-cutting topic
|
|
77
|
+
→ collections: ["coding", "workspace"] (default — searches both)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Set `score_threshold: 0.5` by default to filter noise. Raise to `0.65` if too many results come back. Lower to `0.4` only if nothing is found.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Step 3 — Execute Search
|
|
85
|
+
|
|
86
|
+
Call `search_memory` with:
|
|
87
|
+
- `query`: focused natural language query from Step 1
|
|
88
|
+
- `collections`: chosen in Step 2
|
|
89
|
+
- `limit`: 5 (default); raise to 10 if the topic is broad
|
|
90
|
+
- `score_threshold`: 0.5
|
|
91
|
+
- `memory_type`: add if you know the type, omit otherwise
|
|
92
|
+
- `tags`: add if you know a relevant tag, omit otherwise
|
|
93
|
+
|
|
94
|
+
Use the default `mode: "hybrid"` unless you have a specific reason not to.
|
|
95
|
+
For exact identifiers, error messages, ticket IDs, or class names, use
|
|
96
|
+
`mode: "keyword"` or keep hybrid and include the exact term in `query`.
|
|
97
|
+
For audit/debugging of old corrections, set `include_inactive: true`.
|
|
98
|
+
|
|
99
|
+
If the first search returns nothing useful, try once more with:
|
|
100
|
+
- A rephrased query (different vocabulary, not just synonyms)
|
|
101
|
+
- A lower `score_threshold` (0.4)
|
|
102
|
+
- Broader `collections` (drop the collection filter)
|
|
103
|
+
|
|
104
|
+
Do not search more than twice per topic without finding something — absence
|
|
105
|
+
of results is itself useful signal ("we haven't recorded this yet").
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Step 4 — Interpret and Apply Results
|
|
110
|
+
|
|
111
|
+
For each result returned:
|
|
112
|
+
|
|
113
|
+
1. **Check the score**: below 0.5 = weak match, treat with caution
|
|
114
|
+
2. **Check `memory_type`**:
|
|
115
|
+
- `rule` → this is a constraint, follow it
|
|
116
|
+
- `decision` → this was decided, don't relitigate without reason
|
|
117
|
+
- `fact` → current state of affairs, may be outdated
|
|
118
|
+
- `summary` → background context, use as backdrop
|
|
119
|
+
- `preference` → user/team preference, apply unless overridden
|
|
120
|
+
3. **Check `created_at`**: facts older than 3 months may be stale — flag to user
|
|
121
|
+
4. **Check lifecycle fields** if present:
|
|
122
|
+
- `status: active` → use normally
|
|
123
|
+
- `status: superseded` / `deprecated` → do not apply unless explicitly auditing history
|
|
124
|
+
- `superseded_by` → prefer the newer memory when available
|
|
125
|
+
|
|
126
|
+
**Apply the results directly to your work.** Don't just summarise them back
|
|
127
|
+
to the user — use them to inform your next action, code, or recommendation.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Step 5 — Surface to User (only when relevant)
|
|
132
|
+
|
|
133
|
+
If a result is directly actionable or changes your approach, mention it briefly:
|
|
134
|
+
|
|
135
|
+
> "Found a relevant rule in memory: [one-line summary]. Applying that now."
|
|
136
|
+
|
|
137
|
+
If results are background context (not immediately actionable), apply silently.
|
|
138
|
+
|
|
139
|
+
If nothing was found, only mention it if the user explicitly asked to search,
|
|
140
|
+
or if the absence of a rule/decision is itself significant:
|
|
141
|
+
|
|
142
|
+
> "No prior decisions found on this. We're making a fresh call."
|
|
143
|
+
|
|
144
|
+
If the user corrects a result, or you confirm the result is stale, call
|
|
145
|
+
`correct_memory` with the old ID/collection and corrected standalone content.
|
|
146
|
+
Do not ask the user to manually delete stale memories.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Self-Check Before Finishing
|
|
151
|
+
|
|
152
|
+
- [ ] Did the search results influence the work (code, recommendation, answer)?
|
|
153
|
+
- [ ] Were stale facts (>3 months) flagged to the user?
|
|
154
|
+
- [ ] If a result was corrected or contradicted, did you trigger `correct_memory`?
|
|
155
|
+
- [ ] If nothing was found, was that noted where it matters?
|
|
156
|
+
- [ ] Was search limited to ≤2 attempts per topic?
|