pikakit 1.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.
Files changed (145) hide show
  1. package/README.md +239 -0
  2. package/bin/add-skill-kit.js +3 -0
  3. package/bin/cli.mjs +6 -0
  4. package/bin/kit.mjs +89 -0
  5. package/bin/lib/agents.js +208 -0
  6. package/bin/lib/commands/analyze.js +70 -0
  7. package/bin/lib/commands/cache.js +65 -0
  8. package/bin/lib/commands/doctor.js +75 -0
  9. package/bin/lib/commands/help.js +155 -0
  10. package/bin/lib/commands/info.js +38 -0
  11. package/bin/lib/commands/init.js +39 -0
  12. package/bin/lib/commands/install.js +803 -0
  13. package/bin/lib/commands/list.js +43 -0
  14. package/bin/lib/commands/lock.js +57 -0
  15. package/bin/lib/commands/uninstall.js +307 -0
  16. package/bin/lib/commands/update.js +55 -0
  17. package/bin/lib/commands/validate.js +69 -0
  18. package/bin/lib/commands/verify.js +56 -0
  19. package/bin/lib/config.js +81 -0
  20. package/bin/lib/helpers.js +196 -0
  21. package/bin/lib/helpers.test.js +60 -0
  22. package/bin/lib/installer.js +164 -0
  23. package/bin/lib/skills.js +119 -0
  24. package/bin/lib/skills.test.js +109 -0
  25. package/bin/lib/types.js +82 -0
  26. package/bin/lib/ui.js +329 -0
  27. package/lib/agent-cli/README.md +21 -0
  28. package/lib/agent-cli/__tests__/adaptive_engine.test.js +190 -0
  29. package/lib/agent-cli/__tests__/integration/cross_script.test.js +222 -0
  30. package/lib/agent-cli/__tests__/integration/full_cycle.test.js +230 -0
  31. package/lib/agent-cli/__tests__/pattern_analyzer.test.js +173 -0
  32. package/lib/agent-cli/__tests__/pre_execution_check.test.js +167 -0
  33. package/lib/agent-cli/__tests__/skill_injector.test.js +191 -0
  34. package/lib/agent-cli/bin/agent.js +191 -0
  35. package/lib/agent-cli/dashboard/dashboard_server.js +340 -0
  36. package/lib/agent-cli/dashboard/index.html +538 -0
  37. package/lib/agent-cli/lib/audit.js +154 -0
  38. package/lib/agent-cli/lib/audit.test.js +100 -0
  39. package/lib/agent-cli/lib/auto-learn.js +319 -0
  40. package/lib/agent-cli/lib/backup.js +138 -0
  41. package/lib/agent-cli/lib/backup.test.js +78 -0
  42. package/lib/agent-cli/lib/cognitive-lesson.js +476 -0
  43. package/lib/agent-cli/lib/completion.js +149 -0
  44. package/lib/agent-cli/lib/config.js +35 -0
  45. package/lib/agent-cli/lib/eslint-fix.js +238 -0
  46. package/lib/agent-cli/lib/evolution-signal.js +215 -0
  47. package/lib/agent-cli/lib/export.js +86 -0
  48. package/lib/agent-cli/lib/export.test.js +65 -0
  49. package/lib/agent-cli/lib/fix.js +337 -0
  50. package/lib/agent-cli/lib/fix.test.js +80 -0
  51. package/lib/agent-cli/lib/gemini-export.js +83 -0
  52. package/lib/agent-cli/lib/generate-registry.js +42 -0
  53. package/lib/agent-cli/lib/hooks/install-hooks.js +152 -0
  54. package/lib/agent-cli/lib/hooks/lint-learn.js +172 -0
  55. package/lib/agent-cli/lib/ignore.js +116 -0
  56. package/lib/agent-cli/lib/ignore.test.js +58 -0
  57. package/lib/agent-cli/lib/init.js +124 -0
  58. package/lib/agent-cli/lib/learn.js +255 -0
  59. package/lib/agent-cli/lib/learn.test.js +70 -0
  60. package/lib/agent-cli/lib/migrate-to-v4.js +322 -0
  61. package/lib/agent-cli/lib/proposals.js +199 -0
  62. package/lib/agent-cli/lib/proposals.test.js +56 -0
  63. package/lib/agent-cli/lib/recall.js +820 -0
  64. package/lib/agent-cli/lib/recall.test.js +107 -0
  65. package/lib/agent-cli/lib/selfevolution-bridge.js +167 -0
  66. package/lib/agent-cli/lib/settings.js +227 -0
  67. package/lib/agent-cli/lib/skill-learn.js +296 -0
  68. package/lib/agent-cli/lib/stats.js +132 -0
  69. package/lib/agent-cli/lib/stats.test.js +94 -0
  70. package/lib/agent-cli/lib/types.js +33 -0
  71. package/lib/agent-cli/lib/ui/audit-ui.js +146 -0
  72. package/lib/agent-cli/lib/ui/backup-ui.js +107 -0
  73. package/lib/agent-cli/lib/ui/clack-helpers.js +317 -0
  74. package/lib/agent-cli/lib/ui/common.js +83 -0
  75. package/lib/agent-cli/lib/ui/completion-ui.js +126 -0
  76. package/lib/agent-cli/lib/ui/custom-select.js +69 -0
  77. package/lib/agent-cli/lib/ui/dashboard-ui.js +222 -0
  78. package/lib/agent-cli/lib/ui/evolution-signals-ui.js +107 -0
  79. package/lib/agent-cli/lib/ui/export-ui.js +94 -0
  80. package/lib/agent-cli/lib/ui/fix-all-ui.js +191 -0
  81. package/lib/agent-cli/lib/ui/help-ui.js +49 -0
  82. package/lib/agent-cli/lib/ui/index.js +199 -0
  83. package/lib/agent-cli/lib/ui/init-ui.js +56 -0
  84. package/lib/agent-cli/lib/ui/knowledge-ui.js +55 -0
  85. package/lib/agent-cli/lib/ui/learn-ui.js +706 -0
  86. package/lib/agent-cli/lib/ui/lessons-ui.js +148 -0
  87. package/lib/agent-cli/lib/ui/pretty.js +145 -0
  88. package/lib/agent-cli/lib/ui/proposals-ui.js +99 -0
  89. package/lib/agent-cli/lib/ui/recall-ui.js +342 -0
  90. package/lib/agent-cli/lib/ui/routing-demo.js +79 -0
  91. package/lib/agent-cli/lib/ui/routing-ui.js +325 -0
  92. package/lib/agent-cli/lib/ui/settings-ui.js +381 -0
  93. package/lib/agent-cli/lib/ui/stats-ui.js +123 -0
  94. package/lib/agent-cli/lib/ui/watch-ui.js +236 -0
  95. package/lib/agent-cli/lib/watcher.js +181 -0
  96. package/lib/agent-cli/lib/watcher.test.js +85 -0
  97. package/lib/agent-cli/package.json +51 -0
  98. package/lib/agent-cli/scripts/adaptive_engine.js +381 -0
  99. package/lib/agent-cli/scripts/dashboard_server.js +224 -0
  100. package/lib/agent-cli/scripts/error_sensor.js +565 -0
  101. package/lib/agent-cli/scripts/learn_from_failure.js +225 -0
  102. package/lib/agent-cli/scripts/pattern_analyzer.js +781 -0
  103. package/lib/agent-cli/scripts/pre_execution_check.js +623 -0
  104. package/lib/agent-cli/scripts/rule_sharing.js +374 -0
  105. package/lib/agent-cli/scripts/skill_injector.js +387 -0
  106. package/lib/agent-cli/scripts/success_sensor.js +500 -0
  107. package/lib/agent-cli/scripts/user_correction_sensor.js +426 -0
  108. package/lib/agent-cli/services/auto-learn-service.js +247 -0
  109. package/lib/agent-cli/src/MIGRATION.md +418 -0
  110. package/lib/agent-cli/src/README.md +367 -0
  111. package/lib/agent-cli/src/core/evolution/evolution-signal.js +42 -0
  112. package/lib/agent-cli/src/core/evolution/index.js +17 -0
  113. package/lib/agent-cli/src/core/evolution/review-gate.js +40 -0
  114. package/lib/agent-cli/src/core/evolution/signal-detector.js +137 -0
  115. package/lib/agent-cli/src/core/evolution/signal-queue.js +79 -0
  116. package/lib/agent-cli/src/core/evolution/threshold-checker.js +79 -0
  117. package/lib/agent-cli/src/core/index.js +15 -0
  118. package/lib/agent-cli/src/core/learning/cognitive-enhancer.js +282 -0
  119. package/lib/agent-cli/src/core/learning/index.js +12 -0
  120. package/lib/agent-cli/src/core/learning/lesson-synthesizer.js +83 -0
  121. package/lib/agent-cli/src/core/scanning/index.js +14 -0
  122. package/lib/agent-cli/src/data/index.js +13 -0
  123. package/lib/agent-cli/src/data/repositories/index.js +8 -0
  124. package/lib/agent-cli/src/data/repositories/lesson-repository.js +130 -0
  125. package/lib/agent-cli/src/data/repositories/signal-repository.js +119 -0
  126. package/lib/agent-cli/src/data/storage/index.js +8 -0
  127. package/lib/agent-cli/src/data/storage/json-storage.js +64 -0
  128. package/lib/agent-cli/src/data/storage/yaml-storage.js +66 -0
  129. package/lib/agent-cli/src/infrastructure/index.js +13 -0
  130. package/lib/agent-cli/src/presentation/formatters/skill-formatter.js +232 -0
  131. package/lib/agent-cli/src/services/export-service.js +162 -0
  132. package/lib/agent-cli/src/services/index.js +13 -0
  133. package/lib/agent-cli/src/services/learning-service.js +99 -0
  134. package/lib/agent-cli/types/index.d.ts +343 -0
  135. package/lib/agent-cli/utils/benchmark.js +269 -0
  136. package/lib/agent-cli/utils/logger.js +303 -0
  137. package/lib/agent-cli/utils/ml_patterns.js +300 -0
  138. package/lib/agent-cli/utils/recovery.js +312 -0
  139. package/lib/agent-cli/utils/telemetry.js +290 -0
  140. package/lib/agentskillskit-cli/README.md +21 -0
  141. package/lib/agentskillskit-cli/ag-smart.js +158 -0
  142. package/lib/agentskillskit-cli/package.json +51 -0
  143. package/package.json +79 -0
  144. package/specs/ADD_SKILL_SPEC.md +333 -0
  145. package/specs/REGISTRY_V2_SPEC.md +334 -0
