memtrace-skills 0.8.2 → 0.8.4

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 (37) hide show
  1. package/dist/commands/doctor.js +11 -0
  2. package/dist/index.js +1 -1
  3. package/dist/rail-install.js +4 -15
  4. package/dist/transformers/codex.js +7 -80
  5. package/dist/transformers/index.d.ts +2 -1
  6. package/dist/transformers/index.js +3 -1
  7. package/dist/transformers/opencode.js +5 -21
  8. package/dist/transformers/rail-hooks.d.ts +13 -0
  9. package/dist/transformers/rail-hooks.js +50 -0
  10. package/dist/transformers/types.d.ts +1 -1
  11. package/dist/transformers/warp.d.ts +4 -0
  12. package/dist/transformers/warp.js +83 -0
  13. package/package.json +1 -1
  14. package/plugins/memtrace-skills/.claude-plugin/plugin.json +1 -1
  15. package/plugins/memtrace-skills/references/mcp-parameters.md +7 -4
  16. package/plugins/memtrace-skills/skills/memtrace-change-impact-analysis/SKILL.md +19 -7
  17. package/plugins/memtrace-skills/skills/memtrace-decision-memory/SKILL.md +16 -12
  18. package/plugins/memtrace-skills/skills/memtrace-decision-recall/SKILL.md +7 -4
  19. package/plugins/memtrace-skills/skills/memtrace-docs/SKILL.md +121 -0
  20. package/plugins/memtrace-skills/skills/memtrace-docs-ask/SKILL.md +91 -0
  21. package/plugins/memtrace-skills/skills/memtrace-docs-read/SKILL.md +84 -0
  22. package/plugins/memtrace-skills/skills/memtrace-docs-search/SKILL.md +87 -0
  23. package/plugins/memtrace-skills/skills/memtrace-first/SKILL.md +21 -3
  24. package/plugins/memtrace-skills/skills/memtrace-preflight/SKILL.md +14 -1
  25. package/plugins/memtrace-skills/skills/memtrace-provenance/SKILL.md +7 -4
  26. package/plugins/memtrace-skills/skills/memtrace-refactoring-guide/SKILL.md +21 -9
  27. package/skills/commands/memtrace-decision-recall.md +7 -4
  28. package/skills/commands/memtrace-docs-ask.md +99 -0
  29. package/skills/commands/memtrace-docs-read.md +91 -0
  30. package/skills/commands/memtrace-docs-search.md +94 -0
  31. package/skills/commands/memtrace-preflight.md +17 -1
  32. package/skills/commands/memtrace-provenance.md +7 -4
  33. package/skills/workflows/memtrace-change-impact-analysis.md +23 -7
  34. package/skills/workflows/memtrace-decision-memory.md +16 -12
  35. package/skills/workflows/memtrace-docs.md +129 -0
  36. package/skills/workflows/memtrace-first.md +25 -3
  37. package/skills/workflows/memtrace-refactoring-guide.md +25 -9
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: memtrace-refactoring-guide
3
- description: "Build a phased, risk-scored refactoring plan from Memtrace complexity, dead-code, bridge, and impact analysis. Use when the user wants to refactor source code, reduce complexity, clean technical debt, split large functions, extract modules, reorganize code, or choose refactoring priorities. Do not use Grep or manual reference search to plan refactors; Memtrace provides complexity, dead-code, relationships, and impact context."
3
+ description: "Build a phased, risk-scored refactoring plan from Memtrace complexity, dead-code, bridge, impact analysis, and Cortex decision-memory constraints. Use when the user wants to refactor source code, reduce complexity, clean technical debt, delete dead code, split large functions, extract modules, reorganize code, or choose refactoring priorities. Do not plan refactors from grep/manual reference search alone; check graph impact and decision rationale/bans/contracts before changing existing code."
4
4
  ---
5
5
 
6
6
  ## Overview
7
7
 
8
- Guided refactoring workflow — identifies refactoring candidates using structural analysis, scores them by risk and priority, and produces a phased refactoring plan. Combines complexity metrics, dead code detection, bridge analysis, and temporal evolution to prioritize what to refactor first and how to do it safely.
8
+ 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.
9
9
 
10
10
  ## Steps
11
11
 
@@ -49,7 +49,17 @@ Also call `get_symbol_context` to check:
49
49
  - How many processes does this symbol participate in? (More = more testing needed)
50
50
  - Is it part of a cross-repo API? (If yes, coordinate with consumers)
51
51
 
