memtrace 0.7.25 → 0.8.0

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 (64) hide show
  1. package/README.md +209 -287
  2. package/install.js +9 -6
  3. package/installer/package.json +1 -1
  4. package/installer/skills/commands/memtrace-api-topology.md +31 -34
  5. package/installer/skills/commands/memtrace-cochange.md +64 -33
  6. package/installer/skills/commands/memtrace-daily.md +73 -0
  7. package/installer/skills/commands/memtrace-decision-recall.md +91 -0
  8. package/installer/skills/commands/memtrace-evolution.md +121 -88
  9. package/installer/skills/commands/memtrace-fleet-publish-intent.md +18 -2
  10. package/installer/skills/commands/memtrace-fleet-record-episode.md +23 -2
  11. package/installer/skills/commands/memtrace-fleet-resolve.md +24 -1
  12. package/installer/skills/commands/memtrace-graph.md +59 -41
  13. package/installer/skills/commands/memtrace-impact.md +67 -19
  14. package/installer/skills/commands/memtrace-index.md +20 -3
  15. package/installer/skills/commands/memtrace-intent-verification.md +81 -0
  16. package/installer/skills/commands/memtrace-preflight.md +85 -0
  17. package/installer/skills/commands/memtrace-provenance.md +90 -0
  18. package/installer/skills/commands/memtrace-quality.md +49 -32
  19. package/installer/skills/commands/memtrace-relationships.md +73 -30
  20. package/installer/skills/commands/memtrace-search.md +86 -61
  21. package/installer/skills/workflows/memtrace-change-impact-analysis.md +32 -12
  22. package/installer/skills/workflows/memtrace-code-review.md +17 -11
  23. package/installer/skills/workflows/memtrace-codebase-exploration.md +41 -5
  24. package/installer/skills/workflows/memtrace-continuous-memory.md +54 -56
  25. package/installer/skills/workflows/memtrace-decision-memory.md +139 -0
  26. package/installer/skills/workflows/memtrace-episode-replay.md +87 -63
  27. package/installer/skills/workflows/memtrace-first.md +63 -7
  28. package/installer/skills/workflows/memtrace-fleet-coordination.md +21 -1
  29. package/installer/skills/workflows/memtrace-fleet-first.md +35 -5
  30. package/installer/skills/workflows/memtrace-incident-investigation.md +113 -55
  31. package/installer/skills/workflows/memtrace-refactoring-guide.md +31 -11
  32. package/installer/skills/workflows/memtrace-session-continuity.md +63 -49
  33. package/installer/skills/workflows/memtrace-style-fingerprint.md +27 -4
  34. package/package.json +7 -7
  35. package/skills/commands/memtrace-api-topology.md +31 -34
  36. package/skills/commands/memtrace-cochange.md +64 -33
  37. package/skills/commands/memtrace-daily.md +73 -0
  38. package/skills/commands/memtrace-decision-recall.md +91 -0
  39. package/skills/commands/memtrace-evolution.md +121 -88
  40. package/skills/commands/memtrace-fleet-publish-intent.md +18 -2
  41. package/skills/commands/memtrace-fleet-record-episode.md +23 -2
  42. package/skills/commands/memtrace-fleet-resolve.md +24 -1
  43. package/skills/commands/memtrace-graph.md +59 -41
  44. package/skills/commands/memtrace-impact.md +67 -19
  45. package/skills/commands/memtrace-index.md +20 -3
  46. package/skills/commands/memtrace-intent-verification.md +81 -0
  47. package/skills/commands/memtrace-preflight.md +85 -0
  48. package/skills/commands/memtrace-provenance.md +90 -0
  49. package/skills/commands/memtrace-quality.md +49 -32
  50. package/skills/commands/memtrace-relationships.md +73 -30
  51. package/skills/commands/memtrace-search.md +86 -61
  52. package/skills/workflows/memtrace-change-impact-analysis.md +32 -12
  53. package/skills/workflows/memtrace-code-review.md +17 -11
  54. package/skills/workflows/memtrace-codebase-exploration.md +41 -5
  55. package/skills/workflows/memtrace-continuous-memory.md +54 -56
  56. package/skills/workflows/memtrace-decision-memory.md +139 -0
  57. package/skills/workflows/memtrace-episode-replay.md +87 -63
  58. package/skills/workflows/memtrace-first.md +63 -7
  59. package/skills/workflows/memtrace-fleet-coordination.md +21 -1
  60. package/skills/workflows/memtrace-fleet-first.md +35 -5
  61. package/skills/workflows/memtrace-incident-investigation.md +113 -55
  62. package/skills/workflows/memtrace-refactoring-guide.md +31 -11
  63. package/skills/workflows/memtrace-session-continuity.md +63 -49
  64. package/skills/workflows/memtrace-style-fingerprint.md +27 -4
