@jcorpac/skill-vault 1.8.0 → 2.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/README.md CHANGED
@@ -1,75 +1,74 @@
1
1
  # Skill Vault 🛡️
2
2
 
3
- [![CI Test Suite](https://github.com/jcorpac/skill-vault/actions/workflows/test.yml/badge.svg)](https://github.com/jcorpac/skill-vault/actions)
3
+ [![CI Test Suite](https://github.com/jcorpac/skill-vault/actions/workflows/test.yml/badge.svg)](https://github.com/jcorp/skill-vault/actions)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
5
  [![npm version](https://img.shields.io/npm/v/@jcorpac/skill-vault.svg)](https://www.npmjs.com/package/@jcorpac/skill-vault)
6
6
  [![Agent Skills](https://img.shields.io/badge/Agent%20Skills-Standard-green.svg)](SKILL.md)
7
7
 
8
- > **Universal Agent Skill Router, Lifecycle Manager & Tiered Storage Engine for AI Coding Agents.**
9
- > Works across **Google Antigravity, Claude Code, Cursor, Windsurf, OpenCode, and CI/CD**.
8
+ > **Automatic Background Skill Router, Read-Only JIT MCP Server & Tiered Cold-Storage Engine for AI Coding Agents.**
9
+ > Works across **Google Antigravity, Claude Code, Gemini CLI, Cursor, and CI/CD**.
10
10
 
11
11
  ---
12
12
 
13
13
  ## ⚡ The Problem: Context Bloat & Skill Bleed
14
14
 
15
- As teams collect specialized skills (database admin, cloud deployment, bioinformatics, testing workflows), loading 50–100+ skills into active AI prompts causes:
16
- 1. **Context Window Saturation**: Thousands of prompt tokens consumed before the conversation even starts.
17
- 2. **Skill Bleed**: AI models get confused by conflicting tool instructions from unrelated frameworks.
18
- 3. **Broken Manifests & Orphan Folders**: Manual directory changes leave dangling references.
19
-
20
- ## 💡 The Solution: Tiered Skill Memory
21
-
22
- **Skill Vault** implements a **two-tier memory model**:
23
- - **L1 Active Memory (`skills/`)**: Lightweight general-purpose skills actively loaded in context.
24
- - **L2 Cold Storage (`skill_archive/`)**: Deep domain skills indexed in metadata, searchable in milliseconds, and dynamically mounted or restored on demand.
25
-
26
- ```
27
- ┌─────────────────────────────────────────────────────────────┐
28
- │ AI CODING AGENT │
29
- │ (Google Antigravity / Claude Code / Cursor / Windsurf) │
30
- └──────────────────────────────┬──────────────────────────────┘
31
- │
32
- ┌───────────────┴───────────────┐
33
- ▼ ▼
34
- [L1 Active Context Memory] [L2 Cold Storage Archive]
35
- ./.agents/skills/ ./skill_archive/skills/
36
- - general-git-workflow - alloydb-omni-cluster
37
- - managing-python-deps - gcp-composer-troubleshoot
38
- - alphafold-protein-analysis
39
- │ ▲
40
- │ npx @jcorpac/skill-vault │
41
- │ archive │
42
- ├──────────────────────────────►│
43
- │ npx @jcorpac/skill-vault │
44
- │ restore │
45
- │◄──────────────────────────────┤
15
+ Loading 50–250+ specialized skills into active AI prompts causes:
16
+ 1. **Context Window Saturation**: Thousands of prompt tokens consumed before a conversation starts.
17
+ 2. **Skill Bleed**: Conflicting instructions from unrelated frameworks degrade tool selection and reasoning.
18
+ 3. **Manual Friction**: Constantly enabling/disabling plugins or approving CLI searches slows down every session.
19
+
20
+ ## 💡 The Solution: Zero-Approval Background JIT Orchestration
21
+
22
+ **Skill Vault v2.0** keeps **L1 Active Context** permanently minimal (core skills only) while giving the agent **automatic, zero-approval access** to every skill stored in **L2 Cold Storage (`skill_archive/`)**:
23
+
24
+ ```text
25
+ ┌─────────────────────────────────────────────────────────────────────────┐
26
+ │ AI CODING AGENT │
27
+ │ (Google Antigravity / Claude Code / Gemini CLI / Cursor) │
28
+ └──────────────┬────────────────────────────────────────┬─────────────────┘
29
+ │ │
30
+ [1. Background Lifecycle Hooks] [2. Mid-Turn Read-Only MCP]
31
+ • SessionStart (silent sync & index) • list_skills(category?)
32
+ • PreInvocation / UserPromptSubmit • search_skills(query)
33
+ └─► Pre-built BM25 + Multi-Signal • load_skill(name, file?)
34
+ Router (~50–90ms, no approvals)
35
+ ├─ Unrelated prompt ──► Injects 0 tokens
36
+ ├─ High confidence ──► Inlines top 1–2 SKILL.md (<=12 KB cap)
37
+ └─ Broad / medium ──► Emits 1-line compact pointers
38
+ │ │
39
+ └───────────────────┬────────────────────┘
40
+ ▼
41
+ [L2 Cold Storage Archive]
42
+ skill_archive/search_index.json
43
+ skill_archive/backup_manifest.json
44
+ skill_archive/skills/<skill_name>/
46
45
  ```
47
46
 
48
47
  ---
49
48
 
50
49
  ## 🚀 Quickstart
51
50
 
52
- ### Option 1: Run via `npx` (Zero Installation)
53
- ```bash
54
- # Initialize a repository for skill storage
55
- npx @jcorpac/skill-vault init
51
+ ### 1. One-Command Setup (Recommended)
52
+ Install the background lifecycle hooks, read-only MCP server, and pre-built search index for your agent:
56
53
 
57
- # Search indexed skills
58
- npx @jcorpac/skill-vault search "database"
54
+ ```bash
55
+ # Auto-detect installed agents (Antigravity, Claude Code, Gemini CLI, Cursor)
56
+ npx @jcorpac/skill-vault setup
59
57
 
60
- # Verify archive integrity
61
- npx @jcorpac/skill-vault verify --fix
58
+ # Or target Antigravity explicitly (and migrate legacy nested archive if present)
59
+ npx @jcorpac/skill-vault setup --agent antigravity --migrate-archive
62
60
  ```
63
61
 
64
- ### Option 2: Install as an Agent Skill
65
- Install directly into Claude Code, Antigravity, or Cursor:
62
+ ### 2. Run Directly via Python CLI (Pure Standard Library)
66
63
  ```bash
67
- npx skills add jcorpac/skill-vault
68
- ```
64
+ # Test what the background router injects for any prompt
65
+ python scripts/skill_vault.py route "optimize slow postgres query"
69
66
 
70
- ### Option 3: Use with Python CLI (Pure Standard Library)
71
- ```bash
72
- python scripts/skill_vault.py verify
67
+ # Check routing telemetry (0-token turn %, latency, top skills)
68
+ python scripts/skill_vault.py stats
69
+
70
+ # Verify archive integrity
71
+ python scripts/skill_vault.py verify --fix
73
72
  ```
74
73
 
75
74
  ---
@@ -78,67 +77,38 @@ python scripts/skill_vault.py verify
78
77
 
79
78
  | Command | Description |
80
79
  | :--- | :--- |
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. |
88
- | `skill-vault archive <name> --category "<Cat>"` | Move active skill to archive with category metadata (preserves newer L2 copies). |
89
- | `skill-vault archive <name> --force` | Force archive overwrite regardless of archive recency. |
90
- | `skill-vault archive --pattern "gcp-*"` | Archive multiple matching skills via glob pattern. |
91
- | `skill-vault recategorize <name> "<New Cat>"` | Reorganize skill category without modifying `SKILL.md`. |
92
- | `skill-vault restore <name>` | Restore an archived skill back to active availability (auto-upgrades if L2 is newer). |
93
- | `skill-vault restore <name> --force` | Force restore overwrite regardless of active recency. |
94
- | `skill-vault restore --category "<Cat>"` | Restore all skills in a specific category. |
95
- | `skill-vault search "<query>"` | Search skills across names, descriptions, and categories. |
96
- | `skill-vault reindex` | Regenerate `INDEX.md` and sync `backup_manifest.json`. |
97
- | `skill-vault sync` | Auto-scan plugins & active dirs, ingest new/updated skills, and prune non-core skills. |
98
- | `skill-vault sync --dry-run` | Preview new/updated skills to ingest without moving or deleting files. |
99
- | `skill-vault sync --keep-active` | Ingest new/updated skills into the vault while keeping all active. |
100
- | `skill-vault import <name>` | Import a skill from vault into project directory (e.g. `./skills` or `./.agents/skills`). |
101
- | `skill-vault import --category "<Cat>"` | Import all skills in a category into the current project. |
102
- | `skill-vault import --pattern "gcp-*"` | Import matching skills via glob pattern into the project. |
103
- | `skill-vault import <name> --dest <path>` | Import skill into an explicit project destination folder. |
104
- | `skill-vault import <name> --vault-dir <path>` | Import from an explicit source vault (defaults to global archive or base). |
105
- | `skill-vault import <name> --force` | Overwrite existing project skill regardless of recency. |
106
- | `skill-vault import <name> --dry-run` | Preview what would be imported without copying files. |
107
- | `skill-vault config --show` | Inspect effective core skills, stack fingerprints, and category rules. |
108
- | `skill-vault config --init` | Write `skill_archive/vault_config.json` with universal defaults for customization. |
109
- | `skill-vault config --add-core <name>` | Add a skill to protected Core Foundation Skills (or use `--remove-core`). |
110
- | `skill-vault config --add-fingerprint "<Cat>" "<pat>"` | Add a workspace file/glob fingerprint to a skill category. |
111
- | `skill-vault config --add-category-rule "<Cat>" "<kw>"` | Add a keyword rule for automatic skill categorization. |
112
- | `skill-vault config --sync-prompt` | Dynamically update `SKILL.md`'s router description with your vault's categories. |
113
- | `skill-vault verify` | Audit bi-directional consistency across disk, manifest, and index. |
114
- | `skill-vault verify --fix` | Audit and automatically self-heal all detected discrepancies. |
115
- | `skill-vault uninstall` | Cleanly restore all archived skills to L1 (preserving newer L1 versions), verify, and remove archive + `skill-vault` (alias: `eject`). |
116
- | `skill-vault uninstall --dry-run` | Preview the uninstall restoration and cleanup plan without modifying files. |
117
- | `skill-vault uninstall --keep-archive` | Restore all skills to L1 and remove `skill-vault`, while preserving/relocating `skill_archive`. |
80
+ | `skill-vault setup` | Install background hooks, read-only MCP server, and plugin bundle (`--agent`, `--scope`, `--migrate-archive`, `--dry-run`). |
81
+ | `skill-vault route "<prompt>"` | Dry-run the JIT router and inspect BM25 scores, tiers (`INLINE`/`POINTER`), and estimated token budget. |
82
+ | `skill-vault stats` | Summarize local routing telemetry (`0`-token turn %, avg/p95 latency, top matched skills). |
83
+ | `skill-vault search "<query>"` | Multi-term BM25 search across skill names, tags, descriptions, headings, and body identifiers. |
84
+ | `skill-vault sync` | Scan plugins & active dirs, ingest updates, prune non-core skills (automatically protecting hook/MCP dependencies). |
85
+ | `skill-vault recategorize --auto` | Re-classify `"General & Utility Skills"` using expanded domain rules. |
86
+ | `skill-vault dedupe` | Consolidate hyphen/underscore duplicate skills in L2 while keeping the newest version. |
87
+ | `skill-vault list` / `status` | Present active (L1) and archived (L2) skills and category counts. |
88
+ | `skill-vault archive` / `restore` | Move specific skills or categories between L1 and L2 (recency-aware). |
89
+ | `skill-vault import <name>` | Copy vaulted skills into a project's `.agents/skills` or `skills/` directory. |
90
+ | `skill-vault optimize` | Prune/mount active skills using workspace file fingerprints. |
91
+ | `skill-vault config` | Inspect or customize core skills, fingerprints, category rules, and `--set-routing` thresholds. |
92
+ | `skill-vault reindex` / `verify` | Rebuild `INDEX.md` + `search_index.json` and audit archive integrity. |
93
+ | `skill-vault uninstall` | Safely restore all archived skills to L1 and remove Skill Vault wiring & files (`eject` alias). |
118
94
 
119
95
  ---
120
96
 
121
97
  ## 🎯 Key Design Principles
122
98
 
123
- 1. **`SKILL.md` Purity**: `SKILL.md` files are immutable instructions. Categories and routing metadata are stored strictly in `backup_manifest.json` and rendered in `INDEX.md`.
124
- 2. **Environment Agnostic**: Dynamically resolves workspace roots via CLI flags (`--base-dir`), environment variables (`$SKILL_VAULT_BASE`), script parents, or working directories.
125
- 3. **Zero Runtime Dependencies**: The core engine requires only Python 3 standard library (`os`, `sys`, `json`, `re`, `shutil`, `hashlib`, `argparse`, `pathlib`).
126
- 4. **Self-Healing Integrity**: Detects orphaned folders, phantom manifest entries, broken markdown links, and duplicate aliases.
127
- 5. **Recency & Version Prioritization**: Automatically protects newer versions when archiving, restoring, or optimizing by evaluating semantic version tags (`version:`) with filesystem timestamp (`mtime`) fallbacks. Use `--force` to override.
128
- 6. **Universal Cross-Ecosystem Stack Detection**: Includes built-in workspace fingerprinting and category inference across Frontend, Backend, Cloud/DevOps, Databases, Mobile, AI/ML, Testing/Security, Data Engineering, and Science — fully extensible via `vault_config.json` and `SKILL.md` frontmatter (`core: true`, `category:`).
129
- 7. **Dynamic Router Prompt Syncing**: `reindex` and `config --sync-prompt` automatically keep `skill-vault`'s `SKILL.md` frontmatter description synchronized with the exact skills and categories in the user's own vault.
99
+ 1. **Zero Context Bloat by Default**: Generic prompts (`"Refactor this function"`, `"Write a git commit message"`) inject **0 tokens**. Same-turn tool-call loops short-circuit automatically, and already-injected skills never re-inject in the same conversation.
100
+ 2. **Zero-Approval Background Execution**: Hooks run natively in the agent lifecycle before the model is called; mid-turn fallback uses a 3-tool read-only MCP server (`list_skills`, `search_skills`, `load_skill`) with strict directory-containment guards.
101
+ 3. **`SKILL.md` Purity**: `SKILL.md` files are never modified during indexing or categorization.
102
+ 4. **Hook-Dependency Safety**: `sync`, `optimize`, and `archive` inspect sibling `hooks.json` and `mcp_config.json` files so plugin-referenced skill scripts are never accidentally pruned.
103
+ 5. **Zero Runtime Dependencies**: Pure Python 3.10+ standard library across Windows, macOS, and Linux.
130
104
 
131
105
  ---
132
106
 
133
107
  ## 🧪 Running the Test Suite
134
108
 
135
- Skill Vault includes a comprehensive, sandboxed test harness:
136
-
137
109
  ```bash
138
- # Run unit tests
139
110
  python -m unittest discover -s tests -v
140
-
141
- # Or via npm
111
+ # Or via npm:
142
112
  npm test
143
113
  ```
144
114
 
package/SKILL.md CHANGED
@@ -1,240 +1,61 @@
1
1
  ---
2
2
  name: skill-vault
3
- version: 1.8.0
3
+ version: 2.0.1
4
4
  description: >-
5
- Universal agent-agnostic skill router, lifecycle manager, and tiered storage engine for AI coding agents.
6
- ALWAYS use this skill whenever a task involves specialized domain skills, frameworks, or tools not currently loaded in active context memory (L1), or when managing skill context bloat.
7
- Search cold storage (L2) on demand via 'python scripts/skill_vault.py search "<keyword>"', view 'skill_archive/INDEX.md', or dynamically mount skills via 'restore', 'import', or 'optimize'.
5
+ Universal agent-agnostic skill router and tiered storage manager.
6
+ Background hooks automatically inject relevant vaulted skills on demand;
7
+ use MCP tools list_skills/search_skills/load_skill for mid-turn lookups.
8
8
  ---
9
9
 
10
- # Skill Vault: Universal Agent Skill Lifecycle & Storage Manager
10
+ # Skill Vault: Automatic Skill Router & Cold-Storage Manager
11
11
 
12
- ## Overview
13
- **Skill Vault** provides an **agent-agnostic**, **environment-agnostic**, and **OS-agnostic** framework for:
14
- 1. **Tiered Context Optimization**: Managing active skills (L1 context memory) and cold-storage archives (L2 disk storage) to eliminate "skill bleed" and prompt token waste.
15
- 2. **Dynamic Skill Routing**: Discovering, querying, and dynamically executing specialized domain skills across active and archived repositories.
16
- 3. **Decoupled Categorization**: Organizing skills via manifest metadata without modifying `SKILL.md` files.
17
- 4. **Bi-Directional Integrity Auditing**: Verifying and self-healing consistency across disk folders, `backup_manifest.json`, and `INDEX.md`.
12
+ **Skill Vault** keeps active L1 context minimal (core skills only) while preserving instant, zero-approval access to all vaulted L2 domain skills:
18
13
 
19
- ---
20
-
21
- ## 1. Skill Discovery & Execution Protocol (Agent-Agnostic)
22
-
23
- Whenever a user request requires specialized domain knowledge:
24
-
25
- 1. **Locate Target Skill**:
26
- - Check active skill locations (`skills/`, `.agents/skills/`, `.claude/skills/`, `plugins/*/skills/`).
27
- - If missing from active locations, search the central archive manifest via CLI:
28
- ```bash
29
- python scripts/skill_vault.py search "<keyword or topic>"
30
- ```
31
- or consult `skill_archive/INDEX.md` / `skill_archive/backup_manifest.json`.
32
-
33
- 2. **Execute Based on Environment Capabilities**:
34
- - **Multi-Agent / Delegation Supported** (e.g., Antigravity `invoke_subagent`, Claude Code subagent):
35
- Spawn a subagent instructed to view the target `SKILL.md` and execute the task.
36
- - **Single-Agent CLI / Standalone Mode**:
37
- Use native file-reading tools to load the target `SKILL.md` directly into main context.
14
+ 1. **Background Lifecycle Hooks (Primary Path)**:
15
+ - `SessionStart` incrementally syncs newly installed/updated plugin skills, refreshes `search_index.json`, and warms workspace stack fingerprints.
16
+ - `PreInvocation` / `UserPromptSubmit` / `BeforeAgent` scores the user prompt via a pre-built BM25 + multi-signal index (`<100ms`), injects top high-confidence skills or compact pointers directly from L2, and injects **0 tokens** on unrelated turns.
17
+ 2. **Read-Only MCP Fallback (Mid-Turn Discovery)**:
18
+ - If a task pivots mid-turn to a specialized domain not present in context, call the `skill-vault` MCP tools:
19
+ - `list_skills(category?, include_descriptions?)` — List all vaulted L2 skill names grouped by category in one call.
20
+ - `search_skills(query, category?, limit?, offset?)` — Search vaulted L2 skills by keyword, intent, or list categories.
21
+ - `load_skill(name, file?)` — Read a vaulted skill's `SKILL.md` or any companion file (`references/`, `scripts/`, `examples/`).
22
+ - Never mutate L1 active directories or run shell commands solely to browse archived skills when MCP tools are available.
38
23
 
39
24
  ---
40
25
 
41
- ## 2. Skill Lifecycle Management Operations (Automated via CLI)
42
-
43
- All lifecycle operations are executed via the portable Python CLI `scripts/skill_vault.py`.
44
-
45
- > [!NOTE]
46
- > `SKILL.md` files are **never modified** when categorizing or archiving. Categories are strictly routing metadata stored inside `backup_manifest.json` and presented in `INDEX.md`.
47
-
48
- ### A. Archiving Skills (LLM-Driven Categorization)
49
- When asked to archive an active skill into cold storage:
50
- 1. Read the skill's `SKILL.md` to understand its domain.
51
- 2. Select a concise, human-readable category fitting the user's workspace (e.g. `"Cloud Infrastructure"`, `"Data Engineering"`, `"Mobile Development"`, `"Bioinformatics"`).
52
- 3. Run the archive command with `--category`:
53
- ```bash
54
- # Archive a single skill with category
55
- python scripts/skill_vault.py archive <skill_name> --category "<Category Name>"
56
-
57
- # Archive multiple skills matching a pattern
58
- python scripts/skill_vault.py archive --pattern "gcp-*" --category "GCP & Data Engineering"
59
-
60
- # Archive while keeping the active folder intact
61
- python scripts/skill_vault.py archive <skill_name> --category "<Category Name>" --keep-active
62
- ```
63
-
64
- ### B. Recategorizing Skills
65
- To reorganize existing archived skills without touching `SKILL.md`:
66
- ```bash
67
- python scripts/skill_vault.py recategorize <skill_name> "<New Category Name>"
68
- ```
69
-
70
- ### C. Unarchiving / Restoring Skills
71
- To restore archived skills back to active availability:
72
- ```bash
73
- # Restore a specific skill
74
- python scripts/skill_vault.py restore <skill_name>
75
-
76
- # Restore all skills in a category
77
- python scripts/skill_vault.py restore --category "GCP & Data Engineering"
26
+ ## CLI Operations (`skill-vault` / `npx @jcorpac/skill-vault`)
78
27
 
79
- # Restore all archived skills
80
- python scripts/skill_vault.py restore --all
81
- ```
82
-
83
- ### D. Reindexing & Manifest Refresh
84
- To rebuild `INDEX.md` and ensure all paths and category sections are synchronized:
85
- ```bash
86
- python scripts/skill_vault.py reindex
87
- ```
88
-
89
- ### E. Presenting Skills & Tier Status
90
- To get a rapid overview of what skills are currently in active context memory (L1) vs. cold storage (L2):
91
- ```bash
92
- # Full overview of active and archived skills
93
- python scripts/skill_vault.py list
94
-
95
- # Quick breakdown of counts and categories
96
- python scripts/skill_vault.py status
97
-
98
- # List only active skills in context
99
- python scripts/skill_vault.py list --active
100
-
101
- # List archived skills in a specific category
102
- python scripts/skill_vault.py list --archived --category "Cloud SQL"
103
-
104
- # Output structured JSON (for scripts/dashboards)
105
- python scripts/skill_vault.py list --json
106
- ```
107
-
108
- ### F. Skill Discovery & Keyword Search
109
28
  ```bash
110
- python scripts/skill_vault.py search "<keyword>"
111
- ```
29
+ # Install background hooks, read-only MCP server, and plugin bundle
30
+ skill-vault setup --agent auto --scope global
112
31
 
113
- ### G. Archive Integrity Audit & Self-Healing
114
- To confirm bi-directional consistency across disk folders, `backup_manifest.json`, and `INDEX.md`:
115
- ```bash
116
- # Run integrity verification audit
117
- python scripts/skill_vault.py verify
32
+ # Dry-run JIT router scoring, tiers, and estimated token usage for a prompt
33
+ skill-vault route "<prompt>" [--workspace <path>] [--mode hybrid|inline|pointer]
118
34
 
119
- # Run audit and automatically fix any detected discrepancies
120
- python scripts/skill_vault.py verify --fix
121
- ```
35
+ # Search archived skills using the BM25 index
36
+ skill-vault search "<query>" [--category "<Category>"] [--limit 10]
122
37
 
123
- ### H. Automated Context Optimization (Zero-Effort Pruning & Mounting)
124
- 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):
125
- ```bash
126
- # Automatically optimize active skills for the current workspace
127
- python scripts/skill_vault.py optimize
38
+ # Inspect background routing telemetry (0-token turn rate, latency, top skills)
39
+ skill-vault stats [--limit 100]
128
40
 
129
- # Preview what would be archived and mounted without moving files
130
- python scripts/skill_vault.py optimize --dry-run
41
+ # Scan plugins/active directories, ingest updates, and prune non-core skills (respects hook dependencies)
42
+ skill-vault sync [--dry-run] [--keep-active]
131
43
 
132
- # Optimize for a specific workspace folder and protect custom skills
133
- python scripts/skill_vault.py optimize --workspace "./my-repo" --protect my-custom-skill
134
- ```
44
+ # Re-classify 'General & Utility Skills' using built-in + custom rules
45
+ skill-vault recategorize --auto [--dry-run]
135
46
 
136
- ### I. Recency & Version Prioritization Protocol
137
- Skill Vault automatically protects newer skills and prevents regressions when archiving, restoring, or optimizing:
138
- 1. **Semantic Version Check**: Compares `version:` headers in `SKILL.md` frontmatter (e.g., `v2` > `v1`, `1.2.0` > `1.1.0`).
139
- 2. **Timestamp Recency Fallback**: If versions match or are unversioned, compares the newest file modification timestamp (`mtime`).
140
- 3. **Tier Behavior**:
141
- - **`archive`**: When L1 is newer or equal to L2, updates L2 with the active version. If L2 is strictly newer, preserves L2 to avoid overwriting with stale files.
142
- - **`restore`**: When L2 is strictly newer than L1, upgrades active L1 with the newer vault copy. If L1 is newer or equal, preserves L1.
143
- - **`optimize`**: Automatically detects and upgrades active L1 skills if newer versions exist in the vault, while archiving unneeded skills safely.
144
- - **`--force`**: Bypasses recency checks on `archive`, `restore`, or `optimize` when an intentional overwrite is required.
47
+ # Consolidate duplicate skills in L2 (keeps newest version)
48
+ skill-vault dedupe [--dry-run]
145
49
 
146
- ### J. Project-Level Skill Importing
147
- To import skills from a global vault (e.g., `~/.gemini/config/skill_archive` or `$SKILL_VAULT_BASE`) into a project workspace on demand:
148
- ```bash
149
- # Import a specific skill into the current project (defaults to ./skills or ./.agents/skills)
150
- python scripts/skill_vault.py import <skill_name>
50
+ # Inspect or tune routing thresholds & core skills
51
+ skill-vault config --show
52
+ skill-vault config --set-routing mode hybrid
53
+ skill-vault config --set-routing show_ui_notice true
151
54
 
152
- # Import all skills in a category into the current project
153
- python scripts/skill_vault.py import --category "BigQuery & Data Warehouse"
154
-
155
- # Import matching skills via glob pattern
156
- python scripts/skill_vault.py import --pattern "gcp-*"
157
-
158
- # Import into an explicit project destination
159
- python scripts/skill_vault.py import <skill_name> --dest "./.agents/skills"
160
-
161
- # Preview what would be imported without copying
162
- python scripts/skill_vault.py import <skill_name> --dry-run
163
-
164
- # Force overwrite of project skill if already present
165
- python scripts/skill_vault.py import <skill_name> --force
166
- ```
167
-
168
- ### K. Automated Plugin Ingestion & Syncing (`sync`)
169
- Whenever plugins are installed or updated, use `sync` to scan all active locations and plugins, ingest new/updated skills into the vault, protect the Core Foundation Skills, and prune non-core skills:
170
- ```bash
171
- # Scan plugins and active skills, ingest new/updated skills, and prune non-core active skills
172
- python scripts/skill_vault.py sync
173
-
174
- # Preview what would be ingested and pruned without moving or deleting files
175
- python scripts/skill_vault.py sync --dry-run
176
-
177
- # Ingest new/updated skills into the vault while keeping all active
178
- python scripts/skill_vault.py sync --keep-active
179
- ```
180
-
181
- ### L. Universal Stack Customization & Dynamic Router Sync (`config`)
182
- Skill Vault supports cross-ecosystem workspace fingerprinting and auto-categorization out of the box (Frontend, Backend, Cloud/DevOps, Databases, Mobile, AI/ML, Testing/Security, Data Engineering, and Science), and can be customized per user or repository via `skill_archive/vault_config.json` or `SKILL.md` frontmatter tags:
183
-
184
- ```bash
185
- # Inspect active core skills, stack fingerprints, and category rules
186
- python scripts/skill_vault.py config --show
187
-
188
- # Initialize skill_archive/vault_config.json with universal defaults
189
- python scripts/skill_vault.py config --init
190
-
191
- # Protect or unprotect specific core foundation skills from auto-archiving/pruning
192
- python scripts/skill_vault.py config --add-core <skill_name>
193
- python scripts/skill_vault.py config --remove-core <skill_name>
194
-
195
- # Add custom workspace file/glob fingerprints and category keyword rules
196
- python scripts/skill_vault.py config --add-fingerprint "<Category>" "<pattern>"
197
- python scripts/skill_vault.py config --add-category-rule "<Category>" "<keyword>"
198
-
199
- # Dynamically update SKILL.md's router description with currently indexed categories
200
- python scripts/skill_vault.py config --sync-prompt
201
- ```
202
-
203
- Any individual skill's `SKILL.md` frontmatter can also declare:
204
- - `core: true` (or `pinned: true` / `always_active: true`) to automatically protect that skill during `sync` and `optimize`.
205
- - `category: "<Category>"` to pin its vault category without needing `--category` flags.
206
-
207
- ### M. Clean Uninstallation & Safe Decommissioning (`uninstall` / `eject`)
208
- To cleanly remove or replace `skill-vault` without losing any archived skills or overwriting newer active L1 versions:
209
- ```bash
210
- # Preview restoration and cleanup plan without modifying files
211
- python scripts/skill_vault.py uninstall --dry-run
212
-
213
- # Restore all archived skills to L1 (preserving newer L1 versions), verify SKILL.md files, and remove archive + skill-vault
214
- python scripts/skill_vault.py uninstall
215
-
216
- # Keep skill_archive as a backup (relocates it out of skills/skill-vault if nested)
217
- python scripts/skill_vault.py uninstall --keep-archive
218
-
219
- # Restore all skills and clear archive, while keeping the skill-vault folder itself
220
- python scripts/skill_vault.py uninstall --keep-skill
221
- ```
222
-
223
- ---
224
-
225
- ## 3. Environment & OS Compatibility Guidelines
226
-
227
- - **Base Directory**: Auto-discovers the workspace root relative to the script location, current working directory, or via `--base-dir <path>` / `$SKILL_VAULT_BASE`.
228
- - **Portable Relative Links**: `INDEX.md` and `backup_manifest.json` use relative paths, allowing the skill repository to be committed to Git or shared across environments seamlessly.
229
- - **Pure Python**: Requires only Python 3 standard library (`os`, `sys`, `json`, `re`, `shutil`, `hashlib`, `argparse`, `pathlib`).
230
-
231
- ---
232
-
233
- ## 4. Automated Testing Harness
234
-
235
- A sandboxed test suite is located in `tests/test_skill_vault.py` to prevent regressions whenever changes are made:
236
-
237
- ```bash
238
- # Run test suite
239
- python -m unittest discover -s tests -v
55
+ # Archive, restore, import, verify, or cleanly uninstall
56
+ skill-vault archive <name> --category "<Category>"
57
+ skill-vault restore <name>
58
+ skill-vault import <name> --dest "./.agents/skills"
59
+ skill-vault verify --fix
60
+ skill-vault uninstall [--dry-run]
240
61
  ```
package/bin/hook.js ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Cross-platform fail-safe launcher for Skill Vault lifecycle hooks (scripts/hook_runner.py).
5
+ */
6
+
7
+ const { spawn } = require('child_process');
8
+ const path = require('path');
9
+
10
+ const scriptPath = path.join(__dirname, '..', 'scripts', 'hook_runner.py');
11
+ const candidates = process.platform === 'win32' ? ['python', 'py'] : ['python3', 'python'];
12
+ const extraArgs = process.argv.slice(2);
13
+
14
+ function runWith(idx) {
15
+ if (idx >= candidates.length) {
16
+ process.stdout.write('{}\n');
17
+ process.exit(0);
18
+ }
19
+ const cmd = candidates[idx];
20
+ const cmdArgs = cmd === 'py' ? ['-3', scriptPath, ...extraArgs] : [scriptPath, ...extraArgs];
21
+ const child = spawn(cmd, cmdArgs, { stdio: 'inherit' });
22
+
23
+ child.on('error', (err) => {
24
+ if (err && err.code === 'ENOENT') {
25
+ runWith(idx + 1);
26
+ return;
27
+ }
28
+ process.stdout.write('{}\n');
29
+ process.exit(0);
30
+ });
31
+
32
+ child.on('exit', (code) => {
33
+ process.exit(code ?? 0);
34
+ });
35
+ }
36
+
37
+ runWith(0);
package/bin/mcp.js ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Cross-platform stdio launcher for Skill Vault read-only MCP server (scripts/mcp_server.py).
5
+ */
6
+
7
+ const { spawn } = require('child_process');
8
+ const path = require('path');
9
+
10
+ const scriptPath = path.join(__dirname, '..', 'scripts', 'mcp_server.py');
11
+ const candidates = process.platform === 'win32' ? ['python', 'py'] : ['python3', 'python'];
12
+ const extraArgs = process.argv.slice(2);
13
+
14
+ function runWith(idx) {
15
+ if (idx >= candidates.length) {
16
+ console.error('[Skill Vault MCP Error] Python 3 was not found on PATH.');
17
+ process.exit(1);
18
+ }
19
+ const cmd = candidates[idx];
20
+ const cmdArgs = cmd === 'py' ? ['-3', scriptPath, ...extraArgs] : [scriptPath, ...extraArgs];
21
+ const child = spawn(cmd, cmdArgs, { stdio: 'inherit' });
22
+
23
+ child.on('error', (err) => {
24
+ if (err && err.code === 'ENOENT') {
25
+ runWith(idx + 1);
26
+ return;
27
+ }
28
+ console.error(`[Skill Vault MCP Error] ${err.message}`);
29
+ process.exit(1);
30
+ });
31
+
32
+ child.on('exit', (code) => {
33
+ process.exit(code ?? 0);
34
+ });
35
+ }
36
+
37
+ runWith(0);
package/hooks.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "skill-vault-session-sync": {
3
+ "SessionStart": [
4
+ {
5
+ "type": "command",
6
+ "command": "node bin/hook.js --harness antigravity --event SessionStart",
7
+ "timeout": 30
8
+ }
9
+ ]
10
+ },
11
+ "skill-vault-jit-router": {
12
+ "PreInvocation": [
13
+ {
14
+ "type": "command",
15
+ "command": "node bin/hook.js --harness antigravity --event PreInvocation",
16
+ "timeout": 10
17
+ }
18
+ ]
19
+ }
20
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "mcpServers": {
3
+ "skill-vault": {
4
+ "command": "node",
5
+ "type": "stdio",
6
+ "args": ["bin/mcp.js"]
7
+ }
8
+ }
9
+ }