singularity-claude 0.1.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.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "singularity-claude",
3
+ "description": "Self-evolving skill engine for Claude Code",
4
+ "owner": {
5
+ "name": "Haroun El Alami"
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "singularity-claude",
10
+ "description": "Self-evolving skill engine for Claude Code. Creates, scores, repairs, and hardens skills autonomously.",
11
+ "version": "0.1.0",
12
+ "source": "./"
13
+ }
14
+ ]
15
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "singularity-claude",
3
+ "description": "Self-evolving skill engine for Claude Code. Creates, scores, repairs, and hardens skills autonomously through recursive improvement cycles.",
4
+ "version": "0.1.0",
5
+ "author": {
6
+ "name": "Haroun El Alami"
7
+ },
8
+ "homepage": "https://github.com/shmayro/singularity-claude",
9
+ "repository": "https://github.com/shmayro/singularity-claude",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "skills",
13
+ "evolution",
14
+ "self-improving",
15
+ "scoring",
16
+ "auto-repair",
17
+ "crystallization",
18
+ "memory",
19
+ "claude-code"
20
+ ]
21
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2026-03-17
4
+
5
+ ### Added
6
+ - Initial plugin structure with `.claude-plugin/` registration
7
+ - **using-singularity** skill — bootstrap context injected at session start
8
+ - **creating-skills** skill — meta-skill for building new Claude Code skills
9
+ - **scoring** skill — 5-dimension rubric (Correctness, Completeness, Edge Cases, Efficiency, Reusability)
10
+ - **repairing** skill — auto-fix failing skills through diagnosis and targeted rewrite
11
+ - **crystallizing** skill — lock validated versions via git tags
12
+ - **reviewing** skill — health check with trend analysis and recommendations
13
+ - **dashboard** skill — overview table of all managed skills with alerts
14
+ - **skill-assessor** agent (haiku) — automated scoring subagent
15
+ - **gap-detector** agent (haiku) — capability gap analysis subagent
16
+ - **score-manager.sh** — CLI for managing score JSON files
17
+ - **telemetry-writer.sh** — CLI for structured execution logging
18
+ - SessionStart hook with alert injection
19
+ - Data storage at `~/.claude/singularity/` (scores, telemetry, registry, config)
20
+ - Maturity progression: draft → tested → hardened → crystallized
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Haroun El Alami
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,269 @@
1
+ <p align="center">
2
+ <h1 align="center">singularity-claude</h1>
3
+ <p align="center">
4
+ <strong>Skills that evolve themselves.</strong>
5
+ <br />
6
+ A self-evolving skill engine for Claude Code — create, score, repair, and crystallize skills through autonomous recursive improvement loops.
7
+ </p>
8
+ <p align="center">
9
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
10
+ <a href="#installation"><img src="https://img.shields.io/badge/Claude%20Code-Plugin-blue?logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgZmlsbD0id2hpdGUiLz48L3N2Zz4=" alt="Claude Code Plugin"></a>
11
+ <img src="https://img.shields.io/badge/Version-0.1.0-green" alt="Version">
12
+ <img src="https://img.shields.io/badge/Status-Experimental-orange" alt="Status">
13
+ </p>
14
+ </p>
15
+
16
+ ---
17
+
18
+ ## The Problem
19
+
20
+ Claude Code skills are **static**. You write them once, and they stay exactly as they are — even when they fail, produce subpar output, or encounter new edge cases. There's no feedback loop, no way to know which skills are working well, and no mechanism to improve them over time.
21
+
22
+ You end up with a growing pile of skills where some work great, some are mediocre, and some are silently broken. The only way to fix them is manual review.
23
+
24
+ ## The Solution
25
+
26
+ **singularity-claude** adds a recursive evolution loop to your skills:
27
+
28
+ ```mermaid
29
+ graph TD
30
+ Goal["🎯 Goal:<br/>Set up API proxy endpoints"]
31
+ Goal --> HasSkill{Skill exists?}
32
+
33
+ HasSkill -->|No| Gap["🔍 Gap detected:<br/>recurring pattern"]
34
+ Gap --> Create["⚙️ /singularity-create\nGather requirements\nGenerate SKILL.md\nRegister + init scoring"]
35
+ Create --> Execute
36
+
37
+ HasSkill -->|Yes| Execute["⚡ Execute skill"]
38
+ Execute --> Score["📊 /singularity-score\nDispatch assessor agent\nRate 5 dimensions · 0-100"]
39
+ Score --> Maturity["🔄 Auto-update maturity\ndraft → tested → hardened"]
40
+
41
+ Maturity --> Low{Avg < 50\n2+ runs?}
42
+ Low -->|Yes| Repair["🔧 /singularity-repair\nAnalyze telemetry\nRewrite weak dimensions\nBump version · re-test"]
43
+ Repair --> Execute
44
+
45
+ Low -->|No| High{Avg ≥ 90 · 5+ runs\nhardened · edge cases?}
46
+ High -->|Yes| Crystal["💎 /singularity-crystallize\nGit tag + lock version"]
47
+ Crystal --> Done["✅ Production-grade skill\nImmutable · rollback-safe"]
48
+
49
+ High -->|No| Loop["🔁 Keep using + scoring"]
50
+ Loop --> Execute
51
+
52
+ style Goal fill:#1d3557,color:#fff,stroke:#0d1b2a
53
+ style Gap fill:#e9ecef,color:#000,stroke:#adb5bd
54
+ style Create fill:#457b9d,color:#fff,stroke:#1d3557
55
+ style Execute fill:#2a9d8f,color:#fff,stroke:#1a7a6e
56
+ style Score fill:#e76f51,color:#fff,stroke:#c1440e
57
+ style Maturity fill:#264653,color:#fff,stroke:#1d3540
58
+ style Low fill:#fff3cd,color:#000,stroke:#ffc107
59
+ style High fill:#d4edda,color:#000,stroke:#28a745
60
+ style Repair fill:#f4a261,color:#000,stroke:#e76f51
61
+ style Crystal fill:#2d6a4f,color:#fff,stroke:#1b4332
62
+ style Done fill:#1b4332,color:#fff,stroke:#0d2818
63
+ style Loop fill:#a8dadc,color:#000,stroke:#457b9d
64
+ ```
65
+
66
+ > **Tip:** Click the expand button (↔) on the diagram to see the full interactive flow.
67
+
68
+ Skills are scored after every execution. Low scores trigger automatic repair. High scores lead to crystallization — a locked, battle-tested version you can trust. Every step is logged for full auditability.
69
+
70
+ **No external dependencies.** No SmythOS, no OpenTelemetry collector, no Docker. Pure Claude Code.
71
+
72
+ ## What's Inside
73
+
74
+ ### Skills (7)
75
+
76
+ | Skill | Command | Purpose |
77
+ |-------|---------|---------|
78
+ | **using-singularity** | *(auto-loaded)* | Bootstrap context + capability gap detection |
79
+ | **creating-skills** | `/singularity-create` | Build new skills through a structured workflow |
80
+ | **scoring** | `/singularity-score` | Rate execution on a 5-dimension rubric (0-100) |
81
+ | **repairing** | `/singularity-repair` | Auto-fix failing skills by analyzing score history |
82
+ | **crystallizing** | `/singularity-crystallize` | Lock validated versions via git tags |
83
+ | **reviewing** | `/singularity-review` | Health check with trend analysis |
84
+ | **dashboard** | `/singularity-dashboard` | Overview of all managed skills |
85
+
86
+ ### Agents (2)
87
+
88
+ | Agent | Model | Purpose |
89
+ |-------|-------|---------|
90
+ | **skill-assessor** | Haiku | Fast, cheap automated scoring against the rubric |
91
+ | **gap-detector** | Haiku | Analyzes failed tasks to find missing skill capabilities |
92
+
93
+ ### Scripts (2)
94
+
95
+ | Script | Purpose |
96
+ |--------|---------|
97
+ | `score-manager.sh` | CLI for reading/writing score JSON files (atomic writes, jq/node fallback) |
98
+ | `telemetry-writer.sh` | CLI for structured execution logging with replay support |
99
+
100
+ ## Installation
101
+
102
+ ### From the official Claude Code plugin registry
103
+
104
+ > **Requires** [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI
105
+
106
+ Inside a Claude Code session, run:
107
+
108
+ ```
109
+ /plugin marketplace add Shmayro/singularity-claude
110
+ /plugin install singularity-claude
111
+ ```
112
+
113
+ ### From npm
114
+
115
+ ```bash
116
+ npm install -g singularity-claude
117
+ ```
118
+
119
+ Then inside a Claude Code session:
120
+
121
+ ```
122
+ /plugin marketplace add $(npm root -g)/singularity-claude
123
+ /plugin install singularity-claude
124
+ ```
125
+
126
+ ### From source
127
+
128
+ ```bash
129
+ git clone https://github.com/shmayro/singularity-claude.git
130
+ cd singularity-claude
131
+ ```
132
+
133
+ Then inside a Claude Code session:
134
+
135
+ ```
136
+ /plugin marketplace add .
137
+ /plugin install singularity-claude
138
+ ```
139
+
140
+ ## Quick Start
141
+
142
+ ```bash
143
+ # 1. Start a new Claude Code session — singularity loads automatically
144
+
145
+ # 2. Create your first skill
146
+ /singularity-create
147
+
148
+ # 3. Use the skill, then score it
149
+ /singularity-score
150
+
151
+ # 4. Check the dashboard
152
+ /singularity-dashboard
153
+ ```
154
+
155
+ That's it. The evolution loop starts running from the first score.
156
+
157
+ ## How It Works
158
+
159
+ ### The Evolution Loop
160
+
161
+ **1. Create** — `/singularity-create` walks you through building a new skill: requirements gathering, duplicate checking, SKILL.md generation, registry registration, and initial scoring.
162
+
163
+ **2. Score** — After every skill execution, `/singularity-score` dispatches a Haiku assessor agent that rates the output on 5 dimensions:
164
+
165
+ | Dimension | What It Measures |
166
+ |-----------|-----------------|
167
+ | **Correctness** (0-20) | Did it achieve the goal? |
168
+ | **Completeness** (0-20) | Were all requirements addressed? |
169
+ | **Edge Cases** (0-20) | Did it handle unusual inputs? |
170
+ | **Efficiency** (0-20) | Was the approach direct and minimal? |
171
+ | **Reusability** (0-20) | Could the output be reused? |
172
+
173
+ **3. Repair** — When a skill's average drops below 50 (configurable), `/singularity-repair` kicks in: reads score history + telemetry, identifies the weakest rubric dimensions, rewrites the skill to fix them, bumps the version, and re-tests.
174
+
175
+ **4. Harden** — Each edge case encountered is recorded. Skills that handle more edge cases with higher scores progress through maturity levels.
176
+
177
+ **5. Crystallize** — Once a skill hits 90+ average over 5+ runs with edge cases handled, `/singularity-crystallize` locks it with a git tag. Crystallized skills are immutable — a production-grade snapshot you can always roll back to.
178
+
179
+ ### Maturity Progression
180
+
181
+ ```mermaid
182
+ graph TD
183
+ Draft["📝 Draft<br/><i>&lt; 3 runs</i>"] --> Tested["✅ Tested<br/><i>3+ runs, avg ≥ 60</i>"]
184
+ Tested --> Hardened["🛡️ Hardened<br/><i>5+ runs, avg ≥ 80<br/>edge cases handled</i>"]
185
+ Hardened --> Crystallized["🔒 Crystallized<br/><i>git-tagged, immutable</i>"]
186
+
187
+ style Draft fill:#e9ecef,color:#000,stroke:#adb5bd
188
+ style Tested fill:#a8dadc,color:#000,stroke:#457b9d
189
+ style Hardened fill:#264653,color:#fff,stroke:#1d3540
190
+ style Crystallized fill:#2d6a4f,color:#fff,stroke:#1b4332
191
+ ```
192
+
193
+ ### Capability Gap Detection
194
+
195
+ The `using-singularity` skill (injected at every session start) teaches Claude to recognize when a new skill is needed:
196
+
197
+ - **Repetition** — Doing the same multi-step procedure across sessions
198
+ - **Failure without coverage** — No existing skill addresses the task
199
+ - **Generalizable pattern** — The procedure applies beyond the current task
200
+
201
+ When a gap is detected, Claude suggests creating a new skill automatically.
202
+
203
+ ## Data Storage
204
+
205
+ All data is local. Nothing leaves your machine.
206
+
207
+ ```
208
+ ~/.claude/singularity/
209
+ ├── scores/ # Score history per skill (JSON)
210
+ ├── telemetry/ # Execution logs per skill (JSON)
211
+ ├── registry.json # All managed skills
212
+ └── config.json # Thresholds and preferences
213
+ ```
214
+
215
+ ## Configuration
216
+
217
+ Edit `~/.claude/singularity/config.json`:
218
+
219
+ ```json
220
+ {
221
+ "autoRepairThreshold": 50,
222
+ "crystallizationThreshold": 90,
223
+ "crystallizationMinExecutions": 5,
224
+ "scoringMode": "auto"
225
+ }
226
+ ```
227
+
228
+ | Setting | Default | Description |
229
+ |---------|---------|-------------|
230
+ | `autoRepairThreshold` | 50 | Average score below this triggers repair suggestion |
231
+ | `crystallizationThreshold` | 90 | Average score above this enables crystallization |
232
+ | `crystallizationMinExecutions` | 5 | Minimum runs before crystallization is allowed |
233
+ | `scoringMode` | `"auto"` | `"auto"` (agent scores), `"manual"` (you score), `"hybrid"` (agent scores, you override) |
234
+
235
+ ## Integration
236
+
237
+ - Works alongside [superpowers](https://github.com/obra/superpowers) and other Claude Code plugins
238
+ - Skills namespaced as `singularity-claude:*` — no conflicts
239
+ - Created skills go to `~/.claude/skills/` — the standard Claude Code location, usable by any plugin
240
+
241
+ ## Requirements
242
+
243
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI
244
+ - `jq` (recommended) or Node.js (fallback) for JSON manipulation
245
+ - Git (optional, for crystallization via tags)
246
+
247
+ ## Inspired By
248
+
249
+ [Moltron](https://github.com/adridder/moltron) — a self-evolving skill engine built on SmythOS. singularity-claude takes the same core ideas (scoring, auto-repair, crystallization, hardening) and rebuilds them natively for Claude Code with zero external dependencies.
250
+
251
+ ## Contributing
252
+
253
+ Contributions welcome! See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for guidelines.
254
+
255
+ **Ideas for contributions:**
256
+ - New scoring rubric dimensions
257
+ - Additional maturity metrics
258
+ - Platform support (Cursor, Codex, Gemini CLI)
259
+ - Skill templates for common patterns
260
+
261
+ ## License
262
+
263
+ [MIT](LICENSE) — use it however you want.
264
+
265
+ ---
266
+
267
+ <p align="center">
268
+ <sub>Built with Claude Code. Skills that improve themselves.</sub>
269
+ </p>
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: gap-detector
3
+ description: Analyzes a failed or unsatisfied task to determine if a new skill should be created. Checks existing registry for coverage and recommends skill creation when capability gaps are found.
4
+ model: haiku
5
+ ---
6
+
7
+ # Gap Detector
8
+
9
+ You are a capability gap analyzer for the singularity-claude skill evolution engine. Your job is to determine whether a task failure or difficulty indicates a missing skill.
10
+
11
+ ## Input
12
+
13
+ You will receive:
14
+ 1. **Task description** — what the user tried to accomplish
15
+ 2. **Outcome** — what happened (failure, partial success, manual workaround)
16
+ 3. **Registry** — list of existing singularity-managed skills
17
+ 4. **Context** — any relevant error messages, code, or notes
18
+
19
+ ## Analysis Process
20
+
21
+ 1. **Understand the task** — What capability was needed?
22
+ 2. **Check coverage** — Does any existing skill address this capability?
23
+ - Full coverage → No gap
24
+ - Partial coverage → Suggest extending existing skill
25
+ - No coverage → New skill needed
26
+ 3. **Assess recurrence** — Is this a one-off or likely to recur?
27
+ - One-off → Not worth a skill
28
+ - Recurring → Skill candidate
29
+ 4. **Assess generalizability** — Would this skill be useful beyond this specific task?
30
+ - Too specific → Not a skill (put in CLAUDE.md instead)
31
+ - Generalizable → Good skill candidate
32
+
33
+ ## Rules
34
+
35
+ - A gap is only worth flagging if the skill would be used 3+ times
36
+ - Don't recommend skills for things that are simple one-liners
37
+ - Don't recommend skills that duplicate existing tools or CLI commands
38
+ - Do recommend skills for multi-step workflows that require coordination
39
+
40
+ ## Output
41
+
42
+ Return ONLY valid JSON:
43
+
44
+ ```json
45
+ {
46
+ "gapDetected": true,
47
+ "confidence": "high",
48
+ "reasoning": "This task required X which no existing skill covers, and it's likely to recur because Y",
49
+ "recommendation": {
50
+ "action": "create-new",
51
+ "suggestedName": "<skill-name>",
52
+ "suggestedDescription": "Use when <triggering conditions>",
53
+ "suggestedScope": "<what the skill should cover>",
54
+ "relatedSkills": ["<existing-skill-if-any>"]
55
+ }
56
+ }
57
+ ```
58
+
59
+ Or if no gap:
60
+
61
+ ```json
62
+ {
63
+ "gapDetected": false,
64
+ "confidence": "high",
65
+ "reasoning": "This is covered by existing skill X / This is a one-off / This is too simple for a skill",
66
+ "recommendation": {
67
+ "action": "none",
68
+ "existingSkill": "<skill-name-if-applicable>"
69
+ }
70
+ }
71
+ ```
72
+
73
+ Confidence levels: `"high"`, `"medium"`, `"low"`
74
+ Actions: `"create-new"`, `"extend-existing"`, `"none"`
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: skill-assessor
3
+ description: Evaluates the quality of a skill execution output against the Singularity scoring rubric. Returns a structured score breakdown with per-dimension ratings and rationale. Use this agent for automated skill scoring.
4
+ model: haiku
5
+ ---
6
+
7
+ # Skill Assessor
8
+
9
+ You are a skill quality assessor for the singularity-claude evolution engine. Your job is to objectively evaluate how well a skill performed on a specific task.
10
+
11
+ ## Input
12
+
13
+ You will receive:
14
+ 1. **Skill name** and version
15
+ 2. **Task description** — what was requested
16
+ 3. **Skill output** — what was produced (files, code, analysis)
17
+ 4. **Scoring rubric** — the 5-dimension rubric to evaluate against
18
+
19
+ ## Evaluation Process
20
+
21
+ 1. Read the task description carefully
22
+ 2. Examine the skill output thoroughly
23
+ 3. Rate each rubric dimension 0-20 with a brief rationale
24
+ 4. Identify strengths, weaknesses, and edge cases encountered
25
+ 5. Compute the total score (sum of all dimensions)
26
+
27
+ ## Rules
28
+
29
+ - Be objective. A score of 100 means perfection — rare.
30
+ - A typical good execution scores 70-85.
31
+ - Don't inflate scores. If something is missing, dock points.
32
+ - Focus on what the skill ACTUALLY produced, not what it could have done.
33
+ - Edge cases: note any unusual inputs, boundary conditions, or error scenarios that arose.
34
+
35
+ ## Output
36
+
37
+ Return ONLY valid JSON in this format:
38
+
39
+ ```json
40
+ {
41
+ "totalScore": <0-100>,
42
+ "dimensions": {
43
+ "correctness": { "score": <0-20>, "rationale": "<why>" },
44
+ "completeness": { "score": <0-20>, "rationale": "<why>" },
45
+ "edgeCases": { "score": <0-20>, "rationale": "<why>" },
46
+ "efficiency": { "score": <0-20>, "rationale": "<why>" },
47
+ "reusability": { "score": <0-20>, "rationale": "<why>" }
48
+ },
49
+ "strengths": ["<strength1>", "<strength2>"],
50
+ "weaknesses": ["<weakness1>"],
51
+ "edgeCasesEncountered": ["<edge-case-if-any>"]
52
+ }
53
+ ```
54
+
55
+ Do not include any text outside the JSON block.
@@ -0,0 +1,16 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "matcher": "startup|clear|compact",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start",
10
+ "async": false
11
+ }
12
+ ]
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,5 @@
1
+ : ; # Polyglot script: runs as bash on Unix, cmd on Windows
2
+ : ; SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ; exec bash "${SCRIPT_DIR}/$1" ; exit $?
3
+ @echo off
4
+ set "SCRIPT_DIR=%~dp0"
5
+ bash "%SCRIPT_DIR%\%1"
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env bash
2
+ # SessionStart hook for singularity-claude plugin
3
+ # Injects using-singularity context and skill health alerts
4
+
5
+ set -euo pipefail
6
+
7
+ # Determine plugin root directory
8
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
9
+ PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
10
+
11
+ # Data directory
12
+ SINGULARITY_DATA="${HOME}/.claude/singularity"
13
+
14
+ # Ensure data directories exist
15
+ mkdir -p "${SINGULARITY_DATA}/scores"
16
+ mkdir -p "${SINGULARITY_DATA}/telemetry"
17
+
18
+ # Initialize registry if it doesn't exist
19
+ if [ ! -f "${SINGULARITY_DATA}/registry.json" ]; then
20
+ cat > "${SINGULARITY_DATA}/registry.json" << 'REGISTRY'
21
+ {
22
+ "$schema": "singularity-registry-v1",
23
+ "skills": {}
24
+ }
25
+ REGISTRY
26
+ fi
27
+
28
+ # Initialize config if it doesn't exist
29
+ if [ ! -f "${SINGULARITY_DATA}/config.json" ]; then
30
+ cat > "${SINGULARITY_DATA}/config.json" << 'CONFIG'
31
+ {
32
+ "autoRepairThreshold": 50,
33
+ "crystallizationThreshold": 90,
34
+ "crystallizationMinExecutions": 5,
35
+ "hardeningMinExecutions": 3,
36
+ "telemetryEnabled": true,
37
+ "scoringMode": "auto",
38
+ "skillOutputDir": "~/.claude/skills",
39
+ "gitTagPrefix": "singularity/"
40
+ }
41
+ CONFIG
42
+ fi
43
+
44
+ # Read using-singularity content
45
+ using_singularity_content=$(cat "${PLUGIN_ROOT}/skills/using-singularity/SKILL.md" 2>&1 || echo "Error reading using-singularity skill")
46
+
47
+ # Build alerts from registry
48
+ alerts=""
49
+ if command -v jq &>/dev/null && [ -f "${SINGULARITY_DATA}/registry.json" ]; then
50
+ # Find skills needing repair (avg < 50 with 2+ executions)
51
+ repair_needed=$(jq -r '
52
+ .skills | to_entries[]
53
+ | select(.value.averageScore < 50 and .value.executionCount >= 2)
54
+ | " - ⚠ \(.key): avg score \(.value.averageScore)/100 (\(.value.executionCount) runs) — needs repair"
55
+ ' "${SINGULARITY_DATA}/registry.json" 2>/dev/null || true)
56
+
57
+ # Find skills ready for crystallization (avg >= 90 with 5+ executions)
58
+ crystal_ready=$(jq -r '
59
+ .skills | to_entries[]
60
+ | select(.value.averageScore >= 90 and .value.executionCount >= 5 and .value.maturity != "crystallized")
61
+ | " - ✦ \(.key): avg score \(.value.averageScore)/100 (\(.value.executionCount) runs) — ready to crystallize"
62
+ ' "${SINGULARITY_DATA}/registry.json" 2>/dev/null || true)
63
+
64
+ if [ -n "$repair_needed" ] || [ -n "$crystal_ready" ]; then
65
+ alerts="\n\n**Skill Alerts:**\n"
66
+ [ -n "$repair_needed" ] && alerts="${alerts}${repair_needed}\n"
67
+ [ -n "$crystal_ready" ] && alerts="${alerts}${crystal_ready}\n"
68
+ fi
69
+ fi
70
+
71
+ # Escape string for JSON embedding
72
+ escape_for_json() {
73
+ local s="$1"
74
+ s="${s//\\/\\\\}"
75
+ s="${s//\"/\\\"}"
76
+ s="${s//$'\n'/\\n}"
77
+ s="${s//$'\r'/\\r}"
78
+ s="${s//$'\t'/\\t}"
79
+ printf '%s' "$s"
80
+ }
81
+
82
+ using_singularity_escaped=$(escape_for_json "$using_singularity_content")
83
+ alerts_escaped=$(escape_for_json "$alerts")
84
+ session_context="<SINGULARITY_ENGINE>\nYou have singularity-claude — a self-evolving skill engine.\n\n${using_singularity_escaped}\n${alerts_escaped}\n</SINGULARITY_ENGINE>"
85
+
86
+ # Output context injection as JSON
87
+ # Cursor hooks expect additional_context
88
+ # Claude Code hooks expect hookSpecificOutput.additionalContext
89
+ if [ -n "${CURSOR_PLUGIN_ROOT:-}" ]; then
90
+ printf '{\n "additional_context": "%s"\n}\n' "$session_context"
91
+ elif [ -n "${CLAUDE_PLUGIN_ROOT:-}" ]; then
92
+ printf '{\n "hookSpecificOutput": {\n "hookEventName": "SessionStart",\n "additionalContext": "%s"\n }\n}\n' "$session_context"
93
+ else
94
+ printf '{\n "additional_context": "%s"\n}\n' "$session_context"
95
+ fi
96
+
97
+ exit 0
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "singularity-claude",
3
+ "version": "0.1.0",
4
+ "description": "Self-evolving skill engine for Claude Code. Creates, scores, repairs, and hardens skills autonomously.",
5
+ "author": "Haroun El Alami",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/shmayro/singularity-claude"
10
+ },
11
+ "homepage": "https://github.com/shmayro/singularity-claude#readme",
12
+ "keywords": [
13
+ "claude-code",
14
+ "skills",
15
+ "evolution",
16
+ "self-improving",
17
+ "ai-agent"
18
+ ],
19
+ "files": [
20
+ "skills/",
21
+ "agents/",
22
+ "scripts/",
23
+ "hooks/",
24
+ ".claude-plugin/",
25
+ "README.md",
26
+ "LICENSE",
27
+ "CHANGELOG.md"
28
+ ]
29
+ }