@@ -1,6 +1,6 @@
1
1
  ---
2
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."
3
+ description: "Keep the Memtrace index fresh while editing by watching a repo for live, incremental re-indexing. Use when the user asks to keep Memtrace fresh while editing, watch a repo, enable live or incremental indexing, set up always-on memory (meaning Memtrace index watching, not generic agent memory), or make just-saved source code queryable immediately. Do not fall back to repeated Grep or manual rescans; configure Memtrace watching."
4
4
  allowed-tools:
5
5
  - mcp__memtrace__watch_directory
6
6
  - mcp__memtrace__list_watched_paths
@@ -8,97 +8,95 @@ allowed-tools:
8
8
  - mcp__memtrace__index_directory
9
9
  - mcp__memtrace__list_indexed_repositories
10
10
  - mcp__memtrace__check_job_status
11
+ metadata:
12
+ author: "Syncable <support@syncable.dev>"
13
+ version: "1.0.0"
14
+ category: development
11
15
  user-invocable: true
12
16
  ---
13
17
 
14
18
  ## Overview
15
19
 
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.
20
+ Keep the knowledge graph live while editing. `watch_directory` triggers incremental re-indexing on file saves (~80 ms typical latency after debounce).
17
21
 
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.
22
+ ## Required parameters `watch_directory`
23
+
24
+ | Param | Required | Notes |
25
+ |---|---|---|
26
+ | `path` | yes | Absolute directory path |
27
+ | `repo_id` | yes | Must already be indexed |
28
+ | `branch` | no | default `"main"` |
29
+
30
+ ```json
31
+ { "path": "/abs/path/to/repo", "repo_id": "memdb" }
32
+ ```
33
+
34
+ Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bundled at the memtrace-skills plugin root).
19
35
 
20
36
  ## Steps
21
37
 
22
- ### 1. Confirm the repo is indexed
38
+ ### 1. Confirm indexed
23
39
 
24
40
  ```
25
- mcp__memtrace__list_indexed_repositories
41
+ list_indexed_repositories()
26
42
  ```
27
43
 
28
- If the repo isn't there, run `index_directory` first. The watcher requires an existing repo_id it never bootstraps from scratch.
44
+ Run `index_directory` first if missing (poll `check_job_status`; stop after ~5 minutes and report the job id see memtrace-index).
29
45
 
30
46
  ### 2. Start watching
31
47
 
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.
48
+ See JSON above. Returns immediately; watcher runs in background.
39
49
 
40
- ### 3. Confirm it's live
50
+ ### 3. Confirm active watches
41
51
 
42
52
  ```
43
- mcp__memtrace__list_watched_paths
53
+ list_watched_paths()
44
54
  ```
45
55
 
