memtrace-skills 1.2.9 → 1.2.11

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 (48) hide show
  1. package/dist/managed-skills.d.ts +4 -0
  2. package/dist/managed-skills.js +95 -0
  3. package/dist/rail-hook.d.ts +7 -1
  4. package/dist/rail-hook.js +177 -57
  5. package/dist/rail-install.js +3 -6
  6. package/dist/rail-lifecycle.js +6 -3
  7. package/dist/rail-runtime.d.ts +38 -3
  8. package/dist/rail-runtime.js +88 -7
  9. package/dist/tool-names.js +6 -0
  10. package/dist/transformers/claude.d.ts +16 -4
  11. package/dist/transformers/claude.js +69 -82
  12. package/dist/transformers/codex.js +5 -20
  13. package/dist/transformers/cursor.js +5 -20
  14. package/dist/transformers/kiro.js +5 -14
  15. package/dist/transformers/opencode.js +6 -6
  16. package/dist/transformers/pi.js +5 -5
  17. package/dist/transformers/rail-hooks.d.ts +6 -1
  18. package/dist/transformers/rail-hooks.js +72 -13
  19. package/dist/transformers/shared.d.ts +2 -1
  20. package/dist/transformers/shared.js +28 -23
  21. package/dist/transformers/vscode.js +3 -1
  22. package/package.json +2 -2
  23. package/plugins/memtrace-skills/references/mcp-parameters.md +14 -3
  24. package/plugins/memtrace-skills/skills/memtrace-codebase-exploration/SKILL.md +4 -0
  25. package/plugins/memtrace-skills/skills/memtrace-daily/SKILL.md +4 -0
  26. package/plugins/memtrace-skills/skills/memtrace-first/SKILL.md +55 -24
  27. package/plugins/memtrace-skills/skills/memtrace-graph/SKILL.md +4 -0
  28. package/plugins/memtrace-skills/skills/memtrace-guided-refactor/SKILL.md +88 -0
  29. package/plugins/memtrace-skills/skills/memtrace-impact/SKILL.md +4 -0
  30. package/plugins/memtrace-skills/skills/memtrace-index/SKILL.md +21 -0
  31. package/plugins/memtrace-skills/skills/memtrace-preflight/SKILL.md +4 -0
  32. package/plugins/memtrace-skills/skills/memtrace-quality/SKILL.md +16 -2
  33. package/plugins/memtrace-skills/skills/memtrace-refactoring-guide/SKILL.md +4 -0
  34. package/plugins/memtrace-skills/skills/memtrace-search/SKILL.md +1 -0
  35. package/plugins/memtrace-skills/skills/memtrace-session-continuity/SKILL.md +4 -0
  36. package/skills/commands/memtrace-daily.md +4 -0
  37. package/skills/commands/memtrace-graph.md +4 -0
  38. package/skills/commands/memtrace-impact.md +4 -0
  39. package/skills/commands/memtrace-index.md +22 -0
  40. package/skills/commands/memtrace-preflight.md +4 -0
  41. package/skills/commands/memtrace-quality.md +19 -2
  42. package/skills/commands/memtrace-search.md +1 -0
  43. package/skills/managed-stock-sha256.txt +364 -0
  44. package/skills/workflows/memtrace-codebase-exploration.md +4 -0
  45. package/skills/workflows/memtrace-first.md +55 -24
  46. package/skills/workflows/memtrace-guided-refactor.md +89 -0
  47. package/skills/workflows/memtrace-refactoring-guide.md +4 -0
  48. package/skills/workflows/memtrace-session-continuity.md +4 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: memtrace-first
3
- description: "Route code discovery, debugging, flow tracing, how-code-works questions, and pre-edit rationale checks in indexed source-code repos to Memtrace graph plus Cortex decision tools. Use first before searching/reading code, and before editing, refactoring, deleting, or re-picking an approach that may have a recorded decision, ban, convention, or contract. Do not use Grep, Glob, rg, find, or manual file browsing for code discovery when Memtrace is indexed. Zero results are not permission to grep: diagnose the miss first, then allow one targeted reformulation and bounded source verification or fallback, and reindex only on evidence of stale or incomplete coverage — never in a loop. A `repo_not_in_store` refusal means a different store holds the repository: route to that store, never grep and never re-index here."
3
+ description: "Use indexed graph and decision context for nontrivial code discovery, debugging, caller or consumer analysis, cross-file changes, impact, history, and recorded contracts. Follow useful retrieval with relevant relationships and current-source verification. Ordinary tools remain available; explicit user and project workflows take precedence."
4
4
  allowed-tools:
5
5
  - mcp__memtrace__list_indexed_repositories
6
6
  - mcp__memtrace__index_directory
@@ -37,14 +37,28 @@ metadata:
37
37
  ---
38
38
  # Memtrace First
39
39
 
40
- Use Memtrace first for code discovery in indexed repositories. Use its graph to
41
- understand relationships, processes and impact; verify source when exact behavior
42
- matters. Retrieval is evidence, not a guarantee of complete coverage.
40
+ Use Memtrace when indexed context helps resolve a concrete question about code,
41
+ relationships, processes, change impact or recorded decisions. Retrieval is
42
+ evidence, not a guarantee of complete coverage or correct behavior.
43
+
44
+ ## Respect the chosen workflow
45
+
46
+ This is the managed contextual default. Explicit user and project instructions,
47
+ including custom strict workflows and opt-outs, take precedence. Keep the existing
48
+ Rail setting: `off`, `observe`, `nudge`, `rail` or `strict`. Do not change a user's
49
+ mode or treat this default as authorization for indexing or other external actions.
50
+
51
+ Ordinary source search, reads, edits and tests remain available. Use them directly
52
+ for small, known local changes, exact text searches, or questions the graph cannot
53
+ answer. There is no mandatory first call, query quota or minimum tool count. For
54
+ nontrivial discovery or shared behavior, prefer Memtrace's indexed context and
55
+ follow useful hits with the relationships that answer the open question.
43
56
 
44
57
  ## Establish scope
45
58
 
46
- Call `list_indexed_repositories` once per session. Select the actual repository
47
- and branch; pass `repo_id` explicitly when possible. It lists this session's
59
+ Select the actual repository and branch; pass `repo_id` explicitly when
60
+ possible. When the task already names the repository, use it directly; call
61
+ `list_indexed_repositories` only when the repository or branch is unknown. It lists this session's
48
62
  store only, so a repository missing from it may still be indexed and live in
49
63
  another store. Do not index a parent containing unrelated repositories. For a
50
64
  deliberately shared workspace, verify its workspace marker and scope before
@@ -85,7 +99,7 @@ answer from stale repos.
85
99
  ## Search, then investigate
86
100
 
87
101
  - Exact symbol: `find_symbol(name=..., repo_id=...)`.
88
- - Behavior or concept: `find_code(query=..., repo_id=...)`.
102
+ - Behavior or concept: `find_code(query=..., repo_id=..., limit=10)` (default 20 rows).
89
103
  - Relationships: `get_symbol_context` or `analyze_relationships` on the useful hit.
90
104
  - Change impact: `get_impact`; confirm relevant callers against source.
91
105
  - Execution path: `get_process_flow`; follow its `next_offset` for further steps.
@@ -101,7 +115,8 @@ Treat partial context, truncation and unavailable overlay context as incomplete
101
115
  evidence; selected static flows are not complete runtime traces.
102
116
 
103
117
  `context.next_calls` provides scoped follow-up arguments for the useful symbol
104
- and process. Before changing shared behavior, inspect relevant callers and
118
+ and process; copy them rather than rebuilding arguments. A `context.processes[].id`
119
+ is the `process` for `get_process_flow`. Before changing shared behavior, inspect relevant callers and
105
120
  callees to identify contracts the patch must preserve. Use process IDs for
106
121
  flow navigation. No sampled flow is not proof that no call path exists.
107
122
 
@@ -112,8 +127,11 @@ Run related existing tests to detect regressions before claiming completion.
112
127
 
113
128
  Read the bounded source span when verifying behavior, editing or quoting. Do not
114
129
  fetch whole files or entire process traces when a local span answers the question.
115
- `get_symbol_context` omits source bodies by default; use `include_content: true`
116
- for explicit expansion, and `limit`/`offset` for relationship pages. An omitted
130
+ `get_symbol_context` returns 5 rows per relationship section and omits source
131
+ bodies and references by default: `pagination` names sections with more
132
+ (`limit`/`offset`), `omitted` names what was left out (`include_references: true`,
133
+ `include_details: true`), and `include_content: true` returns the symbol's body whole
134
+ with short neighbour previews. An omitted
117
135
  risk diagnostic means unknown, not zero callers or low risk. Check truncation and
