@skedulo/memory-hub-mcp 0.2.19 → 0.2.21

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
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.
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?", "where is the Acme release at?", "which test cases cover manual entry?", "is bulk cancel in scope for Acme?". It answers as a delivery lead, developer, QA or consultant, picked from the question, from hub knowledge, inside or outside a project folder, fixes what it relies on when the code, a cited document, a ticket or a PR moved, and saves what it learns when the hub did not know.
4
4
  argument-hint: "<question>"
5
5
  ---
6
6
 
@@ -8,13 +8,14 @@ argument-hint: "<question>"
8
8
 
9
9
  Answer a question from what the hub already knows, for anyone: a developer in a repo, or someone in
10
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.
11
+ principles, so this skill also fixes what it relies on when the code, a cited document, a ticket or
12
+ a PR moved, and grows the hub when it did not know. It answers in the role the question needs
13
+ (delivery lead, developer, QA or consultant), which changes what it reads and how it answers.
13
14
 
14
15
  - **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
+ use, and no tool names in the answer, unless the role's file says otherwise.
16
17
  - **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
+ (steps 3, 9 and 7). Everything else you decide. Joining is the person's choice, so never join
18
19
  without their yes.
19
20
  - **Never paste SOW or Slack text.** Say what it means in your own words and name where it came from.
20
21
  - **Never reveal others' Private items.** The hub never returns them; never guess at them either.
@@ -36,7 +37,33 @@ server is older than this release. Stop, do nothing else, and say it must be upd
36
37
 
37
38
  ## 1. Read the question
38
39
 
39
- Note the project or customer it names, if any, and pick the types to search:
40
+ Note the project or customer it names, if any. A link names it too: a Linear project or ticket, a
41
+ GitHub PR, or a Confluence or Drive document is the question's subject. Find the project's repos
42
+ with `memory_listRepos`, called without a query, by keeping those whose team is the project or
43
+ customer: a repo's own name often does not include it.
44
+
45
+ Then pick the role to answer as, and read its file in this skill's folder before step 2 (as a
46
+ prompt, the role files follow this skill):
47
+
48
+ - **delivery** (`references/delivery.md`): progress, dates, milestones, risks, releases, what is
49
+ blocked or left;
50
+ - **developer** (`references/developer.md`): how the code works, where something lives, how to
51
+ change or fix it;
52
+ - **qa** (`references/qa.md`): test cases, UAT, defects, what to test or what is untested;
53
+ - **consultant** (`references/consultant.md`): rules, scope, what the customer asked for or
54
+ agreed, what not to build, bug or change.
55
+
56
+ The person's own words decide first ("as a PM", "as a dev", "as QA", "as a BA"), then the question.
57
+ When the question fits none clearly, use the default in the persona's `preferences` (a line
58
+ "ask role: <role>", from `memory_sessionContext`); with none, answer without a role file. A question
59
+ that plainly spans two roles uses both files, never more. When you inferred the role, name it in
60
+ the answer's first line so the person can redirect it.
61
+
62
+ When the person asks to make a role their default, take the persona's `preferences` from
63
+ `memory_sessionContext`, add or replace its "ask role: <role>" line, and pass the whole text back
64
+ with `memory_upsertPersona`, which replaces the field.
65
+
66
+ Pick the types to search, starting with those the role's file names:
40
67
 
41
68
  - **Facts and Scenarios** for decisions, history and "why did we…";
42
69
  - **Skills** for how-tos and architecture maps ("how does X work", "how do I…");
@@ -46,7 +73,7 @@ When unsure, search all four.
46
73
 
47
74
  Note too whether you have a checkout of the project's repo and the project-knowledge skill
48
75
  (`memory-hub:project-knowledge` when installed as a plugin). In Claude Desktop you have neither, and
49
- steps 4 to 6 say what changes.
76
+ steps 4 to 7 say what changes.
50
77
 
51
78
  ## 2. Search the hub
52
79
 
@@ -66,7 +93,7 @@ teams the person is on) before treating it as unrecorded. If none of their teams
66
93
  say that its knowledge may be shared with its team only, and that saying "join the <team> team"
67
94
  shows it, using the project's name as the team name when you know no better. Call `memory_joinTeam`
68
95
  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.
96
+ such team exists, or they do not say yes, carry on to step 7 with what you have.
70
97
 
71
98
  ## 4. Check what you rely on
72
99
 
@@ -100,7 +127,7 @@ answer that the hub's memory was behind it. Then:
100
127
  - **Project page:** it is never edited here. Without a checkout of the project's repo or the
101
128
  project-knowledge skill (for example in Claude Desktop), never hand off: answer from the reread
102
129
  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
130
+ document now says (step 9), and tell the person a developer can update the project page with
104
131
  "update the <Project> knowledge". With both, hand the change to project-knowledge's targeted
105
132
  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
133
  new version (Confluence `version.number`, or Drive `modifiedTime`) only when you read the whole
@@ -118,7 +145,74 @@ text: say what it means in your own words and name the document.
118
145
 
119
146
  Keep each fix (uid and what changed) for the closing line.
120
147
 
