claude-slim 2.13.0 → 2.14.0
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/README.md +28 -21
- package/dist/cli.js +3 -2
- package/dist/codex/report.js +4 -2
- package/package.json +2 -2
- package/skills/claude-slim/SKILL.md +49 -15
package/README.md
CHANGED
|
@@ -94,21 +94,21 @@ That's slower responses. Hitting your usage cap faster. Paying for context you'r
|
|
|
94
94
|
**Report** — Shows exactly what changed:
|
|
95
95
|
|
|
96
96
|
```
|
|
97
|
-
|
|
98
|
-
│ claude-slim report
|
|
99
|
-
│
|
|
100
|
-
│ Before: 14,510 tokens at startup
|
|
101
|
-
│ After: 5,181 tokens at startup
|
|
102
|
-
│ Saved: 9,329 tokens (64.3%)
|
|
103
|
-
│
|
|
104
|
-
│ Top offenders removed:
|
|
105
|
-
│ • office-hours 23,008 tok
|
|
106
|
-
│ • harness 7,902 tok
|
|
107
|
-
│ • manpower 4,764 tok
|
|
108
|
-
│
|
|
109
|
-
│ Est. monthly savings: ~$1.68
|
|
110
|
-
│ (2 sessions/day × $0.003/1K tok)
|
|
111
|
-
|
|
97
|
+
╭────────────────────────────────────────╮
|
|
98
|
+
│ claude-slim report │
|
|
99
|
+
│ │
|
|
100
|
+
│ Before: 14,510 tokens at startup │
|
|
101
|
+
│ After: 5,181 tokens at startup │
|
|
102
|
+
│ Saved: 9,329 tokens (64.3%) │
|
|
103
|
+
│ │
|
|
104
|
+
│ Top offenders removed: │
|
|
105
|
+
│ • office-hours 23,008 tok│
|
|
106
|
+
│ • harness 7,902 tok│
|
|
107
|
+
│ • manpower 4,764 tok│
|
|
108
|
+
│ │
|
|
109
|
+
│ Est. monthly savings: ~$1.68 │
|
|
110
|
+
│ (2 sessions/day × $0.003/1K tok) │
|
|
111
|
+
╰────────────────────────────────────────╯
|
|
112
112
|
|
|
113
113
|
┌──────────────────┬──────────┬──────────┬────────────┐
|
|
114
114
|
│ │ Before │ After │ Saved │
|
|
@@ -139,6 +139,14 @@ claude plugin install claude-slim
|
|
|
139
139
|
|
|
140
140
|
Then just type `/claude-slim` in any session.
|
|
141
141
|
|
|
142
|
+
Or install it through the [skills.sh](https://skills.sh) directory, which can also place
|
|
143
|
+
the skill into Codex, Cursor, and OpenCode. What claude-slim *analyzes* is unchanged:
|
|
144
|
+
`~/.claude/` and `~/.codex/`.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npx skills add iops-leo/claude-slim
|
|
148
|
+
```
|
|
149
|
+
|
|
142
150
|
---
|
|
143
151
|
|
|
144
152
|
## Usage
|
|
@@ -249,15 +257,14 @@ Token counts come from [js-tiktoken](https://github.com/nicolo-ribaudo/js-tiktok
|
|
|
249
257
|
|
|
250
258
|
---
|
|
251
259
|
|
|
252
|
-
## v2.13.
|
|
260
|
+
## v2.13.1 — What's new
|
|
253
261
|
|
|
254
|
-
- **
|
|
255
|
-
-
|
|
256
|
-
- **Fixed: plugin skills are attributed to their plugin, not their marketplace.** One marketplace can host several plugins with different enabled states, so the two had to be told apart.
|
|
262
|
+
- **Fixed: `scan` promised the tool never touches `~/.codex/`, while `clean --auto` deletes from it permanently.** The Codex summary closed with `Reported only — claude-slim never modifies ~/.codex/.` That was true in v2.10 and false from **v2.11** on, when `clean` gained the Codex tiers. Measured here: `clean --dry-run` selects `[Auto] [codex] temp_cache: .tmp (146MB of install leftovers) (permanent)` — Tier 1, which `--auto` applies without prompting and no `restore` undoes.
|
|
263
|
+
- The summary now says what actually happens: `scan` only reads, `clean` acts under the same tiers as `~/.claude/`, moves land in `~/.codex/skills.disabled/` and reverse with `restore`, and Tier 1 install leftovers are deleted permanently.
|
|
257
264
|
|
|
258
|
-
|
|
265
|
+
A test was holding the false claim in place. It asserted the summary *must* say "never modifies", so the line could not be corrected without a test failing — and all 461 tests stayed green across four releases that contradicted it. The assertion is now inverted: the summary must not promise `~/.codex/` is left alone, and must name the permanent deletion and `--auto`.
|
|
259
266
|
|
|
260
|
-
Tests:
|
|
267
|
+
Tests: 461 → 462.
|
|
261
268
|
|
|
262
269
|
For older release notes, see [CHANGELOG.md](CHANGELOG.md).
|
|
263
270
|
|
package/dist/cli.js
CHANGED
|
@@ -50,8 +50,9 @@ program
|
|
|
50
50
|
lookbackDays: parseNonNegativeInt(opts.lookbackDays, 60),
|
|
51
51
|
projectDir,
|
|
52
52
|
});
|
|
53
|
-
// Codex is scanned when present.
|
|
54
|
-
//
|
|
53
|
+
// Codex is scanned when present. `scan` only reads; `clean` has acted here
|
|
54
|
+
// since v2.11 under the same tiers. Unused-skill detection stays suppressed
|
|
55
|
+
// for lack of a usage signal.
|
|
55
56
|
// commander maps `--no-codex` to `opts.codex === false`, not `opts.noCodex`.
|
|
56
57
|
const codex = opts.codex === false ? null : await scanCodex();
|
|
57
58
|
await flushCache();
|
package/dist/codex/report.js
CHANGED
|
@@ -44,13 +44,15 @@ export function formatCodexSummary(result) {
|
|
|
44
44
|
lines.push(` ${b.name.length > 30 ? `${b.name.slice(0, 29)}…` : b.name.padEnd(30)} ` +
|
|
45
45
|
`${String(b.listingTokens).padStart(5)} tok \x1b[90m${b.backupArtifact}\x1b[0m`);
|
|
46
46
|
}
|
|
47
|
-
lines.push(` \x1b[
|
|
47
|
+
lines.push(` \x1b[90mOffered by clean as Tier 2 — moved to ~/.codex/skills.disabled/, reversible with restore.\x1b[0m`);
|
|
48
48
|
}
|
|
49
49
|
lines.push('');
|
|
50
50
|
lines.push(` \x1b[33m!\x1b[0m Unused-skill detection unavailable for Codex.`);
|
|
51
51
|
lines.push(` \x1b[90m${result.unusedDetectionReason}\x1b[0m`);
|
|
52
52
|
lines.push('');
|
|
53
|
-
lines.push(` \x1b[
|
|
53
|
+
lines.push(` \x1b[90mscan only reads. Since v2.11 clean also acts here, under the same tiers as ~/.claude/:\x1b[0m`);
|
|
54
|
+
lines.push(` \x1b[90mmoves go to ~/.codex/skills.disabled/ and reverse with restore, but Tier 1 install\x1b[0m`);
|
|
55
|
+
lines.push(` \x1b[90mleftovers (~/.codex/.tmp) are deleted permanently, and --auto applies Tier 1 unprompted.\x1b[0m`);
|
|
54
56
|
lines.push('');
|
|
55
57
|
return lines.join('\n');
|
|
56
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-slim",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Audit and shrink your Claude Code startup context. Measures what every skill, plugin, agent, command, and memory file costs in the system prompt, then reversibly disables the dead weight. Non-destructive scan, tiered proposals, one-command restore — no proxy, no compression.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -65,6 +65,6 @@
|
|
|
65
65
|
"@types/node": "^22.20.1",
|
|
66
66
|
"tmp-promise": "^3.0.3",
|
|
67
67
|
"typescript": "^5.9.3",
|
|
68
|
-
"vitest": "^4.1.
|
|
68
|
+
"vitest": "^4.1.11"
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -18,16 +18,38 @@ Analyze the user's Claude Code environment for token waste and perform non-destr
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
## Running the CLI
|
|
22
|
+
|
|
23
|
+
Every command block below opens with a `claude_slim()` resolver. It is repeated in full each
|
|
24
|
+
time on purpose: each Bash invocation is a fresh shell, so a function defined in one
|
|
25
|
+
block does not survive into the next. It resolves in three tiers — the plugin's own
|
|
26
|
+
`dist/cli.js` when `CLAUDE_PLUGIN_ROOT` is set, then a `claude-slim` on `PATH`, then
|
|
27
|
+
`npx`. That last tier is what makes the skill work when it was installed by
|
|
28
|
+
`npx skills add` rather than `claude plugin install`, where no plugin root exists.
|
|
29
|
+
|
|
30
|
+
Do not shorten the name. A two-letter `cs` collides with claude-squad's binary, and a
|
|
31
|
+
shell function is invisible to `timeout`, `env`, and `xargs` — a wrapped call would
|
|
32
|
+
silently run that other program instead. Call `claude_slim` directly, never through a
|
|
33
|
+
wrapper.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
21
37
|
## Phase 0 — Version gate (run before every scan)
|
|
22
38
|
|
|
23
39
|
An outdated claude-slim does not merely lack features — it reports **wrong numbers**. Versions before 2.8.0 summed memory across every project on disk and inflated the startup estimate roughly 8×. Presenting those figures as fact is worse than not running at all, so check first:
|
|
24
40
|
|
|
25
41
|
```bash
|
|
26
|
-
|
|
42
|
+
claude_slim(){ if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "$CLAUDE_PLUGIN_ROOT/dist/cli.js" ]; then node "$CLAUDE_PLUGIN_ROOT/dist/cli.js" "$@"; elif command -v claude-slim >/dev/null 2>&1; then claude-slim "$@"; else npx -y 'claude-slim@^2' "$@"; fi; }
|
|
43
|
+
claude_slim check-update --json
|
|
27
44
|
```
|
|
28
45
|
|
|
29
46
|
The check is cached for 24h and fails open — if it errors, times out, or returns `"latest": null`, **proceed silently**. Never block the user because a version lookup failed.
|
|
30
47
|
|
|
48
|
+
The response carries `installMethod`. When it is `"npx"` the gate is structurally
|
|
49
|
+
inert — the CLI was just fetched at the tag it is being compared against, so `outdated`
|
|
50
|
+
can never be true. Note that the version was resolved at run time and move on; do not
|
|
51
|
+
present the gate as a safeguard it is not.
|
|
52
|
+
|
|
31
53
|
If `"outdated": true`, stop and tell the user before scanning:
|
|
32
54
|
|
|
33
55
|
> 설치된 claude-slim이 {installed}이고 최신은 {latest}입니다.
|
|
@@ -39,7 +61,7 @@ If `"outdated": true`, stop and tell the user before scanning:
|
|
|
39
61
|
|
|
40
62
|
Then honour their answer. If they choose to continue, run the scan but **label the numbers as coming from an outdated version** in your report.
|
|
41
63
|
|
|
42
|
-
**Plugin installs need a restart
|
|
64
|
+
**Plugin installs need a restart** (only when `installMethod` is `"plugin"`). `claude plugin update` writes the new version to disk, but the running session keeps the loaded copy. Tell the user this explicitly — otherwise they update, re-run, and see the same stale numbers with no idea why.
|
|
43
65
|
|
|
44
66
|
If `"outdated": false`, say nothing and continue to Phase 1.
|
|
45
67
|
|
|
@@ -50,20 +72,27 @@ If `"outdated": false`, say nothing and continue to Phase 1.
|
|
|
50
72
|
Run the CLI to collect environment data:
|
|
51
73
|
|
|
52
74
|
```bash
|
|
53
|
-
|
|
75
|
+
claude_slim(){ if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "$CLAUDE_PLUGIN_ROOT/dist/cli.js" ]; then node "$CLAUDE_PLUGIN_ROOT/dist/cli.js" "$@"; elif command -v claude-slim >/dev/null 2>&1; then claude-slim "$@"; else npx -y 'claude-slim@^2' "$@"; fi; }
|
|
76
|
+
claude_slim scan --json
|
|
54
77
|
```
|
|
55
78
|
|
|
56
|
-
If `
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
node "$PLUGIN_DIR/dist/cli.js" scan --json
|
|
60
|
-
```
|
|
79
|
+
If that command fails for **any** reason — `node` missing, or the `npx` tier unable to
|
|
80
|
+
reach the npm registry because the machine is offline or behind a proxy — fall back to
|
|
81
|
+
the legacy bash scanner. It needs neither node nor a network:
|
|
61
82
|
|
|
62
|
-
If `node` is not available, fall back to the legacy bash scanner:
|
|
63
83
|
```bash
|
|
64
|
-
|
|
84
|
+
for d in "${CLAUDE_PLUGIN_ROOT:+$CLAUDE_PLUGIN_ROOT/skills/claude-slim}" "$HOME/.claude/skills/claude-slim" "./.claude/skills/claude-slim"; do
|
|
85
|
+
[ -n "$d" ] || continue
|
|
86
|
+
if [ -f "$d/scripts/scan.sh" ]; then bash "$d/scripts/scan.sh" json; exit $?; fi
|
|
87
|
+
done
|
|
88
|
+
echo "claude-slim: no scan.sh found in any known skill directory" >&2
|
|
89
|
+
exit 1
|
|
65
90
|
```
|
|
66
91
|
|
|
92
|
+
If this fails too, tell the user the scan could not run and **stop**. Never continue to
|
|
93
|
+
Phase 2 without data: an empty scan is indistinguishable from a clean environment, and
|
|
94
|
+
reporting zeros as fact is the one outcome worse than reporting nothing.
|
|
95
|
+
|
|
67
96
|
---
|
|
68
97
|
|
|
69
98
|
## Phase 2 — Interpret & Present
|
|
@@ -163,18 +192,21 @@ If subcommand is `scan`, stop here. Ask a localized equivalent of "Proceed with
|
|
|
163
192
|
Run the interactive clean command:
|
|
164
193
|
|
|
165
194
|
```bash
|
|
166
|
-
|
|
195
|
+
claude_slim(){ if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "$CLAUDE_PLUGIN_ROOT/dist/cli.js" ]; then node "$CLAUDE_PLUGIN_ROOT/dist/cli.js" "$@"; elif command -v claude-slim >/dev/null 2>&1; then claude-slim "$@"; else npx -y 'claude-slim@^2' "$@"; fi; }
|
|
196
|
+
claude_slim clean
|
|
167
197
|
```
|
|
168
198
|
|
|
169
199
|
Or with dry-run:
|
|
170
200
|
```bash
|
|
171
|
-
|
|
201
|
+
claude_slim(){ if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "$CLAUDE_PLUGIN_ROOT/dist/cli.js" ]; then node "$CLAUDE_PLUGIN_ROOT/dist/cli.js" "$@"; elif command -v claude-slim >/dev/null 2>&1; then claude-slim "$@"; else npx -y 'claude-slim@^2' "$@"; fi; }
|
|
202
|
+
claude_slim clean --dry-run
|
|
172
203
|
```
|
|
173
204
|
|
|
174
205
|
After cleanup, re-run scan to get updated numbers, then show the savings report:
|
|
175
206
|
|
|
176
207
|
```bash
|
|
177
|
-
|
|
208
|
+
claude_slim(){ if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "$CLAUDE_PLUGIN_ROOT/dist/cli.js" ]; then node "$CLAUDE_PLUGIN_ROOT/dist/cli.js" "$@"; elif command -v claude-slim >/dev/null 2>&1; then claude-slim "$@"; else npx -y 'claude-slim@^2' "$@"; fi; }
|
|
209
|
+
claude_slim report
|
|
178
210
|
```
|
|
179
211
|
|
|
180
212
|
Present the report box AND the before/after breakdown table to the user.
|
|
@@ -186,7 +218,8 @@ Present the report box AND the before/after breakdown table to the user.
|
|
|
186
218
|
When `/claude-slim restore` is invoked:
|
|
187
219
|
|
|
188
220
|
```bash
|
|
189
|
-
|
|
221
|
+
claude_slim(){ if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "$CLAUDE_PLUGIN_ROOT/dist/cli.js" ]; then node "$CLAUDE_PLUGIN_ROOT/dist/cli.js" "$@"; elif command -v claude-slim >/dev/null 2>&1; then claude-slim "$@"; else npx -y 'claude-slim@^2' "$@"; fi; }
|
|
222
|
+
claude_slim restore
|
|
190
223
|
```
|
|
191
224
|
|
|
192
225
|
## Doctor
|
|
@@ -194,7 +227,8 @@ node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" restore
|
|
|
194
227
|
When `/claude-slim doctor` is invoked:
|
|
195
228
|
|
|
196
229
|
```bash
|
|
197
|
-
|
|
230
|
+
claude_slim(){ if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "$CLAUDE_PLUGIN_ROOT/dist/cli.js" ]; then node "$CLAUDE_PLUGIN_ROOT/dist/cli.js" "$@"; elif command -v claude-slim >/dev/null 2>&1; then claude-slim "$@"; else npx -y 'claude-slim@^2' "$@"; fi; }
|
|
231
|
+
claude_slim doctor
|
|
198
232
|
```
|
|
199
233
|
|
|
200
234
|
Explain warnings in the user's language. Pay special attention to session-log warnings because they explain why unused-skill detection may be suppressed.
|