46
- Each entry shows the watched root, the bound repo_id, and the last delta's `persist_ms`.
56
+ Response shape: see [Output](#output).
47
57
 
48
- ### 4. Edit normally — Memtrace catches up
58
+ ### 4. Edit normally
49
59
 
50
- After every save the watcher emits a `labels_updated` WebSocket event:
60
+ Next `find_symbol` / `get_symbol_context` call sees saved changes after debounce (~500 ms) + incremental persist (~80 ms).
51
61
 
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
- ```
62
+ ### 5. Stop watching (kill switch)
61
63
 
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.
64
+ `unwatch_directory`:
63
65
 
64
- ### 5. Stop watching
65
-
66
- ```
67
- mcp__memtrace__unwatch_directory(path: "/abs/path/to/repo")
66
+ ```json
67
+ { "path": "/abs/path/to/repo" }
68
68
  ```
69
69
 
70
70
  Idempotent — unwatching an already-unwatched path is a no-op.
71
71
 
72
- ## When to Use
72
+ ## Latency expectations
73
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
74
+ | Stage | Typical |
75
+ |---|---|
76
+ | Debounce | **500 ms** (MCP schema) |
77
+ | Incremental persist | ~80 ms |
78
+ | Save → queryable | ~80–150 ms after debounce |
80
79
 
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
80
+ ## Output
84
81
 
85
- ## Latency Expectations
82
+ `watch_directory` returns an immediate acknowledgment; the watcher runs in the background. `list_watched_paths` returns:
86
83
 
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 |
84
+ ```json
85
+ {
86
+ "watches": [
87
+ { "path": "...", "repo_id": "...", "branch": "...", "started_at": "...", "origin": "..." }
88
+ ],
89
+ "count": 1
90
+ }
91
+ ```
94
92
 
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.
93
+ There is **no `persist_ms`** field in this response.
96
94
 
97
95
  ## Common Mistakes
98
96
 
99
97
  | 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 |
98
+ |---------|---------|
99
+ | `watch_directory(path=...)` without `repo_id` | **Both required** |
100
+ | Watching unindexed repo | Index first |
101
+ | Expecting `persist_ms` from `list_watched_paths` | Field not in MCP response |
102
+ | Debounce "50 ms" | Schema documents **500 ms** |
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: memtrace-decision-memory
3
+ description: "Check Cortex decision memory — the umbrella entry point for decision recall, provenance (why is this here), intent verification, and governing contracts. Use before assuming WHY code exists, before making a choice that may contradict a past one, or before deleting/rewriting code that looks odd or redundant. Route: free-text what-was-decided → memtrace-decision-recall; why does this symbol exist / what constrains it → memtrace-provenance; did the decision hold → memtrace-intent-verification. Do not guess rationale from the diff or git log; Cortex remembers the decision, the ban, and whether it still holds."
4
+ allowed-tools:
5
+ - mcp__memtrace__recall_decision
6
+ - mcp__memtrace__why_is_this_here
7
+ - mcp__memtrace__verify_intent
8
+ - mcp__memtrace__get_arc
9
+ - mcp__memtrace__governing_contracts
10
+ metadata:
11
+ author: "Syncable <support@syncable.dev>"
12
+ version: "1.0.0"
13
+ category: development
14
+ ---
15
+
16
+ # Decision Memory First
17
+
18
+ ## The Iron Law
19
+
20
+ ```
21
+ BEFORE you assume why code exists, contradict a convention, re-pick a settled
22
+ choice, or delete code that "looks unused/weird" → CHECK DECISION MEMORY.
23
+
24
+ recall_decision(free-text) → what did we decide / ban about X?
25
+ why_is_this_here(symbol_id) → what decision put this here?
26
+ verify_intent(decision_id) → did that decision still hold, or was it violated?
27
+ get_arc(decision_id) → what episodes implemented it?
28
+ governing_contracts(sym_id) → what constraints bind this symbol?
29
+ ```
30
+
31
+ This is the **rationale layer** of the codebase. `memtrace-first` answers *what the
32
+ code is and how it's wired* (symbols, calls, git, blast radius). Decision memory
33
+ answers *why it is the way it is, what we already decided, and whether that decision
34
+ still holds* — extracted from real coding conversations and decisions, not the AST.
35
+
36
+ The graph can tell you a function exists and who calls it. Only decision memory can
37
+ tell you that three weeks ago you **banned** the approach you're about to reintroduce.
38
+
39
+ Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bundled at the memtrace-skills plugin root).
40
+
41
+ ## The honesty contract — read this first
42
+
43
+ These five tools are **deterministic, zero-LLM**. Every call returns a labeled
44
+ **Verdict / Evidence / CannotProve** answer carrying its FactStatus and proof path.
45
+ **No tool ever fabricates an answer.**
46
+
47
+ | Answer | What it means | What you must NOT do |
48
+ |---|---|---|
49
+ | **Verdict + Evidence** (Observed / DeterministicallyDerived / StatisticallyRanked) | A recorded decision/provenance backs this | — |
50
+ | **CannotProve** | No recorded decision governs this | Do **not** read it as "safe / approved / unconstrained." It means *unknown*, not *permitted*. Fall back to `memtrace-first` + asking the user. |
51
+
52
+ `CannotProve` is a real, trustworthy answer ("memory has nothing on this"), not a
53
+ failure and not a green light. Never invent a rationale to fill the gap.
54
+
55
+ ## Server check (once per session)
56
+
57
+ These tools are served by the **`memcortex`** MCP server (decision memory), separate
58
+ from the `memtrace` code-graph server. If `recall_decision` isn't available, decision
59
+ memory isn't wired in this environment — say so and use `memtrace-first` instead;
60
+ don't fabricate decisions.
61
+
62
+ ## The decision rule
63
+
64
+ | What you're about to do / be asked | Right tool | Sub-skill |
65
+ |---|---|---|
66
+ | "Did we already decide/choose/reject X?" "What's our convention on Y?" | `recall_decision("X")` | `memtrace-decision-recall` |
67
+ | "Is there a ban / a 'don't do this' on Z?" | `recall_decision("Z")` — bans surface as decisions | `memtrace-decision-recall` |
68
+ | About to re-pick a library/pattern/approach | `recall_decision` FIRST — don't re-litigate a settled call | `memtrace-decision-recall` |
69
+ | "Why is this code here?" "Why is it done this odd way?" | `why_is_this_here(symbol_id)` | `memtrace-provenance` |
70
+ | About to delete/refactor code that looks unused or strange | `why_is_this_here` + `governing_contracts` before touching it | `memtrace-provenance` |
71
+ | "What rules/contracts constrain this symbol?" | `governing_contracts(symbol_id)` | `memtrace-provenance` |
72
+ | "Did decision D actually hold, or did we drift?" | `verify_intent(decision_id)` | `memtrace-intent-verification` |
73
+ | "What commits/episodes implemented decision D?" | `get_arc(decision_id)` | `memtrace-intent-verification` |
74
+
75
+ ## How the tools chain (ids come from recall, not from names)
76
+
77
+ Only `recall_decision` takes free text. The other four take **numeric node ids**
78
+ (`decision_id` / `symbol_id`, uint64). The normal flow is:
79
+
80
+ ```
81
+ recall_decision("auth strategy")
82
+ │ returns ranked hits, decisions first: [{ id, kind: "decision", ... }]
83
+ │ (pick a kind:"decision" hit; conversation hits are context, not chainable)
84
+ ├─► verify_intent(decision_id) did it hold?
85
+ └─► get_arc(decision_id) what implemented it?
86
+
87
+ why_is_this_here(symbol_id)
88
+ │ returns the governing decision lineage for a symbol
89
+ └─► verify_intent(that decision_id) is that rationale still valid?
90
+ ```
91
+
92
+ `symbol_id` comes from a prior recall/arc result or the Cortex view — **if you only
93
+ have a name or a free-text question, start with `recall_decision`.** Do not invent ids.
94
+
95
+ ## Standard workflows
96
+
97
+ ### "Why does this code exist / can I delete it?"
98
+ 1. `why_is_this_here(symbol_id)` → the governing decision, if any
99
+ 2. `governing_contracts(symbol_id)` → constraints that must survive a rewrite
100
+ 3. If a decision governs it → `verify_intent(decision_id)` to see if it still holds
101
+ 4. **CannotProve on all three ≠ safe to delete** — confirm with `memtrace-impact` (blast radius) and the user
102
+
103
+ ### "Should I do X?" (about to make a choice)
104
+ 1. `recall_decision("X")` → did we already decide or ban this?
105
+ 2. If a prior decision exists → `verify_intent(decision_id)` → is it still in force?
106
+ 3. Honor a held decision; only revisit a `ViolatedAt`/superseded one — and say so explicitly
107
+
108
+ ### "Did we follow through on decision D?"
109
+ 1. `verify_intent(decision_id)` → Held | ViolatedAt | CannotProve
110
+ 2. `get_arc(decision_id)` → the episodes that implemented (or should have) it
111
+
112
+ ## Red flags — STOP, check decision memory
113
+
114
+ | Thought | Reality |
115
+ |---|---|
116
+ | "This code looks unused, I'll delete it" | `why_is_this_here` first — a decision may govern it; deletion may reopen a closed issue |
117
+ | "I'll just use library/pattern X" | `recall_decision("X")` — you may be undoing a deliberate ban |
118
+ | "The diff/git log will tell me why" | Git shows *what changed*, not *what was decided or rejected*. Decision memory has the rationale and the bans. |
119
+ | "CannotProve, so it's fine/approved" | CannotProve = unknown, not approved. Don't treat absence of a record as permission. |
120
+ | "I'll guess the rationale from the code" | Don't fabricate a why. Return what the tool proves, or say it's unknown. |
121
+
122
+ ## Skill priority
123
+
124
+ This is a **process skill** — it runs alongside `memtrace-first` before
125
+ implementation. Use `memtrace-first` for *what/where/impact* (code graph); use
126
+ decision memory for *why/whether-it-held* (rationale). When both apply, decision
127
+ memory gates the intent, the code graph gates the mechanics.
128
+
129
+ ## Output
130
+
131
+ The routing outcome: which sibling skill/tool to invoke, and the evidence to quote.
132
+
133
+ ```
134
+ Ask: "Should I switch to library X?"
135
+ Route: recall_decision("library X") → memtrace-decision-recall
136
+ Hit: { id: 4217, kind: "decision", ... } (a ban exists)
137
+ Next: verify_intent(4217) → memtrace-intent-verification
138
+ Quote: Verdict + Evidence (FactStatus, proof path) — or CannotProve = unknown, not permission
139
+ ```
@@ -1,100 +1,124 @@
1
1
  ---
