@skedulo/memory-hub-mcp 0.2.17 → 0.2.19

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  Local stdio MCP server wrapping `memory-hub`.
4
4
 
5
5
  `memory_getSkillGuide` serves `skill-guide.md` (this package's own file, read fresh on every
6
- call) as the current usage guide for the `se-ai-memory-hub` skill. The skill's own
6
+ call) as the current usage guide for the `memory-hub` skill. The skill's own
7
7
  `SKILL.md` is a thin stub that just tells Claude to call this tool — the actual guidance
8
8
  lives here so it updates on the next `yarn build`, not via a manual `cp` into
9
9
  `~/.claude/skills/`. Edit `skill-guide.md` directly; never hand-copy its content elsewhere.
@@ -60,6 +60,7 @@ have no equivalent there, and nothing is saved unless Claude calls `memory_save`
60
60
  For Claude Code, `setup` installs the `memory-hub` plugin from the repo's marketplace when the
61
61
  `claude` CLI and your GitHub access allow it, and turns its auto-update on; otherwise, or with
62
62
  `--no-plugin`, it installs the hooks and skill directly as described below.
63
+ Older installs (`memory-hub@se-ai-memory-hub`) move to the `memory-hub@memory-hub` ID by themselves at the end of a session, except ones with a pasted token, which keep working and move when you run `setup`.
63
64
 
64
65
  Two commands, no config file to edit. No GitHub access, no git clone, no build step, no npm
65
66
  account:
@@ -203,7 +204,7 @@ matching the `AgentFacts`/`AgentSkills`/`AgentWikiPages` custom objects' `Tags`
203
204
  `ConnectedFunction`, `HorizonComponent`, `TriggeredAction`, `ObjectModel`, `MobileExtension`,
204
205
  `Deployment`, `Auth`, `Testing`, `BreezeUI`, `PSS`, `PSF`, `Optimization`, `Webhooks`, `Salesforce`,
205
206
  `Other`, `ArchitectureMap`, `SOW`, `TDD`, `AI`, `API`, `Mobile`, `Infrastructure`, `Security`,
206
- `Messaging`, `ProjectRules`, and `ProductRules`, its old name, kept for skills older than 0.2.16 (26 in all; `TAG_VALUES` in `src/index.ts` is the source of truth). The tool's Zod schema enforces this — any other value fails validation
207
+ `Messaging`, `ProjectRules`, `ProductRules`, its old name, kept for skills older than 0.2.16, `Superseded` and `SkillDrift` (28 in all; `TAG_VALUES` in `src/tags.ts` is the source of truth). The tool's Zod schema enforces this — any other value fails validation
207
208
  before the request reaches the connected function (which otherwise 400s with no indication of
208
209
  what went wrong). If the underlying Picklist's `allowedValues` ever changes, update `TAG_VALUES`
209
- in `src/index.ts` to match.
210
+ in `src/tags.ts` and the panel's `TAG_OPTIONS` to match.
@@ -11,10 +11,14 @@ set -u
11
11
  FUNCTION_URL="${MEMORY_HUB_FUNCTION_URL:-https://dev-api.test.skl.io/function/memory-hub/memory-hub}"
12
12
  TOKEN="${MEMORY_HUB_MCP_TOKEN:-${CLAUDE_PLUGIN_OPTION_TOKEN:-}}"
13
13
 
