memorydetective 1.3.0 → 1.3.1

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/CHANGELOG.md CHANGED
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.3.1] — 2026-05-01
10
+
11
+ ### Added
12
+
13
+ - USAGE.md: new section 6 "Pipeline awareness" documenting `suggestedNextCalls` (with a full JSON example), `getInvestigationPlaybook` (with the five playbook kinds), and the tool-description tag taxonomy. Establishes the workflow norm: every release ships with USAGE updates.
14
+ - USAGE.md section 4: row for `getInvestigationPlaybook` added at the top of the follow-up requests table.
15
+ - README API section: opening paragraph documents the namespace tags + `suggestedNextCalls` mechanism.
16
+
17
+ ### Changed
18
+
19
+ - No code changes from `1.3.0` — this is a documentation catch-up release.
20
+
9
21
  ## [1.3.0] — 2026-05-01
10
22
 
11
23
  Pipeline-aware release. Addresses real-user feedback that the Swift tools were "an attachment" rather than part of the investigation chain. **Discovery is now data, not inference.** 25 → 26 tools.
@@ -160,7 +172,8 @@ When called with no arguments it starts the MCP server over stdio.
160
172
  - **`captureMemgraph`** does not work on physical iOS devices — `leaks(1)` only attaches to processes on the local Mac (which includes iOS simulators). Memory Graph capture from a physical device still requires Xcode.
161
173
  - **`detectLeaksInXCUITest`** is flagged experimental: orchestration logic is implemented but not yet validated against a wide set of production XCUITest runs.
162
174
 
163
- [Unreleased]: https://github.com/carloshpdoc/memorydetective/compare/v1.3.0...HEAD
175
+ [Unreleased]: https://github.com/carloshpdoc/memorydetective/compare/v1.3.1...HEAD
176
+ [1.3.1]: https://github.com/carloshpdoc/memorydetective/compare/v1.3.0...v1.3.1
164
177
  [1.3.0]: https://github.com/carloshpdoc/memorydetective/compare/v1.2.1...v1.3.0
165
178
  [1.2.1]: https://github.com/carloshpdoc/memorydetective/compare/v1.2.0...v1.2.1
166
179
  [1.2.0]: https://github.com/carloshpdoc/memorydetective/compare/v1.1.0...v1.2.0
package/USAGE.md CHANGED
@@ -210,6 +210,7 @@ Once you have the diagnosis, here are useful follow-up prompts you can paste int
210
210
 
211
211
  | Prompt | What Claude calls |
212
212
  |---|---|
213
+ | "I want to investigate a memgraph leak — what's the canonical sequence?" | `getInvestigationPlaybook({ kind: "memgraph-leak" })` — returns the 6-step pipeline with `argsTemplate` for each tool. |
213
214
  | "How many `DetailViewModel` instances are leaking?" | `countAlive(path, className: "DetailViewModel")` |
214
215
  | "How many `NSURLSessionConfiguration`s are *inside* the cycle rooted at `DetailViewModel`?" | `reachableFromCycle(path, rootClassName: "DetailViewModel", className: "NSURLSessionConfiguration")` |
215
216
  | "Show the retain chain that keeps `DetailViewModel` alive." | `findRetainers(path, className: "DetailViewModel")` |
@@ -268,7 +269,96 @@ The app process exited before `leaks --outputGraph` could attach. Configure your
268
269
 
269
270
  ---
270
271
 
