@rotifer/playground 0.7.9 → 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 +34 -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.map +1 -1
- package/dist/commands/vg.js +65 -17
- package/dist/commands/vg.js.map +1 -1
- 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,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "guard.code-review",
|
|
3
|
+
"description": "Strict guard gene for code review output filtering. High precision, low recall — blocks false positives aggressively. Prefers missing a real issue over flagging a non-issue. Part of the Code Review Assistant 3×2 arena competition.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"reviewOutput": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"description": "Raw output from a Prompt Gene (code review findings)",
|
|
10
|
+
"properties": {
|
|
11
|
+
"findings": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"severity": { "type": "string" },
|
|
17
|
+
"category": { "type": "string" },
|
|
18
|
+
"message": { "type": "string" },
|
|
19
|
+
"line": { "type": "integer" },
|
|
20
|
+
"fix": { "type": "string" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"summary": { "type": "string" }
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"originalCode": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "The original code being reviewed (for cross-checking)"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": ["reviewOutput"]
|
|
33
|
+
},
|
|
34
|
+
"outputSchema": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {
|
|
37
|
+
"filteredFindings": {
|
|
38
|
+
"type": "array",
|
|
39
|
+
"items": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"properties": {
|
|
42
|
+
"severity": { "type": "string" },
|
|
43
|
+
"category": { "type": "string" },
|
|
44
|
+
"message": { "type": "string" },
|
|
45
|
+
"line": { "type": "integer" },
|
|
46
|
+
"fix": { "type": "string" },
|
|
47
|
+
"confidence": { "type": "number", "description": "0-1 confidence that this is a real issue" }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"description": "Only findings that pass strict validation"
|
|
51
|
+
},
|
|
52
|
+
"rejected": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"originalMessage": { "type": "string" },
|
|
58
|
+
"rejectReason": { "type": "string" }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"description": "Findings rejected with reason"
|
|
62
|
+
},
|
|
63
|
+
"guardStats": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"properties": {
|
|
66
|
+
"inputCount": { "type": "integer" },
|
|
67
|
+
"outputCount": { "type": "integer" },
|
|
68
|
+
"rejectRate": { "type": "number" }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"llmRequirements": {
|
|
74
|
+
"templateFormat": "mustache",
|
|
75
|
+
"templateVariables": ["reviewOutput", "originalCode"],
|
|
76
|
+
"targetModels": ["claude-3", "gpt-4"],
|
|
77
|
+
"minContextWindow": 8192,
|
|
78
|
+
"expectedOutputFormat": "json",
|
|
79
|
+
"temperatureHint": 0.0,
|
|
80
|
+
"maxOutputTokens": 4096,
|
|
81
|
+
"systemPromptPath": "system-prompt.md",
|
|
82
|
+
"chainOfThought": true
|
|
83
|
+
},
|
|
84
|
+
"guardConfig": {
|
|
85
|
+
"mode": "filter",
|
|
86
|
+
"vgContribution": "Security_Leak_Risk",
|
|
87
|
+
"strictness": "high",
|
|
88
|
+
"targetFalsePositiveRate": 0.05,
|
|
89
|
+
"targetFalseNegativeRate": 0.30
|
|
90
|
+
},
|
|
91
|
+
"fitnessConfig": {
|
|
92
|
+
"evaluationMethod": "template-quality",
|
|
93
|
+
"dimensions": {
|
|
94
|
+
"precision": { "weight": 0.40, "description": "1 - false positive rate" },
|
|
95
|
+
"recall": { "weight": 0.20, "description": "Fraction of true issues preserved" },
|
|
96
|
+
"rejectQuality": { "weight": 0.20, "description": "Correctness of reject reasons" },
|
|
97
|
+
"templateValidity": { "weight": 0.10, "description": "Template renders without error" },
|
|
98
|
+
"resourceEfficiency": { "weight": 0.10, "description": "Token efficiency" }
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"dependencies": [],
|
|
102
|
+
"version": "0.1.0",
|
|
103
|
+
"author": "rotifer-team",
|
|
104
|
+
"fidelity": "Wrapped",
|
|
105
|
+
"transparency": "Open",
|
|
106
|
+
"source": "development-genome"
|
|
107
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
You are a STRICT code review guard. Your job is to filter code review findings, removing likely false positives.
|
|
2
|
+
|
|
3
|
+
Your philosophy: **Better to miss a real issue than to waste developer time on a false alarm.**
|
|
4
|
+
|
|
5
|
+
For each finding in the review output, evaluate:
|
|
6
|
+
|
|
7
|
+
1. **Line reference check**: Does the finding reference a specific line? If the line number doesn't correspond to relevant code, REJECT.
|
|
8
|
+
2. **Category validity**: Is the category (e.g., "injection", "memory-leak") supported by the actual code pattern? Reject vague or generic warnings.
|
|
9
|
+
3. **Fix actionability**: Does the fix suggestion contain concrete code? Reject findings with only "consider reviewing" or "be careful" advice.
|
|
10
|
+
4. **Hallucination check**: If `originalCode` is provided, verify the finding references actual code constructs. Reject if the finding describes code that doesn't exist.
|
|
11
|
+
5. **Severity calibration**: Downgrade "critical" to "warning" if the exploit requires unlikely preconditions.
|
|
12
|
+
|
|
13
|
+
Only pass findings with confidence >= 0.7.
|
|
14
|
+
|
|
15
|
+
Output valid JSON with:
|
|
16
|
+
- `filteredFindings`: findings that survived filtering (with confidence scores)
|
|
17
|
+
- `rejected`: findings removed (with reject reasons for transparency)
|
|
18
|
+
- `guardStats`: input/output counts and reject rate
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "prompt.code-review",
|
|
3
|
+
"description": "Code review gene specialized in performance issue detection. Identifies N+1 queries, unnecessary re-renders, memory leaks, blocking operations, inefficient algorithms, and bundle size issues. 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
|
+
"impact": { "type": "string", "description": "Estimated performance impact" }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"summary": { "type": "string" },
|
|
31
|
+
"overallImpact": { "type": "string", "enum": ["high", "medium", "low", "negligible"] }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"llmRequirements": {
|
|
35
|
+
"templateFormat": "mustache",
|
|
36
|
+
"templateVariables": ["code", "language", "context"],
|
|
37
|
+
"targetModels": ["claude-3", "gpt-4"],
|
|
38
|
+
"minContextWindow": 8192,
|
|
39
|
+
"expectedOutputFormat": "json",
|
|
40
|
+
"temperatureHint": 0.2,
|
|
41
|
+
"maxOutputTokens": 4096,
|
|
42
|
+
"systemPromptPath": "system-prompt.md",
|
|
43
|
+
"chainOfThought": true
|
|
44
|
+
},
|
|
45
|
+
"fitnessConfig": {
|
|
46
|
+
"evaluationMethod": "template-quality",
|
|
47
|
+
"dimensions": {
|
|
48
|
+
"detectionRate": { "weight": 0.35, "description": "Fraction of known perf issues found" },
|
|
49
|
+
"falsePositiveRate": { "weight": 0.25, "description": "Precision of findings" },
|
|
50
|
+
"responseQuality": { "weight": 0.20, "description": "Actionability of optimization suggestions" },
|
|
51
|
+
"templateValidity": { "weight": 0.10, "description": "Template renders without error" },
|
|
52
|
+
"resourceEfficiency": { "weight": 0.10, "description": "Token efficiency" }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"dependencies": [],
|
|
56
|
+
"version": "0.1.0",
|
|
57
|
+
"author": "rotifer-team",
|
|
58
|
+
"fidelity": "Wrapped",
|
|
59
|
+
"transparency": "Open",
|
|
60
|
+
"source": "development-genome"
|
|
61
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
You are a performance-focused code reviewer. Your mission is to find performance bottlenecks and optimization opportunities.
|
|
2
|
+
|
|
3
|
+
Focus areas (in priority order):
|
|
4
|
+
1. **Database queries**: N+1 queries, missing indexes, unbounded SELECTs, unnecessary JOINs
|
|
5
|
+
2. **Memory**: leaks, unbounded caches, large object retention, missing cleanup
|
|
6
|
+
3. **Async/blocking**: synchronous operations in async context, missing concurrency, sequential awaits that could be parallel
|
|
7
|
+
4. **Rendering**: unnecessary re-renders (React), layout thrashing, unoptimized images
|
|
8
|
+
5. **Algorithms**: O(n²) when O(n log n) exists, redundant computation, missing memoization
|
|
9
|
+
6. **Bundle/payload**: unused imports, large dependencies for small tasks, missing tree-shaking
|
|
10
|
+
7. **Network**: missing caching headers, redundant API calls, large payloads
|
|
11
|
+
|
|
12
|
+
For each finding, provide:
|
|
13
|
+
- `severity`: "critical" (measurable impact >100ms), "warning" (noticeable), "info" (micro-optimization)
|
|
14
|
+
- `category`: short tag (e.g., "n-plus-1", "memory-leak", "blocking-io")
|
|
15
|
+
- `message`: clear description of the issue
|
|
16
|
+
- `line`: approximate line number
|
|
17
|
+
- `fix`: concrete optimization with expected improvement
|
|
18
|
+
- `impact`: estimated performance impact (e.g., "~200ms savings per request")
|
|
19
|
+
|
|
20
|
+
Focus on findings with measurable impact. Avoid premature optimization suggestions.
|
|
21
|
+
|
|
22
|
+
Output valid JSON matching the output schema.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "prompt.code-review",
|
|
3
|
+
"description": "Code review gene specialized in readability and maintainability. Identifies unclear naming, missing documentation, excessive complexity, inconsistent patterns, and code smell. 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
|
+
"readabilityScore": { "type": "number", "description": "0-10 readability score" }
|
|
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.3,
|
|
40
|
+
"maxOutputTokens": 4096,
|
|
41
|
+
"systemPromptPath": "system-prompt.md",
|
|
42
|
+
"chainOfThought": false
|
|
43
|
+
},
|
|
44
|
+
"fitnessConfig": {
|
|
45
|
+
"evaluationMethod": "template-quality",
|
|
46
|
+
"dimensions": {
|
|
47
|
+
"detectionRate": { "weight": 0.30, "description": "Coverage of known readability issues" },
|
|
48
|
+
"falsePositiveRate": { "weight": 0.25, "description": "Precision — avoid pedantic nitpicks" },
|
|
49
|
+
"responseQuality": { "weight": 0.25, "description": "Quality of rewrite suggestions" },
|
|
50
|
+
"templateValidity": { "weight": 0.10, "description": "Template renders without error" },
|
|
51
|
+
"resourceEfficiency": { "weight": 0.10, "description": "Token efficiency" }
|
|
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 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)
|