memtrace 0.8.63 → 1.0.1
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.
- package/hooks/userprompt-claude.sh +14 -5
- package/installer/package.json +1 -1
- package/installer/skills/commands/memtrace-quality.md +17 -5
- package/installer/skills/workflows/memtrace-refactoring-guide.md +2 -2
- package/lib/cuda-ep.js +3 -3
- package/package.json +7 -7
- package/skills/commands/memtrace-quality.md +17 -5
- package/skills/workflows/memtrace-refactoring-guide.md +2 -2
|
@@ -162,11 +162,20 @@ LOCK_FILE="$LOCK_DIR/$SESSION_ID.lock"
|
|
|
162
162
|
# entirely so every fire proceeds (useful for debugging & tests).
|
|
163
163
|
if (( DEBOUNCE_SECS > 0 )) && [[ -f "$LOCK_FILE" ]]; then
|
|
164
164
|
NOW=$(date +%s)
|
|
165
|
-
# `stat -
|
|
166
|
-
#
|
|
167
|
-
#
|
|
168
|
-
#
|
|
169
|
-
LAST="
|
|
165
|
+
# `stat -c %Y` is GNU/Linux, while `stat -f %m` is BSD/macOS.
|
|
166
|
+
# GNU stat accepts `-f` for a different operation and exits zero,
|
|
167
|
+
# so an `cmd_a || cmd_b` fallback can capture filesystem details
|
|
168
|
+
# instead of an mtime. Validate each result before accepting it.
|
|
169
|
+
LAST=""
|
|
170
|
+
if LAST="$(stat -c %Y "$LOCK_FILE" 2>/dev/null)" && [[ "$LAST" =~ ^[0-9]+$ ]]; then
|
|
171
|
+
:
|
|
172
|
+
elif LAST="$(stat -f %m "$LOCK_FILE" 2>/dev/null)" && [[ "$LAST" =~ ^[0-9]+$ ]]; then
|
|
173
|
+
:
|
|
174
|
+
else
|
|
175
|
+
# If neither form works (extremely unusual), treat the lock as
|
|
176
|
+
# freshly touched rather than spamming the daemon.
|
|
177
|
+
LAST="$NOW"
|
|
178
|
+
fi
|
|
170
179
|
if [[ "$LAST" =~ ^[0-9]+$ ]]; then
|
|
171
180
|
AGE=$((NOW - LAST))
|
|
172
181
|
if (( AGE < DEBOUNCE_SECS )); then
|
package/installer/package.json
CHANGED
|
@@ -9,7 +9,7 @@ allowed-tools:
|
|
|
9
9
|
- mcp__memtrace__get_evolution
|
|
10
10
|
metadata:
|
|
11
11
|
author: "Syncable <support@syncable.dev>"
|
|
12
|
-
version: "1.
|
|
12
|
+
version: "1.1.0"
|
|
13
13
|
category: development
|
|
14
14
|
user-invocable: true
|
|
15
15
|
---
|
|
@@ -22,7 +22,7 @@ Code quality via graph analysis — dead code, complexity hotspots, repository s
|
|
|
22
22
|
|
|
23
23
|
| Tool | Purpose | Required | Key optional |
|
|
24
24
|
|------|---------|----------|--------------|
|
|
25
|
-
| `find_dead_code` |
|
|
25
|
+
| `find_dead_code` | Symbols unreachable from roots | `repo_id` | `include_tests`, `limit`, `min_confidence`, `include_historical` |
|
|
26
26
|
| `find_most_complex_functions` | Ranked complexity hotspots | `repo_id` | **`top_n`** (def 20) — not `limit` |
|
|
27
27
|
| `calculate_cyclomatic_complexity` | Score one symbol | `repo_id`, **`target`** | — |
|
|
28
28
|
| `get_repository_stats` | Repository overview | `repo_id` | `branch` |
|
|
@@ -42,10 +42,20 @@ Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bun
|
|
|
42
42
|
### 2. Dead code
|
|
43
43
|
|
|
44
44
|
```json
|
|
45
|
-
{ "repo_id": "memdb", "include_tests": false, "limit": 50 }
|
|
45
|
+
{ "repo_id": "memdb", "include_tests": false, "limit": 50, "min_confidence": "high" }
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
`find_dead_code` seeds **roots** (`main`, exported symbols, HANDLES targets,
|
|
49
|
+
`trait_impl`, Magalz/framework allowlists), BFS-walks CALLS / REFERENCES /
|
|
50
|
+
MAKES_API_CALL forward, and reports Function/Method nodes **unreachable from
|
|
51
|
+
roots**. Each row includes `confidence` (`high` / `medium` / `low`) and
|
|
52
|
+
`confidence_score` (Skylos-style penalties for dynamic languages, ambiguous
|
|
53
|
+
hook names, methods). Use `min_confidence: "high"` for CI-safe cleanup;
|
|
54
|
+
omit or `"low"` to see all bands.
|
|
55
|
+
|
|
56
|
+
Results are still candidates, not proof — unmodeled dynamic dispatch can look
|
|
57
|
+
live or dead incorrectly. Verify before deleting. Prefer false-live over
|
|
58
|
+
false-dead.
|
|
49
59
|
|
|
50
60
|
### 3. Complexity hotspots
|
|
51
61
|
|
|
@@ -72,7 +82,7 @@ Ordered by call-graph out-degree.
|
|
|
72
82
|
|
|
73
83
|
| Result | Carries |
|
|
74
84
|
|--------|---------|
|
|
75
|
-
| Dead-code entry (`find_dead_code`) |
|
|
85
|
+
| Dead-code entry (`find_dead_code`) | Name, kind, path, `reason` (`unreachable from roots`), `confidence`, `confidence_score` |
|
|
76
86
|
| Complexity row (`find_most_complex_functions`) | Symbol, complexity score, risk level — e.g. `processOrder` — 27, Critical |
|
|
77
87
|
| Single score (`calculate_cyclomatic_complexity`) | Cyclomatic complexity for `target` |
|
|
78
88
|
| Stats (`get_repository_stats`) | Node counts by kind, edge counts, community and process counts for `repo_id`/`branch` |
|
|
@@ -81,6 +91,8 @@ Ordered by call-graph out-degree.
|
|
|
81
91
|
|
|
82
92
|
| Mistake | Reality |
|
|
83
93
|
|---------|---------|
|
|
94
|
+
| Treating every dead-code row as deletable | Filter with `min_confidence: "high"`; still verify framework/dynamic use |
|
|
95
|
+
| Assuming “no inbound edge” is the model | Dead means unreachable from roots, not merely unreferenced |
|
|
84
96
|
| `find_most_complex_functions(limit: 10)` | Param is **`top_n`** |
|
|
85
97
|
| `calculate_cyclomatic_complexity(symbol_id=...)` | Required param is **`target`** |
|
|
86
98
|
| Only looking at the highest complexity | Medium-complexity functions that are growing (check `get_evolution`) are often more urgent |
|
|
@@ -35,7 +35,7 @@ Run these three tools in parallel to build a candidate list:
|
|
|
35
35
|
Call `find_most_complex_functions` with `top_n: 20`
|
|
36
36
|
|
|
37
37
|
**b) Dead code:**
|
|
38
|
-
Call `find_dead_code`
|
|
38
|
+
Call `find_dead_code` (prefer `min_confidence: "high"`) for symbols unreachable from roots
|
|
39
39
|
|
|
40
40
|
**c) Architectural bottlenecks:**
|
|
41
41
|
Call `find_bridge_symbols` to find chokepoints with too much responsibility
|
|
@@ -122,7 +122,7 @@ For each item, include:
|
|
|
122
122
|
|-----------|--------|
|
|
123
123
|
| Complex + volatile + high blast radius | Highest priority — but plan carefully; incremental approach |
|
|
124
124
|
| Complex + stable + low blast radius | Can wait; refactor when you're already touching nearby code |
|
|
125
|
-
| Dead code
|
|
125
|
+
| Dead code (`unreachable from roots`, high confidence) | Run Cortex provenance/recall first; reachability is not proof that no decision/contract keeps it |
|
|
126
126
|
| Bridge symbol with many dependents | Extract interface first, then refactor implementation behind it |
|
|
127
127
|
| Symbol in cross-repo API | Coordinate with consumers; backward-compatible changes only |
|
|
128
128
|
| Cortex returns a held ban/contract | Preserve it or ask before overriding it |
|
package/lib/cuda-ep.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
// ships as a GitHub release asset instead (`memtrace-windows-x86_64-
|
|
9
9
|
// cuda-ep.zip`, sha256 recorded in the release's `checksums.txt`), and
|
|
10
10
|
// this module fetches it at install time for hosts that can actually
|
|
11
|
-
// use it. The
|
|
12
|
-
// missing DLL is never fatal — NVIDIA users
|
|
13
|
-
//
|
|
11
|
+
// use it. The bundled Windows runtime probes CUDA -> CPU at startup, so
|
|
12
|
+
// a missing DLL is never fatal — NVIDIA users safely land on CPU. A
|
|
13
|
+
// custom ONNX Runtime can additionally expose DirectML.
|
|
14
14
|
//
|
|
15
15
|
// Placement contract: the engine's dylib discovery looks next to the
|
|
16
16
|
// running binary (`bridge_ort_dylib_env` in the Rust CLI), so the DLL
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memtrace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Code intelligence graph — MCP server + AI agent skills + visualization UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"fs-extra": "^11.0.0"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
|
-
"@memtrace/darwin-arm64": "0.
|
|
44
|
-
"@memtrace/linux-x64": "0.
|
|
45
|
-
"@memtrace/linux-arm64": "0.
|
|
46
|
-
"@memtrace/win32-x64": "0.
|
|
47
|
-
"@memtrace/linux-x64-noavx2": "0.
|
|
48
|
-
"@memtrace/win32-x64-noavx2": "0.
|
|
43
|
+
"@memtrace/darwin-arm64": "1.0.1",
|
|
44
|
+
"@memtrace/linux-x64": "1.0.1",
|
|
45
|
+
"@memtrace/linux-arm64": "1.0.1",
|
|
46
|
+
"@memtrace/win32-x64": "1.0.1",
|
|
47
|
+
"@memtrace/linux-x64-noavx2": "1.0.1",
|
|
48
|
+
"@memtrace/win32-x64-noavx2": "1.0.1"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=18"
|
|
@@ -9,7 +9,7 @@ allowed-tools:
|
|
|
9
9
|
- mcp__memtrace__get_evolution
|
|
10
10
|
metadata:
|
|
11
11
|
author: "Syncable <support@syncable.dev>"
|
|
12
|
-
version: "1.
|
|
12
|
+
version: "1.1.0"
|
|
13
13
|
category: development
|
|
14
14
|
user-invocable: true
|
|
15
15
|
---
|
|
@@ -22,7 +22,7 @@ Code quality via graph analysis — dead code, complexity hotspots, repository s
|
|
|
22
22
|
|
|
23
23
|
| Tool | Purpose | Required | Key optional |
|
|
24
24
|
|------|---------|----------|--------------|
|
|
25
|
-
| `find_dead_code` |
|
|
25
|
+
| `find_dead_code` | Symbols unreachable from roots | `repo_id` | `include_tests`, `limit`, `min_confidence`, `include_historical` |
|
|
26
26
|
| `find_most_complex_functions` | Ranked complexity hotspots | `repo_id` | **`top_n`** (def 20) — not `limit` |
|
|
27
27
|
| `calculate_cyclomatic_complexity` | Score one symbol | `repo_id`, **`target`** | — |
|
|
28
28
|
| `get_repository_stats` | Repository overview | `repo_id` | `branch` |
|
|
@@ -42,10 +42,20 @@ Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bun
|
|
|
42
42
|
### 2. Dead code
|
|
43
43
|
|
|
44
44
|
```json
|
|
45
|
-
{ "repo_id": "memdb", "include_tests": false, "limit": 50 }
|
|
45
|
+
{ "repo_id": "memdb", "include_tests": false, "limit": 50, "min_confidence": "high" }
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
`find_dead_code` seeds **roots** (`main`, exported symbols, HANDLES targets,
|
|
49
|
+
`trait_impl`, Magalz/framework allowlists), BFS-walks CALLS / REFERENCES /
|
|
50
|
+
MAKES_API_CALL forward, and reports Function/Method nodes **unreachable from
|
|
51
|
+
roots**. Each row includes `confidence` (`high` / `medium` / `low`) and
|
|
52
|
+
`confidence_score` (Skylos-style penalties for dynamic languages, ambiguous
|
|
53
|
+
hook names, methods). Use `min_confidence: "high"` for CI-safe cleanup;
|
|
54
|
+
omit or `"low"` to see all bands.
|
|
55
|
+
|
|
56
|
+
Results are still candidates, not proof — unmodeled dynamic dispatch can look
|
|
57
|
+
live or dead incorrectly. Verify before deleting. Prefer false-live over
|
|
58
|
+
false-dead.
|
|
49
59
|
|
|
50
60
|
### 3. Complexity hotspots
|
|
51
61
|
|
|
@@ -72,7 +82,7 @@ Ordered by call-graph out-degree.
|
|
|
72
82
|
|
|
73
83
|
| Result | Carries |
|
|
74
84
|
|--------|---------|
|
|
75
|
-
| Dead-code entry (`find_dead_code`) |
|
|
85
|
+
| Dead-code entry (`find_dead_code`) | Name, kind, path, `reason` (`unreachable from roots`), `confidence`, `confidence_score` |
|
|
76
86
|
| Complexity row (`find_most_complex_functions`) | Symbol, complexity score, risk level — e.g. `processOrder` — 27, Critical |
|
|
77
87
|
| Single score (`calculate_cyclomatic_complexity`) | Cyclomatic complexity for `target` |
|
|
78
88
|
| Stats (`get_repository_stats`) | Node counts by kind, edge counts, community and process counts for `repo_id`/`branch` |
|
|
@@ -81,6 +91,8 @@ Ordered by call-graph out-degree.
|
|
|
81
91
|
|
|
82
92
|
| Mistake | Reality |
|
|
83
93
|
|---------|---------|
|
|
94
|
+
| Treating every dead-code row as deletable | Filter with `min_confidence: "high"`; still verify framework/dynamic use |
|
|
95
|
+
| Assuming “no inbound edge” is the model | Dead means unreachable from roots, not merely unreferenced |
|
|
84
96
|
| `find_most_complex_functions(limit: 10)` | Param is **`top_n`** |
|
|
85
97
|
| `calculate_cyclomatic_complexity(symbol_id=...)` | Required param is **`target`** |
|
|
86
98
|
| Only looking at the highest complexity | Medium-complexity functions that are growing (check `get_evolution`) are often more urgent |
|
|
@@ -35,7 +35,7 @@ Run these three tools in parallel to build a candidate list:
|
|
|
35
35
|
Call `find_most_complex_functions` with `top_n: 20`
|
|
36
36
|
|
|
37
37
|
**b) Dead code:**
|
|
38
|
-
Call `find_dead_code`
|
|
38
|
+
Call `find_dead_code` (prefer `min_confidence: "high"`) for symbols unreachable from roots
|
|
39
39
|
|
|
40
40
|
**c) Architectural bottlenecks:**
|
|
41
41
|
Call `find_bridge_symbols` to find chokepoints with too much responsibility
|
|
@@ -122,7 +122,7 @@ For each item, include:
|
|
|
122
122
|
|-----------|--------|
|
|
123
123
|
| Complex + volatile + high blast radius | Highest priority — but plan carefully; incremental approach |
|
|
124
124
|
| Complex + stable + low blast radius | Can wait; refactor when you're already touching nearby code |
|
|
125
|
-
| Dead code
|
|
125
|
+
| Dead code (`unreachable from roots`, high confidence) | Run Cortex provenance/recall first; reachability is not proof that no decision/contract keeps it |
|
|
126
126
|
| Bridge symbol with many dependents | Extract interface first, then refactor implementation behind it |
|
|
127
127
|
| Symbol in cross-repo API | Coordinate with consumers; backward-compatible changes only |
|
|
128
128
|
| Cortex returns a held ban/contract | Preserve it or ask before overriding it |
|