@jcorpac/skill-vault 1.1.0 → 1.3.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 CHANGED
@@ -79,6 +79,8 @@ python scripts/skill_vault.py verify
79
79
  | Command | Description |
80
80
  | :--- | :--- |
81
81
  | `skill-vault init` | Bootstrap standard skill and archive folders in workspace. |
82
+ | `skill-vault optimize` | Auto-minimize active skills to essential Core + workspace stack. |
83
+ | `skill-vault optimize --dry-run` | Preview auto-minimization changes without moving files. |
82
84
  | `skill-vault list` | Present all active skills (L1) and archived skills (L2). |
83
85
  | `skill-vault status` | Fast summary of skill counts and category breakdown. |
84
86
  | `skill-vault list --active` | List only active skills currently loaded in context memory. |
package/SKILL.md CHANGED
@@ -1,6 +1,17 @@
1
1
  ---
2
2
  name: skill-vault
3
- description: Universal agent-agnostic and OS-agnostic skill router, tiered storage manager, and lifecycle auditor. Solves context bloat and skill bleed by managing active skills vs archived cold storage across environments (Google Antigravity, Claude Code, Cursor, CI/CD).
3
+ description: >-
4
+ Universal agent-agnostic skill router and tiered storage manager for 210+ specialized domain skills in cold storage.
5
+ ALWAYS use this skill whenever the task involves domains or tools not in active memory, including:
6
+ (1) AlloyDB (Omni, replication, vector, tuning),
7
+ (2) Cloud SQL (Postgres, MySQL, backup/DR, performance),
8
+ (3) BigQuery & Data Warehouse (dbt, Dataform, optimization),
9
+ (4) GCP & Data Engineering (Airflow/Composer, Spanner, Dataproc, GCS),
10
+ (5) Gemini API & AI Agents (ADK, Live API, Omni Flash, evals),
11
+ (6) Science & Biomedicine (AlphaFold, AlphaGenome, Foldseek, ChEMBL, PDB, PyMOL, PubMed, variant analysis),
12
+ (7) Android Development, or
13
+ (8) General Utilities.
14
+ Search or restore skills on demand via 'python scripts/skill_vault.py search "<keyword>"', view 'skill_archive/INDEX.md', or run 'restore <name>'.
4
15
  ---
5
16
 
6
17
  # Skill Vault: Universal Agent Skill Lifecycle & Storage Manager
@@ -116,6 +127,19 @@ python scripts/skill_vault.py verify
116
127
  python scripts/skill_vault.py verify --fix
