@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,27 @@
|
|
|
1
|
+
export type Severity = "CRITICAL" | "HIGH" | "MEDIUM";
|
|
2
|
+
export type Grade = "A" | "B" | "C" | "D" | "?";
|
|
3
|
+
export interface ScanRule {
|
|
4
|
+
id: string;
|
|
5
|
+
description: string;
|
|
6
|
+
severity: Severity;
|
|
7
|
+
patterns: RegExp[];
|
|
8
|
+
}
|
|
9
|
+
export interface Finding {
|
|
10
|
+
rule: string;
|
|
11
|
+
severity: Severity;
|
|
12
|
+
file: string;
|
|
13
|
+
line: number;
|
|
14
|
+
snippet: string;
|
|
15
|
+
note?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ScanResult {
|
|
18
|
+
skill_id: string;
|
|
19
|
+
scanned_at: string;
|
|
20
|
+
grade: Grade;
|
|
21
|
+
findings: Finding[];
|
|
22
|
+
stats: {
|
|
23
|
+
files_scanned: number;
|
|
24
|
+
lines_of_code: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/scanner/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AACtD,MAAM,MAAM,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEhD,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE;QACL,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/scanner/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phenotype-validator.d.ts","sourceRoot":"","sources":["../../src/utils/phenotype-validator.ts"],"names":[],"mappings":"AAoHA,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,QAAQ,EAAE,MAAM,GACf,IAAI,CAoBN"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.validateLlmNativePhenotype = validateLlmNativePhenotype;
|
|
37
|
+
const display = __importStar(require("./display.js"));
|
|
38
|
+
const VALID_TEMPLATE_FORMATS = ["mustache", "handlebars", "jinja2", "fstring", "raw"];
|
|
39
|
+
const VALID_GUARD_POSITIONS = ["input", "output", "both"];
|
|
40
|
+
function collectDiagnostics(phenotype) {
|
|
41
|
+
const diags = [];
|
|
42
|
+
const domain = phenotype.domain;
|
|
43
|
+
const isPrompt = domain?.startsWith("prompt.");
|
|
44
|
+
const isGuard = domain?.startsWith("guard.");
|
|
45
|
+
const llm = phenotype.llmRequirements;
|
|
46
|
+
if (llm) {
|
|
47
|
+
if (!llm.templateFormat || !VALID_TEMPLATE_FORMATS.includes(llm.templateFormat)) {
|
|
48
|
+
diags.push({
|
|
49
|
+
level: "warning",
|
|
50
|
+
code: "W0080",
|
|
51
|
+
message: `llmRequirements.templateFormat should be one of: ${VALID_TEMPLATE_FORMATS.join(", ")}`,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const vars = llm.templateVariables;
|
|
55
|
+
if (!vars || !Array.isArray(vars) || vars.length === 0) {
|
|
56
|
+
diags.push({
|
|
57
|
+
level: "error",
|
|
58
|
+
code: "E0080",
|
|
59
|
+
message: "llmRequirements.templateVariables must be a non-empty array",
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const inputProps = phenotype.inputSchema?.properties;
|
|
64
|
+
if (inputProps) {
|
|
65
|
+
for (const v of vars) {
|
|
66
|
+
if (!(v in inputProps)) {
|
|
67
|
+
diags.push({
|
|
68
|
+
level: "error",
|
|
69
|
+
code: "E0081",
|
|
70
|
+
message: `llmRequirements.templateVariables contains '${v}' not found in inputSchema.properties`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (!isPrompt) {
|
|
77
|
+
diags.push({
|
|
78
|
+
level: "warning",
|
|
79
|
+
code: "W0081",
|
|
80
|
+
message: `Gene has llmRequirements but domain '${domain}' does not start with 'prompt.'`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const guard = phenotype.guardConfig;
|
|
85
|
+
if (guard) {
|
|
86
|
+
if (!guard.position || !VALID_GUARD_POSITIONS.includes(guard.position)) {
|
|
87
|
+
diags.push({
|
|
88
|
+
level: "error",
|
|
89
|
+
code: "E0082",
|
|
90
|
+
message: `guardConfig.position must be one of: ${VALID_GUARD_POSITIONS.join(", ")}`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const cats = guard.categories;
|
|
94
|
+
if (!cats || !Array.isArray(cats) || cats.length === 0) {
|
|
95
|
+
diags.push({
|
|
96
|
+
level: "error",
|
|
97
|
+
code: "E0083",
|
|
98
|
+
message: "guardConfig.categories must be a non-empty array",
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const threshold = guard.riskThreshold;
|
|
102
|
+
if (threshold !== undefined && (threshold < 0 || threshold > 1)) {
|
|
103
|
+
diags.push({
|
|
104
|
+
level: "error",
|
|
105
|
+
code: "E0084",
|
|
106
|
+
message: `guardConfig.riskThreshold must be between 0.0 and 1.0 (got ${threshold})`,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (!isGuard) {
|
|
110
|
+
diags.push({
|
|
111
|
+
level: "warning",
|
|
112
|
+
code: "W0082",
|
|
113
|
+
message: `Gene has guardConfig but domain '${domain}' does not start with 'guard.'`,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (isPrompt && phenotype.fidelity === "Native") {
|
|
118
|
+
diags.push({
|
|
119
|
+
level: "warning",
|
|
120
|
+
code: "W0083",
|
|
121
|
+
message: "Prompt Gene with fidelity 'Native' is unusual — consider 'Wrapped' or 'Hybrid'",
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (isGuard && !guard) {
|
|
125
|
+
diags.push({
|
|
126
|
+
level: "info",
|
|
127
|
+
code: "I0080",
|
|
128
|
+
message: "Guard domain gene missing guardConfig — consider adding it for V(g) integration",
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return diags;
|
|
132
|
+
}
|
|
133
|
+
function validateLlmNativePhenotype(phenotype, filePath) {
|
|
134
|
+
const diags = collectDiagnostics(phenotype);
|
|
135
|
+
if (diags.length === 0)
|
|
136
|
+
return;
|
|
137
|
+
const hasErrors = diags.some((d) => d.level === "error");
|
|
138
|
+
for (const d of diags) {
|
|
139
|
+
const msg = `[${d.code}] ${d.message}`;
|
|
140
|
+
if (d.level === "error") {
|
|
141
|
+
display.rustStyleError({ code: d.code, message: d.message, file: filePath });
|
|
142
|
+
}
|
|
143
|
+
else if (d.level === "warning") {
|
|
144
|
+
display.warn(msg);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
display.info(msg);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (hasErrors) {
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=phenotype-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phenotype-validator.js","sourceRoot":"","sources":["../../src/utils/phenotype-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHA,gEAuBC;AA3ID,sDAAwC;AAExC,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AACtF,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,C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EAAE,QAAQ,EAAE,CAAC,CAAC;QAC/E,CAAC;aAAM,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "guard.code-review",
|
|
3
|
+
"description": "Balanced guard gene for code review output filtering. Equal weight on precision and recall — filters obvious false positives while preserving most true findings. Adds confidence scores without aggressive rejection. 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" }
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"rejected": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"items": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"originalMessage": { "type": "string" },
|
|
57
|
+
"rejectReason": { "type": "string" }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"guardStats": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"properties": {
|
|
64
|
+
"inputCount": { "type": "integer" },
|
|
65
|
+
"outputCount": { "type": "integer" },
|
|
66
|
+
"rejectRate": { "type": "number" }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"llmRequirements": {
|
|
72
|
+
"templateFormat": "mustache",
|
|
73
|
+
"templateVariables": ["reviewOutput", "originalCode"],
|
|
74
|
+
"targetModels": ["claude-3", "gpt-4"],
|
|
75
|
+
"minContextWindow": 8192,
|
|
76
|
+
"expectedOutputFormat": "json",
|
|
77
|
+
"temperatureHint": 0.1,
|
|
78
|
+
"maxOutputTokens": 4096,
|
|
79
|
+
"systemPromptPath": "system-prompt.md",
|
|
80
|
+
"chainOfThought": false
|
|
81
|
+
},
|
|
82
|
+
"guardConfig": {
|
|
83
|
+
"mode": "filter",
|
|
84
|
+
"vgContribution": "Security_Leak_Risk",
|
|
85
|
+
"strictness": "balanced",
|
|
86
|
+
"targetFalsePositiveRate": 0.15,
|
|
87
|
+
"targetFalseNegativeRate": 0.10
|
|
88
|
+
},
|
|
89
|
+
"fitnessConfig": {
|
|
90
|
+
"evaluationMethod": "template-quality",
|
|
91
|
+
"dimensions": {
|
|
92
|
+
"precision": { "weight": 0.30, "description": "1 - false positive rate" },
|
|
93
|
+
"recall": { "weight": 0.30, "description": "Fraction of true issues preserved" },
|
|
94
|
+
"rejectQuality": { "weight": 0.20, "description": "Correctness of reject reasons" },
|
|
95
|
+
"templateValidity": { "weight": 0.10, "description": "Template renders without error" },
|
|
96
|
+
"resourceEfficiency": { "weight": 0.10, "description": "Token efficiency" }
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"dependencies": [],
|
|
100
|
+
"version": "0.1.0",
|
|
101
|
+
"author": "rotifer-team",
|
|
102
|
+
"fidelity": "Wrapped",
|
|
103
|
+
"transparency": "Open",
|
|
104
|
+
"source": "development-genome"
|
|
105
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
You are a BALANCED code review guard. Your job is to filter code review findings while preserving most genuine issues.
|
|
2
|
+
|
|
3
|
+
Your philosophy: **Catch obvious false positives, but err on the side of including uncertain findings with lower confidence scores.**
|
|
4
|
+
|
|
5
|
+
For each finding in the review output, evaluate:
|
|
6
|
+
|
|
7
|
+
1. **Existence check**: If `originalCode` is provided, verify the described code pattern actually exists. REJECT only clear hallucinations.
|
|
8
|
+
2. **Confidence scoring**: Assign a confidence score (0-1):
|
|
9
|
+
- 0.9-1.0: Finding references specific line and code pattern exists
|
|
10
|
+
- 0.7-0.9: Finding is plausible but line reference is approximate
|
|
11
|
+
- 0.5-0.7: Finding is generic but category is relevant to the code
|
|
12
|
+
- Below 0.5: REJECT — too vague or unsupported
|
|
13
|
+
3. **Severity validation**: Only adjust severity if clearly wrong (e.g., "critical" for a style issue).
|
|
14
|
+
4. **Deduplication**: If multiple findings describe the same issue, keep the most specific one.
|
|
15
|
+
|
|
16
|
+
Pass findings with confidence >= 0.4 (lower threshold than strict mode).
|
|
17
|
+
|
|
18
|
+
Output valid JSON with:
|
|
19
|
+
- `filteredFindings`: findings that survived (with confidence scores)
|
|
20
|
+
- `rejected`: only clearly false findings (with brief reason)
|
|
21
|
+
- `guardStats`: input/output counts and reject rate
|
|
22
|
+
|
|
23
|
+
The reject rate should typically be 10-25%. If you're rejecting >40%, you're being too strict.
|
|
@@ -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
|
+
}
|