memtrace 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 (41) hide show
  1. package/bin/memtrace.js +43 -15
  2. package/hooks/posttool-mcp-telemetry.sh +0 -0
  3. package/hooks/userprompt-claude.sh +0 -0
  4. package/installer/dist/commands/doctor.js +11 -0
  5. package/installer/dist/index.js +1 -1
  6. package/installer/dist/rail-install.js +4 -15
  7. package/installer/dist/transformers/codex.js +7 -80
  8. package/installer/dist/transformers/index.d.ts +2 -1
  9. package/installer/dist/transformers/index.js +3 -1
  10. package/installer/dist/transformers/opencode.js +5 -21
  11. package/installer/dist/transformers/rail-hooks.d.ts +13 -0
  12. package/installer/dist/transformers/rail-hooks.js +50 -0
  13. package/installer/dist/transformers/types.d.ts +1 -1
  14. package/installer/dist/transformers/warp.d.ts +4 -0
  15. package/installer/dist/transformers/warp.js +83 -0
  16. package/installer/package.json +1 -1
  17. package/installer/skills/commands/memtrace-decision-recall.md +7 -4
  18. package/installer/skills/commands/memtrace-docs-ask.md +99 -0
  19. package/installer/skills/commands/memtrace-docs-read.md +91 -0
  20. package/installer/skills/commands/memtrace-docs-search.md +94 -0
  21. package/installer/skills/commands/memtrace-preflight.md +17 -1
  22. package/installer/skills/commands/memtrace-provenance.md +7 -4
  23. package/installer/skills/workflows/memtrace-change-impact-analysis.md +23 -7
  24. package/installer/skills/workflows/memtrace-decision-memory.md +16 -12
  25. package/installer/skills/workflows/memtrace-docs.md +129 -0
  26. package/installer/skills/workflows/memtrace-first.md +25 -3
  27. package/installer/skills/workflows/memtrace-refactoring-guide.md +25 -9
  28. package/lib/child-supervisor.js +104 -0
  29. package/lib/install-consent.js +1 -1
  30. package/package.json +7 -7
  31. package/skills/commands/memtrace-decision-recall.md +7 -4
  32. package/skills/commands/memtrace-docs-ask.md +99 -0
  33. package/skills/commands/memtrace-docs-read.md +91 -0
  34. package/skills/commands/memtrace-docs-search.md +94 -0
  35. package/skills/commands/memtrace-preflight.md +17 -1
  36. package/skills/commands/memtrace-provenance.md +7 -4
  37. package/skills/workflows/memtrace-change-impact-analysis.md +23 -7
  38. package/skills/workflows/memtrace-decision-memory.md +16 -12
  39. package/skills/workflows/memtrace-docs.md +129 -0
  40. package/skills/workflows/memtrace-first.md +25 -3
  41. package/skills/workflows/memtrace-refactoring-guide.md +25 -9
@@ -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. |
@@ -0,0 +1,129 @@
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
+ allowed-tools:
5
+ - mcp__memtrace__search_docs
6
+ - mcp__memtrace__ask_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
+ # Memtrace Docs First
15
+
16
+ ## The Iron Law
17
+
18
+ ```
19
+ IF THE USER ASKS ABOUT MEMTRACE PRODUCT DOCS → USE DOCS MCP TOOLS FIRST.
20
+ Do not guess CLI flags, MCP tool lists, enterprise deploy steps, or fleet rules
21
+ from memory. Query the hosted documentation corpus at memtrace.io (or
22
+ MEMTRACE_DOCS_API_URL), then answer with citations.
23
+
24
+ memtrace-first = your indexed SOURCE CODE (find_code, get_impact, …)
25
+ memtrace-docs = official MEMTRACE DOCUMENTATION (search_docs, ask_docs, read_doc)
26
+ ```
27
+
28
+ Docs tools call the **hosted** Memtrace docs API over HTTPS. They do **not** read
29
+ your local MemDB or your repo. Core graph tools stay offline; docs tools degrade
30
+ gracefully when the network is down (`ok: false` + hint).
31
+
32
+ ## Server check (once per session)
33
+
34
+ Confirm the docs tools are available on your `memtrace` MCP server:
35
+
36
+ - `search_docs` — ranked chunks (slug, title, H2, excerpt)
37
+ - `ask_docs` — grounded Q&A `{ answer, citations[], refused }`
38
+ - `read_doc` — full page text by slug
39
+ - Resources: `memtrace://docs/<slug>` via `read_resource` (optional)
40
+
41
+ If none of these exist, the MCP build may be outdated — tell the user to update
42
+ Memtrace and run `npx -y memtrace-skills@latest install`.
43
+
44
+ Override API host: `MEMTRACE_DOCS_API_URL` (default `https://memtrace.io`).
45
+
46
+ ## The decision rule
47
+
48
+ | User is asking | Right tool | Sub-skill |
49
+ |---|---|---|
50
+ | "How do I install / configure / deploy X in Memtrace?" | `ask_docs(question=…)` | `memtrace-docs-ask` |
51
+ | "What MCP tools / skills / CLI commands exist?" | `ask_docs` or `search_docs` then `read_doc` on hit slugs | `memtrace-docs-ask` / `memtrace-docs-search` |
52
+ | "What does `memtrace rail enable` do?" | `ask_docs` | `memtrace-docs-ask` |
53
+ | "Find docs about fleet coordination" | `search_docs(query=…)` | `memtrace-docs-search` |
54
+ | "Read the full getting-started page" | `read_doc(slug="getting-started")` | `memtrace-docs-read` |
55
+ | "Read enterprise MemDB deploy guide" | `read_doc(slug="enterprise/memdb-deploy")` | `memtrace-docs-read` |
56
+ | Need several related sections | `search_docs` → `read_doc` on top slugs | `memtrace-docs-search` + `memtrace-docs-read` |
57
+
58
+ **Default for natural-language questions:** `ask_docs` — it retrieves context and
59
+ returns a cited answer in one call.
60
+
61
+ **Default for "find the doc about…":** `search_docs` — scan chunks, then `read_doc`
62
+ if you need the full page.
63
+
64
+ ## Standard workflows
65
+
66
+ ### "How does X work in Memtrace?" (most common)
67
+
68
+ 1. `ask_docs(question="<user question verbatim>")`
69
+ 2. If `refused: true` or `ok: false` → `search_docs` with shorter keywords → `read_doc` on best slug
70
+ 3. Quote the answer; link slugs as `/docs/<slug>` when helpful
71
+ 4. If docs say "not found", say so — do not invent flags or behavior
72
+
73
+ ### "What tools / commands / skills are available?"
74
+
75
+ 1. `ask_docs(question="What MCP tools are available?")` or fleet/skills variant
76
+ 2. If the answer lists categories but user wants exhaustive detail → `read_doc(slug="mcp/tools")`
77
+ 3. For agent skills → `read_doc(slug="mcp/skills")`
78
+
79
+ ### "Read up on X before we implement"
80
+
81
+ 1. `search_docs(query="X", limit=8)`
82
+ 2. `read_doc(slug=<top hit>)` for each page you will rely on
83
+ 3. Summarize with citations; use `memtrace-first` only when switching to **their repo's code**
84
+
85
+ ### Enterprise / self-hosted MemDB
86
+
87
+ 1. `ask_docs(question="How do I deploy MemDB with Helm on Azure?")` or user wording
88
+ 2. Follow-up `read_doc(slug="enterprise/memdb-deploy")` for operator steps
89
+ 3. Engineer connect → `read_doc(slug="enterprise/connect")` or `cli/connect`
90
+
91
+ ## Red flags — STOP, use docs tools
92
+
93
+ | Thought | Reality |
94
+ |---|---|
95
+ | "I know how Memtrace fleet works from training data" | Product docs change — `ask_docs` first |
96
+ | "I'll grep the repo for README" | User repo ≠ official docs — use `search_docs` / `read_doc` |
97
+ | "I'll web-search Memtrace" | Use hosted docs API — same corpus as memtrace.io/docs |
98
+ | `ask_docs` returned `refused: true` | Docs corpus had no match — say so; try `search_docs` with different terms |
99
+ | `ok: false` network error | Report offline; core Memtrace graph tools still work locally |
100
+
101
+ ## Relationship to other skills
102
+
103
+ | Skill | When |
104
+ |---|---|
105
+ | `memtrace-docs` | Questions about **Memtrace product** (install, MCP, fleet, Cortex, enterprise) |
106
+ | `memtrace-first` | Questions about **the user's indexed source code** |
107
+ | `memtrace-decision-memory` | **Why** code exists (Cortex decisions) — not product docs |
108
+
109
+ Use both when needed: docs for "how is Memtrace supposed to work?", graph tools for
110
+ "how does *this repo* implement it?"
111
+
112
+ ## Output
113
+
114
+ Prefer citing doc slugs returned in `citations` or `search_docs` results:
115
+
116
+ ```
117
+ ask_docs → { ok: true, answer: "…", citations: ["cli/rail", "mcp/skills"], refused: false }
118
+ search_docs → { ok: true, results: [{ slug, pageTitle, h2Title, excerpt }] }
119
+ read_doc → { ok: true, slug, title, body }
120
+ ```
121
+
122
+ When `refused: true`, tell the user the docs did not cover it and suggest browsing
123
+ https://memtrace.io/docs or rephrasing.
124
+
125
+ ## Sub-skills
126
+
127
+ - Discovery / chunk search → `memtrace-docs-search`
128
+ - Grounded Q&A → `memtrace-docs-ask`
129
+ - Full page read → `memtrace-docs-read`