52
- ### 4. Understand the neighbourhood
52
+ ### 4. Check decision memory before refactoring/removing
53
+
54
+ For each top candidate, call `recall_decision("<symbol/subsystem/refactor intent>")`.
55
+ If you have a numeric `symbol_id`, call `why_is_this_here(symbol_id)` and
56
+ `governing_contracts(symbol_id)`.
57
+
58
+ - A matching held decision/ban can veto or reshape the refactor.
59
+ - Contracts become acceptance criteria for the new design.
60
+ - CannotProve is unknown, not permission to delete.
61
+
62
+ ### 5. Understand the neighbourhood
53
63
 
54
64
  For each refactoring target, call `analyze_relationships`:
55
65
  - `find_callees` — what does it depend on? These become candidates for extraction
@@ -58,13 +68,13 @@ For each refactoring target, call `analyze_relationships`:
58
68
 
59
69
  Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bundled at the memtrace-skills plugin root).
60
70
 
61
- ### 5. Check community boundaries
71
+ ### 6. Check community boundaries
62
72
 
63
73
  Call `list_communities` and check: does the refactoring target sit at a community boundary?
64
74
  - If yes, the refactoring may involve splitting responsibilities across modules
65
75
  - If it belongs clearly to one community, the refactoring is more contained
66
76
 
67
- ### 6. Produce the refactoring plan
77
+ ### 7. Produce the refactoring plan
68
78
 
69
79
  Synthesize into a phased plan:
70
80
 
@@ -84,8 +94,9 @@ For each item, include:
84
94
  1. **Target** — function/class name, file, current complexity score
85
95
  2. **Why** — complexity + volatility + blast radius rationale
86
96
  3. **How** — specific refactoring approach (extract method, split class, introduce interface)
87
- 4. **Risk** — impact analysis rating + affected processes
88
- 5. **Test Plan** — which callers/processes to verify
97
+ 4. **Decision Memory** — relevant Cortex decisions/bans/contracts, or CannotProve as unknown
98
+ 5. **Risk** — impact analysis rating + affected processes
99
+ 6. **Test Plan** — which callers/processes to verify
89
100
 
90
101
  ## Decision Points
91
102
 
@@ -93,9 +104,10 @@ For each item, include:
93
104
  |-----------|--------|
94
105
  | Complex + volatile + high blast radius | Highest priority — but plan carefully; incremental approach |
95
106
  | Complex + stable + low blast radius | Can wait; refactor when you're already touching nearby code |
96
- | Dead code with zero callers | Safe to delete quick win |
107
+ | Dead code with zero callers | Run Cortex provenance/recall first; zero callers is not proof that no decision/contract keeps it |
97
108
  | Bridge symbol with many dependents | Extract interface first, then refactor implementation behind it |
98
109
  | Symbol in cross-repo API | Coordinate with consumers; backward-compatible changes only |
110
+ | Cortex returns a held ban/contract | Preserve it or ask before overriding it |
99
111
 
100
112
  ## Output
101
113
 
@@ -109,7 +121,7 @@ A phased plan (Phases 1–3). One worked entry:
109
121
  | Risk | High — upstream spans 3 processes incl. `checkout_flow`; incremental migration |
110
122
 
111
123
  Acceptance criteria:
112
- - Every plan item cites complexity, volatility, and blast radius — no gut-feel picks.
124
+ - Every plan item cites complexity, volatility, blast radius, and decision-memory status — no gut-feel picks.
113
125
  - High/Critical-risk items include a test plan naming affected callers/processes.
114
126
 
115
127
  ## Common Mistakes
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: memtrace-decision-recall
3
- description: "Recall ranked decisions, bans, and conventions from Cortex decision memory by free-text query. Use when the user asks what was decided, what was chosen or rejected, whether there's a convention/ban/policy on something, or before re-picking a library, pattern, or approach that may already be settled. Do not reconstruct past decisions from git log or guesswork. To verify whether a known decision held, use memtrace-intent-verification; for symbol-scoped decision lineage/contracts, use memtrace-provenance."
3
+ description: "Recall ranked decisions, bans, and conventions from Cortex decision memory by free-text query through the normal Memtrace MCP server. Use when the user asks what was decided/chosen/rejected, whether there is a convention/ban/policy, and before any non-trivial edit/refactor/delete or re-picking a library, pattern, architecture, or subsystem behavior that may already be settled. Do not reconstruct decisions from git log or guesswork. To verify whether a known decision held, use memtrace-intent-verification; for symbol lineage/contracts, use memtrace-provenance."
4
4
  allowed-tools:
5
5
  - mcp__memtrace__recall_decision
6
6
  - mcp__memtrace__verify_intent
@@ -16,7 +16,8 @@ metadata:
16
16
  `recall_decision` is the **free-text entry point** to decision memory. Given a query,
17
17
  it returns the statistically-ranked set of decisions/conversations that bear on it —
18
18
  including **bans** ("never use X", "don't do Y"), which are recorded as decisions.
19
- Use it before re-litigating a settled choice or contradicting a convention.
19
+ Use it before re-litigating a settled choice, changing existing behavior, or
20
+ contradicting a convention.
20
21
 
