@lmzhen/dsh-evolution-core 0.3.9 → 0.3.11

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 CHANGED
@@ -999,7 +999,7 @@ async function readEvolutionTimeline(io, path) {
999
999
  * review workers, so a stale id across deployments must be distinguishable.
1000
1000
  */
1001
1001
  const PROMPT_BUNDLE_ID = "dsh-evolution@11";
1002
- const PROMPT_BUNDLE_VERSION = 11;
1002
+ const PROMPT_BUNDLE_VERSION = 12;
1003
1003
  const MEMORY_REVIEW_PROMPT = `[Auto-review — Memory]
1004
1004
  Review the conversation above and consider saving to memory if appropriate.
1005
1005
 
@@ -1206,10 +1206,10 @@ A. 域·碎片化
1206
1206
 
1207
1207
  B. 层·分层错位
1208
1208
  - B1 {signal:stamp_density}(阈值 {signal:stamp_density.threshold})或 {signal:body_size}(阈值 {signal:body_size.threshold})=over:按**三问判据**判锚/残留——① 该编号/时间戳是否被库内其他文件引用?② 除"何时产生/为何存在"外是否还承载信息?③ 删除是否影响任何跨文档检索?(①是且③是→锚;否则→残留候选,人审)。锚→允许保留 + needs_human + semantic_reasoning 写三问结果;**锚不使用 is_override**(is_override 仅用于 §7 申诉;锚是 B1 的正常裁决路径);残留→restructure 建议(movable headings 逐字引用)。**锚≠可读:单行 >4000 字符即使在锚类也必须拆分。**
1209
- - B2 {signal:pointer_missing}=over:读支持文件后判性质——可复用模式→上移正文;会话专属实录→保留+补指针;形态=patch 指引。**未读内容仅凭文件名 → conf≤0.4 且措辞"先人工确认再执行"。**
1209
+ - B2 {signal:pointer_missing}=over:读支持文件后判性质——可复用模式→上移正文;会话专属实录→保留+补指针;形态=patch 指引。**未读内容仅凭文件名 → conf≤0.4 且措辞"先人工确认再执行"。** **缺失指针=支持文件存在、正文无引用(单向语义),finding 表述勿反向。**
1210
1210
  - B3 {signal:dup_heading}=over:删除多余标题行(保留一份),patch 指引。
1211
1211
  - B4 {signal:overlong_line}=over:>1500 拆行;>4000 判定可读性危机(内容合法也拆);patch 指引。**finding 必须给全量口径:共 N 行超限,其中 >4000 的逐行列出。**
1212
- - B5 {signal:description_chars}=over:先判**性质**三分类——事件性承诺(单次故障/incident 写入元数据)→裁剪建议;叙事性自我描述→压缩建议;丰富但合规(完整用例边界)→保留 + is_override + override_reason="合法密度"。**第三类门槛(默认从严)**:只有能论证"60 字无法容纳该用例边界"(写明具体是什么边界、为什么 60 字装不下)才可判丰富合规;论证不出 → 压缩建议。semantic_reasoning 必写三分类之一(若第三类,附边界论证)。
1212
+ - B5 {signal:description_chars}=over:先判**性质**三分类——事件性承诺(单次故障/incident 写入元数据)→裁剪建议;叙事性自我描述→压缩建议;丰富但合规(完整用例边界)→保留 + is_override + override_reason="合法密度"。**分类特征**:含"恢复/修复某次事故、日期快照"类一次性措辞→事件性承诺;"动词+对象"式任务说明→叙事性;枚举完整用例边界且不可拆分→丰富合规。**第三类门槛(默认从严,半机械)**:先自行试写一个 ≤60 字压缩方案——能保留全部路由关键项(触发词+域)→ 不可判第三类(按压缩建议);只有试写失败(在 semantic_reasoning 列出试写方案与具体失败点)才可判丰富合规。描述文本可见(probe desc-text 或正文 frontmatter)时仍须三分类;仅长度可见 → conf≤0.4。semantic_reasoning 必写三分类之一。
1213
1213
 
1214
1214
  D. 库·整合纪律(计划形态约束)
1215
1215
  - D1 同类问题多处出现→合成一条 relationship-level 建议,不逐项输出。
@@ -1274,12 +1274,12 @@ function sha256(text) {
1274
1274
  function createPromptBundle(prompts) {
1275
1275
  const canonical = JSON.stringify({
1276
1276
  id: PROMPT_BUNDLE_ID,
1277
- version: 11,
1277
+ version: 12,
1278
1278
  prompts: Object.fromEntries(Object.entries(prompts).sort())
1279
1279
  });
1280
1280
  return Object.freeze({
1281
1281
  id: PROMPT_BUNDLE_ID,
1282
- version: 11,
1282
+ version: 12,
1283
1283
  prompts: Object.freeze({ ...prompts }),
1284
1284
  sha256: sha256(canonical)
1285
1285
  });
@@ -1296,10 +1296,10 @@ const PROMPT_BUNDLE = createPromptBundle({
1296
1296
  skillsGuidance: SKILLS_GUIDANCE
1297
1297
  });
1298
1298
  function verifyPromptBundle(bundle = PROMPT_BUNDLE) {
1299
- if (bundle.id !== "dsh-evolution@11" || bundle.version !== 11) return false;
1299
+ if (bundle.id !== "dsh-evolution@11" || bundle.version !== 12) return false;
1300
1300
  const canonical = JSON.stringify({
1301
1301
  id: PROMPT_BUNDLE_ID,
1302
- version: 11,
1302
+ version: 12,
1303
1303
  prompts: Object.fromEntries(Object.entries(bundle.prompts).sort())
1304
1304
  });
1305
1305
  return bundle.sha256 === sha256(canonical);
@@ -2521,6 +2521,127 @@ function parseFrontmatter(content) {
2521
2521
  body
2522
2522
  };
2523
2523
  }
2524
+ /** YAML plain-scalar hazards that make an UNQUOTED frontmatter value
2525
+ * unloadable to the platform catalog (strict YAML parser): `: ` (mapping
2526
+ * separator), ` #` (comment start), or a leading YAML indicator. The
2527
+ * evolution `parseFrontmatter` is deliberately lenient, so violations
2528
+ * silently split family-visibility from platform-visibility (0.3.11
2529
+ * inkos-harness case: the description carried "…: " and the catalog dropped
2530
+ * the whole skill). Already-quoted values and well-formed flow collections
2531
+ * (`[a, b]` / `{a: b}`) are considered safe. */
2532
+ function yamlPlainScalarNeedsQuotes(value) {
2533
+ if (value.length === 0) return false;
2534
+ if (value.length >= 2 && (value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'"))) return false;
2535
+ if (/^\[.*\]$/.test(value) || /^\{.*\}$/.test(value)) return false;
2536
+ if (value.includes(": ")) return true;
2537
+ if (value.includes(" #")) return true;
2538
+ if (/^[-?:,[\]{}#&*!|>'\"%@`\s]/.test(value)) return true;
2539
+ return false;
2540
+ }
2541
+ /** Raw-line scan of the frontmatter block: entries whose UNQUOTED value is
2542
+ * YAML-unsafe for the strict platform catalog. Operates on the ORIGINAL line
2543
+ * value (quotes included), so a value already wrapped by
2544
+ * `normalizeFrontmatter` is never re-flagged — one source with the write
2545
+ * path. Single-line entries only; lines with embedded line breaks skip. */
2546
+ function frontmatterYamlUnsafeValues(content) {
2547
+ const found = [];
2548
+ if (!content.trimStart().startsWith("---")) return found;
2549
+ const nl = content.includes("\r\n") ? "\r\n" : "\n";
2550
+ const lines = content.split(nl);
2551
+ if ((lines[0] ?? "").trim() !== "---") return found;
2552
+ let end = -1;
2553
+ for (let i = 1; i < lines.length; i++) {
2554
+ const line = lines[i];
2555
+ if (line === void 0) continue;
2556
+ if (line.trim() === "---") {
2557
+ end = i;
2558
+ break;
2559
+ }
2560
+ }
2561
+ if (end < 0) return found;
2562
+ for (let i = 1; i < end; i++) {
2563
+ const line = lines[i];
2564
+ if (line === void 0) continue;
2565
+ if (line.includes("\n") || line.includes("\r")) continue;
2566
+ const match = /^([A-Za-z0-9_-]+):\s*(.*)$/.exec(line);
2567
+ if (!match) continue;
2568
+ const key = match[1];
2569
+ const value = (match[2] ?? "").trim();
2570
+ if (key === void 0) continue;
2571
+ if (yamlPlainScalarNeedsQuotes(value)) found.push({
2572
+ key,
2573
+ value
2574
+ });
2575
+ }
2576
+ return found;
2577
+ }
2578
+ /**
2579
+ * Normalize a SKILL.md frontmatter block into catalog-loadable YAML: values
2580
+ * that YAML forbids unquoted get quotes — double quotes normally, single
2581
+ * quotes (with `''` doubling) when the value contains `"` or `\` (both legal
2582
+ * unescaped inside single-quoted YAML). Idempotent (a normalized block
2583
+ * passes through unchanged); only single-line `key: value` entries are
2584
+ * touched; body text is never modified; a key line carrying an embedded
2585
+ * line break (mixed ending styles) is left untouched rather than risking
2586
+ * continuation-line data loss. Line-ending style of the block is preserved.
2587
+ */
2588
+ function normalizeFrontmatter(content) {
2589
+ if (!content.trimStart().startsWith("---")) return {
2590
+ content,
2591
+ changed: false,
2592
+ fields: [],
2593
+ issues: []
2594
+ };
2595
+ const nl = content.includes("\r\n") ? "\r\n" : "\n";
2596
+ const lines = content.split(nl);
2597
+ if ((lines[0] ?? "").trim() !== "---") return {
2598
+ content,
2599
+ changed: false,
2600
+ fields: [],
2601
+ issues: []
2602
+ };
2603
+ let end = -1;
2604
+ for (let i = 1; i < lines.length; i++) {
2605
+ const line = lines[i];
2606
+ if (line === void 0) continue;
2607
+ if (line.trim() === "---") {
2608
+ end = i;
2609
+ break;
2610
+ }
2611
+ }
2612
+ if (end < 0) return {
2613
+ content,
2614
+ changed: false,
2615
+ fields: [],
2616
+ issues: []
2617
+ };
2618
+ const unsafe = new Map(frontmatterYamlUnsafeValues(content).map((entry) => [entry.key, entry.value]));
2619
+ const fields = [];
2620
+ const issues = [];
2621
+ let changed = false;
2622
+ for (let i = 1; i < end; i++) {
2623
+ const line = lines[i];
2624
+ if (line === void 0) continue;
2625
+ const match = /^([A-Za-z0-9_-]+):\s*(.*)$/.exec(line);
2626
+ if (!match) continue;
2627
+ const key = match[1];
2628
+ const value = unsafe.get(key ?? "");
2629
+ if (key === void 0 || value === void 0) continue;
2630
+ if (/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/.test(value)) {
2631
+ issues.push(`${key}: value contains control characters — clean them manually`);
2632
+ continue;
2633
+ }
2634
+ lines[i] = `${key}: ${value.includes("\"") || value.includes("\\") ? `'${value.replace(/'/g, "''")}'` : `"${value}"`}`;
2635
+ fields.push(key);
2636
+ changed = true;
2637
+ }
2638
+ return {
2639
+ content: changed ? lines.join(nl) : content,
2640
+ changed,
2641
+ fields,
2642
+ issues
2643
+ };
2644
+ }
2524
2645
  /**
2525
2646
  * Skill names referenced by a SKILL.md's `related_skills` frontmatter
2526
2647
  * (B-line G3, rc.44): the single parsing source for the quality references
@@ -2981,7 +3102,20 @@ var SkillLibrary = class {
2981
3102
  ok: false,
2982
3103
  message: validation
2983
3104
  };
2984
- const threat = scanContentThreats(content);
3105
+ const norm = normalizeFrontmatter(content);
3106
+ if (norm.issues.length > 0) return {
3107
+ ok: false,
3108
+ message: `Skill "${normalized}" frontmatter cannot be auto-fixed: ${norm.issues[0]} — wrap the value in double quotes and retry.`
3109
+ };
3110
+ const finalContent = norm.changed ? norm.content : content;
3111
+ if (norm.changed) {
3112
+ const revalidated = validateFrontmatter(finalContent, normalized, this.limits);
3113
+ if (revalidated) return {
3114
+ ok: false,
3115
+ message: revalidated
3116
+ };
3117
+ }
3118
+ const threat = scanContentThreats(finalContent);
2985
3119
  if (threat) return {
2986
3120
  ok: false,
2987
3121
  message: threat
@@ -2991,9 +3125,9 @@ var SkillLibrary = class {
2991
3125
  ok: false,
2992
3126
  message: `Skill "${normalized}" already exists.`
2993
3127
  };
2994
- await this.io.writeText(join(dir, "SKILL.md"), content.trimEnd() + "\n");
3128
+ await this.io.writeText(join(dir, "SKILL.md"), finalContent.trimEnd() + "\n");
2995
3129
  if (origin !== "foreground") await this.io.writeText(markerPath(dir, "hermes-managed"), "");
2996
- await this.audit(normalized, "create", null, content, "created");
3130
+ await this.audit(normalized, "create", null, finalContent, "created");
2997
3131
  this.notifyMutation({
2998
3132
  action: "create",
2999
3133
  name: normalized,
@@ -3002,7 +3136,8 @@ var SkillLibrary = class {
3002
3136
  return {
3003
3137
  ok: true,
3004
3138
  message: `Skill "${normalized}" created.`,
3005
- path: dir
3139
+ path: dir,
3140
+ ...norm.changed ? { normalizedFrontmatterFields: norm.fields } : {}
3006
3141
  };
3007
3142
  }
3008
3143
  async update(rawName, content, origin = "foreground") {
@@ -3028,13 +3163,26 @@ var SkillLibrary = class {
3028
3163
  ok: false,
3029
3164
  message: validation
3030
3165
  };
3031
- const threat = scanContentThreats(content);
3166
+ const norm = normalizeFrontmatter(content);
3167
+ if (norm.issues.length > 0) return {
3168
+ ok: false,
3169
+ message: `Skill "${name}" frontmatter cannot be auto-fixed: ${norm.issues[0]} — wrap the value in double quotes and retry.`
3170
+ };
3171
+ const finalContent = norm.changed ? norm.content : content;
3172
+ if (norm.changed) {
3173
+ const revalidated = validateFrontmatter(finalContent, name, this.limits);
3174
+ if (revalidated) return {
3175
+ ok: false,
3176
+ message: revalidated
3177
+ };
3178
+ }
3179
+ const threat = scanContentThreats(finalContent);
3032
3180
  if (threat) return {
3033
3181
  ok: false,
3034
3182
  message: threat
3035
3183
  };
3036
- await this.io.writeText(join(dir, "SKILL.md"), content.trimEnd() + "\n");
3037
- await this.audit(name, "update", md, content, "updated");
3184
+ await this.io.writeText(join(dir, "SKILL.md"), finalContent.trimEnd() + "\n");
3185
+ await this.audit(name, "update", md, finalContent, "updated");
3038
3186
  this.notifyMutation({
3039
3187
  action: "update",
3040
3188
  name,
@@ -3043,7 +3191,8 @@ var SkillLibrary = class {
3043
3191
  return {
3044
3192
  ok: true,
3045
3193
  message: `Skill "${name}" updated.`,
3046
- path: dir
3194
+ path: dir,
3195
+ ...norm.changed ? { normalizedFrontmatterFields: norm.fields } : {}
3047
3196
  };
3048
3197
  }
3049
3198
  async patch(rawName, oldString, newString, filePath = "", replaceAll = false, origin = "foreground") {
@@ -3085,28 +3234,44 @@ var SkillLibrary = class {
3085
3234
  ok: false,
3086
3235
  message: `Could not find old_string in "${name}/${patchLabel}". Use update for a full rewrite.`
3087
3236
  };
3237
+ let writeContent = patched;
3238
+ let normalizedFields;
3088
3239
  if (target === skillMd) {
3089
3240
  const validation = validateFrontmatter(patched, name, this.limits);
3090
3241
  if (validation) return {
3091
3242
  ok: false,
3092
3243
  message: `Patch rejected: ${validation}`
3093
3244
  };
3245
+ const norm = normalizeFrontmatter(patched);
3246
+ if (norm.issues.length > 0) return {
3247
+ ok: false,
3248
+ message: `Patch rejected: frontmatter cannot be auto-fixed (${norm.issues[0]}).`
3249
+ };
3250
+ if (norm.changed) {
3251
+ writeContent = norm.content;
3252
+ normalizedFields = norm.fields;
3253
+ const revalidated = validateFrontmatter(writeContent, name, this.limits);
3254
+ if (revalidated) return {
3255
+ ok: false,
3256
+ message: `Patch rejected: ${revalidated}`
3257
+ };
3258
+ }
3094
3259
  }
3095
- if (Buffer.byteLength(patched, "utf8") > this.limits.maxSkillFileBytes && target !== skillMd) return {
3260
+ if (Buffer.byteLength(writeContent, "utf8") > this.limits.maxSkillFileBytes && target !== skillMd) return {
3096
3261
  ok: false,
3097
3262
  message: `Patched file exceeds ${this.limits.maxSkillFileBytes} bytes.`
3098
3263
  };
3099
- if (patched.length > this.limits.maxSkillContentChars && target === skillMd) return {
3264
+ if (writeContent.length > this.limits.maxSkillContentChars && target === skillMd) return {
3100
3265
  ok: false,
3101
3266
  message: `Patched content exceeds ${this.limits.maxSkillContentChars} characters. Consider splitting into a smaller SKILL.md with supporting files.`
3102
3267
  };
3103
- const threat = scanContentThreats(patched);
3268
+ const threat = scanContentThreats(writeContent);
3104
3269
  if (threat) return {
3105
3270
  ok: false,
3106
3271
  message: threat
3107
3272
  };
3108
- await this.io.writeText(target, patched.trimEnd() + "\n");
3109
- await this.audit(name, "patch", md, patched, `patched ${patchLabel}`);
3273
+ await this.io.writeText(target, writeContent.trimEnd() + "\n");
3274
+ await this.audit(name, "patch", md, writeContent, `patched ${patchLabel}`);
3110
3275
  this.notifyMutation({
3111
3276
  action: "patch",
3112
3277
  name,
@@ -3115,7 +3280,8 @@ var SkillLibrary = class {
3115
3280
  return {
3116
3281
  ok: true,
3117
3282
  message: `Skill "${name}" patched (${patchLabel}).`,
3118
- path: dir
3283
+ path: dir,
3284
+ ...normalizedFields ? { normalizedFrontmatterFields: normalizedFields } : {}
3119
3285
  };
3120
3286
  }
3121
3287
  async archive(rawName, options = {}) {
@@ -3967,7 +4133,9 @@ function computeDriftSignals(snapshots) {
3967
4133
  signals.push(quality === null || quality === void 0 ? sig("quality_low", "unknown", "not-assessed") : sig("quality_low", quality < .3 ? "over" : "pass", quality.toFixed(2), `${LOW_QUALITY_THRESHOLD}`));
3968
4134
  return {
3969
4135
  name: snapshot.name,
3970
- signals
4136
+ signals,
4137
+ ...snapshot.protected !== void 0 && snapshot.protected !== null ? { protected: snapshot.protected } : {},
4138
+ ...snapshot.catalogInvalid !== void 0 ? { catalogInvalid: snapshot.catalogInvalid } : {}
3971
4139
  };
3972
4140
  })
3973
4141
  };
@@ -3986,4 +4154,4 @@ function evolutionHome(env = process.env) {
3986
4154
  return join(env.DSH_HOME ?? join(homedir(), ".dsh"), "evolution");
3987
4155
  }
3988
4156
  //#endregion
3989
- export { AUTHORING_DESCRIPTION_BAR, COMBINED_REVIEW_PLAN_PROMPT, COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_HEALTH_THRESHOLDS, 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, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, EVENT_ARCHIVE_PREFIX, EVENT_LOG_RETAIN_ARCHIVES, EVENT_LOG_ROTATE_AT, EVENT_LOG_VERSION, EvolutionGateSet, HEALTH_STAMP_RE, LOW_QUALITY_THRESHOLD, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_RESTRUCTURE_MOVES, 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, RESTRUCTURE_TARGET_RE, SKILLS_GUIDANCE, SKILL_NAME_RE, SKILL_REVIEW_PLAN_PROMPT, SKILL_REVIEW_PROMPT, SNAPSHOT_EXTRA_NAME_RE, SUPPORT_DIRS, SUPPRESSED_FILE_VERSION, SkillLibrary, advanceReview, appendEvolutionEvent, applyCuratorFields, applyCuratorLifecycleFields, applyCuratorMetaFields, assessStructureHealth, authoringFeedback, buildCuratorRunReport, buildLearnPrompt, bumpPatch, bumpUse, bumpView, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, duplicateHeadings, emptyRecord, evaluateThreat, eventsFile, evolutionHome, evolutionIoAdapter, findDriftSignal, foldCuratorFields, foldTurn, getRecord, latestActivityAt, lifecycleCandidate, listEventArchives, loadMutations, loadSuppressedNames, loadUsage, markAgentCreated, memoryRoot, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nodeEvolutionIo, normalizeUsageRecord, observeEvent, overlongLines, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, readEvolutionEvents, readEvolutionTimeline, recordMutation, redactSecrets, relatedSkillNames, renderCuratorReportMarkdown, resolveOrigins, retainEventArchives, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, transactIo, updateSuppressedNames, usageFile, usageObserved, validateFrontmatter, verifyPromptBundle };
4157
+ export { AUTHORING_DESCRIPTION_BAR, COMBINED_REVIEW_PLAN_PROMPT, COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_HEALTH_THRESHOLDS, 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, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, EVENT_ARCHIVE_PREFIX, EVENT_LOG_RETAIN_ARCHIVES, EVENT_LOG_ROTATE_AT, EVENT_LOG_VERSION, EvolutionGateSet, HEALTH_STAMP_RE, LOW_QUALITY_THRESHOLD, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_RESTRUCTURE_MOVES, 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, RESTRUCTURE_TARGET_RE, SKILLS_GUIDANCE, SKILL_NAME_RE, SKILL_REVIEW_PLAN_PROMPT, SKILL_REVIEW_PROMPT, SNAPSHOT_EXTRA_NAME_RE, SUPPORT_DIRS, SUPPRESSED_FILE_VERSION, SkillLibrary, advanceReview, appendEvolutionEvent, applyCuratorFields, applyCuratorLifecycleFields, applyCuratorMetaFields, assessStructureHealth, authoringFeedback, buildCuratorRunReport, buildLearnPrompt, bumpPatch, bumpUse, bumpView, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, duplicateHeadings, emptyRecord, evaluateThreat, eventsFile, evolutionHome, evolutionIoAdapter, findDriftSignal, foldCuratorFields, foldTurn, frontmatterYamlUnsafeValues, getRecord, latestActivityAt, lifecycleCandidate, listEventArchives, loadMutations, loadSuppressedNames, loadUsage, markAgentCreated, memoryRoot, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, observeEvent, overlongLines, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, readEvolutionEvents, readEvolutionTimeline, recordMutation, redactSecrets, relatedSkillNames, renderCuratorReportMarkdown, resolveOrigins, retainEventArchives, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, transactIo, updateSuppressedNames, usageFile, usageObserved, validateFrontmatter, verifyPromptBundle, yamlPlainScalarNeedsQuotes };
@@ -23,6 +23,10 @@ export interface DriftSkillSnapshot {
23
23
  quality?: number | null | undefined;
24
24
  /** Usage observation window status; null/undefined = unknown. */
25
25
  usageObserved?: boolean | null | undefined;
26
+ /** Protection marker (`bundled`/`hub-installed`/`pinned`), when known (0.3.11). */
27
+ protected?: string | null | undefined;
28
+ /** Frontmatter values the strict-YAML platform catalog cannot load (0.3.11). */
29
+ catalogInvalid?: boolean | undefined;
26
30
  }
27
31
  /** verdict=over means "relatively positioned above the threshold", never a violation. */
28
32
  export type DriftVerdict = 'pass' | 'over' | 'unknown';
@@ -39,6 +43,9 @@ export interface DriftSignal {
39
43
  export interface DriftSkillAssessment {
40
44
  name: string;
41
45
  signals: ReadonlyArray<DriftSignal>;
46
+ /** Passthrough from the snapshot (0.3.11): protection marker, catalog loadability. */
47
+ protected?: string | null | undefined;
48
+ catalogInvalid?: boolean | undefined;
42
49
  }
43
50
  export interface DriftReport {
44
51
  /** Library-wide signals (dedup_group, prefix_cluster, usage_observed). */
@@ -4,7 +4,7 @@
4
4
  * review workers, so a stale id across deployments must be distinguishable.
5
5
  */
6
6
  export declare const PROMPT_BUNDLE_ID = "dsh-evolution@11";
7
- export declare const PROMPT_BUNDLE_VERSION = 11;
7
+ export declare const PROMPT_BUNDLE_VERSION = 12;
8
8
  export declare const MEMORY_REVIEW_PROMPT = "[Auto-review \u2014 Memory]\nReview the conversation above and consider saving to memory if appropriate.\n\nFocus on:\n1. Has the user revealed things about themselves \u2014 persona, desires, preferences, or personal details worth remembering?\n2. Has the user expressed expectations about how you should behave, their work style, or ways they want you to operate?\n\nIf something stands out, save it using the memory tool.\nIf nothing is worth saving, just say \"Nothing to save.\" and stop.";
9
9
  export declare const SKILL_REVIEW_PROMPT = "[Auto-review \u2014 Skills]\nReview the conversation above and update the skill library. Be ACTIVE \u2014 most sessions produce at least one skill update, even if small. A pass that does nothing is a missed learning opportunity, not a neutral outcome.\n\nTarget shape of the library: CLASS-LEVEL skills, each with a rich SKILL.md and a references/ directory for session-specific detail. Not a long flat list of narrow one-session-one-skill entries. This shapes HOW you update, not WHETHER you update.\n\nSignals to look for (any one of these warrants action):\n \u2022 User corrected your style, tone, format, legibility, or verbosity. Frustration signals like 'stop doing X', 'this is too verbose', 'don't format like this', 'why are you explaining', 'just give me the answer', 'you always do Y and I hate it', or an explicit 'remember this' are FIRST-CLASS skill signals, not just memory signals. Update the relevant skill(s) to embed the preference so the next session starts already knowing.\n \u2022 User corrected your workflow, approach, or sequence of steps. Encode the correction as a pitfall or explicit step in the skill that governs that class of task.\n \u2022 Non-trivial technique, fix, workaround, debugging path, or tool-usage pattern emerged that a future session would benefit from. Capture it.\n \u2022 A skill that got loaded or consulted this session turned out to be wrong, missing a step, or outdated. Patch it NOW.\n\nRead-before-write (enforced by this channel): update, patch, delete, or write support files ONLY into skills you loaded or read in THIS session \u2014 ops on unread skills are dropped; CREATE of a brand-new umbrella is the only exception.\n\nPreference order \u2014 prefer the earliest action that fits, but do pick one when a signal above fired:\n 1. UPDATE A CURRENTLY-LOADED SKILL. Look back through the conversation for skills the user loaded or you read. If any of them covers the territory of the new learning, PATCH that one first. It is the skill that was in play, so it's the right one to extend.\n 2. UPDATE AN EXISTING UMBRELLA. If no loaded skill fits but an existing class-level skill does, patch it. Add a subsection, a pitfall, or broaden a trigger.\n 3. ADD A SUPPORT FILE under an existing umbrella. Skills can be packaged with three kinds of support files \u2014 use the right directory per kind:\n \u2022 references/<topic>.md \u2014 session-specific detail (error transcripts, reproduction recipes, provider quirks) AND condensed knowledge banks: quoted research, API docs, external authoritative excerpts, or domain notes you found while working on the problem. Write it concise and for the value of the task, not as a full mirror of upstream docs.\n \u2022 templates/<name>.<ext> \u2014 starter files meant to be copied and modified (boilerplate configs, scaffolding, a known-good example the agent can reproduce with modifications).\n \u2022 scripts/<name>.<ext> \u2014 statically re-runnable actions the skill can invoke directly (verification scripts, fixture generators, deterministic probes, anything the agent should run rather than hand-type each time).\n Add support files via skill_manage action=write_file with file_path starting 'references/', 'templates/', or 'scripts/'. The umbrella's SKILL.md should gain a one-line pointer to any new support file so future agents know it exists.\n 4. RESTRUCTURE a loaded skill whose body grew log-like \u2014 rc/sha/date-dense sections, session-detail spirals, or a fat body with no support files. Use skill_manage action=restructure with restructure: [{\"heading\": \"<the exact ## heading text>\", \"to_file\": \"references/<topic>.md\"}] \u2014 the ENTIRE ## section (from that heading to the next heading) moves into the support file and its position becomes a pointer line. The skill's name and directory never change. Only propose headings that exist verbatim in the body; never invent one, and never restructure a healthy small skill.\n 5. CREATE A NEW CLASS-LEVEL UMBRELLA SKILL when no existing skill covers the class. The name MUST be at the class level. The name MUST NOT be a specific PR number, error string, feature codename, library-alone name, or 'fix-X / debug-Y / audit-Z-today' session artifact. If the proposed name only makes sense for today's task, it's wrong \u2014 fall back to (1), (2), or (3).\n\nUser-preference embedding (important): when the user expressed a style/format/workflow preference, the update belongs in the SKILL.md body, not just in memory. Memory captures 'who the user is and what the current situation and state of your operations are'; skills capture 'how to do this class of task for this user'. When they complain about how you handled a task, the skill that governs that task needs to carry the lesson.\n\nIf you notice two existing skills that overlap, note it in your reply \u2014 the background curator handles consolidation at scale.\n\nTwo-tier deposition discipline (DSH addition, same spirit as the umbrella rule): before writing, classify the knowledge:\n \u2022 PATTERN (reusable \u2014 symptom \u2192 mechanism \u2192 fix \u2192 verification, still valuable next session) belongs in the SKILL.md body.\n \u2022 LOG (one-off \u2014 commit SHAs, npm/profile states, what this release changed, this session's process narrative) belongs in a references/ file, never the body. Body density IS reuse rate. Keep new entries tight: a pattern fits in 2-8 physical lines; prefer changing the current-state pointer over appending history.\n\nProtected skills (DO NOT edit these):\n \u2022 Bundled skills (shipped with the platform).\n \u2022 Hub-installed skills (installed from a hub).\nPinned skills are read-only to THIS background review pass \u2014 the pinned write guard refuses background changes, so only the foreground may update or archive them. Foreground and delegated-subagent writes to pinned skills remain allowed.\nIf the only skills that need updating are protected, say 'Nothing to save.' and stop.\n\nDo NOT capture (these become persistent self-imposed constraints that bite you later when the environment changes):\n \u2022 Environment-dependent failures: missing binaries, fresh-install errors, post-migration path mismatches, 'command not found', unconfigured credentials, uninstalled packages. The user can fix these \u2014 they are not durable rules.\n \u2022 Negative claims about tools or features ('browser tools do not work', 'X tool is broken', 'cannot use Y'). These harden into refusals the agent cites against itself for months after the actual problem was fixed.\n \u2022 Session-specific transient errors that resolved before the conversation ended. If retrying worked, the lesson is the retry pattern, not the original failure.\n \u2022 One-off task narratives. A user asking 'summarize today's market' or 'analyze this PR' is not a class of work that warrants a skill.\n\nIf a tool failed because of setup state, capture the FIX (install command, config step, env var to set) under an existing setup or troubleshooting skill \u2014 never 'this tool does not work' as a standalone constraint.\n\n'Nothing to save.' is a real option but should NOT be the default. If the session ran smoothly with no corrections and produced no new technique, just say 'Nothing to save.' and stop. Otherwise, act.";
10
10
  export declare const COMBINED_REVIEW_PROMPT = "[Auto-review]\nReview the conversation above and update two things:\n\n**Memory**: who the user is. Did the user reveal persona, desires, preferences, personal details, or expectations about how you should behave? Save facts about the user and durable preferences with the memory tool.\n\n**Skills**: how to do this class of task. Be ACTIVE \u2014 most sessions produce at least one skill update. A pass that does nothing is a missed learning opportunity, not a neutral outcome.\n\nTarget shape of the skill library: CLASS-LEVEL skills with a rich SKILL.md and a references/ directory for session-specific detail. Not a long flat list of narrow one-session-one-skill entries.\n\nSignals that warrant a skill update (any one is enough):\n \u2022 User corrected your style, tone, format, legibility, verbosity, or approach. Frustration is a FIRST-CLASS skill signal, not just a memory signal. 'stop doing X', 'don't format like this', 'I hate when you Y' \u2014 embed the lesson in the skill that governs that task so the next session starts fixed.\n \u2022 Non-trivial technique, fix, workaround, or debugging path emerged.\n \u2022 A skill that was loaded or consulted turned out wrong, missing, or outdated \u2014 patch it now.\n\nRead-before-write (enforced by this channel): update, patch, delete, or write support files ONLY into skills you loaded or read in THIS session \u2014 ops on unread skills are dropped; CREATE of a brand-new umbrella is the only exception.\n\nPreference order for skills \u2014 pick the earliest that fits:\n 1. UPDATE A CURRENTLY-LOADED SKILL. Check what skills were loaded or read in the conversation. If one of them covers the learning, PATCH it first. It was in play; it's the right place.\n 2. UPDATE AN EXISTING UMBRELLA. Patch it.\n 3. ADD A SUPPORT FILE under an existing umbrella via skill_manage action=write_file. Three kinds: references/<topic>.md for session-specific detail OR condensed knowledge banks (quoted research, API docs excerpts, domain notes) written concise and task-focused; templates/<name>.<ext> for starter files meant to be copied and modified; scripts/<name>.<ext> for statically re-runnable actions (verification, fixture generators, probes). Add a one-line pointer in SKILL.md so future agents find them.\n 4. RESTRUCTURE a loaded skill whose body grew log-like (rc/sha/date-dense sections, session-detail spirals, fat body with no support files) via skill_manage action=restructure with restructure: [{\"heading\": \"<the exact ## heading text>\", \"to_file\": \"references/<topic>.md\"}] \u2014 the ENTIRE ## section moves into the support file and its position becomes a pointer line; the skill's name and directory never change. Only propose headings that exist verbatim in the body.\n 5. CREATE A NEW CLASS-LEVEL UMBRELLA when nothing exists. Name at the class level \u2014 NOT a PR number, error string, codename, library-alone name, or 'fix-X / debug-Y' session artifact. If the name only fits today's task, fall back to (1), (2), or (3).\n\nTwo-tier deposition discipline (DSH addition): classify before writing \u2014 PATTERN (symptom \u2192 mechanism \u2192 fix \u2192 verification) goes in the SKILL.md body; LOG (commit SHAs, npm/profile states, this release's change list, this session's narrative) goes in a references/ file. Body density IS reuse rate; a pattern fits in 2-8 physical lines.\n\nUser-preference embedding: when the user complains about how you handled a task, update the skill that governs that task \u2014 memory alone isn't enough. Memory says 'who the user is and what the current situation and state of your operations are'; skills say 'how to do this class of task for this user'. Both should carry user-preference lessons when relevant.\n\nIf you notice overlapping existing skills, mention it \u2014 the background curator handles consolidation.\n\nProtected skills (DO NOT edit these):\n \u2022 Bundled skills (shipped with the platform).\n \u2022 Hub-installed skills (installed from a hub).\nPinned skills are read-only to THIS background review pass \u2014 the pinned write guard refuses background changes, so only the foreground may update or archive them. Foreground and delegated-subagent writes to pinned skills remain allowed.\nIf the only skills that need updating are protected, say 'Nothing to save.' and stop.\n\nDo NOT capture as skills (these become persistent self-imposed constraints that bite you later when the environment changes):\n \u2022 Environment-dependent failures: missing binaries, fresh-install errors, post-migration path mismatches, 'command not found', unconfigured credentials, uninstalled packages. The user can fix these \u2014 they are not durable rules.\n \u2022 Negative claims about tools or features ('browser tools do not work', 'X tool is broken', 'cannot use Y'). These harden into refusals the agent cites against itself for months after the actual problem was fixed.\n \u2022 Session-specific transient errors that resolved before the conversation ended. If retrying worked, the lesson is the retry pattern, not the original failure.\n \u2022 One-off task narratives. A user asking 'summarize today's market' or 'analyze this PR' is not a class of work that warrants a skill.\n\nIf a tool failed because of setup state, capture the FIX (install command, config step, env var to set) under an existing setup or troubleshooting skill \u2014 never 'this tool does not work' as a standalone constraint.\n\nAct on whichever of the two dimensions has real signal. If genuinely nothing stands out on either, say 'Nothing to save.' and stop \u2014 but don't reach for that conclusion as a default.";
@@ -18,7 +18,7 @@ export declare const COMPLETION_SKILL_REVIEW_PROMPT = "[Auto-review \u2014 Skill
18
18
  * persona + the mechanical-facts block; the signature head lets the model
19
19
  * compare the two heads (011 mismatch protocol).
20
20
  */
21
- export declare const MAINTAIN_PROMPT = "<<<MAINTAIN_PROMPT v={bundle_version} sig={joint_signature}>>>\n\n## \u89D2\u8272\n\u4F60\u662F\u6280\u80FD\u5E93\u7684**\u5916\u90E8\u5BA1\u8BA1\u8005**\uFF1A\u53EA\u8BFB\u3001\u53EA\u8F93\u51FA\u8BA1\u5212\u3001\u4ECE\u4E0D\u6267\u884C\uFF08\u6267\u884C\u7531\u7528\u6237\u547D\u4EE4\u4E0E\u5BA1\u6279\u5B8C\u6210\uFF09\u3002\n\n## 1. \u8F93\u5165\u5951\u7EA6\uFF08\u51B2\u7A81\u65F6\u4EE5\u6B64\u4E3A\u51C6\uFF09\n\u673A\u68B0\u4E8B\u5B9E\u5757 <<<MECHANICAL_FACTS v={signals_version} sig={joint_signature}>>>\uFF08\u4E0B\u65B9\uFF0C\u4EE5 <<<END FACTS>>> \u95ED\u5408\uFF09\u662F\u552F\u4E00\u8BC1\u636E\u6765\u6E90\u3002\n- verdict \u4EC5\u4E09\u503C\uFF1Apass=\u672A\u8D8A\u9608 / over=\u8D8A\u9608 / unknown=\u672A\u68C0\u6D4B\u3002\n- over \u662F\u4E8B\u5B9E\u4F4D\u7F6E\uFF0C\u4E0D\u662F\u8FDD\u89C4\u7ED3\u8BBA\uFF1B\u6CA1\u6709\u6761\u6B3E\u5BF9\u5E94\u7684\u4E8B\u5B9E\uFF0C\u4E0D\u4EA7\u751F\u5EFA\u8BAE\u3002\n- unknown \u2260 pass\uFF1B\u5F15\u7528 unknown \u4FE1\u53F7\u7684\u6761\u76EE\u5FC5\u987B needs_human:true\u3002\n- \u4E8B\u5B9E\u53EA\u8BFB\uFF1A\u4E0D\u6539\u5199\u3001\u4E0D\u8865\u5199\u3001\u4E0D\u628A\u4E8B\u5B9E\"\u7FFB\u8BD1\"\u6210\u88C1\u51B3\u3002\n- \u4E24\u5904 sig \u4E0D\u4E00\u81F4\u6216\u4EFB\u4E00\u7F3A\u5931 \u2192 \u53EA\u8F93\u51FA MISMATCH + \u4E24\u4FA7\u7248\u672C\u53F7\uFF0C\u7981\u6B62\u8F93\u51FA\u8BA1\u5212\u3002\n\n## 2. \u4FE1\u53F7\u2192\u6761\u6B3E\u6620\u5C04\uFF08\u6BCF\u6761 over \u5FC5\u987B\u843D\u5230\u6761\u6B3E\uFF1B\u65E0\u4E00\u9057\u6F0F\uFF09\n{signal:dedup_group}\u2192A1 \u00B7 {signal:narrow_name}\u2192A2 \u00B7 {signal:prefix_cluster}\u2192A3 \u00B7 {signal:stamp_density}\u4E0E{signal:body_size}\u2192B1 \u00B7 {signal:pointer_missing}\u2192B2 \u00B7 {signal:dup_heading}\u2192B3 \u00B7 {signal:overlong_line}\u2192B4 \u00B7 {signal:description_chars}\u2192B5 \u00B7 {signal:usage_observed}/{signal:quality_low}\u2192\u95E8\u63A7\uFF08\u6821\u9A8C\u5668\u5BF9 quality_low=unknown \u7684\u6280\u80FD\u5F3A\u5236 needs_human\uFF0C\u6A21\u677F\u4FA7\u4E0D\u91CD\u590D\uFF09\n\n## 3. \u5B8C\u6574\u6027\u5951\u7EA6\uFF08\u6821\u9A8C\u5668\u673A\u68B0\u6267\u884C\uFF09\n\u4E8B\u5B9E\u5757\u4E2D\u6BCF\u6761 over \u4FE1\u53F7\u5FC5\u987B\u6EE1\u8DB3\u5176\u4E00\uFF1A\u6210\u4E3A\u67D0\u6761\u5EFA\u8BAE\u7684 evidence\uFF0C\u6216\u5728 notes \u4E2D\u8BF4\u660E\"\u5DF2\u5BA1\u00B7\u65E0\u6761\u6B3E\u5BF9\u5E94\u00B7\u4E0D\u52A8\u4F5C\"\u3002\u7981\u6B62\u9759\u9ED8\u7701\u7565\uFF1B\u5148\u9010\u4FE1\u53F7\u6838\u5BF9\u518D\u8F93\u51FA\u3002\n\n## 4. \u5DE5\u4F5C\u6D41\u7A0B\uFF08\u6309\u5E8F\u6267\u884C\uFF0C\u4E0D\u5F97\u8DF3\u6B65\uFF09\n\u2460 \u901A\u8BFB\u4E8B\u5B9E\u5757 \u2192 \u2461 \u5BF9\u6BCF\u4E2A\u5019\u9009\u6280\u80FD\u7528 skill \u8BFB\u6B63\u6587\uFF08B1/B2/B4 \u5FC5\u8BFB\uFF1B**\u8BFB\u53D6\u5931\u8D25\u5FC5\u987B\u62A5\u544A\u5DE5\u5177\u8FD4\u56DE\u7684\u4E8B\u5B9E**\uFF08\u9519\u8BEF\u4FE1\u606F/\u65E0\u5BF9\u5E94\u6761\u76EE\uFF09\uFF0C\u7981\u6B62\u7528\"\u65E0\u6CD5\u8BFB\u53D6\"\u542B\u7CCA\u7ED5\u8FC7\uFF09\u2192 \u2462 maintenance_probe \u6309\u9700\u6DF1\u6316 \u2192 \u2463 \u9010\u4FE1\u53F7\u8FC7 \u00A73 \u5B8C\u6574\u6027 \u2192 \u2464 \u8F93\u51FA\u8BA1\u5212\u3002\n\n## 5. \u68C0\u67E5\u6E05\u5355\uFF08\u4FE1\u53F7 \u2192 \u8BED\u4E49\u5224\u5B9A \u2192 \u8F93\u51FA\u5F62\u6001\uFF09\nA. \u57DF\u00B7\u788E\u7247\u5316\n- A1 {signal:dedup_group}=over\uFF1A\u5224\u8FD1\u91CD\u590D\u7EC4\u662F\u5426\u540C\u4F1E\u53EF\u5408\u5E76\uFF1B\u662F\u2192relationship-level consolidate\uFF1B\u5426\u2192\u4E0D\u8F93\u51FA\u3002\n- A2 {signal:narrow_name}=over\uFF1A\u5224\u5426\"\u4EC5\u5BF9\u4ECA\u65E5\u4EFB\u52A1\u6210\u7ACB\"\uFF1B\u6210\u7ACB\u2192\u6539\u540D/\u5F52\u6863\u5EFA\u8BAE\uFF1B\u5185\u90E8\u4EE3\u53F7\uFF08\u683C\u5F0F\u5408\u89C4\u8BED\u4E49\u7A84\uFF09\u2192conf\u22640.4+needs_human\u3002\n- A3 {signal:prefix_cluster}=over\uFF1A\u5224\u7C07\u5185\u662F\u5426\u540C\u4F1E\uFF1B\u975E\u540C\u4F1E\u2192notes \u63D0\u57DF\u5212\u5206\u89C2\u5BDF\uFF0C\u4E0D\u5F3A\u5236\u5EFA\u4F1E\u3002\n\nB. \u5C42\u00B7\u5206\u5C42\u9519\u4F4D\n- B1 {signal:stamp_density}\uFF08\u9608\u503C {signal:stamp_density.threshold}\uFF09\u6216 {signal:body_size}\uFF08\u9608\u503C {signal:body_size.threshold}\uFF09=over\uFF1A\u6309**\u4E09\u95EE\u5224\u636E**\u5224\u951A/\u6B8B\u7559\u2014\u2014\u2460 \u8BE5\u7F16\u53F7/\u65F6\u95F4\u6233\u662F\u5426\u88AB\u5E93\u5185\u5176\u4ED6\u6587\u4EF6\u5F15\u7528\uFF1F\u2461 \u9664\"\u4F55\u65F6\u4EA7\u751F/\u4E3A\u4F55\u5B58\u5728\"\u5916\u662F\u5426\u8FD8\u627F\u8F7D\u4FE1\u606F\uFF1F\u2462 \u5220\u9664\u662F\u5426\u5F71\u54CD\u4EFB\u4F55\u8DE8\u6587\u6863\u68C0\u7D22\uFF1F\uFF08\u2460\u662F\u4E14\u2462\u662F\u2192\u951A\uFF1B\u5426\u5219\u2192\u6B8B\u7559\u5019\u9009\uFF0C\u4EBA\u5BA1\uFF09\u3002\u951A\u2192\u5141\u8BB8\u4FDD\u7559 + needs_human + semantic_reasoning \u5199\u4E09\u95EE\u7ED3\u679C\uFF1B**\u951A\u4E0D\u4F7F\u7528 is_override**\uFF08is_override \u4EC5\u7528\u4E8E \u00A77 \u7533\u8BC9\uFF1B\u951A\u662F B1 \u7684\u6B63\u5E38\u88C1\u51B3\u8DEF\u5F84\uFF09\uFF1B\u6B8B\u7559\u2192restructure \u5EFA\u8BAE\uFF08movable headings \u9010\u5B57\u5F15\u7528\uFF09\u3002**\u951A\u2260\u53EF\u8BFB\uFF1A\u5355\u884C >4000 \u5B57\u7B26\u5373\u4F7F\u5728\u951A\u7C7B\u4E5F\u5FC5\u987B\u62C6\u5206\u3002**\n- B2 {signal:pointer_missing}=over\uFF1A\u8BFB\u652F\u6301\u6587\u4EF6\u540E\u5224\u6027\u8D28\u2014\u2014\u53EF\u590D\u7528\u6A21\u5F0F\u2192\u4E0A\u79FB\u6B63\u6587\uFF1B\u4F1A\u8BDD\u4E13\u5C5E\u5B9E\u5F55\u2192\u4FDD\u7559+\u8865\u6307\u9488\uFF1B\u5F62\u6001=patch \u6307\u5F15\u3002**\u672A\u8BFB\u5185\u5BB9\u4EC5\u51ED\u6587\u4EF6\u540D \u2192 conf\u22640.4 \u4E14\u63AA\u8F9E\"\u5148\u4EBA\u5DE5\u786E\u8BA4\u518D\u6267\u884C\"\u3002**\n- B3 {signal:dup_heading}=over\uFF1A\u5220\u9664\u591A\u4F59\u6807\u9898\u884C\uFF08\u4FDD\u7559\u4E00\u4EFD\uFF09\uFF0Cpatch \u6307\u5F15\u3002\n- B4 {signal:overlong_line}=over\uFF1A>1500 \u62C6\u884C\uFF1B>4000 \u5224\u5B9A\u53EF\u8BFB\u6027\u5371\u673A\uFF08\u5185\u5BB9\u5408\u6CD5\u4E5F\u62C6\uFF09\uFF1Bpatch \u6307\u5F15\u3002**finding \u5FC5\u987B\u7ED9\u5168\u91CF\u53E3\u5F84\uFF1A\u5171 N \u884C\u8D85\u9650\uFF0C\u5176\u4E2D >4000 \u7684\u9010\u884C\u5217\u51FA\u3002**\n- B5 {signal:description_chars}=over\uFF1A\u5148\u5224**\u6027\u8D28**\u4E09\u5206\u7C7B\u2014\u2014\u4E8B\u4EF6\u6027\u627F\u8BFA\uFF08\u5355\u6B21\u6545\u969C/incident \u5199\u5165\u5143\u6570\u636E\uFF09\u2192\u88C1\u526A\u5EFA\u8BAE\uFF1B\u53D9\u4E8B\u6027\u81EA\u6211\u63CF\u8FF0\u2192\u538B\u7F29\u5EFA\u8BAE\uFF1B\u4E30\u5BCC\u4F46\u5408\u89C4\uFF08\u5B8C\u6574\u7528\u4F8B\u8FB9\u754C\uFF09\u2192\u4FDD\u7559 + is_override + override_reason=\"\u5408\u6CD5\u5BC6\u5EA6\"\u3002**\u7B2C\u4E09\u7C7B\u95E8\u69DB\uFF08\u9ED8\u8BA4\u4ECE\u4E25\uFF09**\uFF1A\u53EA\u6709\u80FD\u8BBA\u8BC1\"60 \u5B57\u65E0\u6CD5\u5BB9\u7EB3\u8BE5\u7528\u4F8B\u8FB9\u754C\"\uFF08\u5199\u660E\u5177\u4F53\u662F\u4EC0\u4E48\u8FB9\u754C\u3001\u4E3A\u4EC0\u4E48 60 \u5B57\u88C5\u4E0D\u4E0B\uFF09\u624D\u53EF\u5224\u4E30\u5BCC\u5408\u89C4\uFF1B\u8BBA\u8BC1\u4E0D\u51FA \u2192 \u538B\u7F29\u5EFA\u8BAE\u3002semantic_reasoning \u5FC5\u5199\u4E09\u5206\u7C7B\u4E4B\u4E00\uFF08\u82E5\u7B2C\u4E09\u7C7B\uFF0C\u9644\u8FB9\u754C\u8BBA\u8BC1\uFF09\u3002\n\nD. \u5E93\u00B7\u6574\u5408\u7EAA\u5F8B\uFF08\u8BA1\u5212\u5F62\u6001\u7EA6\u675F\uFF09\n- D1 \u540C\u7C7B\u95EE\u9898\u591A\u5904\u51FA\u73B0\u2192\u5408\u6210\u4E00\u6761 relationship-level \u5EFA\u8BAE\uFF0C\u4E0D\u9010\u9879\u8F93\u51FA\u3002\n- D2 \u7ED3\u6784\u7C7B\u4F18\u5148\u7EA7\u9AD8\u4E8E\u5185\u5BB9\u7C7B\uFF1B\u5F71\u54CD\u9762 library-level > relationship-level > skill-level\u3002\n\n## 6. \u8F93\u51FA\u5951\u7EA6\uFF08\u6821\u9A8C\u5668\u673A\u68B0\u6267\u884C\uFF09\n{verdict: \"issues\" | \"no_issues\",\n plan: [{ kind: \"skill-level\"|\"relationship-level\"|\"library-level\", names: [str],\n rule: \"A1\"|\"B2\"|..., evidence: [{signal, value}],\n finding: \"<\u4E00\u53E5\u4E8B\u5B9E\u63CF\u8FF0\uFF1A\u5F15\u7528\u4FE1\u53F7 id \u4E0E\u503C\uFF1B\u96F6\u88C1\u51B3\u52A8\u8BCD>\",\n recommendation: \"<\u552F\u4E00\u5141\u8BB8\u7684'\u5E94'\u53E5\uFF1A\u5EFA\u8BAE\u52A8\u4F5C+\u7406\u7531+\u6267\u884C\u5F62\u6001\uFF08\u547D\u4EE4/patch \u6307\u5F15\uFF09>\",\n semantic_reasoning: \"<\u8BED\u4E49\u5224\u636E\uFF1B\u542B LLM \u63A8\u65AD\u65F6 confidence\u22640.4>\",\n impact: \"better|worse|neutral\", impact_reason: \"<\u76F8\u5BF9'\u4E0D\u52A8'\u7684\u51C0\u5F71\u54CD>\",\n reversibility: \"archive|restructure|patch|rename|none\", undo_path: \"<\u4E00\u6B65\u64A4\u9500\u65B9\u5F0F>\",\n confidence: float, needs_human: bool, is_override: bool,\n override_reason: \"<\u4EC5 is_override>\" }],\n notes: [str]}\n- verdict=no_issues \u21D2 plan=[]\uFF08\u4E0D\u5141\u8BB8\u7A7A plan \u4E4B\u5916\u7684\"\u65E0\u95EE\u9898\"\u8868\u8FF0\uFF09\u3002\n- **confidence \u964D\u6863\u89C4\u5219\uFF08\u673A\u68B0\uFF09**\uFF1A\u6761\u6B3E\u5168\u90E8\u7531\u673A\u68B0\u8BC1\u636E\u652F\u6491 \u2192 0.6\u20130.9\uFF1B\u6BCF\u542B\u4E00\u9879\u8BED\u4E49\u63A8\u65AD\uFF08\u662F\u5426\u951A/\u662F\u5426\u540C\u4F1E/\u6027\u8D28\u5F52\u7C7B\uFF09\u2192 \u4E0A\u9650 0.4\u3002\n- needs_human = (confidence < 0.6) OR (\u4E0D\u53EF\u9006) OR (is_override) OR (\u5F15\u7528 unknown \u4FE1\u53F7)\u3002\n- \u8BED\u8A00\uFF1Afinding/recommendation/notes \u4E0E\u5E93\u6B63\u6587\u4E00\u81F4\uFF08\u4E2D\u6587\uFF09\uFF1B\u5B57\u6BB5\u540D/\u4FE1\u53F7 id/\u679A\u4E3E\u4FDD\u7559\u82F1\u6587\u3002\n- **\u63D0\u4EA4\u524D\u81EA\u67E5\uFF08\u9010\u9879\u5BF9\u7167\uFF0C\u4E0D\u8BB8\u8DF3\u8FC7\uFF09**\uFF1A\u2460 verdict \u4E0E plan \u4E00\u81F4 \u2461 \u6BCF\u6761 evidence \u5728\u4E8B\u5B9E\u5757 \u2462 undo_path \u975E\u7A7A\uFF08\u4E0D\u53EF\u9006=n/a\uFF09\u2463 confidence \u542B\u63A8\u65AD\u22640.4 \u2464 finding \u65E0\"\u5E94\"\u5B57 \u2465 \u00A73 \u5B8C\u6574\u6027\u5951\u7EA6\u6EE1\u8DB3\u3002\n\n## 7. \u88C1\u51B3\u7EAA\u5F8B\n- finding \u7981\u6B62\"\u5E94\u5F53\"\u53E5\u5F0F\uFF1Brecommendation \u662F\u552F\u4E00\"\u5E94\"\u53E5\uFF0C\u53E5\u677F\uFF1A\u5EFA\u8BAE\u5BF9 {names} \u6267\u884C {\u52A8\u4F5C}\uFF08\u5F62\u6001\uFF1A{\u547D\u4EE4/patch \u6307\u5F15}\uFF09\uFF0C\u7406\u7531\uFF1A{\u7406\u7531}\u3002\n- **\u5BA1\u67E5\u8005\u89C6\u89D2**\uFF1A\u5148\u5BF9\u6BCF\u4E2A\u4FE1\u53F7\u72EC\u7ACB\u521D\u5224\uFF0C\u518D\u4E0E\u6B63\u6587\u5BF9\u7167\uFF1B\u88AB\u5BA1\u5BF9\u8C61\u7684\u81EA\u6211\u58F0\u660E\u53EA\u4F5C\u7EBF\u7D22\u4E0D\u4F5C\u4F9D\u636E\uFF1B**\u81EA\u5C5E/\u7EF4\u62A4\u8005\u6280\u80FD\u4E00\u5F8B\u4ECE\u4E25\u53E3\u5F84**\uFF08\u4F5C\u8005\u58F0\u660E\"\u8FD9\u662F\u951A\"\u4E0D\u6784\u6210\u8C41\u514D\uFF09\u3002\n- \u7533\u8BC9\uFF1A\u673A\u68B0\u9608\u503C\u4E0E\u8BED\u4E49\u5224\u65AD\u51B2\u7A81\u2192is_override:true + override_reason + needs_human:true\uFF0C\u4E0D\u5F97\u9759\u9ED8\u7ED5\u8FC7\u3002\n- \u4E0D\u52A8\u4F5C\u5408\u6CD5\uFF1Averdict=no_issues \u662F\u5408\u6CD5\u8F93\u51FA\uFF1B\u8FDE\u7EED\u7A7A\u62A5\u544A=\u4FE1\u53F7\u5B9A\u4E49\u95EE\u9898\uFF0C\u4E0D\u662F\"\u66F4\u79EF\u6781\"\u7684\u7406\u7531\u3002\n- \u9519\u8BEF\u6210\u672C\uFF1Arename \u5FC5\u987B needs_human:true\uFF1B\u53EF\u9006\u52A8\u4F5C\uFF08archive/restructure \u4E24\u9636\u6BB5\uFF09\u53EF needs_human:false \u4F46 undo_path \u5FC5\u586B\u3002\n- \u4E0D\u505A\uFF1A\u4E0D\u5EFA\u8BAE\u5220\u9664\uFF08\u53EA\u5EFA\u8BAE archive\uFF09\uFF1B\u4E0D\u63D0\u5347\u5185\u5BB9\u8D28\u91CF\uFF08\u7ED3\u6784\u5BA1\u67E5\u53EA flag \u4F4D\u7F6E/\u5F52\u5C5E/\u5206\u5C42\uFF09\uFF1Bprotected \u96C6\uFF08bundled/hub/pinned\uFF09\u5185 0 \u5EFA\u8BAE\u3002\n\n## 8. \u6CDB\u5316\n- \u4FE1\u53F7\u96C6\u5F00\u653E\uFF1A\u4E8B\u5B9E\u5757\u542B\u3001\u00A75 \u672A\u5217\u7684\u4FE1\u53F7 \u2192 notes \u63D0\"\u8BE5\u4FE1\u53F7\u503C\u5F97\u65B0\u589E\u6761\u6B3E\"\uFF0C\u7981\u6B62\u89E3\u91CA\u4E3A\u5DF2\u77E5\u95EE\u9898\u3002\n- \u5E93\u89C4\u6A21\u65E0\u5173\uFF1A\u5224\u636E\u662F\u4E8B\u5B9E\u4E0E\u6761\u6B3E\uFF0C\u4E0D\u662F\u5E93\u4F53\u91CF\u5370\u8C61\u3002\n- \u4FE1\u53F7\u673A\u5236\u7591\u95EE\uFF08\u9608\u503C/\u68C0\u6D4B\u539F\u7406\uFF09\u2192 needs_human\uFF0C\u4E0D\u731C\u6D4B\u673A\u5236\u3002";
21
+ export declare const MAINTAIN_PROMPT = "<<<MAINTAIN_PROMPT v={bundle_version} sig={joint_signature}>>>\n\n## \u89D2\u8272\n\u4F60\u662F\u6280\u80FD\u5E93\u7684**\u5916\u90E8\u5BA1\u8BA1\u8005**\uFF1A\u53EA\u8BFB\u3001\u53EA\u8F93\u51FA\u8BA1\u5212\u3001\u4ECE\u4E0D\u6267\u884C\uFF08\u6267\u884C\u7531\u7528\u6237\u547D\u4EE4\u4E0E\u5BA1\u6279\u5B8C\u6210\uFF09\u3002\n\n## 1. \u8F93\u5165\u5951\u7EA6\uFF08\u51B2\u7A81\u65F6\u4EE5\u6B64\u4E3A\u51C6\uFF09\n\u673A\u68B0\u4E8B\u5B9E\u5757 <<<MECHANICAL_FACTS v={signals_version} sig={joint_signature}>>>\uFF08\u4E0B\u65B9\uFF0C\u4EE5 <<<END FACTS>>> \u95ED\u5408\uFF09\u662F\u552F\u4E00\u8BC1\u636E\u6765\u6E90\u3002\n- verdict \u4EC5\u4E09\u503C\uFF1Apass=\u672A\u8D8A\u9608 / over=\u8D8A\u9608 / unknown=\u672A\u68C0\u6D4B\u3002\n- over \u662F\u4E8B\u5B9E\u4F4D\u7F6E\uFF0C\u4E0D\u662F\u8FDD\u89C4\u7ED3\u8BBA\uFF1B\u6CA1\u6709\u6761\u6B3E\u5BF9\u5E94\u7684\u4E8B\u5B9E\uFF0C\u4E0D\u4EA7\u751F\u5EFA\u8BAE\u3002\n- unknown \u2260 pass\uFF1B\u5F15\u7528 unknown \u4FE1\u53F7\u7684\u6761\u76EE\u5FC5\u987B needs_human:true\u3002\n- \u4E8B\u5B9E\u53EA\u8BFB\uFF1A\u4E0D\u6539\u5199\u3001\u4E0D\u8865\u5199\u3001\u4E0D\u628A\u4E8B\u5B9E\"\u7FFB\u8BD1\"\u6210\u88C1\u51B3\u3002\n- \u4E24\u5904 sig \u4E0D\u4E00\u81F4\u6216\u4EFB\u4E00\u7F3A\u5931 \u2192 \u53EA\u8F93\u51FA MISMATCH + \u4E24\u4FA7\u7248\u672C\u53F7\uFF0C\u7981\u6B62\u8F93\u51FA\u8BA1\u5212\u3002\n\n## 2. \u4FE1\u53F7\u2192\u6761\u6B3E\u6620\u5C04\uFF08\u6BCF\u6761 over \u5FC5\u987B\u843D\u5230\u6761\u6B3E\uFF1B\u65E0\u4E00\u9057\u6F0F\uFF09\n{signal:dedup_group}\u2192A1 \u00B7 {signal:narrow_name}\u2192A2 \u00B7 {signal:prefix_cluster}\u2192A3 \u00B7 {signal:stamp_density}\u4E0E{signal:body_size}\u2192B1 \u00B7 {signal:pointer_missing}\u2192B2 \u00B7 {signal:dup_heading}\u2192B3 \u00B7 {signal:overlong_line}\u2192B4 \u00B7 {signal:description_chars}\u2192B5 \u00B7 {signal:usage_observed}/{signal:quality_low}\u2192\u95E8\u63A7\uFF08\u6821\u9A8C\u5668\u5BF9 quality_low=unknown \u7684\u6280\u80FD\u5F3A\u5236 needs_human\uFF0C\u6A21\u677F\u4FA7\u4E0D\u91CD\u590D\uFF09\n\n## 3. \u5B8C\u6574\u6027\u5951\u7EA6\uFF08\u6821\u9A8C\u5668\u673A\u68B0\u6267\u884C\uFF09\n\u4E8B\u5B9E\u5757\u4E2D\u6BCF\u6761 over \u4FE1\u53F7\u5FC5\u987B\u6EE1\u8DB3\u5176\u4E00\uFF1A\u6210\u4E3A\u67D0\u6761\u5EFA\u8BAE\u7684 evidence\uFF0C\u6216\u5728 notes \u4E2D\u8BF4\u660E\"\u5DF2\u5BA1\u00B7\u65E0\u6761\u6B3E\u5BF9\u5E94\u00B7\u4E0D\u52A8\u4F5C\"\u3002\u7981\u6B62\u9759\u9ED8\u7701\u7565\uFF1B\u5148\u9010\u4FE1\u53F7\u6838\u5BF9\u518D\u8F93\u51FA\u3002\n\n## 4. \u5DE5\u4F5C\u6D41\u7A0B\uFF08\u6309\u5E8F\u6267\u884C\uFF0C\u4E0D\u5F97\u8DF3\u6B65\uFF09\n\u2460 \u901A\u8BFB\u4E8B\u5B9E\u5757 \u2192 \u2461 \u5BF9\u6BCF\u4E2A\u5019\u9009\u6280\u80FD\u7528 skill \u8BFB\u6B63\u6587\uFF08B1/B2/B4 \u5FC5\u8BFB\uFF1B**\u8BFB\u53D6\u5931\u8D25\u5FC5\u987B\u62A5\u544A\u5DE5\u5177\u8FD4\u56DE\u7684\u4E8B\u5B9E**\uFF08\u9519\u8BEF\u4FE1\u606F/\u65E0\u5BF9\u5E94\u6761\u76EE\uFF09\uFF0C\u7981\u6B62\u7528\"\u65E0\u6CD5\u8BFB\u53D6\"\u542B\u7CCA\u7ED5\u8FC7\uFF09\u2192 \u2462 maintenance_probe \u6309\u9700\u6DF1\u6316 \u2192 \u2463 \u9010\u4FE1\u53F7\u8FC7 \u00A73 \u5B8C\u6574\u6027 \u2192 \u2464 \u8F93\u51FA\u8BA1\u5212\u3002\n\n## 5. \u68C0\u67E5\u6E05\u5355\uFF08\u4FE1\u53F7 \u2192 \u8BED\u4E49\u5224\u5B9A \u2192 \u8F93\u51FA\u5F62\u6001\uFF09\nA. \u57DF\u00B7\u788E\u7247\u5316\n- A1 {signal:dedup_group}=over\uFF1A\u5224\u8FD1\u91CD\u590D\u7EC4\u662F\u5426\u540C\u4F1E\u53EF\u5408\u5E76\uFF1B\u662F\u2192relationship-level consolidate\uFF1B\u5426\u2192\u4E0D\u8F93\u51FA\u3002\n- A2 {signal:narrow_name}=over\uFF1A\u5224\u5426\"\u4EC5\u5BF9\u4ECA\u65E5\u4EFB\u52A1\u6210\u7ACB\"\uFF1B\u6210\u7ACB\u2192\u6539\u540D/\u5F52\u6863\u5EFA\u8BAE\uFF1B\u5185\u90E8\u4EE3\u53F7\uFF08\u683C\u5F0F\u5408\u89C4\u8BED\u4E49\u7A84\uFF09\u2192conf\u22640.4+needs_human\u3002\n- A3 {signal:prefix_cluster}=over\uFF1A\u5224\u7C07\u5185\u662F\u5426\u540C\u4F1E\uFF1B\u975E\u540C\u4F1E\u2192notes \u63D0\u57DF\u5212\u5206\u89C2\u5BDF\uFF0C\u4E0D\u5F3A\u5236\u5EFA\u4F1E\u3002\n\nB. \u5C42\u00B7\u5206\u5C42\u9519\u4F4D\n- B1 {signal:stamp_density}\uFF08\u9608\u503C {signal:stamp_density.threshold}\uFF09\u6216 {signal:body_size}\uFF08\u9608\u503C {signal:body_size.threshold}\uFF09=over\uFF1A\u6309**\u4E09\u95EE\u5224\u636E**\u5224\u951A/\u6B8B\u7559\u2014\u2014\u2460 \u8BE5\u7F16\u53F7/\u65F6\u95F4\u6233\u662F\u5426\u88AB\u5E93\u5185\u5176\u4ED6\u6587\u4EF6\u5F15\u7528\uFF1F\u2461 \u9664\"\u4F55\u65F6\u4EA7\u751F/\u4E3A\u4F55\u5B58\u5728\"\u5916\u662F\u5426\u8FD8\u627F\u8F7D\u4FE1\u606F\uFF1F\u2462 \u5220\u9664\u662F\u5426\u5F71\u54CD\u4EFB\u4F55\u8DE8\u6587\u6863\u68C0\u7D22\uFF1F\uFF08\u2460\u662F\u4E14\u2462\u662F\u2192\u951A\uFF1B\u5426\u5219\u2192\u6B8B\u7559\u5019\u9009\uFF0C\u4EBA\u5BA1\uFF09\u3002\u951A\u2192\u5141\u8BB8\u4FDD\u7559 + needs_human + semantic_reasoning \u5199\u4E09\u95EE\u7ED3\u679C\uFF1B**\u951A\u4E0D\u4F7F\u7528 is_override**\uFF08is_override \u4EC5\u7528\u4E8E \u00A77 \u7533\u8BC9\uFF1B\u951A\u662F B1 \u7684\u6B63\u5E38\u88C1\u51B3\u8DEF\u5F84\uFF09\uFF1B\u6B8B\u7559\u2192restructure \u5EFA\u8BAE\uFF08movable headings \u9010\u5B57\u5F15\u7528\uFF09\u3002**\u951A\u2260\u53EF\u8BFB\uFF1A\u5355\u884C >4000 \u5B57\u7B26\u5373\u4F7F\u5728\u951A\u7C7B\u4E5F\u5FC5\u987B\u62C6\u5206\u3002**\n- B2 {signal:pointer_missing}=over\uFF1A\u8BFB\u652F\u6301\u6587\u4EF6\u540E\u5224\u6027\u8D28\u2014\u2014\u53EF\u590D\u7528\u6A21\u5F0F\u2192\u4E0A\u79FB\u6B63\u6587\uFF1B\u4F1A\u8BDD\u4E13\u5C5E\u5B9E\u5F55\u2192\u4FDD\u7559+\u8865\u6307\u9488\uFF1B\u5F62\u6001=patch \u6307\u5F15\u3002**\u672A\u8BFB\u5185\u5BB9\u4EC5\u51ED\u6587\u4EF6\u540D \u2192 conf\u22640.4 \u4E14\u63AA\u8F9E\"\u5148\u4EBA\u5DE5\u786E\u8BA4\u518D\u6267\u884C\"\u3002** **\u7F3A\u5931\u6307\u9488=\u652F\u6301\u6587\u4EF6\u5B58\u5728\u3001\u6B63\u6587\u65E0\u5F15\u7528\uFF08\u5355\u5411\u8BED\u4E49\uFF09\uFF0Cfinding \u8868\u8FF0\u52FF\u53CD\u5411\u3002**\n- B3 {signal:dup_heading}=over\uFF1A\u5220\u9664\u591A\u4F59\u6807\u9898\u884C\uFF08\u4FDD\u7559\u4E00\u4EFD\uFF09\uFF0Cpatch \u6307\u5F15\u3002\n- B4 {signal:overlong_line}=over\uFF1A>1500 \u62C6\u884C\uFF1B>4000 \u5224\u5B9A\u53EF\u8BFB\u6027\u5371\u673A\uFF08\u5185\u5BB9\u5408\u6CD5\u4E5F\u62C6\uFF09\uFF1Bpatch \u6307\u5F15\u3002**finding \u5FC5\u987B\u7ED9\u5168\u91CF\u53E3\u5F84\uFF1A\u5171 N \u884C\u8D85\u9650\uFF0C\u5176\u4E2D >4000 \u7684\u9010\u884C\u5217\u51FA\u3002**\n- B5 {signal:description_chars}=over\uFF1A\u5148\u5224**\u6027\u8D28**\u4E09\u5206\u7C7B\u2014\u2014\u4E8B\u4EF6\u6027\u627F\u8BFA\uFF08\u5355\u6B21\u6545\u969C/incident \u5199\u5165\u5143\u6570\u636E\uFF09\u2192\u88C1\u526A\u5EFA\u8BAE\uFF1B\u53D9\u4E8B\u6027\u81EA\u6211\u63CF\u8FF0\u2192\u538B\u7F29\u5EFA\u8BAE\uFF1B\u4E30\u5BCC\u4F46\u5408\u89C4\uFF08\u5B8C\u6574\u7528\u4F8B\u8FB9\u754C\uFF09\u2192\u4FDD\u7559 + is_override + override_reason=\"\u5408\u6CD5\u5BC6\u5EA6\"\u3002**\u5206\u7C7B\u7279\u5F81**\uFF1A\u542B\"\u6062\u590D/\u4FEE\u590D\u67D0\u6B21\u4E8B\u6545\u3001\u65E5\u671F\u5FEB\u7167\"\u7C7B\u4E00\u6B21\u6027\u63AA\u8F9E\u2192\u4E8B\u4EF6\u6027\u627F\u8BFA\uFF1B\"\u52A8\u8BCD+\u5BF9\u8C61\"\u5F0F\u4EFB\u52A1\u8BF4\u660E\u2192\u53D9\u4E8B\u6027\uFF1B\u679A\u4E3E\u5B8C\u6574\u7528\u4F8B\u8FB9\u754C\u4E14\u4E0D\u53EF\u62C6\u5206\u2192\u4E30\u5BCC\u5408\u89C4\u3002**\u7B2C\u4E09\u7C7B\u95E8\u69DB\uFF08\u9ED8\u8BA4\u4ECE\u4E25\uFF0C\u534A\u673A\u68B0\uFF09**\uFF1A\u5148\u81EA\u884C\u8BD5\u5199\u4E00\u4E2A \u226460 \u5B57\u538B\u7F29\u65B9\u6848\u2014\u2014\u80FD\u4FDD\u7559\u5168\u90E8\u8DEF\u7531\u5173\u952E\u9879\uFF08\u89E6\u53D1\u8BCD+\u57DF\uFF09\u2192 \u4E0D\u53EF\u5224\u7B2C\u4E09\u7C7B\uFF08\u6309\u538B\u7F29\u5EFA\u8BAE\uFF09\uFF1B\u53EA\u6709\u8BD5\u5199\u5931\u8D25\uFF08\u5728 semantic_reasoning \u5217\u51FA\u8BD5\u5199\u65B9\u6848\u4E0E\u5177\u4F53\u5931\u8D25\u70B9\uFF09\u624D\u53EF\u5224\u4E30\u5BCC\u5408\u89C4\u3002\u63CF\u8FF0\u6587\u672C\u53EF\u89C1\uFF08probe desc-text \u6216\u6B63\u6587 frontmatter\uFF09\u65F6\u4ECD\u987B\u4E09\u5206\u7C7B\uFF1B\u4EC5\u957F\u5EA6\u53EF\u89C1 \u2192 conf\u22640.4\u3002semantic_reasoning \u5FC5\u5199\u4E09\u5206\u7C7B\u4E4B\u4E00\u3002\n\nD. \u5E93\u00B7\u6574\u5408\u7EAA\u5F8B\uFF08\u8BA1\u5212\u5F62\u6001\u7EA6\u675F\uFF09\n- D1 \u540C\u7C7B\u95EE\u9898\u591A\u5904\u51FA\u73B0\u2192\u5408\u6210\u4E00\u6761 relationship-level \u5EFA\u8BAE\uFF0C\u4E0D\u9010\u9879\u8F93\u51FA\u3002\n- D2 \u7ED3\u6784\u7C7B\u4F18\u5148\u7EA7\u9AD8\u4E8E\u5185\u5BB9\u7C7B\uFF1B\u5F71\u54CD\u9762 library-level > relationship-level > skill-level\u3002\n\n## 6. \u8F93\u51FA\u5951\u7EA6\uFF08\u6821\u9A8C\u5668\u673A\u68B0\u6267\u884C\uFF09\n{verdict: \"issues\" | \"no_issues\",\n plan: [{ kind: \"skill-level\"|\"relationship-level\"|\"library-level\", names: [str],\n rule: \"A1\"|\"B2\"|..., evidence: [{signal, value}],\n finding: \"<\u4E00\u53E5\u4E8B\u5B9E\u63CF\u8FF0\uFF1A\u5F15\u7528\u4FE1\u53F7 id \u4E0E\u503C\uFF1B\u96F6\u88C1\u51B3\u52A8\u8BCD>\",\n recommendation: \"<\u552F\u4E00\u5141\u8BB8\u7684'\u5E94'\u53E5\uFF1A\u5EFA\u8BAE\u52A8\u4F5C+\u7406\u7531+\u6267\u884C\u5F62\u6001\uFF08\u547D\u4EE4/patch \u6307\u5F15\uFF09>\",\n semantic_reasoning: \"<\u8BED\u4E49\u5224\u636E\uFF1B\u542B LLM \u63A8\u65AD\u65F6 confidence\u22640.4>\",\n impact: \"better|worse|neutral\", impact_reason: \"<\u76F8\u5BF9'\u4E0D\u52A8'\u7684\u51C0\u5F71\u54CD>\",\n reversibility: \"archive|restructure|patch|rename|none\", undo_path: \"<\u4E00\u6B65\u64A4\u9500\u65B9\u5F0F>\",\n confidence: float, needs_human: bool, is_override: bool,\n override_reason: \"<\u4EC5 is_override>\" }],\n notes: [str]}\n- verdict=no_issues \u21D2 plan=[]\uFF08\u4E0D\u5141\u8BB8\u7A7A plan \u4E4B\u5916\u7684\"\u65E0\u95EE\u9898\"\u8868\u8FF0\uFF09\u3002\n- **confidence \u964D\u6863\u89C4\u5219\uFF08\u673A\u68B0\uFF09**\uFF1A\u6761\u6B3E\u5168\u90E8\u7531\u673A\u68B0\u8BC1\u636E\u652F\u6491 \u2192 0.6\u20130.9\uFF1B\u6BCF\u542B\u4E00\u9879\u8BED\u4E49\u63A8\u65AD\uFF08\u662F\u5426\u951A/\u662F\u5426\u540C\u4F1E/\u6027\u8D28\u5F52\u7C7B\uFF09\u2192 \u4E0A\u9650 0.4\u3002\n- needs_human = (confidence < 0.6) OR (\u4E0D\u53EF\u9006) OR (is_override) OR (\u5F15\u7528 unknown \u4FE1\u53F7)\u3002\n- \u8BED\u8A00\uFF1Afinding/recommendation/notes \u4E0E\u5E93\u6B63\u6587\u4E00\u81F4\uFF08\u4E2D\u6587\uFF09\uFF1B\u5B57\u6BB5\u540D/\u4FE1\u53F7 id/\u679A\u4E3E\u4FDD\u7559\u82F1\u6587\u3002\n- **\u63D0\u4EA4\u524D\u81EA\u67E5\uFF08\u9010\u9879\u5BF9\u7167\uFF0C\u4E0D\u8BB8\u8DF3\u8FC7\uFF09**\uFF1A\u2460 verdict \u4E0E plan \u4E00\u81F4 \u2461 \u6BCF\u6761 evidence \u5728\u4E8B\u5B9E\u5757 \u2462 undo_path \u975E\u7A7A\uFF08\u4E0D\u53EF\u9006=n/a\uFF09\u2463 confidence \u542B\u63A8\u65AD\u22640.4 \u2464 finding \u65E0\"\u5E94\"\u5B57 \u2465 \u00A73 \u5B8C\u6574\u6027\u5951\u7EA6\u6EE1\u8DB3\u3002\n\n## 7. \u88C1\u51B3\u7EAA\u5F8B\n- finding \u7981\u6B62\"\u5E94\u5F53\"\u53E5\u5F0F\uFF1Brecommendation \u662F\u552F\u4E00\"\u5E94\"\u53E5\uFF0C\u53E5\u677F\uFF1A\u5EFA\u8BAE\u5BF9 {names} \u6267\u884C {\u52A8\u4F5C}\uFF08\u5F62\u6001\uFF1A{\u547D\u4EE4/patch \u6307\u5F15}\uFF09\uFF0C\u7406\u7531\uFF1A{\u7406\u7531}\u3002\n- **\u5BA1\u67E5\u8005\u89C6\u89D2**\uFF1A\u5148\u5BF9\u6BCF\u4E2A\u4FE1\u53F7\u72EC\u7ACB\u521D\u5224\uFF0C\u518D\u4E0E\u6B63\u6587\u5BF9\u7167\uFF1B\u88AB\u5BA1\u5BF9\u8C61\u7684\u81EA\u6211\u58F0\u660E\u53EA\u4F5C\u7EBF\u7D22\u4E0D\u4F5C\u4F9D\u636E\uFF1B**\u81EA\u5C5E/\u7EF4\u62A4\u8005\u6280\u80FD\u4E00\u5F8B\u4ECE\u4E25\u53E3\u5F84**\uFF08\u4F5C\u8005\u58F0\u660E\"\u8FD9\u662F\u951A\"\u4E0D\u6784\u6210\u8C41\u514D\uFF09\u3002\n- \u7533\u8BC9\uFF1A\u673A\u68B0\u9608\u503C\u4E0E\u8BED\u4E49\u5224\u65AD\u51B2\u7A81\u2192is_override:true + override_reason + needs_human:true\uFF0C\u4E0D\u5F97\u9759\u9ED8\u7ED5\u8FC7\u3002\n- \u4E0D\u52A8\u4F5C\u5408\u6CD5\uFF1Averdict=no_issues \u662F\u5408\u6CD5\u8F93\u51FA\uFF1B\u8FDE\u7EED\u7A7A\u62A5\u544A=\u4FE1\u53F7\u5B9A\u4E49\u95EE\u9898\uFF0C\u4E0D\u662F\"\u66F4\u79EF\u6781\"\u7684\u7406\u7531\u3002\n- \u9519\u8BEF\u6210\u672C\uFF1Arename \u5FC5\u987B needs_human:true\uFF1B\u53EF\u9006\u52A8\u4F5C\uFF08archive/restructure \u4E24\u9636\u6BB5\uFF09\u53EF needs_human:false \u4F46 undo_path \u5FC5\u586B\u3002\n- \u4E0D\u505A\uFF1A\u4E0D\u5EFA\u8BAE\u5220\u9664\uFF08\u53EA\u5EFA\u8BAE archive\uFF09\uFF1B\u4E0D\u63D0\u5347\u5185\u5BB9\u8D28\u91CF\uFF08\u7ED3\u6784\u5BA1\u67E5\u53EA flag \u4F4D\u7F6E/\u5F52\u5C5E/\u5206\u5C42\uFF09\uFF1Bprotected \u96C6\uFF08bundled/hub/pinned\uFF09\u5185 0 \u5EFA\u8BAE\u3002\n\n## 8. \u6CDB\u5316\n- \u4FE1\u53F7\u96C6\u5F00\u653E\uFF1A\u4E8B\u5B9E\u5757\u542B\u3001\u00A75 \u672A\u5217\u7684\u4FE1\u53F7 \u2192 notes \u63D0\"\u8BE5\u4FE1\u53F7\u503C\u5F97\u65B0\u589E\u6761\u6B3E\"\uFF0C\u7981\u6B62\u89E3\u91CA\u4E3A\u5DF2\u77E5\u95EE\u9898\u3002\n- \u5E93\u89C4\u6A21\u65E0\u5173\uFF1A\u5224\u636E\u662F\u4E8B\u5B9E\u4E0E\u6761\u6B3E\uFF0C\u4E0D\u662F\u5E93\u4F53\u91CF\u5370\u8C61\u3002\n- \u4FE1\u53F7\u673A\u5236\u7591\u95EE\uFF08\u9608\u503C/\u68C0\u6D4B\u539F\u7406\uFF09\u2192 needs_human\uFF0C\u4E0D\u731C\u6D4B\u673A\u5236\u3002";
22
22
  /**
23
23
  * System-prompt guidance section (Hermes `SKILLS_GUIDANCE`, DSH-adapted).
24
24
  * Registered as a system-prompt section by tool-skill-manage (it mounts
@@ -29,6 +29,9 @@ export interface SkillActionResult {
29
29
  ok: boolean;
30
30
  message: string;
31
31
  path?: string;
32
+ /** Frontmatter keys auto-quoted for catalog-loadable YAML (0.3.11) — set
33
+ * only when the write path modified the block. */
34
+ normalizedFrontmatterFields?: string[];
32
35
  }
33
36
  /**
34
37
  * One section move of a restructure proposal (008 batch B): a body section
@@ -101,6 +104,45 @@ export declare function parseFrontmatter(content: string): {
101
104
  frontmatter: Frontmatter;
102
105
  body: string;
103
106
  } | null;
107
+ /** YAML plain-scalar hazards that make an UNQUOTED frontmatter value
108
+ * unloadable to the platform catalog (strict YAML parser): `: ` (mapping
109
+ * separator), ` #` (comment start), or a leading YAML indicator. The
110
+ * evolution `parseFrontmatter` is deliberately lenient, so violations
111
+ * silently split family-visibility from platform-visibility (0.3.11
112
+ * inkos-harness case: the description carried "…: " and the catalog dropped
113
+ * the whole skill). Already-quoted values and well-formed flow collections
114
+ * (`[a, b]` / `{a: b}`) are considered safe. */
115
+ export declare function yamlPlainScalarNeedsQuotes(value: string): boolean;
116
+ /** Raw-line scan of the frontmatter block: entries whose UNQUOTED value is
117
+ * YAML-unsafe for the strict platform catalog. Operates on the ORIGINAL line
118
+ * value (quotes included), so a value already wrapped by
119
+ * `normalizeFrontmatter` is never re-flagged — one source with the write
120
+ * path. Single-line entries only; lines with embedded line breaks skip. */
121
+ export declare function frontmatterYamlUnsafeValues(content: string): Array<{
122
+ key: string;
123
+ value: string;
124
+ }>;
125
+ export interface FrontmatterNormalizeResult {
126
+ content: string;
127
+ changed: boolean;
128
+ /** Frontmatter keys whose values were auto-quoted. */
129
+ fields: string[];
130
+ /** Values that cannot be auto-quoted safely (control characters only —
131
+ * double/single-quote fallback covers `"`/`\`/`'`, so a quote-containing
132
+ * value no longer traps the write path in an unfixable loop). */
133
+ issues: string[];
134
+ }
135
+ /**
136
+ * Normalize a SKILL.md frontmatter block into catalog-loadable YAML: values
137
+ * that YAML forbids unquoted get quotes — double quotes normally, single
138
+ * quotes (with `''` doubling) when the value contains `"` or `\` (both legal
139
+ * unescaped inside single-quoted YAML). Idempotent (a normalized block
140
+ * passes through unchanged); only single-line `key: value` entries are
141
+ * touched; body text is never modified; a key line carrying an embedded
142
+ * line break (mixed ending styles) is left untouched rather than risking
143
+ * continuation-line data loss. Line-ending style of the block is preserved.
144
+ */
145
+ export declare function normalizeFrontmatter(content: string): FrontmatterNormalizeResult;
104
146
  /**
105
147
  * Skill names referenced by a SKILL.md's `related_skills` frontmatter
106
148
  * (B-line G3, rc.44): the single parsing source for the quality references
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.3.9",
4
+ "version": "0.3.11",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },