vigiles 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.json +46 -0
- package/.claude/settings.local.json +8 -0
- package/.claude-plugin/hooks/post-edit.sh +34 -0
- package/.claude-plugin/hooks/pre-edit.sh +40 -0
- package/.claude-plugin/hooks/session-start.sh +38 -0
- package/.claude-plugin/marketplace.json +14 -0
- package/.claude-plugin/plugin.json +47 -0
- package/.github/workflows/ci.yml +81 -0
- package/.prettierignore +1 -0
- package/.vigiles/generated.d.ts +205 -0
- package/CLAUDE.md +95 -0
- package/CLAUDE.md.spec.ts +142 -0
- package/CONTRIBUTING.md +121 -0
- package/LICENSE +21 -0
- package/README.md +377 -0
- package/action.yml +25 -0
- package/dist/action.d.ts +7 -0
- package/dist/action.d.ts.map +1 -0
- package/dist/action.js +180 -0
- package/dist/action.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1267 -0
- package/dist/cli.js.map +1 -0
- package/dist/cli.test.d.ts +2 -0
- package/dist/cli.test.d.ts.map +1 -0
- package/dist/cli.test.js +650 -0
- package/dist/cli.test.js.map +1 -0
- package/dist/compile.d.ts +101 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +503 -0
- package/dist/compile.js.map +1 -0
- package/dist/evolve.d.ts +132 -0
- package/dist/evolve.d.ts.map +1 -0
- package/dist/evolve.js +599 -0
- package/dist/evolve.js.map +1 -0
- package/dist/freshness.d.ts +67 -0
- package/dist/freshness.d.ts.map +1 -0
- package/dist/freshness.js +244 -0
- package/dist/freshness.js.map +1 -0
- package/dist/freshness.test.d.ts +2 -0
- package/dist/freshness.test.d.ts.map +1 -0
- package/dist/freshness.test.js +356 -0
- package/dist/freshness.test.js.map +1 -0
- package/dist/generate-types.d.ts +34 -0
- package/dist/generate-types.d.ts.map +1 -0
- package/dist/generate-types.js +381 -0
- package/dist/generate-types.js.map +1 -0
- package/dist/inline.d.ts +58 -0
- package/dist/inline.d.ts.map +1 -0
- package/dist/inline.js +142 -0
- package/dist/inline.js.map +1 -0
- package/dist/inline.test.d.ts +5 -0
- package/dist/inline.test.d.ts.map +1 -0
- package/dist/inline.test.js +152 -0
- package/dist/inline.test.js.map +1 -0
- package/dist/linters.d.ts +38 -0
- package/dist/linters.d.ts.map +1 -0
- package/dist/linters.js +588 -0
- package/dist/linters.js.map +1 -0
- package/dist/proofs.d.ts +272 -0
- package/dist/proofs.d.ts.map +1 -0
- package/dist/proofs.js +622 -0
- package/dist/proofs.js.map +1 -0
- package/dist/proofs.test.d.ts +9 -0
- package/dist/proofs.test.d.ts.map +1 -0
- package/dist/proofs.test.js +952 -0
- package/dist/proofs.test.js.map +1 -0
- package/dist/spec.d.ts +258 -0
- package/dist/spec.d.ts.map +1 -0
- package/dist/spec.js +113 -0
- package/dist/spec.js.map +1 -0
- package/dist/spec.test.d.ts +2 -0
- package/dist/spec.test.d.ts.map +1 -0
- package/dist/spec.test.js +1222 -0
- package/dist/spec.test.js.map +1 -0
- package/dist/types.d.ts +101 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.d.ts +10 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +286 -0
- package/dist/validate.js.map +1 -0
- package/dist/validate.test.d.ts +2 -0
- package/dist/validate.test.d.ts.map +1 -0
- package/dist/validate.test.js +531 -0
- package/dist/validate.test.js.map +1 -0
- package/docs/agent-setup.md +85 -0
- package/docs/agent-workflows.md +103 -0
- package/docs/comparison.md +71 -0
- package/docs/freshness.md +124 -0
- package/docs/inline-mode.md +119 -0
- package/docs/linter-support.md +166 -0
- package/docs/spec-format.md +194 -0
- package/eslint.config.mjs +79 -0
- package/examples/CLAUDE.md +54 -0
- package/examples/CLAUDE.md.spec.ts +65 -0
- package/examples/SKILL.md +50 -0
- package/examples/SKILL.md.spec.ts +57 -0
- package/fixtures/example-project/CLAUDE.md +11 -0
- package/fixtures/example-project/package.json +9 -0
- package/fixtures/example-project/src/index.ts +3 -0
- package/fixtures/example-project/src/utils.test.ts +2 -0
- package/fixtures/example-project/src/utils.ts +3 -0
- package/logo.png +0 -0
- package/package.json +42 -0
- package/research/adoption-strategy.md +111 -0
- package/research/agent-integration.md +145 -0
- package/research/ai-code-quality.md +197 -0
- package/research/code-search-for-agents.md +313 -0
- package/research/competitive-landscape.md +163 -0
- package/research/doc-freshness.md +516 -0
- package/research/executable-specs.md +368 -0
- package/research/feature-ideas.md +464 -0
- package/research/formal-proofs-for-agents.md +338 -0
- package/research/fp-for-agent-harness.md +150 -0
- package/research/fp-for-deterministic-ai.md +131 -0
- package/research/self-evolving-specs.md +298 -0
- package/schemas/claude-md-strict.yml +18 -0
- package/schemas/claude-md.yml +6 -0
- package/schemas/skill-strict.yml +12 -0
- package/schemas/skill.yml +5 -0
- package/skills/audit-feedback-loop/SKILL.md +76 -0
- package/skills/edit-spec/SKILL.md +131 -0
- package/skills/enforce-rules-format/SKILL.md +71 -0
- package/skills/generate-logo/SKILL.md +102 -0
- package/skills/generate-rule/SKILL.md +90 -0
- package/skills/linter-docs/clippy.md +241 -0
- package/skills/linter-docs/eslint.md +384 -0
- package/skills/linter-docs/pylint.md +288 -0
- package/skills/linter-docs/rubocop.md +277 -0
- package/skills/linter-docs/ruff.md +187 -0
- package/skills/linter-docs/stylelint.md +247 -0
- package/skills/migrate-to-spec/SKILL.md +124 -0
- package/skills/pr-to-lint-rule/SKILL.md +97 -0
- package/skills/strengthen/SKILL.md +168 -0
- package/src/action.ts +214 -0
- package/src/cli.test.ts +914 -0
- package/src/cli.ts +1631 -0
- package/src/compile.ts +691 -0
- package/src/evolve.ts +781 -0
- package/src/freshness.test.ts +449 -0
- package/src/freshness.ts +299 -0
- package/src/generate-types.ts +448 -0
- package/src/inline.test.ts +206 -0
- package/src/inline.ts +164 -0
- package/src/linters.ts +739 -0
- package/src/proofs.test.ts +1314 -0
- package/src/proofs.ts +849 -0
- package/src/spec.test.ts +1471 -0
- package/src/spec.ts +427 -0
- package/src/types.ts +117 -0
- package/src/validate.test.ts +701 -0
- package/src/validate.ts +381 -0
- package/tsconfig.json +23 -0
package/dist/evolve.js
ADDED
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* vigiles — Evolution engine for self-evolving specifications.
|
|
4
|
+
*
|
|
5
|
+
* AI agents propose mutations. The engine applies them, runs the proof suite,
|
|
6
|
+
* and only accepts mutations that pass all proofs AND improve fitness.
|
|
7
|
+
*
|
|
8
|
+
* Pattern: "LLM proposes, deterministic algorithm disposes."
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.EvolutionEngine = void 0;
|
|
12
|
+
exports.applyMutation = applyMutation;
|
|
13
|
+
exports.runProofSuite = runProofSuite;
|
|
14
|
+
const proofs_js_1 = require("./proofs.js");
|
|
15
|
+
const compile_js_1 = require("./compile.js");
|
|
16
|
+
/**
|
|
17
|
+
* Shallow-clone a Rule. Rules are simple value types (primitive fields only),
|
|
18
|
+
* so a spread is sufficient to decouple engine state from the caller's
|
|
19
|
+
* mutation object — without this, later caller-side edits would silently
|
|
20
|
+
* alter accepted engine state without re-running proofs.
|
|
21
|
+
*/
|
|
22
|
+
function cloneRule(rule) {
|
|
23
|
+
return { ...rule };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Canonical string representation of a rules map for hashing.
|
|
27
|
+
*
|
|
28
|
+
* `JSON.stringify` preserves insertion order, so two logically identical
|
|
29
|
+
* rule maps built in a different order would hash to different values.
|
|
30
|
+
* That would make the Merkle head/specHash comparison in the constructor
|
|
31
|
+
* falsely reject a valid imported history just because the caller
|
|
32
|
+
* reconstructed rules in a different order.
|
|
33
|
+
*
|
|
34
|
+
* Sort by rule id, stringify each entry with its own stable key order,
|
|
35
|
+
* and join with a separator.
|
|
36
|
+
*/
|
|
37
|
+
function canonicalRulesJson(rules) {
|
|
38
|
+
const sortedIds = Object.keys(rules).sort();
|
|
39
|
+
const entries = sortedIds.map((id) => {
|
|
40
|
+
const rule = rules[id];
|
|
41
|
+
// Also sort the keys within each rule object so { _kind, text } and
|
|
42
|
+
// { text, _kind } produce the same output.
|
|
43
|
+
const ruleKeys = Object.keys(rule).sort();
|
|
44
|
+
const orderedRule = {};
|
|
45
|
+
for (const k of ruleKeys) {
|
|
46
|
+
orderedRule[k] = rule[k];
|
|
47
|
+
}
|
|
48
|
+
return [id, orderedRule];
|
|
49
|
+
});
|
|
50
|
+
return JSON.stringify(entries);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Apply a mutation to a spec's rules, producing a new rule map.
|
|
54
|
+
* Returns null + error if the mutation is invalid.
|
|
55
|
+
*/
|
|
56
|
+
function applyMutation(rules, mutation) {
|
|
57
|
+
const next = { ...rules };
|
|
58
|
+
switch (mutation.type) {
|
|
59
|
+
case "add": {
|
|
60
|
+
if (mutation.ruleId in next) {
|
|
61
|
+
return {
|
|
62
|
+
rules,
|
|
63
|
+
error: {
|
|
64
|
+
mutation,
|
|
65
|
+
reason: `Rule "${mutation.ruleId}" already exists`,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
next[mutation.ruleId] = cloneRule(mutation.rule);
|
|
70
|
+
return { rules: next };
|
|
71
|
+
}
|
|
72
|
+
case "remove": {
|
|
73
|
+
if (!(mutation.ruleId in next)) {
|
|
74
|
+
return {
|
|
75
|
+
rules,
|
|
76
|
+
error: {
|
|
77
|
+
mutation,
|
|
78
|
+
reason: `Rule "${mutation.ruleId}" not found`,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const { [mutation.ruleId]: _removed, ...rest } = next;
|
|
83
|
+
void _removed;
|
|
84
|
+
return { rules: rest };
|
|
85
|
+
}
|
|
86
|
+
case "strengthen": {
|
|
87
|
+
const rule = next[mutation.ruleId];
|
|
88
|
+
if (!rule) {
|
|
89
|
+
return {
|
|
90
|
+
rules,
|
|
91
|
+
error: {
|
|
92
|
+
mutation,
|
|
93
|
+
reason: `Rule "${mutation.ruleId}" not found`,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (rule._kind === "guidance") {
|
|
98
|
+
if (mutation.linterRule) {
|
|
99
|
+
// guidance → enforce
|
|
100
|
+
next[mutation.ruleId] = {
|
|
101
|
+
_kind: "enforce",
|
|
102
|
+
linterRule: mutation.linterRule,
|
|
103
|
+
why: rule.text,
|
|
104
|
+
verify: true,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return {
|
|
109
|
+
rules,
|
|
110
|
+
error: {
|
|
111
|
+
mutation,
|
|
112
|
+
reason: "Strengthening guidance requires a linterRule to enforce against.",
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
return {
|
|
119
|
+
rules,
|
|
120
|
+
error: {
|
|
121
|
+
mutation,
|
|
122
|
+
reason: `Rule "${mutation.ruleId}" is already at maximum strength (enforce)`,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return { rules: next };
|
|
127
|
+
}
|
|
128
|
+
case "weaken": {
|
|
129
|
+
const rule = next[mutation.ruleId];
|
|
130
|
+
if (!rule) {
|
|
131
|
+
return {
|
|
132
|
+
rules,
|
|
133
|
+
error: {
|
|
134
|
+
mutation,
|
|
135
|
+
reason: `Rule "${mutation.ruleId}" not found`,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (rule._kind === "enforce") {
|
|
140
|
+
next[mutation.ruleId] = {
|
|
141
|
+
_kind: "guidance",
|
|
142
|
+
text: rule.why,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
return {
|
|
147
|
+
rules,
|
|
148
|
+
error: {
|
|
149
|
+
mutation,
|
|
150
|
+
reason: `Rule "${mutation.ruleId}" is already at minimum strength (guidance)`,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return { rules: next };
|
|
155
|
+
}
|
|
156
|
+
case "merge": {
|
|
157
|
+
const [idA, idB] = mutation.sourceIds;
|
|
158
|
+
if (idA === idB) {
|
|
159
|
+
return {
|
|
160
|
+
rules,
|
|
161
|
+
error: {
|
|
162
|
+
mutation,
|
|
163
|
+
reason: `Merge requires two distinct source rules; got "${idA}" twice`,
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
if (!(idA in next) || !(idB in next)) {
|
|
168
|
+
return {
|
|
169
|
+
rules,
|
|
170
|
+
error: {
|
|
171
|
+
mutation,
|
|
172
|
+
reason: `One or both source rules not found: "${idA}", "${idB}"`,
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
// mergedId must not collide with an unrelated existing rule —
|
|
177
|
+
// otherwise the assignment would silently overwrite that rule and
|
|
178
|
+
// drop its constraints. Allowed only when mergedId is one of the
|
|
179
|
+
// sources being consumed (renaming-in-place).
|
|
180
|
+
if (mutation.mergedId in next &&
|
|
181
|
+
mutation.mergedId !== idA &&
|
|
182
|
+
mutation.mergedId !== idB) {
|
|
183
|
+
return {
|
|
184
|
+
rules,
|
|
185
|
+
error: {
|
|
186
|
+
mutation,
|
|
187
|
+
reason: `Merge target "${mutation.mergedId}" collides with an existing unrelated rule; pick a new id or remove the existing rule first`,
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
// Merge must not silently weaken enforcement. The merged rule's
|
|
192
|
+
// strength must be at least as strong as the strongest source —
|
|
193
|
+
// otherwise a caller could launder two enforced rules into a
|
|
194
|
+
// single guidance rule and bypass monotonicity (because the
|
|
195
|
+
// per-call allowWeaken for merge sources means removals don't
|
|
196
|
+
// trigger the violation).
|
|
197
|
+
const sourceStrengths = mutation.sourceIds.map((id) => (0, proofs_js_1.ruleStrength)(next[id]._kind));
|
|
198
|
+
const maxSourceStrength = Math.max(...sourceStrengths);
|
|
199
|
+
const mergedStrength = (0, proofs_js_1.ruleStrength)(mutation.mergedRule._kind);
|
|
200
|
+
if (mergedStrength < maxSourceStrength) {
|
|
201
|
+
return {
|
|
202
|
+
rules,
|
|
203
|
+
error: {
|
|
204
|
+
mutation,
|
|
205
|
+
reason: `Merged rule "${mutation.mergedId}" (${mutation.mergedRule._kind}) is weaker than source rules (strongest was ${maxSourceStrength === 1 ? "enforce" : "guidance"}). Merges may not downgrade enforcement.`,
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
const { [idA]: _a, [idB]: _b, ...rest } = next;
|
|
210
|
+
void _a;
|
|
211
|
+
void _b;
|
|
212
|
+
return {
|
|
213
|
+
rules: { ...rest, [mutation.mergedId]: cloneRule(mutation.mergedRule) },
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
case "reword": {
|
|
217
|
+
const rule = next[mutation.ruleId];
|
|
218
|
+
if (!rule) {
|
|
219
|
+
return {
|
|
220
|
+
rules,
|
|
221
|
+
error: {
|
|
222
|
+
mutation,
|
|
223
|
+
reason: `Rule "${mutation.ruleId}" not found`,
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
if (rule._kind === "guidance") {
|
|
228
|
+
next[mutation.ruleId] = { ...rule, text: mutation.newText };
|
|
229
|
+
}
|
|
230
|
+
else if (rule._kind === "enforce") {
|
|
231
|
+
next[mutation.ruleId] = { ...rule, why: mutation.newText };
|
|
232
|
+
}
|
|
233
|
+
return { rules: next };
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Run all proofs on a candidate spec mutation.
|
|
239
|
+
*
|
|
240
|
+
* Proofs:
|
|
241
|
+
* 1. Monotonicity — rules don't weaken (unless explicitly allowed)
|
|
242
|
+
* 2. NCD deduplication — no near-duplicate rules introduced
|
|
243
|
+
* 3. Bloom filter overlap — fast cross-check for token similarity
|
|
244
|
+
*/
|
|
245
|
+
function runProofSuite(before, after, options = {}) {
|
|
246
|
+
const receipts = [];
|
|
247
|
+
const ncdThreshold = options.ncdThreshold ?? 0.3;
|
|
248
|
+
// 1. Monotonicity
|
|
249
|
+
const mono = (0, proofs_js_1.checkMonotonicity)(before, after, {
|
|
250
|
+
allowWeaken: options.allowWeaken,
|
|
251
|
+
});
|
|
252
|
+
receipts.push({
|
|
253
|
+
name: "monotonicity",
|
|
254
|
+
passed: mono.valid,
|
|
255
|
+
detail: mono.valid
|
|
256
|
+
? `${mono.strengthened.length} strengthened, ${mono.added.length} added`
|
|
257
|
+
: `${mono.violations.length} violations: ${mono.violations.map((v) => `${v.ruleId} (${v.from}→${v.to})`).join(", ")}`,
|
|
258
|
+
});
|
|
259
|
+
// 2. NCD deduplication. Only fail on pairs NEWLY INTRODUCED by the
|
|
260
|
+
// candidate change — a repo with historical duplication must not
|
|
261
|
+
// block every unrelated mutation. Compute similar pairs on `after`
|
|
262
|
+
// and `before`, then subtract.
|
|
263
|
+
//
|
|
264
|
+
// Wrapped in try/catch so an unknown rule kind (legacy data / JS
|
|
265
|
+
// caller) surfaces as a clean proof failure rather than crashing
|
|
266
|
+
// the whole audit pipeline.
|
|
267
|
+
try {
|
|
268
|
+
const beforePairs = new Set((0, proofs_js_1.findSimilarRules)(before, ncdThreshold).map((p) => [p.idA, p.idB].sort().join("|")));
|
|
269
|
+
const similar = (0, proofs_js_1.findSimilarRules)(after, ncdThreshold).filter((p) => !beforePairs.has([p.idA, p.idB].sort().join("|")));
|
|
270
|
+
const ncdPassed = similar.length === 0;
|
|
271
|
+
receipts.push({
|
|
272
|
+
name: "ncd-dedup",
|
|
273
|
+
passed: ncdPassed,
|
|
274
|
+
detail: ncdPassed
|
|
275
|
+
? "No new near-duplicate rules"
|
|
276
|
+
: `${similar.length} new near-duplicate pairs: ${similar.map((p) => `${p.idA}↔${p.idB} (${p.distance.toFixed(3)})`).join(", ")}`,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
catch (e) {
|
|
280
|
+
receipts.push({
|
|
281
|
+
name: "ncd-dedup",
|
|
282
|
+
passed: false,
|
|
283
|
+
detail: `Similarity check failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
// 3. Bloom filter cross-check (fast sanity check for token overlap).
|
|
287
|
+
// Baseline is built from rules that still exist in `after` — any
|
|
288
|
+
// rule removed by the candidate mutation (e.g. the two sources of
|
|
289
|
+
// a merge) must be excluded, otherwise the newly introduced merge
|
|
290
|
+
// rule would collide against its own sources and the merge would
|
|
291
|
+
// be rejected for the very similarity it was meant to deduplicate.
|
|
292
|
+
//
|
|
293
|
+
// Wrapped for the same reason as NCD: ruleToBloomFilter → ruleToText
|
|
294
|
+
// throws on unknown rule kinds.
|
|
295
|
+
try {
|
|
296
|
+
let bloomPassed = true;
|
|
297
|
+
const newRuleIds = Object.keys(after).filter((id) => !(id in before));
|
|
298
|
+
const existingFilters = new Map();
|
|
299
|
+
for (const [id, rule] of Object.entries(before)) {
|
|
300
|
+
if (!(id in after))
|
|
301
|
+
continue; // removed — skip
|
|
302
|
+
existingFilters.set(id, (0, proofs_js_1.ruleToBloomFilter)(rule));
|
|
303
|
+
}
|
|
304
|
+
const bloomOverlaps = [];
|
|
305
|
+
for (const newId of newRuleIds) {
|
|
306
|
+
const newFilter = (0, proofs_js_1.ruleToBloomFilter)(after[newId]);
|
|
307
|
+
for (const [existingId, existingFilter] of existingFilters) {
|
|
308
|
+
if (existingId === newId)
|
|
309
|
+
continue;
|
|
310
|
+
try {
|
|
311
|
+
const similarity = proofs_js_1.BloomFilter.jaccardSimilarity(newFilter, existingFilter);
|
|
312
|
+
if (similarity > 0.7) {
|
|
313
|
+
bloomOverlaps.push(`${newId}↔${existingId} (jaccard=${similarity.toFixed(3)})`);
|
|
314
|
+
bloomPassed = false;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
// Different filter sizes — skip comparison
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
receipts.push({
|
|
323
|
+
name: "bloom-overlap",
|
|
324
|
+
passed: bloomPassed,
|
|
325
|
+
detail: bloomPassed
|
|
326
|
+
? "No suspicious token overlap"
|
|
327
|
+
: `High overlap: ${bloomOverlaps.join(", ")}`,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
catch (e) {
|
|
331
|
+
receipts.push({
|
|
332
|
+
name: "bloom-overlap",
|
|
333
|
+
passed: false,
|
|
334
|
+
detail: `Bloom filter check failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
// Compute fitness of the new spec. Guard against bad runtime data: fitness
|
|
338
|
+
// recomputes similarity internally and would otherwise crash on unknown
|
|
339
|
+
// rule kinds (legacy `check`, JS caller), propagating the throw up through
|
|
340
|
+
// the engine. Fall back to a neutral fitness and mark the proof failed.
|
|
341
|
+
const specForFitness = { rules: after };
|
|
342
|
+
let fitnessResult;
|
|
343
|
+
try {
|
|
344
|
+
fitnessResult = (0, proofs_js_1.fitness)(specForFitness, {
|
|
345
|
+
maxTokens: options.maxTokens,
|
|
346
|
+
ncdThreshold,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
catch (e) {
|
|
350
|
+
receipts.push({
|
|
351
|
+
name: "fitness",
|
|
352
|
+
passed: false,
|
|
353
|
+
detail: `Fitness computation failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
354
|
+
});
|
|
355
|
+
fitnessResult = {
|
|
356
|
+
score: 0,
|
|
357
|
+
coverage: 0,
|
|
358
|
+
redundancy: 0,
|
|
359
|
+
budgetPressure: 0,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
const allPassed = receipts.every((r) => r.passed);
|
|
363
|
+
return { passed: allPassed, receipts, fitness: fitnessResult };
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* The evolution engine: the core of the self-evolving spec system.
|
|
367
|
+
*
|
|
368
|
+
* Maintains a spec, a proof suite, and a Merkle history.
|
|
369
|
+
* Accepts mutations that pass all proofs and improve (or maintain) fitness.
|
|
370
|
+
*/
|
|
371
|
+
class EvolutionEngine {
|
|
372
|
+
rules;
|
|
373
|
+
history;
|
|
374
|
+
options;
|
|
375
|
+
constructor(initialRules, options = {}) {
|
|
376
|
+
this.rules = Object.fromEntries(Object.entries(initialRules).map(([id, rule]) => [id, cloneRule(rule)]));
|
|
377
|
+
// Snapshot the supplied history by serializing and rehydrating, so a
|
|
378
|
+
// caller that retains their reference to the original MerkleHistory
|
|
379
|
+
// can't append to the audit trail behind the engine's back. Without
|
|
380
|
+
// this, external code could bypass propose()'s proof + fitness gates
|
|
381
|
+
// and mutate provenance — defeating the whole tamper-evident point.
|
|
382
|
+
this.history = options.history
|
|
383
|
+
? proofs_js_1.MerkleHistory.fromJSON(options.history.toJSON())
|
|
384
|
+
: new proofs_js_1.MerkleHistory();
|
|
385
|
+
this.options = {
|
|
386
|
+
// Clone the Set so a caller mutating their own reference after
|
|
387
|
+
// construction can't silently change acceptance policy (e.g. by
|
|
388
|
+
// adding a rule id to allow a weakening mutation that would
|
|
389
|
+
// otherwise be rejected).
|
|
390
|
+
allowWeaken: new Set(options.allowWeaken ?? []),
|
|
391
|
+
ncdThreshold: options.ncdThreshold ?? 0.3,
|
|
392
|
+
maxTokens: options.maxTokens ?? 2000,
|
|
393
|
+
acceptNeutral: options.acceptNeutral ?? false,
|
|
394
|
+
};
|
|
395
|
+
// If a history was supplied, verify its chain integrity and that its
|
|
396
|
+
// head corresponds to initialRules. A stale or mismatched history would
|
|
397
|
+
// produce misleading provenance for subsequent mutations.
|
|
398
|
+
if (options.history) {
|
|
399
|
+
const verification = this.history.verify();
|
|
400
|
+
if (!verification.valid) {
|
|
401
|
+
throw new Error(`Supplied Merkle history is invalid at node ${String(verification.invalidAt)}. Tamper detected or corrupted chain.`);
|
|
402
|
+
}
|
|
403
|
+
if (this.history.length > 0) {
|
|
404
|
+
const expectedHash = (0, compile_js_1.computeHash)(canonicalRulesJson(this.rules));
|
|
405
|
+
const head = this.history.head();
|
|
406
|
+
if (head && head.specHash !== expectedHash) {
|
|
407
|
+
throw new Error(`Supplied Merkle history head does not match initialRules. ` +
|
|
408
|
+
`History head specHash="${head.specHash}", expected="${expectedHash}". ` +
|
|
409
|
+
`The history and rules are mismatched; refusing to record new mutations on the wrong chain.`);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
// Record genesis state
|
|
414
|
+
if (this.history.length === 0) {
|
|
415
|
+
const specHash = (0, compile_js_1.computeHash)(canonicalRulesJson(this.rules));
|
|
416
|
+
this.history.append(specHash, {
|
|
417
|
+
type: "add",
|
|
418
|
+
ruleIds: Object.keys(this.rules),
|
|
419
|
+
description: "Genesis",
|
|
420
|
+
}, [{ name: "genesis", passed: true }]);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Get current rules as a deep defensive copy. Callers cannot mutate
|
|
425
|
+
* engine state through the returned map because every rule is cloned —
|
|
426
|
+
* otherwise a JS caller or a TS cast could silently alter accepted
|
|
427
|
+
* state without running proofs or appending to history.
|
|
428
|
+
*/
|
|
429
|
+
getRules() {
|
|
430
|
+
return Object.fromEntries(Object.entries(this.rules).map(([id, rule]) => [id, cloneRule(rule)]));
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Get a snapshot of the Merkle history.
|
|
434
|
+
*
|
|
435
|
+
* Returns a freshly deserialized copy so even a JS caller that casts
|
|
436
|
+
* to MerkleHistory and calls `.append()` cannot inject nodes into the
|
|
437
|
+
* engine's real chain. The snapshot is read-only at the TS level
|
|
438
|
+
* (ReadonlyMerkleHistory) and isolated at the runtime level (separate
|
|
439
|
+
* instance via toJSON/fromJSON).
|
|
440
|
+
*/
|
|
441
|
+
getHistory() {
|
|
442
|
+
return proofs_js_1.MerkleHistory.fromJSON(this.history.toJSON());
|
|
443
|
+
}
|
|
444
|
+
/** Get current fitness. */
|
|
445
|
+
getFitness() {
|
|
446
|
+
return (0, proofs_js_1.fitness)({ rules: this.rules }, {
|
|
447
|
+
maxTokens: this.options.maxTokens,
|
|
448
|
+
ncdThreshold: this.options.ncdThreshold,
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Propose a mutation. The engine applies it, runs proofs, and accepts or rejects.
|
|
453
|
+
*
|
|
454
|
+
* Returns a detailed result including proof receipts and fitness comparison.
|
|
455
|
+
*/
|
|
456
|
+
propose(mutation) {
|
|
457
|
+
// Guard baseline fitness: if engine state contains a malformed rule
|
|
458
|
+
// (legacy _kind, JS caller, cast bypass), fitness() reaches ruleToText
|
|
459
|
+
// and throws BEFORE we enter runProofSuite's own try/catch. Return a
|
|
460
|
+
// clean rejection with a neutral fitness instead of crashing the flow.
|
|
461
|
+
let beforeFitness;
|
|
462
|
+
try {
|
|
463
|
+
beforeFitness = this.getFitness();
|
|
464
|
+
}
|
|
465
|
+
catch (e) {
|
|
466
|
+
const neutral = {
|
|
467
|
+
score: 0,
|
|
468
|
+
coverage: 0,
|
|
469
|
+
redundancy: 0,
|
|
470
|
+
budgetPressure: 0,
|
|
471
|
+
};
|
|
472
|
+
return {
|
|
473
|
+
accepted: false,
|
|
474
|
+
mutation,
|
|
475
|
+
proofs: {
|
|
476
|
+
passed: false,
|
|
477
|
+
receipts: [
|
|
478
|
+
{
|
|
479
|
+
name: "baseline-fitness",
|
|
480
|
+
passed: false,
|
|
481
|
+
detail: `Baseline fitness failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
482
|
+
},
|
|
483
|
+
],
|
|
484
|
+
fitness: neutral,
|
|
485
|
+
},
|
|
486
|
+
beforeFitness: neutral,
|
|
487
|
+
afterFitness: neutral,
|
|
488
|
+
error: `Baseline fitness failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
// Apply the mutation
|
|
492
|
+
const { rules: candidateRules, error } = applyMutation(this.rules, mutation);
|
|
493
|
+
if (error) {
|
|
494
|
+
return {
|
|
495
|
+
accepted: false,
|
|
496
|
+
mutation,
|
|
497
|
+
proofs: { passed: false, receipts: [], fitness: beforeFitness },
|
|
498
|
+
beforeFitness,
|
|
499
|
+
afterFitness: beforeFitness,
|
|
500
|
+
error: error.reason,
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
// For merge mutations, the source rule IDs are removed by design.
|
|
504
|
+
// Add them to a per-call allowWeaken set so checkMonotonicity doesn't
|
|
505
|
+
// reject the removal as a monotonicity violation — merging is the
|
|
506
|
+
// intended constraint-reducing operation, not silent deletion.
|
|
507
|
+
const perCallAllowWeaken = new Set(this.options.allowWeaken);
|
|
508
|
+
if (mutation.type === "merge") {
|
|
509
|
+
for (const id of mutation.sourceIds) {
|
|
510
|
+
perCallAllowWeaken.add(id);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
// Run proof suite
|
|
514
|
+
const proofResult = runProofSuite(this.rules, candidateRules, {
|
|
515
|
+
allowWeaken: perCallAllowWeaken,
|
|
516
|
+
ncdThreshold: this.options.ncdThreshold,
|
|
517
|
+
maxTokens: this.options.maxTokens,
|
|
518
|
+
});
|
|
519
|
+
const afterFitness = proofResult.fitness;
|
|
520
|
+
// Decision: all proofs pass AND fitness doesn't decrease.
|
|
521
|
+
//
|
|
522
|
+
// `acceptNeutral` relaxes strict improvement (>) to ≥ — i.e. it accepts
|
|
523
|
+
// mutations that keep fitness the same. It must NOT accept regressions:
|
|
524
|
+
// a previous version short-circuited on acceptNeutral, which meant any
|
|
525
|
+
// proof-passing mutation was accepted regardless of score, silently
|
|
526
|
+
// driving spec quality downward over time.
|
|
527
|
+
const fitnessOk = this.options.acceptNeutral
|
|
528
|
+
? afterFitness.score >= beforeFitness.score
|
|
529
|
+
: afterFitness.score > beforeFitness.score;
|
|
530
|
+
const accepted = proofResult.passed && fitnessOk;
|
|
531
|
+
let historyHash;
|
|
532
|
+
if (accepted) {
|
|
533
|
+
// Accept the mutation
|
|
534
|
+
this.rules = candidateRules;
|
|
535
|
+
// Record in Merkle history
|
|
536
|
+
const specHash = (0, compile_js_1.computeHash)(canonicalRulesJson(this.rules));
|
|
537
|
+
const historyMutation = {
|
|
538
|
+
type: mutation.type === "merge" ? "merge" : mutation.type,
|
|
539
|
+
ruleIds: mutation.type === "merge"
|
|
540
|
+
? [...mutation.sourceIds, mutation.mergedId]
|
|
541
|
+
: ["ruleId" in mutation ? mutation.ruleId : "unknown"],
|
|
542
|
+
description: describeMutation(mutation),
|
|
543
|
+
};
|
|
544
|
+
// Defensive copy: the same proofResult is returned to the caller,
|
|
545
|
+
// so without this clone a caller mutating result.proofs.receipts
|
|
546
|
+
// would retroactively alter the stored history node.
|
|
547
|
+
historyHash = this.history.append(specHash, historyMutation, proofResult.receipts.map((r) => ({ ...r })));
|
|
548
|
+
}
|
|
549
|
+
return {
|
|
550
|
+
accepted,
|
|
551
|
+
mutation,
|
|
552
|
+
proofs: proofResult,
|
|
553
|
+
beforeFitness,
|
|
554
|
+
afterFitness,
|
|
555
|
+
historyHash,
|
|
556
|
+
error: !proofResult.passed
|
|
557
|
+
? `Proofs failed: ${proofResult.receipts
|
|
558
|
+
.filter((r) => !r.passed)
|
|
559
|
+
.map((r) => r.name)
|
|
560
|
+
.join(", ")}`
|
|
561
|
+
: !fitnessOk
|
|
562
|
+
? `Fitness decreased: ${beforeFitness.score.toFixed(3)} → ${afterFitness.score.toFixed(3)}`
|
|
563
|
+
: undefined,
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Propose multiple mutations in sequence.
|
|
568
|
+
* Stops at the first rejection unless `continueOnReject` is true.
|
|
569
|
+
*/
|
|
570
|
+
proposeAll(mutations, options = {}) {
|
|
571
|
+
const results = [];
|
|
572
|
+
for (const mutation of mutations) {
|
|
573
|
+
const result = this.propose(mutation);
|
|
574
|
+
results.push(result);
|
|
575
|
+
if (!result.accepted && !options.continueOnReject)
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
return results;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
exports.EvolutionEngine = EvolutionEngine;
|
|
582
|
+
/** Human-readable description of a mutation. */
|
|
583
|
+
function describeMutation(mutation) {
|
|
584
|
+
switch (mutation.type) {
|
|
585
|
+
case "add":
|
|
586
|
+
return `Add rule "${mutation.ruleId}" (${mutation.rule._kind})`;
|
|
587
|
+
case "remove":
|
|
588
|
+
return `Remove rule "${mutation.ruleId}"`;
|
|
589
|
+
case "strengthen":
|
|
590
|
+
return `Strengthen rule "${mutation.ruleId}"${mutation.linterRule ? ` → enforce(${mutation.linterRule})` : ""}`;
|
|
591
|
+
case "weaken":
|
|
592
|
+
return `Weaken rule "${mutation.ruleId}": ${mutation.justification}`;
|
|
593
|
+
case "merge":
|
|
594
|
+
return `Merge "${mutation.sourceIds[0]}" + "${mutation.sourceIds[1]}" → "${mutation.mergedId}"`;
|
|
595
|
+
case "reword":
|
|
596
|
+
return `Reword rule "${mutation.ruleId}"`;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
//# sourceMappingURL=evolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evolve.js","sourceRoot":"","sources":["../src/evolve.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAsHH,sCAiMC;AAoBD,sCA4IC;AApdD,2CAYqB;AACrB,6CAA2C;AA4D3C;;;;;GAKG;AACH,SAAS,SAAS,CAAC,IAAU;IAC3B,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;AACrB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,kBAAkB,CAAC,KAA2B;IACrD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,C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