@lmzhen/dsh-evolution-core 0.1.0-rc.22 → 0.1.0-rc.24
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/lib/index.js +216 -178
- package/lib/types/index.d.ts +1 -0
- package/lib/types/learn-prompt.d.ts +19 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -377,6 +377,221 @@ function computeLifecycleTransitions(usage, config, now = /* @__PURE__ */ new Da
|
|
|
377
377
|
return result;
|
|
378
378
|
}
|
|
379
379
|
//#endregion
|
|
380
|
+
//#region lib/types/prompts.js
|
|
381
|
+
/**
|
|
382
|
+
* Review and curation prompts adapted from Hermes Agent
|
|
383
|
+
* `agent/background_review.py`, `agent/curator.py`, and
|
|
384
|
+
* `agent/learn_prompt.py`, with tool names translated to the DSH-native
|
|
385
|
+
* catalog (`memory`, `skill_manage`, `skill`, `bash`, `str_replace_editor`).
|
|
386
|
+
*
|
|
387
|
+
* Every prompt is pinned in a versioned bundle. Review workers verify the
|
|
388
|
+
* bundle digest before spending a model call, so a partially-patched
|
|
389
|
+
* deployment fails closed instead of silently running a truncated prompt.
|
|
390
|
+
*/
|
|
391
|
+
/**
|
|
392
|
+
* Prompt bundle identity. Bump both id and version whenever a prompt's text
|
|
393
|
+
* changes semantically: the bundle digest is the fail-closed signal for
|
|
394
|
+
* review workers, so a stale id across deployments must be distinguishable.
|
|
395
|
+
*/
|
|
396
|
+
const PROMPT_BUNDLE_ID = "dsh-evolution@2";
|
|
397
|
+
const PROMPT_BUNDLE_VERSION = 2;
|
|
398
|
+
const MEMORY_REVIEW_PROMPT = `[Auto-review — Memory]
|
|
399
|
+
Review the conversation above and consider saving to memory if appropriate.
|
|
400
|
+
|
|
401
|
+
Focus on:
|
|
402
|
+
1. Has the user revealed things about themselves — persona, desires, preferences, or personal details worth remembering?
|
|
403
|
+
2. Has the user expressed expectations about how you should behave, their work style, or ways they want you to operate?
|
|
404
|
+
|
|
405
|
+
If something stands out, save it using the memory tool.
|
|
406
|
+
If nothing is worth saving, just say "Nothing to save." and stop.`;
|
|
407
|
+
const SKILL_REVIEW_PROMPT = `[Auto-review — Skills]
|
|
408
|
+
Review the conversation above and update the skill library. Be ACTIVE — most sessions produce at least one skill update, even if small.
|
|
409
|
+
|
|
410
|
+
Target shape: CLASS-LEVEL skills with a rich SKILL.md and a references/ directory for session-specific detail. Not a flat list of narrow one-session skills.
|
|
411
|
+
|
|
412
|
+
Signals that warrant action:
|
|
413
|
+
- The user corrected your style, tone, format, verbosity, workflow, or approach.
|
|
414
|
+
- A non-trivial technique, fix, workaround, or debugging path emerged.
|
|
415
|
+
- A loaded skill turned out wrong, missing, or outdated — patch it now.
|
|
416
|
+
|
|
417
|
+
Preference order:
|
|
418
|
+
1. Patch a skill that was loaded or read this session.
|
|
419
|
+
2. Patch an existing umbrella skill.
|
|
420
|
+
3. Add references/, templates/, or scripts/ support under an existing skill.
|
|
421
|
+
4. Create a new class-level umbrella skill only when nothing fits.
|
|
422
|
+
|
|
423
|
+
Protected skills (bundled/hub-installed) must not be edited. Pinned skills may be patched but not archived.
|
|
424
|
+
|
|
425
|
+
Do NOT capture:
|
|
426
|
+
- Environment-dependent failures (missing binaries, unconfigured credentials).
|
|
427
|
+
- Negative claims about tools ("browser tools do not work").
|
|
428
|
+
- Transient errors that resolved during the session.
|
|
429
|
+
- One-off task narratives.
|
|
430
|
+
|
|
431
|
+
If a tool failed because of setup state, capture the FIX under an existing setup skill — never "this tool does not work" as a standalone constraint.
|
|
432
|
+
|
|
433
|
+
"Nothing to save." is a real option but should NOT be the default.`;
|
|
434
|
+
const COMBINED_REVIEW_PROMPT = `[Auto-review]
|
|
435
|
+
Review the conversation above and update two things.
|
|
436
|
+
|
|
437
|
+
**Memory**: who the user is. Save durable user preferences, personal details, and expectations with the memory tool.
|
|
438
|
+
|
|
439
|
+
**Skills**: how to do this class of task. Be ACTIVE. Follow the same class-level umbrella policy, preference order, protected-skill rules, and do-not-capture list as a skill review.
|
|
440
|
+
|
|
441
|
+
Act on whichever dimension has real signal. If genuinely nothing stands out on either, say "Nothing to save." and stop — but don't reach for that conclusion as a default.`;
|
|
442
|
+
const CURATOR_PROMPT = `You are the skill curator. Maintain a healthy, class-level skill library, not a flat pile of narrow one-session skills.
|
|
443
|
+
|
|
444
|
+
The goal is a LIBRARY OF CLASS-LEVEL INSTRUCTIONS. A skill collection of many narrow skills where each captures one session's specific bug is a FAILURE of the library. An agent searching skills matches on descriptions, not exact names; one broad umbrella with labeled subsections beats five narrow siblings for discoverability.
|
|
445
|
+
|
|
446
|
+
Right target shape: class-level skills with rich SKILL.md + references/, templates/, scripts/ support files for session-specific detail.
|
|
447
|
+
|
|
448
|
+
Hard rules:
|
|
449
|
+
1. NEVER hard-delete a skill. Archive (moving to .archive/) is the maximum destructive action; archives are recoverable, deletion is not.
|
|
450
|
+
2. Do not touch bundled, hub-installed, pinned, or scheduled-task-referenced (\`referenced\`) skills. Referenced skills MAY be consolidated into an umbrella, but never simply pruned.
|
|
451
|
+
3. Do not archive recently-created or never-used skills without strong evidence. "use=0" is NOT evidence either way — it only means the trigger has not come up yet.
|
|
452
|
+
4. Do NOT reject consolidation on the grounds that "each skill has a distinct trigger". The right bar is: would a human maintainer write this as N separate skills, or one skill with N labeled subsections? When the answer is the latter, merge.
|
|
453
|
+
5. Judge overlap on CONTENT, not on usage counters.
|
|
454
|
+
6. Before archiving a merged skill, ensure its unique content was preserved in the umbrella.
|
|
455
|
+
|
|
456
|
+
How to work:
|
|
457
|
+
1. Scan the candidate list. Identify PREFIX CLUSTERS — skills sharing a first word or domain keyword (expect 10-25 clusters).
|
|
458
|
+
2. For each cluster with 2+ members, ask "what is the UMBRELLA CLASS these skills serve?" and consolidate:
|
|
459
|
+
a. MERGE INTO AN EXISTING UMBRELLA (patch a labeled section for each sibling's unique insight, then archive the siblings).
|
|
460
|
+
b. CREATE A NEW UMBRELLA SKILL.md covering the shared workflow with short labeled subsections, then archive the absorbed siblings.
|
|
461
|
+
c. DEMOTE session-specific detail to references/, templates/, or scripts/ under the umbrella.
|
|
462
|
+
3. Keep the umbrella body tight and scannable: exact commands, verbatim paths, ~100-200 lines; never invent flags or APIs.
|
|
463
|
+
|
|
464
|
+
Produce a YAML summary with exactly this shape:
|
|
465
|
+
consolidations:
|
|
466
|
+
- from: <old-skill-name>
|
|
467
|
+
into: <umbrella-skill-name>
|
|
468
|
+
reason: <one short sentence>
|
|
469
|
+
prunings:
|
|
470
|
+
- name: <skill-name>
|
|
471
|
+
reason: <one short sentence>
|
|
472
|
+
Nominate a pruning only when archival is clearly safe (stale AND genuinely obsolete or fully absorbed elsewhere).`;
|
|
473
|
+
const CURATOR_DRY_RUN_BANNER = `═══════════════════════════════════════════════════════════════
|
|
474
|
+
DRY-RUN — REPORT ONLY. DO NOT MUTATE THE SKILL LIBRARY.
|
|
475
|
+
═══════════════════════════════════════════════════════════════
|
|
476
|
+
|
|
477
|
+
This is a PREVIEW pass. Follow every instruction above EXCEPT:
|
|
478
|
+
• Do NOT call skill_manage with action=create, update, patch, delete, write_file, or remove_file.
|
|
479
|
+
• Do NOT move, copy, or rewrite any file under the skills tree.
|
|
480
|
+
|
|
481
|
+
Your output IS the deliverable: produce the exact same human-readable summary and YAML block you would on a live run, describing the actions you WOULD take. A reviewer will decide whether to approve a live run.
|
|
482
|
+
|
|
483
|
+
If you accidentally take a mutating action, say so explicitly in the summary.`;
|
|
484
|
+
const COMPLETION_SKILL_REVIEW_PROMPT = `[Auto-review — Skills · task complete]
|
|
485
|
+
Your current task now appears complete. Before wrapping up, review the approach and update the skill library via skill_manage.
|
|
486
|
+
|
|
487
|
+
Follow the skills review policy: be ACTIVE, prefer class-level umbrellas, patch skills loaded this session, and capture non-trivial techniques and user corrections. Do NOT capture environment-dependent failures, negative claims about tools, or one-off task narratives.
|
|
488
|
+
|
|
489
|
+
Do NOT modify output files or re-run the task. If you are still mid-task, ignore this.`;
|
|
490
|
+
function reviewPrompt(kind) {
|
|
491
|
+
if (kind === "memory") return MEMORY_REVIEW_PROMPT;
|
|
492
|
+
if (kind === "skill") return SKILL_REVIEW_PROMPT;
|
|
493
|
+
return COMBINED_REVIEW_PROMPT;
|
|
494
|
+
}
|
|
495
|
+
function sha256(text) {
|
|
496
|
+
return createHash("sha256").update(text).digest("hex");
|
|
497
|
+
}
|
|
498
|
+
function createPromptBundle(prompts) {
|
|
499
|
+
const canonical = JSON.stringify({
|
|
500
|
+
id: PROMPT_BUNDLE_ID,
|
|
501
|
+
version: 2,
|
|
502
|
+
prompts: Object.fromEntries(Object.entries(prompts).sort())
|
|
503
|
+
});
|
|
504
|
+
return Object.freeze({
|
|
505
|
+
id: PROMPT_BUNDLE_ID,
|
|
506
|
+
version: 2,
|
|
507
|
+
prompts: Object.freeze({ ...prompts }),
|
|
508
|
+
sha256: sha256(canonical)
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
const PROMPT_BUNDLE = createPromptBundle({
|
|
512
|
+
memory: MEMORY_REVIEW_PROMPT,
|
|
513
|
+
skill: SKILL_REVIEW_PROMPT,
|
|
514
|
+
combined: COMBINED_REVIEW_PROMPT,
|
|
515
|
+
curator: CURATOR_PROMPT,
|
|
516
|
+
completion: COMPLETION_SKILL_REVIEW_PROMPT
|
|
517
|
+
});
|
|
518
|
+
function verifyPromptBundle(bundle = PROMPT_BUNDLE) {
|
|
519
|
+
const canonical = JSON.stringify({
|
|
520
|
+
id: bundle.id,
|
|
521
|
+
version: bundle.version,
|
|
522
|
+
prompts: Object.fromEntries(Object.entries(bundle.prompts).sort())
|
|
523
|
+
});
|
|
524
|
+
return bundle.sha256 === sha256(canonical);
|
|
525
|
+
}
|
|
526
|
+
const DSH_AUTHORING_STANDARDS = `Follow the Hermes skill-authoring standards, translated to DSH tools.
|
|
527
|
+
|
|
528
|
+
Frontmatter:
|
|
529
|
+
- name: lowercase-hyphenated, <=64 chars, no spaces.
|
|
530
|
+
- description: ONE sentence, <=60 characters, ends with a period. State the capability, not the implementation. No marketing words. Do NOT repeat the skill name. Count the characters before saving.
|
|
531
|
+
- version: 0.1.0
|
|
532
|
+
- author: always the literal value "Hermes". NEVER fill it from the environment, git config, or any identity you can probe.
|
|
533
|
+
- platforms: declare [macos], [linux], and/or [windows] only when the skill is genuinely OS-bound; omit for portable skills.
|
|
534
|
+
- metadata.hermes.tags: a few Capitalized, Relevant, Tags.
|
|
535
|
+
|
|
536
|
+
Body section order (omit only when empty):
|
|
537
|
+
1. "# <Human Title>" then a 2-3 sentence intro: what it does, what it does NOT do, key dependency stance.
|
|
538
|
+
2. "## When to Use" — concrete trigger phrases.
|
|
539
|
+
3. "## Prerequisites" — exact env vars, install steps, credentials.
|
|
540
|
+
4. "## How to Run" — canonical invocation framed through DSH tools.
|
|
541
|
+
5. "## Quick Reference" — flat command/endpoint list.
|
|
542
|
+
6. "## Procedure" — numbered steps with copy-paste-exact commands.
|
|
543
|
+
7. "## Pitfalls" — known limits and rate limits.
|
|
544
|
+
8. "## Verification" — one check proving the skill worked.
|
|
545
|
+
|
|
546
|
+
DSH-tool framing:
|
|
547
|
+
- Reference DSH tools by name in backticks: \`bash\`, \`str_replace_editor\`, \`write\`, \`skill\`, \`skill_manage\`, \`memory\`.
|
|
548
|
+
- Do not name wrapped shell utilities when a DSH tool already covers them.
|
|
549
|
+
- Larger scripts belong under \`scripts/\` (written with \`skill_manage write_file\`) and are referenced from SKILL.md by relative path.
|
|
550
|
+
|
|
551
|
+
Quality bar:
|
|
552
|
+
- Prefer verbatim flags, paths, and APIs from the source. Never invent them.
|
|
553
|
+
- Keep it tight: ~100 lines simple, ~200 complex.
|
|
554
|
+
- No router/index/hub skills that only point at other skills.
|
|
555
|
+
- References go in \`references/\`, templates in \`templates/\`.`;
|
|
556
|
+
//#endregion
|
|
557
|
+
//#region lib/types/learn-prompt.js
|
|
558
|
+
/**
|
|
559
|
+
* Open-ended `/evolution learn` prompt builder.
|
|
560
|
+
*
|
|
561
|
+
* `learn` is open-ended: the user can name anything they can describe — a
|
|
562
|
+
* directory of code, an API doc URL, a workflow they just walked the agent
|
|
563
|
+
* through, or pasted notes. The prompt instructs the live agent to gather the
|
|
564
|
+
* named sources with its existing tools, then author a single SKILL.md via
|
|
565
|
+
* `skill_manage` following `DSH_AUTHORING_STANDARDS`. There is no separate
|
|
566
|
+
* distillation engine and no model-tool footprint.
|
|
567
|
+
*/
|
|
568
|
+
/**
|
|
569
|
+
* Build the agent prompt for an open-ended `/evolution learn` request.
|
|
570
|
+
*
|
|
571
|
+
* @param userRequest free-text the user gave after `/evolution learn`; an
|
|
572
|
+
* empty string falls back to "the workflow we just went through".
|
|
573
|
+
* @returns a complete instruction the agent runs as a normal turn.
|
|
574
|
+
*/
|
|
575
|
+
function buildLearnPrompt(userRequest) {
|
|
576
|
+
return [
|
|
577
|
+
"[/learn] The user wants you to learn a reusable skill from the request below, and save it.",
|
|
578
|
+
"",
|
|
579
|
+
"THE REQUEST:",
|
|
580
|
+
userRequest.trim() || "the workflow we just went through in this conversation — review the steps taken and distill them into a reusable skill",
|
|
581
|
+
"",
|
|
582
|
+
"The request is open-ended and may mix two kinds of content, in any order: SOURCES to gather (directories, file paths, URLs, \"what we just did\", pasted notes) AND REQUIREMENTS that shape the skill (what to focus on, what to leave out, scope, naming, the angle to take). Treat EVERY part of the request as load-bearing. In particular, prose that comes after a path or link is NOT incidental — it is the user telling you what they want from that source. A request like `<url> focus on the auth flow, skip the deprecated endpoints` means: gather the URL AND honor \"focus on auth, skip deprecated\" as authoring requirements. Never fetch the first source and ignore the rest.",
|
|
583
|
+
"",
|
|
584
|
+
"Do this:",
|
|
585
|
+
"1. Gather every source the user named, using the tools you already have — reads and searches for local files or directories, web access for URLs, this conversation history if they referred to something you just did, and the text they pasted as-is. If the request is ambiguous about scope, make a reasonable choice and note it; do not stall.",
|
|
586
|
+
"2. Author ONE SKILL.md, applying every requirement, focus, and constraint in the request — these govern what the SKILL.md covers and emphasizes, not just which sources you read.",
|
|
587
|
+
"3. Save it with the `skill_manage` tool (action=\"create\"). Pick a sensible category. If the procedure needs a non-trivial script, add it under the skill's `scripts/` with `skill_manage` write_file and reference it by relative path.",
|
|
588
|
+
"",
|
|
589
|
+
DSH_AUTHORING_STANDARDS,
|
|
590
|
+
"",
|
|
591
|
+
"When done, tell the user the skill name, its category, and a one-line summary of what it captured."
|
|
592
|
+
].join("\n");
|
|
593
|
+
}
|
|
594
|
+
//#endregion
|
|
380
595
|
//#region lib/types/threats.js
|
|
381
596
|
/**
|
|
382
597
|
* Threat scanning for agent-authored memory and skill content.
|
|
@@ -1048,183 +1263,6 @@ async function recordMutation(root, io, record, cap = 500) {
|
|
|
1048
1263
|
}, null, 2));
|
|
1049
1264
|
}
|
|
1050
1265
|
//#endregion
|
|
1051
|
-
//#region lib/types/prompts.js
|
|
1052
|
-
/**
|
|
1053
|
-
* Review and curation prompts adapted from Hermes Agent
|
|
1054
|
-
* `agent/background_review.py`, `agent/curator.py`, and
|
|
1055
|
-
* `agent/learn_prompt.py`, with tool names translated to the DSH-native
|
|
1056
|
-
* catalog (`memory`, `skill_manage`, `skill`, `bash`, `str_replace_editor`).
|
|
1057
|
-
*
|
|
1058
|
-
* Every prompt is pinned in a versioned bundle. Review workers verify the
|
|
1059
|
-
* bundle digest before spending a model call, so a partially-patched
|
|
1060
|
-
* deployment fails closed instead of silently running a truncated prompt.
|
|
1061
|
-
*/
|
|
1062
|
-
/**
|
|
1063
|
-
* Prompt bundle identity. Bump both id and version whenever a prompt's text
|
|
1064
|
-
* changes semantically: the bundle digest is the fail-closed signal for
|
|
1065
|
-
* review workers, so a stale id across deployments must be distinguishable.
|
|
1066
|
-
*/
|
|
1067
|
-
const PROMPT_BUNDLE_ID = "dsh-evolution@2";
|
|
1068
|
-
const PROMPT_BUNDLE_VERSION = 2;
|
|
1069
|
-
const MEMORY_REVIEW_PROMPT = `[Auto-review — Memory]
|
|
1070
|
-
Review the conversation above and consider saving to memory if appropriate.
|
|
1071
|
-
|
|
1072
|
-
Focus on:
|
|
1073
|
-
1. Has the user revealed things about themselves — persona, desires, preferences, or personal details worth remembering?
|
|
1074
|
-
2. Has the user expressed expectations about how you should behave, their work style, or ways they want you to operate?
|
|
1075
|
-
|
|
1076
|
-
If something stands out, save it using the memory tool.
|
|
1077
|
-
If nothing is worth saving, just say "Nothing to save." and stop.`;
|
|
1078
|
-
const SKILL_REVIEW_PROMPT = `[Auto-review — Skills]
|
|
1079
|
-
Review the conversation above and update the skill library. Be ACTIVE — most sessions produce at least one skill update, even if small.
|
|
1080
|
-
|
|
1081
|
-
Target shape: CLASS-LEVEL skills with a rich SKILL.md and a references/ directory for session-specific detail. Not a flat list of narrow one-session skills.
|
|
1082
|
-
|
|
1083
|
-
Signals that warrant action:
|
|
1084
|
-
- The user corrected your style, tone, format, verbosity, workflow, or approach.
|
|
1085
|
-
- A non-trivial technique, fix, workaround, or debugging path emerged.
|
|
1086
|
-
- A loaded skill turned out wrong, missing, or outdated — patch it now.
|
|
1087
|
-
|
|
1088
|
-
Preference order:
|
|
1089
|
-
1. Patch a skill that was loaded or read this session.
|
|
1090
|
-
2. Patch an existing umbrella skill.
|
|
1091
|
-
3. Add references/, templates/, or scripts/ support under an existing skill.
|
|
1092
|
-
4. Create a new class-level umbrella skill only when nothing fits.
|
|
1093
|
-
|
|
1094
|
-
Protected skills (bundled/hub-installed) must not be edited. Pinned skills may be patched but not archived.
|
|
1095
|
-
|
|
1096
|
-
Do NOT capture:
|
|
1097
|
-
- Environment-dependent failures (missing binaries, unconfigured credentials).
|
|
1098
|
-
- Negative claims about tools ("browser tools do not work").
|
|
1099
|
-
- Transient errors that resolved during the session.
|
|
1100
|
-
- One-off task narratives.
|
|
1101
|
-
|
|
1102
|
-
If a tool failed because of setup state, capture the FIX under an existing setup skill — never "this tool does not work" as a standalone constraint.
|
|
1103
|
-
|
|
1104
|
-
"Nothing to save." is a real option but should NOT be the default.`;
|
|
1105
|
-
const COMBINED_REVIEW_PROMPT = `[Auto-review]
|
|
1106
|
-
Review the conversation above and update two things.
|
|
1107
|
-
|
|
1108
|
-
**Memory**: who the user is. Save durable user preferences, personal details, and expectations with the memory tool.
|
|
1109
|
-
|
|
1110
|
-
**Skills**: how to do this class of task. Be ACTIVE. Follow the same class-level umbrella policy, preference order, protected-skill rules, and do-not-capture list as a skill review.
|
|
1111
|
-
|
|
1112
|
-
Act on whichever dimension has real signal. If genuinely nothing stands out on either, say "Nothing to save." and stop — but don't reach for that conclusion as a default.`;
|
|
1113
|
-
const CURATOR_PROMPT = `You are the skill curator. Maintain a healthy, class-level skill library, not a flat pile of narrow one-session skills.
|
|
1114
|
-
|
|
1115
|
-
The goal is a LIBRARY OF CLASS-LEVEL INSTRUCTIONS. A skill collection of many narrow skills where each captures one session's specific bug is a FAILURE of the library. An agent searching skills matches on descriptions, not exact names; one broad umbrella with labeled subsections beats five narrow siblings for discoverability.
|
|
1116
|
-
|
|
1117
|
-
Right target shape: class-level skills with rich SKILL.md + references/, templates/, scripts/ support files for session-specific detail.
|
|
1118
|
-
|
|
1119
|
-
Hard rules:
|
|
1120
|
-
1. NEVER hard-delete a skill. Archive (moving to .archive/) is the maximum destructive action; archives are recoverable, deletion is not.
|
|
1121
|
-
2. Do not touch bundled, hub-installed, pinned, or scheduled-task-referenced (\`referenced\`) skills. Referenced skills MAY be consolidated into an umbrella, but never simply pruned.
|
|
1122
|
-
3. Do not archive recently-created or never-used skills without strong evidence. "use=0" is NOT evidence either way — it only means the trigger has not come up yet.
|
|
1123
|
-
4. Do NOT reject consolidation on the grounds that "each skill has a distinct trigger". The right bar is: would a human maintainer write this as N separate skills, or one skill with N labeled subsections? When the answer is the latter, merge.
|
|
1124
|
-
5. Judge overlap on CONTENT, not on usage counters.
|
|
1125
|
-
6. Before archiving a merged skill, ensure its unique content was preserved in the umbrella.
|
|
1126
|
-
|
|
1127
|
-
How to work:
|
|
1128
|
-
1. Scan the candidate list. Identify PREFIX CLUSTERS — skills sharing a first word or domain keyword (expect 10-25 clusters).
|
|
1129
|
-
2. For each cluster with 2+ members, ask "what is the UMBRELLA CLASS these skills serve?" and consolidate:
|
|
1130
|
-
a. MERGE INTO AN EXISTING UMBRELLA (patch a labeled section for each sibling's unique insight, then archive the siblings).
|
|
1131
|
-
b. CREATE A NEW UMBRELLA SKILL.md covering the shared workflow with short labeled subsections, then archive the absorbed siblings.
|
|
1132
|
-
c. DEMOTE session-specific detail to references/, templates/, or scripts/ under the umbrella.
|
|
1133
|
-
3. Keep the umbrella body tight and scannable: exact commands, verbatim paths, ~100-200 lines; never invent flags or APIs.
|
|
1134
|
-
|
|
1135
|
-
Produce a YAML summary with exactly this shape:
|
|
1136
|
-
consolidations:
|
|
1137
|
-
- from: <old-skill-name>
|
|
1138
|
-
into: <umbrella-skill-name>
|
|
1139
|
-
reason: <one short sentence>
|
|
1140
|
-
prunings:
|
|
1141
|
-
- name: <skill-name>
|
|
1142
|
-
reason: <one short sentence>
|
|
1143
|
-
Nominate a pruning only when archival is clearly safe (stale AND genuinely obsolete or fully absorbed elsewhere).`;
|
|
1144
|
-
const CURATOR_DRY_RUN_BANNER = `═══════════════════════════════════════════════════════════════
|
|
1145
|
-
DRY-RUN — REPORT ONLY. DO NOT MUTATE THE SKILL LIBRARY.
|
|
1146
|
-
═══════════════════════════════════════════════════════════════
|
|
1147
|
-
|
|
1148
|
-
This is a PREVIEW pass. Follow every instruction above EXCEPT:
|
|
1149
|
-
• Do NOT call skill_manage with action=create, update, patch, delete, write_file, or remove_file.
|
|
1150
|
-
• Do NOT move, copy, or rewrite any file under the skills tree.
|
|
1151
|
-
|
|
1152
|
-
Your output IS the deliverable: produce the exact same human-readable summary and YAML block you would on a live run, describing the actions you WOULD take. A reviewer will decide whether to approve a live run.
|
|
1153
|
-
|
|
1154
|
-
If you accidentally take a mutating action, say so explicitly in the summary.`;
|
|
1155
|
-
const COMPLETION_SKILL_REVIEW_PROMPT = `[Auto-review — Skills · task complete]
|
|
1156
|
-
Your current task now appears complete. Before wrapping up, review the approach and update the skill library via skill_manage.
|
|
1157
|
-
|
|
1158
|
-
Follow the skills review policy: be ACTIVE, prefer class-level umbrellas, patch skills loaded this session, and capture non-trivial techniques and user corrections. Do NOT capture environment-dependent failures, negative claims about tools, or one-off task narratives.
|
|
1159
|
-
|
|
1160
|
-
Do NOT modify output files or re-run the task. If you are still mid-task, ignore this.`;
|
|
1161
|
-
function reviewPrompt(kind) {
|
|
1162
|
-
if (kind === "memory") return MEMORY_REVIEW_PROMPT;
|
|
1163
|
-
if (kind === "skill") return SKILL_REVIEW_PROMPT;
|
|
1164
|
-
return COMBINED_REVIEW_PROMPT;
|
|
1165
|
-
}
|
|
1166
|
-
function sha256(text) {
|
|
1167
|
-
return createHash("sha256").update(text).digest("hex");
|
|
1168
|
-
}
|
|
1169
|
-
function createPromptBundle(prompts) {
|
|
1170
|
-
const canonical = JSON.stringify({
|
|
1171
|
-
id: PROMPT_BUNDLE_ID,
|
|
1172
|
-
version: 2,
|
|
1173
|
-
prompts: Object.fromEntries(Object.entries(prompts).sort())
|
|
1174
|
-
});
|
|
1175
|
-
return Object.freeze({
|
|
1176
|
-
id: PROMPT_BUNDLE_ID,
|
|
1177
|
-
version: 2,
|
|
1178
|
-
prompts: Object.freeze({ ...prompts }),
|
|
1179
|
-
sha256: sha256(canonical)
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
const PROMPT_BUNDLE = createPromptBundle({
|
|
1183
|
-
memory: MEMORY_REVIEW_PROMPT,
|
|
1184
|
-
skill: SKILL_REVIEW_PROMPT,
|
|
1185
|
-
combined: COMBINED_REVIEW_PROMPT,
|
|
1186
|
-
curator: CURATOR_PROMPT,
|
|
1187
|
-
completion: COMPLETION_SKILL_REVIEW_PROMPT
|
|
1188
|
-
});
|
|
1189
|
-
function verifyPromptBundle(bundle = PROMPT_BUNDLE) {
|
|
1190
|
-
const canonical = JSON.stringify({
|
|
1191
|
-
id: bundle.id,
|
|
1192
|
-
version: bundle.version,
|
|
1193
|
-
prompts: Object.fromEntries(Object.entries(bundle.prompts).sort())
|
|
1194
|
-
});
|
|
1195
|
-
return bundle.sha256 === sha256(canonical);
|
|
1196
|
-
}
|
|
1197
|
-
const DSH_AUTHORING_STANDARDS = `Follow the Hermes skill-authoring standards, translated to DSH tools.
|
|
1198
|
-
|
|
1199
|
-
Frontmatter:
|
|
1200
|
-
- name: lowercase-hyphenated, <=64 chars, no spaces.
|
|
1201
|
-
- description: ONE sentence, <=60 characters, ends with a period. State the capability, not the implementation. No marketing words. Do NOT repeat the skill name. Count the characters before saving.
|
|
1202
|
-
- version: 0.1.0
|
|
1203
|
-
- author: always the literal value "Hermes". NEVER fill it from the environment, git config, or any identity you can probe.
|
|
1204
|
-
- platforms: declare [macos], [linux], and/or [windows] only when the skill is genuinely OS-bound; omit for portable skills.
|
|
1205
|
-
- metadata.hermes.tags: a few Capitalized, Relevant, Tags.
|
|
1206
|
-
|
|
1207
|
-
Body section order (omit only when empty):
|
|
1208
|
-
1. "# <Human Title>" then a 2-3 sentence intro: what it does, what it does NOT do, key dependency stance.
|
|
1209
|
-
2. "## When to Use" — concrete trigger phrases.
|
|
1210
|
-
3. "## Prerequisites" — exact env vars, install steps, credentials.
|
|
1211
|
-
4. "## How to Run" — canonical invocation framed through DSH tools.
|
|
1212
|
-
5. "## Quick Reference" — flat command/endpoint list.
|
|
1213
|
-
6. "## Procedure" — numbered steps with copy-paste-exact commands.
|
|
1214
|
-
7. "## Pitfalls" — known limits and rate limits.
|
|
1215
|
-
8. "## Verification" — one check proving the skill worked.
|
|
1216
|
-
|
|
1217
|
-
DSH-tool framing:
|
|
1218
|
-
- Reference DSH tools by name in backticks: \`bash\`, \`str_replace_editor\`, \`write\`, \`skill\`, \`skill_manage\`, \`memory\`.
|
|
1219
|
-
- Do not name wrapped shell utilities when a DSH tool already covers them.
|
|
1220
|
-
- Larger scripts belong under \`scripts/\` (written with \`skill_manage write_file\`) and are referenced from SKILL.md by relative path.
|
|
1221
|
-
|
|
1222
|
-
Quality bar:
|
|
1223
|
-
- Prefer verbatim flags, paths, and APIs from the source. Never invent them.
|
|
1224
|
-
- Keep it tight: ~100 lines simple, ~200 complex.
|
|
1225
|
-
- No router/index/hub skills that only point at other skills.
|
|
1226
|
-
- References go in \`references/\`, templates in \`templates/\`.`;
|
|
1227
|
-
//#endregion
|
|
1228
1266
|
//#region lib/types/quality.js
|
|
1229
1267
|
/**
|
|
1230
1268
|
* Quality scoring and near-duplicate detection for the curated skill library.
|
|
@@ -2144,4 +2182,4 @@ var JsonState = class JsonState {
|
|
|
2144
2182
|
}
|
|
2145
2183
|
};
|
|
2146
2184
|
//#endregion
|
|
2147
|
-
export { COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_USER_CHAR_LIMIT, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, JsonState, LOW_QUALITY_THRESHOLD, MAX_DESCRIPTION_LENGTH, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MEMORY_REVIEW_PROMPT, MUTATIONS_FILE_VERSION, MemoryStore, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, QUALITY_WEIGHTS, SKILL_NAME_RE, SKILL_REVIEW_PROMPT, SUPPORT_DIRS, SUPPRESSED_FILE_VERSION, SkillLibrary, advanceReview, buildCuratorRunReport, bumpPatch, bumpUse, bumpView, computeDedupGroups, computeLifecycleTransitions, computeQualityScores, contentHash, emptyRecord, evaluateThreat, evolutionHome, evolutionIoAdapter, foldTurn, getRecord, latestActivityAt, loadMutations, loadSuppressedNames, loadUsage, markAgentCreated, memoryRoot, mutationsFile, nodeEvolutionIo, observeEvent, parseCuratorNominations, parseFrontmatter, recordMutation, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, usageFile, validateFrontmatter, verifyPromptBundle };
|
|
2185
|
+
export { COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_USER_CHAR_LIMIT, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, JsonState, LOW_QUALITY_THRESHOLD, MAX_DESCRIPTION_LENGTH, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MEMORY_REVIEW_PROMPT, MUTATIONS_FILE_VERSION, MemoryStore, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, QUALITY_WEIGHTS, SKILL_NAME_RE, SKILL_REVIEW_PROMPT, SUPPORT_DIRS, SUPPRESSED_FILE_VERSION, SkillLibrary, advanceReview, buildCuratorRunReport, buildLearnPrompt, bumpPatch, bumpUse, bumpView, computeDedupGroups, computeLifecycleTransitions, computeQualityScores, contentHash, emptyRecord, evaluateThreat, evolutionHome, evolutionIoAdapter, foldTurn, getRecord, latestActivityAt, loadMutations, loadSuppressedNames, loadUsage, markAgentCreated, memoryRoot, mutationsFile, nodeEvolutionIo, observeEvent, parseCuratorNominations, parseFrontmatter, recordMutation, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, usageFile, validateFrontmatter, verifyPromptBundle };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open-ended `/evolution learn` prompt builder.
|
|
3
|
+
*
|
|
4
|
+
* `learn` is open-ended: the user can name anything they can describe — a
|
|
5
|
+
* directory of code, an API doc URL, a workflow they just walked the agent
|
|
6
|
+
* through, or pasted notes. The prompt instructs the live agent to gather the
|
|
7
|
+
* named sources with its existing tools, then author a single SKILL.md via
|
|
8
|
+
* `skill_manage` following `DSH_AUTHORING_STANDARDS`. There is no separate
|
|
9
|
+
* distillation engine and no model-tool footprint.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Build the agent prompt for an open-ended `/evolution learn` request.
|
|
13
|
+
*
|
|
14
|
+
* @param userRequest free-text the user gave after `/evolution learn`; an
|
|
15
|
+
* empty string falls back to "the workflow we just went through".
|
|
16
|
+
* @returns a complete instruction the agent runs as a normal turn.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildLearnPrompt(userRequest: string): string;
|
|
19
|
+
//# sourceMappingURL=learn-prompt.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-core",
|
|
3
3
|
"description": "Shared stores, prompts, signals and lifecycle logic for the dsh-evolution plugin family (community build)",
|
|
4
|
-
"version": "0.1.0-rc.
|
|
4
|
+
"version": "0.1.0-rc.24",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|