21
22
  This is the one decision-memory tool that takes plain text. The ranked decisions it
22
23
  returns carry the `decision_id`s the other tools (`verify_intent`, `get_arc`) need.
@@ -41,7 +42,8 @@ Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bun
41
42
 
42
43
  `recall_decision(query)` — `query` is free text. Use the noun phrase of the thing in
43
44
  question: a library (`"redis vs in-memory cache"`), a pattern (`"error handling
44
- strategy"`), a subsystem (`"auth tokens"`), or the exact thing you're about to do.
45
+ strategy"`), a subsystem (`"auth tokens"`), a symbol, or the exact edit/refactor/delete
46
+ you are about to do.
45
47
 
46
48
  ### 2. Read the ranked result
47
49
 
@@ -71,7 +73,8 @@ require a Decision node and will honestly return CannotProve. See
71
73
 
72
74
  | Situation | Action |
73
75
  |-----------|--------|
74
- | About to choose a library/pattern/approach | `recall_decision` FIRST — you may be undoing a deliberate choice or ban |
76
+ | About to edit/refactor/delete existing code where intent may matter | `recall_decision("<symbol/subsystem/behavior>")` FIRST — you may be crossing a recorded decision, ban, or convention |
77
+ | About to choose or replace a library/pattern/architecture | `recall_decision` FIRST — you may be undoing a deliberate choice or ban |
75
78
  | User asks "did we decide X?" / "what's our convention on Y?" | `recall_decision("X" / "Y")` |
76
79
  | You suspect a "don't do this" rule exists | `recall_decision` — bans are decisions and will surface |
