@jcorpac/skill-vault 1.8.0 → 2.0.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 +67 -98
- package/SKILL.md +39 -219
- package/bin/hook.js +37 -0
- package/bin/mcp.js +37 -0
- package/hooks.json +20 -0
- package/mcp_config.json +9 -0
- package/package.json +8 -3
- package/plugin.json +10 -0
- package/scripts/hook_runner.py +488 -0
- package/scripts/mcp_server.py +473 -0
- package/scripts/skill_router.py +1159 -0
- package/scripts/skill_vault.py +1128 -92
package/README.md
CHANGED
|
@@ -1,75 +1,73 @@
|
|
|
1
1
|
# Skill Vault 🛡️
|
|
2
2
|
|
|
3
|
-
[](https://github.com/
|
|
3
|
+
[](https://github.com/jcorp/skill-vault/actions)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](https://www.npmjs.com/package/@jcorpac/skill-vault)
|
|
6
6
|
[](SKILL.md)
|
|
7
7
|
|
|
8
|
-
> **
|
|
9
|
-
> Works across **Google Antigravity, Claude Code,
|
|
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
|
-
|
|
16
|
-
1. **Context Window Saturation**: Thousands of prompt tokens consumed before
|
|
17
|
-
2. **Skill Bleed**:
|
|
18
|
-
3. **
|
|
19
|
-
|
|
20
|
-
## 💡 The Solution:
|
|
21
|
-
|
|
22
|
-
**Skill Vault**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
│
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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) • search_skills(query)
|
|
32
|
+
• PreInvocation / UserPromptSubmit • load_skill(name, file?)
|
|
33
|
+
└─► Pre-built BM25 + Multi-Signal Router (~50–90ms, no approvals)
|
|
34
|
+
├─ Unrelated prompt ──► Injects 0 tokens
|
|
35
|
+
├─ High confidence ──► Inlines top 1–2 SKILL.md (<=12 KB cap)
|
|
36
|
+
└─ Broad / medium ──► Emits 1-line compact pointers
|
|
37
|
+
│ │
|
|
38
|
+
└───────────────────┬────────────────────┘
|
|
39
|
+
▼
|
|
40
|
+
[L2 Cold Storage Archive]
|
|
41
|
+
skill_archive/search_index.json
|
|
42
|
+
skill_archive/backup_manifest.json
|
|
43
|
+
skill_archive/skills/<skill_name>/
|
|
46
44
|
```
|
|
47
45
|
|
|
48
46
|
---
|
|
49
47
|
|
|
50
48
|
## 🚀 Quickstart
|
|
51
49
|
|
|
52
|
-
###
|
|
53
|
-
|
|
54
|
-
# Initialize a repository for skill storage
|
|
55
|
-
npx @jcorpac/skill-vault init
|
|
50
|
+
### 1. One-Command Setup (Recommended)
|
|
51
|
+
Install the background lifecycle hooks, read-only MCP server, and pre-built search index for your agent:
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
```bash
|
|
54
|
+
# Auto-detect installed agents (Antigravity, Claude Code, Gemini CLI, Cursor)
|
|
55
|
+
npx @jcorpac/skill-vault setup
|
|
59
56
|
|
|
60
|
-
#
|
|
61
|
-
npx @jcorpac/skill-vault
|
|
57
|
+
# Or target Antigravity explicitly (and migrate legacy nested archive if present)
|
|
58
|
+
npx @jcorpac/skill-vault setup --agent antigravity --migrate-archive
|
|
62
59
|
```
|
|
63
60
|
|
|
64
|
-
###
|
|
65
|
-
Install directly into Claude Code, Antigravity, or Cursor:
|
|
61
|
+
### 2. Run Directly via Python CLI (Pure Standard Library)
|
|
66
62
|
```bash
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
# Test what the background router injects for any prompt
|
|
64
|
+
python scripts/skill_vault.py route "optimize slow postgres query"
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
# Check routing telemetry (0-token turn %, latency, top skills)
|
|
67
|
+
python scripts/skill_vault.py stats
|
|
68
|
+
|
|
69
|
+
# Verify archive integrity
|
|
70
|
+
python scripts/skill_vault.py verify --fix
|
|
73
71
|
```
|
|
74
72
|
|
|
75
73
|
---
|
|
@@ -78,67 +76,38 @@ python scripts/skill_vault.py verify
|
|
|
78
76
|
|
|
79
77
|
| Command | Description |
|
|
80
78
|
| :--- | :--- |
|
|
81
|
-
| `skill-vault
|
|
82
|
-
| `skill-vault
|
|
83
|
-
| `skill-vault
|
|
84
|
-
| `skill-vault
|
|
85
|
-
| `skill-vault
|
|
86
|
-
| `skill-vault
|
|
87
|
-
| `skill-vault
|
|
88
|
-
| `skill-vault
|
|
89
|
-
| `skill-vault archive
|
|
90
|
-
| `skill-vault
|
|
91
|
-
| `skill-vault
|
|
92
|
-
| `skill-vault
|
|
93
|
-
| `skill-vault
|
|
94
|
-
| `skill-vault
|
|
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`. |
|
|
79
|
+
| `skill-vault setup` | Install background hooks, read-only MCP server, and plugin bundle (`--agent`, `--scope`, `--migrate-archive`, `--dry-run`). |
|
|
80
|
+
| `skill-vault route "<prompt>"` | Dry-run the JIT router and inspect BM25 scores, tiers (`INLINE`/`POINTER`), and estimated token budget. |
|
|
81
|
+
| `skill-vault stats` | Summarize local routing telemetry (`0`-token turn %, avg/p95 latency, top matched skills). |
|
|
82
|
+
| `skill-vault search "<query>"` | Multi-term BM25 search across skill names, tags, descriptions, headings, and body identifiers. |
|
|
83
|
+
| `skill-vault sync` | Scan plugins & active dirs, ingest updates, prune non-core skills (automatically protecting hook/MCP dependencies). |
|
|
84
|
+
| `skill-vault recategorize --auto` | Re-classify `"General & Utility Skills"` using expanded domain rules. |
|
|
85
|
+
| `skill-vault dedupe` | Consolidate hyphen/underscore duplicate skills in L2 while keeping the newest version. |
|
|
86
|
+
| `skill-vault list` / `status` | Present active (L1) and archived (L2) skills and category counts. |
|
|
87
|
+
| `skill-vault archive` / `restore` | Move specific skills or categories between L1 and L2 (recency-aware). |
|
|
88
|
+
| `skill-vault import <name>` | Copy vaulted skills into a project's `.agents/skills` or `skills/` directory. |
|
|
89
|
+
| `skill-vault optimize` | Prune/mount active skills using workspace file fingerprints. |
|
|
90
|
+
| `skill-vault config` | Inspect or customize core skills, fingerprints, category rules, and `--set-routing` thresholds. |
|
|
91
|
+
| `skill-vault reindex` / `verify` | Rebuild `INDEX.md` + `search_index.json` and audit archive integrity. |
|
|
92
|
+
| `skill-vault uninstall` | Safely restore all archived skills to L1 and remove Skill Vault wiring & files (`eject` alias). |
|
|
118
93
|
|
|
119
94
|
---
|
|
120
95
|
|
|
121
96
|
## 🎯 Key Design Principles
|
|
122
97
|
|
|
123
|
-
1.
|
|
124
|
-
2. **
|
|
125
|
-
3.
|
|
126
|
-
4. **
|
|
127
|
-
5. **
|
|
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.
|
|
98
|
+
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.
|
|
99
|
+
2. **Zero-Approval Background Execution**: Hooks run natively in the agent lifecycle before the model is called; mid-turn fallback uses a 2-tool read-only MCP server (`search_skills`, `load_skill`) with strict directory-containment guards.
|
|
100
|
+
3. **`SKILL.md` Purity**: `SKILL.md` files are never modified during indexing or categorization.
|
|
101
|
+
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.
|
|
102
|
+
5. **Zero Runtime Dependencies**: Pure Python 3.10+ standard library across Windows, macOS, and Linux.
|
|
130
103
|
|
|
131
104
|
---
|
|
132
105
|
|
|
133
106
|
## 🧪 Running the Test Suite
|
|
134
107
|
|
|
135
|
-
Skill Vault includes a comprehensive, sandboxed test harness:
|
|
136
|
-
|
|
137
108
|
```bash
|
|
138
|
-
# Run unit tests
|
|
139
109
|
python -m unittest discover -s tests -v
|
|
140
|
-
|
|
141
|
-
# Or via npm
|
|
110
|
+
# Or via npm:
|
|
142
111
|
npm test
|
|
143
112
|
```
|
|
144
113
|
|
package/SKILL.md
CHANGED
|
@@ -1,240 +1,60 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: skill-vault
|
|
3
|
-
version:
|
|
3
|
+
version: 2.0.0
|
|
4
4
|
description: >-
|
|
5
|
-
Universal agent-agnostic skill router
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Universal agent-agnostic skill router and tiered storage manager.
|
|
6
|
+
Background hooks automatically inject relevant vaulted skills on demand;
|
|
7
|
+
use MCP tools search_skills/load_skill for mid-turn lookups.
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# Skill Vault:
|
|
10
|
+
# Skill Vault: Automatic Skill Router & Cold-Storage Manager
|
|
11
11
|
|
|
12
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
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
|
+
- `search_skills(query, category?, limit?)` — Search vaulted L2 skills by keyword, intent, or list categories.
|
|
20
|
+
- `load_skill(name, file?)` — Read a vaulted skill's `SKILL.md` or any companion file (`references/`, `scripts/`, `examples/`).
|
|
21
|
+
- Never mutate L1 active directories or run shell commands solely to browse archived skills when MCP tools are available.
|
|
38
22
|
|
|
39
23
|
---
|
|
40
24
|
|
|
41
|
-
##
|
|
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"
|
|
25
|
+
## CLI Operations (`skill-vault` / `npx @jcorpac/skill-vault`)
|
|
78
26
|
|
|
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
27
|
```bash
|
|
110
|
-
|
|
111
|
-
|
|
28
|
+
# Install background hooks, read-only MCP server, and plugin bundle
|
|
29
|
+
skill-vault setup --agent auto --scope global
|
|
112
30
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
# Run integrity verification audit
|
|
117
|
-
python scripts/skill_vault.py verify
|
|
31
|
+
# Dry-run JIT router scoring, tiers, and estimated token usage for a prompt
|
|
32
|
+
skill-vault route "<prompt>" [--workspace <path>] [--mode hybrid|inline|pointer]
|
|
118
33
|
|
|
119
|
-
#
|
|
120
|
-
|
|
121
|
-
```
|
|
34
|
+
# Search archived skills using the BM25 index
|
|
35
|
+
skill-vault search "<query>" [--category "<Category>"] [--limit 10]
|
|
122
36
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
# Automatically optimize active skills for the current workspace
|
|
127
|
-
python scripts/skill_vault.py optimize
|
|
37
|
+
# Inspect background routing telemetry (0-token turn rate, latency, top skills)
|
|
38
|
+
skill-vault stats [--limit 100]
|
|
128
39
|
|
|
129
|
-
#
|
|
130
|
-
|
|
40
|
+
# Scan plugins/active directories, ingest updates, and prune non-core skills (respects hook dependencies)
|
|
41
|
+
skill-vault sync [--dry-run] [--keep-active]
|
|
131
42
|
|
|
132
|
-
#
|
|
133
|
-
|
|
134
|
-
```
|
|
43
|
+
# Re-classify 'General & Utility Skills' using built-in + custom rules
|
|
44
|
+
skill-vault recategorize --auto [--dry-run]
|
|
135
45
|
|
|
136
|
-
|
|
137
|
-
|
|
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.
|
|
46
|
+
# Consolidate hyphen/underscore duplicate skills in L2 (keeps newest version)
|
|
47
|
+
skill-vault dedupe [--dry-run]
|
|
145
48
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
python scripts/skill_vault.py import <skill_name>
|
|
49
|
+
# Inspect or tune routing thresholds & core skills
|
|
50
|
+
skill-vault config --show
|
|
51
|
+
skill-vault config --set-routing mode hybrid
|
|
52
|
+
skill-vault config --set-routing show_ui_notice true
|
|
151
53
|
|
|
152
|
-
#
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
|
54
|
+
# Archive, restore, import, verify, or cleanly uninstall
|
|
55
|
+
skill-vault archive <name> --category "<Category>"
|
|
56
|
+
skill-vault restore <name>
|
|
57
|
+
skill-vault import <name> --dest "./.agents/skills"
|
|
58
|
+
skill-vault verify --fix
|
|
59
|
+
skill-vault uninstall [--dry-run]
|
|
240
60
|
```
|
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
|
+
}
|