2
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."
3
+ description: "Replay the graph diff of one episode — a single git commit or working-tree save — to inspect what it changed: added/modified/removed symbols and edges. Use when the user asks what one commit or save changed in the graph, why code looks this way, or wants to inspect implementation attempts, reversions, past reasoning, or abandoned approaches across commits and working-tree episodes. Do not use git log or Grep for graph-level episode diffs; Memtrace replays indexed episode records. Do NOT use for module-level summaries or date-range change history — use memtrace-evolution."
4
4
  allowed-tools:
5
5
  - mcp__memtrace__get_episode_replay
6
+ - mcp__memtrace__get_evolution
6
7
  - mcp__memtrace__get_timeline
7
- - mcp__memtrace__find_symbol
8
- - mcp__memtrace__list_indexed_repositories
8
+ metadata:
9
+ author: "Syncable <support@syncable.dev>"
10
+ version: "1.0.0"
11
+ category: development
9
12
  user-invocable: true
10
13
  ---
11
14
 
12
15
  ## Overview
13
16
 
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.
17
+ Replay the graph diff for **one episode** (a single git commit or working-tree save). Shows which nodes/edges were added, modified, or removed in that episode — not a multi-episode time-range narrative.
15
18
 
16
- **Git shows A→B. Episode replay shows every step in between.**
19
+ Use `get_evolution(mode: "recent")` to **find** episode IDs and timestamps, then drill into a specific episode with this tool.
17
20
 