77
80
  | Recall returns a decision you're about to contradict | Surface it to the user verbatim; don't silently override |
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: memtrace-docs-ask
3
+ description: "Answer questions from official Memtrace documentation only — installation, CLI, MCP tools, fleet, Cortex, enterprise MemDB deploy, skills, configuration. Use when the user asks how Memtrace works or wants a cited explanation. Calls ask_docs on memtrace.io (RAG + guardrails). Do not guess product behavior from training data."
4
+ allowed-tools:
5
+ - mcp__memtrace__ask_docs
6
+ - mcp__memtrace__search_docs
7
+ - mcp__memtrace__read_doc
8
+ metadata:
9
+ author: "Syncable <support@syncable.dev>"
10
+ version: "1.0.0"
11
+ category: development
12
+ ---
13
+
14
+ ## Overview
15
+
16
+ `ask_docs` sends the user's question to the hosted docs RAG backend. The server
17
+ retrieves relevant doc chunks, generates an answer **only from that context**, and
18
+ returns citations. Off-topic or ungrounded questions return `refused: true`.
19
+
20
+ This is the **default** tool for "how does Memtrace X work?" questions.
21
+
22
+ Umbrella routing: `memtrace-docs` workflow.
23
+
24
+ ## `ask_docs` parameters
25
+
26
+ | Param | Required | Notes |
27
+ |---|---|---|
28
+ | `question` | yes | Pass the user's question verbatim when possible |
29
+
30
+ ```json
31
+ { "question": "How do I deploy MemDB with Docker Compose?" }
32
+ ```
33
+
34
+ ## Response shape
35
+
36
+ ```json
37
+ {
38
+ "ok": true,
39
+ "answer": "…markdown with /docs/… links…",
40
+ "citations": ["enterprise/memdb-deploy", "cli/connect"],
41
+ "refused": false
42
+ }
43
+ ```
44
+
45
+ | Field | Meaning |
46
+ |---|---|
47
+ | `answer` | Grounded response text |
48
+ | `citations` | Doc slugs used as context |
49
+ | `refused` | `true` when no context or injection detected |
50
+ | `refusalReason` | `no_context` or `injection` when refused |
51
+
52
+ ## Steps
53
+
54
+ ### 1. Ask
55
+
56
+ Use the user's exact wording when it is already a clear question:
57
+
58
+ ```json
59
+ { "question": "What MCP tools are available?" }
60
+ ```
61
+
62
+ ### 2. Handle refusal
63
+
64
+ If `refused: true` with `no_context`:
65
+
66
+ 1. Retry `search_docs` with shorter keywords
67
+ 2. `read_doc` on the best slug
68
+ 3. If still empty — tell the user docs did not cover it; do not invent
69
+
70
+ ### 3. Deepen with read_doc
71
+
72
+ When the user needs exhaustive tables (e.g. all MCP tools):
73
+
74
+ ```json
75
+ { "slug": "mcp/tools" }
76
+ ```
77
+
78
+ After `ask_docs` gave a summary.
79
+
80
+ ## Example questions → ask_docs
81
+
82
+ | User asks | ask_docs question |
83
+ |---|---|
84
+ | How to install Memtrace? | `"How do I install Memtrace?"` |
85
+ | What is Rail? | `"What is Memtrace Rail and how do I enable it?"` |
86
+ | Enterprise MemDB on Azure | `"How do I deploy self-hosted MemDB on Azure?"` |
87
+ | How to connect local memtrace to shared MemDB | `"How do engineers connect with memtrace connect?"` |
88
+ | What skills exist? | `"What agent skills does Memtrace ship?"` |
89
+
90
+ ## Privacy note
91
+
92
+ `ask_docs` sends the **question string** to memtrace.io, which runs retrieval and
93
+ calls a hosted LLM (DeepSeek) server-side. No repo source code is transmitted.
94
+ Do not paste secrets into questions.
95
+
96
+ ## Offline behavior
97
+
98
+ `ok: false` → network or API error. Quote the `error` and `hint` fields; suggest
99
+ checking connectivity or `MEMTRACE_DOCS_API_URL`.
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: memtrace-docs-read
3
+ description: "Read the full plain-text body of an official Memtrace docs page by slug. Use when you know the page path (from search_docs, ask_docs citations, or user link) and need complete content — CLI reference, enterprise deploy guide, MCP tool tables. Calls read_doc or memtrace://docs/* resources on memtrace.io."
4
+ allowed-tools:
5
+ - mcp__memtrace__read_doc
6
+ - mcp__memtrace__search_docs
7
+ metadata:
8
+ author: "Syncable <support@syncable.dev>"
9
+ version: "1.0.0"
10
+ category: development
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ `read_doc` fetches the full rendered text of one docs page. Use after `search_docs`
16
+ or `ask_docs` when excerpts are not enough — long flag tables, deploy runbooks,
17
+ MCP tool inventories.
18
+
19
+ Alternative: MCP resource `memtrace://docs/<slug>` via `read_resource` if your
20
+ client prefers resources over tools.
21
+
22
+ Umbrella routing: `memtrace-docs` workflow.
23
+
24
+ ## `read_doc` parameters
25
+
26
+ | Param | Required | Notes |
27
+ |---|---|---|
28
+ | `slug` | yes | Path without `/docs/` prefix |
29
+
30
+ ```json
31
+ { "slug": "enterprise/memdb-deploy" }
32
+ ```
33
+
34
+ Valid examples:
35
+
36
+ - `getting-started`
37
+ - `cli/start`
38
+ - `mcp/tools`
39
+ - `enterprise/connect`
40
+ - `cli/rail` (hidden from sidebar but indexed)
41
+
42
+ ## Response shape
43
+
44
+ ```json
45
+ {
46
+ "ok": true,
47
+ "slug": "enterprise/memdb-deploy",
48
+ "title": "Deploy MemDB",
49
+ "body": "…full plain text…"
50
+ }
51
+ ```
52
+
53
+ ## Steps
54
+
55
+ ### 1. Resolve slug
56
+
57
+ From user URL `https://memtrace.io/docs/cli/connect` → slug `cli/connect`.
58
+
59
+ From `ask_docs` citations array → use slug directly.
60
+
61
+ From unknown topic → `search_docs` first, then `read_doc` on top hit.
62
+
63
+ ### 2. Read and summarize
64
+
65
+ Read the `body`, answer the user, keep `/docs/<slug>` links when citing.
66
+
67
+ ### 3. Multi-page topics
68
+
69
+ Enterprise deploy + engineer connect:
70
+
71
+ ```json
72
+ { "slug": "enterprise/memdb-deploy" }
73
+ ```
74
+
75
+ then
76
+
77
+ ```json
78
+ { "slug": "enterprise/connect" }
79
+ ```
80
+
81
+ ## When NOT to use read_doc
82
+
83
+ | Situation | Use instead |
84
+ |---|---|
85
+ | User asked a natural-language question | `ask_docs` first |
86
+ | You don't know which page | `search_docs` first |
87
+ | User's **source code** in their repo | `memtrace-search` / `memtrace-first` |
88
+
89
+ ## Offline behavior
90
+
91
+ `ok: false` → docs API unreachable. Do not substitute local README guesses.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: memtrace-docs-search
3
+ description: "Search official Memtrace documentation with semantic full-text search. Use when the user wants to find doc pages, locate a guide, or discover which docs cover a topic (fleet, MCP, CLI, enterprise MemDB, skills). Calls search_docs on memtrace.io. Do not grep local files or web-search for Memtrace product docs."
4
+ allowed-tools:
5
+ - mcp__memtrace__search_docs
6
+ - mcp__memtrace__read_doc
7
+ metadata:
8
+ author: "Syncable <support@syncable.dev>"
9
+ version: "1.0.0"
10
+ category: development
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ `search_docs` queries the hosted Memtrace docs corpus (same index as memtrace.io/docs
16
+ and the Ask AI widget). Returns ranked **chunks** — not full pages. Follow with
17
+ `read_doc` when you need the complete page.
18
+
19
+ Umbrella routing: `memtrace-docs` workflow.
20
+
21
+ ## Quick Reference
22
+
23
+ | Tool | Best for |
24
+ |------|----------|
25
+ | `search_docs` | Find which doc pages/sections match a topic |
26
+ | `read_doc` | Load full page text after search hits |
27
+
28
+ ## `search_docs` parameters
29
+
30
+ | Param | Required | Default | Notes |
31
+ |---|---|---|---|
32
+ | `query` | yes | — | Natural-language search string |
33
+ | `limit` | no | 8 | Max chunks to return |
34
+
35
+ ```json
36
+ { "query": "deploy MemDB helm azure", "limit": 8 }
37
+ ```
38
+
39
+ ## Steps
40
+
41
+ ### 1. Search
42
+
43
+ ```json
44
+ { "query": "memtrace rail enable hook", "limit": 6 }
45
+ ```
46
+
47
+ ### 2. Inspect results
48
+
49
+ Each hit includes:
50
+
51
+ ```json
52
+ {
53
+ "slug": "cli/rail",
54
+ "pageTitle": "memtrace rail & route",
55
+ "h2Title": "Subcommands",
56
+ "h2Id": "enable-sub",
57
+ "excerpt": "…",
58
+ "distance": 0.12
59
+ }
60
+ ```
61
+
62
+ Lower `distance` ≈ better match.
63
+
64
+ ### 3. Read full pages when needed
65
+
66
+ ```json
67
+ { "slug": "cli/rail" }
68
+ ```
69
+
70
+ Slug uses forward slashes: `enterprise/memdb-deploy`, `mcp/tools`, `getting-started`.
71
+
72
+ ## Common slugs
73
+
74
+ | Topic | Slug |
75
+ |---|---|
76
+ | Getting started | `getting-started` |
77
+ | MCP tools list | `mcp/tools` |
78
+ | MCP docs tools | `mcp/docs-tools` |
79
+ | Agent skills | `mcp/skills` |
80
+ | Deploy MemDB (enterprise) | `enterprise/memdb-deploy` |
81
+ | Connect to shared MemDB | `enterprise/connect` |
82
+ | memtrace connect CLI | `cli/connect` |
83
+ | Rail | `cli/rail` |
84
+
85
+ ## Offline behavior
86
+
87
+ If `ok: false`, the docs API is unreachable. Report the error; do not fall back to
88
+ hallucinated documentation. Local code-graph tools are unaffected.
89
+
90
+ ## Hand off
91
+
92
+ - Natural-language "how do I…" → `memtrace-docs-ask` (`ask_docs`) instead
93
+ - Found the right slug → `memtrace-docs-read` (`read_doc`)
94
+ - User's **source code** → `memtrace-first` / `memtrace-search` (different corpus)
@@ -1,10 +1,13 @@
1
1
  ---