@@ -0,0 +1,158 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Smart Agent CLI - ESM Version (Production-Ready)
4
+ *
5
+ * The main interface for humans to interact with the Smart Agent Skills system.
6
+ *
7
+ * Commands:
8
+ * learn Add new lessons to memory
9
+ * recall Check files against memory
10
+ * audit Full compliance audit
11
+ * watch Real-time file monitoring
12
+ * stats Knowledge base statistics
13
+ * install-hooks Install git pre-commit hook
14
+ * lint-learn Auto-learn from ESLint output
15
+ */
16
+
17
+ import { spawn } from "child_process";
18
+ import path from "path";
19
+ import { fileURLToPath } from "url";
20
+ import { VERSION } from "../lib/config.js";
21
+
22
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
23
+ const ARGS = process.argv.slice(2);
24
+ const COMMAND = ARGS[0];
25
+ const SCRIPTS_DIR = path.join(__dirname, "..", "lib");
26
+ const HOOKS_DIR = path.join(SCRIPTS_DIR, "hooks");
27
+
28
+ /**
29
+ * Run a script with given arguments
30
+ * @param {string} script - Script filename (relative to lib/)
31
+ * @param {string[]} args - Arguments to pass
32
+ * @param {string} baseDir - Base directory for script
33
+ */
34
+ function run(script, args = [], baseDir = SCRIPTS_DIR) {
35
+ const scriptPath = path.join(baseDir, script);
36
+ const child = spawn("node", [scriptPath, ...args], {
37
+ stdio: "inherit",
38
+ shell: true
39
+ });
40
+
41
+ child.on("close", (code) => {
42
+ process.exit(code || 0);
43
+ });
44
+
45
+ child.on("error", (err) => {
46
+ console.error(`❌ Failed to run ${script}:`, err.message);
47
+ process.exit(1);
48
+ });
49
+ }
50
+
51
+ function printHelp() {
52
+ console.log(`
53
+ 🤖 Agent Skill Kit CLI v${VERSION}
54
+
55
+ Usage: agent <command> [options]
56
+
57
+ ${"─".repeat(50)}
58
+
59
+ 📚 CORE COMMANDS:
60
+
61
+ learn Teach a new lesson to the memory
62
+ agent learn --add --pattern "var " --message "Use let/const"
63
+ agent learn --list
64
+ agent learn --remove LEARN-001
65
+
66
+ recall Check file(s) against learned patterns
67
+ agent recall src/app.js
68
+ agent recall ./src
69
+
70
+ audit Run full compliance audit
71
+ agent audit [directory]
72
+
73
+ ${"─".repeat(50)}
74
+
75
+ 🚀 PRODUCTION FEATURES:
76
+
77
+ watch Real-time file monitoring
78
+ agent watch [directory]
79
+
80
+ stats Knowledge base statistics
81
+ agent stats
82
+
83
+ install-hooks Install git pre-commit hook
84
+ agent install-hooks
85
+ agent install-hooks --remove
86
+
87
+ lint-learn Auto-learn from ESLint JSON output
88
+ npx eslint . --format json | agent lint-learn
89
+
90
+ fix 🆕 Auto-fix violations
91
+ agent fix <file|dir> [--mode safe|aggressive]
92
+
93
+ sync-skills 🆕 Sync hot patterns to SKILL.md
94
+ agent sync-skills
95
+
96
+ ${"─".repeat(50)}
97
+
98
+ 📖 HELP:
99
+
100
+ help, --help Show this help message
101
+ --version Show version number
102
+
103
+ 💡 Docs: https://github.com/agentskillkit/agent-skills
104
+ `);
105
+ }
106
+
107
+ // Command routing
108
+ switch (COMMAND) {
109
+ // Core commands (v2 versions)
110
+ case "learn":
111
+ run("learn.js", ARGS.slice(1));
112
+ break;
113
+ case "recall":
114
+ run("recall.js", ARGS.slice(1));
115
+ break;
116
+ case "audit":
117
+ run("audit.js", ARGS.slice(1));
118
+ break;
119
+
120
+ // Production features
121
+ case "watch":
122
+ run("watcher.js", ARGS.slice(1));
123
+ break;
124
+ case "stats":
125
+ run("stats.js", ARGS.slice(1));
126
+ break;
127
+ case "install-hooks":
128
+ run("install-hooks.js", ARGS.slice(1), HOOKS_DIR);
129
+ break;
130
+ case "lint-learn":
131
+ run("lint-learn.js", ARGS.slice(1), HOOKS_DIR);
132
+ break;
133
+ case "fix":
134
+ run("fix.js", ARGS.slice(1));
135
+ break;
136
+ case "sync-skills":
137
+ run("skill-learn.js", ARGS.slice(1));
138
+ break;
139
+
140
+ // Meta
141
+ case "--version":
142
+ case "-v":
143
+ console.log(VERSION);
144
+ break;
145
+ case "help":
146
+ case "--help":
147
+ case "-h":
148
+ printHelp();
149
+ break;
150
+ case undefined:
151
+ // No command = show interactive Clack menu
152
+ import("../lib/ui/index.js").then(m => m.showMainMenu()).catch(console.error);
153
+ break;
154
+ default:
155
+ console.log(`❌ Unknown command: ${COMMAND}`);
156
+ console.log(" Run 'agent help' for available commands.\n");
157
+ process.exit(1);
158
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "agentskillskit-cli",
3
+ "version": "3.2.0",
4
+ "description": "CLI for Agent Skill Kit",
5
+ "type": "module",
6
+ "main": "lib/config.js",
7
+ "bin": {
8
+ "agent": "bin/agent.js",
9
+ "agent": "bin/agent.js",
10
+ "agent-skills-kit": "bin/agent.js"
11
+ },
12
+ "scripts": {
13
+ "test": "vitest run",
14
+ "test:watch": "vitest"
15
+ },
16
+ "dependencies": {
17
+ "@clack/core": "^0.5.0",
18
+ "@clack/prompts": "^0.11.0",
19
+ "boxen": "^8.0.1",
20
+ "clipboardy": "^5.1.0",
21
+ "js-yaml": "^4.1.0",
22
+ "ora": "^9.1.0",
23
+ "picocolors": "^1.1.1"
24
+ },
25
+ "devDependencies": {
26
+ "vitest": "^1.6.0"
27
+ },
28
+ "author": "Agent Skill Kit Authors",
29
+ "license": "MIT",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/agentskillkit/agent-skills.git",
33
+ "directory": "packages/cli"
34
+ },
35
+ "keywords": [
36
+ "agent",
37
+ "ai",
38
+ "skills",
39
+ "cli",
40
+ "tooling",
41
+ "antigravity"
42
+ ],
43
+ "files": [
44
+ "bin",
45
+ "lib",
46
+ "README.md"
47
+ ],
48
+ "publishConfig": {
49
+ "access": "public"
50
+ }
51
+ }
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "pikakit",
3
+ "version": "1.0.0",
4
+ "description": "Enterprise-grade Agent Skill Manager with Antigravity Skills support, Progressive Disclosure detection, and semantic routing validation",
5
+ "license": "MIT",
6
+ "author": "agentskillkit <agentskillkit@gmail.com>",
7
+ "homepage": "https://github.com/agentskillkit/pikakit",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/agentskillkit/pikakit.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/agentskillkit/pikakit/issues"
14
+ },
15
+ "type": "module",
16
+ "bin": {
17
+ "pikakit": "./bin/cli.mjs",
18
+ "kit": "./bin/cli.mjs",
19
+ "agent": "./lib/agent-cli/bin/agent.js"
20
+ },
21
+ "files": [
22
+ "bin/",
23
+ "lib/",
24
+ "specs/",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "types": "./lib/agent-cli/types/index.d.ts",
29
+ "engines": {
30
+ "node": ">=18.0.0"
31
+ },
32
+ "keywords": [
33
+ "agent",
34
+ "ai",
35
+ "skills",
36
+ "cli",
37
+ "tooling",
38
+ "registry",
39
+ "security",
40
+ "devops",
41
+ "automation",
42
+ "antigravity"
43
+ ],
44
+ "scripts": {
45
+ "lint": "eslint bin/",
46
+ "lint:fix": "eslint bin/ --fix",
47
+ "format": "prettier --write bin/",
48
+ "test": "vitest run",
49
+ "test:watch": "vitest",
50
+ "ci": "npm run lint && npm test && node bin/kit.js verify --strict && node bin/kit.js doctor --strict",
51
+ "agent": "agent"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "dependencies": {
57
+ "@clack/core": "^0.5.0",
58
+ "@clack/prompts": "^0.11.0",
59
+ "@google/generative-ai": "^0.21.0",
60
+ "boxen": "^8.0.1",
61
+ "chalk": "^5.4.1",
62
+ "clipboardy": "^5.1.0",
63
+ "csv-parse": "^6.1.0",
64
+ "css-tree": "^3.1.0",
65
+ "dotenv": "^16.4.5",
66
+ "gradient-string": "^2.0.2",
67
+ "js-yaml": "^4.1.0",
68
+ "kleur": "^4.1.5",
69
+ "ora": "^9.1.0",
70
+ "picocolors": "^1.1.1",
71
+ "prompts": "^2.4.2"
72
+ },
73
+ "devDependencies": {
74
+ "agentskillskit-cli": "^3.2.0",
75
+ "eslint": "^8.57.0",
76
+ "prettier": "^3.2.5",
77
+ "vitest": "^4.0.18"
78
+ }
79
+ }
@@ -0,0 +1,333 @@
1
+ # ADD_SKILL_SPEC.md
2
+ ## Enterprise Agent Skill Specification
3
+
4
+ **Status:** Stable
5
+ **Version:** 1.0
6
+ **Applies to:** `@dataguruin/add-skill >= 1.0`
7
+ **Audience:** Tool authors, skill publishers, platform engineers, AI agents
8
+
9
+ ---
10
+
11
+ ## 1. Purpose & Scope
12
+
13
+ `@dataguruin/add-skill` defines a **deterministic, secure, and auditable system** for managing **Agent Skills**.
14
+
15
+ A **Skill** is a **versioned, verifiable intelligence artifact** that extends an agent’s capabilities without executing code or mutating the host environment.
16
+
17
+ This specification is **normative** and defines:
18
+
19
+ - Skill format and lifecycle
20
+ - Deterministic installation and locking
21
+ - Security and trust guarantees
22
+ - CLI behavior and invariants
23
+ - Explicitly forbidden practices
24
+
25
+ Any implementation that violates this specification is considered **non-compliant**.
26
+
27
+ ---
28
+
29
+ ## 2. Terminology
30
+
31
+ | Term | Definition |
32
+ |---|---|
33
+ | Skill | A folder containing agent instructions and static resources |
34
+ | Publisher | Entity that authors and optionally signs a skill |
35
+ | Skill Source | Git repository + immutable ref |
36
+ | Workspace Scope | `.agent/skills` |
37
+ | Global Scope | `~/.gemini/antigravity/skills` |
38
+ | Lock File | `skill-lock.json`, ensures deterministic environments |
39
+ | Deterministic | Same inputs always produce the same skill environment |
40
+
41
+ ---
42
+
43
+ ## 3. Skill Format (MANDATORY)
44
+
45
+ ### 3.1 Required Files
46
+
47
+ Every skill **MUST** contain the following files:
48
+
49
+ ```
50
+
51
+ <skill-name>/
52
+ ├─ SKILL.md # Human- and agent-readable instructions
53
+ ├─ .skill-source.json # Auto-generated metadata (DO NOT EDIT)
54
+
55
+ ```
56
+
57
+ If any required file is missing:
58
+
59
+ - `add-skill install` → **FAIL**
60
+ - `add-skill doctor` → **ERROR**
61
+
62
+ ---
63
+
64
+ ### 3.2 Optional Files
65
+
66
+ ```
67
+
68
+ ├─ README.md
69
+ ├─ assets/
70
+ ├─ examples/
71
+ ├─ docs/
72
+
73
+ ````
74
+
75
+ Optional files **MUST NOT**:
76
+
77
+ - Execute automatically
78
+ - Mutate the system environment
79
+ - Perform network calls
80
+ - Contain secrets or credentials
81
+
82
+ All optional content must be **inert by default**.
83
+
84
+ ---
85
+
86
+ ## 4. SKILL.md Rules (NON-NEGOTIABLE)
87
+
88
+ `SKILL.md`:
89
+
90
+ - MUST be plain Markdown
91
+ - MUST contain instructions only
92
+ - MUST NOT contain:
93
+ - secrets or credentials
94
+ - API keys
95
+ - executable code
96
+ - shell commands that mutate the system
97
+
98
+ **Design Rule:**
99
+
100
+ > A skill must be safe to read, safe to load, and safe to reason about.
101
+
102
+ ---
103
+
104
+ ## 5. Skill Metadata — `.skill-source.json`
105
+
106
+ Generated automatically at install time by `add-skill`.
107
+
108
+ ### Schema (v1)
109
+
110
+ ```json
111
+ {
112
+ "repo": "org/repo",
113
+ "skill": "skill-name",
114
+ "ref": "v1.2.3",
115
+ "checksum": "sha256:…",
116
+ "publisher": "org",
117
+ "installedAt": "ISO-8601"
118
+ }
119
+ ````
120
+
121
+ ### Rules
122
+
123
+ * MUST NOT be manually edited
124
+ * `checksum` is a Merkle SHA-256 hash of the entire skill directory
125
+ * Any checksum drift is an **integrity violation**
126
+
127
+ ---
128
+
129
+ ## 6. Skill Lifecycle
130
+
131
+ ### 6.1 Install
132
+
133
+ ```bash
134
+ add-skill install org/repo#skill@ref
135
+ ```
136
+
137
+ **Guarantees:**
138
+
139
+ * Skill content matches the declared source
140
+ * Checksum is computed and recorded
141
+ * Scope resolution is deterministic
142
+
143
+ ---
144
+
145
+ ### 6.2 Verify
146
+
147
+ ```bash
148
+ add-skill verify
149
+ add-skill verify --strict
150
+ ```
151
+
152
+ **Verification checks:**
153
+
154
+ * Directory integrity
155
+ * Checksum validity
156
+ * Metadata presence
157
+
158
+ In `--strict` mode, **any violation results in failure**.
159
+
160
+ ---
161
+
162
+ ### 6.3 Upgrade
163
+
164
+ ```bash
165
+ add-skill upgrade-all
166
+ ```
167
+
168
+ or
169
+
170
+ ```bash
171
+ add-skill install org/repo#skill@new-ref --upgrade
172
+ ```
173
+
174
+ **Rules:**
175
+
176
+ * Upgrades must be explicit
177
+ * Silent or implicit upgrades are forbidden
178
+ * Lock file must be regenerated after upgrades
179
+
180
+ ---
181
+
182
+ ### 6.4 Lock (Deterministic Environments)
183
+
184
+ ```bash
185
+ add-skill lock
186
+ ```
187
+
188
+ Generates:
189
+
190
+ ```
191
+ .agent/skill-lock.json
192
+ ```
193
+
194
+ **Purpose:**
195
+
196
+ > Ensure identical skill environments across machines, CI pipelines, and production agents.
197
+
198
+ ---
199
+
200
+ ### 6.5 Locked Install (CI / Production Mode)
201
+
202
+ ```bash
203
+ add-skill install --locked
204
+ ```
205
+
206
+ **Rules:**
207
+
208
+ * Only skills listed in `skill-lock.json` are allowed
209
+ * Ref overrides are forbidden
210
+ * Any checksum mismatch results in immediate failure
211
+
212
+ ---
213
+
214
+ ## 7. Security Model
215
+
216
+ ### 7.1 Integrity
217
+
218
+ * Merkle SHA-256 hashing
219
+ * Directory-wide and order-independent
220
+ * Any file modification invalidates the checksum
221
+
222
+ ---
223
+
224
+ ### 7.2 Trust Model
225
+
226
+ * Skills are verified locally
227
+ * Registries and publishers may provide signatures
228
+ * Trust is **explicit**, never implicit
229
+
230
+ ---
231
+
232
+ ### 7.3 Execution Model
233
+
234
+ * Skills MUST NOT execute code
235
+ * No scripts are run during install
236
+ * No network calls are allowed during install or verification
237
+
238
+ ---
239
+
240
+ ## 8. add-skill doctor (Audit & Repair)
241
+
242
+ ```bash
243
+ add-skill doctor
244
+ add-skill doctor --fix
245
+ add-skill doctor --strict
246
+ ```
247
+
248
+ **Doctor checks:**
249
+
250
+ * Missing required files
251
+ * Checksum drift
252
+ * Lock mismatches
253
+ * Orphaned cache entries
254
+
255
+ **Guarantee:**
256
+
257
+ > No mutation occurs unless `--fix` is explicitly provided.
258
+
259
+ ---
260
+
261
+ ## 9. CLI Contract (STABILITY GUARANTEE)
262
+
263
+ The following flags have **guaranteed semantics**:
264
+
265
+ | Flag | Meaning |
266
+ | ----------- | -------------------------------- |
267
+ | `--verify` | Read-only integrity verification |
268
+ | `--strict` | Fail on any violation |
269
+ | `--locked` | Enforce deterministic lock |
270
+ | `--dry-run` | No filesystem changes |
271
+ | `--fix` | Apply safe, explicit repairs |
272
+
273
+ Breaking changes require:
274
+
275
+ * Major version bump
276
+ * Specification update
277
+
278
+ ---
279
+
280
+ ## 10. CI/CD Integration (RECOMMENDED)
281
+
282
+ ```yaml
283
+ - name: Install skills
284
+ run: add-skill install --locked
285
+
286
+ - name: Verify skills
287
+ run: add-skill verify --strict
288
+
289
+ - name: Audit environment
290
+ run: add-skill doctor --strict
291
+ ```
292
+
293
+ ---
294
+
295
+ ## 11. Forbidden Practices (HARD FAIL)
296
+
297
+ The following practices are explicitly forbidden:
298
+
299
+ * ❌ Auto-updating skills
300
+ * ❌ Executable scripts inside skills
301
+ * ❌ Mutable skills without checksum update
302
+ * ❌ Network calls during install
303
+ * ❌ Hidden side effects
304
+ * ❌ Silent security bypass
305
+
306
+ Violation results in failure by design.
307
+
308
+ ---
309
+
310
+ ## 12. Design Philosophy
311
+
312
+ Skills are **intelligence artifacts**, not scripts.
313
+ Trust must be explicit.
314
+ Reproducibility is mandatory.
315
+ Silence is a bug.
316
+
317
+ `@dataguruin/add-skill` treats agent skills with the same rigor as binaries, containers, or infrastructure code.
318
+
319
+ ---
320
+
321
+ ## 13. Forward Compatibility
322
+
323
+ This specification is designed to be compatible with:
324
+
325
+ * Signed skill registries
326
+ * Organization-level registries
327
+ * Policy enforcement engines
328
+ * Paid and licensed skills
329
+ * Enterprise governance systems
330
+
331
+ ---
332
+
333
+ **END OF SPEC**