121
- ## 6. When the hub has nothing
148
+ ## 6. Check the live state of work
149
+
150
+ A memory about work in progress is a snapshot. Tickets move and PRs merge or close after it was
151
+ saved, and work that never went through a hub session (a teammate's, a QA move, a PR closed by hand)
152
+ is not in the hub at all. Do this step:
153
+
154
+ - always for the delivery and QA roles;
155
+ - for any role, when the question is about progress, status, or what is open, done or released;
156
+ - for any role, when the answer rests on an item that states a ticket or PR status ("Status as
157
+ of…", "PR #n open", "In QA").
158
+
159
+ The role's file says what else to list.
160
+
161
+ 1. **List recent work.** Pick the window: the last 14 days, or since the oldest status date among
162
+ the items you rely on when that is earlier, never more than 30 days. Pick the repos: those of
163
+ the items you rely on and, for a progress or status question that names a project, its team's
164
+ repos from `memory_listRepos`. In each, list the PRs opened, merged or closed in the window:
165
+ `gh pr list -R <owner/name> --state all --limit 100 --search "updated:>=<date>" --json
166
+ number,title,state,author,mergedAt,closedAt,updatedAt,headRefName`, and drop those whose author
167
+ is a bot (`author.is_bot`, or a login ending in `[bot]`). For a status question that names a
168
+ project, also list the tickets updated in the window, at most 100 in all: those in the Linear
169
+ projects, or under the parent tickets, of the tickets the memories cite (a name search misses
170
+ stories whose titles do not name the customer), plus a search by the project or customer name.
171
+ 2. **Check what the memories cite.** Match each ticket and PR an item you rely on names against
172
+ those lists, and look up only the ones they missed: at most 20 calls in all, and flag the rest
173
+ as not checked.
174
+ - A ticket (its `externalRef`, or a ticket ID in its text): one Linear or Jira call for its
175
+ status, assignee and last update.
176
+ - A PR written as `<owner/name>#<n>` or as a link: `gh pr view <n> -R <owner/name> --json
177
+ state,mergedAt,closedAt,title,headRefName`.
178
+ - A bare `#<n>` may be in any of the project's repos. Take a PR as the one cited only when its
179
+ title or branch names a ticket the item cites; otherwise say in the answer that you could not
180
+ tell which PR it is.
181
+ 3. **Read more only where it matters.** Read the comments of at most five tickets: those whose status
182
+ changed since the hub's note, those whose PR was closed without merging, and those waiting on a
183
+ decision. Read nothing else.
184
+
185
+ Then:
186
+
187
+ - **Which state wins.** A merged PR or a recorded release beats any ticket status. A ticket beats
188
+ the memory only when the ticket's last update is later than the memory's status date (its "as of"
189
+ date, else its `lastModifiedDate`). Never move a memory backward on a ticket alone, for example
190
+ from shipped to "Ready for Prod": tickets are often left behind. When a ticket disagrees and does
191
+ not win, say in the answer that the ticket may be behind, and change nothing.
192
+ - **A memory whose status is now wrong:** add a status note to it under the guide's "Stale
193
+ memories" rules: one `memory_update` that adds a dated line at the top saying where the work now
194
+ stands and where that was seen ("UPDATE <date> (GitHub): PR #123 closed without merging"), and
195
+ keeps the rest. Say what is true now; never write that the rest is out of date. Flag, instead of
196
+ editing, an item those rules say you cannot edit. A project page is never edited here: handle it
197
+ as step 5 handles a project page that is behind its document. Status notes are not among step
198
+ 4's three fixes. At most five status notes per question; flag the rest in the answer.
199
+ - **What the hub had no memory of** goes into step 9 as the project's status snapshot: one Fact on
200
+ the project's repo that starts "<Project> status snapshot, <date>", with ticket statuses, PR
201
+ states, open decisions and newly seen tickets, and `externalRef` set to the main ticket when
202
+ there is one. Find the last snapshot first (`memory_recall type=Fact scope=team` for
203
+ "<Project> status snapshot") and pass its uid as `supersedes`, so the hub keeps one.
204
+ - **In the answer,** say which live sources you checked and when. Anything you did not check keeps
205
+ the date the hub gave it.
206
+
207
+ Without a shell (for example in Claude Desktop), check PRs through a GitHub connector if one is
208
+ attached. If Linear, Jira or GitHub cannot be reached, say in the answer what was not checked and
209
+ use the memories as they are. Never paste ticket comments: say what they mean and name the ticket.
210
+
211
+ Keep each correction (uid and what changed) for the closing line.
212
+
213
+ ## 7. When the hub has nothing
214
+
215
+ If step 6 found the answer, skip this step: answer (step 8) and save it (step 9).
122
216
 
123
217
  If nothing found answers the question, say so plainly, then ask which sources to read:
124
218
  links or names of documents, tickets, Slack channels or repos. In the
@@ -130,23 +224,23 @@ team when it is about a project.
130
224
  - Read only the sources they give.
131
225
  - If they say "search everything" after that warning, and you have a checkout of the project's
132
226
  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
227
+ saved. It saves those pages itself: step 9 saves nothing more. Without them (for example in
134
228
  Claude Desktop), explain that searching everything needs Claude Code opened in the project's
135
229
  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."
230
+ - If they give no sources, answer that the hub does not know, and close as step 10 says.
137
231
 
138
- Then answer (step 7), and save what you found (step 8) without asking again.
232
+ Then answer (step 8), and save what you found (step 9) without asking again.
139
233
 
140
- ## 7. Answer
234
+ ## 8. Answer
141
235
 
142
- Answer briefly, in plain language. Back each claim with the item it came from: its uid, its title
236
+ Answer briefly, shaped as the role's file says, in plain language unless it says otherwise. Back each claim with the item it came from: its uid, its title
143
237
  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.
238
+ know. Mention anything flagged in steps 4 to 6.
145
239
 
146
- ## 8. Save what was learned
240
+ ## 9. Save what was learned
147
241
 
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
242
+ Save only what came from the sources read in steps 5 to 7, not what the hub already had;
243
+ corrections found in steps 4 to 6 are already made by their `memory_update`. One `memory_save` per
150
244
  durable point: a Fact for a decision or finding, a Skill for a how-to. Pass `supersedes` with the old
151
245
  uid when it replaces an existing memory, and a `source` when it came from code.
152
246
 
@@ -157,7 +251,7 @@ source.
157
251
  Decide the visibility by the guide's "What to share" section
158
252
  (`memory_getSkillGuide section="What to share"`), and state the choice and the reason in the answer.
159
253
 
160
- ## 9. Close
254
+ ## 10. Close
161
255
 
162
256
  End with the one line of what changed: each update and save by uid, with the visibility of each
163
257
  save, or "Nothing changed."
@@ -0,0 +1,27 @@
1
+ # Answering as a consultant or BA
2
+
3
+ For business rules, scope, what the customer asked for or agreed, what not to build, and whether a
4
+ request is a bug or a change.
5
+
6
+ ## Search first
7
+
8
+ - The project's Rules pages (rules with IDs and tiers), its Don't build page, and its Reference
9
+ pages (overview, glossary, workflows).
10
+ - Facts on decisions and on the customer's answers to questions.
11
+ - `<Project> › Sources`, for the documents behind each rule.
12
+
13
+ ## Live sources
14
+
15
+ - The documents the rules cite (SOW, TDD, design pages), through step 5. Step 5's checks matter
16
+ most for this role: a changed SOW or TDD changes the scope.
17
+ - Tickets only for a decision recorded in their comments: at most five tickets' comments.
18
+
19
+ ## Answer
20
+
21
+ - Answer with the rule IDs that decide it, and say what each means in your own words.
22
+ - In or out of scope: name the rule, the Don't build entry, or the document behind it. When nothing
23
+ covers it, say so: it is a new requirement, which needs a change request.
24
+ - Bug or change: a bug breaks an agreed rule or acceptance criterion; anything else the customer
25
+ now wants is a change. Name what it was measured against.
26
+
27
+ Never paste SOW text, and never name commercial terms (prices, rates, budgets).
@@ -0,0 +1,47 @@
1
+ # Answering as a delivery lead
2
+
3
+ For progress, dates, milestones, risks, releases, and what is blocked or left. Step 6 always runs
4
+ for this role.
5
+
6
+ ## Search first
7
+
8
+ - Facts and Scenarios on the project's repos: the latest "<Project> status snapshot", release
9
+ Facts, and plan Scenarios.
10
+ - The project's Reference pages only when the answer needs its scope.
11
+
12
+ ## Live sources (in step 6)
13
+
14
+ Find the Linear project: the one the question links, else the project of the tickets the memories
15
+ cite (at most three projects, the most cited first).
16
+
17
+ 1. Get the project with its milestones (name, target date, progress), its status, target date and
18
+ lead.
19
+ 2. Read its latest project update: health, date and what it says. Never paste it.
20
+ 3. List its issues: every open one whatever its last update, since stalled work is what a status
21
+ answer most needs, and those completed or canceled in step 6's window. They count toward step
22
+ 6's 100 tickets.
23
+ 4. Release and deploy tickets done in the window say what reached which environment.
24
+
25
+ Then check PRs as step 6 says.
26
+
27
+ ## When Linear itself is behind
28
+
29
+ Project status, milestone progress and target dates are set by hand and are often left behind.
30
+ Flag these in the answer as "Linear may be behind", and never correct the hub from them:
31
+
32
+ - a milestone whose target date has passed with progress under 100%;
33
+ - a project status that does not match its issues, for example Backlog while stories are in UAT;
34
+ - a latest project update older than 14 days.
35
+
36
+ ## Answer
37
+
38
+ 1. One line on where the project stands against its next milestone date (on track, at risk or
39
+ behind) and why.
40
+ 2. Milestones: the last one passed and the next two, each with its target date and progress.
41
+ 3. Work by state: done or released (with the environment and version when the hub knows them), in
42
+ UAT or QA, in progress, waiting (and on whom: the customer, or another team's ticket), not
43
+ started.
44
+ 4. Risks and decisions waiting, each naming its ticket.
45
+ 5. What was not checked, and each "Linear may be behind" flag.
46
+
47
+ Ticket IDs are fine in the answer; tool names are not.
@@ -0,0 +1,27 @@
1
+ # Answering as a developer
2
+
3
+ For how the code works, where something lives, why it behaves as it does, and how to change or fix
4
+ it.
5
+
6
+ ## Search first
7
+
8
+ - Skills (architecture maps and how-tos) and Facts with a `source`, on the project's repos.
9
+ - The project's Rules pages only when a rule constrains the change; cite the rule's ID.
10
+
11
+ ## Live sources
12
+
13
+ - The code. With a checkout, confirm the answer in the files the items you rely on cite, read at
14
+ `origin/<default>` (`git show origin/<default>:<path>`), never the working tree. Read at most
15
+ five other files to fill a gap. Step 4's staleness check matters most for this role.
16
+ - Without a checkout, say the answer was not checked against the code, and give each item's
17
+ "verified <n> days ago".
18
+ - PRs only when the question is about a change in flight, through step 6.
19
+
20
+ ## Answer
21
+
22
+ - Lead with the answer, then where it lives: `<owner/name>@<short commit>:<path>` for each place,
23
+ and the uid of each memory used.
24
+ - Name the gotchas the memories record, with their uids.
25
+ - File paths, function names, commands and tool names are fine for this role. Use no jargon the
26
+ code and the question do not use.
27
+ - When the code contradicts a memory, the code wins: say so, and fix the memory under step 4.
@@ -0,0 +1,33 @@
1
+ # Answering as QA
2
+
3
+ For test cases, UAT, defects, regressions, and what to test or what is untested. Step 6 runs for
4
+ this role, for the stories the question is about.
5
+
6
+ ## Search first
7
+
8
+ - The project's Rules pages for the feature: the expected behaviour, with rule IDs. These are what
9
+ a test checks.
10
+ - Facts and Scenarios on known issues, defects and UAT findings.
11
+
12
+ ## Live sources (in step 6)
13
+
14
+ For each story the question is about (named by ID or title, or the feature's stories in its Linear
15
+ project), at most 15 stories:
16
+
17
+ - its status and its acceptance criteria (the ticket's description: read it, never paste it);
18
+ - its sub-tickets, above all its test-case tickets (titles like "Create test cases - …"), and their
19
+ state;
20
+ - defects: bug tickets linked to it, or in its project naming the feature, and their state.
21
+
22
+ Take these from one listing of the project's issues, which gives each sub-ticket's parent, rather
23
+ than a call per story. Read comments only on stories that failed QA or UAT or were sent back, within
24
+ step 6's five.
25
+
26
+ ## Answer
27
+
28
+ - For each story: its state, its test cases (done, canceled or missing) and its open defects.
29
+ - Gaps: stories in QA or UAT with no done test-case ticket, rules no story or test covers, and
30
+ known issues the hub records that have no ticket.
31
+ - What to test next, riskiest first, each tied to a rule ID or an acceptance criterion.
32
+
33
+ Never paste test steps or ticket text: say what they mean and name the ticket.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: sweep-knowledge
3
- description: Use for the weekly knowledge sweep, run by hand or as a scheduled routine, e.g. "sweep the hub knowledge", "dry-run the knowledge sweep", "apply the weekly sweep for Skedulo/acme-delivery". It checks every hub memory sourced from your teams' repos against the latest code, stamps the ones still current, updates a capped number of changed ones, refreshes each project's non-code sources, and reports one digest. It never asks questions.
4
- argument-hint: "[dry-run|apply] [repo owner/name ...]"
3
+ description: Use for the weekly knowledge sweep, run by hand or as a scheduled routine, e.g. "sweep the hub knowledge", "dry-run the knowledge sweep", "apply the weekly sweep for Skedulo/acme-delivery". It checks every hub memory sourced from your teams' repos against the latest code, stamps the ones still current, updates a capped number of changed ones, refreshes each project's non-code sources, and reports one digest. It never asks questions. It can also schedule itself as a weekly cloud routine.
4
+ argument-hint: "[dry-run|apply|schedule [dry-run|apply]] [repo owner/name ...]"
5
5
  ---
6
6
 
7
7
  # Weekly knowledge sweep
@@ -15,7 +15,7 @@ ones, within fixed caps.
15
15
  would do. `apply` stamps, updates and refreshes. Start with dry runs; switch to `apply` once the
16
16
  digests look right.
17
17
  - **Repos.** The `owner/name` arguments, or else every repo found in step 2.
18
- - **Unattended.** Never ask a question. Anything that would need an answer is skipped and listed in
18
+ - **Unattended.** Never ask a question (schedule mode asks for one environment id, once). Anything that would need an answer is skipped and listed in
19
19
  the digest as waiting, with why. A problem that stops the whole run still ends with the digest.
20
20
  - **Never draft new knowledge.** The sweep saves no new memories, SkillDrift Facts included; it only
21
21
  stamps, updates, flags and reports.
@@ -39,9 +39,50 @@ The `sweep` command needs `MEMORY_HUB_MCP_TOKEN` in the environment. If it is mi
39
39
  in the digest how to provide it, as step 3 of the project-knowledge skill's `references/import.md`
40
40
  explains (`memory-hub:project-knowledge` when installed as a plugin).
41
41
 
42
+ ## Schedule mode
43
+
44
+ `schedule` sets up the weekly cloud routine `Memory hub weekly sweep` and stops. The rest of this
45
+ skill does not run. In order:
46
+
47
+ 1. If `MEMORY_HUB_MCP_TOKEN` is unset, stop and say how to provide it, as in the check above. Never
48
+ print the token.
49
+ 2. **Environment.** The token, the network access and the plugin live on a claude.ai cloud
50
+ environment, not on the routine. `RemoteTrigger list`, and if the existing routine has a
51
+ `job_config.ccr.environment_id`, reuse it. Otherwise ask for the id (`env_...`) of an environment
52
+ named `Memory hub`, giving these settings to create in claude.ai (Claude Code, environments).
53
+ This is the only question schedule mode asks.
54
+ - Network access: custom, keep the defaults, and add `*.skl.io`.
55
+ - Environment variable: `MEMORY_HUB_MCP_TOKEN=<your token>`. They paste it themselves from Pulse
56
+ Web or their local settings.
57
+ - If your local `MEMORY_HUB_FUNCTION_URL` differs from the default, set it on the environment too.
58
+ - Setup script:
59
+ ```
60
+ claude plugin marketplace add Skedulo/se-ai-memory-hub
61
+ claude plugin install memory-hub@memory-hub
62
+ ```
63
+ 3. **Repos.** `memory_listRepos`; keep every name matching the repo pattern in step 2 below. The
64
+ command drops repos without hub items.
65
+ 4. **Connectors.** From the `RemoteTrigger list` result, take the first `mcp_connections` entry named
66
+ `Linear`, `Atlassian`, `Google_Drive` or `Slack` across the developer's routines, and write them as
67
+ a JSON array to a temp file. If there are none, pass no file, and say the non-code refresh will
68
+ list sources as not refreshed until they add connectors on the routine page.
69
+ 5. **User.** `git config user.email`, else the email in the memory-hub persona
70
+ (`memory_sessionContext`). If neither exists, stop and say why.
71
+ 6. **Mode.** The argument after `schedule`, else the mode in the existing routine's prompt, else
72
+ `dry-run`.
73
+ 7. Run `npx -y @skedulo/memory-hub-mcp@latest routine --mode <mode> --user <email> --environment
74
+ <env id> --repos <owner/name,...> [--connections-file <file>]`. It prints the routine JSON. Exit
75
+ code 2: relay the command's message and stop (bad arguments, unreadable connections file, or no
76
+ repo with hub items). Exit code 1: the token is missing. Remove the temp connections file on
77
+ every stop.
78
+ 8. `RemoteTrigger create` with that JSON, or `update` the existing routine with the full body so
79
+ removed repos drop out. Remove the temp file.
80
+ 9. Reply with the routine link, the next run time, the mode and the repo count only. Never echo the
81
+ token or the body.
82
+
42
83
  ## 1. Settle the mode and the date
43
84
 
44
- Take the mode from the arguments (`dry-run` when none is given) and today's date, used as the reason
85
+ Take the mode from the arguments (`dry-run` when none is given; `schedule` goes to the section above) and today's date, used as the reason
45
86
  "weekly sweep <date>" in every change-log line this run writes.
46
87
 
47
88
  ## 2. Find the repos
@@ -61,7 +102,15 @@ Take the mode from the arguments (`dry-run` when none is given) and today's date
61
102
 
62
103
  For each swept repo, in turn:
63
104
 
64
- 1. Clone it fresh, without blobs, so only the files a diff needs are fetched:
105
+ 1. In a cloud routine the sources are already checked out, shallow, at `/home/user/<name>` (the
106
+ working directory or its parent). If one of them is `<owner/name>` (match `git remote get-url
107
+ origin`), use it as the clone; if `git rev-parse --is-shallow-repository` says `true`, run
108
+ `git fetch --unshallow`, and if that fails, list the repo as not swept, with the error. Then run
109
+ `git remote set-head origin --auto` (ignore a failure) and `git rev-parse --verify -q
110
+ origin/HEAD`; in `apply` mode, if that prints nothing, list the repo as not swept: no
111
+ `origin/HEAD` to stamp against. A repo with hub items that is not checked out in a cloud run is
112
+ not swept: list it as "not a source; re-run `schedule` to add it", not as a clone failure.
113
+ Otherwise clone it fresh, without blobs, so only the files a diff needs are fetched:
65
114
  `rm -rf "${TMPDIR:-/tmp}/memory-hub-sweep/<owner>/<name>"`, then
66
115
  `gh repo clone <owner/name> "${TMPDIR:-/tmp}/memory-hub-sweep/<owner>/<name>" -- --filter=blob:none`
67
116
  (or `git clone --filter=blob:none` with the repo URL when `gh` is not available). If the clone
@@ -92,7 +141,7 @@ Take the items in order. Before reading anything, skip and list:
92
141
  - `diffLines` over 300: flag it as too big to check here. For a project page, suggest "catch up the
93
142
  <Project> knowledge with the code".
94
143
  - `diffLines` of -1: the diff failed; flag it as not checked.
95
- - `editedByOtherWithin7Days`: someone else is working on it; report it, never rewrite it.
144
+ - `editedByOtherWithin7Days`: someone else is working on it; never rewrite it. Count it as "already swept by a teammate" in the digest, not as waiting.
96
145
  - `editable: false`: flag it (the "Stale memories" rule on edits you cannot make).
97
146
  - tagged `Superseded`: a newer memory replaced it; report it, do not update it.
98
147
 
@@ -137,7 +186,7 @@ In `apply` mode, for each project that has `<Project> › Sources` on a swept re
137
186
  (`memory_list type=Wiki repo=<repo uid> titlePrefix="<Project> › Sources"`), run the
138
187
  project-knowledge skill as "the weekly sweep runs this skill", so it picks the sources-only refresh:
139
188
  it reads the non-code sources, never repos, applies only non-core changes, and lists the core ones
140
- as waiting. Each refresh counts as one update against the cap; once the cap is reached, list the
189
+ as waiting. A source whose connector tools are missing is listed as not refreshed, not as an error. Each refresh counts as one update against the cap; once the cap is reached, list the
141
190
  remaining projects as not reached. In `dry-run` mode, list the projects it would refresh, counted
142
191
  the same way.
143
192
 
@@ -156,8 +205,9 @@ One digest for the whole run, headed with the mode and the date:
156
205
  1. Per repo: `target`, and the counts of unchanged, stamped, changed, updated, flagged, skipped,
157
206
  not reached, nothing cited, unknown commit, other repo and errors. Repos not swept, with why.
158
207
  2. Each update with its reason, by title (uid only when Private).
159
- 3. Flagged and skipped items with why: too big, diff failed, edited by someone else in the last 7 days, not
160
- editable, superseded, unclear after verifying, not reached.
208
+ 3. Flagged and skipped items with why: too big, diff failed, not editable,
209
+ superseded, unclear after verifying, not reached. Items edited by someone else in the last 7
210
+ days are counted as already swept by a teammate.
161
211
  4. Per project: what the targeted updates and sources-only refreshes changed, by page title and
162
212
  entry ID, the core changes waiting ("run project-knowledge on <Project> to decide them"), and
163
213
  anything "Worth a look", such as new modules.
@@ -167,4 +217,5 @@ One digest for the whole run, headed with the mode and the date:
167
217
 
168
218
  ## 8. Clean up
169
219
 
170
- Remove the clones, even after a failure: `rm -rf "${TMPDIR:-/tmp}/memory-hub-sweep"`.
220
+ Remove the clones, even after a failure: `rm -rf "${TMPDIR:-/tmp}/memory-hub-sweep"`. Never remove
221
+ a repo that was already checked out.
@@ -26,7 +26,8 @@ function skillPaths(assetsDir) {
26
26
  function readSkillBody(assetsDir) {
27
27
  for (const path of skillPaths(assetsDir)) {
28
28
  try {
29
- return (0, fs_1.readFileSync)(path, 'utf-8').replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, '').trim();
29
+ const body = (0, fs_1.readFileSync)(path, 'utf-8').replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, '').trim();
30
+ return [body, ...roleFiles((0, path_1.dirname)(path))].join('\n\n');
30
31
  }
31
32
  catch {
32
33
  continue;
@@ -34,6 +35,18 @@ function readSkillBody(assetsDir) {
34
35
  }
35
36
  return undefined;
36
37
  }
38
+ // A prompt has no skill folder to read from, so the role files ride along.
39
+ function roleFiles(skillDir) {
40
+ const folder = (0, path_1.join)(skillDir, 'references');
41
+ let names;
42
+ try {
43
+ names = (0, fs_1.readdirSync)(folder).filter((name) => name.endsWith('.md')).sort();
44
+ }
45
+ catch {
46
+ return [];
47
+ }
48
+ return names.map((name) => `## references/${name}\n\n${(0, fs_1.readFileSync)((0, path_1.join)(folder, name), 'utf-8').trim()}`);
49
+ }
37
50
  function askPromptText(question, assetsDir) {
38
51
  const body = readSkillBody(assetsDir) || FALLBACK;
39
52
  return `${body}\n\n## The question\n\n${question.trim()}\n`;
package/dist/cli.js CHANGED
@@ -72,6 +72,23 @@ else if (command === 'sweep') {
72
72
  process.exitCode = 1;
73
73
  });
74
74
  }
75
+ else if (command === 'routine') {
76
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
77
+ const { runRoutine } = require('./routine');
78
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
79
+ const { functionUrl } = require('./setup');
80
+ runRoutine(process.argv.slice(3), {
81
+ env: process.env,
82
+ log: (line) => console.log(line),
83
+ functionUrl,
84
+ timeZone: () => Intl.DateTimeFormat().resolvedOptions().timeZone,
85
+ }).then((code) => {
86
+ process.exitCode = code;
87
+ }, (error) => {
88
+ console.error(error instanceof Error ? error.message : String(error));
89
+ process.exitCode = 1;
90
+ });
91
+ }
75
92
  else if (command === 'migrate-plugin') {
76
93
  // eslint-disable-next-line @typescript-eslint/no-var-requires
77
94
  const { runMigratePlugin } = require('./migrate-plugin');
@@ -110,6 +127,10 @@ else if (command === '--help' || command === '-h') {
110
127
  they cite changed since their source commit, and print JSON.
111
128
  Compares against the checkout's origin/HEAD and never fetches.
112
129
  --stamp moves the source commit of unchanged items forward.
130
+ memory-hub-mcp routine --mode <dry-run|apply> --user <email> --environment <id> --repos <a/b,...>
131
+ print the JSON body of the weekly sweep cloud routine for those repos
132
+ (only repos with hub items), to create at claude.ai/code/routines.
133
+ [--connections-file <path>] adds connector entries.
113
134
  memory-hub-mcp embed print the embedding of the text on stdin (or the arguments) as JSON;
114
135
  used by the UserPromptSubmit hook. Exits non-zero if it cannot.
115
136
  memory-hub-mcp run the MCP server on stdio (how a host launches it)
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runRoutine = exports.reposWithItems = exports.buildSweepRoutine = exports.sweepPrompt = exports.staggerMinute = exports.ROUTINE_USAGE = exports.ROUTINE_NAME = void 0;
4
+ const crypto_1 = require("crypto");
5
+ const fs_1 = require("fs");
6
+ const client_1 = require("./client");
7
+ const sweep_1 = require("./sweep");
8
+ exports.ROUTINE_NAME = 'Memory hub weekly sweep';
9
+ exports.ROUTINE_USAGE = 'memory-hub-mcp routine --mode <dry-run|apply> --user <email> --environment <id> --repos <owner/name,...> [--connections-file <path>]';
10
+ const HUB_REPO = 'Skedulo/se-ai-memory-hub';
11
+ const TYPES = ['Fact', 'Skill', 'Scenario', 'Wiki'];
12
+ const ALLOWED_TOOLS = ['Bash', 'Read', 'Write', 'Edit', 'Glob', 'Grep', 'Skill'];
13
+ function staggerMinute(user) {
14
+ const digest = (0, crypto_1.createHash)('sha256').update(user.trim().toLowerCase()).digest();
15
+ return digest.readUInt32BE(0) % 60;
16
+ }
17
+ exports.staggerMinute = staggerMinute;
18
+ function sweepPrompt(mode, repos) {
19
+ const args = [mode, ...repos.map((repo) => repo.trim())].join(' ');
20
+ return `Run \`/memory-hub:sweep-knowledge ${args}\`. The repos to sweep are already checked out in the working directory. There is nobody to ask: never ask a question, and report anything that needs an answer in the digest.`;
21
+ }
22
+ exports.sweepPrompt = sweepPrompt;
23
+ function buildSweepRoutine(input) {
24
+ const seen = new Set();
25
+ const sources = [];
26
+ for (const repo of [HUB_REPO, ...input.repos]) {
27
+ const key = repo.trim().toLowerCase();
28
+ if (seen.has(key))
29
+ continue;
30
+ seen.add(key);
31
+ sources.push({ git_repository: { url: `https://github.com/${repo.trim()}` } });
32
+ }
33
+ const swept = input.repos.filter((repo, i) => input.repos.findIndex((r) => r.trim().toLowerCase() === repo.trim().toLowerCase()) === i);
34
+ return {
35
+ name: exports.ROUTINE_NAME,
36
+ cron_expression: `CRON_TZ=${input.timeZone} ${staggerMinute(input.user)} 7 * * 1`,
37
+ enabled: true,
38
+ mcp_connections: input.connections ?? [],
39
+ job_config: {
40
+ ccr: {
41
+ environment_id: input.environmentId,
42
+ session_context: { allowed_tools: ALLOWED_TOOLS, sources },
43
+ events: [
44
+ {
45
+ data: {
46
+ type: 'user',
47
+ uuid: (0, crypto_1.randomUUID)(),
48
+ session_id: '',
49
+ parent_tool_use_id: null,
50
+ message: { role: 'user', content: sweepPrompt(input.mode, swept) },
51
+ },
52
+ },
53
+ ],
54
+ },
55
+ },
56
+ };
57
+ }
58
+ exports.buildSweepRoutine = buildSweepRoutine;
59
+ async function reposWithItems(client, repos) {
60
+ const kept = [];
61
+ for (const repo of repos) {
62
+ for (const type of TYPES) {
63
+ const page = await client.listResources({ type, sourceRepo: repo, offset: 0, limit: 1 });
64
+ if (page.total > 0) {
65
+ kept.push(repo);
66
+ break;
67
+ }
68
+ }
69
+ }
70
+ return kept;
71
+ }
72
+ exports.reposWithItems = reposWithItems;
73
+ function option(argv, name) {
74
+ const index = argv.indexOf(`--${name}`);
75
+ const value = index >= 0 ? argv[index + 1] : undefined;
76
+ return value && !value.startsWith('--') ? value : undefined;
77
+ }
78
+ async function runRoutine(argv, deps) {
79
+ const mode = option(argv, 'mode');
80
+ const user = option(argv, 'user');
81
+ const environmentId = option(argv, 'environment');
82
+ const reposIndex = argv.indexOf('--repos');
83
+ const reposArg = reposIndex >= 0 ? (argv[reposIndex + 1] ?? '') : undefined;
84
+ if (mode !== 'dry-run' && mode !== 'apply') {
85
+ deps.log(`--mode must be dry-run or apply.\n${exports.ROUTINE_USAGE}`);
86
+ return 2;
87
+ }
88
+ if (!user || !environmentId || reposArg === undefined) {
89
+ deps.log(`--user, --environment and --repos are required.\n${exports.ROUTINE_USAGE}`);
90
+ return 2;
91
+ }
92
+ const repos = reposArg
93
+ .split(',')
94
+ .map((repo) => repo.trim())
95
+ .filter(Boolean);
96
+ if (repos.length === 0) {
97
+ deps.log(`--repos needs at least one owner/name.\n${exports.ROUTINE_USAGE}`);
98
+ return 2;
99
+ }
100
+ const bad = repos.find((repo) => !sweep_1.REPO_NAME.test(repo));
101
+ if (bad) {
102
+ deps.log(`--repos must be owner/name entries, got "${bad}".\n${exports.ROUTINE_USAGE}`);
103
+ return 2;
104
+ }
105
+ let connections;
106
+ const connectionsFile = option(argv, 'connections-file');
107
+ if (connectionsFile) {
108
+ try {
109
+ const parsed = JSON.parse((0, fs_1.readFileSync)(connectionsFile, 'utf8'));
110
+ if (!Array.isArray(parsed))
111
+ throw new Error('not a JSON array');
112
+ connections = parsed;
113
+ }
114
+ catch (error) {
115
+ deps.log(`Cannot read --connections-file ${connectionsFile}: ${error instanceof Error ? error.message : String(error)}`);
116
+ return 2;
117
+ }
118
+ }
119
+ const apiToken = deps.env.MEMORY_HUB_MCP_TOKEN;
120
+ if (!apiToken) {
121
+ deps.log('MEMORY_HUB_MCP_TOKEN is not set. Run `npx -y @skedulo/memory-hub-mcp setup` first.');
122
+ return 1;
123
+ }
124
+ const baseUrl = deps.env.MEMORY_HUB_FUNCTION_URL || deps.functionUrl();
125
+ const client = (deps.makeClient ?? ((config) => new client_1.MemoryHubClient(config)))({ baseUrl, apiToken });
126
+ const candidates = repos.filter((repo) => repo.toLowerCase() !== HUB_REPO.toLowerCase());
127
+ const withItems = await reposWithItems(client, candidates);
128
+ if (withItems.length === 0) {
129
+ deps.log('None of the repos has items in the hub, so there is nothing to sweep.');
130
+ return 2;
131
+ }
132
+ const body = buildSweepRoutine({ mode, timeZone: deps.timeZone() || 'UTC', user, repos: withItems, environmentId, connections });
133
+ deps.log(JSON.stringify(body, null, 2));
134
+ return 0;
135
+ }
136
+ exports.runRoutine = runRoutine;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skedulo/memory-hub-mcp",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
4
4
  "description": "MCP server for the 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
@@ -95,10 +95,9 @@ list is prose, kept in sync by hand.
95
95
  developer prefers to work emerged this session (a standing preference, a
96
96
  recurring decision pattern). Pass only the field(s) that changed
97
97
  (`preferences`, `decisions`, `patterns`) — **this replaces each field's
98
- content entirely, it does not append.** There is currently no way to read
99
- back the persona's existing content before overwriting it, so treat each
100
- field you touch as a full replacement — don't assume you can merge with
101
- what's already there.
98
+ content entirely, it does not append.** To add to a field, read its
99
+ current text from `memory_sessionContext`'s `persona` and pass back the
100
+ whole text with your change.
102
101
  - **`type: 'Wiki'`** — a standing reference, not a one-off decision:
103
102
  "how the deploy pipeline works," "what each config variable does," "the
104
103
  object model's relationships" — or a whole project document: an SOW, a
@@ -551,6 +550,10 @@ Before relying on a stale item, verify, then flag, then fix:
551
550
  Rules:
552
551
 
553
552
  - At most three fixes per task. Flag the rest to the developer.
553
+ - A status note is not a fix: one dated line added at the top of a memory that says where a ticket
554
+ or PR now stands and where that was seen (`UPDATE <date> (GitHub): PR #123 closed without
555
+ merging`), the rest left as it is. At most five status notes per task, under the same rules on
556
+ who may edit what. Flag the rest.
554
557
  - `source.commit` only moves forward: only when `git merge-base --is-ancestor <old> <new>` passes,
555
558
  and never onto an unmerged commit. When `target` is `HEAD` (no `origin/<default>` to compare
556
559
  with), never move `source`; flag it instead.