2
2
  name: memtrace-preflight
3
- description: "Run a one-call pre-flight check on a single existing symbol before editing it: blast radius (who depends on it), co-change partners (files that historically change with it), complexity, 30-day churn, and a generated verification checklist. Use before modifying any existing function or symbol you did not just write. Do not start editing a non-trivial existing function without a pre-flight check; Memtrace knows the dependency graph and change history. For a full multi-symbol change plan or what-will-break analysis, use memtrace-change-impact-analysis."
3
+ description: "Run a one-call pre-flight check on a single existing symbol before editing it: blast radius, co-change partners, complexity, 30-day churn, and verification checklist, then check Cortex decision memory for rationale/bans when intent may matter. Use before modifying any existing function or symbol you did not just write. Do not start editing a non-trivial existing function without pre-flight plus decision-memory recall/provenance; Memtrace knows the dependency graph, change history, and recorded decisions."
4
4
  allowed-tools:
5
5
  - mcp__memtrace__preflight_check
6
6
  - mcp__memtrace__get_impact
7
7
  - mcp__memtrace__get_cochange_context
8
+ - mcp__memtrace__recall_decision
9
+ - mcp__memtrace__why_is_this_here
10
+ - mcp__memtrace__governing_contracts
8
11
  metadata:
9
12
  author: "Syncable <support@syncable.dev>"
10
13
  version: "1.0.0"
@@ -26,6 +29,8 @@ symbol.
26
29
  | `preflight_check` | Full radar for one symbol: blast radius + co-change + churn + checklist |
27
30
  | `get_impact` | Deeper blast-radius walk when the radar flags HIGH/CRITICAL |
28
31
  | `get_cochange_context` | Wider co-change window when partners look surprising |