118
136
  pagination metadata before describing a neighborhood as complete.
119
137
 
@@ -157,9 +175,11 @@ searched nothing. The `diagnostic` block names the store that answered, its
157
175
  problem: the id matches more than one repository in *this* store, and the
158
176
  message says to pass the exact id. Do that and stop here. Everything below
159
177
  applies to the `not_in_store` reason.
160
- 2. Do not fall back to file search. The refusal says so itself, in `_note`:
161
- "Wrong store for this repo_id; do not fall back to filesystem search, ask
162
- the session attached to the store named in diagnostic.repo_lives_in."
178
+ 2. Route graph questions to the owning store. A filesystem match cannot turn
179
+ this refusal into successful graph retrieval or prove that graph edges are
180
+ absent. Ordinary source work may continue when the actual checkout, path and
181
+ branch have been verified; keep that evidence separate from the unavailable
182
+ graph answer. Do not freeze the user's workflow while waiting for a store.
163
183
  3. Do not call `index_directory`. The repository is already indexed in the
164
184
  store `repo_lives_in` names. Indexing it here would build a second copy in
165
185
  the wrong store — writes are never routed to another store, so the call
@@ -171,7 +191,9 @@ searched nothing. The `diagnostic` block names the store that answered, its
171
191
  or `--workspace <name>` when a manifest or a Named Workspace owns its
172
192
  scope.
173
193
  5. If `repo_lives_in` is absent, no live Memtrace runtime declares the
174
- repository. Running `memtrace start` in its own workspace is the fix.
194
+ repository. If graph access is needed and setup is authorized, start Memtrace
195
+ in that repository's own workspace. Ordinary verified source work need not
196
+ wait; a retrieval refusal is not authorization to create another index.
175
197
 
176
198
  A refusal is not the only outcome. When the runtime whose store declares the
177
199
  repository is live and publishes a reachable control port, the same read is
@@ -200,8 +222,9 @@ that sets no `repo_in_store` key, is handled in the section above, not here.
200
222
  tool that sets no `repo_in_store` key, missing scope, wrong branch, pending
201
223
  index/embedding job, stale index and a valid empty result. Do not treat an
202
224
  error as a clean miss, and do not treat a refusal or a keyless zero as one
203
- either — re-ask through `find_code` or `find_symbol` before reading
204
- anything into a keyless zero.
225
+ either. Use a membership-checking tool when a membership or absence claim
226
+ matters; a keyless zero alone cannot establish it. Ordinary source
227
+ verification remains available without an extra graph-call prerequisite.
205
228
  2. For an ambiguous query, make at most one targeted reformulation, using an
206
229
  identifier or path hint where available, and a `file_path` filter such as
207
230
  `ui/`, `memtrace-ui/`, `src/` or the framework directory when one applies.
@@ -228,8 +251,9 @@ are also appropriate uses of file tools.
228
251
 
229
252
  ## Check rationale before changing code
230
253
 
231
- BEFORE you edit/refactor/delete existing code or choose another pattern, call
232
- Cortex `recall_decision("<symbol/subsystem/approach>")` when available. If a symbol
254
+ When changing shared behavior, deleting code, or revisiting an approach that may
255
+ have a recorded contract, use Cortex `recall_decision("<symbol/subsystem/approach>")`
256
+ when available and relevant. If a symbol
233
257
  ID is available, consult `why_is_this_here(symbol_id)` and
234
258
  `governing_contracts(symbol_id)`. Verify a
235
259
  matching decision with `verify_intent` before relying on it. Unknown rationale
@@ -241,8 +265,10 @@ when choosing among competing local idioms.
241
265
 
242
266
  Use JSON numbers for limits/depths and booleans for switches. Use symbol names
243
267
  for `get_symbol_context.symbol`, `get_impact.target` and relationship targets;
244
- use IDs only where the specific schema asks for one. Prefer the live schema over
245
- remembered parameters. `find_code` has no `kind` filter; use `find_symbol` for it.
268
+ use a returned exact UUID when that tool supports identity-based recovery. Check
269
+ the actual schema rather than guessing an argument name. When a call is rejected,
270
+ check that tool's schema rather than retrying from memory; do not pre-read schemas.
271
+ `find_code` has no `kind` filter; use `find_symbol` for it.
246
272
  Search without an explicit repository uses safe scope inference, not an implicit