18
- This is the only tool that can answer: "why does this code look like this?" without relying on commit messages or comments.
21
+ ## Episode selector pick one
19
22
 
20
- ## Steps
23
+ | Approach | Parameters |
24
+ |---|---|
25
+ | Known episode UUID | `episode_id` |
26
+ | Newest episode in repo | `repo_id` + `episode_index: 0` |
27
+ | Nth newest | `repo_id` + `episode_index: N` |
21
28
 
22
- ### 1. Identify the symbol and time window
29
+ **There is no `from` / `to` / `include_working_tree` on this tool.**
23
30
 
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)
31
+ ## Optional filters (large commits)
27
32
 
28
- If you don't know the window, call `get_timeline` first to find when the symbol changed.
33
+ | Param | Purpose |
34
+ |---|---|
35
+ | `symbol` | Scope to one symbol name |
36
+ | `file_path` | Substring filter on record paths |
37
+ | `kind` | e.g. `"Function"`, `"CALLS"` |
38
+ | `mode` | `"graph_summary"` for digest on huge commits |
39
+ | `compress` | default `true` — collapse identical-hash modifications |
40
+ | `limit` / `cursor` | Pagination per bucket (default limit 200) |
29
41
 
30
- ### 2. Call `get_episode_replay`
42
+ Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bundled at the memtrace-skills plugin root).
31
43
 
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
- ```
44
+ ## Steps
42
45
 
43
- ### 3. Read the narrative_hint sequence
46
+ ### 1. Find the episode to inspect
44
47
 
45
- Each episode has a `narrative_hint` — derived automatically from AST hash patterns:
48
+ From `get_evolution`:
46
49
 
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 |
50
+ ```json
51
+ { "repo_id": "memdb", "from": "7d ago", "mode": "recent", "limit": 20 }
52
+ ```
55
53
 
56
- ### 4. Reconstruct the implementation story
54
+ Each entry has `episode` metadata including `id` (use as `episode_id`) and `reference_time`.
57
55
 
58
- Read the sequence like a narrative:
56
+ Or use `episode_index: 0` for the newest episode without knowing the UUID.
59
57
 
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
- ```
58
+ ### 2. Call `get_episode_replay`
68
59
 
