memtrace-skills 0.8.3 → 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,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
  ---
5
5
 
6
6
  ## Overview
@@ -8,7 +8,8 @@ description: "Recall ranked decisions, bans, and conventions from Cortex decisio
8
8
  `recall_decision` is the **free-text entry point** to decision memory. Given a query,
9
9
  it returns the statistically-ranked set of decisions/conversations that bear on it —
10
10
  including **bans** ("never use X", "don't do Y"), which are recorded as decisions.
11
- Use it before re-litigating a settled choice or contradicting a convention.
11
+ Use it before re-litigating a settled choice, changing existing behavior, or
12
+ contradicting a convention.
12
13
 
13
14
  This is the one decision-memory tool that takes plain text. The ranked decisions it
14
15
  returns carry the `decision_id`s the other tools (`verify_intent`, `get_arc`) need.
@@ -33,7 +34,8 @@ Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bun
33
34
 
34
35
  `recall_decision(query)` — `query` is free text. Use the noun phrase of the thing in
35
36
  question: a library (`"redis vs in-memory cache"`), a pattern (`"error handling
36
- strategy"`), a subsystem (`"auth tokens"`), or the exact thing you're about to do.
37
+ strategy"`), a subsystem (`"auth tokens"`), a symbol, or the exact edit/refactor/delete
38
+ you are about to do.
37
39
 
38
40
  ### 2. Read the ranked result
39
41
 
@@ -63,7 +65,8 @@ require a Decision node and will honestly return CannotProve. See
63
65
 
64
66
  | Situation | Action |
65
67
  |-----------|--------|
66
- | About to choose a library/pattern/approach | `recall_decision` FIRST — you may be undoing a deliberate choice or ban |
68
+ | 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 |
69
+ | About to choose or replace a library/pattern/architecture | `recall_decision` FIRST — you may be undoing a deliberate choice or ban |
67
70
  | User asks "did we decide X?" / "what's our convention on Y?" | `recall_decision("X" / "Y")` |
68
71
  | You suspect a "don't do this" rule exists | `recall_decision` — bans are decisions and will surface |
69
72
  | Recall returns a decision you're about to contradict | Surface it to the user verbatim; don't silently override |
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: memtrace-docs
3
+ description: "Route Memtrace product documentation questions to the hosted docs MCP tools before guessing, searching the web, or reading stale local copies. Use when the user asks how Memtrace works, how to install/configure CLI/MCP/fleet/Cortex/enterprise MemDB, what tools or skills exist, what a command does, or wants the agent to read up on official docs. Calls search_docs, ask_docs, or read_doc on memtrace.io (override with MEMTRACE_DOCS_API_URL). Do not hallucinate Memtrace behavior — query docs first. Separate from memtrace-first (your repo's code graph)."
4
+ ---
5
+
6
+ # Memtrace Docs First
7
+
8
+ ## The Iron Law
9
+
10
+ ```
11
+ IF THE USER ASKS ABOUT MEMTRACE PRODUCT DOCS → USE DOCS MCP TOOLS FIRST.
12
+ Do not guess CLI flags, MCP tool lists, enterprise deploy steps, or fleet rules
13
+ from memory. Query the hosted documentation corpus at memtrace.io (or
14
+ MEMTRACE_DOCS_API_URL), then answer with citations.
15
+
16
+ memtrace-first = your indexed SOURCE CODE (find_code, get_impact, …)
17
+ memtrace-docs = official MEMTRACE DOCUMENTATION (search_docs, ask_docs, read_doc)
18
+ ```
19
+
20
+ Docs tools call the **hosted** Memtrace docs API over HTTPS. They do **not** read
21
+ your local MemDB or your repo. Core graph tools stay offline; docs tools degrade
22
+ gracefully when the network is down (`ok: false` + hint).
23
+
24
+ ## Server check (once per session)
25
+
26
+ Confirm the docs tools are available on your `memtrace` MCP server:
27
+
28
+ - `search_docs` — ranked chunks (slug, title, H2, excerpt)
29
+ - `ask_docs` — grounded Q&A `{ answer, citations[], refused }`
30
+ - `read_doc` — full page text by slug
31
+ - Resources: `memtrace://docs/<slug>` via `read_resource` (optional)
32
+
33
+ If none of these exist, the MCP build may be outdated — tell the user to update
34
+ Memtrace and run `npx -y memtrace-skills@latest install`.
35
+
36
+ Override API host: `MEMTRACE_DOCS_API_URL` (default `https://memtrace.io`).
37
+
38
+ ## The decision rule
39
+
40
+ | User is asking | Right tool | Sub-skill |
41
+ |---|---|---|
42
+ | "How do I install / configure / deploy X in Memtrace?" | `ask_docs(question=…)` | `memtrace-docs-ask` |
43
+ | "What MCP tools / skills / CLI commands exist?" | `ask_docs` or `search_docs` then `read_doc` on hit slugs | `memtrace-docs-ask` / `memtrace-docs-search` |
44
+ | "What does `memtrace rail enable` do?" | `ask_docs` | `memtrace-docs-ask` |
45
+ | "Find docs about fleet coordination" | `search_docs(query=…)` | `memtrace-docs-search` |
46
+ | "Read the full getting-started page" | `read_doc(slug="getting-started")` | `memtrace-docs-read` |
47
+ | "Read enterprise MemDB deploy guide" | `read_doc(slug="enterprise/memdb-deploy")` | `memtrace-docs-read` |
48
+ | Need several related sections | `search_docs` → `read_doc` on top slugs | `memtrace-docs-search` + `memtrace-docs-read` |
49
+
50
+ **Default for natural-language questions:** `ask_docs` — it retrieves context and
51
+ returns a cited answer in one call.
52
+
53
+ **Default for "find the doc about…":** `search_docs` — scan chunks, then `read_doc`
54
+ if you need the full page.
55
+
56
+ ## Standard workflows
57
+
58
+ ### "How does X work in Memtrace?" (most common)
59
+
60
+ 1. `ask_docs(question="<user question verbatim>")`
61
+ 2. If `refused: true` or `ok: false` → `search_docs` with shorter keywords → `read_doc` on best slug
62
+ 3. Quote the answer; link slugs as `/docs/<slug>` when helpful
63
+ 4. If docs say "not found", say so — do not invent flags or behavior
64
+
65
+ ### "What tools / commands / skills are available?"
66
+
67
+ 1. `ask_docs(question="What MCP tools are available?")` or fleet/skills variant
68
+ 2. If the answer lists categories but user wants exhaustive detail → `read_doc(slug="mcp/tools")`
69
+ 3. For agent skills → `read_doc(slug="mcp/skills")`
70
+
71
+ ### "Read up on X before we implement"
72
+
73
+ 1. `search_docs(query="X", limit=8)`
74
+ 2. `read_doc(slug=<top hit>)` for each page you will rely on
75
+ 3. Summarize with citations; use `memtrace-first` only when switching to **their repo's code**
76
+
77
+ ### Enterprise / self-hosted MemDB
78
+
79
+ 1. `ask_docs(question="How do I deploy MemDB with Helm on Azure?")` or user wording
80
+ 2. Follow-up `read_doc(slug="enterprise/memdb-deploy")` for operator steps
81
+ 3. Engineer connect → `read_doc(slug="enterprise/connect")` or `cli/connect`
82
+
83
+ ## Red flags — STOP, use docs tools
84
+
85
+ | Thought | Reality |
86
+ |---|---|
87
+ | "I know how Memtrace fleet works from training data" | Product docs change — `ask_docs` first |
88
+ | "I'll grep the repo for README" | User repo ≠ official docs — use `search_docs` / `read_doc` |
89
+ | "I'll web-search Memtrace" | Use hosted docs API — same corpus as memtrace.io/docs |
90
+ | `ask_docs` returned `refused: true` | Docs corpus had no match — say so; try `search_docs` with different terms |
91
+ | `ok: false` network error | Report offline; core Memtrace graph tools still work locally |
92
+
93
+ ## Relationship to other skills
94
+
95
+ | Skill | When |
96
+ |---|---|
97
+ | `memtrace-docs` | Questions about **Memtrace product** (install, MCP, fleet, Cortex, enterprise) |
98
+ | `memtrace-first` | Questions about **the user's indexed source code** |
99
+ | `memtrace-decision-memory` | **Why** code exists (Cortex decisions) — not product docs |
100
+
101
+ Use both when needed: docs for "how is Memtrace supposed to work?", graph tools for
102
+ "how does *this repo* implement it?"
103
+
104
+ ## Output
105
+
106
+ Prefer citing doc slugs returned in `citations` or `search_docs` results:
107
+
108
+ ```
109
+ ask_docs → { ok: true, answer: "…", citations: ["cli/rail", "mcp/skills"], refused: false }
110
+ search_docs → { ok: true, results: [{ slug, pageTitle, h2Title, excerpt }] }
111
+ read_doc → { ok: true, slug, title, body }
112
+ ```
113
+
114
+ When `refused: true`, tell the user the docs did not cover it and suggest browsing
115
+ https://memtrace.io/docs or rephrasing.
116
+
117
+ ## Sub-skills
118
+
119
+ - Discovery / chunk search → `memtrace-docs-search`
120
+ - Grounded Q&A → `memtrace-docs-ask`
121
+ - Full page read → `memtrace-docs-read`
@@ -0,0 +1,91 @@
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
+ ---
5
+
6
+ ## Overview
7
+
8
+ `ask_docs` sends the user's question to the hosted docs RAG backend. The server
9
+ retrieves relevant doc chunks, generates an answer **only from that context**, and
10
+ returns citations. Off-topic or ungrounded questions return `refused: true`.
11
+
12
+ This is the **default** tool for "how does Memtrace X work?" questions.
13
+
14
+ Umbrella routing: `memtrace-docs` workflow.
15
+
16
+ ## `ask_docs` parameters
17
+
18
+ | Param | Required | Notes |
19
+ |---|---|---|
20
+ | `question` | yes | Pass the user's question verbatim when possible |
21
+
22
+ ```json
23
+ { "question": "How do I deploy MemDB with Docker Compose?" }
24
+ ```
25
+
26
+ ## Response shape
27
+
28
+ ```json
29
+ {
30
+ "ok": true,
31
+ "answer": "…markdown with /docs/… links…",
32
+ "citations": ["enterprise/memdb-deploy", "cli/connect"],
33
+ "refused": false
34
+ }
35
+ ```
36
+
37
+ | Field | Meaning |
38
+ |---|---|
39
+ | `answer` | Grounded response text |
40
+ | `citations` | Doc slugs used as context |
41
+ | `refused` | `true` when no context or injection detected |
42
+ | `refusalReason` | `no_context` or `injection` when refused |
43
+
44
+ ## Steps
45
+
46
+ ### 1. Ask
47
+
48
+ Use the user's exact wording when it is already a clear question:
49
+
50
+ ```json
51
+ { "question": "What MCP tools are available?" }
52
+ ```
53
+
54
+ ### 2. Handle refusal
55
+
56
+ If `refused: true` with `no_context`:
57
+
58
+ 1. Retry `search_docs` with shorter keywords
59
+ 2. `read_doc` on the best slug
60
+ 3. If still empty — tell the user docs did not cover it; do not invent
61
+
62
+ ### 3. Deepen with read_doc
63
+
64
+ When the user needs exhaustive tables (e.g. all MCP tools):
65
+
66
+ ```json
67
+ { "slug": "mcp/tools" }
68
+ ```
69
+
70
+ After `ask_docs` gave a summary.
71
+
72
+ ## Example questions → ask_docs
73
+
74
+ | User asks | ask_docs question |
75
+ |---|---|
76
+ | How to install Memtrace? | `"How do I install Memtrace?"` |
77
+ | What is Rail? | `"What is Memtrace Rail and how do I enable it?"` |
78
+ | Enterprise MemDB on Azure | `"How do I deploy self-hosted MemDB on Azure?"` |
79
+ | How to connect local memtrace to shared MemDB | `"How do engineers connect with memtrace connect?"` |
80
+ | What skills exist? | `"What agent skills does Memtrace ship?"` |
81
+
82
+ ## Privacy note
83
+
84
+ `ask_docs` sends the **question string** to memtrace.io, which runs retrieval and
85
+ calls a hosted LLM (DeepSeek) server-side. No repo source code is transmitted.
86
+ Do not paste secrets into questions.
87
+
88
+ ## Offline behavior
89
+
90
+ `ok: false` → network or API error. Quote the `error` and `hint` fields; suggest
91
+ checking connectivity or `MEMTRACE_DOCS_API_URL`.
@@ -0,0 +1,84 @@
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
+ ---
5
+
6
+ ## Overview
7
+
8
+ `read_doc` fetches the full rendered text of one docs page. Use after `search_docs`
9
+ or `ask_docs` when excerpts are not enough — long flag tables, deploy runbooks,
10
+ MCP tool inventories.
11
+
12
+ Alternative: MCP resource `memtrace://docs/<slug>` via `read_resource` if your
13
+ client prefers resources over tools.
14
+
15
+ Umbrella routing: `memtrace-docs` workflow.
16
+
17
+ ## `read_doc` parameters
18
+
19
+ | Param | Required | Notes |
20
+ |---|---|---|
21
+ | `slug` | yes | Path without `/docs/` prefix |
22
+
23
+ ```json
24
+ { "slug": "enterprise/memdb-deploy" }
25
+ ```
26
+
27
+ Valid examples:
28
+
29
+ - `getting-started`
30
+ - `cli/start`
31
+ - `mcp/tools`
32
+ - `enterprise/connect`
33
+ - `cli/rail` (hidden from sidebar but indexed)
34
+
35
+ ## Response shape
36
+
37
+ ```json
38
+ {
39
+ "ok": true,
40
+ "slug": "enterprise/memdb-deploy",
41
+ "title": "Deploy MemDB",
42
+ "body": "…full plain text…"
43
+ }
44
+ ```
45
+
46
+ ## Steps
47
+
48
+ ### 1. Resolve slug
49
+
50
+ From user URL `https://memtrace.io/docs/cli/connect` → slug `cli/connect`.
51
+
52
+ From `ask_docs` citations array → use slug directly.
53
+
54
+ From unknown topic → `search_docs` first, then `read_doc` on top hit.
55
+
56
+ ### 2. Read and summarize
57
+
58
+ Read the `body`, answer the user, keep `/docs/<slug>` links when citing.
59
+
60
+ ### 3. Multi-page topics
61
+
62
+ Enterprise deploy + engineer connect:
63
+
64
+ ```json
65
+ { "slug": "enterprise/memdb-deploy" }
66
+ ```
67
+
68
+ then
69
+
70
+ ```json
71
+ { "slug": "enterprise/connect" }
72
+ ```
73
+
74
+ ## When NOT to use read_doc
75
+
76
+ | Situation | Use instead |
77
+ |---|---|
78
+ | User asked a natural-language question | `ask_docs` first |
79
+ | You don't know which page | `search_docs` first |
80
+ | User's **source code** in their repo | `memtrace-search` / `memtrace-first` |
81
+
82
+ ## Offline behavior
83
+
84
+ `ok: false` → docs API unreachable. Do not substitute local README guesses.
@@ -0,0 +1,87 @@
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
+ ---
5
+
6
+ ## Overview
7
+
8
+ `search_docs` queries the hosted Memtrace docs corpus (same index as memtrace.io/docs
9
+ and the Ask AI widget). Returns ranked **chunks** — not full pages. Follow with
10
+ `read_doc` when you need the complete page.
11
+
12
+ Umbrella routing: `memtrace-docs` workflow.
13
+
14
+ ## Quick Reference
15
+
16
+ | Tool | Best for |
17
+ |------|----------|
18
+ | `search_docs` | Find which doc pages/sections match a topic |
19
+ | `read_doc` | Load full page text after search hits |
20
+
21
+ ## `search_docs` parameters
22
+
23
+ | Param | Required | Default | Notes |
24
+ |---|---|---|---|
25
+ | `query` | yes | — | Natural-language search string |
26
+ | `limit` | no | 8 | Max chunks to return |
27
+
28
+ ```json
29
+ { "query": "deploy MemDB helm azure", "limit": 8 }
30
+ ```
31
+
32
+ ## Steps
33
+
34
+ ### 1. Search
35
+
36
+ ```json
37
+ { "query": "memtrace rail enable hook", "limit": 6 }
38
+ ```
39
+
40
+ ### 2. Inspect results
41
+
42
+ Each hit includes:
43
+
44
+ ```json
45
+ {
46
+ "slug": "cli/rail",
47
+ "pageTitle": "memtrace rail & route",
48
+ "h2Title": "Subcommands",
49
+ "h2Id": "enable-sub",
50
+ "excerpt": "…",
51
+ "distance": 0.12
52
+ }
53
+ ```
54
+
55
+ Lower `distance` ≈ better match.
56
+
57
+ ### 3. Read full pages when needed
58
+
59
+ ```json
60
+ { "slug": "cli/rail" }
61
+ ```
62
+
63
+ Slug uses forward slashes: `enterprise/memdb-deploy`, `mcp/tools`, `getting-started`.
64
+
65
+ ## Common slugs
66
+
67
+ | Topic | Slug |
68
+ |---|---|
69
+ | Getting started | `getting-started` |
70
+ | MCP tools list | `mcp/tools` |
71
+ | MCP docs tools | `mcp/docs-tools` |
72
+ | Agent skills | `mcp/skills` |
73
+ | Deploy MemDB (enterprise) | `enterprise/memdb-deploy` |
74
+ | Connect to shared MemDB | `enterprise/connect` |
75
+ | memtrace connect CLI | `cli/connect` |
76
+ | Rail | `cli/rail` |
77
+
78
+ ## Offline behavior
79
+
80
+ If `ok: false`, the docs API is unreachable. Report the error; do not fall back to
81
+ hallucinated documentation. Local code-graph tools are unaffected.
82
+
83
+ ## Hand off
84
+
85
+ - Natural-language "how do I…" → `memtrace-docs-ask` (`ask_docs`) instead
86
+ - Found the right slug → `memtrace-docs-read` (`read_doc`)
87
+ - User's **source code** → `memtrace-first` / `memtrace-search` (different corpus)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: memtrace-first
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."
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/reindex with Memtrace."
4
4
  ---
5
5
 
6
6
  # Memtrace First
@@ -15,6 +15,12 @@ ONLY when you're about to edit or quote, and read only the bounded span
15
15
  returned by Memtrace (start_line .. end_line + small context). Do not
16
16
  Grep/Glob/Find to "locate" anything already in the graph, and do not read
17
17
  the whole file when Memtrace has given you exact lines.
18
+
19
+ BEFORE you edit/refactor/delete existing code or choose/re-pick a pattern,
20
+ call Cortex decision memory: recall_decision for the symbol/subsystem/approach,
21
+ and use provenance/contracts when a symbol_id is available. Use Memtrace's graph
22
+ tools for structure and blast radius; use Cortex for rationale, bans, and
23
+ contracts.
18
24
  ```
19
25
 
20
26
  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.
@@ -74,6 +80,8 @@ For everything else inside the indexed repo, memtrace is the right tool.
74
80
  | "Find the function that uses `STRIPE_KEY_FOO_BAR`" | `find_code(query="STRIPE_KEY_FOO_BAR")` → semantic finds it inside any embedded body. |
75
81
  | "Where's that error message `'connection refused for tenant'`?" | `find_code(query="connection refused for tenant")` → semantic catches it. |
76
82
  | "What breaks if I change `foo`?" | `get_impact(repo_id, target="foo")` → blast radius. |
83
+ | "Should I change/delete/refactor `foo`?" | `find_symbol`/`get_symbol_context` → `recall_decision("foo / subsystem / approach")`; if a symbol id is available, `why_is_this_here` + `governing_contracts`; then `get_impact`. |
84
+ | "Can I use/switch to pattern or library X?" | `recall_decision("X")` FIRST; bans and conventions are decisions. Verify a matching decision with `verify_intent(decision_id)` before relying on it. |
77
85
  | "What changed in `auth.ts` last week?" | `get_evolution(repo_id, from="7d ago", mode="recent", file_path="auth.ts")`. |
78
86
  | "List all `*.test.ts` files." | `Glob` (file inventory, not symbol search). |
79
87
  | "Find this string in my `.env`." | `Grep` (non-source artifact). |
@@ -131,6 +139,8 @@ If not indexed → offer to index with `mcp__memtrace__index_directory`, then fo
131
139
  | What files change together? | `get_cochange_context` |
132
140
  | Architecture overview | `list_communities` + `find_central_symbols` |
133
141
  | About to edit / quote — need exact lines | Bounded `Read(file, offset=start_line, limit=N)` (preferred), or `get_source_window` for path-resolution parity |
142
+ | About to edit/refactor/delete existing code | `recall_decision` for the intent + `why_is_this_here`/`governing_contracts` when a symbol id is available, then `get_impact` |
143
+ | About to choose or replace a library/pattern/architecture | `recall_decision` first; use `verify_intent` on any matching decision before contradicting it |
134
144
  | About to choose between competing idioms (ternary vs if-else, arrow vs fn-decl, const vs let, await vs `.then`) | `get_style_fingerprint(repo_id, file_path)` — empirical codebase norm; see `memtrace-style-fingerprint` workflow |
135
145
 
136
146
  ## Standard Workflows
@@ -156,8 +166,10 @@ If not indexed → offer to index with `mcp__memtrace__index_directory`, then fo
156
166
  ### Before any code modification
157
167
  1. `find_symbol` → confirm you have the right target
158
168
  2. `get_symbol_context` → understand full context
159
- 3. `get_impact` → know blast radius before touching anything
160
- 4. `get_style_fingerprint(repo_id, file_path=<file>)` match the codebase's empirical idiom (ternary vs if-else, arrow vs fn-decl, etc.) see `memtrace-style-fingerprint` workflow for the full decision rule
169
+ 3. `recall_decision("<symbol/subsystem/approach>")` → surface recorded choices, bans, and conventions before deciding what to do
170
+ 4. If a `symbol_id` is available, `why_is_this_here(symbol_id)` + `governing_contracts(symbol_id)` before deleting, rewriting, or "cleaning up" odd code
171
+ 5. `get_impact` → know blast radius before touching anything
172
+ 6. `get_style_fingerprint(repo_id, file_path=<file>)` → match the codebase's empirical idiom (ternary vs if-else, arrow vs fn-decl, etc.) — see `memtrace-style-fingerprint` workflow for the full decision rule
161
173
 
162
174
  ## Red Flags — STOP, Use Memtrace Instead
163
175
 
@@ -168,6 +180,9 @@ You are violating this skill if you think:
168
180
  | "Let me grep for this" | `find_code` or `find_symbol` is faster and structurally aware |
169
181
  | "Let me glob for the file" | `find_symbol` returns exact location with context |
170
182
  | "Let me read the whole file" | `get_symbol_context` for the WHY (callers/callees/community); a bounded source read at start_line..end_line for the WHAT |
183
+ | "I know why this is written this way" | Check Cortex first. Use `recall_decision`; use `why_is_this_here`/`governing_contracts` when you have a symbol id. |
184
+ | "This looks unused/weird; I'll remove it" | `why_is_this_here` + `governing_contracts` first, then blast radius. CannotProve is unknown, not permission. |
185
+ | "I'll just switch to library/pattern X" | `recall_decision("X")` first — you may be reintroducing a banned approach. |
171
186
  | "It's just a quick search" | Grep has no understanding of call graphs, communities, or time |
172
187
  | "I don't know if it's indexed" | Check with `list_indexed_repositories` first — takes 1 second |
173
188
  | "Memtrace returned 0 results" | Broaden the Memtrace query, check repo_id/path coverage, then reindex if needed |
@@ -181,6 +196,7 @@ Use Grep/Glob/Read ONLY for:
181
196
  - Non-source files or paths outside every indexed source repo
182
197
  - Files that are config, data, or docs (not source code symbols)
183
198
  - Repos or paths confirmed outside every Memtrace indexed root
199
+ - **Official Memtrace product documentation** — use `memtrace-docs` (`ask_docs` / `search_docs` / `read_doc`), not file tools or web search
184
200
 
185
201
  For source-code spans already located by Memtrace, use a **bounded** read —
186
202
  your harness's `Read(file, offset, limit)` with the returned `start_line` /
@@ -198,9 +214,11 @@ When this skill applies, it overrides default file-search behavior. Use the spec
198
214
  - Discovery → `memtrace-search`
199
215
  - Impact analysis → `memtrace-impact`
200
216
  - Temporal / change analysis → `memtrace-evolution`
217
+ - Rationale / prior decisions / bans / contracts → `memtrace-decision-memory`
201
218
  - Incident investigation → `memtrace-incident-investigation`
202
219
  - Architecture overview → `memtrace-codebase-exploration`
203
220
  - Refactoring → `memtrace-refactoring-guide`
221
+ - Memtrace **product docs** (install, CLI, MCP, enterprise) → `memtrace-docs`
204
222
 
205
223
  ## Output
206
224
 
@@ -1,6 +1,6 @@
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
  ---
5
5
 
6
6
  ## Overview
@@ -17,6 +17,8 @@ symbol.
17
17
  | `preflight_check` | Full radar for one symbol: blast radius + co-change + churn + checklist |
18
18
  | `get_impact` | Deeper blast-radius walk when the radar flags HIGH/CRITICAL |
19
19
  | `get_cochange_context` | Wider co-change window when partners look surprising |
20
+ | `recall_decision` | Recorded choices, bans, and conventions for the symbol/subsystem/behavior |
21
+ | `why_is_this_here` / `governing_contracts` | Symbol-scoped rationale and constraints when a symbol id is available |
20
22
 
21
23
  > **Parameter types:** MCP parameters are strictly typed. Numbers must be
22
24
 
@@ -56,12 +58,23 @@ frequent partner, say so explicitly and why.
56
58
  - The complexity number should not have grown without a stated reason;
57
59
  if it did, simplify before declaring the work done.
58
60
 
61
+ ### Cortex gate before editing
62
+
63
+ Before changing behavior, deleting code, or refactoring odd/legacy code:
64
+
65
+ 1. Run `recall_decision("<symbol/subsystem/behavior>")`.
66
+ 2. If the preflight/graph result gives you a numeric `symbol_id`, run
67
+ `why_is_this_here(symbol_id)` and `governing_contracts(symbol_id)`.
68
+ 3. Honor matching held decisions/bans. Treat CannotProve as unknown, not approval.
69
+
59
70
  ## Verdict guidance
60
71
 
61
72
  - `risk: CRITICAL/HIGH` — propose the change plan before editing; consider
62
73
  a feature flag or staged rollout.
63
74
  - `dependents: 0` — edit freely; note the symbol may be newly added or an
64
75
  entry point.
76
+ - A matching Cortex decision/ban — surface it before editing and do not
77
+ contradict it without explicit user sign-off.
65
78
 
66
79
  ## Output
67
80
 
@@ -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
  ---
5
5
 
6
6
  ## Overview
@@ -37,7 +37,10 @@ Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bun
37
37
  ### 1. Get the symbol_id
38
38
 
39
39
  If you have a name or a "why" question, run `recall_decision(...)` first and take the
40
- `symbol_id` from the result (or the Cortex view). The id-based tools need a numeric id.
40
+ `symbol_id` from the result if present, or use the id returned by a graph/Cortex view.
41
+ The id-based tools need a numeric id. If you cannot get a symbol id, do not skip
42
+ decision memory entirely: use `recall_decision("<symbol/subsystem/behavior>")` and
43
+ report any matching decision/bans before changing the code.
41
44
 
42
45
  ### 2. Ask why it's here
43
46
 
@@ -62,8 +65,8 @@ was superseded via `recall_decision`) changes whether the code should still look
62
65
  | Situation | Action |
63
66
  |-----------|--------|
64
67
  | Code looks unused/dead and you want to delete it | `why_is_this_here` + `governing_contracts` BEFORE deleting; CannotProve is not a green light |
65
- | Code is written in a strange/non-obvious way | `why_is_this_here` there's likely a decision explaining the oddity |
66
- | About to refactor a symbol's internals | `governing_contracts` — preserve every constraint, not just the test surface |
68
+ | 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 |
69
+ | About to refactor a symbol's internals | `why_is_this_here` + `governing_contracts` — preserve the rationale and every constraint, not just the test surface |
67
70
  | User asks "why is this here?" | `why_is_this_here(symbol_id)`; if you only have a name, `recall_decision` first |
68
71
  | All provenance returns CannotProve | Treat as unknown; combine with `memtrace-impact` (blast radius) and ask the user before removing |
69
72