memtrace-skills 0.7.10

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.
Files changed (97) hide show
  1. package/dist/commands/doctor.d.ts +16 -0
  2. package/dist/commands/doctor.js +199 -0
  3. package/dist/commands/enterprise-install.d.ts +7 -0
  4. package/dist/commands/enterprise-install.js +129 -0
  5. package/dist/commands/install.d.ts +9 -0
  6. package/dist/commands/install.js +104 -0
  7. package/dist/commands/picker.d.ts +6 -0
  8. package/dist/commands/picker.js +22 -0
  9. package/dist/commands/rail-install.d.ts +7 -0
  10. package/dist/commands/rail-install.js +37 -0
  11. package/dist/fs-safe.d.ts +21 -0
  12. package/dist/fs-safe.js +35 -0
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.js +87 -0
  15. package/dist/rail-install.d.ts +20 -0
  16. package/dist/rail-install.js +183 -0
  17. package/dist/skills.d.ts +17 -0
  18. package/dist/skills.js +64 -0
  19. package/dist/transformers/claude.d.ts +71 -0
  20. package/dist/transformers/claude.js +702 -0
  21. package/dist/transformers/codex.d.ts +8 -0
  22. package/dist/transformers/codex.js +294 -0
  23. package/dist/transformers/cursor.d.ts +7 -0
  24. package/dist/transformers/cursor.js +124 -0
  25. package/dist/transformers/gemini.d.ts +3 -0
  26. package/dist/transformers/gemini.js +78 -0
  27. package/dist/transformers/hermes.d.ts +5 -0
  28. package/dist/transformers/hermes.js +136 -0
  29. package/dist/transformers/index.d.ts +14 -0
  30. package/dist/transformers/index.js +24 -0
  31. package/dist/transformers/kiro.d.ts +2 -0
  32. package/dist/transformers/kiro.js +69 -0
  33. package/dist/transformers/opencode.d.ts +2 -0
  34. package/dist/transformers/opencode.js +77 -0
  35. package/dist/transformers/rail-hooks.d.ts +56 -0
  36. package/dist/transformers/rail-hooks.js +303 -0
  37. package/dist/transformers/shared.d.ts +18 -0
  38. package/dist/transformers/shared.js +129 -0
  39. package/dist/transformers/types.d.ts +40 -0
  40. package/dist/transformers/types.js +1 -0
  41. package/dist/transformers/vscode.d.ts +3 -0
  42. package/dist/transformers/vscode.js +53 -0
  43. package/dist/transformers/windsurf.d.ts +3 -0
  44. package/dist/transformers/windsurf.js +43 -0
  45. package/dist/utils.d.ts +5 -0
  46. package/dist/utils.js +22 -0
  47. package/package.json +50 -0
  48. package/plugins/memtrace-skills/.claude-plugin/plugin.json +23 -0
  49. package/plugins/memtrace-skills/references/mcp-parameters.md +302 -0
  50. package/plugins/memtrace-skills/skills/memtrace-api-topology/SKILL.md +58 -0
  51. package/plugins/memtrace-skills/skills/memtrace-change-impact-analysis/SKILL.md +75 -0
  52. package/plugins/memtrace-skills/skills/memtrace-cochange/SKILL.md +71 -0
  53. package/plugins/memtrace-skills/skills/memtrace-code-review/SKILL.md +41 -0
  54. package/plugins/memtrace-skills/skills/memtrace-codebase-exploration/SKILL.md +94 -0
  55. package/plugins/memtrace-skills/skills/memtrace-continuous-memory/SKILL.md +96 -0
  56. package/plugins/memtrace-skills/skills/memtrace-episode-replay/SKILL.md +94 -0
  57. package/plugins/memtrace-skills/skills/memtrace-evolution/SKILL.md +128 -0
  58. package/plugins/memtrace-skills/skills/memtrace-first/SKILL.md +194 -0
  59. package/plugins/memtrace-skills/skills/memtrace-fleet-coordination/SKILL.md +80 -0
  60. package/plugins/memtrace-skills/skills/memtrace-fleet-first/SKILL.md +125 -0
  61. package/plugins/memtrace-skills/skills/memtrace-fleet-publish-intent/SKILL.md +48 -0
  62. package/plugins/memtrace-skills/skills/memtrace-fleet-record-episode/SKILL.md +44 -0
  63. package/plugins/memtrace-skills/skills/memtrace-fleet-resolve/SKILL.md +54 -0
  64. package/plugins/memtrace-skills/skills/memtrace-graph/SKILL.md +67 -0
  65. package/plugins/memtrace-skills/skills/memtrace-impact/SKILL.md +58 -0
  66. package/plugins/memtrace-skills/skills/memtrace-incident-investigation/SKILL.md +112 -0
  67. package/plugins/memtrace-skills/skills/memtrace-index/SKILL.md +65 -0
  68. package/plugins/memtrace-skills/skills/memtrace-quality/SKILL.md +63 -0
  69. package/plugins/memtrace-skills/skills/memtrace-refactoring-guide/SKILL.md +103 -0
  70. package/plugins/memtrace-skills/skills/memtrace-relationships/SKILL.md +67 -0
  71. package/plugins/memtrace-skills/skills/memtrace-search/SKILL.md +93 -0
  72. package/plugins/memtrace-skills/skills/memtrace-session-continuity/SKILL.md +93 -0
  73. package/plugins/memtrace-skills/skills/memtrace-style-fingerprint/SKILL.md +105 -0
  74. package/skills/commands/memtrace-api-topology.md +65 -0
  75. package/skills/commands/memtrace-cochange.md +76 -0
  76. package/skills/commands/memtrace-evolution.md +135 -0
  77. package/skills/commands/memtrace-fleet-publish-intent.md +51 -0
  78. package/skills/commands/memtrace-fleet-record-episode.md +48 -0
  79. package/skills/commands/memtrace-fleet-resolve.md +59 -0
  80. package/skills/commands/memtrace-graph.md +75 -0
  81. package/skills/commands/memtrace-impact.md +64 -0
  82. package/skills/commands/memtrace-index.md +71 -0
  83. package/skills/commands/memtrace-quality.md +69 -0
  84. package/skills/commands/memtrace-relationships.md +73 -0
  85. package/skills/commands/memtrace-search.md +93 -0
  86. package/skills/workflows/memtrace-change-impact-analysis.md +85 -0
  87. package/skills/workflows/memtrace-code-review.md +48 -0
  88. package/skills/workflows/memtrace-codebase-exploration.md +108 -0
  89. package/skills/workflows/memtrace-continuous-memory.md +104 -0
  90. package/skills/workflows/memtrace-episode-replay.md +100 -0
  91. package/skills/workflows/memtrace-first.md +194 -0
  92. package/skills/workflows/memtrace-fleet-coordination.md +87 -0
  93. package/skills/workflows/memtrace-fleet-first.md +132 -0
  94. package/skills/workflows/memtrace-incident-investigation.md +125 -0
  95. package/skills/workflows/memtrace-refactoring-guide.md +116 -0
  96. package/skills/workflows/memtrace-session-continuity.md +98 -0
  97. package/skills/workflows/memtrace-style-fingerprint.md +111 -0
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: memtrace-style-fingerprint
3
+ description: "Always use before writing or editing source code in an indexed repo when choosing between competing idioms (ternary vs if-else, arrow vs function declaration, const vs let, await vs .then, early-return vs nested-return). Pull the codebase's empirical style norm from Memtrace and match it instead of re-deriving style from training priors. Do not maintain a markdown style guide for the project; the fingerprint is sampled live from the actual code."
4
+ ---
5
+
6
+ ## Overview
7
+
8
+ Every indexed Memtrace repository carries an empirical **style fingerprint** — descriptive histograms of competing AST idioms (ternary vs if-else, arrow vs function declaration, const vs let, await vs `.then`, early-return vs nested-return depth) computed at parse time and rolled up to Repository + Community level. This workflow tells you when and how to consult it so your edits match the codebase's existing idioms instead of drifting on stylistic choices the linter doesn't catch.
9
+
10
+ The fingerprint is **descriptive, not prescriptive**. It reports what the codebase actually does, not what a style guide says it should do. If the codebase deviates from a popular convention for some reason, the fingerprint captures the deviation and you should match the deviation — that's the whole point. For prescriptive bug/security/perf rules, use `find_code_review_issues` instead.
11
+
12
+ ## When to use this workflow
13
+
14
+ | Situation | Action |
15
+ |---|---|
16
+ | About to write new code (function, component, module) in an indexed repo | Step 1 + Step 2 with `file_path=<the file you'll create>` |
17
+ | About to edit an existing file | Step 1 + Step 2 with `file_path=<that file>` |
18
+ | Asked "what's the convention here for X?" | Step 1 only — repo-mode fingerprint answers it |
19
+ | Deciding between two equivalent idioms (ternary vs if, arrow vs fn-decl, await vs then) | Step 2 with `file_path` — `delta_from_codebase_norm` tells you which idiom matches the norm |
20
+ | Reviewing a diff | Step 2 on each modified file — flag any new idioms that diverge from the file's language norm |
21
+ | Session start in a multi-day project | Read the `style:` line in `get_codebase_briefing` (auto-included) |
22
+
23
+ If the repo is not indexed in Memtrace, this workflow does not apply — fall back to your default behavior.
24
+
25
+ ## Steps
26
+
27
+ ### 1. Get the codebase's overall norm
28
+
29
+ Call `get_style_fingerprint(repo_id)` with no `file_path`. The response includes:
30
+
31
+ - `histogram` — raw counts (e.g. `ternary_count: 1005, if_stmt_count: 8087`)
32
+ - `ratios` — computed shares for each competing pair (e.g. `ternary_share: 0.11`)
33
+ - `dominant_idioms` — top-3 dimensions sorted by `|ratio - 0.5|` (strongest preferences first), each with a `dimension`, `ratio`, and human-readable `interpretation`
34
+ - `function_count` — sample size at the repo level
35
+ - `sample_threshold` — minimum observations before a ratio is committed (currently 20)
36
+
37
+ A `ratio` of `null` means the codebase doesn't have enough observations for that dimension to commit a norm — treat it as "no signal", do not assume one.
38
+
39
+ ### 2. Get the file's deviation from the norm (when about to edit a specific file)
40
+
41
+ Call `get_style_fingerprint(repo_id, file_path=<file>)`. The response adds:
42
+
43
+ - `file_fingerprint` — the same shape as `histogram`/`ratios`/`function_count` but computed over just the functions in that file
44
+ - `codebase_fingerprint` — repo aggregate for comparison
45
+ - `delta_from_codebase_norm` — array of dimensions where the file diverges ≥0.15 from the codebase, sorted by absolute delta, capped at top 5. Each entry has `dimension`, `file_ratio`, `codebase_ratio`, `abs_delta`, and a `note` describing the direction
46
+
47
+ **Match the file's `language_fingerprint`, not the repo aggregate.** In file mode the response carries `language` (the file's language), `language_fingerprint` (that language's slice — the primary comparator), and `delta_from_language_norm` (divergence vs the language, not the repo). Per-language slicing prevents cross-applying Python norms to JS code or vice versa — read the `language_fingerprint`. (`delta_from_codebase_norm` is retained as a deprecated alias and is removed in 0.5.14.)
48
+
49
+ If `delta_from_language_norm` is empty, the file is already aligned — proceed without style adjustments. If it has entries, your edits should not amplify the divergence (e.g. don't add more ternaries to a file that's already above the language's ternary norm).
50
+
51
+ ### 3. Read the briefing line at session start (passive)
52
+
53
+ `get_codebase_briefing(repo_id)` auto-includes a `style:` line in its summary when the sample threshold is met and at least one ratio is outside the 0.4..0.6 no-preference band. Format:
54
+
55
+ ```
56
+ style: <interpretation 1> (<%>); <interpretation 2> (<%>); <interpretation 3> (<%>)
57
+ ```
58
+
59
+ Example on a TS/JS-heavy codebase:
60
+
61
+ ```
62
+ style: strongly prefers arrow functions (98%); strongly prefers async/await over .then chains (88%); strongly prefers const over let (94%)
63
+ ```
64
+
65
+ You should already be reading the briefing at session start (per `memtrace-codebase-exploration`). The `style:` line lands in your context for free — no extra call needed.
66
+
67
+ ## Decision points
68
+
69
+ | Condition | Action |
70
+ |---|---|
71
+ | `dominant_idioms[0].ratio >= 0.85` or `<= 0.15` | Treat as a hard preference — match it unless there's a specific structural reason not to |
72
+ | `dominant_idioms[0].ratio` in `0.65..0.85` or `0.15..0.35` | Treat as a soft preference — match it for new code, leave existing patterns alone |
73
+ | `ratio` in `0.4..0.6` | No clear preference — use your own judgment, match local file context |
74
+ | `ratio` is `null` (below sample threshold) | No signal — don't assume a norm; pick the idiom that fits the immediate context |
75
+ | `delta_from_codebase_norm` shows your target file already diverges from the norm | Don't amplify the divergence with your edits — match the codebase, not the outlier file |
76
+ | `file_fingerprint` is empty (file has no functions yet, or is a config file) | Use the language slice or repo aggregate; this is creation territory |
77
+
78
+ ## Anti-patterns — do not do these
79
+
80
+ - **Reading the repo aggregate when editing a single-language file.** If the codebase is 70% TS / 30% Python, the repo aggregate mixes both. The `language_fingerprint` (when available) or `codebase_fingerprint.ratios` filtered by the file's language is what you should match. Cross-applying TS norms to a Python file is the failure mode this whole tool exists to prevent.
81
+ - **Treating the fingerprint as prescriptive.** It tells you what the codebase does. If the codebase consistently does something unusual, match that — don't override with "this isn't best practice" arguments. The whole point is to stop drifting from the codebase's own choices.
82
+ - **Calling `get_style_fingerprint` for every line of code.** Once per file at the start of an edit session is enough. The norm doesn't change between your edits within the same session.
83
+ - **Ignoring the briefing line.** It auto-loads into your context. If you act on style choices in an edit session without reading it first, you're spending tool calls to re-derive something you already had.
84
+ - **Adding a markdown style guide to the project.** The fingerprint is the style guide. It refreshes on every reindex. A markdown file would either duplicate it or contradict it.
85
+
86
+ ## Naming-case dimensions (shipped in 0.5.13)
87
+
88
+ Beyond the AST idioms, the fingerprint also reports identifier **naming-case** per scope, across all 13 source languages:
89
+
90
+ - **Variables / functions / types / constants / files** — the share of camelCase / snake_case / PascalCase / SCREAMING_SNAKE / kebab. Read e.g. `ratios.naming_variables_snake_share` or the `dominant_idioms` entry that names the scope's winning case ("vars are snake_case (89%)").
91
+ - **Config keys** for YAML / JSON / TOML / HCL / SQL — `ratios.config_keys_*_share`.
92
+ - **Enforcement-aware:** languages that compiler-enforce a scope return `null` for it (Rust vars/fns/types/consts, Ruby constants). A `null` there means "the compiler decides, not the codebase" — don't try to match a non-signal.
93
+ - **Go** reports `go_exported_share` (PascalCase = exported) instead of per-case naming, because case encodes visibility in Go.
94
+
95
+ When editing, match the naming case the file's `language_fingerprint` reports for the scope you're touching — same per-language rule as the idiom dimensions.
96
+
97
+ ## What this workflow does NOT cover
98
+
99
+ - **Security / bug / performance rules** — use `find_code_review_issues` (prescriptive deterministic review).
100
+ - **Comment / docstring style** — not in scope; use file-local examples.
101
+ - **Architecture / module-organization decisions** — see `memtrace-codebase-exploration` and `memtrace-refactoring-guide`.
102
+
103
+ ## Why this exists
104
+
105
+ Without this workflow, LLM editors drift session-to-session on style choices that aren't enforced by linters — one session uses ternaries, the next doesn't; one uses arrow functions, the next uses `function`. The fix isn't a manually-maintained style guide (stale by week 2). The fix is sampling the codebase's actual idioms at parse time and reading them before each edit. The fingerprint is computed in the same parse pass as cyclomatic + cognitive complexity at sub-1% overhead, so the cost of providing the answer is near zero.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: memtrace-api-topology
3
+ description: "Always use for API endpoint, HTTP route, fetch/client call, REST surface, service dependency, cross-repo dependency, or API topology questions in source code. Do not use Grep, Glob, rg, find, or manual file search for routes or HTTP calls; Memtrace maps endpoints and call edges from the indexed AST graph."
4
+ allowed-tools:
5
+ - mcp__memtrace__get_api_topology
6
+ - mcp__memtrace__find_api_endpoints
7
+ - mcp__memtrace__find_api_calls
8
+ - mcp__memtrace__get_symbol_context
9
+ - mcp__memtrace__link_repositories
10
+ user-invocable: true
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ Map the HTTP API surface of a codebase — exposed endpoints, outbound HTTP calls, and cross-repo service-to-service dependency graphs. Supports auto-detection for Express, Encore, NestJS, Axum, FastAPI, Flask, Gin, Spring Boot, and more.
16
+
17
+ ## Quick Reference
18
+
19
+ | Tool | Purpose |
20
+ |------|---------|
21
+ | `find_api_endpoints` | All exposed HTTP endpoints (GET /users, POST /orders, etc.) |
22
+ | `find_api_calls` | All outbound HTTP calls (fetch, axios, reqwest, etc.) |
23
+ | `get_api_topology` | Cross-repo call graph: which service calls which endpoint |
24
+ | `link_repositories` | Manually link repos for cross-repo edge detection |
25
+
26
+ > **Parameter types:** MCP parameters are strictly typed. Numbers (`limit`, `depth`, `min_size`, `last_n`, etc.) must be JSON numbers — not strings. Use `limit: 20`, never `limit: "20"`. Passing a string yields `MCP error -32602: invalid type: string, expected usize`.
27
+
28
+
29
+ ## Steps
30
+
31
+ ### 1. Discover endpoints
32
+
33
+ Use `find_api_endpoints`:
34
+ - `repo_id` — required
35
+ - Returns: method, path, handler function, framework detected
36
+
37
+ ### 2. Discover outbound calls
38
+
39
+ Use `find_api_calls`:
40
+ - `repo_id` — required
41
+ - Returns: target URL/path, HTTP method, calling function, library used (fetch, axios, reqwest, etc.)
42
+
43
+ ### 3. Map service topology
44
+
45
+ Use `get_api_topology` to see the cross-repo HTTP call graph:
46
+ - Which services call which endpoints
47
+ - Confidence scores for each detected link
48
+ - Service-to-service dependency direction
49
+
50
+ **Prerequisite:** Multiple repos must be indexed. If cross-repo links aren't appearing, use `link_repositories` to explicitly connect them.
51
+
52
+ ### 4. Deep-dive into an endpoint
53
+
54
+ For any specific endpoint, use `get_symbol_context` with the endpoint's symbol ID to see:
55
+ - Which internal functions handle the request
56
+ - Which processes (execution flows) include this endpoint
57
+ - Which external services call this endpoint
58
+
59
+ ## Common Mistakes
60
+
61
+ | Mistake | Reality |
62
+ |---------|---------|
63
+ | Expecting cross-repo links with only one repo indexed | Index ALL related services first; cross-repo HTTP edges are linked automatically after indexing |
64
+ | Missing endpoints from custom frameworks | Memtrace auto-detects major frameworks; for custom routers, the endpoints may appear as regular functions |
65
+ | Not using `link_repositories` | If auto-linking missed a connection, use this to manually establish cross-repo edges |
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: memtrace-cochange
3
+ description: "Always use for historical coupling, co-change, what changes with this, hidden dependency, or what else needs to move questions for source code. Do not use git log, git diff, Grep, or manual file search to correlate changes; Memtrace queries co-change and temporal graph data directly."
4
+ allowed-tools:
5
+ - mcp__memtrace__get_cochange_context
6
+ - mcp__memtrace__find_symbol
7
+ - mcp__memtrace__get_impact
8
+ user-invocable: true
9
+ ---
10
+
11
+ ## Overview
12
+
13
+ Find symbols that historically co-change with a target symbol — ranked by co-occurrence frequency across all episodes. This surfaces **behavioral coupling** that the static call graph cannot see.
14
+
15
+ `get_impact` answers "who calls this?" (structural).
16
+ `get_cochange_context` answers "what always moves when this moves?" (historical).
17
+
18
+ They are complementary. A symbol with no direct callers can still have strong cochange partners if it's always modified alongside another in every commit.
19
+
20
+ > **Parameter types:** MCP parameters are strictly typed. Numbers (`limit`, `depth`, `min_size`, `last_n`, etc.) must be JSON numbers — not strings. Use `limit: 20`, never `limit: "20"`. Passing a string yields `MCP error -32602: invalid type: string, expected usize`.
21
+
22
+
23
+ ## Steps
24
+
25
+ ### 1. Identify the target symbol
26
+
27
+ Use `find_symbol` if you need the exact name. The tool matches by `name` field.
28
+
29
+ ### 2. Call `get_cochange_context`
30
+
31
+ ```
32
+ get_cochange_context(
33
+ repo_id: "...",
34
+ symbol: "execute", // exact symbol name
35
+ limit: 20 // default 20, increase for broader view
36
+ )
37
+ ```
38
+
39
+ ### 3. Interpret results
40
+
41
+ The response contains `cochanges[]`, each with:
42
+ - `name` — symbol name
43
+ - `kind` — Function / Method / Class / Struct
44
+ - `file_path` — where it lives
45
+ - `cochange_count` — how many episodes it shared with the target
46
+
47
+ ```
48
+ High cochange_count = strong historical coupling
49
+ → If you modify the target, you will likely need to touch this too
50
+ → Or it may be the real root cause you should investigate first
51
+ ```
52
+
53
+ ### 4. Cross-reference with call graph
54
+
55
+ For the top cochange partners, optionally run `get_impact` to see if the coupling is also structural:
56
+
57
+ | Structural coupling | Historical coupling | Interpretation |
58
+ |---|---|---|
59
+ | Yes | Yes | Core architectural dependency — highest risk |
60
+ | No | Yes | Hidden coupling — only visible through history |
61
+ | Yes | No | Called frequently but changed independently — lower risk |
62
+
63
+ ## When to Use
64
+
65
+ - **Before modifying a symbol** — get blast awareness beyond what `get_impact` shows
66
+ - **Incident investigation** — when `get_impact` doesn't explain the blast radius, check cochange history
67
+ - **Code review** — verify that a PR touched all historically-coupled partners
68
+ - **Refactoring** — discover implicit coupling before extracting a module
69
+
70
+ ## Common Mistakes
71
+
72
+ | Mistake | Reality |
73
+ |---------|---------|
74
+ | Only using `get_impact` for blast radius | Structural coupling misses behavioral coupling — always pair with cochange |
75
+ | Ignoring low-`in_degree` cochange partners | A rarely-called utility with high cochange_count is a strong coupling signal |
76
+ | Using cochange as a dependency map | It's not a dependency graph — it's a change correlation. Two symbols can cochange without any direct relationship. |
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: memtrace-evolution
3
+ description: "Always use for source-code change history, recent modifications, what changed since a date, symbol timeline, evolution, unexpected changes, or incident timeline questions. Do not use git log, git diff, Grep, or manual file search to reconstruct history; Memtrace has symbol-level temporal memory."
4
+ allowed-tools:
5
+ - mcp__memtrace__get_evolution
6
+ - mcp__memtrace__get_timeline
7
+ - mcp__memtrace__detect_changes
8
+ - mcp__memtrace__list_indexed_repositories
9
+ - mcp__memtrace__get_changes_since
10
+ user-invocable: true
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ Multi-mode temporal analysis engine that answers "what changed and why should I care?" across arbitrary time windows. Uses Structural Significance Budgeting (SSB) to surface the most important changes without overwhelming you with noise.
16
+
17
+ This is memtrace's most powerful analytical tool. It implements six distinct scoring algorithms — choose the right one based on what the user needs.
18
+
19
+ ## Query Modes — Choose the Right Algorithm
20
+
21
+ | Mode | Algorithm | Best For |
22
+ |------|-----------|----------|
23
+ | `compound` | Rank-fusion: 0.50×impact + 0.35×novel + 0.15×recent | **Default.** General-purpose "what changed?" — use when unsure |
24
+ | `impact` | Structural Significance: `sig(n) = in_degree^0.7 × (1 + out_degree)^0.3` | "What broke?" — finds changes with the largest blast radius |
25
+ | `novel` | Change Surprise Index: `surprise(n) = (1 + in_degree) / (1 + change_freq_90d)` | "What's unexpected?" — anomaly detection for rarely-changing code |
26
+ | `recent` | Temporal Proximity: `impact × exp(−0.5 × Δhours)` | "What changed near the incident?" — time-weighted for root cause |
27
+ | `directional` | Asymmetric scoring (added→out_degree, removed→in_degree, modified→impact) | "What was added vs removed?" — structural change direction |
28
+ | `overview` | Fast module-level rollup only | Quick summary — no per-symbol scoring, just module counts |
29
+
30
+ > **Parameter types:** MCP parameters are strictly typed. Numbers (`limit`, `depth`, `min_size`, `last_n`, etc.) must be JSON numbers — not strings. Use `limit: 20`, never `limit: "20"`. Passing a string yields `MCP error -32602: invalid type: string, expected usize`.
31
+
32
+
33
+ ## Steps
34
+
35
+ ### 1. Determine the time window
36
+
37
+ Ask the user or infer:
38
+ - `from` — ISO-8601 start timestamp (required)
39
+ - `to` — ISO-8601 end timestamp (defaults to now)
40
+ - `repo_id` — scope to a repo (call `list_indexed_repositories` if unknown)
41
+
42
+ ### 2. Choose the mode
43
+
44
+ **Decision tree:**
45
+
46
+ ```
47
+ User wants to know...
48
+ ├── "what changed?" → compound (default)
49
+ ├── "what could have broken?" → impact
50
+ ├── "anything unexpected?" → novel
51
+ ├── "what changed near X?" → recent (set to to incident time)
52
+ ├── "what was added/removed?" → directional
53
+ └── "quick summary?" → overview
54
+ ```
55
+
56
+ ### 3. Execute the query
57
+
58
+ Use the `get_evolution` MCP tool with:
59
+ - `repo_id` — required
60
+ - `from` / `to` — the time window
61
+ - `mode` — one of: compound, impact, novel, recent, directional, overview
62
+
63
+ ### 4. Interpret results
64
+
65
+ The response contains:
66
+
67
+ - **`added[]`** — new symbols that appeared in the time window
68
+ - **`removed[]`** — symbols that were deleted
69
+ - **`modified[]`** — symbols that changed
70
+ - **`by_module[]`** — module-level rollup (NEVER truncated — always shows all modules)
71
+ - **`significance_coverage`** — fraction of total significance captured (target: ≥0.80)
72
+ - **`budget_exhausted`** — if true, there were more significant changes than the budget allowed
73
+
74
+ Each symbol includes: `name`, `kind`, `file_path`, `scope_path`, `in_degree`, `out_degree`, and all four scores (`impact`, `novel`, `recent`, `compound`).
75
+
76
+ ### 5. Drill deeper
77
+
78
+ - **For a single symbol's full history:** Use `get_timeline` with the symbol name
79
+ - **For diff-based change scope:** Use `detect_changes` when you have a specific diff/patch
80
+ - **For blast radius of a specific change:** Use `get_impact` on high-scoring symbols
81
+
82
+ ## Scoring Algorithms — Detailed Reference
83
+
84
+ ### Impact Score (Structural Significance Budgeting)
85
+ ```
86
+ sig(n) = in_degree^0.7 × (1 + out_degree)^0.3
87
+ ```
88
+ - Heavily weights callers (in_degree) — symbols called by many others have high blast radius
89
+ - Mild boost for outbound complexity (out_degree) — complex functions that changed are notable
90
+ - SSB selects the minimum set covering ≥80% of total significance mass
91
+
92
+ ### Novelty Score (Change Surprise Index)
93
+ ```
94
+ surprise(n) = (1 + in_degree) / (1 + change_freq_90d)
95
+ ```
96
+ - High in_degree + low change frequency = **maximum surprise**
97
+ - A core utility that hasn't changed in 90 days suddenly changing → likely worth investigating
98
+ - Low in_degree + high frequency = routine churn, deprioritized
99
+
100
+ ### Recent Score (Temporal Proximity Weighting)
101
+ ```
102
+ recent(n) = impact(n) × exp(−0.5 × |Δhours to reference|)
103
+ ```
104
+ - Exponential decay from the reference timestamp (the `to` parameter)
105
+ - Changes close to an incident get amplified; older changes fade
106
+ - Best for incident timelines: set `to` to the incident timestamp
107
+
108
+ ### Compound Score (Rank Fusion)
109
+ ```
110
+ compound = 0.50×rank(impact) + 0.35×rank(novel) + 0.15×rank(recent)
111
+ ```
112
+ - Rank-based fusion avoids scale sensitivity between different score types
113
+ - Impact-dominant but boosted by novelty and recency
114
+ - Best default when you don't have a specific hypothesis
115
+
116
+ ## Auto-overview Safety
117
+
118
+ If a time window produces more than 500 candidates and mode is not `overview`, the query **automatically downgrades to overview mode** and returns `auto_overview: true`. This prevents timeouts on wide windows. When you see `auto_overview: true`:
119
+ - Narrow the window, OR
120
+ - Switch to `get_changes_since` (which handles this automatically), OR
121
+ - Use the `by_module` rollup to identify the specific area and query a tighter window
122
+
123
+ ## Session-Aware Alternative
124
+
125
+ If you're resuming work after a break and don't know the right `from` timestamp, use `get_changes_since` instead — it accepts a `last_episode_id` anchor and never requires timestamp guessing.
126
+
127
+ ## Common Mistakes
128
+
129
+ | Mistake | Reality |
130
+ |---------|---------|
131
+ | Using `overview` when user needs details | Overview only gives module-level counts — use `compound` for symbol-level |
132
+ | Ignoring `budget_exhausted` flag | If true, there are more significant changes beyond what was returned — narrow the time window or use module rollup |
133
+ | Not checking `by_module` first | Module rollup is never truncated — scan it to identify which areas changed before diving into symbol-level |
134
+ | Using `recent` without setting `to` | The `to` timestamp is the reference point for proximity weighting — set it to the incident/event time |
135
+ | Guessing timestamps when resuming work | Use `get_changes_since` with a stored `session_anchor` instead — exact episode boundary, no guessing |
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: memtrace-fleet-publish-intent
3
+ description: "Use to declare a structural intent BEFORE editing in a fleet — what symbols you'll touch and why — so other agents on your branch coordinate around you. Triggered by: 'I'm about to edit/rename/refactor X', starting any non-trivial edit while other agents share your repo+branch. Returns the graph blast radius, overlapping live intents on your branch, and a shift-left coordination/partition hint. Do not start editing shared symbols without publishing first."
4
+ allowed-tools:
5
+ - mcp__memtrace__fleet_publish_intent
6
+ - mcp__memtrace__fleet_preflight
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ `fleet_publish_intent` is step 1 of the fleet protocol: announce what you're about
12
+ to touch so other agents on the **same `(repo, branch)`** coordinate around you.
13
+ It's a typed, ~20-token declaration — not prose.
14
+
15
+ ## Call it
16
+
17
+ ```jsonc
18
+ fleet_publish_intent({
19
+ repo_id: "myrepo",
20
+ branch: "session/auth-revamp", // your fleet's session branch
21
+ agent_id:"agent-a",
22
+ touched: ["auth::verify_token"], // qualified symbol identities
23
+ intent: {"refactor": {"pattern": "change_signature"}},
24
+ assignment: "widen verify_token signature for pagination" // the alignment anchor
25
+ })
26
+ ```
27
+
28
+ You get back:
29
+ - `impact_preview` — the real graph blast radius of the touched symbols.
30
+ - `active_conflicts` — overlapping live intents **on your branch** (none from other
31
+ branches; coordination is branch-scoped).
32
+ - `coordination` — a shift-left hint: `would_escalate`, a `suggested_partition`
33
+ (who should own a contested symbol), and advice to realign *before* you edit.
34
+
35
+ ## Intent kinds (JSON, snake_case, externally-tagged)
36
+
37
+ - `{"refactor":{"pattern":"rename_symbol"|"change_signature"|"move_symbol"|"extract_function"|…}}`
38
+ - `{"feature_add":{"surface":"new_symbol"|"new_endpoint"|…}}`
39
+ - `{"bug_fix":{"defect":"logic_error"|"null_handling"|…}}`
40
+ - `{"cleanup":{"kind":"dead_code"|"unused_import"|…}}`
41
+ - `{"performance":{"axis":"latency"|…}}`, `{"security_fix":{"severity":"high"}}`,
42
+ `{"test_add":{"covers":[…]}}`, `"docs_only"`, `"exploratory"`
43
+
44
+ **Destructive** kinds — `change_signature`, `move_symbol`, `cleanup/dead_code` —
45
+ are what raise a Class C decision when they overlap another agent's work.
46
+
47
+ ## Rules
48
+
49
+ - Always pass `branch` (your session branch) and `assignment` (your task).
50
+ - Read-only check first? Use `fleet_preflight` (same inputs, no registration).
51
+ - An empty `active_conflicts` is good — proceed and `fleet_record_episode` when done.
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: memtrace-fleet-record-episode
3
+ description: "Use AFTER an edit in a fleet to record it and get its conflict class (A/B/C) against agents on your branch. Triggered by: finishing an edit, 'I just changed X', completing a refactor step while other agents share your repo+branch. Returns conflict_class + replan_hint; a Class C returns an escalation_id and mediation_request that starts the decision loop. Do not finish a coordinated edit without recording it."
4
+ allowed-tools:
5
+ - mcp__memtrace__fleet_record_episode
6
+ - mcp__memtrace__fleet_get_escalation
7
+ - mcp__memtrace__fleet_query_episodes
8
+ ---
9
+
10
+ ## Overview
11
+
12
+ `fleet_record_episode` is step 3 of the fleet protocol: record the edit you just
13
+ made and learn whether it collided with another agent on your branch.
14
+
15
+ ## Call it
16
+
17
+ ```jsonc
18
+ fleet_record_episode({
19
+ repo_id: "myrepo",
20
+ branch: "session/auth-revamp",
21
+ agent_id:"agent-a",
22
+ touched: ["auth::verify_token"],
23
+ intent: {"refactor": {"pattern": "change_signature"}}
24
+ })
25
+ ```
26
+
27
+ ## The result: conflict_class
28
+
29
+ - **A → proceed.** Additive, order-independent.
30
+ - **B → re-read, then proceed.** Non-destructive overlap; re-read the shared
31
+ symbols so you build on current state.
32
+ - **C → a decision is needed.** A destructive change overlaps another agent's
33
+ work. The response includes:
34
+ - `escalation_id` — the decision's id.
35
+ - `mediation_request` — the judging task (every agent's `assignment` + the
36
+ contested symbols). If you're asked to judge, call `fleet_submit_verdict`.
37
+ - `next_action` — poll `fleet_get_escalation({escalation_id, agent_id})` until
38
+ `your_directive` ≠ `wait`, then `proceed` / `defer` / `review`.
39
+
40
+ Class is computed **only against agents on your branch**. Agents on other branches
41
+ never make your edit a Class C.
42
+
43
+ ## After recording
44
+
45
+ - Class A/B → continue.
46
+ - Class C → enter the decision loop (see `memtrace-fleet-coordination`). Don't keep
47
+ editing the contested symbols until your directive is `proceed`.
48
+ - Review history with `fleet_query_episodes({repo_id, node?, conflict_class?})`.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: memtrace-fleet-resolve
3
+ description: "Use to act on a Class C decision: submit your verdict as an agent judge (fleet_submit_verdict), poll your own directive (fleet_get_escalation), see the needs-human queue (fleet_list_escalations), or record a human decision (fleet_resolve_escalation). Triggered by: 'a decision is waiting', 'who should proceed', being handed a mediation_request, acting as a mediator between two agents, or a human choosing a winner in the dashboard."
4
+ allowed-tools:
5
+ - mcp__memtrace__fleet_submit_verdict
6
+ - mcp__memtrace__fleet_get_escalation
7
+ - mcp__memtrace__fleet_list_escalations
8
+ - mcp__memtrace__fleet_resolve_escalation
9
+ ---
10
+
11
+ ## Overview
12
+
13
+ The tools that resolve a Class C conflict. The judging is done by the user's own
14
+ agents (no API keys): an agent reads the bundle and submits a verdict; the daemon
15
+ is the deterministic referee that decides the outcome and routes it back.
16
+
17
+ ## Submit a verdict (you are the judge)
18
+
19
+ You were handed a `mediation_request` (from `fleet_record_episode`). Read **every
20
+ agent's `assignment`** in it and decide on merit — including against your own
21
+ change:
22
+
23
+ ```jsonc
24
+ fleet_submit_verdict({
25
+ escalation_id: "01J…",
26
+ agent_id: "agent-a",
27
+ verdict: { "kind": "recommend", "winner": "agent-b",
28
+ "rationale": "wider contract; rebase the fix onto it", "confidence": 0.8 }
29
+ })
30
+ // kinds: reconcile {merge_plan} | recommend {winner, rationale, confidence} | defer_to_human {question}
31
+ ```
32
+
33
+ The response tells you the `outcome` (`auto_apply` | `human_confirm` |
34
+ `human_required` | `pending`) and `your_directive`.
35
+
36
+ ## Read your own directive (you are blocked)
37
+
38
+ ```jsonc
39
+ fleet_get_escalation({ escalation_id: "01J…", agent_id: "agent-a" })
40
+ // → your_directive: wait | proceed | defer | review
41
+ ```
42
+
43
+ Poll until it's not `wait`. `proceed` = continue; `defer` = stand down and rebase
44
+ onto the winner; `review` = read `resolution`.
45
+
46
+ ## Human paths
47
+
48
+ - `fleet_list_escalations({repo_id})` — the per-repo "needs human" queue.
49
+ - `fleet_resolve_escalation({escalation_id, resolution, winner})` — record a human
50
+ decision (pick which agent proceeds) and clear it. Prefer the agent-judge path;
51
+ use this for genuine human/product calls.
52
+
53
+ ## Safety the referee guarantees
54
+
55
+ - A destructive **removal** (delete/move) is **never** auto-applied — always a human.
56
+ - Auto-apply happens only for the clear-safe machine case or ≥2 agents agreeing on
57
+ a non-destructive resolution.
58
+ - So a wrong verdict degrades to "a human reviews a suggestion," never a silent
59
+ bad merge.
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: memtrace-graph
3
+ description: "Always use for source-code architecture, important symbols, centrality, PageRank, bridge functions, communities, logical modules, chokepoints, service boundaries, or dependency path questions. Do not use Glob, find, tree, or directory browsing to infer architecture; Memtrace runs graph algorithms over the AST graph."
4
+ allowed-tools:
5
+ - mcp__memtrace__find_bridge_symbols
6
+ - mcp__memtrace__find_central_symbols
7
+ - mcp__memtrace__find_dependency_path
8
+ - mcp__memtrace__list_communities
9
+ - mcp__memtrace__list_processes
10
+ - mcp__memtrace__get_process_flow
11
+ user-invocable: true
12
+ ---
13
+
14
+ ## Overview
15
+
16
+ Graph algorithms that reveal the structural architecture of a codebase — community detection (Louvain), centrality ranking (PageRank), bridge symbol identification (Tarjan articulation points), shortest-path discovery, and execution flow tracing.
17
+
18
+ All four algorithm tools (`find_central_symbols`, `find_bridge_symbols`, `find_dependency_path`, `list_communities`) run natively against the MemDB-backed knowledge graph — no Cypher required.
19
+
20
+ ## Quick Reference
21
+
22
+ | Tool | Purpose |
23
+ |------|---------|
24
+ | `find_bridge_symbols` | Architectural chokepoints — symbols whose removal disconnects the graph (Tarjan articulation points) |
25
+ | `find_central_symbols` | Most important symbols by **PageRank** (default) or degree centrality |
26
+ | `find_dependency_path` | Shortest call/import path between two symbols (BFS over typed edges) |
27
+ | `list_communities` | Louvain-detected logical modules/services |
28
+ | `list_processes` | Execution flows: HTTP handlers, background jobs, CLI commands, event handlers |
29
+ | `get_process_flow` | Trace a single process step-by-step |
30
+
31
+ ## Steps
32
+
33
+ ### 1. Understand the architecture
34
+
35
+ Start with `list_communities` to see how the codebase is naturally partitioned into logical modules. Each community has a name, member count, and representative symbols.
36
+
37
+ ### 2. Find critical infrastructure
38
+
39
+ Use `find_central_symbols` to identify the most important symbols:
40
+ - `method: "pagerank"` — importance by link structure (default; same algorithm Google uses)
41
+ - `method: "degree"` — importance by direct connection count
42
+ - `limit` — how many to return
43
+
44
+ The PageRank pass walks every CALLS / REFERENCES edge in the repo, distributes rank with the standard 0.85 damping factor, and converges on a stable ordering. The output is sorted by score descending, with each entry carrying `name`, `kind`, `file_path`, `score`, and the `in_degree`/`out_degree` it accumulated during the walk.
45
+
46
+ ### 3. Find architectural chokepoints
47
+
48
+ Use `find_bridge_symbols` to find symbols that, if removed, would disconnect parts of the graph (Tarjan articulation points). These are:
49
+ - **Single points of failure** — if they break, cascading failures occur
50
+ - **Integration points** — good places for interfaces/contracts
51
+ - **Refactoring targets** — often too much responsibility concentrated in one place
52
+
53
+ ### 4. Discover the path between two symbols
54
+
55
+ Use `find_dependency_path` to answer "how does symbol A reach symbol B?" — returns the shortest call/import chain via BFS over typed edges. Useful for:
56
+ - "Why does the auth handler depend on the database client?"
57
+ - "How does this CLI command reach the logging subsystem?"
58
+ - "Confirm symbol X actually transitively depends on Y."
59
+
60
+ ### 5. Trace execution flows
61
+
62
+ Use `list_processes` to see all entry points (HTTP handlers, background jobs, CLI commands, event handlers).
63
+
64
+ Use `get_process_flow` with a process name to trace a specific flow step-by-step — shows the full call chain from entry point through business logic to data access, ordered by the indexed `step` property on each STEP_IN_PROCESS edge.
65
+
66
+ ## Decision Points
67
+
68
+ | Question | Tool |
69
+ |----------|------|
70
+ | "What are the main modules?" | `list_communities` |
71
+ | "What are the most important functions?" | `find_central_symbols` with method=pagerank |
72
+ | "Where are the bottlenecks?" | `find_bridge_symbols` |
73
+ | "How does symbol A reach symbol B?" | `find_dependency_path` |
74
+ | "How does a request flow through the system?" | `list_processes` → `get_process_flow` |
75
+ | "What's the entry point for feature X?" | `list_processes`, then filter by name |