32
+ | `recall_decision` | Recorded choices, bans, and conventions for the symbol/subsystem/behavior |
33
+ | `why_is_this_here` / `governing_contracts` | Symbol-scoped rationale and constraints when a symbol id is available |
29
34
 
30
35
  > **Parameter types:** MCP parameters are strictly typed. Numbers must be
31
36
 
@@ -65,12 +70,23 @@ frequent partner, say so explicitly and why.
65
70
  - The complexity number should not have grown without a stated reason;
66
71
  if it did, simplify before declaring the work done.
67
72
 
73
+ ### Cortex gate before editing
74
+
75
+ Before changing behavior, deleting code, or refactoring odd/legacy code:
76
+
77
+ 1. Run `recall_decision("<symbol/subsystem/behavior>")`.
78
+ 2. If the preflight/graph result gives you a numeric `symbol_id`, run
79
+ `why_is_this_here(symbol_id)` and `governing_contracts(symbol_id)`.
80
+ 3. Honor matching held decisions/bans. Treat CannotProve as unknown, not approval.
81
+
68
82
  ## Verdict guidance
69
83
 
70
84
  - `risk: CRITICAL/HIGH` — propose the change plan before editing; consider
71
85
  a feature flag or staged rollout.
72
86
  - `dependents: 0` — edit freely; note the symbol may be newly added or an
73
87
  entry point.
88
+ - A matching Cortex decision/ban — surface it before editing and do not
89
+ contradict it without explicit user sign-off.
74
90
 
75
91
  ## Output
76
92
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: memtrace-provenance
3
- description: "Retrieve the governing decision lineage (why is this here) and the contracts that bind a symbol, from Cortex decision memory. Use before deleting, rewriting, or 'cleaning up' code that looks unused, odd, or redundant, and when the user asks why a symbol exists or what rules constrain it. Symbol-scoped; for free-text decision search use memtrace-decision-recall. Do not infer intent from the diff or assume unfamiliar code is safe to remove."
3
+ description: "Retrieve the governing decision lineage (why is this here) and contracts that bind a symbol from Cortex decision memory through the normal Memtrace MCP server. Use before deleting, rewriting, refactoring, or 'cleaning up' existing code that looks unused, odd, redundant, legacy, or policy-sensitive, and when the user asks why a symbol exists or what rules constrain it. Symbol-scoped; for free-text decision search use memtrace-decision-recall first. Do not infer intent from the diff or assume unfamiliar code is safe to remove."
4
4
  allowed-tools:
5
5
  - mcp__memtrace__why_is_this_here
6
6
  - mcp__memtrace__governing_contracts
@@ -46,7 +46,10 @@ Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bun
46
46
  ### 1. Get the symbol_id
47
47
 
48
48
  If you have a name or a "why" question, run `recall_decision(...)` first and take the
49
- `symbol_id` from the result (or the Cortex view). The id-based tools need a numeric id.
49
+ `symbol_id` from the result if present, or use the id returned by a graph/Cortex view.
50
+ The id-based tools need a numeric id. If you cannot get a symbol id, do not skip
51
+ decision memory entirely: use `recall_decision("<symbol/subsystem/behavior>")` and
52
+ report any matching decision/bans before changing the code.
50
53
 
51
54
  ### 2. Ask why it's here
52
55
 
@@ -71,8 +74,8 @@ was superseded via `recall_decision`) changes whether the code should still look
71
74
  | Situation | Action |
72
75
  |-----------|--------|
73
76
  | Code looks unused/dead and you want to delete it | `why_is_this_here` + `governing_contracts` BEFORE deleting; CannotProve is not a green light |
74
- | Code is written in a strange/non-obvious way | `why_is_this_here` there's likely a decision explaining the oddity |
75
- | About to refactor a symbol's internals | `governing_contracts` — preserve every constraint, not just the test surface |
77
+ | Code is written in a strange/non-obvious way | `why_is_this_here` if you have a symbol id; otherwise `recall_decision` for the symbol/subsystem |
78
+ | About to refactor a symbol's internals | `why_is_this_here` + `governing_contracts` — preserve the rationale and every constraint, not just the test surface |
76
79
  | User asks "why is this here?" | `why_is_this_here(symbol_id)`; if you only have a name, `recall_decision` first |
77
80
  | All provenance returns CannotProve | Treat as unknown; combine with `memtrace-impact` (blast radius) and ask the user before removing |
