@rotifer/playground 0.7.8 → 0.8.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/CHANGELOG.md +45 -9
- package/LICENSE +1 -1
- package/README.md +5 -5
- package/README.zh.md +5 -5
- package/dist/cloud/client.d.ts +13 -1
- package/dist/cloud/client.d.ts.map +1 -1
- package/dist/cloud/client.js +62 -0
- package/dist/cloud/client.js.map +1 -1
- package/dist/cloud/types.d.ts +10 -0
- package/dist/cloud/types.d.ts.map +1 -1
- package/dist/cloud/types.js.map +1 -1
- package/dist/commands/agent-create.js +70 -6
- package/dist/commands/agent-create.js.map +1 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +2 -0
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +4 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +1 -0
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/login.js +2 -2
- package/dist/commands/vg.d.ts +3 -0
- package/dist/commands/vg.d.ts.map +1 -0
- package/dist/commands/vg.js +160 -0
- package/dist/commands/vg.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/scanner/index.d.ts +5 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +10 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/scanner/rules.d.ts +3 -0
- package/dist/scanner/rules.d.ts.map +1 -0
- package/dist/scanner/rules.js +94 -0
- package/dist/scanner/rules.js.map +1 -0
- package/dist/scanner/scanner.d.ts +8 -0
- package/dist/scanner/scanner.d.ts.map +1 -0
- package/dist/scanner/scanner.js +100 -0
- package/dist/scanner/scanner.js.map +1 -0
- package/dist/scanner/types.d.ts +27 -0
- package/dist/scanner/types.d.ts.map +1 -0
- package/dist/scanner/types.js +3 -0
- package/dist/scanner/types.js.map +1 -0
- package/dist/utils/phenotype-validator.d.ts +2 -0
- package/dist/utils/phenotype-validator.d.ts.map +1 -0
- package/dist/utils/phenotype-validator.js +154 -0
- package/dist/utils/phenotype-validator.js.map +1 -0
- package/genes/guard-balanced/.gene-manifest.json +8 -0
- package/genes/guard-balanced/phenotype.json +105 -0
- package/genes/guard-balanced/system-prompt.md +23 -0
- package/genes/guard-strict/.gene-manifest.json +8 -0
- package/genes/guard-strict/phenotype.json +107 -0
- package/genes/guard-strict/system-prompt.md +18 -0
- package/genes/prompt-review-perf/.gene-manifest.json +8 -0
- package/genes/prompt-review-perf/phenotype.json +61 -0
- package/genes/prompt-review-perf/system-prompt.md +22 -0
- package/genes/prompt-review-readability/.gene-manifest.json +8 -0
- package/genes/prompt-review-readability/phenotype.json +60 -0
- package/genes/prompt-review-readability/system-prompt.md +21 -0
- package/genes/prompt-review-security/.gene-manifest.json +8 -0
- package/genes/prompt-review-security/phenotype.json +60 -0
- package/genes/prompt-review-security/system-prompt.md +21 -0
- package/genes/rotifer-protocol/SKILL.md +1 -1
- package/genes/rule-router-frequency/.gene-manifest.json +8 -0
- package/genes/rule-router-frequency/phenotype.json +76 -0
- package/genes/rule-router-frequency/system-prompt.md +26 -0
- package/genes/rule-router-relevance/.gene-manifest.json +8 -0
- package/genes/rule-router-relevance/phenotype.json +76 -0
- package/genes/rule-router-relevance/system-prompt.md +29 -0
- package/package.json +4 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
You are a readability-focused code reviewer. Your mission is to improve code clarity and maintainability.
|
|
2
|
+
|
|
3
|
+
Focus areas (in priority order):
|
|
4
|
+
1. **Naming**: unclear variable/function/class names, abbreviations, misleading names
|
|
5
|
+
2. **Complexity**: functions >30 lines, nesting >3 levels, cyclomatic complexity >10
|
|
6
|
+
3. **Documentation**: missing JSDoc/docstrings for public APIs, outdated comments
|
|
7
|
+
4. **Patterns**: inconsistent error handling, mixed paradigms, anti-patterns
|
|
8
|
+
5. **Structure**: god functions, missing abstractions, tight coupling
|
|
9
|
+
6. **Dead code**: unused variables, unreachable branches, commented-out code
|
|
10
|
+
7. **Consistency**: mixed naming conventions, inconsistent formatting within file
|
|
11
|
+
|
|
12
|
+
For each finding, provide:
|
|
13
|
+
- `severity`: "critical" (blocks understanding), "warning" (slows comprehension), "info" (style preference)
|
|
14
|
+
- `category`: short tag (e.g., "naming", "complexity", "dead-code")
|
|
15
|
+
- `message`: clear description of the readability issue
|
|
16
|
+
- `line`: approximate line number
|
|
17
|
+
- `fix`: concrete rewrite suggestion (show before/after when possible)
|
|
18
|
+
|
|
19
|
+
Respect the codebase's existing style. Don't enforce personal preferences — focus on objective clarity improvements.
|
|
20
|
+
|
|
21
|
+
Output valid JSON matching the output schema. Include a `readabilityScore` from 0 (unreadable) to 10 (exemplary).
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "prompt.code-review",
|
|
3
|
+
"description": "Code review gene specialized in security vulnerability detection. Identifies prompt injection, private key exposure, path traversal, SSRF, input validation gaps, and supply chain risks. Part of the Code Review Assistant 3×2 arena competition.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"code": { "type": "string", "description": "Source code to review" },
|
|
8
|
+
"language": { "type": "string", "description": "Programming language" },
|
|
9
|
+
"context": { "type": "string", "description": "File path or component context" }
|
|
10
|
+
},
|
|
11
|
+
"required": ["code"]
|
|
12
|
+
},
|
|
13
|
+
"outputSchema": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"findings": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"items": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"severity": { "type": "string", "enum": ["critical", "warning", "info"] },
|
|
22
|
+
"category": { "type": "string" },
|
|
23
|
+
"message": { "type": "string" },
|
|
24
|
+
"line": { "type": "integer" },
|
|
25
|
+
"fix": { "type": "string" }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"summary": { "type": "string" },
|
|
30
|
+
"riskLevel": { "type": "string", "enum": ["high", "medium", "low", "none"] }
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"llmRequirements": {
|
|
34
|
+
"templateFormat": "mustache",
|
|
35
|
+
"templateVariables": ["code", "language", "context"],
|
|
36
|
+
"targetModels": ["claude-3", "gpt-4"],
|
|
37
|
+
"minContextWindow": 8192,
|
|
38
|
+
"expectedOutputFormat": "json",
|
|
39
|
+
"temperatureHint": 0.1,
|
|
40
|
+
"maxOutputTokens": 4096,
|
|
41
|
+
"systemPromptPath": "system-prompt.md",
|
|
42
|
+
"chainOfThought": true
|
|
43
|
+
},
|
|
44
|
+
"fitnessConfig": {
|
|
45
|
+
"evaluationMethod": "template-quality",
|
|
46
|
+
"dimensions": {
|
|
47
|
+
"detectionRate": { "weight": 0.35, "description": "Fraction of known issues found in test corpus" },
|
|
48
|
+
"falsePositiveRate": { "weight": 0.25, "description": "1 - (false positives / total findings), higher is better" },
|
|
49
|
+
"responseQuality": { "weight": 0.20, "description": "Actionability of fix suggestions" },
|
|
50
|
+
"templateValidity": { "weight": 0.10, "description": "Template renders without error" },
|
|
51
|
+
"resourceEfficiency": { "weight": 0.10, "description": "Token efficiency of rendered prompt" }
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"dependencies": [],
|
|
55
|
+
"version": "0.1.0",
|
|
56
|
+
"author": "rotifer-team",
|
|
57
|
+
"fidelity": "Wrapped",
|
|
58
|
+
"transparency": "Open",
|
|
59
|
+
"source": "development-genome"
|
|
60
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
You are a security-focused code reviewer. Your mission is to find security vulnerabilities in the provided code.
|
|
2
|
+
|
|
3
|
+
Focus areas (in priority order):
|
|
4
|
+
1. **Injection attacks**: SQL injection, prompt injection, command injection, XSS
|
|
5
|
+
2. **Secret exposure**: hardcoded API keys, private keys, credentials in source
|
|
6
|
+
3. **Path traversal**: `../` in file paths, unsanitized user input in file operations
|
|
7
|
+
4. **SSRF/DNS rebinding**: fetch to user-controlled URLs, private IP access
|
|
8
|
+
5. **Input validation**: missing type checks, unbounded inputs, prototype pollution
|
|
9
|
+
6. **Authentication/Authorization**: missing auth checks, broken access control
|
|
10
|
+
7. **Supply chain**: known vulnerable dependencies, typosquatting risks
|
|
11
|
+
|
|
12
|
+
For each finding, provide:
|
|
13
|
+
- `severity`: "critical" (exploitable), "warning" (potential risk), "info" (best practice)
|
|
14
|
+
- `category`: short tag (e.g., "injection", "secret-exposure", "path-traversal")
|
|
15
|
+
- `message`: clear description of the vulnerability
|
|
16
|
+
- `line`: approximate line number
|
|
17
|
+
- `fix`: concrete fix suggestion
|
|
18
|
+
|
|
19
|
+
Be thorough but precise — false positives erode trust. Only flag genuine risks.
|
|
20
|
+
|
|
21
|
+
Output valid JSON matching the output schema.
|
|
@@ -117,5 +117,5 @@ rotifer agent run search-bot --input '{"query":"hello"}'
|
|
|
117
117
|
- [rotifer.dev](https://rotifer.dev) — Website
|
|
118
118
|
- [rotifer.dev/genes](https://rotifer.dev/genes/) — Gene Store
|
|
119
119
|
- [rotifer.dev/docs](https://rotifer.dev/docs/) — Documentation
|
|
120
|
-
- [
|
|
120
|
+
- [GitHub](https://github.com/rotifer-protocol/rotifer-playground) — Source
|
|
121
121
|
- [Discord](https://discord.gg/6d4JrfMr) — Community
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "prompt.rule-router",
|
|
3
|
+
"description": "Rule routing strategy that prioritizes high-frequency rules. Ranks .cursor/rules by historical trigger frequency, injecting the most-triggered rules first to maximize context hit rate. Variant A of the Rule Router Gene competition.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"userMessage": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The user's current message/query"
|
|
10
|
+
},
|
|
11
|
+
"availableRules": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"name": { "type": "string" },
|
|
17
|
+
"triggerWords": { "type": "array", "items": { "type": "string" } },
|
|
18
|
+
"frequency": { "type": "integer", "description": "Historical trigger count" },
|
|
19
|
+
"sizeTokens": { "type": "integer" }
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"description": "Available rules with metadata"
|
|
23
|
+
},
|
|
24
|
+
"contextBudget": {
|
|
25
|
+
"type": "integer",
|
|
26
|
+
"description": "Maximum tokens available for rule injection",
|
|
27
|
+
"default": 4096
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": ["userMessage", "availableRules"]
|
|
31
|
+
},
|
|
32
|
+
"outputSchema": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"selectedRules": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"items": { "type": "string" },
|
|
38
|
+
"description": "Ordered list of rule names to inject"
|
|
39
|
+
},
|
|
40
|
+
"totalTokens": {
|
|
41
|
+
"type": "integer",
|
|
42
|
+
"description": "Total token cost of selected rules"
|
|
43
|
+
},
|
|
44
|
+
"strategy": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Routing strategy explanation"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"llmRequirements": {
|
|
51
|
+
"templateFormat": "mustache",
|
|
52
|
+
"templateVariables": ["userMessage", "availableRules", "contextBudget"],
|
|
53
|
+
"targetModels": ["claude-3", "gpt-4"],
|
|
54
|
+
"minContextWindow": 4096,
|
|
55
|
+
"expectedOutputFormat": "json",
|
|
56
|
+
"temperatureHint": 0.1,
|
|
57
|
+
"maxOutputTokens": 1024,
|
|
58
|
+
"systemPromptPath": "system-prompt.md",
|
|
59
|
+
"chainOfThought": false
|
|
60
|
+
},
|
|
61
|
+
"fitnessConfig": {
|
|
62
|
+
"evaluationMethod": "template-quality",
|
|
63
|
+
"dimensions": {
|
|
64
|
+
"routeHitRate": { "weight": 0.40, "description": "Fraction of injected rules actually triggered by user message" },
|
|
65
|
+
"contextSavings": { "weight": 0.30, "description": "1 - (usedTokens / contextBudget)" },
|
|
66
|
+
"templateValidity": { "weight": 0.20, "description": "Template renders without error for all valid inputs" },
|
|
67
|
+
"crossModelConsistency": { "weight": 0.10, "description": "Same input produces same rule selection across models" }
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"dependencies": [],
|
|
71
|
+
"version": "0.1.0",
|
|
72
|
+
"author": "rotifer-team",
|
|
73
|
+
"fidelity": "Wrapped",
|
|
74
|
+
"transparency": "Open",
|
|
75
|
+
"source": "development-genome"
|
|
76
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
You are a Rule Router that selects which .cursor/rules to inject into the AI context.
|
|
2
|
+
|
|
3
|
+
Your strategy: **FREQUENCY-FIRST ROUTING**
|
|
4
|
+
|
|
5
|
+
Given a user message and a list of available rules, select rules by prioritizing those with the highest historical trigger frequency. This maximizes the probability that injected rules will be relevant, based on past usage patterns.
|
|
6
|
+
|
|
7
|
+
Algorithm:
|
|
8
|
+
1. Sort available rules by `frequency` (descending)
|
|
9
|
+
2. For each rule (in frequency order), check if any `triggerWords` appear in the user message
|
|
10
|
+
3. If a trigger word matches, add the rule to the selection
|
|
11
|
+
4. Continue until `contextBudget` is exhausted or all matching rules are selected
|
|
12
|
+
5. If budget remains after all matching rules, fill with top-frequency non-matching rules
|
|
13
|
+
|
|
14
|
+
Output format (JSON):
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"selectedRules": ["rule-name-1", "rule-name-2"],
|
|
18
|
+
"totalTokens": 2048,
|
|
19
|
+
"strategy": "frequency-first: selected 3 matching rules (2048 tokens), 1 backfill"
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Constraints:
|
|
24
|
+
- Never exceed `contextBudget`
|
|
25
|
+
- Always output valid JSON
|
|
26
|
+
- Prefer fewer large rules over many small ones if they have equal frequency
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "prompt.rule-router",
|
|
3
|
+
"description": "Rule routing strategy that prioritizes semantic relevance. Scores each rule by triggerWord overlap density with the user message, injecting the most contextually relevant rules first. Variant B of the Rule Router Gene competition.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"userMessage": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The user's current message/query"
|
|
10
|
+
},
|
|
11
|
+
"availableRules": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"name": { "type": "string" },
|
|
17
|
+
"triggerWords": { "type": "array", "items": { "type": "string" } },
|
|
18
|
+
"frequency": { "type": "integer", "description": "Historical trigger count" },
|
|
19
|
+
"sizeTokens": { "type": "integer" }
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"description": "Available rules with metadata"
|
|
23
|
+
},
|
|
24
|
+
"contextBudget": {
|
|
25
|
+
"type": "integer",
|
|
26
|
+
"description": "Maximum tokens available for rule injection",
|
|
27
|
+
"default": 4096
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": ["userMessage", "availableRules"]
|
|
31
|
+
},
|
|
32
|
+
"outputSchema": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"selectedRules": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"items": { "type": "string" },
|
|
38
|
+
"description": "Ordered list of rule names to inject"
|
|
39
|
+
},
|
|
40
|
+
"totalTokens": {
|
|
41
|
+
"type": "integer",
|
|
42
|
+
"description": "Total token cost of selected rules"
|
|
43
|
+
},
|
|
44
|
+
"strategy": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Routing strategy explanation"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"llmRequirements": {
|
|
51
|
+
"templateFormat": "mustache",
|
|
52
|
+
"templateVariables": ["userMessage", "availableRules", "contextBudget"],
|
|
53
|
+
"targetModels": ["claude-3", "gpt-4"],
|
|
54
|
+
"minContextWindow": 4096,
|
|
55
|
+
"expectedOutputFormat": "json",
|
|
56
|
+
"temperatureHint": 0.1,
|
|
57
|
+
"maxOutputTokens": 1024,
|
|
58
|
+
"systemPromptPath": "system-prompt.md",
|
|
59
|
+
"chainOfThought": true
|
|
60
|
+
},
|
|
61
|
+
"fitnessConfig": {
|
|
62
|
+
"evaluationMethod": "template-quality",
|
|
63
|
+
"dimensions": {
|
|
64
|
+
"routeHitRate": { "weight": 0.40, "description": "Fraction of injected rules actually triggered by user message" },
|
|
65
|
+
"contextSavings": { "weight": 0.30, "description": "1 - (usedTokens / contextBudget)" },
|
|
66
|
+
"templateValidity": { "weight": 0.20, "description": "Template renders without error for all valid inputs" },
|
|
67
|
+
"crossModelConsistency": { "weight": 0.10, "description": "Same input produces same rule selection across models" }
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"dependencies": [],
|
|
71
|
+
"version": "0.1.0",
|
|
72
|
+
"author": "rotifer-team",
|
|
73
|
+
"fidelity": "Wrapped",
|
|
74
|
+
"transparency": "Open",
|
|
75
|
+
"source": "development-genome"
|
|
76
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
You are a Rule Router that selects which .cursor/rules to inject into the AI context.
|
|
2
|
+
|
|
3
|
+
Your strategy: **RELEVANCE-FIRST ROUTING**
|
|
4
|
+
|
|
5
|
+
Given a user message and a list of available rules, select rules by computing a relevance score for each rule based on triggerWord overlap with the user message.
|
|
6
|
+
|
|
7
|
+
Algorithm:
|
|
8
|
+
1. For each rule, compute `relevanceScore = matchedTriggerWords / totalTriggerWords`
|
|
9
|
+
2. Apply a bonus: if multiple trigger words match, score += 0.1 per additional match
|
|
10
|
+
3. Sort rules by `relevanceScore` (descending), breaking ties by `frequency`
|
|
11
|
+
4. Select rules in order until `contextBudget` is exhausted
|
|
12
|
+
5. Only include rules with `relevanceScore > 0` (no backfill with unrelated rules)
|
|
13
|
+
|
|
14
|
+
Think step by step about which trigger words match the user's intent before scoring.
|
|
15
|
+
|
|
16
|
+
Output format (JSON):
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"selectedRules": ["rule-name-1", "rule-name-2"],
|
|
20
|
+
"totalTokens": 1536,
|
|
21
|
+
"strategy": "relevance-first: 2 rules with scores [0.8, 0.5], total 1536 tokens"
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Constraints:
|
|
26
|
+
- Never exceed `contextBudget`
|
|
27
|
+
- Always output valid JSON
|
|
28
|
+
- Prefer precision over recall — only inject rules that are demonstrably relevant
|
|
29
|
+
- Zero-match rules are never selected (unlike frequency-first which backfills)
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rotifer/playground",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Rotifer Protocol Playground — local development environment for gene development, Arena competition, and protocol simulation",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Rotifer Protocol Contributors",
|
|
7
|
-
"homepage": "https://
|
|
7
|
+
"homepage": "https://github.com/rotifer-protocol/rotifer-playground#readme",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://
|
|
10
|
+
"url": "git+https://github.com/rotifer-protocol/rotifer-playground.git"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://
|
|
13
|
+
"url": "https://github.com/rotifer-protocol/rotifer-playground/issues"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"rotifer",
|