247
273
  search of every repository. `get_evolution` uses `from`, not `days`.
248
274
 
@@ -255,12 +281,17 @@ receipts; preserve evidence internally and report meaningful findings and limits
255
281
  - The right repository and branch were used.
256
282
  - Graph claims are supported by retrieved edges, with missing/truncated data
257
283
  made explicit, and exact behavioral claims are checked against source.
258
- - A `repo_not_in_store` refusal was routed on `diagnostic.repo_lives_in`, not
259
- answered by grep and not answered by indexing the repository into this store.
284
+ - A `repo_not_in_store` graph question was routed on `diagnostic.repo_lives_in`,
285
+ not answered by indexing another copy into this store. Any ordinary source
286
+ fallback verified the actual checkout and was not reported as graph evidence.
260
287
  - A zero from a tool that sets no `repo_in_store` key was re-checked through a
261
288
  membership-checking tool before it was called an absence.
262
289
  - Failed retrieval on a genuine zero (`repo_in_store: true`) is diagnosed and
263
290
  bounded; it does not trigger query or reindex loops, and fallbacks remain
264
291
  distinguishable from retrieval successes.
265
- - Any source read was bounded to the span Memtrace returned.
266
- - Existing rationale and contracts were checked when the tools were available.
292
+ - Source inspection was scoped to the question; exact claims and edits were
293
+ verified against the current source rather than inferred from graph edges.
294
+ - Relevant recorded rationale and contracts were checked when available.
295
+ - Before finishing, compare the requested requirements with the implementation
296
+ and verification: state any remaining unverified behavior. This checklist is
297
+ a review aid, not machine-verified correctness or an extra approval gate.
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: memtrace-guided-refactor
3
+ description: "Run a saved, staged refactor shared with Memtrace's Quality page. Use for splitting tangled functions, extracting helpers, or continuing a guided refactor run with fixed file scope and checks between edits."
4
+ user-invocable: true
5
+ ---
6
+
7
+ Use the `guided_refactor` MCP tool to track the same run shown in Quality. This
8
+ skill coordinates the agent's edits and language tools; Memtrace does not execute
9
+ shell commands or rewrite source on behalf of the browser. Never invent check
10
+ results. Recorded checks are agent-reported evidence, not proof of equivalence.
11
+
12
+ ## Diagnose
13
+
14
+ 1. Resolve the repository and exact symbol/file with `find_symbol` and
15
+ `get_symbol_context`. Use the runtime attached to that repository.
16
+ 2. If a run ID was supplied, call `guided_refactor` with `action: "get"`,
17
+ `repo_id`, and `run_id`. Otherwise call `action: "list"` and reuse a relevant
18
+ unfinished run; create one with `file_path` and `symbol` only when needed.
19
+ 3. Inspect function complexity, affected callers, evolution/churn, module
20
+ boundaries, existing tests, and decision-memory constraints. Use
21
+ `get_function_quality_metrics`, `get_impact`, `get_evolution`, and
22
+ `get_symbol_context` as available; read the selected source. Record missing
23
+ evidence explicitly. LOC alone is never a reason to split code.
24
+ 4. Respect the returned classification. `Manual` runs permit diagnosis and
25
+ blueprint only. In this first version, staged source work is available for
26
+ Rust, TypeScript, JavaScript, Python, and Go in Git checkouts. Other indexed
27
+ languages and configuration files still get a saved manual plan. Nothing is
28
+ classified Automatic.
29
+
30
+ ## Blueprint
31
+
32
+ Call `get` before running baseline checks and retain its `snapshot`. Run the
33
+ project's compiler/type checker and relevant behavior tests. Compare the exported
34
+ API and affected callers. If a check fails or is unavailable, record that fact;
35
+ do not label it passed or begin source work.
36
+
37
+ Submit `action: "blueprint"` with the returned `revision`, retained `snapshot`,
38
+ diagnostic evidence in `note`, baseline `checks`, and 1–12 ordered `steps`:
39
+
40
+ ```json
41
+ {
42
+ "title": "Capture diagnostic behavior",
43
+ "operation": "capture_tests",
44
+ "files": ["src/parser.rs", "tests/parser.rs"],
45
+ "boundary": "Add cases for existing diagnostics; preserve parsing behavior"
46
+ }
47
+ ```
48
+
49
+ The only staged operations are `capture_tests` and `extract_helper`. Name every
50
+ file a step can change, including planned new files, with repository-relative
51
+ paths. Keep each step small enough to review. Do not change generated code,
52
+ ownership or lifetime contracts, macros, import side effects, public APIs, or
53
+ configuration semantics as an incidental extraction. If those boundaries cannot
54
+ be justified, pause and explain the manual decision needed.
55
+
56
+ Every check has `kind` (`compiler`, `tests`, or `api`), `command`, `passed`, and
57
+ `evidence`. All three kinds are required. Evidence should include exact commands,
58
+ results/counts, and uncertainty. API evidence can be a documented source/caller
59
+ comparison when the project has no API-check command.
60
+
61
+ ## Execute one step
62
+
63
+ 1. Call `get`, inspect saved state, and send `action: "begin"` with `revision`,
64
+ `snapshot`, and one stable `agent_id`. The coordinator refuses overlapping
65
+ active runs and source changes between steps. Do not delegate overlapping edits.
66
+ 2. Make only the active step's bounded change. Preserve existing unrelated edits.
67
+ Do not commit during a run: a changed Git HEAD requires a fresh diagnosis.
68
+ 3. Call `get` after editing and **before** running the checks. Retain that snapshot,
69
+ run the compiler, tests, and API comparison, then send `action: "checkpoint"`
70
+ with that same `snapshot`, current `revision`, `agent_id`, `checks`, and `note`.
71
+ Never refresh the snapshot after tests merely to get past a stale-source gate.
72
+ 4. Inspect the response. A paused run is not a passed checkpoint. Stop editing
73
+ until the failure is understood. Keep failed evidence visible. To resume after
74
+ fixing the active step, obtain a fresh snapshot, rerun all checks, and send
75
+ `action: "resume"` with checks and an explanation, then checkpoint the step.
76
+ Restore an accidental scope escape without discarding someone else's work;
77
+ otherwise create a new diagnosis with an explicitly reviewed scope.
78
+ 5. Begin the next step only after the preceding checkpoint is accepted.
79
+
80
+ ## Verify
81
+
82
+ After every step is checked, the run enters Verify. Compare before/after
83
+ complexity, callers, public API, test results, and the actual diff. Get a snapshot,
84
+ run final checks, then submit `action: "complete"` with `revision`, `snapshot`,
85
+ `agent_id`, `checks`, and the comparison in `note`. State what remains unproven.
86
+
87
+ The Quality page shows saved stages, agent, scope, current tracked-file diff,
88
+ failed checks, and the final comparison. Closing the browser does not discard the
89
+ run. Use `pause` with a reason whenever the next safe step needs a decision.
@@ -23,6 +23,10 @@ user-invocable: true
23
23
 