69
- The gap between `committed` entries is the implementation story.
60
+ By episode UUID:
61
+
62
+ ```json
63
+ {
64
+ "episode_id": "550e8400-e29b-41d4-a716-446655440000",
65
+ "symbol": "execute",
66
+ "file_path": "src/order/service.rs",
67
+ "kind": "Function",
68
+ "compress": true,
69
+ "limit": 200
70
+ }
71
+ ```
70
72
 
71
- ### 5. Identify what to act on
73
+ Newest episode, summary first on large commits:
72
74
 
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 |
75
+ ```json
76
+ {
77
+ "repo_id": "memdb",
78
+ "episode_index": 0,
79
+ "mode": "graph_summary"
80
+ }
81
+ ```
79
82
 
80
- ## When to Use
83
+ ### 3. Interpret the response
81
84
 
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
85
+ | Field | Meaning |
86
+ |---|---|
87
+ | `found` | `false` if episode missing check `_note` |
88
+ | `totals` | Counts: `nodes_added/modified/removed`, `edges_*` |
89
+ | `nodes_added[]` etc. | Per-record diffs (paginated) |
90
+ | `page.next_cursor` | More records remain — pass as `cursor` |
91
+
92
+ For symbol history **across many episodes**, use `get_timeline` instead:
93
+
94
+ ```json
95
+ {
96
+ "repo_id": "memdb",
97
+ "scope_path": "OrderService.execute",
98
+ "file_path": "src/order/service.rs"
99
+ }
100
+ ```
86
101
 
87
- ## Compression
102
+ ## Output
88
103
 
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.
104
+ `get_episode_replay` returns the buckets interpreted in step 3:
90
105
 