78
81
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: memtrace-change-impact-analysis
3
- description: "Compute what a planned source-code change will break — blast radius, affected processes, cross-repo callers — and produce a risk-rated change plan. Use when the user needs to know what will break before a change: edits, refactors, API changes, renames, removals, PR reviews, or risk assessments. Do not manually grep references or browse files for impact; this workflow uses Memtrace graph context, impact, and change history. For a quick blast-radius check on one symbol, use memtrace-impact."
3
+ description: "Compute what a planned source-code change will break — blast radius, affected processes, cross-repo callers, temporal stability, and Cortex decision-memory constraints — and produce a risk-rated change plan. Use before edits, refactors, API changes, renames, removals, PR reviews, or risk assessments, especially when changing established behavior or deleting code. Do not manually grep references or browse files for impact; use Memtrace graph context, change history, and decision recall/provenance."
4
4
  allowed-tools:
5
5
  - mcp__memtrace__find_symbol
6
6
  - mcp__memtrace__find_code
@@ -9,6 +9,10 @@ allowed-tools:
9
9
  - mcp__memtrace__get_evolution
10
10
  - mcp__memtrace__get_timeline
11
11
  - mcp__memtrace__analyze_relationships
12
+ - mcp__memtrace__recall_decision
13
+ - mcp__memtrace__why_is_this_here
14
+ - mcp__memtrace__governing_contracts
15
+ - mcp__memtrace__verify_intent
12
16
  metadata:
13
17
  author: "Syncable <support@syncable.dev>"
14
18
  version: "1.0.0"
@@ -18,7 +22,7 @@ user-invocable: true
18
22
 
19
23
  ## Overview
20
24
 
21
- Pre-change risk assessment workflow. Before modifying code, this workflow maps the full blast radius, identifies affected processes, checks recent change history for instability signals, and produces a risk-rated change plan.
25
+ Pre-change risk assessment workflow. Before modifying code, this workflow maps the full blast radius, identifies affected processes, checks recent change history for instability signals, checks Cortex decision memory for recorded decisions/bans/contracts, and produces a risk-rated change plan.
22
26
 
23
27
  ## Steps
24
28
 
@@ -55,20 +59,30 @@ For each target, call `get_impact` (`repo_id`, `target`) with `direction: "both"
55
59
  | High | Plan incremental migration; consider feature flags |
56
60
  | Critical | Full migration strategy; backward-compatible changes required |
57
61
 
58
- ### 4. Check temporal stability
62
+ ### 4. Check Cortex decision memory
63
+
64
+ For each target or subsystem, call `recall_decision("<target/subsystem/approach>")`.
65
+ If the graph result exposes a numeric `symbol_id`, also call
66
+ `why_is_this_here(symbol_id)` and `governing_contracts(symbol_id)`.
67
+
68
+ - Matching decision/ban/convention → include it in the plan before recommending a change.
69
+ - Decision you intend to rely on → run `verify_intent(decision_id)` first.
70
+ - CannotProve → record "no decision proven"; do not treat it as approval.
71
+
72
+ ### 5. Check temporal stability
59
73
 
60
74
  Call `get_evolution` (`repo_id`, `from: "30d ago"`, `mode: "compound"`), then `get_timeline` on each target symbol (requires `scope_path` + `file_path` from `find_symbol`):
61
75
  - Sparse timeline history + you're about to change it → structurally surprising; extra scrutiny warranted.
62
76
  - Target appears in `top_touched_symbols` → high churn + high impact = volatile hotspot.
63
77
 
64
- ### 5. Map affected execution flows
78
+ ### 6. Map affected execution flows
65
79
 
66
80
  From step 2, you already know which processes are affected. For critical changes, use `analyze_relationships` (`repo_id`, `target`) with `query_type: "find_callers"` at `depth: 3` to trace the full transitive caller chain.
67
81
 
68
82
  `depth: 3` is a JSON number, not a string — the validator rejects `"3"`.
69
83
  Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bundled at the memtrace-skills plugin root).
70
84
 
71
- ### 6. Produce the risk assessment
85
+ ### 7. Produce the risk assessment
72
86
 
73
87
  Synthesize into a change plan:
74
88
 
@@ -77,8 +91,9 @@ Synthesize into a change plan:
77
91
  3. **Affected Processes** — which execution flows will be impacted
78
92
  4. **Cross-Service Impact** — any external callers or consumers
79
93
  5. **Stability Signal** — sparse `get_timeline` history (stable) vs frequent appearance in `top_touched_symbols` (volatile)
80
- 6. **Recommended Approach** — based on risk: direct change, incremental migration, or backward-compatible evolution
81
- 7. **Test Coverage** — which callers/processes to verify after the change
94
+ 6. **Decision Memory** — relevant decisions/bans/contracts, or CannotProve as unknown
95
+ 7. **Recommended Approach** — based on risk and decision constraints: direct change, incremental migration, or backward-compatible evolution
96
+ 8. **Test Coverage** — which callers/processes to verify after the change
82
97
 
83
98
  ## Decision Points
84
99
 
@@ -89,6 +104,7 @@ Synthesize into a change plan:
89
104
  | Symbol has sparse timeline but high impact | Extra review — this rarely changes; make sure the change is intentional |
90
105
  | Multiple processes affected | List each affected flow; recommend testing each one |
91
106
  | Symbol is a bridge point | Change may disconnect parts of the architecture — verify alternative paths exist |
107
+ | Cortex returns a held ban/contract | Do not recommend contradicting it without explicit user sign-off |
92
108
 
93
109
  ## Output
94
110
 
@@ -1,6 +1,6 @@
1
1
  ---
2
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."
3
+ description: "Check Cortex decision memory through the normal Memtrace MCP tools — the umbrella entry point for decision recall, provenance (why is this here), intent verification, and governing contracts. Use before assuming WHY code exists, before any non-trivial edit/refactor/delete of existing code, before re-picking a library/pattern/architecture, or before contradicting an apparent convention. Route: free-text decisions/bans/conventions → memtrace-decision-recall; symbol lineage/contracts → memtrace-provenance; did the decision hold → memtrace-intent-verification. Do not guess rationale from the diff or git log."
4
4
  allowed-tools:
5
5
  - mcp__memtrace__recall_decision
6
6
  - mcp__memtrace__why_is_this_here
@@ -52,12 +52,14 @@ These five tools are **deterministic, zero-LLM**. Every call returns a labeled
52
52
  `CannotProve` is a real, trustworthy answer ("memory has nothing on this"), not a
53
53
  failure and not a green light. Never invent a rationale to fill the gap.
54
54
 
55
- ## Server check (once per session)
55
+ ## Tool availability (once per session)
56
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.
57
+ These tools are exposed on the normal **`memtrace` MCP server**:
58
+ `recall_decision`, `why_is_this_here`, `verify_intent`, `get_arc`, and
59
+ `governing_contracts`. Hosts do not need a second MemCortex MCP connection. If a
60
+ tool call returns CannotProve because Cortex is unavailable (for example native
61
+ Windows without WSL2), say decision memory was unavailable/unknown and continue
62
+ with `memtrace-first`; do not fabricate decisions.
61
63
 
62
64
  ## The decision rule
63
65
 
@@ -65,9 +67,9 @@ don't fabricate decisions.
65
67
  |---|---|---|
66
68
  | "Did we already decide/choose/reject X?" "What's our convention on Y?" | `recall_decision("X")` | `memtrace-decision-recall` |
67
69
  | "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` |
