@skedulo/memory-hub-mcp 0.2.3 → 0.2.5

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.
@@ -41,14 +41,16 @@ would be worth knowing next time, in this repo or across the team — not
41
41
  narration or exploration. If you already called memory_save with type
42
42
  "Fact" or "Scenario" for it earlier in this same session, do not save it
43
43
  again. If nothing in this session qualifies, do nothing and finish.
44
- Otherwise, call memory_save now (type "Fact" or "Scenario") for exactly
45
- the items that qualify.'
44
+ For each item that qualifies, first call memory_recall with a query for it.
45
+ If one of your own memories already covers it, call memory_update on that
46
+ memory with the revised full text instead of saving a copy. Otherwise call
47
+ memory_save (type "Fact" or "Scenario"). Never delete anything.'
46
48
 
47
49
  LOG_FILE="${TMPDIR:-/tmp}/memory-hub-stop-hook.log"
48
50
  {
49
51
  echo "---- $(date -u +%FT%TZ) session=$SESSION_ID ----"
50
52
  MEMORY_HUB_STOP_HOOK_ACTIVE=1 claude -p --resume "$SESSION_ID" \
51
- --allowedTools "mcp__memory-hub__memory_recall,mcp__memory-hub__memory_save" \
53
+ --allowedTools "mcp__memory-hub__memory_recall,mcp__memory-hub__memory_save,mcp__memory-hub__memory_update" \
52
54
  --permission-prompts none \
53
55
  --model haiku \
54
56
  --no-session-persistence \
@@ -13,11 +13,12 @@ FUNCTION_URL="${MEMORY_HUB_FUNCTION_URL:-https://dev-api.test.skl.io/function/me
13
13
  BUDGET="${MEMORY_HUB_PROMPT_MAX_CHARS:-6000}"
14
14
  [ "$BUDGET" -gt 9000 ] && BUDGET=9000
15
15
  FACTS_N="${MEMORY_HUB_PROMPT_FACTS:-5}"
16
- # Scores in this corpus are compressed: relevant items land near 0.4-0.7, unrelated ones near 0.3-0.4,
17
- # so an item must clear a floor and stay close to the best match across both lists.
18
- MIN_SIMILARITY="${MEMORY_HUB_PROMPT_MIN_SIMILARITY:-0.35}"
16
+ # 0.45 and 0.25 come from memory-hub-mcp/eval: at 0.35, 3 of 10 prompts with no relevant memory still injected some.
17
+ MIN_SIMILARITY="${MEMORY_HUB_PROMPT_MIN_SIMILARITY:-0.45}"
19
18
  SIMILARITY_BAND="${MEMORY_HUB_PROMPT_SIMILARITY_BAND:-0.25}"
20
19
  SKILLS_N="${MEMORY_HUB_PROMPT_SKILLS:-3}"
20
+ WIKI_N="${MEMORY_HUB_PROMPT_WIKI:-2}"
21
+ SCENARIOS_N="${MEMORY_HUB_PROMPT_SCENARIOS:-2}"
21
22
  ITEM_CAP=500
22
23
  NL=$'\n'
23
24
 
@@ -86,6 +87,8 @@ call() {
86
87
 
87
88
  call "/memory/recall" "$TMP_DIR/facts.json" &
88
89
  call "/memory/list-skills" "$TMP_DIR/skills.json" &
90
+ call "/memory/recall-wiki" "$TMP_DIR/wiki.json" &
91
+ call "/memory/recall-scenarios" "$TMP_DIR/scenarios.json" &
89
92
  wait
90
93
 
91
94
  CLOSE_FENCE='if ([match("```"; "g")] | length) % 2 == 1 then . + "\n```" else . end'
@@ -93,11 +96,15 @@ INDENT='gsub("\n"; "\n ")'
93
96
  STAMP='(if .lastModifiedDate then " (updated " + .lastModifiedDate[0:10] + ")" else "" end)'
94
97
  ELIDE="if length >= $ITEM_CAP then . + \"…\" else . end"
95
98
  cut_pointer() {
96
- printf '(if .truncated then " [cut at \\(.content | length) of \\(.fullLength) — memory_get type=%s uid=\\(.uid)]" else "" end)' "$1"
99
+ printf '(if .truncated then " [cut at \\(.%s | length) of \\(.fullLength) — memory_get type=%s uid=\\(.uid)]" else "" end)' "${2:-content}" "$1"
97
100
  }
98
101
 
99
- # Judged across both lists: one list alone may have no strong match, and would keep its weak ones.
100
- BEST=$(jq -rs '[.[] | ((.facts // []) + (.skills // []))[] | .similarity // empty] | max // empty' "$TMP_DIR/facts.json" "$TMP_DIR/skills.json" 2>/dev/null)
102
+ # Judged across every list: one list alone may have no strong match, and would keep its weak ones.
103
+ BEST=""
104
+ for kind in facts skills wiki scenarios; do
105
+ top=$(jq -r '[(.facts // [])[], (.skills // [])[], (.pages // [])[], (.scenarios // [])[]] | map(.similarity // empty) | max // empty' "$TMP_DIR/$kind.json" 2>/dev/null)
106
+ if [ -n "$top" ] && { [ -z "$BEST" ] || [ "$(jq -n --argjson a "$top" --argjson b "$BEST" '$a > $b' 2>/dev/null)" = true ]; }; then BEST="$top"; fi
107
+ done
101
108
  FLOOR=-1
102
109
  [ -n "$BEST" ] && FLOOR=$(jq -n --argjson best "$BEST" --argjson band "$SIMILARITY_BAND" '$best - $band')
103
110
  KEEP='select(.similarity == null or .similarity >= $floor)'
@@ -117,6 +124,8 @@ while IFS= read -r -d $'\x1e' item; do
117
124
  done < <(
118
125
  jq -j --argjson floor "$FLOOR" "[.facts[]? | $KEEP][:$FACTS_N][] | ((\"- \" + (.content | $ELIDE) + $(cut_pointer Fact) + $STAMP) | $CLOSE_FENCE | $INDENT), \"\\u001e\"" "$TMP_DIR/facts.json" 2>/dev/null
119
126
  jq -j --argjson floor "$FLOOR" "[.skills[]? | $KEEP][:$SKILLS_N][] | ((\"- \" + .title + \": \" + (.content | $ELIDE) + $(cut_pointer Skill) + $STAMP) | $CLOSE_FENCE | $INDENT), \"\\u001e\"" "$TMP_DIR/skills.json" 2>/dev/null
127
+ jq -j --argjson floor "$FLOOR" "[.pages[]? | $KEEP][:$WIKI_N][] | ((\"- \" + .title + \": \" + (.content | $ELIDE) + $(cut_pointer Wiki) + $STAMP) | $CLOSE_FENCE | $INDENT), \"\\u001e\"" "$TMP_DIR/wiki.json" 2>/dev/null
128
+ jq -j --argjson floor "$FLOOR" "[.scenarios[]? | $KEEP][:$SCENARIOS_N][] | ((\"- \" + (.summary | $ELIDE) + $(cut_pointer Scenario summary) + $STAMP) | $CLOSE_FENCE | $INDENT), \"\\u001e\"" "$TMP_DIR/scenarios.json" 2>/dev/null
120
129
  )
121
130
  [ -n "$BODY" ] || exit 0
122
131
 
package/dist/chunk.js ADDED
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.chunkText = void 0;
4
+ const DEFAULTS = { target: 900, max: 1400, overlap: 300 };
5
+ // A block ends at a blank line and a new one starts at each markdown heading, so a heading stays with its text.
6
+ function blocks(text) {
7
+ const out = [];
8
+ let blockStart = -1;
9
+ let cursor = 0;
10
+ for (const line of text.split('\n')) {
11
+ const lineEnd = cursor + line.length;
12
+ const blank = line.trim() === '';
13
+ const heading = /^#{1,6}\s/.test(line);
14
+ if (blank) {
15
+ if (blockStart >= 0)
16
+ out.push({ start: blockStart, end: cursor - 1 });
17
+ blockStart = -1;
18
+ }
19
+ else {
20
+ if (heading && blockStart >= 0)
21
+ out.push({ start: blockStart, end: cursor - 1 });
22
+ if (heading || blockStart < 0)
23
+ blockStart = cursor;
24
+ }
25
+ cursor = lineEnd + 1;
26
+ }
27
+ if (blockStart >= 0)
28
+ out.push({ start: blockStart, end: text.length });
29
+ return out;
30
+ }
31
+ function splitLong(text, block, max) {
32
+ if (block.end - block.start <= max)
33
+ return [block];
34
+ const parts = [];
35
+ let start = block.start;
36
+ while (block.end - start > max) {
37
+ const window = text.slice(start, start + max);
38
+ const cut = Math.max(window.lastIndexOf('\n'), window.lastIndexOf('. '));
39
+ const end = start + (cut > max / 2 ? cut + 1 : max);
40
+ parts.push({ start, end });
41
+ start = end;
42
+ while (start < block.end && /\s/.test(text[start]))
43
+ start += 1;
44
+ }
45
+ if (start < block.end)
46
+ parts.push({ start, end: block.end });
47
+ return parts;
48
+ }
49
+ function chunkText(text, options = {}) {
50
+ const { target, max, overlap } = { ...DEFAULTS, ...options };
51
+ const pieces = blocks(text).flatMap((block) => splitLong(text, block, max));
52
+ if (pieces.length === 0)
53
+ return [];
54
+ const chunks = [];
55
+ let current = [];
56
+ const span = (list) => list[list.length - 1].end - list[0].start;
57
+ const flush = () => {
58
+ if (current.length === 0)
59
+ return;
60
+ const start = current[0].start;
61
+ const end = current[current.length - 1].end;
62
+ chunks.push({ start, end, text: text.slice(start, end) });
63
+ };
64
+ for (const piece of pieces) {
65
+ if (current.length > 0 && span([...current, piece]) > target) {
66
+ flush();
67
+ const last = current[current.length - 1];
68
+ current = last.end - last.start <= overlap && current.length > 1 ? [last] : [];
69
+ }
70
+ current.push(piece);
71
+ }
72
+ flush();
73
+ return chunks;
74
+ }
75
+ exports.chunkText = chunkText;
package/dist/client.js CHANGED
@@ -6,20 +6,62 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.MemoryHubClient = void 0;
7
7
  // memory-hub-mcp/src/client.ts
8
8
  const axios_1 = __importDefault(require("axios"));
9
+ // axios only says "status code 400"; the function puts the reason in { error } on the body.
10
+ function withServerMessage(err) {
11
+ const response = err?.response;
12
+ const reason = response?.data?.error;
13
+ if (typeof reason !== 'string' || !reason)
14
+ return err;
15
+ const wrapped = new Error(response?.status ? `${reason} (HTTP ${response.status})` : reason);
16
+ wrapped.cause = err;
17
+ return wrapped;
18
+ }
9
19
  class MemoryHubClient {
10
20
  config;
11
21
  constructor(config) {
12
22
  this.config = config;
13
23
  }
14
24
  async post(path, body) {
15
- const res = await axios_1.default.post(`${this.config.baseUrl}${path}`, body, {
16
- headers: { Authorization: `Bearer ${this.config.apiToken}`, 'Content-Type': 'application/json' },
17
- });
18
- return res.data;
25
+ try {
26
+ const res = await axios_1.default.post(`${this.config.baseUrl}${path}`, body, {
27
+ headers: { Authorization: `Bearer ${this.config.apiToken}`, 'Content-Type': 'application/json' },
28
+ });
29
+ return res.data;
30
+ }
31
+ catch (err) {
32
+ throw withServerMessage(err);
33
+ }
19
34
  }
20
35
  recall(input) {
21
36
  return this.post('/memory/recall', input);
22
37
  }
38
+ updateFact(input) {
39
+ return this.post('/memory/update-fact', input);
40
+ }
41
+ updateSkill(input) {
42
+ return this.post('/memory/update-skill', input);
43
+ }
44
+ updateScenario(input) {
45
+ return this.post('/memory/update-scenario', input);
46
+ }
47
+ updateWikiPage(input) {
48
+ return this.post('/memory/update-wiki-page', input);
49
+ }
50
+ deleteFact(input) {
51
+ return this.post('/memory/delete-fact', input);
52
+ }
53
+ deleteSkill(input) {
54
+ return this.post('/memory/delete-skill', input);
55
+ }
56
+ deleteScenario(input) {
57
+ return this.post('/memory/delete-scenario', input);
58
+ }
59
+ deleteWikiPage(input) {
60
+ return this.post('/memory/delete-wiki-page', input);
61
+ }
62
+ updateTask(input) {
63
+ return this.post('/memory/update-task', input);
64
+ }
23
65
  saveFact(input) {
24
66
  return this.post('/memory/save-fact', input);
25
67
  }
package/dist/index.js CHANGED
@@ -14,6 +14,8 @@ const embeddings_1 = require("./embeddings");
14
14
  const save_1 = require("./save");
15
15
  const recall_1 = require("./recall");
16
16
  const guide_check_1 = require("./guide-check");
17
+ const revise_1 = require("./revise");
18
+ const similar_notice_1 = require("./similar-notice");
17
19
  const session_context_1 = require("./session-context");
18
20
  // Must match the AgentFacts/AgentSkills/AgentWikiPages Tags custom field's Picklist
19
21
  // allowedValues (src/object-model/custom-fields/{AgentFacts,AgentSkills,AgentWikiPages}/*-Tags.custom-field.json)
@@ -83,22 +85,10 @@ async function joinNoticeBlocks() {
83
85
  },
84
86
  ];
85
87
  }
86
- // saveFact/saveScenario's dedup check warns rather than blocks (see saveFact.ts's
87
- // comment for why), so the save above already happened by the time this runs — this
88
- // only makes the match legible to Claude instead of it being buried in the raw JSON
89
- // result, the same visibility upgrade joinNoticeBlocks gives the auto-join case.
90
- function duplicateNoticeBlocks(result) {
91
- const match = result.possibleDuplicate;
92
- if (!match) {
93
- return [];
94
- }
95
- const when = match.lastModifiedDate ? ` on ${match.lastModifiedDate.slice(0, 10)}` : '';
96
- return [
97
- {
98
- type: 'text',
99
- text: `Note: this looks similar to something already saved${when}: "${match.content}". Saved as new anyway — consider recalling and updating that one instead next time.`,
100
- },
101
- ];
88
+ // The save has already happened (dedup only warns), so this just makes the match visible to the agent.
89
+ function similarNoticeBlocks(type, result) {
90
+ const text = (0, similar_notice_1.similarNotice)(type, result);
91
+ return text ? [{ type: 'text', text }] : [];
102
92
  }
103
93
  server.tool('memory_getSkillGuide', 'Get the current SE AI Memory Hub usage guide — when to recall, what to save where, sharing rules, repo linking. Call this first when the se-ai-memory-hub skill triggers.', {}, async () => {
104
94
  // Read from disk on every call, not cached at module load — this is the whole point:
@@ -156,7 +146,7 @@ server.tool('memory_save', 'Save a Fact, Skill, Scenario, or Wiki page to the SE
156
146
  return {
157
147
  content: [
158
148
  ...(await joinNoticeBlocks()),
159
- ...duplicateNoticeBlocks(result),
149
+ ...similarNoticeBlocks(input.type, result),
160
150
  { type: 'text', text: JSON.stringify(result) },
161
151
  ],
162
152
  };
@@ -205,6 +195,32 @@ server.tool('memory_listTeams', "List the memory teams this developer belongs to
205
195
  const { teams } = await client.listTeams();
206
196
  return { content: [{ type: 'text', text: JSON.stringify({ teams }) }] };
207
197
  });
198
+ server.tool('memory_update', "Revise a memory you saved, in place, instead of saving a second copy. Pass the uid (from memory_recall, memory_get or a memory_save notice) and only the fields to change: content and tags for a Fact; title, content and tags for a Skill or Wiki page; summary for a Scenario; repo (a uid from memory_listRepos, or null for not project-specific) for any. Only the author can update. When this repeats or corrects something you already saved, use this, not memory_save.", {
199
+ type: zod_1.z.enum(['Fact', 'Skill', 'Scenario', 'Wiki']),
200
+ uid: zod_1.z.string().min(1),
201
+ content: zod_1.z.string().min(1).optional().describe('Fact, Skill, Wiki: the full new text, not a patch.'),
202
+ title: zod_1.z.string().min(1).optional().describe('Skill, Wiki only.'),
203
+ summary: zod_1.z.string().min(1).optional().describe('Scenario only: the full new summary.'),
204
+ tags: zod_1.z.array(zod_1.z.enum(TAG_VALUES)).optional().describe('Fact, Skill, Wiki only. Replaces the existing tags.'),
205
+ repo: zod_1.z.string().min(1).nullable().optional().describe('A DevRepos uid, or null to clear it.'),
206
+ }, async (input) => {
207
+ const result = await (0, revise_1.performUpdate)({ client, embed: embeddings_1.embed }, input);
208
+ return { content: [{ type: 'text', text: JSON.stringify(result) }] };
209
+ });
210
+ server.tool('memory_delete', "Permanently delete one memory you saved. Use it to remove a copy you have just merged into another, or a memory that is wrong or obsolete. It cannot be undone and only the author can delete. Prefer memory_update when the memory is still partly right.", {
211
+ type: zod_1.z.enum(['Fact', 'Skill', 'Scenario', 'Wiki']),
212
+ uid: zod_1.z.string().min(1),
213
+ }, async (input) => {
214
+ const result = await (0, revise_1.performDelete)({ client }, input);
215
+ return { content: [{ type: 'text', text: JSON.stringify(result) }] };
216
+ });
217
+ server.tool('memory_setTaskStatus', "Mark a ticket's task Done when its work is finished, or Open to reopen it. Takes the ticket ref used with memory_save externalRef, e.g. 'SOL-1234'. Anyone on the task's team can do this.", {
218
+ externalRef: zod_1.z.string().min(1),
219
+ status: zod_1.z.enum(['Open', 'Done']),
220
+ }, async (input) => {
221
+ const result = await (0, revise_1.performSetTaskStatus)({ client }, input);
222
+ return { content: [{ type: 'text', text: JSON.stringify(result) }] };
223
+ });
208
224
  server.tool('memory_listRepos', "List repos across this developer's teams, with an optional substring query filter, for targeting memory_save or memory_moveResourceRepo at a repo other than the current directory.", {
209
225
  query: zod_1.z.string().optional().describe('Case-insensitive substring filter on repo name.'),
210
226
  }, async (input) => {
package/dist/revise.js ADDED
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.performSetTaskStatus = exports.performDelete = exports.performUpdate = void 0;
4
+ // Which fields each type accepts. Anything else is refused, not dropped, so a typo cannot look like a successful edit.
5
+ const ALLOWED = {
6
+ Fact: ['content', 'tags', 'repo'],
7
+ Skill: ['title', 'content', 'tags', 'repo'],
8
+ Scenario: ['summary', 'repo'],
9
+ Wiki: ['title', 'content', 'tags', 'repo'],
10
+ };
11
+ const FIELDS = ['content', 'title', 'summary', 'tags', 'repo'];
12
+ // The text an item is embedded from, matching save.ts, so a revised item stays comparable to the rest.
13
+ function embeddedText(type, current) {
14
+ if (type === 'Fact')
15
+ return current.content ?? '';
16
+ if (type === 'Scenario')
17
+ return current.summary ?? '';
18
+ return `${current.title ?? ''}\n\n${current.content ?? ''}`;
19
+ }
20
+ async function fetchCurrent(client, type, uid) {
21
+ switch (type) {
22
+ case 'Fact':
23
+ return client.getFact({ uid });
24
+ case 'Skill':
25
+ return client.getSkill({ uid });
26
+ case 'Scenario':
27
+ return client.getScenario({ uid });
28
+ case 'Wiki':
29
+ return client.getWikiPage({ uid });
30
+ }
31
+ }
32
+ async function performUpdate(deps, input) {
33
+ const { client, embed } = deps;
34
+ const given = FIELDS.filter((field) => input[field] !== undefined);
35
+ if (given.length === 0) {
36
+ throw new Error('Nothing to update: pass at least one of content, title, summary, tags or repo.');
37
+ }
38
+ const refused = given.filter((field) => !ALLOWED[input.type].includes(field));
39
+ if (refused.length > 0) {
40
+ throw new Error(`A ${input.type} has no ${refused.join(', ')}. It accepts: ${ALLOWED[input.type].join(', ')}.`);
41
+ }
42
+ const textChanged = input.content !== undefined || input.title !== undefined || input.summary !== undefined;
43
+ let embedding;
44
+ if (textChanged) {
45
+ const current = await fetchCurrent(client, input.type, input.uid);
46
+ const merged = {
47
+ title: input.title ?? current.title,
48
+ content: input.content ?? current.content,
49
+ summary: input.summary ?? current.summary,
50
+ };
51
+ // No embedding is better than a stale one: the function clears the old vector when the text changes.
52
+ embedding = await embed(embeddedText(input.type, merged)).catch(() => undefined);
53
+ }
54
+ const { type, uid, ...changes } = input;
55
+ const body = { uid, ...changes, ...(embedding ? { embedding } : {}) };
56
+ switch (type) {
57
+ case 'Fact':
58
+ return client.updateFact(body);
59
+ case 'Skill':
60
+ return client.updateSkill(body);
61
+ case 'Scenario':
62
+ return client.updateScenario(body);
63
+ case 'Wiki':
64
+ return client.updateWikiPage(body);
65
+ }
66
+ }
67
+ exports.performUpdate = performUpdate;
68
+ async function performDelete(deps, input) {
69
+ const { client } = deps;
70
+ switch (input.type) {
71
+ case 'Fact':
72
+ return client.deleteFact({ uid: input.uid });
73
+ case 'Skill':
74
+ return client.deleteSkill({ uid: input.uid });
75
+ case 'Scenario':
76
+ return client.deleteScenario({ uid: input.uid });
77
+ case 'Wiki':
78
+ return client.deleteWikiPage({ uid: input.uid });
79
+ }
80
+ }
81
+ exports.performDelete = performDelete;
82
+ function performSetTaskStatus(deps, input) {
83
+ return deps.client.updateTask(input);
84
+ }
85
+ exports.performSetTaskStatus = performSetTaskStatus;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.similarNotice = void 0;
4
+ const PREVIEW = 160;
5
+ function describe(match) {
6
+ const owner = match.mine === undefined ? '' : match.mine ? ', yours' : ", a teammate's";
7
+ const when = match.lastModifiedDate ? `, updated ${match.lastModifiedDate.slice(0, 10)}` : '';
8
+ const label = match.title ? `${match.title}: ` : '';
9
+ const body = match.content.replace(/\s+/g, ' ').trim();
10
+ const preview = body.length > PREVIEW ? `${body.slice(0, PREVIEW)}…` : body;
11
+ return `- ${match.uid} (${match.similarity.toFixed(2)}${owner}${when}) ${label}"${preview}"`;
12
+ }
13
+ // The save has already happened when this runs; the point is to let the agent keep one copy instead of two.
14
+ function similarNotice(type, result) {
15
+ const matches = result.similar?.length ? result.similar : result.possibleDuplicate ? [result.possibleDuplicate] : [];
16
+ if (matches.length === 0) {
17
+ return undefined;
18
+ }
19
+ const lines = [
20
+ `Saved as ${result.uid}, but it looks like ${matches.length === 1 ? 'a memory' : 'memories'} already saved:`,
21
+ ...matches.map(describe),
22
+ ];
23
+ const editable = matches.some((match) => match.mine !== false);
24
+ lines.push(editable
25
+ ? `If one of yours already covers this, keep a single copy: memory_update type=${type} uid=<that uid> with the merged text, then memory_delete type=${type} uid=${result.uid}.`
26
+ : "Those belong to teammates and cannot be edited, so keep the new one only if it adds something they don't say.");
27
+ return lines.join('\n');
28
+ }
29
+ exports.similarNotice = similarNotice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skedulo/memory-hub-mcp",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "MCP server for the SE AI Memory Hub: recall and save developer memory from Claude Code and Claude Desktop.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
package/skill-guide.md CHANGED
@@ -147,6 +147,36 @@ stopping point, save what's already distilled now — compaction summarizes
147
147
  lossily, and a fact that only exists in your reasoning does not survive
148
148
  it. A save that happens is worth more than a better-timed one that doesn't.
149
149
 
150
+ ## Revise, don't re-save
151
+
152
+ A memory is not frozen. When you learn something that corrects, completes or
153
+ repeats a memory of yours, change that memory instead of saving another one:
154
+
155
+ - **`memory_update`** with `type`, `uid` and only the fields that change
156
+ (`content`/`tags` for a Fact; `title`/`content`/`tags` for a Skill or Wiki
157
+ page; `summary` for a Scenario; `repo`, or `null`, for any). Pass the full
158
+ new text, not a patch. It re-embeds the text, so search keeps working. Only
159
+ the author can update.
160
+ - **`memory_delete`** removes one of your memories for good. Use it for a copy
161
+ you have just merged into another, or a memory that is wrong or obsolete.
162
+ Prefer `memory_update` while the memory is still partly right.
163
+ - **`memory_setTaskStatus`** with the ticket `externalRef` marks that ticket's
164
+ task `Done` when its work is finished, or `Open` to reopen it. Any member of
165
+ the task's team can do this.
166
+
167
+ `memory_save` checks what you are saving against everything you can see. If it
168
+ looks like an existing memory, the reply starts with `Saved as <uid>, but it
169
+ looks like …` and lists each match with its uid, a similarity score and whether
170
+ it is yours. When a match is yours and already covers the point, keep one copy:
171
+ `memory_update` the old one with the merged text, then `memory_delete` the one
172
+ you just saved. A teammate's memory cannot be edited; keep your new one only if
173
+ it adds something theirs does not say. The check only warns, so a distinct
174
+ memory that shares vocabulary with another is saved either way.
175
+
176
+ Before saving a decision or root cause that you suspect was recorded before,
177
+ run `memory_recall` with a query for it first. A status that has changed (a PR
178
+ merged, a rollout finished) is an update to the old memory, not a new fact.
179
+
150
180
  ## Mapping an unfamiliar codebase
151
181
 
152
182
  When asked to get oriented in a repo or subsystem you haven't worked in