271
- ## 6. Where to go from here
272
+ ## 6. Pipeline awareness (suggestedNextCalls + playbooks)
273
+
274
+ Discovery is data, not inference. As of v1.3, the tools that matter most return a `suggestedNextCalls` field with pre-populated arguments and a one-sentence rationale per entry. The orchestrating agent can chain calls without re-reasoning over the result.
275
+
276
+ ### `suggestedNextCalls` — example from `classifyCycle`
277
+
278
+ ```jsonc
279
+ {
280
+ "ok": true,
281
+ "totalCycles": 4,
282
+ "classified": [ /* ... */ ],
283
+ "suggestedNextCalls": [
284
+ {
285
+ "tool": "swiftSearchPattern",
286
+ "args": {
287
+ "pattern": "\\.tag\\(",
288
+ "filePath": "<set to a candidate Swift file in your project>"
289
+ },
290
+ "why": "Locate the code construct implicated by swiftui.tag-index-projection. The regex matches the SwiftUI signal that produces this cycle."
291
+ },
292
+ {
293
+ "tool": "swiftGetSymbolDefinition",
294
+ "args": {
295
+ "symbolName": "DetailViewModel",
296
+ "candidatePaths": ["<set to a Sources/ or app target directory>"]
297
+ },
298
+ "why": "Jump to the declaration of DetailViewModel, the user-defined type captured in this cycle."
299
+ }
300
+ ]
301
+ }
302
+ ```
303
+
304
+ The agent reads `suggestedNextCalls`, fills in the `<...>` placeholders from project context, and chains. No re-reasoning required.
305
+
306
+ ### `getInvestigationPlaybook` — start here for a fresh investigation
307
+
308
+ For agents that haven't seen the project before, ask for the canonical pipeline first:
309
+
310
+ ```jsonc
311
+ {
312
+ "tool": "getInvestigationPlaybook",
313
+ "args": { "kind": "memgraph-leak" }
314
+ }
315
+ ```
316
+
317
+ Returns a 6-step sequence with `argsTemplate` per step:
318
+
319
+ ```jsonc
320
+ {
321
+ "kind": "memgraph-leak",
322
+ "summary": "Diagnose a SwiftUI / Combine retain cycle from a `.memgraph` snapshot, locate the offending code, and propose a fix.",
323
+ "steps": [
324
+ { "step": 1, "tool": "analyzeMemgraph", "purpose": "..." },
325
+ { "step": 2, "tool": "classifyCycle", "purpose": "..." },
326
+ { "step": 3, "tool": "reachableFromCycle", "purpose": "..." },
327
+ { "step": 4, "tool": "swiftSearchPattern", "purpose": "..." },
328
+ { "step": 5, "tool": "swiftGetSymbolDefinition", "purpose": "..." },
329
+ { "step": 6, "tool": "swiftFindSymbolReferences", "purpose": "..." }
330
+ ]
331
+ }
332
+ ```
333
+
334
+ Five playbooks ship in v1.3:
335
+
336
+ | Kind | Use when |
337
+ |---|---|
338
+ | `memgraph-leak` | You have a `.memgraph` and want to find + fix a retain cycle |
339
+ | `perf-hangs` | App feels slow; suspect main-thread blocking |
340
+ | `ui-jank` | Animations drop frames |
341
+ | `app-launch-slow` | Cold-start time is over budget |
342
+ | `verify-fix` | Confirm a fix actually resolved the cycle |
343
+
344
+ ### Tool description tags
345
+
346
+ Every tool description starts with a category tag so related tools are visible as a group:
347
+
348
+ | Tag | What |
349
+ |---|---|
350
+ | `[mg.memory]` | memgraph parsing, cycle classification, retainer chains |
351
+ | `[mg.trace]` | xctrace schemas (hangs, allocations, app-launch, animation hitches, time-profile) |
352
+ | `[mg.code]` | Swift source bridging via SourceKit-LSP |
353
+ | `[mg.log]` | macOS unified logging (`log show` / `log stream`) |
354
+ | `[mg.discover]` | xctrace device + template listing |
355
+ | `[mg.render]` | Cycle visualization (Mermaid + Graphviz) |
356
+ | `[mg.ci]` | XCUITest leak detection |
357
+ | `[meta]` | Pipeline-discovery tools like `getInvestigationPlaybook` |
358
+
359
+ The tag is leading text in the MCP description, so it shows up in any tools/list output and inside Claude Code's "deferred tools" list.
360
+
361
+ ## 7. Where to go from here
272
362
 
273
363
  - **Add a new cycle pattern**: see the *Adding a cycle pattern to `classifyCycle`* section in [`README.md`](./README.md#contributing).
274
364
  - **Run a custom analysis from scratch**: every tool's input schema is documented via the MCP `tools/list` request. Hit the server with `{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}` over stdio.
package/dist/cli.js CHANGED
@@ -25,7 +25,7 @@ const C = {
25
25
  cyan: "\x1b[36m",
26
26
  gray: "\x1b[90m",
27
27
  };
28
- const VERSION = "1.3.0";
28
+ const VERSION = "1.3.1";
29
29
  const HELP = `${C.bold}memorydetective${C.reset} — iOS leak hunting from the CLI
30
30
 
31
31
  ${C.dim}Usage:${C.reset}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memorydetective",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "MCP server for iOS leak hunting and performance investigation. Reads .memgraph + .trace files, captures new ones via xctrace and leaks(1), classifies retain cycles.",
5
5
  "type": "module",
6
6
  "bin": {