70
+ | About to edit behavior, re-pick a library/pattern/architecture, or change a subsystem policy | `recall_decision` FIRST — don't re-litigate a settled call | `memtrace-decision-recall` |
69
71
  | "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` |
72
+ | About to delete/refactor/clean up existing code, especially odd or "dead" code | `why_is_this_here` + `governing_contracts` before touching it | `memtrace-provenance` |
71
73
  | "What rules/contracts constrain this symbol?" | `governing_contracts(symbol_id)` | `memtrace-provenance` |
72
74
  | "Did decision D actually hold, or did we drift?" | `verify_intent(decision_id)` | `memtrace-intent-verification` |
73
75
  | "What commits/episodes implemented decision D?" | `get_arc(decision_id)` | `memtrace-intent-verification` |
@@ -95,10 +97,11 @@ have a name or a free-text question, start with `recall_decision`.** Do not inve
95
97
  ## Standard workflows
96
98
 
97
99
  ### "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
100
+ 1. If you only have a name/free-text target, `recall_decision("<symbol/subsystem>")` first.
101
+ 2. If you have a `symbol_id`, `why_is_this_here(symbol_id)` → the governing decision, if any.
102
+ 3. `governing_contracts(symbol_id)` constraints that must survive a rewrite.
103
+ 4. If a decision governs it `verify_intent(decision_id)` to see if it still holds.
104
+ 5. **CannotProve on all checks ≠ safe to delete** — confirm with `memtrace-impact` (blast radius) and the user.
102
105
 
103
106
  ### "Should I do X?" (about to make a choice)
104
107
  1. `recall_decision("X")` → did we already decide or ban this?
@@ -114,6 +117,7 @@ have a name or a free-text question, start with `recall_decision`.** Do not inve
114
117
  | Thought | Reality |
115
118
  |---|---|
116
119
  | "This code looks unused, I'll delete it" | `why_is_this_here` first — a decision may govern it; deletion may reopen a closed issue |
120
+ | "I'll just edit/refactor this existing behavior" | `recall_decision("<behavior/subsystem>")` first — the change may violate a recorded decision or ban |
117
121
  | "I'll just use library/pattern X" | `recall_decision("X")` — you may be undoing a deliberate ban |
118
122
  | "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
123
  | "CannotProve, so it's fine/approved" | CannotProve = unknown, not approved. Don't treat absence of a record as permission. |