@hmharness/evolution 0.23.51 → 0.23.53
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/dist/insights.js +1 -1
- package/dist/skills.d.ts +14 -0
- package/dist/skills.js +54 -9
- package/dist/three-arm-v2.js +2 -2
- package/dist/three-arm.js +2 -2
- package/package.json +3 -3
package/dist/insights.js
CHANGED
|
@@ -156,7 +156,7 @@ export async function retrieveInsights(home, task, opts = {}) {
|
|
|
156
156
|
if (q.size === 0)
|
|
157
157
|
return rows.slice(-topK).map((r) => formatInsight(r, opts.workspace)).join('\n');
|
|
158
158
|
// newest first within the pool, so idx IS the recency rank
|
|
159
|
-
const newestFirst =
|
|
159
|
+
const newestFirst = rows.toReversed();
|
|
160
160
|
const scored = newestFirst
|
|
161
161
|
.map((r, idx) => ({ r, s: jaccard(q, bigrams(r.task)) + (1 - idx / (newestFirst.length + 1)) * 1e-4 }))
|
|
162
162
|
.filter((x) => x.s > INSIGHT_SIM_FLOOR)
|
package/dist/skills.d.ts
CHANGED
|
@@ -25,6 +25,12 @@ export declare function listDrafts(home: string): Promise<SkillEntry[]>;
|
|
|
25
25
|
/** Canary-state skills: promoted through the bench gates but still under
|
|
26
26
|
* impact evaluation - injected into a sample of sessions, watermarked. */
|
|
27
27
|
export declare function listCanary(home: string): Promise<SkillEntry[]>;
|
|
28
|
+
/** One line per skill. The line carries the skill's sub-folder as a short tag
|
|
29
|
+
* (`- name [canary]: description`); the system prompt supplies the
|
|
30
|
+
* "tag → path" legend under the real HMH_HOME. Before 2026-11-25 the line had
|
|
31
|
+
* no location at all: SKILL.md files sit in three different folders and the
|
|
32
|
+
* model had to guess — in the session history it read a skill body in 1.9% of
|
|
33
|
+
* the sessions that had skills injected (23 of 77 reads failed on the path). */
|
|
28
34
|
export declare function skillsToPrompt(entries: SkillEntry[]): string;
|
|
29
35
|
/** Write (or overwrite) a draft; drafts are cheap and reversible by deletion. */
|
|
30
36
|
export declare function writeDraft(home: string, name: string, skillMd: string): Promise<string>;
|
|
@@ -52,3 +58,11 @@ export declare function rollbackSkill(home: string, name: string): Promise<boole
|
|
|
52
58
|
/** Demote an active skill back to draft without deleting anything. */
|
|
53
59
|
export declare function unpromoteSkill(home: string, name: string): Promise<boolean>;
|
|
54
60
|
export declare function deleteDraft(home: string, name: string): Promise<boolean>;
|
|
61
|
+
/** One-line description of a SKILL.md: the frontmatter `description`, else the
|
|
62
|
+
* first non-heading non-empty line of the BODY. Line endings are normalised
|
|
63
|
+
* first: 65 of 107 skills in a real library had CRLF frontmatter, which the
|
|
64
|
+
* LF-only regex missed, so their "description" came out as the frontmatter's
|
|
65
|
+
* "name: <skill>" line and the model could not tell what they were for.
|
|
66
|
+
* Frontmatter without a description falls through to the body, never to
|
|
67
|
+
* another frontmatter field. Exported for tests. */
|
|
68
|
+
export declare function parseDescription(text: string): string;
|
package/dist/skills.js
CHANGED
|
@@ -169,10 +169,31 @@ async function scan(dir, exclude, state) {
|
|
|
169
169
|
}
|
|
170
170
|
return entries;
|
|
171
171
|
}
|
|
172
|
+
/** Sub-folder of the skills root a SKILL.md lives in, or '' for the top-level
|
|
173
|
+
* layout: skills\<name>\SKILL.md → '', skills\active\<name>\SKILL.md → 'active'.
|
|
174
|
+
* Derived from the file path: top-level and active/ entries both carry
|
|
175
|
+
* state 'active', so the state alone cannot tell the model where to read. */
|
|
176
|
+
function folderTag(file) {
|
|
177
|
+
const norm = file.replace(/\\/g, '/');
|
|
178
|
+
const i = norm.lastIndexOf('/skills/');
|
|
179
|
+
if (i < 0)
|
|
180
|
+
return '';
|
|
181
|
+
const parts = norm.slice(i + '/skills/'.length).split('/');
|
|
182
|
+
return parts.length > 2 ? parts[0] : '';
|
|
183
|
+
}
|
|
184
|
+
/** One line per skill. The line carries the skill's sub-folder as a short tag
|
|
185
|
+
* (`- name [canary]: description`); the system prompt supplies the
|
|
186
|
+
* "tag → path" legend under the real HMH_HOME. Before 2026-11-25 the line had
|
|
187
|
+
* no location at all: SKILL.md files sit in three different folders and the
|
|
188
|
+
* model had to guess — in the session history it read a skill body in 1.9% of
|
|
189
|
+
* the sessions that had skills injected (23 of 77 reads failed on the path). */
|
|
172
190
|
export function skillsToPrompt(entries) {
|
|
173
191
|
if (entries.length === 0)
|
|
174
192
|
return '';
|
|
175
|
-
return entries.map((s) =>
|
|
193
|
+
return entries.map((s) => {
|
|
194
|
+
const tag = folderTag(s.file);
|
|
195
|
+
return `- ${s.name}${tag ? ` [${tag}]` : ''}: ${s.description || '(no description)'}`;
|
|
196
|
+
}).join('\n');
|
|
176
197
|
}
|
|
177
198
|
/** Write (or overwrite) a draft; drafts are cheap and reversible by deletion. */
|
|
178
199
|
export async function writeDraft(home, name, skillMd) {
|
|
@@ -304,15 +325,39 @@ export async function deleteDraft(home, name) {
|
|
|
304
325
|
function sanitize(name) {
|
|
305
326
|
return name.replace(/[^a-zA-Z0-9_-]/g, '-').slice(0, 60) || 'skill';
|
|
306
327
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
328
|
+
/** The frontmatter `description`: inline (optionally quoted) or a folded/literal block scalar. '' when absent. */
|
|
329
|
+
function frontmatterDescription(fm) {
|
|
330
|
+
const lines = fm.split('\n');
|
|
331
|
+
const i = lines.findIndex((l) => /^description:/.test(l));
|
|
332
|
+
if (i < 0)
|
|
333
|
+
return '';
|
|
334
|
+
const inline = lines[i].replace(/^description:\s*/, '').trim();
|
|
335
|
+
if (!/^[>|][+-]?$/.test(inline))
|
|
336
|
+
return inline.replace(/^["']|["']$/g, '').trim();
|
|
337
|
+
// block scalar: every following indented line belongs to it
|
|
338
|
+
const folded = [];
|
|
339
|
+
for (const l of lines.slice(i + 1)) {
|
|
340
|
+
if (!/^\s/.test(l) || !l.trim())
|
|
341
|
+
break;
|
|
342
|
+
folded.push(l.trim());
|
|
314
343
|
}
|
|
315
|
-
|
|
344
|
+
return folded.join(' ');
|
|
345
|
+
}
|
|
346
|
+
/** One-line description of a SKILL.md: the frontmatter `description`, else the
|
|
347
|
+
* first non-heading non-empty line of the BODY. Line endings are normalised
|
|
348
|
+
* first: 65 of 107 skills in a real library had CRLF frontmatter, which the
|
|
349
|
+
* LF-only regex missed, so their "description" came out as the frontmatter's
|
|
350
|
+
* "name: <skill>" line and the model could not tell what they were for.
|
|
351
|
+
* Frontmatter without a description falls through to the body, never to
|
|
352
|
+
* another frontmatter field. Exported for tests. */
|
|
353
|
+
export function parseDescription(text) {
|
|
354
|
+
const lf = text.replace(/\r\n/g, '\n');
|
|
355
|
+
const fm = lf.match(/^---\n([\s\S]*?)\n---(?:\n|$)/);
|
|
356
|
+
const body = fm ? lf.slice(fm[0].length) : lf;
|
|
357
|
+
const fromFm = fm ? frontmatterDescription(fm[1]) : '';
|
|
358
|
+
if (fromFm)
|
|
359
|
+
return fromFm.trim().slice(0, 120);
|
|
360
|
+
for (const line of body.split('\n')) {
|
|
316
361
|
const t = line.trim();
|
|
317
362
|
if (t && !t.startsWith('#') && !t.startsWith('---'))
|
|
318
363
|
return t.slice(0, 120);
|
package/dist/three-arm-v2.js
CHANGED
|
@@ -104,8 +104,8 @@ export function buildTaskSetHashV2(tasks) {
|
|
|
104
104
|
: t.assertion.expectAny?.length ? 'expect-any'
|
|
105
105
|
: t.assertion.expectNone?.length ? 'expect-none'
|
|
106
106
|
: 'expect';
|
|
107
|
-
const rows =
|
|
108
|
-
.
|
|
107
|
+
const rows = tasks
|
|
108
|
+
.toSorted((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))
|
|
109
109
|
.map((t) => ({ id: t.id, prompt: t.prompt, assertion: { kind: primaryKind(t), expect: JSON.stringify(t.assertion) }, holdout: t.split === 'protect' }));
|
|
110
110
|
const canonical = JSON.stringify({ kind: 'hmharness-eval-taskset', version: 1, id: 'three-arm-v2-2026-10-28', revision: 1, tasks: rows });
|
|
111
111
|
return { setId: 'three-arm-v2-2026-10-28', datasetHash: createHash('sha256').update(canonical).digest('hex'), canonical };
|
package/dist/three-arm.js
CHANGED
|
@@ -93,8 +93,8 @@ function seededOrderStr(items, seed) {
|
|
|
93
93
|
* by id; the FULL assertion spec serialized into evalset's assertion.expect
|
|
94
94
|
* so the hash is content-sensitive to every mode, not just the primary). */
|
|
95
95
|
export function buildTaskSetHash(tasks) {
|
|
96
|
-
const rows =
|
|
97
|
-
.
|
|
96
|
+
const rows = tasks
|
|
97
|
+
.toSorted((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))
|
|
98
98
|
.map((t) => ({ id: t.id, prompt: t.prompt, assertion: { kind: primaryKind(t), expect: JSON.stringify(t.assertion) }, holdout: t.split === 'protect' }));
|
|
99
99
|
const canonical = JSON.stringify({ kind: 'hmharness-eval-taskset', version: 1, id: 'three-arm-2026-10-27', revision: 1, tasks: rows });
|
|
100
100
|
return { setId: 'three-arm-2026-10-27', datasetHash: createHash('sha256').update(canonical).digest('hex'), canonical };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmharness/evolution",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.53",
|
|
4
4
|
"description": "hmharness evolution subsystem: persistent memory, insight capture, skill library, and the bench that gives evolution its fitness signal. First-class kernel citizen, not a plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"build": "tsc -p tsconfig.build.json"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@hmharness/cognitive": "0.23.
|
|
19
|
-
"@hmharness/kernel": "0.23.
|
|
18
|
+
"@hmharness/cognitive": "0.23.53",
|
|
19
|
+
"@hmharness/kernel": "0.23.53"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist"
|