117
128
  ```
118
129
 
130
+ ### H. Automated Context Optimization (Zero-Effort Pruning & Mounting)
131
+ To automatically keep only the minimum necessary skills active in context memory (L1) based on workspace fingerprints, while parking unneeded skills in cold storage (L2):
132
+ ```bash
133
+ # Automatically optimize active skills for the current workspace
134
+ python scripts/skill_vault.py optimize
135
+
136
+ # Preview what would be archived and mounted without moving files
137
+ python scripts/skill_vault.py optimize --dry-run
138
+
139
+ # Optimize for a specific workspace folder and protect custom skills
140
+ python scripts/skill_vault.py optimize --workspace "C:\Projects\my-repo" --protect my-custom-skill
141
+ ```
142
+
119
143
  ---
120
144
 
121
145
  ## 3. Environment & OS Compatibility Guidelines
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcorpac/skill-vault",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Universal Agent Skill Router, Lifecycle Manager, and Tiered Storage Engine for AI Coding Agents.",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "files": [
11
11
  "bin/",
12
- "scripts/",
12
+ "scripts/skill_vault.py",
13
13
  "SKILL.md",
14
14
  "README.md",
15
15
  "LICENSE"
@@ -15,6 +15,58 @@ import re
15
15
  import shutil
16
16
  import sys
17
17
 
18
+ # Default Core Foundation Skills that are protected from auto-archiving
19
+ DEFAULT_CORE_SKILLS = {
20
+ "skill-vault",
21
+ "accidental-data-loss-prevention",
22
+ "managing-python-dependencies",
23
+ "find-skills",
24
+ "skill-repair",
25
+ }
26
+
27
+ # Workspace fingerprint signatures mapping to skill categories
28
+ WORKSPACE_FINGERPRINTS = {
29
+ "BigQuery & Data Warehouse": [
30
+ "dbt_project.yml",
31
+ "dataform.json",
32
+ "bigquery.json",
33
+ "*.sql",
34
+ ],
35
+ "GCP & Data Engineering": [
36
+ "dags",
37
+ "airflow.cfg",
38
+ "cloudbuild.yaml",
39
+ "cloudbuild.json",
40
+ "*.tf",
41
+ "Dockerfile",
42
+ ],
43
+ "AlloyDB": [
44
+ "alembic.ini",
45
+ "alloydb.json",
46
+ ],
47
+ "Cloud SQL": [
48
+ "cloudsql.json",
49
+ ],
50
+ "Science & Biomedicine": [
51
+ "*.pdb",
52
+ "*.fasta",
53
+ "*.fa",
54
+ "*.cif",
55
+ "*.vcf",
56
+ "*.bam",
57
+ ],
58
+ "Gemini API & AI Agents": [
59
+ "agent.py",
60
+ "evals.py",
61
+ "gemini.json",
62
+ ],
63
+ "Android Development": [
64
+ "build.gradle",
65
+ "build.gradle.kts",
66
+ "AndroidManifest.xml",
67
+ ],
68
+ }
69
+
18
70
 
19
71
  def resolve_base_dir(cli_base=None):
20
72
  """Dynamically resolve the base directory for skills and archives."""
@@ -230,6 +282,113 @@ class SkillVault:
230
282
 
231
283
  return indexed_skills
232
284
 
285
+ # --- Workspace & Optimization Engine ---
286
+
287
+ def detect_workspace_categories(self, workspace_path=None):
288
+ """Inspect workspace files and return matched skill categories."""
289
+ target_ws = Path(workspace_path).resolve() if workspace_path else Path.cwd().resolve()
290
+ matched = {}
291
+
292
+ for category, patterns in WORKSPACE_FINGERPRINTS.items():
293
+ for pat in patterns:
294
+ if "*" in pat:
295
+ matches = list(target_ws.glob(pat)) + list(target_ws.glob(f"**/{pat}"))[:5]
296
+ if matches:
297
+ matched.setdefault(category, []).append(pat)
298
+ break
299
+ else:
300
+ if (target_ws / pat).exists() or list(target_ws.glob(f"**/{pat}"))[:1]:
301
+ matched.setdefault(category, []).append(pat)
302
+ break
303
+
304
+ return matched
305
+
306
+ def optimize(self, workspace_path=None, protected_skills=None, dry_run=False):
307
+ """Automatically minimize active skills to essential Core + workspace-relevant skills.
308
+
309
+ Archives unneeded active skills into cold storage and mounts matching domain skills.
310
+ """
311
+ target_ws = Path(workspace_path).resolve() if workspace_path else Path.cwd().resolve()
312
+ core_set = set(DEFAULT_CORE_SKILLS)
313
+ if protected_skills:
314
+ core_set.update(protected_skills)
315
+
316
+ print("==================================================")
317
+ print(" SKILL VAULT AUTO-OPTIMIZATION")
318
+ print(f" Target Workspace: {target_ws}")
319
+ print("==================================================\n")
320
+
321
+ # 1. Detect workspace domain
322
+ detected_categories = self.detect_workspace_categories(target_ws)
323
+ if detected_categories:
324
+ print("Detected Tech Stack & Fingerprints:")
325
+ for cat, sigs in detected_categories.items():
326
+ print(f" * {cat} (matched: {', '.join(sigs)})")
327
+ else:
328
+ print("Detected Tech Stack: Generic / Multi-purpose (Only Core Foundation Skills required)")
329
+ print("")
330
+
331
+ # 2. Inspect active skills vs vault
332
+ active_map = self.get_active_skills()
333
+ manifest = self.load_manifest()
334
+ manifest_by_name = {m["name"]: m for m in manifest}
335
+
336
+ to_archive = []
337
+ to_keep = []
338
+
339
+ for name, data in active_map.items():
340
+ if name in core_set:
341
+ to_keep.append((name, "Core Foundation Skill"))
342
+ else:
343
+ skill_cat = manifest_by_name.get(name, {}).get("category", "General & Utility Skills")
344
+ if skill_cat in detected_categories:
345
+ to_keep.append((name, f"Matched Stack ({skill_cat})"))
346
+ else:
347
+ to_archive.append((name, skill_cat))
348
+
349
+ # 3. Determine skills in vault that should be mounted
350
+ to_mount = []
351
+ for cat in detected_categories.keys():
352
+ for item in manifest:
353
+ if item.get("category") == cat and item["name"] not in active_map:
354
+ to_mount.append((item["name"], cat))
355
+
356
+ # Output Plan
357
+ print(f"Active Skills Action Plan:")
358
+ print(f" * Retained in Context ({len(to_keep)} skills):")
359
+ for name, reason in to_keep:
360
+ print(f" [KEEP] {name} - {reason}")
361
+
362
+ if to_archive:
363
+ print(f"\n * Evicting to Cold Storage Archive ({len(to_archive)} skills):")
364
+ for name, cat in to_archive:
365
+ print(f" [ARCHIVE] {name} ({cat})")
366
+ else:
367
+ print("\n * Evictions: None needed (Context is already minimal).")
368
+
369
+ if to_mount:
370
+ print(f"\n * Mounting from Vault ({len(to_mount)} skills):")
371
+ for name, cat in to_mount:
372
+ print(f" [MOUNT] {name} ({cat})")
373
+
374
+ if dry_run:
375
+ print("\n[Dry Run] Optimization preview complete. No files were moved.")
376
+ return
377
+
378
+ # Execute Evictions (Archive)
379
+ if to_archive:
380
+ print("\nExecuting Auto-Archival...")
381
+ for name, cat in to_archive:
382
+ self.archive(name=name, category=cat, keep_active=False)
383
+
384
+ # Execute Mounts (Restore)
385
+ if to_mount:
386
+ print("\nExecuting Auto-Mounts...")
387
+ for name, cat in to_mount:
388
+ self.restore(name=name)
389
+
390
+ print("\n[OK] Optimization complete! Active context surface is at absolute minimum.")
391
+
233
392
  # --- Actions ---
234
393
 
235
394
  def list_skills(self, show_active=True, show_archived=True, category_filter=None, as_json=False, summary_only=False):
@@ -237,11 +396,9 @@ class SkillVault:
237
396
  active_map = self.get_active_skills() if show_active else {}
238
397
  manifest = self.load_manifest() if show_archived else []
239
398
 
240
- # Filter manifest by category if requested
241
399
  if category_filter and show_archived:
242
400
  manifest = [m for m in manifest if m.get("category", "").lower() == category_filter.lower()]
243
401
 
244
- # Group archived by category
245
402
  archived_by_cat = {}
246
403
  for item in manifest:
247
404
  cat = item.get("category", "General & Utility Skills")
@@ -270,7 +427,6 @@ class SkillVault:
270
427
  print(f" Base Directory: {self.base_dir}")
271
428
  print("==================================================\n")
272
429
 
273
- # Summary Header
274
430
  total_active = len(active_map)
275
431
  total_archived = len(manifest)
276
432
  total_categories = len(archived_by_cat)
@@ -290,7 +446,6 @@ class SkillVault:
290
446
  print("")
291
447
  return
292
448
 
293
- # 1. Present Active Skills
294
449
  if show_active:
295
450
  print("--------------------------------------------------")
296
451
  print(f" [L1 ACTIVE SKILLS] ({total_active} in context)")
@@ -306,7 +461,6 @@ class SkillVault:
306
461
  print(f" Path: {data['relative_path']}")
307
462
  print("")
308
463
 
309
- # 2. Present Archived Skills
310
464
  if show_archived:
311
465
  print("--------------------------------------------------")
312
466
  print(f" [L2 ARCHIVED SKILLS] ({total_archived} in vault)")
@@ -450,7 +604,6 @@ class SkillVault:
450
604
  "archived_path": self.make_portable_path(archived_path),
451
605
  }
452
606
 
453
- # Discover all archive directories physically on disk
454
607
  disk_skills = self.get_archived_skill_folders()
455
608
  for name, data in disk_skills.items():
456
609
  if data["has_skill_md"] and name not in manifest_by_folder:
@@ -461,7 +614,6 @@ class SkillVault:
461
614
  "archived_path": self.make_portable_path(data["folder"]),
462
615
  }
463
616
 
464
- # Group by category
465
617
  categories = {}
466
618
  for name, item in manifest_by_folder.items():
467
619
  cat = item.get("category") or "General & Utility Skills"
@@ -514,14 +666,12 @@ class SkillVault:
514
666
  issues = []
515
667
  warnings = []
516
668
 
517
- # 1. Check Disk Skill Folders
518
669
  for name, d in disk_skills.items():
519
670
  if not d["has_skill_md"]:
520
671
  issues.append(f"[Disk Error] Folder '{name}' in archive is missing SKILL.md")
521
672
  elif d["size"] == 0:
522
673
  issues.append(f"[Disk Error] SKILL.md in '{name}' is 0 bytes (empty file)")
523
674
 
524
- # 2. Check Disk vs Manifest
525
675
  disk_names = set(disk_skills.keys())
526
676
  manifest_names = set(manifest_map.keys())
527
677
 
@@ -535,7 +685,6 @@ class SkillVault:
535
685
  for name in sorted(phantom_manifest):
536
686
  issues.append(f"[Phantom Manifest Entry] '{name}' listed in backup_manifest.json but NOT found on disk")
537
687
 
538
- # 3. Check Manifest Path Integrity
539
688
  for item in manifest:
540
689
  name = item["name"]
541
690
  archived_path = self.resolve_portable_path(item.get("archived_path", ""))
@@ -547,7 +696,6 @@ class SkillVault:
547
696
  if not item.get("category"):
548
697
  warnings.append(f"[Missing Category] '{name}' in manifest has no category assigned")
549
698
 
550
- # 4. Check Disk vs INDEX.md
551
699
  index_names = set(indexed_skills.keys())
552
700
  unindexed_disk = disk_names - index_names
553
701
  if unindexed_disk:
@@ -559,13 +707,11 @@ class SkillVault:
559
707
  for name in sorted(phantom_index):
560
708
  issues.append(f"[Phantom Index Entry] '{name}' listed in INDEX.md but does NOT exist on disk")
561
709
 
562
- # 5. Check INDEX.md vs Manifest
563
710
  unindexed_manifest = manifest_names - index_names
564
711
  if unindexed_manifest:
565
712
  for name in sorted(unindexed_manifest):
566
713
  issues.append(f"[Manifest/Index Mismatch] '{name}' is in backup_manifest.json but NOT in INDEX.md")
567
714
 
568
- # 6. Check INDEX.md Link Validity
569
715
  for name, data in indexed_skills.items():
570
716
  link_path_str = data.get("link_path")
571
717
  if link_path_str:
@@ -576,7 +722,6 @@ class SkillVault:
576
722
  if not target_file.exists():
577
723
  issues.append(f"[Broken Index Link] '{name}' link target missing: {target_file}")
578
724
 
579
- # Summary Metrics
580
725
  print("Component Counts:")
581
726
  print(f" * Physical Folders on Disk: {len(disk_skills)}")
582
727
  print(f" * Entries in backup_manifest.json: {len(manifest)}")
@@ -645,6 +790,12 @@ def main():
645
790
  # Init
646
791
  p_init = subparsers.add_parser("init", help="Bootstrap standard skill directory structure in workspace")
647
792
 
793
+ # Optimize / Auto-Tune
794
+ p_opt = subparsers.add_parser("optimize", help="Auto-minimize active skills to essential Core + workspace stack")
795
+ p_opt.add_argument("--workspace", help="Path to workspace directory to inspect")
796
+ p_opt.add_argument("--protect", nargs="*", help="Additional skill names to protect from auto-archiving")
797
+ p_opt.add_argument("--dry-run", action="store_true", help="Preview optimization changes without moving files")
798
+
648
799
  # List / Overview
649
800
  p_list = subparsers.add_parser("list", help="Present active and archived skills")
650
801
  p_list.add_argument("-a", "--active", action="store_true", help="List only active skills (L1 Context)")
@@ -693,6 +844,8 @@ def main():
693
844
 
694
845
  if args.command == "init":
695
846
  mgr.init()
847
+ elif args.command == "optimize":
848
+ mgr.optimize(workspace_path=args.workspace, protected_skills=args.protect, dry_run=args.dry_run)
696
849
  elif args.command == "list":
697
850
  show_active = not args.archived or args.active
698
851
  show_archived = not args.active or args.archived