14
+ PLUGIN_ID=memory-hub@memory-hub
15
+ OLD_ID_ROOT=false
16
+ case "${CLAUDE_PLUGIN_ROOT:-}" in */se-ai-memory-hub/*) PLUGIN_ID=memory-hub@se-ai-memory-hub; OLD_ID_ROOT=true ;; esac
17
+
14
18
  if [ -z "$TOKEN" ]; then
15
19
  # A plugin install has no setup step of its own, so it says how to add the token.
16
20
  if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ]; then
17
- printf '%s\n' '{"hookSpecificOutput": {"hookEventName": "SessionStart", "additionalContext": "memory-hub plugin: MEMORY_HUB_MCP_TOKEN is not set, so memory is off this session. Tell the user to run `npx -y @skedulo/memory-hub-mcp setup --code` in a terminal (it logs in with sked and stores a token), or to paste a Skedulo API token with /plugin configure memory-hub@se-ai-memory-hub. Then restart Claude Code."}}'
21
+ printf '{"hookSpecificOutput": {"hookEventName": "SessionStart", "additionalContext": "memory-hub plugin: MEMORY_HUB_MCP_TOKEN is not set, so memory is off this session. Tell the user to run `npx -y @skedulo/memory-hub-mcp setup --code` in a terminal (it logs in with sked and stores a token), or to paste a Skedulo API token with /plugin configure %s. Then restart Claude Code."}}\n' "$PLUGIN_ID"
18
22
  fi
19
23
  exit 0
20
24
  fi
@@ -209,11 +213,16 @@ cut_pointer() {
209
213
 
210
214
  # Same as user-prompt-submit.sh; change both together.
211
215
  EXTRAS_DEF='def extras($under; $text):
212
- (if (.externalRef | type) == "string" and .externalRef != "" and .externalRef != $under then " · " + (.externalRef | gsub("[[:cntrl:]]"; " ")) else "" end)
213
- + ((first(($text // "") | gsub("[A-Za-z][A-Za-z0-9+.-]*://[^\\s)]*"; " ") | scan("[A-Za-z0-9_./-]+\\.(?:tsx|ts|jsx|js|mjs|sh|py|json|md|yml|yaml|cls|java|kt|swift|go|rb)\\b") | select(startswith("http") | not)) // null) | if . then " · cites " + . else "" end);'
216
+ (if (.source | type) == "object" and (.source.verifiedAt | type) == "string" and .source.verifiedAt != "" then " · verified " + .source.verifiedAt[0:10] else "" end)
217
+ + (if (.externalRef | type) == "string" and .externalRef != "" and .externalRef != $under then " · " + (.externalRef | gsub("[[:cntrl:]]"; " ")) else "" end)
218
+ + ((first(($text // "") | gsub("[A-Za-z][A-Za-z0-9+.-]*://[^\\s)]*"; " ") | scan("[A-Za-z0-9_./-]+\\.(?:tsx|ts|jsx|js|mjs|sh|py|json|md|yml|yaml|cls|java|kt|swift|go|rb)\\b") | select(startswith("http") | not)) // null) | if . then " · cites " + . else "" end)
219
+ + (if ((.tags // []) | index("Superseded")) then " · superseded, prefer the newer memory" else "" end);'
220
+
221
+ # Creation date, not lastModifiedDate: re-verifying an old fact bumps lastModifiedDate without making it newer.
222
+ BORN_DEF='def born: if (.createdDate | type) == "string" then .createdDate else .lastModifiedDate end;'
214
223
 
215
224
  SUPERSEDED_DEF='def superseded: (.externalRef) as $r
216
- | if ($r | type) == "string" and ($newest[$r] != null) and (.lastModifiedDate | type) == "string" and .lastModifiedDate < $newest[$r].date
225
+ | if ($r | type) == "string" and ($newest[$r] != null) and (born | type) == "string" and born < $newest[$r].date
217
226
  then " · older than " + $newest[$r].uid[0:8] + " for " + ($r | gsub("[[:cntrl:]]"; " ")) + ", may be superseded"
218
227
  else "" end;'
219
228
 
@@ -222,15 +231,15 @@ newest_fact_per_ref() {
222
231
  local f
223
232
  for f in "$@"; do
224
233
  jq -c '.facts[]? | select(type == "object")' "$f" 2>/dev/null || true
225
- done | jq -s -c '
226
- [.[] | select((.externalRef | type) == "string" and .externalRef != "" and (.lastModifiedDate | type) == "string" and (.uid | type) == "string")]
234
+ done | jq -s -c "$BORN_DEF"'
235
+ [.[] | select((.externalRef | type) == "string" and .externalRef != "" and (born | type) == "string" and (.uid | type) == "string")]
227
236
  | unique_by(.uid) | group_by(.externalRef)
228
- | map(select(length > 1) | max_by(.lastModifiedDate) | {key: .externalRef, value: {uid: .uid, date: .lastModifiedDate}})
237
+ | map(select(length > 1) | max_by(born) | {key: .externalRef, value: {uid: .uid, date: born}})
229
238
  | from_entries' 2>/dev/null || true
230
239
  }
231
240
 
232
241
  extract_facts() {
233
- jq -c --argjson newest "$NEWEST_BY_REF" "$EXTRAS_DEF $SUPERSEDED_DEF .facts[]? | (\"- \" + (.content | $ELIDE) + $(cut_pointer Fact) + $STAMP + extras(\"\"; .content) + superseded) | $CLOSE_FENCE | $INDENT" "$1" 2>/dev/null || true
242
+ jq -c --argjson newest "$NEWEST_BY_REF" "$EXTRAS_DEF $BORN_DEF $SUPERSEDED_DEF .facts[]? | (\"- \" + (.content | $ELIDE) + $(cut_pointer Fact) + $STAMP + extras(\"\"; .content) + superseded) | $CLOSE_FENCE | $INDENT" "$1" 2>/dev/null || true
234
243
  }
235
244
 
236
245
  extract_skills() {
@@ -405,6 +414,10 @@ if [ -n "$REPO_UID" ]; then
405
414
  else
406
415
  DIAG="${DIAG} · repo: not linked"
407
416
  fi
417
+ if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ]; then
418
+ PLUGIN_VERSION=$(jq -r '.version // empty' "$CLAUDE_PLUGIN_ROOT/.claude-plugin/plugin.json" 2>/dev/null || true)
419
+ [ -n "$PLUGIN_VERSION" ] && DIAG="${DIAG} · plugin ${PLUGIN_VERSION}"
420
+ fi
408
421
  DIAG="${DIAG}_"
409
422
 
410
423
  # Unconditional, not gated behind having any facts to show, so an agent that finds nothing below still knows to check back in before finishing a task.
@@ -504,13 +517,92 @@ collect_capture_notices() {
504
517
  printf '%s%s%s' "${heading}${NL}" "$lines"
505
518
  }
506
519
 
520
+ origin_ref() {
521
+ local ref
522
+ for ref in origin/HEAD origin/main origin/master; do
523
+ git rev-parse --verify --quiet "$ref^{commit}" >/dev/null 2>&1 && { printf '%s' "$ref"; return 0; }
524
+ done
525
+ return 1
526
+ }
527
+
528
+ # The Sources page's repo line is the watermark a catch-up moves; page commits stand in when recall cut or lacks it.
529
+ WATERMARK_COMMITS='[.pages[]? | objects | select((.title | type) == "string" and (.title | contains(" › ")))] as $project
530
+ | ($repo | ascii_downcase) as $here
531
+ | [$project[] | select(.title | endswith(" › Sources")) | .content | strings
532
+ | scan("`repo` · ([^ @·]+)(?:@[^ ·]*)? · commit ([0-9a-f]{7,40})\\b") | select(.[0] | ascii_downcase == $here) | .[1]] as $watermark
533
+ | (if ($watermark | length) > 0 then $watermark
534
+ else [$project[] | .source | objects | select((.repo | type) != "string" or .repo == $repo) | .commit | strings | select(test("^[0-9a-f]{7,40}$"))] end)
535
+ | reduce .[] as $c ([]; if any(.[]; . == $c) then . else . + [$c] end) | .[:5][]'
536
+
537
+ # Once a day per repo; compared with the fetched origin ref, never the working tree, and never fetches.
538
+ catch_up_nudge() {
539
+ local wiki="$TMP_DIR/wiki_repo.json" stamp_dir="$HOME/.claude/memory-hub" stamp today ref sha n behind=0 name start
540
+ [ -n "$REPO_UID" ] && [ -s "$wiki" ] || return 0
541
+ stamp="$stamp_dir/nudge-$(printf '%s' "$REPO_UID" | tr -c 'A-Za-z0-9_-' '_')"
542
+ today=$(date +%Y-%m-%d)
543
+ [ "$(cat "$stamp" 2>/dev/null)" != "$today" ] || return 0
544
+ ref=$(origin_ref) || return 0
545
+ start=$SECONDS
546
+ while IFS= read -r sha; do
547
+ [ $((SECONDS - start)) -lt 2 ] || break
548
+ n=$(git rev-list --count "$sha..$ref" 2>/dev/null) || continue
549
+ case "$n" in '' | *[!0-9]*) continue ;; esac
550
+ [ "$n" -le "$behind" ] || behind=$n
551
+ done < <(jq -r --arg repo "$REPO_NAME" "$WATERMARK_COMMITS" "$wiki" 2>/dev/null)
552
+ [ "$behind" -gt 0 ] || return 0
553
+ name=$(jq -r --slurpfile repo "$TMP_DIR/repo.json" 'first(.pages[]? | .title | strings | select(contains(" › ")) | split(" › ")[0] | select(. != "")) // ($repo[0].teamName | strings) // empty' "$wiki" 2>/dev/null)
554
+ [ -n "$name" ] || name="$REPO_NAME"
555
+ mkdir -p "$stamp_dir" 2>/dev/null && printf '%s\n' "$today" > "$stamp" 2>/dev/null
556
+ printf '%s knowledge is %d commits behind %s; say "catch up" to update it.' "$(printf '%s' "$name" | tr '[:cntrl:]' ' ')" "$behind" "$ref"
557
+ }
558
+
559
+ # A stamp from before uids were stored holds a date, which matches no uid, so it nudges once more.
560
+ share_nudge() {
561
+ local stamp_dir="$HOME/.claude/memory-hub" stamp uids fresh n
562
+ stamp="$stamp_dir/share-nudge-$(printf '%s' "$TOKEN" | cksum | cut -d' ' -f1)"
563
+ uids=$(jq -rs '[.[] | objects | (.facts, .skills) | arrays | .[] | objects
564
+ | select(.visibility == "Private" and (.teamName | type) == "string" and .teamName != "") | .uid | strings
565
+ | select(test("^[A-Za-z0-9_-]+$"))] | unique | .[]' \
566
+ "$TMP_DIR/facts_self.json" "$TMP_DIR/skills_self.json" 2>/dev/null) || return 0
567
+ [ -n "$uids" ] || return 0
568
+ if [ -f "$stamp" ]; then
569
+ fresh=$(printf '%s\n' "$uids" | grep -vxF -f "$stamp")
570
+ else
571
+ fresh=$uids
572
+ fi
573
+ [ -n "$fresh" ] || return 0
574
+ n=$(printf '%s\n' "$uids" | wc -l | tr -d ' ')
575
+ mkdir -p "$stamp_dir" 2>/dev/null && printf '%s\n' "$uids" > "$stamp" 2>/dev/null
576
+ printf '%d of your private notes on team repos look shareable; say "share them" to review and share.' "$n"
577
+ }
578
+
579
+ plugin_move_nudge() {
580
+ $OLD_ID_ROOT || return 0
581
+ local stamp="$STATE_DIR/plugin-move-nudge.stamp" now last
582
+ # The log also holds stderr, so the result is the last line shaped like one.
583
+ grep -E '^[0-9T:.Z-]+ (moved|skipped|failed) ' "$STATE_DIR/plugin-move.log" 2>/dev/null | tail -n1 | grep -qF 'pasted token' || return 0
584
+ now=$(date +%s)
585
+ last=$(cat "$stamp" 2>/dev/null)
586
+ case "$last" in ''|*[!0-9]*) last=0 ;; esac
587
+ [ $((now - last)) -ge 604800 ] || return 0
588
+ printf '%s\n' "$now" > "$stamp" 2>/dev/null || return 0
589
+ printf '%s' 'memory-hub has a new plugin name. Tell the user they can move to it by running `npx -y @skedulo/memory-hub-mcp@latest setup` in a terminal; their current install keeps working.'
590
+ }
591
+
592
+ NUDGE=$(catch_up_nudge 2>/dev/null || true)
593
+ [ -z "$NUDGE" ] || NUDGE="${NUDGE}${NL}${NL}"
594
+ SHARE_NUDGE=$(share_nudge 2>/dev/null || true)
595
+ [ -z "$SHARE_NUDGE" ] || NUDGE="${NUDGE}${SHARE_NUDGE}${NL}${NL}"
596
+ MOVE_NUDGE=$(plugin_move_nudge 2>/dev/null || true)
597
+ [ -z "$MOVE_NUDGE" ] || NUDGE="${NUDGE}${MOVE_NUDGE}${NL}${NL}"
598
+
507
599
  REMINDER="## Reminder${NL}"
508
600
  REMINDER="${REMINDER}${SAVE_LINE}${NL}"
509
- REMINDER="${REMINDER}Invoke the se-ai-memory-hub skill during this session: memory_recall before${NL}"
601
+ REMINDER="${REMINDER}Invoke the memory-hub skill during this session: memory_recall before${NL}"
510
602
  REMINDER="${REMINDER}investigating something that smells like prior context, and memory_save${NL}"
511
603
  REMINDER="${REMINDER}(type \"Fact\" or \"Scenario\") once a task produces a durable decision, root${NL}"
512
604
  REMINDER="${REMINDER}cause, or fix worth keeping for next time.${NL}${NL}"
513
- REMINDER="${REMINDER}${STALE_MCP}"
605
+ REMINDER="${REMINDER}${STALE_MCP}${NUDGE}"
514
606
  NOTICES=$(collect_capture_notices "$STATE_DIR" "$((REMAINING - ${#REMINDER} - ${#DIAG}))" 2>/dev/null || true)
515
607
  [ -z "$NOTICES" ] || NOTICES="${NOTICES}${NL}${NL}"
516
608
  REMINDER="${REMINDER}${NOTICES}"
@@ -7,11 +7,57 @@ if [ -n "${MEMORY_HUB_STOP_HOOK_ACTIVE:-}" ]; then
7
7
  exit 0
8
8
  fi
9
9
 
10
+ start_plugin_move() {
11
+ [ "$EVENT" = SessionEnd ] || return 0
12
+ case "${CLAUDE_PLUGIN_ROOT:-}" in */se-ai-memory-hub/*) ;; *) return 0 ;; esac
13
+ local cli stamp="$STATE_DIR/plugin-move.stamp" lock="$STATE_DIR/plugin-move.lock" today
14
+ today=$(date +%F)
15
+ [ "$(cat "$stamp" 2>/dev/null)" != "$today" ] || return 0
16
+ cli=$(head -n1 "$HOME/.claude/memory-hub-hook/cli-path" 2>/dev/null)
17
+ # An older npm build would start the MCP server instead of failing on the unknown command.
18
+ [ -n "$cli" ] && grep -qF migrate-plugin "$cli" 2>/dev/null || return 0
19
+ if [ -n "${MEMORY_HUB_MIGRATE_CMD:-}" ]; then
20
+ set -- sh -c "$MEMORY_HUB_MIGRATE_CMD"
21
+ else
22
+ command -v node >/dev/null 2>&1 || return 0
23
+ set -- node "$cli" migrate-plugin
24
+ fi
25
+ mkdir -p "$STATE_DIR" 2>/dev/null || return 0
26
+ [ -z "$(find "$lock" -maxdepth 0 -mmin +60 2>/dev/null)" ] || rmdir "$lock" 2>/dev/null
27
+ mkdir "$lock" 2>/dev/null || return 0
28
+ # A session that ended just before may have finished and released the lock after our stamp check.
29
+ if [ "$(cat "$stamp" 2>/dev/null)" = "$today" ]; then
30
+ rmdir "$lock" 2>/dev/null
31
+ return 0
32
+ fi
33
+ if ! printf '%s\n' "$today" > "$stamp" 2>/dev/null; then
34
+ rmdir "$lock" 2>/dev/null
35
+ return 0
36
+ fi
37
+ # HUP is ignored from the fork on and the wrapper leaves the session's process group, so the lock release survives a signal to that group.
38
+ set -- sh -c 'lock=$1 log=$2; shift 2; trap "" HUP; "$@" >>"$log" 2>&1 </dev/null; rmdir "$lock" 2>/dev/null' sh "$lock" "$STATE_DIR/plugin-move.log" "$@"
39
+ if command -v perl >/dev/null 2>&1; then
40
+ set -- perl -e '$SIG{HUP} = "IGNORE"; setpgrp(0, 0); exec @ARGV' "$@"
41
+ fi
42
+ trap '' HUP
43
+ "$@" >/dev/null 2>&1 </dev/null &
44
+ trap - HUP
45
+ }
46
+
10
47
  opted_in() {
11
48
  case "$(printf '%s' "${MEMORY_HUB_AUTO_CAPTURE:-}" | tr '[:upper:]' '[:lower:]')" in 1|true|yes|on) return 0 ;; esac
12
49
  [ "${CLAUDE_PLUGIN_OPTION_CAPTURE:-}" = true ]
13
50
  }
14
51
 
52
+ command -v jq >/dev/null 2>&1 || exit 0
53
+
54
+ INPUT=$(cat)
55
+ EVENT=$(printf '%s' "$INPUT" | jq -r '.hook_event_name // empty' 2>/dev/null)
56
+
57
+ umask 077
58
+ STATE_DIR="${MEMORY_HUB_STATE_DIR:-$HOME/.claude/memory-hub-hook/state}"
59
+ start_plugin_move
60
+
15
61
  # The plugin registers this hook for everyone, so there it waits for an opt-in; a hand registration is the opt-in.
16
62
  if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && ! opted_in; then
17
63
  exit 0
@@ -19,7 +65,6 @@ fi
19
65
 
20
66
  TOKEN="${MEMORY_HUB_MCP_TOKEN:-${CLAUDE_PLUGIN_OPTION_TOKEN:-}}"
21
67
  [ -n "$TOKEN" ] || exit 0
22
- command -v jq >/dev/null 2>&1 || exit 0
23
68
 
24
69
  # Same default as session-start.sh; change both together.
25
70
  FUNCTION_URL="${MEMORY_HUB_FUNCTION_URL:-https://dev-api.test.skl.io/function/memory-hub/memory-hub}"
@@ -30,16 +75,12 @@ SESSION_END_MIN_LINES=8
30
75
  case "$INTERVAL_MIN" in ''|*[!0-9]*) INTERVAL_MIN=30 ;; esac
31
76
  case "$MIN_NEW_LINES" in ''|*[!0-9]*) MIN_NEW_LINES=40 ;; esac
32
77
 
33
- INPUT=$(cat)
34
- EVENT=$(printf '%s' "$INPUT" | jq -r '.hook_event_name // empty' 2>/dev/null)
35
78
  case "$EVENT" in Stop|SessionEnd) ;; *) exit 0 ;; esac
36
79
  SESSION_ID=$(printf '%s' "$INPUT" | jq -r '.session_id // empty' 2>/dev/null | tr -cd 'A-Za-z0-9_-')
37
80
  [ -n "$SESSION_ID" ] || exit 0
38
81
  TRANSCRIPT_PATH=$(printf '%s' "$INPUT" | jq -r '.transcript_path // empty' 2>/dev/null)
39
82
  INPUT_CWD=$(printf '%s' "$INPUT" | jq -r '.cwd // empty' 2>/dev/null)
40
83
 
41
- umask 077
42
- STATE_DIR="${MEMORY_HUB_STATE_DIR:-$HOME/.claude/memory-hub-hook/state}"
43
84
  mkdir -p "$STATE_DIR/logs" 2>/dev/null || exit 0
44
85
  STATE_FILE="$STATE_DIR/capture-$SESSION_ID.json"
45
86
 
@@ -157,7 +198,7 @@ Rules for what you write:
157
198
  - One memory per topic or ticket. If you already saved or updated one for it in this session, update that one instead of saving again.
158
199
  EOF
159
200
  read -r -d '' tail <<'EOF' || true
160
- For anything not listed above: call memory_recall with a short query first; if one of your own memories already covers it, memory_update that memory with the merged, corrected full text. Otherwise memory_save (type "Fact" or "Scenario"). Never delete anything.
201
+ For anything not listed above: call memory_recall with a short query first; if one of your own memories already covers it, memory_update that memory with the merged, corrected full text. Otherwise memory_save (type "Fact" or "Scenario"). Never pass visibility: capture saves are Private. Never delete anything.
161
202
  EOF
162
203
  printf '%s\n%s%s' "${head//<NOW>/$now}" "$existing" "$tail"
163
204
  }
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: ask
3
+ description: Use when someone asks what the team, a project or the hub knows, e.g. "what do we know about the Welbehealth rostering rules?", "ask the hub how job allocation works", "why did we stop syncing contacts for Acme?", "has anyone solved the token refresh problem?". It answers from hub knowledge in plain language, inside or outside a project folder, fixes what it relies on when the code or a cited document moved, and saves what it learns when the hub did not know.
4
+ argument-hint: "<question>"
5
+ ---
6
+
7
+ # Ask the hub
8
+
9
+ Answer a question from what the hub already knows, for anyone: a developer in a repo, or someone in
10
+ Claude Desktop with no project folder open. Keeping knowledge current is one of the hub's core
11
+ principles, so this skill also fixes what it relies on when the code or a cited document moved, and grows the hub when
12
+ it did not know.
13
+
14
+ - **Plain language.** The person may not be a developer. Short sentences, no jargon they did not
15
+ use, and no tool names in the answer.
16
+ - **Ask only for: joining a team, which repo when it is unclear, and which sources to read**
17
+ (steps 3, 8 and 6). Everything else you decide. Joining is the person's choice, so never join
18
+ without their yes.
19
+ - **Never paste SOW or Slack text.** Say what it means in your own words and name where it came from.
20
+ - **Never reveal others' Private items.** The hub never returns them; never guess at them either.
21
+ - **End every answer with one line** listing what you updated and saved, by uid, for example
22
+ "Updated: F-123 (moved its source). Saved: F-456 (Team, Skedulo/acme-delivery)." or
23
+ "Nothing changed."
24
+
25
+ ## First, check the server version
26
+
27
+ Look at the parameters of the `memory_recall`, `memory_list`, `memory_save` and `memory_update`
28
+ tools; if only their names are listed, load their schemas first. If any of them is missing, the
29
+ memory-hub server is not connected: say so and stop. If `memory_update` has no
30
+ `expectedLastModified` parameter, or `memory_save` has no `supersedes` parameter, the memory-hub
31
+ server is older than this release. Stop, do nothing else, and say it must be updated:
32
+
33
+ - plugin installs, and `setup` installs with auto-update: restart Claude Code or Claude Desktop;
34
+ - pinned installs: re-run `npx -y @skedulo/memory-hub-mcp@latest setup --no-auto-update`;
35
+ - a checkout of the se-ai-memory-hub repo: pull and re-run `scripts/setup-dev.sh`.
36
+
37
+ ## 1. Read the question
38
+
39
+ Note the project or customer it names, if any, and pick the types to search:
40
+
41
+ - **Facts and Scenarios** for decisions, history and "why did we…";
42
+ - **Skills** for how-tos and architecture maps ("how does X work", "how do I…");
43
+ - **Wiki** for a project's rules, its work not to build and its reference pages.
44
+
45
+ When unsure, search all four.
46
+
47
+ Note too whether you have a checkout of the project's repo and the project-knowledge skill
48
+ (`memory-hub:project-knowledge` when installed as a plugin). In Claude Desktop you have neither, and
49
+ steps 4 to 6 say what changes.
50
+
51
+ ## 2. Search the hub
52
+
53
+ 1. For each type picked, `memory_recall` with `scope=team`, using the question's key words. It
54
+ also returns the person's own items, Private ones included.
55
+ 2. When a project is named, also list its pages, which works outside a repo too:
56
+ `memory_list type=Wiki titlePrefix="<Project> ›"` (paginate with `offset` until you have
57
+ `total`). Pick the pages the question needs.
58
+ 3. Read with `memory_get` every item you will rely on whose text came back cut short.
59
+ 4. When an item has `superseded: true`, prefer the newer memory that replaced it; look it up if it
60
+ was not returned.
61
+
62
+ ## 3. When a named project's pages are not found
63
+
64
+ If the question names a project and step 2 found none of its pages, check `memory_listTeams` (the
65
+ teams the person is on) before treating it as unrecorded. If none of their teams is the project's,
66
+ say that its knowledge may be shared with its team only, and that saying "join the <team> team"
67
+ shows it, using the project's name as the team name when you know no better. Call `memory_joinTeam`
68
+ only after they say yes, since joining changes who reads what; then go back to step 2. If it says no
69
+ such team exists, or they do not say yes, carry on to step 6 with what you have.
70
+
71
+ ## 4. Check what you rely on
72
+
73
+ For every item you will rely on that has a `staleness` field, follow the guide's "Stale memories"
74
+ section before answering (`memory_getSkillGuide section="Stale memories"`, loaded once per run).
75
+
76
+ - At most three fixes per question, counting those made in step 5; flag the rest in the answer.
77
+ - With no checkout of the repo an item cites (for example in Claude Desktop), staleness cannot be
78
+ worked out, so no item carries it: for each item you rely on that has a `source.verifiedAt`, say
79
+ in the answer "verified <n> days ago".
80
+
81
+ Keep each fix (uid and what changed) for the closing line.
82
+
83
+ ## 5. Check the documents you rely on
84
+
85
+ A memory can cite a Confluence page or a Google Drive file, so an edited document may no longer match
86
+ it. For each such document that an item you will rely on cites (a project page lists them on its
87
+ `<Project> › Sources` page), make one metadata call and compare it with what the hub recorded:
88
+
89
+ - Confluence: the page's `version.number` and last-updated time. Google Drive: `modifiedTime`.
90
+ - **Project page:** it names a document by title (for example `TDD For Schools §4.2`), not by id.
91
+ Find the document's line on `<Project> › Sources` by that title: it gives the page or file id for
92
+ the metadata call and the recorded version to compare with
93
+ (`confluence · page <id> "<title>" · version <n>`, `gdrive · file <id> "<title>" · modifiedTime <t>`).
94
+ - **Any other memory:** compare the document's last-updated time with the memory's
95
+ `source.verifiedAt`, or with its `createdDate` (from `memory_recall`) when it has none.
96
+
97
+ Unchanged: use the memory as it is. Changed: read only that document, answer from it, and say in the
98
+ answer that the hub's memory was behind it. Then:
99
+
100
+ - **Project page:** it is never edited here. Without a checkout of the project's repo or the
101
+ project-knowledge skill (for example in Claude Desktop), never hand off: answer from the reread
102
+ document, save a Fact on the page's repo that names the page and entry ID and says what the
103
+ document now says (step 8), and tell the person a developer can update the project page with
104
+ "update the <Project> knowledge". With both, hand the change to project-knowledge's targeted
105
+ update, which owns the page and its Sources line. Hand over what you took from the reread document as the change list. Add the document's
106
+ new version (Confluence `version.number`, or Drive `modifiedTime`) only when you read the whole
107
+ document and listed every change in it that differs from the project's pages; the targeted update
108
+ then records it on that document's Sources line. Otherwise hand over the changes without the
109
+ version, so the line stays behind and the next refresh reads the document. Tell the person the
110
+ page was behind the document.
111
+ - **Any other memory:** if still true, leave it; if clearly wrong with an obvious fix, correct it
112
+ with one `memory_update` under the "Stale memories" rules; if unclear, leave it and say why. Each correction is one of the
113
+ three fixes.
114
+
115
+ If the Atlassian or Google Drive connector is not connected, or cannot open the document, say in the
116
+ answer that the document was not checked, and use the memory as it is. Never paste the document's
117
+ text: say what it means in your own words and name the document.
118
+
119
+ Keep each fix (uid and what changed) for the closing line.
120
+
121
+ ## 6. When the hub has nothing
122
+
123
+ If nothing found answers the question, say so plainly, then ask which sources to read:
124
+ links or names of documents, tickets, Slack channels or repos. In the
125
+ same message, say that reading sources costs tokens: a few links are small; searching everything
126
+ for a project (building its knowledge from scratch) reads its code, tickets and documents and can
127
+ cost millions of tokens. Say too that what you find will be saved to the hub, for the project's
128
+ team when it is about a project.
129
+
130
+ - Read only the sources they give.
131
+ - If they say "search everything" after that warning, and you have a checkout of the project's
132
+ repo and the project-knowledge skill, run it for that project, then answer from the pages it
133
+ saved. It saves those pages itself: step 8 saves nothing more. Without them (for example in
134
+ Claude Desktop), explain that searching everything needs Claude Code opened in the project's
135
+ repo, and offer to read the sources they name instead.
136
+ - If they give no sources, answer that the hub does not know, and end with "Nothing changed."
137
+
138
+ Then answer (step 7), and save what you found (step 8) without asking again.
139
+
140
+ ## 7. Answer
141
+
142
+ Answer briefly, in plain language. Back each claim with the item it came from: its uid, its title
143
+ and, when it has one, its source as `<owner/name>@<short commit>`. Say plainly what the hub does not
144
+ know. Mention anything flagged in steps 4 and 5.
145
+
146
+ ## 8. Save what was learned
147
+
148
+ Save only what came from the sources read in steps 5 and 6, not what the hub already had;
149
+ corrections found in steps 4 and 5 are already made by their `memory_update`. One `memory_save` per
150
+ durable point: a Fact for a decision or finding, a Skill for a how-to. Pass `supersedes` with the old
151
+ uid when it replaces an existing memory, and a `source` when it came from code.
152
+
153
+ Never save commercial terms (prices, rates, budgets), customer personal data, credentials, or text
154
+ copied from a SOW or Slack. Restate it as what the system does or what was decided, and name the
155
+ source.
156
+
157
+ Decide the visibility by the guide's "What to share" section
158
+ (`memory_getSkillGuide section="What to share"`), and state the choice and the reason in the answer.
159
+
160
+ ## 9. Close
161
+
162
+ End with the one line of what changed: each update and save by uid, with the visibility of each
163
+ save, or "Nothing changed."
@@ -1,10 +1,10 @@
1
1
  ---
2
- name: se-ai-memory-hub
3
- description: Use when working in a repo where the memory-hub MCP tools (memory_recall, memory_list, memory_save, memory_saveBatch, memory_upsertPersona, memory_setVisibility, memory_bulkPromoteRepoScoped, memory_grantAccess, memory_checkRepoStatus, memory_linkRepoTeam, memory_moveResourceRepo, memory_listRepos, memory_registerRepo, memory_checkSources, memory_listTeams, memory_joinTeam, memory_addTeamMember, memory_listTeamMembers, memory_whoCanRead, memory_update, memory_getSkillGuide) are available, to recall prior context mid-session, save durable facts/skills/scenarios, update your persona, and share items with your team on explicit request
2
+ name: memory-hub
3
+ description: Use when working in a repo where the memory-hub MCP tools (memory_recall, memory_list, memory_save, memory_saveBatch, memory_upsertPersona, memory_setVisibility, memory_bulkPromoteRepoScoped, memory_grantAccess, memory_checkRepoStatus, memory_linkRepoTeam, memory_moveResourceRepo, memory_listRepos, memory_registerRepo, memory_checkSources, memory_listTeams, memory_joinTeam, memory_addTeamMember, memory_listTeamMembers, memory_whoCanRead, memory_update, memory_getSkillGuide) are available, to recall prior context mid-session, save durable facts/skills/scenarios with a deliberate visibility, update your persona, and share private notes when asked
4
4
  argument-hint: "[what to recall or save]"
5
5
  ---
6
6
 
7
- # SE AI Memory Hub
7
+ # Memory Hub
8
8
 
9
9
  Call `memory_getSkillGuide` now — it returns the current, full usage guide
10
10
  (when to recall, what to save where, sharing rules, repo linking). That
@@ -12,3 +12,5 @@ guide is served live from `memory-hub-mcp`, not copied here, so it can't go
12
12
  stale on this machine the way this stub's own content once did. This file
13
13
  stays intentionally thin: only what the harness needs to discover and
14
14
  trigger the skill.
15
+
16
+ Give every save a deliberate visibility by the guide's "What to share" rule (work knowledge is Team, on the project's repo by name), and state the choice and the reason. Follow the guide's "Stale memories" rules before relying on an item with a `staleness` field, and its "Skill drift" rule when a plugin skill contradicts the code.
@@ -19,8 +19,8 @@ and never skip one:
19
19
  - `page-format.md`: every run, before reading or writing any page.
20
20
  - `decision-rules.md`: before deciding which source wins, what becomes an entry, or a tier or status.
21
21
  - `checker.md`: before anything is saved ("Check the work").
22
- - `create-refresh.md`: create, resuming a create, and refresh from sources. It also holds
23
- "Discover sources" and "Discover features".
22
+ - `create-refresh.md`: create, resuming a create, refresh from sources and the sources-only refresh.
23
+ It also holds "Discover sources" and "Discover features".
24
24
  - `targeted-update.md`: a change list handed over by another skill, or a change asked for by entry ID.
25
25
  - `touch.md`: keeping the pages in step with the code from a commit range, used by fold-findings and
26
26
  by refresh, or when the developer asks to catch up with the code.
@@ -28,7 +28,8 @@ and never skip one:
28
28
 
29
29
  A section named in quotes is in: this file for "Before any mode", "Core changes" and "Summary";
30
30
  `decision-rules.md` for "Decision rules"; `checker.md` for "Check the work"; `create-refresh.md`
31
- for "Discover sources", "Discover features", "Create" and "Refresh from sources";
31
+ for "Discover sources", "Discover features", "Create", "Refresh from sources" and
32
+ "Sources-only refresh";
32
33
  `targeted-update.md` for "Update" and "Targeted update"; `touch.md` for "Touch update"; `import.md` for "Import" and "Import step <n>".
33
34
 
34
35
  ## How this skill works with the developer
@@ -93,11 +94,14 @@ nothing else, and tell the developer to update it:
93
94
  through with `offset` until you reach `total`). Read the ID prefix from existing entries. With no
94
95
  pages yet, choose the prefix yourself (page-format.md) and say which in the summary.
95
96
  4. Pick the mode:
96
- - a change list, a commit range or a PR's changed files handed over by plan-ticket, delegate-ticket or fold-findings, or
97
- a change the developer asks for by entry ID: the targeted update (see "Update"), whatever else
97
+ - a change list, a commit range or a PR's changed files handed over by plan-ticket, delegate-ticket or fold-findings,
98
+ a commit range with no change list handed over by the weekly sweep (sweep-knowledge), or a
99
+ change the developer asks for by entry ID: the targeted update (see "Update"), whatever else
98
100
  the bullets below would pick;
99
101
  - the developer asks to catch up with the code, and pages and a Sources page exist: the touch update
100
102
  over every repo on the Sources page, as one run (see "Touch update");
103
+ - the developer asks to refresh the sources (not the code), or the weekly sweep runs this skill,
104
+ and pages and a Sources page exist: the sources-only refresh (see "Sources-only refresh");
101
105
  - an unfinished import: the plan file `$TMPDIR/memory-hub-import/<PREFIX>.json` exists, has pages
102
106
  or facts with neither `savedUid` nor `skip`, and every existing `<Project> ›` page is one whose
103
107
  uid the plan records as a `savedUid`. If any item has a `savedUid`, apply was interrupted: re-run
@@ -161,4 +165,13 @@ Use these headings and leave out any that would be empty:
161
165
  with counts.
162
166
  - **Changed by teammates meanwhile**: pages that were edited while you worked, if any.
163
167
 
168
+ - **Help it find more**: what would make this knowledge more complete, so the developer can enrich
169
+ it. Name each connector that was not connected and what it would have added (Linear tickets,
170
+ Confluence or Google Drive documents, Slack channels). Name each kind of source the search found
171
+ none of (no technical design, no SOW, work order or change request, no project Slack channel),
172
+ and each feature that rests on code alone or has rules `(not found in code)`. Say that naming or
173
+ linking a document, channel or repo adds it to the Sources page, so every later refresh reads it,
174
+ and that documents titled with the project name are found on their own. Leave it out when nothing
175
+ is missing.
176
+
164
177
  Finish with one line telling the developer they can change anything by saying so.
@@ -148,14 +148,33 @@ already there.
148
148
  3. Apply the confidentiality rules to every change, then check the changed and new entries (see
149
149
  "Check the work").
150
150
  4. Apply every change that does not touch an existing `core` entry, with the team-safe editing steps
151
- in page-format.md, numbering new entries from the `Next IDs` line. Set each page you checked to the
152
- commit you checked it against ("Page source" in page-format.md), except a page fed by a pack.
151
+ in page-format.md, numbering new entries from the `Next IDs` line. For a `repo` whose commit moved, set the
152
+ `source` of every project page of that repo to the commit the refresh diffed through, touched or
153
+ not, since the whole range was checked ("Page source" in page-format.md); set any other page you
154
+ checked to the commit you checked it against. Never touch a page fed by a pack.
153
155
  5. Handle core changes (see "Core changes").
154
156
  6. Update the Sources page with the versions you read, through the same editing steps, then give the
155
157
  summary. For each pack source, also set the pages it feeds to the new commit
156
158
  (`memory_update ... source={repo: "<owner/name>", commit: "<sha>"}` with `expectedLastModified`),
157
159
  so `memory_checkSources` stops reporting them.
158
160
 
161
+ ## Sources-only refresh
162
+
163
+ **Sources-only refresh**: the developer asks to refresh the sources, or the weekly sweep runs it. The
164
+ touch update and the sweep keep the pages in step with the code; this reads everything else.
165
+
166
+ Run "Refresh from sources" steps 1 to 6, skipping every `repo` source:
167
+
168
+ - Step 1: never run the touch update and never read a repo. Repos newly linked to the team are
169
+ listed in the summary under "Worth a look", not read.
170
+ - Step 4: leave each page's `source` as it is, since no code was read.
171
+ - Step 6: leave the Sources page's `repo` lines as they are; update only the sources you read.
172
+
173
+ When it runs unattended (the sweep), it never asks. Apply only the changes that do not touch an
174
+ existing `core` entry. Apply none of the core changes, write nothing about them to the pages, and
175
+ list them in the summary as waiting. Anything that would make it stop and ask ends the run with a
176
+ summary that says why.
177
+
159
178
  ## Source versions
160
179
 
161
180
  How to read each source's current version for the Sources page:
@@ -1,13 +1,38 @@
1
1
  # Targeted update
2
2
 
3
- **Targeted update**: a change list handed over by plan-ticket, delegate-ticket or fold-findings, or a
4
- change the developer asks for by entry ID. Do not re-read sources, rediscover or touch the Sources
5
- page or the feature map, except for feature-map changes the list itself carries the `Next IDs` line, and the touch update's feature-map changes. When the handed-over
6
- delivery repo has no `<Project> ›` pages or no Sources page, end the run and say so, naming the
7
- changes not applied: a targeted update never creates, resumes or imports. A change marked
3
+ **Targeted update**: a change list handed over by plan-ticket, delegate-ticket or fold-findings, a
4
+ change list from a document ask reread (with that document's version, see "Document version"), a
5
+ commit range with no change list handed over by the weekly sweep (sweep-knowledge), or a change the
6
+ developer asks for by entry ID. Do not re-read sources or rediscover. It may touch only:
7
+
8
+ - the entries listed (for a commit range, the entries its touch update changes);
9
+ - the feature-map changes the list carries;
10
+ - the `Next IDs` line;
11
+ - the touch update's feature-map changes;
12
+ - a handed-over document version, on that document's Sources line (see "Document version").
13
+
14
+ When the handed-over delivery repo has no `<Project> ›` pages or no Sources page, end the run and
15
+ say so, naming the changes not applied: a targeted update never creates, resumes or imports. A change marked
8
16
  "from ticket" by plan-ticket becomes a new entry, `unverified` with `Pending <PARENT-ID>`, and the entry
9
17
  it overrides gets a `Conflict:` note; a change marked "from code" cites the code.
10
18
 
19
+ Never move a Sources page watermark; only a refresh or a catch-up does, except a document version
20
+ handed over with a reread of that document.
21
+
22
+ **Document version.** A caller that reread a Confluence page or Google Drive file (ask does, when
23
+ the document changed since its Sources line) may hand over that document's new version together
24
+ with the changes it took from it: the Confluence `version.number`, or the Drive `modifiedTime`. The
25
+ caller hands the version over only when it read the whole document and listed every change in it
26
+ that differs from the project's pages; a caller that read part of it (ask reads a document to answer
27
+ one question) hands over the changes without a version, and then nothing here touches the Sources
28
+ line, so the next refresh reads the document. A version handed over without such a full reread is
29
+ ignored. After the changes are applied (steps 1 and 2), replace the version on that document's own
30
+ line on the Sources page, and no other line, with the team-safe editing steps in page-format.md:
31
+ `confluence · page <id> "<title>" · version <n>` or `gdrive · file <id> "<title>" · modifiedTime <t>`, and set
32
+ `read` to today. Record it only when the changes taken from that document were saved or already
33
+ there; when any was declined or left waiting (core), leave the line as it is so a later run
34
+ reads the document again. Add a change-log line saying which document's version moved.
35
+
11
36
  1. Apply the confidentiality rules to the listed changes, then check them (see "Check the work",
12
37
  which says which of them need the checker).
13
38
  2. Apply every change that does not touch an existing `core` entry, with the team-safe editing steps
@@ -59,7 +59,8 @@ unchanged code and never rebuilds the project. Callers:
59
59
  - a catch-up: run steps 1 to 7 for every repo on the Sources page first, then, once for all of
60
60
  them, check the new and changed entries ("Check the work"), apply them with the team-safe editing
61
61
  steps, numbering from the `Next IDs` line, handle "Core changes", and give the summary, with the
62
- ranges under "Sources read". Only after applying, set each touched page's `source` and each
63
- repo's line on the Sources page to its `<B>` (except a page fed by a pack).
64
- A refresh sets those after it applies the changes (its step 6). From fold-findings, leave both as
62
+ ranges under "Sources read". Only after applying, set the `source` of every project page whose
63
+ `source` names that repo to its `<B>`, touched or not, since the whole range was diffed (except
64
+ a page fed by a pack), and each repo's line on the Sources page to its `<B>`.
65
+ A refresh sets the page sources the same way in its step 4 and the Sources page lines in its step 6. From fold-findings, leave both as
65
66
  they are: other merges may lie between them and `<B>`, and the next refresh covers them.