91
- With `compress: false`, every single save is shown — useful when you want to see exact timing between saves.
106
+ ```json
107
+ {
108
+ "found": true,
109
+ "totals": { "nodes_added": 3, "nodes_modified": 12, "nodes_removed": 1, "edges_added": 7, "edges_removed": 2 },
110
+ "nodes_added": [ /* per-record diffs, paginated per bucket */ ],
111
+ "nodes_modified": [ /* … */ ],
112
+ "edges_removed": [ /* … */ ],
113
+ "page": { "next_cursor": 200 }
114
+ }
115
+ ```
92
116
 
93
117
  ## Common Mistakes
94
118
 
95
119
  | Mistake | Reality |
96
120
  |---------|---------|
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 |
121
+ | Passing `from` / `to` time window | Not supported one episode per call |
122
+ | Expecting `narrative_hint` / `attempted_and_reverted` | Not in APIinspect added/modified/removed buckets |
123
+ | Unfiltered replay on 10k-symbol commits | Use `kind`, `file_path`, `symbol`, or `mode: "graph_summary"` first |
124
+ | Using this for "what changed last week?" or module summaries | Use memtrace-evolution — `get_evolution(from=..., mode: recent)` to list episodes |
@@ -1,6 +1,35 @@
1
1
  ---
2
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."
3
+ description: "Route code discovery, debugging, flow tracing, and how-code-works questions in indexed source-code repos to Memtrace graph tools. Use first — 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
+ allowed-tools:
5
+ - mcp__memtrace__list_indexed_repositories
6
+ - mcp__memtrace__index_directory
7
+ - mcp__memtrace__find_symbol
8
+ - mcp__memtrace__find_code
9
+ - mcp__memtrace__get_symbol_context
10
+ - mcp__memtrace__get_impact
11
+ - mcp__memtrace__analyze_relationships
12
+ - mcp__memtrace__get_process_flow
13
+ - mcp__memtrace__list_communities
14
+ - mcp__memtrace__find_central_symbols
15
+ - mcp__memtrace__find_api_endpoints
16
+ - mcp__memtrace__find_api_calls
17
+ - mcp__memtrace__get_service_diagram
18
+ - mcp__memtrace__get_api_topology
19
+ - mcp__memtrace__find_dependency_path
20
+ - mcp__memtrace__get_cochange_context
21
+ - mcp__memtrace__get_evolution
22
+ - mcp__memtrace__get_changes_since
23
+ - mcp__memtrace__get_style_fingerprint
24
+ - mcp__memtrace__find_most_complex_functions
25
+ - mcp__memtrace__get_source_window
26
+ - Read
27
+ - Grep
28
+ - Glob
29
+ metadata:
30
+ author: "Syncable <support@syncable.dev>"
31
+ version: "1.0.0"
32
+ category: development
4
33
  ---
5
34
 
6
35
  # Memtrace First
@@ -19,7 +48,7 @@ the whole file when Memtrace has given you exact lines.
19
48
 
20
49
  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
50
 
22
- **97% better accuracy. 83% fewer wasted tokens. No exceptions for what's in the graph.**
51
+ **No exceptions for what's in the graph.**
23
52
 
24
53
  ## Value Tracking
25
54
 
@@ -68,13 +97,13 @@ For everything else inside the indexed repo, memtrace is the right tool.
68
97
  | Question Claude is asking | Right tool |
69
98
  |---|---|
70
99
  | "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. |
100
+ | "What calls `foo`?" | `get_symbol_context(repo_id, symbol="foo")` → callers with file:line. |
72
101
  | "How does authentication work?" | `find_code(query="authentication")` → `get_symbol_context` on the top hit, NOT a source read. |
73
102
  | "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
103
  | "Find the function that uses `STRIPE_KEY_FOO_BAR`" | `find_code(query="STRIPE_KEY_FOO_BAR")` → semantic finds it inside any embedded body. |
