@jcorpac/skill-vault 1.0.0 → 1.2.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 +6 -0
- package/SKILL.md +34 -2
- package/package.json +2 -2
- package/scripts/skill_vault.py +299 -11
package/README.md
CHANGED
|
@@ -79,6 +79,12 @@ 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. |
|
|
84
|
+
| `skill-vault list` | Present all active skills (L1) and archived skills (L2). |
|
|
85
|
+
| `skill-vault status` | Fast summary of skill counts and category breakdown. |
|
|
86
|
+
| `skill-vault list --active` | List only active skills currently loaded in context memory. |
|
|
87
|
+
| `skill-vault list --archived` | List only cold-storage skills grouped by category. |
|
|
82
88
|
| `skill-vault archive <name> --category "<Cat>"` | Move active skill to archive with category metadata. |
|
|
83
89
|
| `skill-vault archive --pattern "gcp-*"` | Archive multiple matching skills via glob pattern. |
|
|
84
90
|
| `skill-vault recategorize <name> "<New Cat>"` | Reorganize skill category without modifying `SKILL.md`. |
|
package/SKILL.md
CHANGED
|
@@ -82,12 +82,31 @@ To rebuild `INDEX.md` and ensure all paths and category sections are synchronize
|
|
|
82
82
|
python scripts/skill_vault.py reindex
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
### E.
|
|
85
|
+
### E. Presenting Skills & Tier Status
|
|
86
|
+
To get a rapid overview of what skills are currently in active context memory (L1) vs. cold storage (L2):
|
|
87
|
+
```bash
|
|
88
|
+
# Full overview of active and archived skills
|
|
89
|
+
python scripts/skill_vault.py list
|
|
90
|
+
|
|
91
|
+
# Quick breakdown of counts and categories
|
|
92
|
+
python scripts/skill_vault.py status
|
|
93
|
+
|
|
94
|
+
# List only active skills in context
|
|
95
|
+
python scripts/skill_vault.py list --active
|
|
96
|
+
|
|
97
|
+
# List archived skills in a specific category
|
|
98
|
+
python scripts/skill_vault.py list --archived --category "Cloud SQL"
|
|
99
|
+
|
|
100
|
+
# Output structured JSON (for scripts/dashboards)
|
|
101
|
+
python scripts/skill_vault.py list --json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### F. Skill Discovery & Keyword Search
|
|
86
105
|
```bash
|
|
87
106
|
python scripts/skill_vault.py search "<keyword>"
|
|
88
107
|
```
|
|
89
108
|
|
|
90
|
-
###
|
|
109
|
+
### G. Archive Integrity Audit & Self-Healing
|
|
91
110
|
To confirm bi-directional consistency across disk folders, `backup_manifest.json`, and `INDEX.md`:
|
|
92
111
|
```bash
|
|
93
112
|
# Run integrity verification audit
|
|
@@ -97,6 +116,19 @@ python scripts/skill_vault.py verify
|
|
|
97
116
|
python scripts/skill_vault.py verify --fix
|
|
98
117
|
```
|
|
99
118
|
|
|
119
|
+
### H. Automated Context Optimization (Zero-Effort Pruning & Mounting)
|
|
120
|
+
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):
|
|
121
|
+
```bash
|
|
122
|
+
# Automatically optimize active skills for the current workspace
|
|
123
|
+
python scripts/skill_vault.py optimize
|
|
124
|
+
|
|
125
|
+
# Preview what would be archived and mounted without moving files
|
|
126
|
+
python scripts/skill_vault.py optimize --dry-run
|
|
127
|
+
|
|
128
|
+
# Optimize for a specific workspace folder and protect custom skills
|
|
129
|
+
python scripts/skill_vault.py optimize --workspace "C:\Projects\my-repo" --protect my-custom-skill
|
|
130
|
+
```
|
|
131
|
+
|
|
100
132
|
---
|
|
101
133
|
|
|
102
134
|
## 3. Environment & OS Compatibility Guidelines
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jcorpac/skill-vault",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.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"
|
package/scripts/skill_vault.py
CHANGED
|
@@ -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."""
|
|
@@ -71,8 +123,8 @@ class SkillVault:
|
|
|
71
123
|
if not self.index_file.exists():
|
|
72
124
|
self.index_file.write_text("# Skill Archive Index\n\nTotal Archived Skills: 0\n", encoding="utf-8")
|
|
73
125
|
print(f"[Initialized] Skill Vault initialized at: {self.base_dir}")
|
|
74
|
-
print(f"
|
|
75
|
-
print(f"
|
|
126
|
+
print(f" * Active skills: {self.skills_dir}")
|
|
127
|
+
print(f" * Archive store: {self.archive_dir}")
|
|
76
128
|
|
|
77
129
|
def get_active_skill_dirs(self):
|
|
78
130
|
"""Discover active skill directories."""
|
|
@@ -92,6 +144,22 @@ class SkillVault:
|
|
|
92
144
|
dirs.append(p / "skills")
|
|
93
145
|
return dirs
|
|
94
146
|
|
|
147
|
+
def get_active_skills(self):
|
|
148
|
+
"""Discover all currently active skills on disk."""
|
|
149
|
+
active = {}
|
|
150
|
+
for search_dir in self.get_active_skill_dirs():
|
|
151
|
+
if search_dir.exists():
|
|
152
|
+
for folder in search_dir.iterdir():
|
|
153
|
+
if folder.is_dir() and (folder / "SKILL.md").exists():
|
|
154
|
+
desc = self.parse_skill_description(folder / "SKILL.md")
|
|
155
|
+
active[folder.name] = {
|
|
156
|
+
"name": folder.name,
|
|
157
|
+
"path": str(folder),
|
|
158
|
+
"relative_path": self.make_portable_path(folder),
|
|
159
|
+
"description": desc,
|
|
160
|
+
}
|
|
161
|
+
return active
|
|
162
|
+
|
|
95
163
|
def get_archived_skill_folders(self):
|
|
96
164
|
"""Discover all skill folders physically present in the archive directory."""
|
|
97
165
|
archive_subdirs = [self.archive_dir / "skills"]
|
|
@@ -214,8 +282,200 @@ class SkillVault:
|
|
|
214
282
|
|
|
215
283
|
return indexed_skills
|
|
216
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
|
+
|
|
217
392
|
# --- Actions ---
|
|
218
393
|
|
|
394
|
+
def list_skills(self, show_active=True, show_archived=True, category_filter=None, as_json=False, summary_only=False):
|
|
395
|
+
"""Present active and archived skills in structured, human-readable or JSON formats."""
|
|
396
|
+
active_map = self.get_active_skills() if show_active else {}
|
|
397
|
+
manifest = self.load_manifest() if show_archived else []
|
|
398
|
+
|
|
399
|
+
if category_filter and show_archived:
|
|
400
|
+
manifest = [m for m in manifest if m.get("category", "").lower() == category_filter.lower()]
|
|
401
|
+
|
|
402
|
+
archived_by_cat = {}
|
|
403
|
+
for item in manifest:
|
|
404
|
+
cat = item.get("category", "General & Utility Skills")
|
|
405
|
+
archived_path = self.resolve_portable_path(item["archived_path"])
|
|
406
|
+
skill_md = archived_path / "SKILL.md"
|
|
407
|
+
desc = self.parse_skill_description(skill_md)
|
|
408
|
+
archived_by_cat.setdefault(cat, []).append({
|
|
409
|
+
"name": item["name"],
|
|
410
|
+
"path": str(archived_path),
|
|
411
|
+
"relative_path": item["archived_path"],
|
|
412
|
+
"description": desc,
|
|
413
|
+
})
|
|
414
|
+
|
|
415
|
+
if as_json:
|
|
416
|
+
result = {}
|
|
417
|
+
if show_active:
|
|
418
|
+
result["active"] = list(active_map.values())
|
|
419
|
+
if show_archived:
|
|
420
|
+
result["archived"] = archived_by_cat
|
|
421
|
+
result["archived_total"] = len(manifest)
|
|
422
|
+
print(json.dumps(result, indent=2))
|
|
423
|
+
return
|
|
424
|
+
|
|
425
|
+
print("==================================================")
|
|
426
|
+
print(" SKILL VAULT OVERVIEW")
|
|
427
|
+
print(f" Base Directory: {self.base_dir}")
|
|
428
|
+
print("==================================================\n")
|
|
429
|
+
|
|
430
|
+
total_active = len(active_map)
|
|
431
|
+
total_archived = len(manifest)
|
|
432
|
+
total_categories = len(archived_by_cat)
|
|
433
|
+
|
|
434
|
+
print("Storage Tier Summary:")
|
|
435
|
+
if show_active:
|
|
436
|
+
print(f" * L1 Active Context Memory: {total_active} skill(s)")
|
|
437
|
+
if show_archived:
|
|
438
|
+
print(f" * L2 Cold Storage Archive: {total_archived} skill(s) across {total_categories} categories")
|
|
439
|
+
print("")
|
|
440
|
+
|
|
441
|
+
if summary_only:
|
|
442
|
+
if show_archived and archived_by_cat:
|
|
443
|
+
print("Archived Categories Breakdown:")
|
|
444
|
+
for cat, skills in sorted(archived_by_cat.items()):
|
|
445
|
+
print(f" - {cat}: {len(skills)} skill(s)")
|
|
446
|
+
print("")
|
|
447
|
+
return
|
|
448
|
+
|
|
449
|
+
if show_active:
|
|
450
|
+
print("--------------------------------------------------")
|
|
451
|
+
print(f" [L1 ACTIVE SKILLS] ({total_active} in context)")
|
|
452
|
+
print("--------------------------------------------------")
|
|
453
|
+
if not active_map:
|
|
454
|
+
print(" (No active skills found. Use 'restore' to mount skills from archive.)\n")
|
|
455
|
+
else:
|
|
456
|
+
for name, data in sorted(active_map.items()):
|
|
457
|
+
desc = data["description"]
|
|
458
|
+
desc_snippet = desc[:110] + "..." if len(desc) > 110 else desc
|
|
459
|
+
print(f" * {name}")
|
|
460
|
+
print(f" Desc: {desc_snippet}")
|
|
461
|
+
print(f" Path: {data['relative_path']}")
|
|
462
|
+
print("")
|
|
463
|
+
|
|
464
|
+
if show_archived:
|
|
465
|
+
print("--------------------------------------------------")
|
|
466
|
+
print(f" [L2 ARCHIVED SKILLS] ({total_archived} in vault)")
|
|
467
|
+
print("--------------------------------------------------")
|
|
468
|
+
if not archived_by_cat:
|
|
469
|
+
print(" (No archived skills found.)\n")
|
|
470
|
+
else:
|
|
471
|
+
for cat, skills in sorted(archived_by_cat.items()):
|
|
472
|
+
print(f"\n [{cat}] ({len(skills)} skills):")
|
|
473
|
+
for s in sorted(skills, key=lambda x: x["name"].lower()):
|
|
474
|
+
desc = s["description"]
|
|
475
|
+
desc_snippet = desc[:110] + "..." if len(desc) > 110 else desc
|
|
476
|
+
print(f" * {s['name']}: {desc_snippet}")
|
|
477
|
+
print("")
|
|
478
|
+
|
|
219
479
|
def archive(self, name=None, pattern=None, category=None, keep_active=False):
|
|
220
480
|
"""Archive active skills with an assigned category."""
|
|
221
481
|
manifest = self.load_manifest()
|
|
@@ -344,7 +604,6 @@ class SkillVault:
|
|
|
344
604
|
"archived_path": self.make_portable_path(archived_path),
|
|
345
605
|
}
|
|
346
606
|
|
|
347
|
-
# Discover all archive directories physically on disk
|
|
348
607
|
disk_skills = self.get_archived_skill_folders()
|
|
349
608
|
for name, data in disk_skills.items():
|
|
350
609
|
if data["has_skill_md"] and name not in manifest_by_folder:
|
|
@@ -355,7 +614,6 @@ class SkillVault:
|
|
|
355
614
|
"archived_path": self.make_portable_path(data["folder"]),
|
|
356
615
|
}
|
|
357
616
|
|
|
358
|
-
# Group by category
|
|
359
617
|
categories = {}
|
|
360
618
|
for name, item in manifest_by_folder.items():
|
|
361
619
|
cat = item.get("category") or "General & Utility Skills"
|
|
@@ -408,14 +666,12 @@ class SkillVault:
|
|
|
408
666
|
issues = []
|
|
409
667
|
warnings = []
|
|
410
668
|
|
|
411
|
-
# 1. Check Disk Skill Folders
|
|
412
669
|
for name, d in disk_skills.items():
|
|
413
670
|
if not d["has_skill_md"]:
|
|
414
671
|
issues.append(f"[Disk Error] Folder '{name}' in archive is missing SKILL.md")
|
|
415
672
|
elif d["size"] == 0:
|
|
416
673
|
issues.append(f"[Disk Error] SKILL.md in '{name}' is 0 bytes (empty file)")
|
|
417
674
|
|
|
418
|
-
# 2. Check Disk vs Manifest
|
|
419
675
|
disk_names = set(disk_skills.keys())
|
|
420
676
|
manifest_names = set(manifest_map.keys())
|
|
421
677
|
|
|
@@ -429,7 +685,6 @@ class SkillVault:
|
|
|
429
685
|
for name in sorted(phantom_manifest):
|
|
430
686
|
issues.append(f"[Phantom Manifest Entry] '{name}' listed in backup_manifest.json but NOT found on disk")
|
|
431
687
|
|
|
432
|
-
# 3. Check Manifest Path Integrity
|
|
433
688
|
for item in manifest:
|
|
434
689
|
name = item["name"]
|
|
435
690
|
archived_path = self.resolve_portable_path(item.get("archived_path", ""))
|
|
@@ -441,7 +696,6 @@ class SkillVault:
|
|
|
441
696
|
if not item.get("category"):
|
|
442
697
|
warnings.append(f"[Missing Category] '{name}' in manifest has no category assigned")
|
|
443
698
|
|
|
444
|
-
# 4. Check Disk vs INDEX.md
|
|
445
699
|
index_names = set(indexed_skills.keys())
|
|
446
700
|
unindexed_disk = disk_names - index_names
|
|
447
701
|
if unindexed_disk:
|
|
@@ -453,13 +707,11 @@ class SkillVault:
|
|
|
453
707
|
for name in sorted(phantom_index):
|
|
454
708
|
issues.append(f"[Phantom Index Entry] '{name}' listed in INDEX.md but does NOT exist on disk")
|
|
455
709
|
|
|
456
|
-
# 5. Check INDEX.md vs Manifest
|
|
457
710
|
unindexed_manifest = manifest_names - index_names
|
|
458
711
|
if unindexed_manifest:
|
|
459
712
|
for name in sorted(unindexed_manifest):
|
|
460
713
|
issues.append(f"[Manifest/Index Mismatch] '{name}' is in backup_manifest.json but NOT in INDEX.md")
|
|
461
714
|
|
|
462
|
-
# 6. Check INDEX.md Link Validity
|
|
463
715
|
for name, data in indexed_skills.items():
|
|
464
716
|
link_path_str = data.get("link_path")
|
|
465
717
|
if link_path_str:
|
|
@@ -470,7 +722,6 @@ class SkillVault:
|
|
|
470
722
|
if not target_file.exists():
|
|
471
723
|
issues.append(f"[Broken Index Link] '{name}' link target missing: {target_file}")
|
|
472
724
|
|
|
473
|
-
# Summary Metrics
|
|
474
725
|
print("Component Counts:")
|
|
475
726
|
print(f" * Physical Folders on Disk: {len(disk_skills)}")
|
|
476
727
|
print(f" * Entries in backup_manifest.json: {len(manifest)}")
|
|
@@ -539,6 +790,24 @@ def main():
|
|
|
539
790
|
# Init
|
|
540
791
|
p_init = subparsers.add_parser("init", help="Bootstrap standard skill directory structure in workspace")
|
|
541
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
|
+
|
|
799
|
+
# List / Overview
|
|
800
|
+
p_list = subparsers.add_parser("list", help="Present active and archived skills")
|
|
801
|
+
p_list.add_argument("-a", "--active", action="store_true", help="List only active skills (L1 Context)")
|
|
802
|
+
p_list.add_argument("-c", "--archived", action="store_true", help="List only archived skills (L2 Vault)")
|
|
803
|
+
p_list.add_argument("--category", help="Filter by category")
|
|
804
|
+
p_list.add_argument("--summary", action="store_true", help="Show compact category summary")
|
|
805
|
+
p_list.add_argument("--json", action="store_true", help="Output in structured JSON format")
|
|
806
|
+
|
|
807
|
+
# Status (alias for list --summary)
|
|
808
|
+
p_stat = subparsers.add_parser("status", help="Show summary of active and archived skills")
|
|
809
|
+
p_stat.add_argument("--json", action="store_true", help="Output in structured JSON format")
|
|
810
|
+
|
|
542
811
|
# Archive
|
|
543
812
|
p_arch = subparsers.add_parser("archive", help="Archive active skills into cold storage")
|
|
544
813
|
p_arch.add_argument("name", nargs="?", help="Specific skill name")
|
|
@@ -575,6 +844,25 @@ def main():
|
|
|
575
844
|
|
|
576
845
|
if args.command == "init":
|
|
577
846
|
mgr.init()
|
|
847
|
+
elif args.command == "optimize":
|
|
848
|
+
mgr.optimize(workspace_path=args.workspace, protected_skills=args.protect, dry_run=args.dry_run)
|
|
849
|
+
elif args.command == "list":
|
|
850
|
+
show_active = not args.archived or args.active
|
|
851
|
+
show_archived = not args.active or args.archived
|
|
852
|
+
mgr.list_skills(
|
|
853
|
+
show_active=show_active,
|
|
854
|
+
show_archived=show_archived,
|
|
855
|
+
category_filter=args.category,
|
|
856
|
+
as_json=args.json,
|
|
857
|
+
summary_only=args.summary,
|
|
858
|
+
)
|
|
859
|
+
elif args.command == "status":
|
|
860
|
+
mgr.list_skills(
|
|
861
|
+
show_active=True,
|
|
862
|
+
show_archived=True,
|
|
863
|
+
as_json=args.json,
|
|
864
|
+
summary_only=True,
|
|
865
|
+
)
|
|
578
866
|
elif args.command == "archive":
|
|
579
867
|
mgr.archive(name=args.name, pattern=args.pattern, category=args.category, keep_active=args.keep_active)
|
|
580
868
|
elif args.command == "recategorize":
|