24
24
  ## Overview
25
25
 
26
+ For an executable sequence with persisted progress and checks between edits, use
27
+ `memtrace-guided-refactor`. This guide remains the broader prioritization and
28
+ planning workflow; a guided run carries an approved bounded plan into execution.
29
+
26
30
  Guided refactoring workflow — identifies refactoring candidates using structural analysis, scores them by risk and priority, checks Cortex decision memory for rationale/bans/contracts, and produces a phased refactoring plan. Combines complexity metrics, dead code detection, bridge analysis, temporal evolution, and decision memory to prioritize what to refactor first and how to do it safely.
27
31
 
28
32
  ## Steps
@@ -14,6 +14,10 @@ user-invocable: true
14
14
 
15
15
  ## Overview
16
16
 
17
+ ### Choose the scope
18
+
19
+ Use this entry to resume from a saved session anchor. For the fixed last-24-hour briefing, hotspots, or a session self-audit, use `memtrace-daily`. Preserve the requested time window instead of treating both workflows as the same catch-up.
20
+
17
21
  Session continuity for agents. Store a timestamp from your last session and call `get_changes_since` to see exactly what happened since then — then drill into details with `get_evolution` if needed.
18
22
 
19
23
  **Core principle:** Persist a `since` timestamp (or the `until` from your last catch-up call). Never invent a `days` parameter.