skilltally 1.0.2 → 1.1.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +19 -0
- package/README.md +12 -5
- package/bin/cli.mjs +163 -1
- package/bin/track.mjs +87 -3
- package/gemini-extension.json +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills/skilltally/SKILL.md +23 -8
- package/src/core/normalize.mjs +1 -1
- package/src/install/antigravity.mjs +1 -1
- package/src/install/prune.mjs +355 -0
- package/src/mcp/server.mjs +345 -0
- package/src/report/aggregate.mjs +206 -17
- package/src/report/chains.mjs +187 -0
- package/src/report/dashboard.mjs +1245 -0
- package/src/report/format.mjs +223 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.0] - 2026-11-20
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Interactive HTML Dashboard (`skilltally dashboard`)**: Self-contained, offline zero-dependency HTML report featuring an interactive SVG Treemap (Context Tax vs. Activations), Timeline chart, Trigger/Host/Project/Model distribution charts, SVG workflow transition diagram, optimization tabs, sortable/filterable skills explorer, and Mermaid snippet generator (`pie`, `xychart-beta`, `flowchart LR`).
|
|
12
|
+
- **Skill Chains & Co-occurrence (`skilltally chains`)**: Session-level analysis of ordered skill transitions (`A -> B` with conditional probability and average gap), 3-step workflows, and co-occurring pairs with Jaccard similarity.
|
|
13
|
+
- **Optimization Insights (`skilltally insights`) & Enriched `stats`/`unused`**:
|
|
14
|
+
- 14-day Unicode sparklines (`▁▂▃▄▅▆▇█`) in `stats` rows and a Context Tax meter bar in `unused`.
|
|
15
|
+
- Trigger mode (`via`) auto vs. manual breakdown and identification of manual-only skills needing sharper `SKILL.md` descriptions.
|
|
16
|
+
- Project-affinity analysis flagging global/plugin skills used exclusively in a single project.
|
|
17
|
+
- Cumulative context ROI (`tokenCostPerActivation`) and per-model usage breakdown.
|
|
18
|
+
- **Safe Actionable Pruning (`skilltally prune`)**: Disable 100%-unused plugins or specific unused skills in Antigravity (`~/.gemini/config/config.json`) and Codex (`~/.codex/config.toml`) with `--dry-run` preview and automatic backups.
|
|
19
|
+
- **Zero-Dependency Stdio MCP Server (`skilltally mcp`)**: Exposes `skilltally_stats`, `skilltally_unused`, `skilltally_timeline`, `skilltally_chains`, and `skilltally_insights` over newline-delimited or `Content-Length`-framed JSON-RPC 2.0.
|
|
20
|
+
|
|
21
|
+
## [1.0.3] - 2026-11-19
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- Ignore paginated continuation reads across all 4 providers (`StartLine`/`start_line`/`offset > 1`, `ByteOffset`/`byte_offset > 0`, `sed -n 'N,Mp'` with `N > 1`, non-`+1` `tail`, and `awk` `NR >= N`/`NR > N`).
|
|
25
|
+
- Deduplicate same-session `(host, session_id, skill)` hook writes within a 30-second window at capture time in `bin/track.mjs`, and increase the default `dedupeEvents` query window from 5 seconds to 30 seconds in `src/core/normalize.mjs`.
|
|
26
|
+
|
|
8
27
|
## [1.0.2] - 2026-11-19
|
|
9
28
|
|
|
10
29
|
### Added
|
package/README.md
CHANGED
|
@@ -71,11 +71,12 @@ If you prefer native plugin managers over `npx skilltally install`:
|
|
|
71
71
|
```text
|
|
72
72
|
skilltally — last 30d (2026-10-20 -> 2026-11-19)
|
|
73
73
|
hosts: antigravity 35 · codex 12
|
|
74
|
+
triggers: auto 38 · manual 9
|
|
74
75
|
|
|
75
|
-
# skill activations reads last used hosts
|
|
76
|
-
1 requesting-code-review 8 10 2026-11-12 14:03 antigravity, codex
|
|
77
|
-
2 systematic-debugging 5 9 2026-11-10 09:41 codex
|
|
78
|
-
3 agent-browser 3 4 2026-11-05 12:18 antigravity, codex
|
|
76
|
+
# skill activations reads last used hosts trend (14d)
|
|
77
|
+
1 requesting-code-review 8 10 2026-11-12 14:03 antigravity, codex ··▁·▃·█··▃·▁··
|
|
78
|
+
2 systematic-debugging 5 9 2026-11-10 09:41 codex ····▁··█··▁···
|
|
79
|
+
3 agent-browser 3 4 2026-11-05 12:18 antigravity, codex ··█···········
|
|
79
80
|
|
|
80
81
|
installed: 214 · used: 22 · unused: 192 -> run `skilltally unused`
|
|
81
82
|
```
|
|
@@ -84,6 +85,7 @@ installed: 214 · used: 22 · unused: 192 -> run `skilltally unused`
|
|
|
84
85
|
|
|
85
86
|
```text
|
|
86
87
|
Unused enabled skills — last 90d (2026-08-21 -> 2026-11-19): 192 (48.2 KB ≈ ~12,340 tok/session)
|
|
88
|
+
context tax: [████████████░░░░] 76% unused (~12,340 / ~16,200 tok/session)
|
|
87
89
|
|
|
88
90
|
plugin:science 47 skills 14.8 KB ~ 3818 tok/session
|
|
89
91
|
alphagenome-atlas-website-links, alphagenome-single-variant-analysis, … (+41)
|
|
@@ -101,12 +103,17 @@ Tip: disabling an unused plugin removes all of its skill descriptions from every
|
|
|
101
103
|
| `uninstall` | Remove `skilltally` hooks (preserves all other user hooks) | `--host ...`, `--purge`, `--dry-run`, `--json` |
|
|
102
104
|
| `doctor` | Check Node version, hook paths, Codex trust, events, and live self-test | `--json` |
|
|
103
105
|
| `backfill` | Import historical skill reads/invocations from local logs | `--host ...`, `--since DATE`, `--dry-run`, `--json` |
|
|
104
|
-
| `stats` | Usage table sorted by `activations`
|
|
106
|
+
| `stats` | Usage table sorted by `activations` with 14-day sparklines and trigger ratio | `--since 30d\|all\|YYYY-MM-DD`, `--host`, `--project`, `--by-source`, `--metric reads`, `--json` |
|
|
105
107
|
| `top` | Top `N` skills | `-n 20`, plus `stats` flags |
|
|
106
108
|
| `unused` | Enabled installed skills with 0 activations and Context Tax breakdown | `--since 90d`, `--host`, `--all`, `--json` |
|
|
107
109
|
| `timeline` | ASCII usage bar chart over time | `--skill <name>`, `--by day\|week\|month`, `--since`, `--host`, `--project`, `--json` |
|
|
110
|
+
| `chains` | Skill transition chains (`A -> B`), 3-step workflows, and co-occurring pairs | `--since`, `--host`, `--project`, `-n 20`, `--json` |
|
|
111
|
+
| `insights` | Context ROI, manual-only triggers, single-project scoping candidates, model stats | `--since`, `--host`, `--project`, `--json` |
|
|
112
|
+
| `dashboard` | Generate self-contained offline HTML dashboard (SVG Treemap, chains, Mermaid) | `-o <file>`, `--since`, `--host`, `--project`, `--open`, `--json` |
|
|
113
|
+
| `prune` | Safely disable 100%-unused plugins or specific unused skills (with backups) | `--since 90d`, `--host all\|antigravity\|codex`, `--plugin <name>`, `--skill <name>`, `--dry-run`, `--json` |
|
|
108
114
|
| `export` | Export deduplicated events as JSON or RFC-4180 CSV | `--format json\|csv`, `-o <file>`, `--since`, `--host`, `--project`, `--include-failed` |
|
|
109
115
|
| `inventory` | List installed skills, sources, hosts, enabled state, and description sizes | `--no-project`, `--json` |
|
|
116
|
+
| `mcp` | Start zero-dependency stdio MCP server (`skilltally_*` tools) | — |
|
|
110
117
|
| `debug` | Toggle opt-in raw stdin logging (`on \| off \| status`) | `--json` |
|
|
111
118
|
|
|
112
119
|
## Privacy, Performance & Reliability
|
package/bin/cli.mjs
CHANGED
|
@@ -9,15 +9,22 @@ import { getDebugStatus, setDebugMode } from '../src/core/debug.mjs';
|
|
|
9
9
|
import { readAllEvents } from '../src/core/store.mjs';
|
|
10
10
|
import { runDoctor } from '../src/install/doctor.mjs';
|
|
11
11
|
import { runInstall, runUninstall } from '../src/install/index.mjs';
|
|
12
|
+
import { runPrune } from '../src/install/prune.mjs';
|
|
12
13
|
import { scanInventory } from '../src/inventory/scan.mjs';
|
|
14
|
+
import { startMcpServer } from '../src/mcp/server.mjs';
|
|
13
15
|
import { aggregateStats, parseSince } from '../src/report/aggregate.mjs';
|
|
16
|
+
import { buildChains } from '../src/report/chains.mjs';
|
|
17
|
+
import { generateDashboardHtml, openInBrowser } from '../src/report/dashboard.mjs';
|
|
14
18
|
import { exportEvents } from '../src/report/export.mjs';
|
|
15
19
|
import {
|
|
16
20
|
formatBackfill,
|
|
21
|
+
formatChains,
|
|
17
22
|
formatDebug,
|
|
18
23
|
formatDoctor,
|
|
24
|
+
formatInsights,
|
|
19
25
|
formatInstall,
|
|
20
26
|
formatInventory,
|
|
27
|
+
formatPrune,
|
|
21
28
|
formatStats,
|
|
22
29
|
formatTimeline,
|
|
23
30
|
formatUninstall,
|
|
@@ -32,7 +39,7 @@ function getVersion() {
|
|
|
32
39
|
try {
|
|
33
40
|
return JSON.parse(readFileSync(join(pkgDir, 'package.json'), 'utf8')).version;
|
|
34
41
|
} catch {
|
|
35
|
-
return '1.0
|
|
42
|
+
return '1.1.0';
|
|
36
43
|
}
|
|
37
44
|
}
|
|
38
45
|
|
|
@@ -47,9 +54,14 @@ Usage:
|
|
|
47
54
|
skilltally top [-n 20] [--since 30d] [--host <h>] [--project <p>] [--by-source] [--metric activations|reads] [--json]
|
|
48
55
|
skilltally unused [--since 90d] [--host <h>] [--all] [--json]
|
|
49
56
|
skilltally timeline [--skill <name>] [--by day|week|month] [--since 30d|all] [--host <h>] [--project <p>] [--json]
|
|
57
|
+
skilltally chains [--since 30d|all] [--host <h>] [--project <p>] [-n 20] [--json]
|
|
58
|
+
skilltally insights [--since 30d|all] [--host <h>] [--project <p>] [--json]
|
|
59
|
+
skilltally dashboard [-o <file>] [--since 30d|all] [--host <h>] [--project <p>] [--open] [--json]
|
|
60
|
+
skilltally prune [--since 90d] [--host all|antigravity|codex] [--plugin <name>] [--skill <name>] [--dry-run] [--json]
|
|
50
61
|
skilltally export [--format json|csv] [-o <file>] [--since all|30d] [--host <h>] [--project <p>] [--include-failed]
|
|
51
62
|
skilltally backfill [--host all|antigravity|codex|claude|gemini] [--since DATE] [--dry-run] [--json]
|
|
52
63
|
skilltally inventory [--no-project] [--json]
|
|
64
|
+
skilltally mcp
|
|
53
65
|
skilltally debug [on|off|status] [--json]
|
|
54
66
|
skilltally track --host <antigravity|claude|codex|gemini|auto>
|
|
55
67
|
|
|
@@ -70,6 +82,7 @@ function parseCliFlags(argv) {
|
|
|
70
82
|
host: { type: 'string' },
|
|
71
83
|
project: { type: 'string' },
|
|
72
84
|
skill: { type: 'string' },
|
|
85
|
+
plugin: { type: 'string', multiple: true },
|
|
73
86
|
by: { type: 'string' },
|
|
74
87
|
format: { type: 'string' },
|
|
75
88
|
output: { type: 'string', short: 'o' },
|
|
@@ -78,6 +91,7 @@ function parseCliFlags(argv) {
|
|
|
78
91
|
'by-source': { type: 'boolean', default: false },
|
|
79
92
|
json: { type: 'boolean', default: false },
|
|
80
93
|
'dry-run': { type: 'boolean', default: false },
|
|
94
|
+
open: { type: 'boolean', default: false },
|
|
81
95
|
all: { type: 'boolean', default: false },
|
|
82
96
|
'no-project': { type: 'boolean', default: false },
|
|
83
97
|
'include-failed': { type: 'boolean', default: false },
|
|
@@ -308,6 +322,154 @@ function run() {
|
|
|
308
322
|
return;
|
|
309
323
|
}
|
|
310
324
|
|
|
325
|
+
if (sub === 'chains') {
|
|
326
|
+
const since = values.since ?? '30d';
|
|
327
|
+
const limit = values.limit !== undefined ? Number(values.limit) : 20;
|
|
328
|
+
if (!Number.isFinite(limit) || limit < 1) {
|
|
329
|
+
throw new Error(`Invalid -n/--limit value: "${values.limit}"`);
|
|
330
|
+
}
|
|
331
|
+
const { events } = readAllEvents(dataHome);
|
|
332
|
+
const inventory = scanInventory({ includeProject: true });
|
|
333
|
+
const chains = buildChains({
|
|
334
|
+
events,
|
|
335
|
+
inventory,
|
|
336
|
+
config,
|
|
337
|
+
since,
|
|
338
|
+
host: values.host || null,
|
|
339
|
+
project: values.project || null,
|
|
340
|
+
limit,
|
|
341
|
+
});
|
|
342
|
+
if (values.json) {
|
|
343
|
+
console.log(JSON.stringify(chains, null, 2));
|
|
344
|
+
} else {
|
|
345
|
+
console.log(formatChains(chains));
|
|
346
|
+
}
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (sub === 'insights') {
|
|
351
|
+
const since = values.since ?? '30d';
|
|
352
|
+
const { events } = readAllEvents(dataHome);
|
|
353
|
+
const inventory = scanInventory({ includeProject: true });
|
|
354
|
+
const report = aggregateStats({
|
|
355
|
+
events,
|
|
356
|
+
inventory,
|
|
357
|
+
config,
|
|
358
|
+
since,
|
|
359
|
+
host: values.host || null,
|
|
360
|
+
project: values.project || null,
|
|
361
|
+
});
|
|
362
|
+
if (values.json) {
|
|
363
|
+
console.log(
|
|
364
|
+
JSON.stringify(
|
|
365
|
+
{
|
|
366
|
+
window: report.window,
|
|
367
|
+
totals: report.totals,
|
|
368
|
+
inventory: report.inventory,
|
|
369
|
+
insights: report.insights,
|
|
370
|
+
},
|
|
371
|
+
null,
|
|
372
|
+
2
|
|
373
|
+
)
|
|
374
|
+
);
|
|
375
|
+
} else {
|
|
376
|
+
console.log(formatInsights(report));
|
|
377
|
+
}
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (sub === 'dashboard') {
|
|
382
|
+
const since = values.since ?? '30d';
|
|
383
|
+
const by = values.by ?? 'day';
|
|
384
|
+
const { events } = readAllEvents(dataHome);
|
|
385
|
+
const inventory = scanInventory({ includeProject: true });
|
|
386
|
+
const stats = aggregateStats({
|
|
387
|
+
events,
|
|
388
|
+
inventory,
|
|
389
|
+
config,
|
|
390
|
+
since,
|
|
391
|
+
host: values.host || null,
|
|
392
|
+
project: values.project || null,
|
|
393
|
+
});
|
|
394
|
+
const timeline = buildTimeline({
|
|
395
|
+
events,
|
|
396
|
+
inventory,
|
|
397
|
+
config,
|
|
398
|
+
by,
|
|
399
|
+
since,
|
|
400
|
+
host: values.host || null,
|
|
401
|
+
project: values.project || null,
|
|
402
|
+
});
|
|
403
|
+
const dailyTimeline = buildTimeline({
|
|
404
|
+
events,
|
|
405
|
+
inventory,
|
|
406
|
+
config,
|
|
407
|
+
by: 'day',
|
|
408
|
+
since: '365d',
|
|
409
|
+
host: values.host || null,
|
|
410
|
+
project: values.project || null,
|
|
411
|
+
});
|
|
412
|
+
const chains = buildChains({
|
|
413
|
+
events,
|
|
414
|
+
inventory,
|
|
415
|
+
config,
|
|
416
|
+
since,
|
|
417
|
+
host: values.host || null,
|
|
418
|
+
project: values.project || null,
|
|
419
|
+
});
|
|
420
|
+
const outPath = values.output || join(dataHome, 'dashboard.html');
|
|
421
|
+
const html = generateDashboardHtml({ stats, timeline, dailyTimeline, chains, inventory });
|
|
422
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
423
|
+
writeFileSync(outPath, html, { encoding: 'utf8', mode: 0o600 });
|
|
424
|
+
const opened = values.open ? openInBrowser(outPath) : { opened: false };
|
|
425
|
+
if (values.json) {
|
|
426
|
+
console.log(
|
|
427
|
+
JSON.stringify({ path: outPath, bytes: Buffer.byteLength(html, 'utf8'), opened: opened.opened }, null, 2)
|
|
428
|
+
);
|
|
429
|
+
} else {
|
|
430
|
+
console.log(`Dashboard written to: ${outPath}`);
|
|
431
|
+
if (values.open) {
|
|
432
|
+
console.log(
|
|
433
|
+
opened.opened
|
|
434
|
+
? 'Opened in browser.'
|
|
435
|
+
: 'Could not open browser automatically; open the file above manually.'
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (sub === 'prune') {
|
|
443
|
+
const since = values.since ?? '90d';
|
|
444
|
+
const plugins = (Array.isArray(values.plugin) ? values.plugin : values.plugin ? [values.plugin] : [])
|
|
445
|
+
.flatMap((p) => String(p).split(','))
|
|
446
|
+
.map((p) => p.trim())
|
|
447
|
+
.filter(Boolean);
|
|
448
|
+
const skills = (values.skill ? [values.skill] : [])
|
|
449
|
+
.flatMap((s) => String(s).split(','))
|
|
450
|
+
.map((s) => s.trim())
|
|
451
|
+
.filter(Boolean);
|
|
452
|
+
const res = runPrune({
|
|
453
|
+
dataHome,
|
|
454
|
+
since,
|
|
455
|
+
host: values.host || 'all',
|
|
456
|
+
plugins,
|
|
457
|
+
skills,
|
|
458
|
+
dryRun: Boolean(values['dry-run']),
|
|
459
|
+
});
|
|
460
|
+
if (values.json) {
|
|
461
|
+
console.log(JSON.stringify(res, null, 2));
|
|
462
|
+
} else {
|
|
463
|
+
console.log(formatPrune(res));
|
|
464
|
+
}
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
if (sub === 'mcp') {
|
|
469
|
+
startMcpServer({ dataHome, pkgVersion: getVersion() });
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
|
|
311
473
|
console.error(`Unknown command: "${sub}"\n`);
|
|
312
474
|
printHelp();
|
|
313
475
|
process.exitCode = 1;
|
package/bin/track.mjs
CHANGED
|
@@ -28,11 +28,54 @@ const CLAUDE_SKILL_BASEDIR_RE =
|
|
|
28
28
|
|
|
29
29
|
const PATH_KEYS = ['Path', 'AbsolutePath', 'TargetFile', 'file_path', 'path', 'absolute_path'];
|
|
30
30
|
const ARRAY_PATH_KEYS = ['paths', 'include', 'files'];
|
|
31
|
+
const LINE_START_KEYS = ['StartLine', 'start_line', 'offset'];
|
|
32
|
+
const BYTE_OFFSET_KEYS = ['ByteOffset', 'byte_offset'];
|
|
31
33
|
const CMD_KEYS = ['CommandLine', 'command', 'cmd', 'input', 'argv'];
|
|
32
34
|
const WRITE_TOOL_RE = /^(write|edit|replace|apply_patch|multiedit|notebookedit|create_file|delete_file)/i;
|
|
33
35
|
const READ_CMD_RE = /^(cat|sed|head|tail|less|more|bat|nl|awk|type|Get-Content)\b/i;
|
|
34
36
|
const MUTATE_CMD_RE = /(?:^|\s)(?:sed|awk)\s+(?:[^\n]*\s)?(?:-i\S*|--in-place\b)|>{1,2}\s*[^\s]*SKILL\.md/i;
|
|
35
37
|
const CODEX_EXEC_CMD_RE = /\bcmd\s*:\s*("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g;
|
|
38
|
+
const DEDUPE_WINDOW_MS = 30_000;
|
|
39
|
+
|
|
40
|
+
function isContinuationReadArgs(safeArgs) {
|
|
41
|
+
for (const key of LINE_START_KEYS) {
|
|
42
|
+
const raw = safeArgs[key];
|
|
43
|
+
if (raw === undefined || raw === null) continue;
|
|
44
|
+
const unwrapped = unwrapArg(raw);
|
|
45
|
+
if (typeof unwrapped === 'string' && unwrapped.trim() === '') continue;
|
|
46
|
+
const n = Number(unwrapped);
|
|
47
|
+
if (Number.isFinite(n) && n > 1) return true;
|
|
48
|
+
}
|
|
49
|
+
for (const key of BYTE_OFFSET_KEYS) {
|
|
50
|
+
const raw = safeArgs[key];
|
|
51
|
+
if (raw === undefined || raw === null) continue;
|
|
52
|
+
const unwrapped = unwrapArg(raw);
|
|
53
|
+
if (typeof unwrapped === 'string' && unwrapped.trim() === '') continue;
|
|
54
|
+
const n = Number(unwrapped);
|
|
55
|
+
if (Number.isFinite(n) && n > 0) return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function isContinuationShellSegment(seg) {
|
|
61
|
+
const mSed = seg.match(/\bsed\b[^;&\n]*?(?:^|[\s'"=])(\d+)(?:\s*,\s*(?:\d+|\$|\+\d+))?p(?=['"\s;|&]|$)/i);
|
|
62
|
+
if (mSed && Number(mSed[1]) > 1) return true;
|
|
63
|
+
|
|
64
|
+
if (
|
|
65
|
+
(/^tail\b/i.test(seg) || /\|\s*tail\b/i.test(seg)) &&
|
|
66
|
+
!/\btail\s+(?:-[^\s]+\s+)*-n\s*\+?[01]\b/i.test(seg)
|
|
67
|
+
) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const mAwkGe = seg.match(/\bawk\b[^;&\n]*?\bNR\s*>=\s*(\d+)/i);
|
|
72
|
+
if (mAwkGe && Number(mAwkGe[1]) > 1) return true;
|
|
73
|
+
|
|
74
|
+
const mAwkGt = seg.match(/\bawk\b[^;&\n]*?\bNR\s*>\s*(\d+)/i);
|
|
75
|
+
if (mAwkGt && Number(mAwkGt[1]) >= 1) return true;
|
|
76
|
+
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
36
79
|
|
|
37
80
|
function argValue(flag, argv = process.argv) {
|
|
38
81
|
const i = argv.indexOf(flag);
|
|
@@ -263,6 +306,8 @@ export function detectSkillCalls({
|
|
|
263
306
|
}
|
|
264
307
|
};
|
|
265
308
|
|
|
309
|
+
if (isContinuationReadArgs(safeArgs)) return [];
|
|
310
|
+
|
|
266
311
|
for (const key of PATH_KEYS) {
|
|
267
312
|
if (typeof safeArgs[key] === 'string') {
|
|
268
313
|
collectFromText(unwrapArg(safeArgs[key]), 'read');
|
|
@@ -299,6 +344,7 @@ export function detectSkillCalls({
|
|
|
299
344
|
const seg = rawSeg.trim().replace(/^(?:[A-Za-z_]\w*=\S+\s+)+/, '');
|
|
300
345
|
if (!READ_CMD_RE.test(seg)) continue;
|
|
301
346
|
if (MUTATE_CMD_RE.test(seg)) continue;
|
|
347
|
+
if (isContinuationShellSegment(seg)) continue;
|
|
302
348
|
collectFromText(seg, 'shell_read');
|
|
303
349
|
}
|
|
304
350
|
}
|
|
@@ -332,6 +378,33 @@ function maybeRotateEvents(home, eventsPath) {
|
|
|
332
378
|
} catch {}
|
|
333
379
|
}
|
|
334
380
|
|
|
381
|
+
function readRecentSessionSkills(eventsPath, host, sessionId, nowMs) {
|
|
382
|
+
const recent = new Set();
|
|
383
|
+
if (!sessionId || !existsSync(eventsPath)) return recent;
|
|
384
|
+
try {
|
|
385
|
+
const raw = readFileSync(eventsPath, 'utf8');
|
|
386
|
+
const lines = raw.trim().split('\n');
|
|
387
|
+
const tail = lines.slice(-64);
|
|
388
|
+
for (const line of tail) {
|
|
389
|
+
if (!line) continue;
|
|
390
|
+
let ev;
|
|
391
|
+
try {
|
|
392
|
+
ev = JSON.parse(line);
|
|
393
|
+
} catch {
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
if (ev.ok === false || ev.host !== host || ev.session_id !== sessionId || !ev.skill) {
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
const evMs = Date.parse(ev.ts);
|
|
400
|
+
if (Number.isFinite(evMs) && Math.abs(nowMs - evMs) <= DEDUPE_WINDOW_MS) {
|
|
401
|
+
recent.add(ev.skill);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
} catch {}
|
|
405
|
+
return recent;
|
|
406
|
+
}
|
|
407
|
+
|
|
335
408
|
export function main() {
|
|
336
409
|
const hostFlag = argValue('--host') ?? 'auto';
|
|
337
410
|
const raw = readFileSync(0, 'utf8');
|
|
@@ -354,11 +427,23 @@ export function main() {
|
|
|
354
427
|
const hits = detectSkillCalls({ tool: n.tool, args: n.args, prompt: n.prompt, cwd: n.cwd });
|
|
355
428
|
if (hits.length === 0) return;
|
|
356
429
|
|
|
430
|
+
const eventsPath = join(home, 'events.jsonl');
|
|
431
|
+
const ts = new Date().toISOString();
|
|
432
|
+
const nowMs = Date.parse(ts);
|
|
433
|
+
const recentSkills = !n.failed ? readRecentSessionSkills(eventsPath, host, n.sessionId, nowMs) : new Set();
|
|
434
|
+
const seenBatch = new Set();
|
|
435
|
+
const uniqueHits = [];
|
|
436
|
+
for (const h of hits) {
|
|
437
|
+
if (n.sessionId && (recentSkills.has(h.skill) || seenBatch.has(h.skill))) continue;
|
|
438
|
+
seenBatch.add(h.skill);
|
|
439
|
+
uniqueHits.push(h);
|
|
440
|
+
}
|
|
441
|
+
if (uniqueHits.length === 0) return;
|
|
442
|
+
|
|
357
443
|
mkdirSync(home, { recursive: true, mode: 0o700 });
|
|
358
444
|
const storeCwd = readStoreCwdFlag(home);
|
|
359
|
-
const ts = new Date().toISOString();
|
|
360
445
|
|
|
361
|
-
const lines =
|
|
446
|
+
const lines = uniqueHits.map((h, idx) =>
|
|
362
447
|
JSON.stringify({
|
|
363
448
|
v: 1,
|
|
364
449
|
id: `${host}:${n.sessionId ?? '-'}:${n.callId ?? ts}#${idx}`,
|
|
@@ -379,7 +464,6 @@ export function main() {
|
|
|
379
464
|
})
|
|
380
465
|
);
|
|
381
466
|
|
|
382
|
-
const eventsPath = join(home, 'events.jsonl');
|
|
383
467
|
maybeRotateEvents(home, eventsPath);
|
|
384
468
|
appendFileSync(eventsPath, lines.join('\n') + '\n', { mode: 0o600 });
|
|
385
469
|
}
|
package/gemini-extension.json
CHANGED
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "skilltally",
|
|
3
3
|
"displayName": "SkillTally",
|
|
4
4
|
"description": "Real-time skill usage tracking via hooks for Antigravity, Claude Code, Codex & Gemini CLI. See which skills you actually use and which eat context.",
|
|
5
|
-
"version": "1.0
|
|
5
|
+
"version": "1.1.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "112516101106",
|
|
8
8
|
"url": "https://github.com/112516101106"
|
|
@@ -20,11 +20,11 @@ Prefer the fastest available invocation:
|
|
|
20
20
|
|
|
21
21
|
## Common commands
|
|
22
22
|
|
|
23
|
-
1. **Overall usage & top skills** (default 30 days):
|
|
23
|
+
1. **Overall usage, sparklines & top skills** (default 30 days):
|
|
24
24
|
```bash
|
|
25
25
|
skilltally stats --since 30d
|
|
26
26
|
```
|
|
27
|
-
Add `--json` for structured output, `--host <name>` to filter by host, or `--by-source` to separate duplicate skill names across sources.
|
|
27
|
+
Add `--json` for structured output (includes 14d `sparkline`, `via` trigger ratio, `tokenCostPerActivation`, and `insights`), `--host <name>` to filter by host, or `--by-source` to separate duplicate skill names across sources.
|
|
28
28
|
2. **Top N skills**:
|
|
29
29
|
```bash
|
|
30
30
|
skilltally top -n 20 --since 30d --metric activations
|
|
@@ -33,27 +33,42 @@ Prefer the fastest available invocation:
|
|
|
33
33
|
```bash
|
|
34
34
|
skilltally unused --since 90d
|
|
35
35
|
```
|
|
36
|
-
Shows enabled installed skills with zero activations in the window,
|
|
37
|
-
4. **
|
|
36
|
+
Shows enabled installed skills with zero activations in the window, Context Tax meter, and estimated `KB` / `~tokens/session` saved by disabling unused plugins.
|
|
37
|
+
4. **Actionable optimization insights & workflow chains**:
|
|
38
|
+
```bash
|
|
39
|
+
skilltally insights --since 30d
|
|
40
|
+
skilltally chains --since 30d
|
|
41
|
+
```
|
|
42
|
+
- `insights` surfaces Context ROI (`~tok/activation`), manual-only skills (`0%` auto-match — sharpen `SKILL.md` descriptions), single-project global skills (move to `.agents/skills` or `.claude/skills`), and per-model breakdown.
|
|
43
|
+
- `chains` reveals `A -> B` transitions, 3-step workflows, and co-occurring skill pairs within sessions.
|
|
44
|
+
5. **Interactive HTML Dashboard & visualizations**:
|
|
45
|
+
```bash
|
|
46
|
+
skilltally dashboard --since 30d --open
|
|
47
|
+
```
|
|
48
|
+
Generates a self-contained, zero-dependency HTML report (`~/.skilltally/dashboard.html` or `-o <file>`) with an interactive Context Tax Treemap, timeline, workflow flow diagram, filterable table, and Mermaid diagram snippets (`pie`, `xychart-beta`, `flowchart LR`).
|
|
49
|
+
When presenting analytics directly in chat, you can also run `--json` subcommands and render **Mermaid diagrams** (`pie`, `xychart-beta`, `flowchart LR`) or interactive HTML widgets from the JSON output.
|
|
50
|
+
6. **Timeline & export**:
|
|
38
51
|
```bash
|
|
39
52
|
skilltally timeline --skill <name> --by week
|
|
40
53
|
skilltally export --format csv -o skilltally-events.csv
|
|
41
54
|
```
|
|
42
|
-
|
|
55
|
+
7. **Preview safe plugin/skill pruning**:
|
|
43
56
|
```bash
|
|
44
|
-
skilltally
|
|
57
|
+
skilltally prune --since 90d --dry-run
|
|
45
58
|
```
|
|
46
|
-
|
|
59
|
+
8. **Import history, inspect inventory, verify hooks & MCP server**:
|
|
47
60
|
```bash
|
|
61
|
+
skilltally backfill
|
|
48
62
|
skilltally inventory --json
|
|
49
63
|
skilltally doctor
|
|
64
|
+
skilltally mcp
|
|
50
65
|
```
|
|
51
66
|
|
|
52
67
|
If `stats` shows zero events, run `skilltally doctor` to check hook installation, then suggest `skilltally install` and `skilltally backfill`.
|
|
53
68
|
|
|
54
69
|
## Rules
|
|
55
70
|
|
|
56
|
-
- **Never delete, uninstall, or disable skills or plugins yourself
|
|
71
|
+
- **Never delete, uninstall, or disable skills or plugins yourself** (never run `skilltally prune` without `--dry-run`) unless the user explicitly asks you to disable specific items; present the findings and let the user decide.
|
|
57
72
|
- Report **activations** (unique `session × skill` pairs) as the primary metric and **reads** (total invocations) as secondary.
|
|
58
73
|
- When reporting unused skills or plugins, include the **Context Tax** (`KB` and `~tokens/session`) so the user knows the context benefit of disabling a plugin.
|
|
59
74
|
- Always state the time window (`--since`) and which hosts contributed data.
|
package/src/core/normalize.mjs
CHANGED
|
@@ -41,7 +41,7 @@ export function canonicalizeEvent(ev, inventoryIndex = null, aliases = {}) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export function dedupeEvents(events, windowMs =
|
|
44
|
+
export function dedupeEvents(events, windowMs = 30_000) {
|
|
45
45
|
// Prioritize real-time hook events over backfill events when deduplicating.
|
|
46
46
|
const ordered = [
|
|
47
47
|
...events.filter((e) => e.origin === 'hook'),
|
|
@@ -88,7 +88,7 @@ export function installAntigravity({
|
|
|
88
88
|
|
|
89
89
|
writeJsonAtomic(join(target, 'hooks.json'), buildAntigravityHooksJson(), 0o644);
|
|
90
90
|
|
|
91
|
-
let version = '1.0.
|
|
91
|
+
let version = '1.0.3';
|
|
92
92
|
try {
|
|
93
93
|
version = JSON.parse(readFileSync(join(pkgRoot, 'package.json'), 'utf8')).version || version;
|
|
94
94
|
} catch {}
|