75
104
  | "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")`. |
105
+ | "What breaks if I change `foo`?" | `get_impact(repo_id, target="foo")` → blast radius. |
106
+ | "What changed in `auth.ts` last week?" | `get_evolution(repo_id, from="7d ago", mode="recent", file_path="auth.ts")`. |
78
107
  | "List all `*.test.ts` files." | `Glob` (file inventory, not symbol search). |
79
108
  | "Find this string in my `.env`." | `Grep` (non-source artifact). |
80
109
  | "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. |
@@ -89,9 +118,18 @@ All memtrace MCP tools are **strictly typed**. Pass JSON numbers (not strings) f
89
118
  | `limit`, `min_size`, `depth`, `max_depth`, `last_n` | `limit: 20` | `limit: "20"` |
90
119
  | `repo_id`, `branch`, `name`, `symbol_name`, `query` | `repo_id: "my-repo"` | `repo_id: my-repo` (unquoted) |
91
120
  | `fuzzy`, `include_tests`, `invalidate` | `fuzzy: true` | `fuzzy: "true"` |
121
+ | `get_evolution.from` | `from: "90d ago"` | `days: 90` (wrong param — use `from`, not `days`) |
122
+ | `get_changes_since.since` | `since: "2026-04-13T10:43:00Z"` | `last_episode_id: "..."` (wrong param) |
123
+ | `get_impact.target` / `get_symbol_context.symbol` | `target: "foo"` / `symbol: "foo"` | `symbol_id: "..."` (wrong — use name) |
124
+ | `find_most_complex_functions` | `top_n: 10` | `limit: 10` (wrong param name) |
125
+ | `get_cochange_context` | `target: "execute"` | `symbol: "execute"` (wrong param name) |
92
126
 
93
127
  If you see `failed to deserialize parameters: invalid type: string "N", expected usize`, remove the quotes from the number and retry.
94
128
 
129
+ If you see `missing field 'from'`, you called `get_evolution` without `from` — pass e.g. `"90d ago"`, never `days`.
130
+
131
+ Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bundled at the memtrace-skills plugin root).
132
+
95
133
  ## Check Indexing First (Once Per Session)
96
134
 
97
135
  ```
@@ -136,8 +174,8 @@ If not indexed → offer to index with `mcp__memtrace__index_directory`, then fo
136
174
  1. `find_symbol` → locate the broken thing
137
175
  2. `get_symbol_context` → understand its role
138
176
  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
177
+ 4. `get_evolution(from=<lookback>, mode: recent)` → per-episode changelog near the incident
178
+ 5. `get_changes_since(since=<anchor>)` → catch-up since last session (requires stored `since` timestamp)
141
179
 
142
180
  ### "Where is X defined / called?"
143
181
  1. `find_symbol` with `fuzzy: true`
@@ -192,3 +230,21 @@ When this skill applies, it overrides default file-search behavior. Use the spec
192
230
  - Incident investigation → `memtrace-incident-investigation`
193
231
  - Architecture overview → `memtrace-codebase-exploration`
194
232
  - Refactoring → `memtrace-refactoring-guide`
233
+
234
+ ## Output
235
+
236
+ `find_symbol` / `find_code` return ranked symbol entries (`score` only with `include_diagnostics: true`):
237
+
238
+ ```json
239
+ { "name": "handleAuth", "kind": "Function", "file_path": "src/auth.ts",
240
+ "start_line": 42, "end_line": 87 }
241
+ ```
242
+
243
+ `get_symbol_context` returns the graph neighborhood: `symbol`, `callers`, `callees`, `type_references`, `community`, `processes`, `api_callers_cross_repo`. Feed `start_line`/`end_line` into a bounded `Read` or `get_source_window` — never a whole-file read.
244
+
245
+ ## Success criteria
246
+
247
+ - The answer is grounded in Memtrace graph results (search hit → `get_symbol_context` / `get_impact`), not file-tool discovery.
248
+ - Grep/Glob/Read appear only via the documented narrow exceptions (non-source artifacts, paths outside every indexed root, file inventory, bounded span reads).
249
+ - Zero-result queries were diagnosed (`list_indexed_repositories` → broaden → reindex), not bypassed to grep.
250
+ - Any source read was bounded to the span Memtrace returned.