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,104 @@
1
+ ---
2
+ name: memtrace-continuous-memory
3
+ description: "Always use when the user asks to keep Memtrace fresh while editing, watch a repo, enable live or incremental indexing, set up always-on memory, or make just-saved source code queryable immediately. Do not fall back to repeated Grep or manual rescans; configure Memtrace watching."
4
+ allowed-tools:
5
+ - mcp__memtrace__watch_directory
6
+ - mcp__memtrace__list_watched_paths
7
+ - mcp__memtrace__unwatch_directory
8
+ - mcp__memtrace__index_directory
9
+ - mcp__memtrace__list_indexed_repositories
10
+ - mcp__memtrace__check_job_status
11
+ user-invocable: true
12
+ ---
13
+
14
+ ## Overview
15
+
16
+ Memtrace keeps the knowledge graph live as you edit. Once you call `watch_directory`, every save runs through the **incremental indexing fast-path** — a notify-based file watcher debounces saves, the indexer re-parses only the touched files, and the engine commits the delta in a single WAL transaction. Steady-state latency is **~80 ms from save to queryable** on a typical project.
17
+
18
+ This is what makes "session continuity" actually work: by the time you ask `find_symbol` after a save, the new symbol is already in the graph.
19
+
20
+ ## Steps
21
+
22
+ ### 1. Confirm the repo is indexed
23
+
24
+ ```
25
+ mcp__memtrace__list_indexed_repositories
26
+ ```
27
+
28
+ If the repo isn't there, run `index_directory` first. The watcher requires an existing repo_id — it never bootstraps from scratch.
29
+
30
+ ### 2. Start watching
31
+
32
+ ```
33
+ mcp__memtrace__watch_directory(
34
+ path: "/abs/path/to/repo"
35
+ )
36
+ ```
37
+
38
+ The tool registers a `notify` watcher on the directory tree, debounces save bursts (so a `:wq` that touches a swap file doesn't trigger twice), and routes deltas through the indexer's incremental fast-path. Returns immediately — watching runs in the background.
39
+
40
+ ### 3. Confirm it's live
41
+
42
+ ```
43
+ mcp__memtrace__list_watched_paths
44
+ ```
45
+
46
+ Each entry shows the watched root, the bound repo_id, and the last delta's `persist_ms`.
47
+
48
+ ### 4. Edit normally — Memtrace catches up
49
+
50
+ After every save the watcher emits a `labels_updated` WebSocket event:
51
+
52
+ ```json
53
+ {
54
+ "event": "labels_updated",
55
+ "repo_id": "demo",
56
+ "nodes_changed": 12,
57
+ "persist_ms": 78,
58
+ "timestamp": "2026-04-27T10:42:13Z"
59
+ }
60
+ ```
61
+
62
+ Dashboards and IDE plugins subscribe to this on `/ws` and refresh themselves. As an agent you don't have to listen — your next `find_symbol` / `find_code` / `get_symbol_context` call will see the new state automatically.
63
+
64
+ ### 5. Stop watching
65
+
66
+ ```
67
+ mcp__memtrace__unwatch_directory(path: "/abs/path/to/repo")
68
+ ```
69
+
70
+ Idempotent — unwatching an already-unwatched path is a no-op.
71
+
72
+ ## When to Use
73
+
74
+ - **Long sessions on the same repo** — keeps `get_symbol_context` accurate without rerunning `index_directory`
75
+ - **Pair programming with an IDE plugin** — the dashboard's WebSocket subscription auto-refreshes panels
76
+ - **Demo / live coding** — every save reflects in the graph within 80–150 ms
77
+ - **Long-running agents** — instead of polling `index_directory`, the watcher pushes deltas
78
+
79
+ ## When NOT to Use
80
+
81
+ - **One-shot batch edits** — running `index_directory --incremental` at the end is cheaper than spinning up a watcher
82
+ - **Generated / build output trees** — exclude paths under `target/`, `dist/`, `node_modules/` (the watcher honours common ignore patterns but a noisy build can still saturate the debounce queue)
83
+ - **CI / containerised runs** — file events are unreliable across container boundaries; index explicitly instead
84
+
85
+ ## Latency Expectations
86
+
87
+ | Operation | Typical wall time |
88
+ |---|---|
89
+ | File save → watcher fires | < 5 ms |
90
+ | Debounce window | 50 ms |
91
+ | Incremental parse + delta persist | ~80 ms |
92
+ | `labels_updated` broadcast | < 1 ms after persist |
93
+ | Total: save → queryable | ~80–150 ms |
94
+
95
+ If you see `persist_ms` consistently above 500 ms, the saved files are larger than expected (e.g., generated bundles) — narrow the watch root or add ignore patterns.
96
+
97
+ ## Common Mistakes
98
+
99
+ | Mistake | Reality |
100
+ |---|---|
101
+ | Calling `watch_directory` on an unindexed repo | Returns an error — run `index_directory` first |
102
+ | Watching `node_modules/` or `target/` | Saturates the watcher with build noise — point at the source root only |
103
+ | Polling `find_symbol` every second to "wait" for indexing | Subscribe to the `labels_updated` WS event, or just call once after the save — the delta is already there |
104
+ | Forgetting to `unwatch_directory` between sessions | Watchers are per-process; restarting `memtrace start` wipes them, but for hosted instances unwatching cleanly avoids leaks |
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: memtrace-episode-replay
3
+ description: "Always use to replay source-code evolution, understand why code looks this way, inspect implementation attempts, reversions, past reasoning, or abandoned approaches across commits and working-tree episodes. Do not use git log, git diff, Grep, or manual history reconstruction; Memtrace has episodic symbol replay."
4
+ allowed-tools:
5
+ - mcp__memtrace__get_episode_replay
6
+ - mcp__memtrace__get_timeline
7
+ - mcp__memtrace__find_symbol
8
+ - mcp__memtrace__list_indexed_repositories
9
+ user-invocable: true
10
+ ---
11
+
12
+ ## Overview
13
+
14
+ Replay the sub-commit implementation narrative for any symbol. Between any two commits, Memtrace recorded every file save as a `working_tree` episode. This tool surfaces that sequence — the attempts, the reversions, the iterative refinements — not just the final committed state.
15
+
16
+ **Git shows A→B. Episode replay shows every step in between.**
17
+
18
+ This is the only tool that can answer: "why does this code look like this?" without relying on commit messages or comments.
19
+
20
+ ## Steps
21
+
22
+ ### 1. Identify the symbol and time window
23
+
24
+ Use `find_symbol` to get the exact symbol name if needed. Determine the window:
25
+ - `from` — when to start (e.g. a few days before a confusing commit)
26
+ - `to` — when to end (usually the commit timestamp or now)
27
+
28
+ If you don't know the window, call `get_timeline` first to find when the symbol changed.
29
+
30
+ ### 2. Call `get_episode_replay`
31
+
32
+ ```
33
+ get_episode_replay(
34
+ repo_id: "...",
35
+ symbol: "execute",
36
+ from: "2026-04-10T00:00:00Z",
37
+ to: "2026-04-13T00:00:00Z",
38
+ include_working_tree: true, // false = commits only
39
+ compress: true // collapse identical-hash runs
40
+ )
41
+ ```
42
+
43
+ ### 3. Read the narrative_hint sequence
44
+
45
+ Each episode has a `narrative_hint` — derived automatically from AST hash patterns:
46
+
47
+ | Hint | What it means |
48
+ |---|---|
49
+ | `committed` | A real git commit — the "public record" checkpoint |
50
+ | `pre_commit_finalization` | Last working_tree save before a commit — the final draft |
51
+ | `iterative_refinement` | 3+ consecutive working_tree saves — active development in progress |
52
+ | `attempted_and_reverted` | Hash returned to a prior state — something was tried and backed out |
53
+ | `no_change` | File was saved but this symbol didn't change |
54
+ | `working_tree_save` | A single file save with structural changes |
55
+
56
+ ### 4. Reconstruct the implementation story
57
+
58
+ Read the sequence like a narrative:
59
+
60
+ ```
61
+ committed ← "here's where we started"
62
+ working_tree_save ← "first attempt"
63
+ iterative_refinement ← "refining the approach"
64
+ attempted_and_reverted ← "tried X, it was wrong, backed out"
65
+ pre_commit_finalization← "final version before commit"
66
+ committed ← "here's what shipped"
67
+ ```
68
+
69
+ The gap between `committed` entries is the implementation story.
70
+
71
+ ### 5. Identify what to act on
72
+
73
+ | Pattern | Implication |
74
+ |---|---|
75
+ | `attempted_and_reverted` appears | There was a tried-and-abandoned approach — understand why before trying similar |
76
+ | Multiple `iterative_refinement` clusters | The author was unsure — this area may need extra care |
77
+ | No working_tree episodes (commits only) | Code was written elsewhere or pasted in — less implementation history available |
78
+ | Very short episode sequence | Straightforward change — low implementation complexity |
79
+
80
+ ## When to Use
81
+
82
+ - **Before modifying unfamiliar code** — understand the intent, not just the current state
83
+ - **Post-session debugging** — replay what was tried during a broken session
84
+ - **Code review** — understand the reasoning behind non-obvious implementations
85
+ - **Avoiding dead ends** — check if the approach you're about to try was already attempted and reverted
86
+
87
+ ## Compression
88
+
89
+ With `compress: true` (default), consecutive episodes with identical `ast_hash` are collapsed to first+last of the run. Cosmetic saves and whitespace-only edits are filtered out. Only structurally significant transitions are shown.
90
+
91
+ With `compress: false`, every single save is shown — useful when you want to see exact timing between saves.
92
+
93
+ ## Common Mistakes
94
+
95
+ | Mistake | Reality |
96
+ |---------|---------|
97
+ | Only reading the final committed code | The commit shows *what*, the episode replay shows *why* — always check both for unfamiliar code |
98
+ | Ignoring `attempted_and_reverted` hints | These are the most valuable entries — they represent knowledge about what doesn't work |
99
+ | Using `include_working_tree: false` by default | Commits-only loses all the sub-commit narrative — only use this if you explicitly want commit-level granularity |
100
+ | Large windows with compress off | Very long histories produce noise; use `compress: true` unless you need exact save-by-save granularity |
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: memtrace-first
3
+ description: "Always use first for indexed source-code repos before searching files, reading code for discovery, debugging, tracing flows, finding implementations, understanding behavior, or answering how code works. Do not use Grep, Glob, rg, find, or manual file browsing for code discovery when Memtrace is indexed. Zero results, missing languages, or partial-looking stats are not permission to grep; diagnose/reindex with Memtrace."
4
+ ---
5
+
6
+ # Memtrace First
7
+
8
+ ## The Iron Law
9
+
10
+ ```
11
+ IF THE REPO IS INDEXED IN MEMTRACE → USE MEMTRACE TOOLS FIRST.
12
+ After a search hit, route to GRAPH tools (get_symbol_context, get_impact,
13
+ analyze_relationships) — that's what Memtrace uniquely provides. Read source
14
+ ONLY when you're about to edit or quote, and read only the bounded span
15
+ returned by Memtrace (start_line .. end_line + small context). Do not
16
+ Grep/Glob/Find to "locate" anything already in the graph, and do not read
17
+ the whole file when Memtrace has given you exact lines.
18
+ ```
19
+
20
+ Memtrace is the **memory layer** of the codebase, not a search engine that returns code. It has the full knowledge graph — every symbol, call, import, community, process, and API — with a time dimension. The point is to navigate that graph: who calls this, what's the blast radius, when did this change, what community is it part of. File tools are blind to all of that.
21
+
22
+ **97% better accuracy. 83% fewer wasted tokens. No exceptions for what's in the graph.**
23
+
24
+ ## Value Tracking
25
+
26
+ Do not print usage receipts in normal answers. Memtrace records tool usage, graph facts, file references, and estimated context avoided internally. Users can inspect that in the local UI's Value panel.
27
+
28
+ ## What Memtrace actually indexes
29
+
30
+ Memtrace's hybrid search = **BM25 over symbol metadata** (name, signature, file_path, kind) **+ semantic vector search over embedded code bodies** (first ~1500 chars of every Function / Method / Class / Struct / Interface body), fused via Reciprocal Rank Fusion.
31
+
32
+ The semantic side means **string literals, error messages, magic constants, log strings, and any text inside an indexed symbol's body are findable through `find_code`**. The body got embedded; the embedding catches it. You do NOT need `Grep` to hunt for `STRIPE_KEY_FOO_BAR` if it lives inside a function in your indexed codebase.
33
+
34
+ ## Zero results are not a grep license
35
+
36
+ If Memtrace returns 0 results, or repository stats look incomplete, do **not**
37
+ infer that a source subdirectory is outside the index. Diagnose through
38
+ Memtrace:
39
+
40
+ 1. Call `list_indexed_repositories` and identify the repo root/repo_id.
41
+ 2. If the path is under that indexed repo root, keep using Memtrace.
42
+ 3. Retry with broader `find_code` terms and, when available, `file_path` filters
43
+ such as `ui/`, `memtrace-ui/`, `src/`, or the framework directory.
44
+ 4. If the language/path still appears missing, run `index_directory` on the repo
45
+ root with `incremental: true` (or ask before `clear_existing: true`).
46
+ 5. Report the indexing coverage problem instead of silently switching to grep.
47
+
48
+ **Never say "the index only covers X, so grep is right" when the target path is
49
+ inside the indexed repository.** That is an indexing freshness/coverage issue,
50
+ not permission to abandon Memtrace.
51
+
52
+ ## The narrow exceptions where grep/glob are still right
53
+
54
+ These are the ONLY cases where file tools beat memtrace:
55
+
56
+ - **Files outside every indexed repo root.** Confirm this with
57
+ `list_indexed_repositories`; 0 search results or missing language stats do not
58
+ prove it. Vendored deps, system headers, and excluded dirs
59
+ (`.git`, `node_modules`, `target`, `dist`) are examples Memtrace cannot see.
60
+ - **Non-source artifacts.** `.env`, `package.json`, build scripts, top-level `README.md`, raw config files. Memtrace indexes parseable code, not configuration text.
61
+ - **Pure file-inventory questions.** "How many `*.test.ts` files exist", "list every Markdown file in `docs/`". You're asking for a file count, not a symbol search.
62
+ - **Reading at a known path outside Memtrace.** For configs, docs, or non-source artifacts that Memtrace cannot index, file `Read` is fine. For source-code spans returned by Memtrace, read the precise line range (your harness's `Read` with offset/limit, or `get_source_window` if your harness lacks bounded reads). Do not whole-file Read when you have a span.
63
+
64
+ For everything else inside the indexed repo, memtrace is the right tool.
65
+
66
+ ## The decision rule
67
+
68
+ | Question Claude is asking | Right tool |
69
+ |---|---|
70
+ | "Where is symbol `foo` defined?" | `find_symbol(name="foo")` → then `get_symbol_context` for callers/callees/community, NOT a source read unless you're editing. |
71
+ | "What calls `foo`?" | `get_symbol_context(name="foo")` → callers with file:line each. |
72
+ | "How does authentication work?" | `find_code(query="authentication")` → `get_symbol_context` on the top hit, NOT a source read. |
73
+ | "Find behavior X" with multi-word phrase (3+ words) | `find_code(verbatim)` first; if low confidence, fan out with identifier-shaped reshapes (camelCase / snake_case). |
74
+ | "Find the function that uses `STRIPE_KEY_FOO_BAR`" | `find_code(query="STRIPE_KEY_FOO_BAR")` → semantic finds it inside any embedded body. |
75
+ | "Where's that error message `'connection refused for tenant'`?" | `find_code(query="connection refused for tenant")` → semantic catches it. |
76
+ | "What breaks if I change `foo`?" | `get_impact(name="foo")` → blast radius with file:line. |
77
+ | "What changed in `auth.ts` last week?" | `get_evolution(file_path="auth.ts", from="7d ago")`. |
78
+ | "List all `*.test.ts` files." | `Glob` (file inventory, not symbol search). |
79
+ | "Find this string in my `.env`." | `Grep` (non-source artifact). |
80
+ | "I'm about to edit `foo` — show me its source." | Bounded `Read(file_path, offset=start_line, limit=end_line-start_line+8)`, or `get_source_window` if your harness lacks bounded reads. Never whole-file. |
81
+ | "Read config/doc file I already have the path of." | `Read` (non-source artifact, path is known). |
82
+
83
+ ## Parameter Types — Read This Before Calling Any Tool
84
+
85
+ All memtrace MCP tools are **strictly typed**. Pass JSON numbers (not strings) for integer parameters.
86
+
87
+ | Parameter | Correct | WRONG (fails with MCP error -32602) |
88
+ |---|---|---|
89
+ | `limit`, `min_size`, `depth`, `max_depth`, `last_n` | `limit: 20` | `limit: "20"` |
90
+ | `repo_id`, `branch`, `name`, `symbol_name`, `query` | `repo_id: "my-repo"` | `repo_id: my-repo` (unquoted) |
91
+ | `fuzzy`, `include_tests`, `invalidate` | `fuzzy: true` | `fuzzy: "true"` |
92
+
93
+ If you see `failed to deserialize parameters: invalid type: string "N", expected usize`, remove the quotes from the number and retry.
94
+
95
+ ## Check Indexing First (Once Per Session)
96
+
97
+ ```
98
+ mcp__memtrace__list_indexed_repositories
99
+ ```
100
+
101
+ If the current repo appears → Memtrace is active. Follow this skill for ALL code tasks.
102
+ If not indexed → offer to index with `mcp__memtrace__index_directory`, then follow this skill.
103
+
104
+ ## Task → Tool Map
105
+
106
+ | What you need | Use instead of Grep/Glob/Read |
107
+ |---|---|
108
+ | Find a function / class / symbol | `find_symbol` or `find_code` |
109
+ | Understand how something works | `get_symbol_context` (the default next step) |
110
+ | Find all callers of a function | `get_symbol_context` (callers field) |
111
+ | Find all callees / dependencies | `get_symbol_context` (callees field) |
112
+ | Trace a request / execution path | `get_process_flow` |
113
+ | Understand module structure | `list_communities` |
114
+ | Find the most important symbols | `find_central_symbols` |
115
+ | Find API endpoints | `find_api_endpoints` |
116
+ | Find where an API is called | `find_api_calls` |
117
+ | Debug a problem | `get_symbol_context` → `get_impact` → `get_evolution` |
118
+ | What changed recently? | `get_changes_since` or `get_evolution` |
119
+ | What breaks if I change X? | `get_impact` |
120
+ | Cross-service / cross-repo calls | `get_service_diagram` or `get_api_topology` |
121
+ | Dependency between two symbols | `find_dependency_path` |
122
+ | What files change together? | `get_cochange_context` |
123
+ | Architecture overview | `list_communities` + `find_central_symbols` |
124
+ | About to edit / quote — need exact lines | Bounded `Read(file, offset=start_line, limit=N)` (preferred), or `get_source_window` for path-resolution parity |
125
+ | About to choose between competing idioms (ternary vs if-else, arrow vs fn-decl, const vs let, await vs `.then`) | `get_style_fingerprint(repo_id, file_path)` — empirical codebase norm; see `memtrace-style-fingerprint` workflow |
126
+
127
+ ## Standard Workflows
128
+
129
+ ### "How does X work?" / "Explain X"
130
+ 1. `find_symbol` or `find_code` → locate the symbol
131
+ 2. `get_symbol_context` → callers, callees, community, processes (this usually answers "how it works")
132
+ 3. `get_process_flow` (if it's a process/request path)
133
+ 4. Only if you need to quote source: bounded `Read` at start_line..end_line, or `get_source_window`
134
+
135
+ ### Debugging "X is broken"
136
+ 1. `find_symbol` → locate the broken thing
137
+ 2. `get_symbol_context` → understand its role
138
+ 3. `get_impact` → blast radius (what else breaks)
139
+ 4. `get_evolution` → what changed recently (mode: `recent`)
140
+ 5. `get_changes_since` → confirm timing vs incident
141
+
142
+ ### "Where is X defined / called?"
143
+ 1. `find_symbol` with `fuzzy: true`
144
+ 2. `get_symbol_context` for full caller/callee map
145
+ 3. Only if you need source text: bounded `Read` at start_line..end_line, or `get_source_window`
146
+
147
+ ### Before any code modification
148
+ 1. `find_symbol` → confirm you have the right target
149
+ 2. `get_symbol_context` → understand full context
150
+ 3. `get_impact` → know blast radius before touching anything
151
+ 4. `get_style_fingerprint(repo_id, file_path=<file>)` → match the codebase's empirical idiom (ternary vs if-else, arrow vs fn-decl, etc.) — see `memtrace-style-fingerprint` workflow for the full decision rule
152
+
153
+ ## Red Flags — STOP, Use Memtrace Instead
154
+
155
+ You are violating this skill if you think:
156
+
157
+ | Thought | Reality |
158
+ |---|---|
159
+ | "Let me grep for this" | `find_code` or `find_symbol` is faster and structurally aware |
160
+ | "Let me glob for the file" | `find_symbol` returns exact location with context |
161
+ | "Let me read the whole file" | `get_symbol_context` for the WHY (callers/callees/community); a bounded source read at start_line..end_line for the WHAT |
162
+ | "It's just a quick search" | Grep has no understanding of call graphs, communities, or time |
163
+ | "I don't know if it's indexed" | Check with `list_indexed_repositories` first — takes 1 second |
164
+ | "Memtrace returned 0 results" | Broaden the Memtrace query, check repo_id/path coverage, then reindex if needed |
165
+ | "Stats only show Rust, but I need `ui/` or `memtrace-ui/`" | That is a coverage diagnostic. Reindex the repo root; do not grep source code. |
166
+ | "The user didn't say to use Memtrace" | User asked about the code. Repo is indexed. Use Memtrace. |
167
+ | "This is a simple question" | Simple questions benefit most — one `find_symbol` vs 20 file reads |
168
+
169
+ ## When File Tools Are Still Correct
170
+
171
+ Use Grep/Glob/Read ONLY for:
172
+ - Non-source files or paths outside every indexed source repo
173
+ - Files that are config, data, or docs (not source code symbols)
174
+ - Repos or paths confirmed outside every Memtrace indexed root
175
+
176
+ For source-code spans already located by Memtrace, use a **bounded** read —
177
+ your harness's `Read(file, offset, limit)` with the returned `start_line` /
178
+ `end_line`, or `get_source_window` if your harness lacks bounded reads. Do
179
+ not read the whole file.
180
+
181
+ Never use file tools as a **discovery** mechanism when Memtrace is available.
182
+
183
+ ## Skill Priority
184
+
185
+ This skill is a **process skill** — it runs BEFORE any implementation or search skill.
186
+
187
+ When this skill applies, it overrides default file-search behavior. Use the specific Memtrace sub-skills for deep detail on each tool:
188
+
189
+ - Discovery → `memtrace-search`
190
+ - Impact analysis → `memtrace-impact`
191
+ - Temporal / change analysis → `memtrace-evolution`
192
+ - Incident investigation → `memtrace-incident-investigation`
193
+ - Architecture overview → `memtrace-codebase-exploration`
194
+ - Refactoring → `memtrace-refactoring-guide`
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: memtrace-fleet-coordination
3
+ description: "Use when you need to understand or act on fleet conflict resolution: what conflict class A/B/C means, how a Class C destructive overlap gets decided (by an agent judge or a human), how to be the judge (fleet_submit_verdict), how to read your directive after a decision, and how branch-scoping isolates fleets. Triggered by: 'two agents are changing the same thing', 'resolve this conflict', 'who should proceed', 'a decision is waiting', acting as a mediator between agents."
4
+ allowed-tools:
5
+ - mcp__memtrace__fleet_record_episode
6
+ - mcp__memtrace__fleet_submit_verdict
7
+ - mcp__memtrace__fleet_get_escalation
8
+ - mcp__memtrace__fleet_list_escalations
9
+ - mcp__memtrace__fleet_resolve_escalation
10
+ - mcp__memtrace__fleet_get_node_state
11
+ ---
12
+
13
+ # Fleet Coordination
14
+
15
+ How the fleet turns overlapping edits into a safe decision. Read
16
+ `memtrace-fleet-first` for the publish→edit→record protocol; this skill is the
17
+ *conflict resolution* half.
18
+
19
+ ## Conflict classes (what `fleet_record_episode` returns)
20
+
21
+ | Class | Meaning | What to do |
22
+ |---|---|---|
23
+ | **A** | Additive, order-independent | Proceed. |
24
+ | **B** | Non-destructive overlap with another agent's work | Re-read the shared symbols, then proceed. |
25
+ | **C** | A **destructive** change (signature change / move / dead-code removal) overlaps another agent's work | A decision is needed — it does NOT auto-resolve. |
26
+
27
+ Class is computed **only against agents on your branch** (`(repo, branch)`).
28
+ Agents on other branches are never conflict peers.
29
+
30
+ ## The Class C decision loop
31
+
32
+ When `fleet_record_episode` returns class C it also returns an `escalation_id` and
33
+ (when mediation is on) a `mediation_request`. The decision is made by an **agent
34
+ judge**, a **human**, or — only when provably safe — the **deterministic referee**.
35
+
36
+ ### Being the judge (the user's own agent does the judging — no API keys)
37
+
38
+ The `mediation_request` bundles **every agent's `assignment`** plus the contested
39
+ symbols. Read the *other* agent's task and decide on merit (including against your
40
+ own change). Submit:
41
+
42
+ ```jsonc
43
+ fleet_submit_verdict({
44
+ escalation_id: "01J…",
45
+ agent_id: "agent-a",
46
+ verdict: { "kind": "recommend", "winner": "agent-b",
47
+ "rationale": "the signature change is the wider contract; rebase the fix onto it",
48
+ "confidence": 0.8 }
49
+ })
50
+ ```
51
+
52
+ Verdict kinds: `reconcile {merge_plan}` · `recommend {winner, rationale, confidence}`
53
+ · `defer_to_human {question}`.
54
+
55
+ The referee then decides the outcome:
56
+ - **Auto-apply** only when safe: the clear machine case, or ≥2 independent agents
57
+ agree — and **never** for a destructive *removal* (delete/move), which always
58
+ needs a human.
59
+ - **Human confirm** — a recommendation is surfaced for one-click confirmation.
60
+ - **Human required** — both sides destructive, agents disagree, or an agent
61
+ deferred → a person decides.
62
+
63
+ ### Reading your directive
64
+
65
+ Poll `fleet_get_escalation({escalation_id, agent_id})` until `your_directive` ≠
66
+ `wait`: `proceed` (you continue), `defer` (stand down / rebase onto the winner),
67
+ `review` (read `resolution`).
68
+
69
+ ### Resolving as a human (or on a human's behalf via the dashboard)
70
+
71
+ `fleet_resolve_escalation({escalation_id, resolution, winner})` records a human
72
+ decision and clears the queue. Prefer the agent-judge path; use this for the
73
+ genuine human-decision cases. `fleet_list_escalations({repo_id})` shows the
74
+ "needs human" queue.
75
+
76
+ ## Why branch-scoping matters here
77
+
78
+ A "winner / defer" only makes sense on a shared surface. Across branches, the
79
+ loser can't defer (its branch needs the change too), so the fleet never escalates
80
+ cross-branch — that's a merge-time concern git already owns. Keep your fleet to
81
+ one session branch and conflicts stay real and resolvable.
82
+
83
+ ## Inspecting state
84
+
85
+ `fleet_get_node_state({repo_id, node})` — recent episodes, active intents, dominant
86
+ intent, and conflict density for one symbol. Use it to understand pressure on a
87
+ hot symbol before you pile on.
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: memtrace-fleet-first
3
+ description: "Always use FIRST when more than one coding agent works the same repo+branch at once (a 'fleet'), before reading code, planning a refactor, or making an edit. Triggered by: 'I'm about to edit X', 'rename Y across the codebase', joining a running fleet/session branch, coordinating with other agents, prose hand-offs. Do not grep for 'who else is touching this' and do not skip fleet_publish_intent because 'it's a small change'. Fleet coordination is branch-scoped: pass your session branch so your fleet coordinates and stays isolated from agents on other branches. Skip ONLY for genuinely solo sessions or pure docs-only edits where coordination has zero value."
4
+ allowed-tools:
5
+ - mcp__memtrace__fleet_status
6
+ - mcp__memtrace__fleet_preflight
7
+ - mcp__memtrace__fleet_publish_intent
8
+ - mcp__memtrace__fleet_record_episode
9
+ - mcp__memtrace__fleet_get_escalation
10
+ - mcp__memtrace__fleet_submit_verdict
11
+ ---
12
+
13
+ # Fleet First
14
+
15
+ The coordination layer for **fleets of coding agents** working the same repo at the
16
+ same time. It stops agents from silently clobbering each other's edits, and turns
17
+ unsafe overlaps into a clear decision instead of a merge-time surprise.
18
+
19
+ ## The Iron Law
20
+
21
+ ```
22
+ IN A FLEET → FLEET TOOLS BEFORE EDITS. NO EXCEPTIONS.
23
+ 1. fleet_publish_intent (declare what you'll touch; get blast radius + conflicts)
24
+ 2. edit (your normal edit loop)
25
+ 3. fleet_record_episode (classify A/B/C; if C, the loop resolves it)
26
+ ```
27
+
28
+ A typed intent serializes to ~20 tokens; a prose "I'm going to change X" averages
29
+ 200+. A 10-agent fleet × 100 edits = tens of thousands of tokens saved per
30
+ fleet-turn — and zero silent overwrites — when the protocol is followed.
31
+
32
+ ## A fleet = agents on ONE branch (always pass it)
33
+
34
+ **Coordination is branch-scoped.** Two agents only coordinate when they're on the
35
+ **same `(repo, branch)`**. The branch name is the fleet identifier: a *session
36
+ branch* is how a group of agents opts into one coordinating fleet.
37
+
38
+ - Working a session branch (`session/auth-revamp`)? Pass `branch` on **every**
39
+ fleet call. Your fleet coordinates together and stays isolated from agents on
40
+ other branches.
41
+ - Omit `branch` only for the shared default pool (single, unnamed fleet).
42
+ - Agents on **different** branches never conflict — git already isolates them, and
43
+ whether branches merge isn't guaranteed, so the fleet never reasons across them.
44
+
45
+ ```jsonc
46
+ { "repo_id": "myrepo", "branch": "session/auth-revamp",
47
+ "agent_id": "agent-a", "touched": ["auth::verify_token"],
48
+ "intent": {"refactor": {"pattern": "change_signature"}},
49
+ "assignment": "widen verify_token signature for pagination" }
50
+ ```
51
+
52
+ Always include **`assignment`** — your natural-language task. When a conflict
53
+ happens, that's what the judge (another agent) or a human reads to reconcile.
54
+
55
+ ## Check the fleet first (once per session)
56
+
57
+ ```
58
+ fleet_status() → live_intents, active_agents, pending_escalations, mediator_mode
59
+ ```
60
+
61
+ If it responds, fleet coordination is active — follow this skill for every edit.
62
+ An empty fleet is **not** permission to skip: it just means you're the first agent
63
+ in this window.
64
+
65
+ ## The protocol, step by step
66
+
67
+ 1. **Before editing** — `fleet_preflight({repo_id, branch, agent_id, touched, intent})`
68
+ (read-only) or go straight to `fleet_publish_intent(...)`. You get the blast
69
+ radius, any overlapping live intents on your branch, and a `coordination` block
70
+ that may already suggest who owns a contested symbol.
71
+ 2. **Edit** — your normal loop.
72
+ 3. **After editing** — `fleet_record_episode({repo_id, branch, agent_id, touched, intent})`.
73
+ It returns a `conflict_class`:
74
+ - **A — proceed.** Additive, order-independent. Nothing to do.
75
+ - **B — re-read, then proceed.** You overlap non-destructively; re-read the
76
+ shared symbols so you build on current state.
77
+ - **C — a decision is needed.** A destructive change overlaps another agent's
78
+ work. This does **not** auto-resolve — see below.
79
+
80
+ ## Class C: the decision loop (read this)
81
+
82
+ A Class C means two edit paths can't both land safely. `fleet_record_episode`
83
+ returns an `escalation_id` and a `mediation_request` (when mediation is enabled).
84
+ What happens next depends on who judges:
85
+
86
+ - **You may be asked to judge.** The `mediation_request` carries **every agent's
87
+ assignment** — including the other side's. Read them and submit a verdict with
88
+ `fleet_submit_verdict({escalation_id, agent_id, verdict})`, where `verdict` is one
89
+ of:
90
+ - `{"kind":"reconcile","merge_plan":"…"}` — the changes combine; here's how.
91
+ - `{"kind":"recommend","winner":"<agent_id>","rationale":"…","confidence":0.0-1.0}` —
92
+ one path should continue.
93
+ - `{"kind":"defer_to_human","question":"…"}` — a real product call; ask a human.
94
+ - **A human may decide** in the Fleet dashboard. Either way the outcome flows back
95
+ to you.
96
+ - **Close YOUR loop**: poll `fleet_get_escalation({escalation_id, agent_id})` until
97
+ `your_directive` is no longer `wait`:
98
+ - `proceed` — you were chosen; continue.
99
+ - `defer` — another path won; stand down and rebase your work onto it.
100
+ - `review` — read the free-text `resolution`.
101
+
102
+ The daemon is a deterministic referee: it never auto-applies a destructive
103
+ *removal* (delete/move) without a human, and only auto-applies when it's safe (a
104
+ clear machine case, or independent agent consensus). So the judge being wrong
105
+ degrades to "a human reviews a suggestion," never a silent bad merge.
106
+
107
+ ## Routing — what do you need?
108
+
109
+ | You're about to… | Do this |
110
+ |---|---|
111
+ | Start any edit in a fleet | `fleet_publish_intent` (declare it) — never skip |
112
+ | Check before declaring | `fleet_preflight` (read-only "is the coast clear?") |
113
+ | Finish an edit | `fleet_record_episode` (get A/B/C) |
114
+ | Got a Class C as the judge | `fleet_submit_verdict` (reconcile/recommend/defer) |
115
+ | Blocked on a Class C | poll `fleet_get_escalation` until `your_directive ≠ wait` |
116
+ | See who's in the fleet | `fleet_status` (active_agents, pending decisions) |
117
+ | Inspect a symbol's coordination state | `fleet_get_node_state` |
118
+
119
+ ## Parameter notes
120
+
121
+ - Pass `intent` as JSON (externally-tagged, snake_case):
122
+ `{"refactor":{"pattern":"rename_symbol"}}`, `{"bug_fix":{"defect":"logic_error"}}`.
123
+ Destructive kinds: `refactor/change_signature`, `refactor/move_symbol`,
124
+ `cleanup/dead_code` — these are what trigger Class C over shared symbols.
125
+ - `touched` is a list of qualified symbol identities (e.g. `"module::Symbol"`).
126
+ - Always include `branch` (your session branch) and `assignment` (your task).
127
+
128
+ ## When to skip
129
+
130
+ Skip the protocol only for a genuinely **solo** session (you're the only agent and
131
+ no one else shares your branch) or **pure docs-only** edits where coordination has
132
+ zero value. Everything else in a fleet goes through the protocol.