@lmzhen/dsh-evolution-core 0.54.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{extract-plan-D4zO7dmD.js → extract-plan-ihQznLVT.js} +2 -1
- package/lib/extract.js +7 -7
- package/lib/index.js +795 -546
- package/lib/{limits-TD4Pv92Q.js → limits-DBg3UMkw.js} +11 -6
- package/lib/{skill-history-CZp8vhyL.js → mutation-storage-adapter-BM7mIJKp.js} +4 -647
- package/lib/mutations-1wLISSrY.js +592 -0
- package/lib/policy.js +9 -3
- package/lib/{quality-BLc6UQQb.js → quality-DNUVRbUm.js} +1 -1
- package/lib/{skill-health-BIpiPvw6.js → review-context-CXKwGGd8.js} +124 -183
- package/lib/runtime/plugin.js +1 -1
- package/lib/{session-projection-ByNxQi9O.js → session-projection-CbIKvDfJ.js} +3 -2
- package/lib/skill-history-B-DyIedq.js +646 -0
- package/lib/skills.js +12 -8
- package/lib/text-metrics-CyJhxWBs.js +132 -0
- package/lib/types/constants.d.ts +10 -5
- package/lib/types/constants.js +10 -5
- package/lib/types/drift-signals.d.ts +1 -4
- package/lib/types/drift-signals.js +14 -23
- package/lib/types/extract-request.js +3 -2
- package/lib/types/frontmatter.js +12 -8
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.js +2 -1
- package/lib/types/memory-store.d.ts +32 -6
- package/lib/types/memory-store.js +86 -30
- package/lib/types/mutation-unit.js +2 -1
- package/lib/types/params.js +6 -3
- package/lib/types/policy.d.ts +5 -0
- package/lib/types/policy.js +8 -2
- package/lib/types/prompts.d.ts +1 -1
- package/lib/types/prompts.js +1 -1
- package/lib/types/signals.js +3 -2
- package/lib/types/skill-health.d.ts +8 -5
- package/lib/types/skill-health.js +27 -28
- package/lib/types/skill-history.d.ts +2 -2
- package/lib/types/skill-history.js +7 -7
- package/lib/types/skill-lint.d.ts +1 -1
- package/lib/types/skill-lint.js +4 -4
- package/lib/types/skill-stats.d.ts +3 -1
- package/lib/types/skill-stats.js +2 -0
- package/lib/types/skill-store.js +2 -1
- package/lib/types/text-budgets.d.ts +150 -0
- package/lib/types/text-budgets.js +65 -0
- package/lib/types/text-metrics.d.ts +88 -0
- package/lib/types/text-metrics.js +131 -0
- package/lib/{usage-B1qveKi9.js → usage-e34VZPmK.js} +2 -515
- package/lib/write.js +3 -2
- package/package.json +1 -1
- package/lib/mutations-DQXddSJd.js +0 -75
- package/lib/types/cost.d.ts +0 -63
- package/lib/types/cost.js +0 -67
|
@@ -9,6 +9,7 @@ import { makeSerialQueue } from "./serial.js";
|
|
|
9
9
|
import { payloadText } from "./payload.js";
|
|
10
10
|
import { scanMemoryThreats } from "./threats.js";
|
|
11
11
|
import { ENTRY_DELIMITER, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, DEFAULT_CONSOLIDATION_FAILURES } from "./constants.js";
|
|
12
|
+
import { measureText } from "./text-metrics.js";
|
|
12
13
|
/**
|
|
13
14
|
* Read-guard factor: a memory file larger than this multiple of its target's
|
|
14
15
|
* char limit is treated as externally corrupted and skipped instead of being
|
|
@@ -44,6 +45,11 @@ function previewEntries(entries) {
|
|
|
44
45
|
const more = entries.length > ERROR_PREVIEW_ENTRIES ? `\n (+${entries.length - ERROR_PREVIEW_ENTRIES} more)` : '';
|
|
45
46
|
return `\n\nCurrent entries (preview):\n${shown.join('\n')}${more}`;
|
|
46
47
|
}
|
|
48
|
+
/** Count one entry list in both units; empty is zero in both. */
|
|
49
|
+
function usageOf(entries) {
|
|
50
|
+
const text = entries.join(ENTRY_DELIMITER);
|
|
51
|
+
return { chars: text.length, tokens: text.length === 0 ? 0 : measureText(text).tokens.value };
|
|
52
|
+
}
|
|
47
53
|
export function memoryRoot(env = process.env) {
|
|
48
54
|
// V9-05 (0.3.51): single resolver — evolutionRoot() holds the ONLY
|
|
49
55
|
// DSH_HOME empty/whitespace fallback; the old bare `||` here resolved
|
|
@@ -73,6 +79,8 @@ function hasEntryDelimiter(content) {
|
|
|
73
79
|
export class MemoryStore {
|
|
74
80
|
memoryLimit;
|
|
75
81
|
userLimit;
|
|
82
|
+
memoryTokenLimit;
|
|
83
|
+
userTokenLimit;
|
|
76
84
|
addDatePrefix;
|
|
77
85
|
root;
|
|
78
86
|
maxFailures;
|
|
@@ -91,8 +99,10 @@ export class MemoryStore {
|
|
|
91
99
|
constructor(options = {}) {
|
|
92
100
|
this.io = options.io ?? nodeEvolutionIo();
|
|
93
101
|
this.fence = options.fence;
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
102
|
+
this.memoryTokenLimit = options.memoryTokenLimit;
|
|
103
|
+
this.userTokenLimit = options.userTokenLimit;
|
|
104
|
+
this.memoryLimit = options.memoryTokenLimit ?? options.memoryCharLimit ?? DEFAULT_MEMORY_CHAR_LIMIT;
|
|
105
|
+
this.userLimit = options.userTokenLimit ?? options.userCharLimit ?? DEFAULT_USER_CHAR_LIMIT;
|
|
96
106
|
this.addDatePrefix = options.addDatePrefix ?? false;
|
|
97
107
|
this.root = options.root ?? memoryRoot();
|
|
98
108
|
this.maxFailures = options.maxConsolidationFailures ?? DEFAULT_CONSOLIDATION_FAILURES;
|
|
@@ -114,6 +124,40 @@ export class MemoryStore {
|
|
|
114
124
|
limitFor(target) {
|
|
115
125
|
return target === 'memory' ? this.memoryLimit : this.userLimit;
|
|
116
126
|
}
|
|
127
|
+
/** Token budget when the target opted into token mode; undefined keeps legacy chars. */
|
|
128
|
+
tokenLimitFor(target) {
|
|
129
|
+
return target === 'memory' ? this.memoryTokenLimit : this.userTokenLimit;
|
|
130
|
+
}
|
|
131
|
+
/** The value the active gate compares: tokens in token mode, UTF-16 chars otherwise. */
|
|
132
|
+
judgedValue(target, usage) {
|
|
133
|
+
return this.tokenLimitFor(target) === undefined ? usage.chars : usage.tokens;
|
|
134
|
+
}
|
|
135
|
+
/** Unit noun for model-facing messages; legacy mode keeps its old wording. */
|
|
136
|
+
unitFor(target) {
|
|
137
|
+
return this.tokenLimitFor(target) === undefined ? 'chars' : 'tokens';
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Byte ceiling for the oversized-read guard. It is NOT the token budget:
|
|
141
|
+
* a token cannot be compared to bytes. Token mode uses a conservative byte
|
|
142
|
+
* envelope so a canonical English/CJK file is never mistaken for corruption.
|
|
143
|
+
*/
|
|
144
|
+
byteGuardFor(target) {
|
|
145
|
+
const tokenLimit = this.tokenLimitFor(target);
|
|
146
|
+
if (tokenLimit === undefined)
|
|
147
|
+
return this.limitFor(target) * READ_GUARD_FACTOR;
|
|
148
|
+
return Math.max(16 * 1024, tokenLimit * 4 * READ_GUARD_FACTOR);
|
|
149
|
+
}
|
|
150
|
+
/** Add the public dual-unit facts to one internal result. */
|
|
151
|
+
decorateResult(target, result) {
|
|
152
|
+
const usage = usageOf(result.entries);
|
|
153
|
+
const tokenLimit = this.tokenLimitFor(target);
|
|
154
|
+
return {
|
|
155
|
+
...result,
|
|
156
|
+
chars: usage.chars,
|
|
157
|
+
tokens: usage.tokens,
|
|
158
|
+
...(tokenLimit === undefined ? {} : { tokenLimit }),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
117
161
|
/** P2-1 (v18): the generated date prefix participates in duplicate detection
|
|
118
162
|
* only when THIS store writes it. With addDatePrefix=false a fact's own
|
|
119
163
|
* leading `## YYYY-MM-DD\n` is content, not a generated prefix. */
|
|
@@ -121,10 +165,10 @@ export class MemoryStore {
|
|
|
121
165
|
return this.addDatePrefix ? stripDatePrefix(entry) : entry;
|
|
122
166
|
}
|
|
123
167
|
/**
|
|
124
|
-
* Read-guard probe: `{ size,
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
168
|
+
* Read-guard probe: `{ size, byteLimit }` when the on-disk file exceeds the
|
|
169
|
+
* target's byte ceiling, `null` when it is absent, unknown, under the bound,
|
|
170
|
+
* or the target has no limit configured. The ceiling is bytes, never the
|
|
171
|
+
* token/char budget itself.
|
|
128
172
|
*/
|
|
129
173
|
async oversizedFile(target) {
|
|
130
174
|
const size = await this.io.size?.(fileFor(this.root, target));
|
|
@@ -133,7 +177,8 @@ export class MemoryStore {
|
|
|
133
177
|
const limit = this.limitFor(target);
|
|
134
178
|
if (limit <= 0)
|
|
135
179
|
return null;
|
|
136
|
-
|
|
180
|
+
const byteLimit = this.byteGuardFor(target);
|
|
181
|
+
return size > byteLimit ? { size, byteLimit } : null;
|
|
137
182
|
}
|
|
138
183
|
async read(target) {
|
|
139
184
|
// Oversized files are skipped whole (claw alignment); a later write to the
|
|
@@ -172,15 +217,16 @@ export class MemoryStore {
|
|
|
172
217
|
}
|
|
173
218
|
/**
|
|
174
219
|
* StorageHint percentage must clamp at 100 like the render header: a drifted
|
|
175
|
-
* entry can push
|
|
176
|
-
* clamped usage indicator.
|
|
220
|
+
* entry can push usage past the limit, and "Storage at 125%" contradicts the
|
|
221
|
+
* clamped usage indicator. The percentage is computed in the ACTIVE unit.
|
|
177
222
|
*/
|
|
178
|
-
storageHint(target,
|
|
223
|
+
storageHint(target, usage) {
|
|
179
224
|
const limit = this.limitFor(target);
|
|
180
225
|
if (limit <= 0)
|
|
181
226
|
return '';
|
|
182
|
-
const
|
|
183
|
-
|
|
227
|
+
const value = this.judgedValue(target, usage);
|
|
228
|
+
const percent = Math.min(100, Math.floor((value * 100) / limit));
|
|
229
|
+
return percent >= 80 ? ` ⚠️ Storage at ${percent}% (${value}/${limit} ${this.unitFor(target)}).` : '';
|
|
184
230
|
}
|
|
185
231
|
/**
|
|
186
232
|
* Best-effort raw-copy backup of the on-disk file to `<file>.bak` before a
|
|
@@ -229,7 +275,7 @@ export class MemoryStore {
|
|
|
229
275
|
const suffix = backup ? ` 已把备份保存到 ${basename(backup)}。` : '';
|
|
230
276
|
return {
|
|
231
277
|
ok: false,
|
|
232
|
-
message: `记忆文件为 ${oversized.size} 字节(上限 ${oversized.
|
|
278
|
+
message: `记忆文件为 ${oversized.size} 字节(上限 ${oversized.byteLimit})—— 跳过读取。${suffix} 请手动修复该文件后重试。`,
|
|
233
279
|
entries: [], chars: 0, limit: this.limitFor(target),
|
|
234
280
|
};
|
|
235
281
|
}
|
|
@@ -309,7 +355,7 @@ export class MemoryStore {
|
|
|
309
355
|
};
|
|
310
356
|
}
|
|
311
357
|
async add(target, facts) {
|
|
312
|
-
return await this.serial(() => this.addChained(target, facts));
|
|
358
|
+
return await this.serial(async () => this.decorateResult(target, await this.addChained(target, facts)));
|
|
313
359
|
}
|
|
314
360
|
async addChained(target, facts) {
|
|
315
361
|
if (!facts.trim())
|
|
@@ -361,16 +407,18 @@ export class MemoryStore {
|
|
|
361
407
|
// `add('alpha')` a false duplicate of a stored `## 2020-01-01\nalpha`.
|
|
362
408
|
if (entries.some(entry => this.dedupeKey(entry) === content)) {
|
|
363
409
|
this.resetFailures();
|
|
364
|
-
|
|
410
|
+
const usage = usageOf(entries);
|
|
411
|
+
return { result: { ok: true, message: `该条目已存在(未重复添加)。${this.storageHint(target, usage)}`, entries, chars: usage.chars, tokens: usage.tokens, limit: this.limitFor(target) }, write: null };
|
|
365
412
|
}
|
|
366
413
|
const next = [...entries, prefixed];
|
|
367
|
-
const
|
|
414
|
+
const usage = usageOf(next);
|
|
415
|
+
const total = this.judgedValue(target, usage);
|
|
368
416
|
const addLimit = this.limitFor(target);
|
|
369
417
|
if (addLimit > 0 && total > addLimit) {
|
|
370
|
-
return { result: this.failure(target, `添加该条目会超过 ${addLimit}
|
|
418
|
+
return { result: this.failure(target, `添加该条目会超过 ${addLimit} ${this.unitFor(target)} 上限。请先合并或删除过期条目,再重试。`, entries), write: null };
|
|
371
419
|
}
|
|
372
420
|
this.resetFailures();
|
|
373
|
-
return { result: { ok: true, message: `已添加条目。${this.storageHint(target,
|
|
421
|
+
return { result: { ok: true, message: `已添加条目。${this.storageHint(target, usage)}`, entries: next, chars: usage.chars, tokens: usage.tokens, limit: this.limitFor(target) }, write: render(next) };
|
|
374
422
|
}
|
|
375
423
|
/**
|
|
376
424
|
* The single drift evaluation. `raw` is in canonical form when it byte-matches
|
|
@@ -413,7 +461,7 @@ export class MemoryStore {
|
|
|
413
461
|
return 'external';
|
|
414
462
|
const limit = this.limitFor(target);
|
|
415
463
|
// A zero/negative limit means "unbounded".
|
|
416
|
-
if (limit > 0 && entries.some(entry =>
|
|
464
|
+
if (limit > 0 && entries.some(entry => this.judgedValue(target, usageOf([entry])) > limit))
|
|
417
465
|
return 'over-limit';
|
|
418
466
|
return null;
|
|
419
467
|
}
|
|
@@ -447,12 +495,17 @@ export class MemoryStore {
|
|
|
447
495
|
return null;
|
|
448
496
|
const limit = this.limitFor(target);
|
|
449
497
|
const entries = normalizeEntries(raw);
|
|
450
|
-
const over = entries.filter(entry =>
|
|
498
|
+
const over = entries.filter(entry => this.judgedValue(target, usageOf([entry])) > limit).length;
|
|
499
|
+
const usage = usageOf(entries);
|
|
500
|
+
const limitName = this.tokenLimitFor(target) === undefined
|
|
501
|
+
? (target === 'memory' ? 'memoryCharLimit' : 'userCharLimit')
|
|
502
|
+
: `${target} tokens`;
|
|
451
503
|
return {
|
|
452
504
|
ok: false,
|
|
453
|
-
message: `${over} 条记忆超过了配置的 ${
|
|
505
|
+
message: `${over} 条记忆超过了配置的 ${limitName}(${limit});它们是在更高上限下写入的。请提高上限或删除条目 —— 删除类操作仍然可用。`,
|
|
454
506
|
entries,
|
|
455
|
-
chars:
|
|
507
|
+
chars: usage.chars,
|
|
508
|
+
tokens: usage.tokens,
|
|
456
509
|
limit,
|
|
457
510
|
};
|
|
458
511
|
}
|
|
@@ -461,7 +514,7 @@ export class MemoryStore {
|
|
|
461
514
|
return { ok: false, message: `检测到记忆文件被外部改动。${suffix} 请先处理该漂移再重试。`, entries: [], chars: 0, limit: this.limitFor(target) };
|
|
462
515
|
}
|
|
463
516
|
async applyBatch(target, operations) {
|
|
464
|
-
return await this.serial(() => this.applyBatchChained(target, operations));
|
|
517
|
+
return await this.serial(async () => this.decorateResult(target, await this.applyBatchChained(target, operations)));
|
|
465
518
|
}
|
|
466
519
|
async applyBatchChained(target, operations) {
|
|
467
520
|
if (operations.length === 0)
|
|
@@ -551,13 +604,14 @@ export class MemoryStore {
|
|
|
551
604
|
working[matchIndex] = entryBody;
|
|
552
605
|
}
|
|
553
606
|
}
|
|
554
|
-
const
|
|
607
|
+
const usage = usageOf(working);
|
|
608
|
+
const total = this.judgedValue(target, usage);
|
|
555
609
|
const batchLimit = this.limitFor(target);
|
|
556
610
|
if (batchLimit > 0 && total > batchLimit) {
|
|
557
|
-
return { result: this.failure(target, `批处理结果(${total}
|
|
611
|
+
return { result: this.failure(target, `批处理结果(${total} ${this.unitFor(target)})超过 ${batchLimit} 上限。请在同一个批里再删除或缩短一些条目。`, entries), write: null };
|
|
558
612
|
}
|
|
559
613
|
this.resetFailures();
|
|
560
|
-
return { result: { ok: true, message: `已应用 ${operations.length} 个操作。${this.storageHint(target,
|
|
614
|
+
return { result: { ok: true, message: `已应用 ${operations.length} 个操作。${this.storageHint(target, usage)}`, entries: working, chars: usage.chars, tokens: usage.tokens, limit: this.limitFor(target) }, write: render(working) };
|
|
561
615
|
}
|
|
562
616
|
async renderContext() {
|
|
563
617
|
const memory = await this.read('memory');
|
|
@@ -568,7 +622,7 @@ export class MemoryStore {
|
|
|
568
622
|
// context states the skip instead of silently dropping the block.
|
|
569
623
|
const oversized = entries.length === 0 ? await this.oversizedFile(target) : null;
|
|
570
624
|
if (oversized) {
|
|
571
|
-
parts.push(`## ${label} — file skipped: ${oversized.size} bytes (limit ${oversized.
|
|
625
|
+
parts.push(`## ${label} — file skipped: ${oversized.size} bytes (limit ${oversized.byteLimit}); not read`);
|
|
572
626
|
continue;
|
|
573
627
|
}
|
|
574
628
|
// V10-03 (P2-18): the same exempt labels apply on render — an entry the
|
|
@@ -578,14 +632,16 @@ export class MemoryStore {
|
|
|
578
632
|
if (safe.length > 0) {
|
|
579
633
|
const body = safe.join(ENTRY_DELIMITER);
|
|
580
634
|
const limit = this.limitFor(target);
|
|
635
|
+
const usage = usageOf(safe);
|
|
636
|
+
const judged = this.judgedValue(target, usage);
|
|
581
637
|
const note = safe.length === entries.length ? '' : ` (${entries.length - safe.length} threat-matched entries filtered)`;
|
|
582
638
|
// Usage indicator aligned with Hermes `_render_block`: floor percentage clamped at 100.
|
|
583
639
|
// C-04: with no limit (limit <= 0) the whole usage segment is
|
|
584
640
|
// omitted — the old form rendered a bogus "[0% — N/0 chars]".
|
|
585
|
-
const
|
|
586
|
-
? ` [${Math.min(100, Math.floor((
|
|
641
|
+
const usageText = limit > 0
|
|
642
|
+
? ` [${Math.min(100, Math.floor((judged * 100) / limit))}% — ${judged}/${limit} ${this.unitFor(target)}]`
|
|
587
643
|
: '';
|
|
588
|
-
parts.push(`## ${label} (${safe.length} entries)${
|
|
644
|
+
parts.push(`## ${label} (${safe.length} entries)${usageText}${note}\n${body}`);
|
|
589
645
|
}
|
|
590
646
|
else if (entries.length > 0) {
|
|
591
647
|
// P3-14 (v14): every entry was threat-matched. The block used to
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { basename, dirname, isAbsolute, join, relative } from 'node:path';
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { isCommittedWarning, isProcessAlive, TransactionNotInvokedError, transactIo } from "./io.js";
|
|
4
|
+
import { exceedsContentLimit } from "./frontmatter.js";
|
|
4
5
|
import { WriteKernel } from "./write-kernel.js";
|
|
5
6
|
function underRoot(rootDir, target) {
|
|
6
7
|
if (rootDir === undefined || rootDir === '')
|
|
@@ -75,7 +76,7 @@ export function validateMutationRequest(request, limits) {
|
|
|
75
76
|
errors.push({ code: 'file-too-large', message: 'write exceeds ' + limits.maxSkillFileBytes + ' bytes', target });
|
|
76
77
|
continue;
|
|
77
78
|
}
|
|
78
|
-
if (basename(target) === 'SKILL.md' && op.content
|
|
79
|
+
if (basename(target) === 'SKILL.md' && exceedsContentLimit(op.content, limits.maxSkillContentChars)) {
|
|
79
80
|
errors.push({ code: 'skill-too-large', message: 'SKILL.md exceeds ' + limits.maxSkillContentChars + ' characters', target });
|
|
80
81
|
continue;
|
|
81
82
|
}
|
package/lib/types/params.js
CHANGED
|
@@ -94,8 +94,10 @@ export const PARAM_EXPOSURE = Object.freeze([
|
|
|
94
94
|
{ id: 'supportFileCharPolicy', group: 'write-caps', tier: 'E3', authority: 'cordis', owner: 'tool-skill-manage', applies: 'live', docAnchor: 'PARAMETERS.md#write-caps', summary: 'Warn about an oversize support file, or refuse the write.', label: '附带文件超限时', hint: '附带文件超出上限时:只提醒/拒绝写入。', control: 'select', unit: '', values: 'report|enforce', valueLabels: '只提醒|拒绝写入', card: 'tool-skill-manage' },
|
|
95
95
|
{ id: 'skillWriteConfirm', group: 'write-caps', tier: 'E3', authority: 'cordis', owner: 'tool-skill-manage', applies: 'live', docAnchor: 'PARAMETERS.md#write-caps', summary: 'What the one confirmation before a create or a bare delete does: write straight through, wait for an answer, or cancel the write when nobody answers within the timeout.', label: '写入前是否确认', hint: '新建或删除技能前要不要问你:直接写入/一直等你回答/超时未答就取消这次写入。', control: 'select', unit: '', values: 'auto|ask|timeout', valueLabels: '不弹窗直接写入|一直等待回答|超时自动取消', card: 'tool-skill-manage' },
|
|
96
96
|
{ id: 'skillWriteConfirmTimeoutSeconds', group: 'write-caps', tier: 'E3', authority: 'cordis', owner: 'tool-skill-manage', applies: 'live', docAnchor: 'PARAMETERS.md#write-caps', summary: 'Seconds the confirmation waits for an answer in timeout mode before the write is cancelled.', label: '确认等待秒数', hint: '选「超时自动取消」时,等多少秒没人回答就取消这次写入。', control: 'number', unit: '秒', values: '', card: 'tool-skill-manage' },
|
|
97
|
-
{ id: 'memoryChars', group: 'memory', tier: 'E3', authority: 'cordis', owner: 'memory-files', applies: 'live', docAnchor: 'PARAMETERS.md#memory', summary: '
|
|
98
|
-
{ id: 'userChars', group: 'memory', tier: 'E3', authority: 'cordis', owner: 'memory-files', applies: 'live', docAnchor: 'PARAMETERS.md#memory', summary: '
|
|
97
|
+
{ id: 'memoryChars', group: 'memory', tier: 'E3', authority: 'cordis', owner: 'memory-files', applies: 'live', docAnchor: 'PARAMETERS.md#memory', summary: 'Legacy character budget for MEMORY.md; only an explicit legacy override, otherwise the token budget governs.', label: '记忆库字符上限(旧)', hint: '旧口径:长期记忆文件最多多少字符。设置后按字符模式工作;未设置时按 token 预算。', control: 'number', unit: '字符', values: '', card: 'memory-files' },
|
|
98
|
+
{ id: 'userChars', group: 'memory', tier: 'E3', authority: 'cordis', owner: 'memory-files', applies: 'live', docAnchor: 'PARAMETERS.md#memory', summary: 'Legacy character budget for USER.md; only an explicit legacy override, otherwise the token budget governs.', label: '用户画像字符上限(旧)', hint: '旧口径:用户画像文件最多多少字符。设置后按字符模式工作;未设置时按 token 预算。', control: 'number', unit: '字符', values: '', card: 'memory-files' },
|
|
99
|
+
{ id: 'memoryTokens', group: 'memory', tier: 'E3', authority: 'cordis', owner: 'memory-files', applies: 'live', docAnchor: 'PARAMETERS.md#memory', summary: 'Estimated token budget for MEMORY.md; the default is derived from the old 2200-character limit.', label: '记忆库 token 上限', hint: '长期记忆按估算 token 计;默认 800,约等于旧英文 2200 字符的上下文成本。', control: 'number', unit: 'token', values: '', card: 'memory-files' },
|
|
100
|
+
{ id: 'userTokens', group: 'memory', tier: 'E3', authority: 'cordis', owner: 'memory-files', applies: 'live', docAnchor: 'PARAMETERS.md#memory', summary: 'Estimated token budget for USER.md; the default is derived from the old 1375-character limit.', label: '用户画像 token 上限', hint: '用户画像按估算 token 计;默认 500,约等于旧英文 1375 字符的上下文成本。', control: 'number', unit: 'token', values: '', card: 'memory-files' },
|
|
99
101
|
{ id: 'memoryEnabled', group: 'memory', tier: 'E2', authority: 'cordis', owner: 'tool-memory', applies: 'none', docAnchor: 'PARAMETERS.md#memory', summary: 'Register the memory tool and its prompt section at all (deployment switch).', why: 'deployment' },
|
|
100
102
|
{ id: 'entryPreviewChars', group: 'memory', tier: 'E3', authority: 'cordis', owner: 'tool-memory', applies: 'live', docAnchor: 'PARAMETERS.md#memory', summary: 'Characters of one memory entry shown in a tool result preview.', label: '记忆预览长度', hint: '列表里每条记忆最多显示多少字符。', control: 'number', unit: '字符', values: '', card: 'tool-memory' },
|
|
101
103
|
{ id: 'addDatePrefix', group: 'memory', tier: 'E3', authority: 'cordis', owner: 'memory-files', applies: 'live', docAnchor: 'PARAMETERS.md#memory', summary: 'Prefix stored memory entries with their date heading.', label: '记忆条目加日期', hint: '写入时在条目开头加上日期。', control: 'switch', unit: '', values: '', card: 'memory-files' },
|
|
@@ -109,7 +111,8 @@ export const PARAM_EXPOSURE = Object.freeze([
|
|
|
109
111
|
{ id: 'llmReview', group: 'curator', tier: 'E3', authority: 'cordis', owner: 'evolution-curator', applies: 'live', docAnchor: 'PARAMETERS.md#curator', summary: 'Enable the LLM nomination pass on top of the deterministic lifecycle.', label: '用模型挑选', hint: '在固定规则之外,再用模型挑一遍候选项。', control: 'switch', unit: '', values: '', card: 'evolution-curator' },
|
|
110
112
|
{ id: 'curatorReviewMaxTokens', group: 'curator', tier: 'E3', authority: 'cordis', owner: 'evolution-curator', applies: 'live', docAnchor: 'PARAMETERS.md#curator', summary: 'Token budget of the curator LLM review.', label: '模型挑选的字数上限', hint: '每次用模型挑选时最多消耗多少 token(模型计费单位)。', control: 'number', unit: 'token', values: '', card: 'evolution-curator' },
|
|
111
113
|
{ id: 'curatorReviewTimeoutMs', group: 'curator', tier: 'E3', authority: 'cordis', owner: 'evolution-curator', applies: 'live', docAnchor: 'PARAMETERS.md#curator', summary: 'Wall-clock bound of the curator LLM review.', label: '模型处理超时', hint: '一次模型挑选最长允许运行多久。', control: 'number', unit: '毫秒', values: '', card: 'evolution-curator' },
|
|
112
|
-
{ id: '
|
|
114
|
+
{ id: 'healthSoftBodyTokens', group: 'curator', tier: 'E3', authority: 'cordis', owner: 'evolution-curator', applies: 'live', docAnchor: 'PARAMETERS.md#curator', summary: 'Estimated body token line the health view judges against.', label: '正文长度参考(token)', hint: '技能正文超过多少估算 token 算偏长(只用于健康提示);中文约 7.3k 字符、英文约 21.8k 字符触发默认 7,273。', control: 'number', unit: 'token', values: '', card: 'evolution-curator' },
|
|
115
|
+
{ id: 'healthSoftBodyChars', group: 'curator', tier: 'E3', authority: 'cordis', owner: 'evolution-curator', applies: 'live', docAnchor: 'PARAMETERS.md#curator', summary: 'Legacy body character line; converted once to healthSoftBodyTokens when no token value is set.', label: '正文长度参考(旧字符)', hint: '旧口径:技能正文超过多少字符算偏长。设置后按 2.75 字符/token 换算;未设置时按 token 预算。', control: 'number', unit: '字符', values: '', card: 'evolution-curator' },
|
|
113
116
|
{ id: 'healthStampDensityPerKb', group: 'curator', tier: 'E3', authority: 'cordis', owner: 'evolution-curator', applies: 'live', docAnchor: 'PARAMETERS.md#curator', summary: 'Stamp density per KB that flags log-like content in a body.', label: '正文像日志的判定线', hint: '每 KB 出现多少个时间标记,就判为「像日志」。', control: 'number', unit: '处/KB', values: '', card: 'evolution-curator' },
|
|
114
117
|
{ id: 'healthChurnMinPatches', group: 'curator', tier: 'E3', authority: 'cordis', owner: 'evolution-curator', applies: 'live', docAnchor: 'PARAMETERS.md#curator', summary: 'Patches without a read that flag a write-ghost skill.', label: '只写不读判定次数', hint: '连续多少次改动都没有被读取,就判为「只写不读」。', control: 'number', unit: '处', values: '', card: 'evolution-curator' },
|
|
115
118
|
{ id: 'evolution-curator.enabled', group: 'curator', tier: 'E2', authority: 'cordis', owner: 'evolution-curator', applies: 'none', docAnchor: 'PARAMETERS.md#curator', summary: 'Mount the curator plugin at all.', why: 'deployment' },
|
package/lib/types/policy.d.ts
CHANGED
|
@@ -25,6 +25,9 @@ export interface PolicySnapshot {
|
|
|
25
25
|
curatorModel: string;
|
|
26
26
|
memoryChars: number;
|
|
27
27
|
userChars: number;
|
|
28
|
+
/** Optional judged token budgets; absent keeps the legacy char budgets in force. */
|
|
29
|
+
memoryTokens?: number;
|
|
30
|
+
userTokens?: number;
|
|
28
31
|
skillContentChars: number;
|
|
29
32
|
curatorIntervalHours: number;
|
|
30
33
|
staleAfterDays: number;
|
|
@@ -46,6 +49,8 @@ export interface Config {
|
|
|
46
49
|
curatorModel?: string;
|
|
47
50
|
memoryChars?: number;
|
|
48
51
|
userChars?: number;
|
|
52
|
+
memoryTokens?: number;
|
|
53
|
+
userTokens?: number;
|
|
49
54
|
skillContentChars?: number;
|
|
50
55
|
curatorIntervalHours?: number;
|
|
51
56
|
staleAfterDays?: number;
|
package/lib/types/policy.js
CHANGED
|
@@ -29,6 +29,8 @@ export const Config = z.object({
|
|
|
29
29
|
curatorModel: z.string().default(DEFAULT_CURATOR_MODEL),
|
|
30
30
|
memoryChars: z.number().min(1).default(DEFAULT_MEMORY_CHAR_LIMIT),
|
|
31
31
|
userChars: z.number().min(1).default(DEFAULT_USER_CHAR_LIMIT),
|
|
32
|
+
memoryTokens: z.number().min(1),
|
|
33
|
+
userTokens: z.number().min(1),
|
|
32
34
|
skillContentChars: z.number().min(1).default(DEFAULT_SKILL_CONTENT_CHARS),
|
|
33
35
|
curatorIntervalHours: z.number().min(1).default(DEFAULT_CURATOR_INTERVAL_HOURS),
|
|
34
36
|
staleAfterDays: z.number().min(1).default(DEFAULT_STALE_AFTER_DAYS),
|
|
@@ -73,6 +75,8 @@ export class EvolutionPolicy extends Service {
|
|
|
73
75
|
clamped.push(name);
|
|
74
76
|
return result;
|
|
75
77
|
};
|
|
78
|
+
const memoryChars = field('memoryChars', config.memoryChars, DEFAULT_MEMORY_CHAR_LIMIT);
|
|
79
|
+
const userChars = field('userChars', config.userChars, DEFAULT_USER_CHAR_LIMIT);
|
|
76
80
|
this.snapshot = Object.freeze({
|
|
77
81
|
version: 1,
|
|
78
82
|
reviewMemoryInterval: field('reviewMemoryInterval', config.reviewMemoryInterval, DEFAULT_REVIEW_MEMORY_INTERVAL),
|
|
@@ -92,8 +96,10 @@ export class EvolutionPolicy extends Service {
|
|
|
92
96
|
return config.reviewMode === 'aux' ? 'aux' : 'inject';
|
|
93
97
|
})(),
|
|
94
98
|
curatorModel: config.curatorModel ?? DEFAULT_CURATOR_MODEL,
|
|
95
|
-
memoryChars
|
|
96
|
-
userChars
|
|
99
|
+
memoryChars,
|
|
100
|
+
userChars,
|
|
101
|
+
...(config.memoryTokens === undefined ? {} : { memoryTokens: field('memoryTokens', config.memoryTokens, 1) }),
|
|
102
|
+
...(config.userTokens === undefined ? {} : { userTokens: field('userTokens', config.userTokens, 1) }),
|
|
97
103
|
skillContentChars: field('skillContentChars', config.skillContentChars, DEFAULT_SKILL_CONTENT_CHARS),
|
|
98
104
|
curatorIntervalHours: field('curatorIntervalHours', config.curatorIntervalHours, DEFAULT_CURATOR_INTERVAL_HOURS),
|
|
99
105
|
staleAfterDays: field('staleAfterDays', config.staleAfterDays, DEFAULT_STALE_AFTER_DAYS),
|
package/lib/types/prompts.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const COMBINED_REVIEW_PROMPT = "[Auto-review]\nApply both review
|
|
|
15
15
|
export declare const COMPLETION_SKILL_REVIEW_PROMPT = "[Auto-review \u2014 Skills \u00B7 task complete]\nReview the conversation above and update the skill library.\n\nUpdate only when the session contains a durable lesson that changes how this class of task should be done. A precise no-op is a valid outcome.\n\nTarget: a class-level skill with a compact SKILL.md and a references/ directory for session-specific detail.\n\nA skill body contains reusable decisions: when to use it, what to do, and how to verify. Session-specific narratives, dated logs, one-off evidence, and version details that do not change the decision belong in references/. Support files: references/ for detail or knowledge banks; templates/ for starter files; scripts/ for re-runnable checks and generators. When you add a support file, add the SKILL.md line that points to it; a file no pointer reaches is invisible next session. A skill must use only tools, commands, and paths available in this session. If one is unavailable, replace it only with a verified local equivalent; otherwise leave it unchanged and report the limitation. Do not invent command names.\n\nBefore adding explanation to a skill, check whether its body is carrying session-specific detail that belongs in references/. When a loaded skill's body has grown past its decision content \u2014 long session logs, dated evidence, or detail that does not change the trigger or the procedure \u2014 move self-contained sections to references/ with skill_manage restructure, keeping the pointer line. Keep the trigger, the decision procedure, commands, and verification in SKILL.md. Offload whole sections; do not rewrite the body to make it shorter. Do at most one skill per review pass; prefer a loaded skill marked [oversize] and do not attempt a library-wide sweep.\n\nSignals include:\n- The user corrected style, tone, format, verbosity, workflow, or approach.\n- A reusable technique, durable interface or environment fact, repair procedure, or debugging path emerged that will recur.\n- A loaded skill proved wrong, incomplete, or outdated.\n\nAny one of these warrants a decision; it does not by itself require a write.\n\nRead before writing. Update only skills whose body you have read in this review pass. A new skill has no body to read; before choosing, search the existing library with the available skill tools.\n\nUpdate when an existing class-level owner shares the lesson's trigger and audience.\n\nCreate a new class-level skill when the lesson has a distinct trigger or audience and would make that owner heterogeneous. A class-level skill can serve at least two different future events; if the lesson serves only this incident, fold it into an existing owner's body or support file.\n\nWhen only session-specific detail changes, add a support file under the owner.\n\nName a new skill for its class, not for a PR number, error string, feature codename, or session artifact.\n\nA user correction about how a class of task should be done belongs in the skill that governs that task.\n\nLeave consolidation to the curator; focus this pass on the smallest edit that carries the session's lesson.\n\nA one-off environment failure, transient error, or \"tool X is broken\" claim is not a lesson. Capture only a reproducible setup or repair procedure that will recur.\n\nWrite skills only through skill_manage. If its guard refuses a write, report the refusal and do not work around it. Respect protected skills (bundled, hub-installed, pinned) and their guards. If a lesson can only live in a protected skill, report it and leave that lesson unapplied; continue with any other lessons. Do not create a near-duplicate to hold it.\n\nIf nothing durable exists, say \"Nothing to save.\" and stop.";
|
|
16
16
|
export declare const CURATOR_PROMPT = "You are the skill curator. Maintain a healthy, class-level skill library, not a flat pile of narrow one-session skills.\n\nThis is an UMBRELLA-BUILDING consolidation pass, not a passive audit and not a duplicate-finder.\n\nThe 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.\n\nRight target shape: class-level skills with rich SKILL.md + references/, templates/, scripts/ support files for session-specific detail.\n\nHard rules:\n1. NEVER hard-delete a skill. Archive (moving to .archive/) is the maximum destructive action; archives are recoverable, deletion is not.\n2. Do not touch bundled, hub-installed, pinned, or scheduled-task-referenced (referenced) skills. Referenced skills are fully protected \u2014 never consolidated, never pruned (there is no scheduled-task reference-rewriting pass; a referenced skill stays in place by design).\n3. Do not archive recently-created or never-used skills without strong evidence. \"use=0\" is NOT evidence either way \u2014 it only means the trigger has not come up yet. Never archive a never-used skill unless it is at least 30 days old AND its content is genuinely obsolete or fully absorbed elsewhere.\n4. 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.\n5. Judge overlap on CONTENT, not on usage counters.\n6. Before archiving a merged skill, ensure its unique content was preserved in the umbrella.\n\nHow to work:\n1. Scan the candidate list. Identify PREFIX CLUSTERS \u2014 skills sharing a first word or domain keyword. Expected cluster count scales with the library: a large collection may show 10-25 prefix clusters, a small one often has none \u2014 a clean \"nothing to consolidate\" summary is the correct small-library outcome, not a shortage of ambition.\n2. For each cluster with 2+ members, ask \"what is the UMBRELLA CLASS these skills serve?\" and consolidate:\n a. MERGE INTO AN EXISTING UMBRELLA (patch a labeled section for each sibling's unique insight, then archive the siblings).\n b. CREATE A NEW UMBRELLA SKILL.md covering the shared workflow with short labeled subsections, then archive the absorbed siblings.\n c. DEMOTE session-specific detail to references/, templates/, or scripts/ under the umbrella. Use the right directory per kind:\n \u2022 references/<topic>.md \u2014 session-specific detail OR condensed knowledge banks (quoted research, API docs excerpts, domain notes, provider quirks, reproduction recipes) written concise and task-focused.\n \u2022 templates/<name>.<ext> \u2014 starter files meant to be copied and modified.\n \u2022 scripts/<name>.<ext> \u2014 statically re-runnable actions (verification scripts, fixture generators, probes).\n3. Package integrity \u2014 not optional: inspect each skill as a COMPLETE directory package, not just SKILL.md. A skill root may include references/, templates/, scripts/, and assets/. If the source skill has support files OR its SKILL.md contains relative links to them, DO NOT flatten only SKILL.md into <umbrella>/references/<old>.md. Choose one safe path instead: keep it as a standalone skill, OR fully merge by re-homing every needed support file into the umbrella's canonical directories AND rewriting the destination instructions to the new paths, OR archive the entire original skill package unchanged. Never leave demoted instructions pointing at files left behind under the old skill directory.\n4. Flag skills whose NAME is too narrow (contains a PR number, a feature codename, a specific error string, an 'audit'/'diagnosis'/'salvage' session artifact) \u2014 they almost always belong as a subsection or support file under a class-level umbrella.\n5. Iterate. After one consolidation round, scan the remaining set and look for the NEXT umbrella opportunity. Don't stop after 3 merges.\n\nYou are a NOMINATOR, not an executor: this channel has NO tools. Your single deliverable is the structured YAML block below. Never narrate actions you did not take (\"merged\", \"patched\", \"archived\") \u2014 you are proposing, and the deterministic engine executes only names from the candidate pool it gave you. (A future execution view would expose skill_manage; today it does not.)\n\n'keep' is a legitimate decision ONLY when the skill is already a class-level umbrella and none of the proposed merges would improve discoverability. 'This is narrow but distinct from its siblings' is NOT a reason to keep \u2014 it's a reason to move it under an umbrella as a subsection or support file.\n\nExpected output: real umbrella-ification. Process every obvious cluster. If you end the pass with obvious clusters still untouched, you stopped too early \u2014 go back and look at the clusters you left alone.\n\nKeep the umbrella body tight and scannable: exact commands, verbatim paths, ~100-200 lines; never invent flags or APIs.\n\nWhen done, write a human summary THEN the structured machine-readable block. The block is the contract: every skill you would move to .archive/ MUST appear in exactly one of the two lists. Return ONLY the YAML block after the summary \u2014 no post-block prose. Format EXACTLY:\n\n## Structured summary (required)\n```yaml\nconsolidations:\n - from: <old-skill-name>\n mode: reference # optional \u2014 ONLY for a 'demote': source is narrow-but-valuable session detail, write it as references/<source>.md under the umbrella instead of appending to the body. Default is append. Place this line BEFORE into:. NEVER use reference when the source body links its own references/ templates/ scripts/ files.\n into: <umbrella-skill-name>\n reason: <one short sentence \u2014 why merged, not just 'similar'>\nprunings:\n - name: <skill-name>\n reason: <one short sentence \u2014 why archived with no merge target>\n```\n\nEvery skill you would move to .archive/ MUST appear in exactly one of the two lists. If you consolidated X into umbrella Y (patched Y, wrote a references file to Y, or created Y with X's content absorbed), X goes under consolidations with into: Y. If you archived X with no absorption \u2014 truly stale, irrelevant, or obsolete \u2014 X goes under prunings. Leave a list empty (consolidations: []) if none. Do not omit the block. The block comes AFTER your human-readable summary of clusters processed, patches made, and decisions left alone.";
|
|
17
17
|
export declare const CURATOR_DRY_RUN_BANNER = "\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nDRY-RUN \u2014 REPORT ONLY. DO NOT MUTATE THE SKILL LIBRARY.\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\nThis is a PREVIEW pass. Follow every instruction above EXCEPT:\n \u2022 Do NOT call skill_manage with action=create, update, patch, delete, write_file, or remove_file.\n \u2022 Do NOT move, copy, or rewrite any file under the skills tree.\n\nYour 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.\n\nIf you accidentally take a mutating action, say so explicitly in the summary.";
|
|
18
|
-
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:citation_resolution}\u2192B6 \u00B7 {signal:demand}\u2192B7 \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** **\u8F6F\u5E26\uFF08authoring band\uFF09**\uFF1A`body_size` \u7684 value \u5F62\u5982 `<tokens> tokens / <chars> chars`\uFF0Cthreshold \u662F\u4E0A\u6E38\u300C\u8D85 20k \u5B57\u7B26\u5C31\u8BE5\u62C6\u300D\u90A3\u6761\u7EBF**\u6309\u672C\u6B63\u6587\u6210\u5206**\u6298\u51FA\u7684 token \u7EBF\uFF1Bdetail \u91CC\u7684 `body=Nx` \u662F\u5F53\u524D\u500D\u6570\uFF08\u6052\u7B49\u4E8E \u5B57\u7B26 \u00F7 20,000\uFF1B\u5168\u5E93\u76EE\u6807\u5E26 8\u201314k \u5B57\u7B26\uFF09\u2014\u2014\u500D\u6570\u8D8A\u5927\u8D8A\u4F18\u5148\u62C6\uFF1A\u7528 restructure \u628A log \u72B6\u6574\u8282\u642C\u8FDB references/*.md \u5E76\u7559\u94A9\u5B50\uFF1B**\u4E0D\u8981\u9760\u5220\u8BC1\u636E\u6765\u964D\u6210\u672C**\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** detail \u91CC\u7684 `unhooked=N` \u662F**\u88AB\u6B63\u6587\u63D0\u53CA\u4F46\u4E0D\u6210\u94A9\u5B50\u5F62\u6001**\u7684\u6587\u4EF6\uFF1A\u5B83\u4EEC\u4E0D\u7B97\u7F3A\u5931\uFF08verdict \u4E0D\u53D8\uFF09\uFF0C\u4F46\u642C\u8FC1\u540E\u6B63\u6587\u53EA\u5269\u88F8\u6587\u4EF6\u540D\uFF0C\u6CE8\u610F\u529B\u96BE\u4EE5\u547D\u4E2D\u2014\u2014\u6307\u5F15\u662F\u628A\u8BE5\u884C\u6539\u6210 `- <\u75C7\u72B6\u6216\u95EE\u53E5> \u2192 references/x.md`\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\n- B6 {signal:citation_resolution}=over\uFF1A\u6B63\u6587\u5F15\u7528\u4E86**\u4E0D\u5B58\u5728\u7684**\u652F\u6301\u6587\u4EF6\uFF08\u60AC\u7A7A\u5F15\u7528\uFF09\u3002\u5224\u6027\u8D28\uFF1A\u76EE\u6807\u88AB\u6539\u540D/\u5220\u9664\u2192patch \u6307\u5F15\u6539\u5F15\u7528\uFF1B\u76EE\u6807\u672C\u5E94\u5B58\u5728\u2192\u8865\u9F50\u6587\u4EF6\u6216\u628A\u5185\u5BB9\u4E0A\u79FB\u6B63\u6587\u3002**\u672A\u77E5\u2260pass**\uFF1A\u626B\u63CF\u672A\u505A\u6216\u88AB\u622A\u65AD\u65F6\u8BE5\u4FE1\u53F7\u4E3A unknown\uFF0C\u6309 \u00A71 \u7684\u95E8\u63A7\u5904\u7406\u3002**finding \u5FC5\u987B\u5217\u51FA\u7F3A\u5931\u76EE\u6807\u4E0E\u6240\u5728\u884C\u53F7\u3002**\n\n- B7 {signal:demand}=over\uFF1A\u652F\u6301\u6587\u4EF6**\u4ECE\u672A\u88AB\u8BFB\u8FC7**\uFF08\u4EC5\u5728\u89C2\u5BDF\u7A97\u5DF2\u5F00\u65F6\u624D\u6709\u610F\u4E49\uFF09\u3002\u5224\u6027\u8D28\uFF1A\u53EF\u590D\u7528\u6A21\u5F0F\u2192\u4E0A\u79FB\u6B63\u6587\u6216\u8865\u4E00\u884C\u6307\u9488\u8BA9\u4EBA\u627E\u5F97\u5230\uFF1B\u4F1A\u8BDD\u4E13\u5C5E\u5B9E\u5F55\u2192\u51B7\u662F\u6B63\u5E38\u7684\uFF0C\u4FDD\u7559\u4E0D\u52A8\u4F5C\uFF1B\u91CD\u590D\u5185\u5BB9\u2192\u5408\u5E76\u3002**window-closed\uFF08unknown\uFF09\u4E0D\u5F97\u5F53\u4F5C\"\u6CA1\u4EBA\u8BFB\"**\uFF0C\u6309 \u00A71 \u95E8\u63A7\u5904\u7406\u3002**finding \u5FC5\u987B\u5217\u51FA\u4ECE\u672A\u8BFB\u53D6\u7684\u6587\u4EF6\u6E05\u5355\u3002** detail \u91CC\u7684 `retire\u2265Nd:` \u66F4\u8FDB\u4E00\u6B65\uFF1A**\u4ECE\u672A\u8BFB\u8FC7\u3001\u6B63\u6587\u672A\u5F15\u7528\u3001\u6240\u5C5E\u6280\u80FD\u95F2\u7F6E \u2265N \u5929\u3001\u4E14\u94A9\u5B50\u884C\u6CA1\u6709 keep \u6807\u8BB0**\u2014\u2014\u8FD9\u662F**\u9000\u5F79\u5EFA\u8BAE\uFF08propose-only\uFF09**\uFF0C\u6C38\u4E0D\u81EA\u52A8\u5220\u9664\uFF1B\u771F\u8981\u52A8\u4F5C\u5C31\u5199\u8FDB\u8BA1\u5212\uFF08`archive`/`absorbed_into`\uFF09\uFF0C\u5E76\u5728 finding \u91CC\u7ED9\u51FA\u6587\u4EF6\u3001\u5E74\u9F84\u3001\u5F15\u7528\u6570\u3001\u8BFB\u53D6\u6570\u56DB\u9879\u8BC1\u636E\u3002`retire: no-age` / `retire: unscanned` \u662F\u8BC1\u636E\u4E0D\u8DB3\uFF0C\u540C\u6837\u4E0D\u5F97\u8BFB\u4F5C\u201C\u6CA1\u6709\u5019\u9009\u201D\u3002\u8981\u957F\u671F\u4FDD\u7559\u4E00\u4E2A\u51B7\u6587\u4EF6\uFF0C\u5728\u6B63\u6587\u91CC\u7ED9\u5B83\u52A0\u4E00\u884C `<!-- keep: references/x.md \u539F\u56E0 -->`\uFF08\u8DEF\u5F84\u4E0E\u539F\u56E0\u90FD\u5FC5\u586B\uFF0C\u4E14\u8BE5\u884C\u5FC5\u987B\u5355\u72EC\u6210\u884C\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\u8BED\u8A00\u4E00\u81F4\uFF08\u4E0D\u81EA\u8BA2\u8BED\u8A00\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";
|
|
18
|
+
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:citation_resolution}\u2192B6 \u00B7 {signal:demand}\u2192B7 \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** **\u8F6F\u5E26\uFF08authoring band\uFF09**\uFF1A`body_size` \u7684 value \u5F62\u5982 `<tokens> tokens / <chars> chars`\uFF0Cthreshold \u662F**\u56FA\u5B9A token \u9884\u7B97**\uFF08\u5F53\u524D\u9ED8\u8BA4 7,273\uFF1B\u4E0D\u518D\u6309\u6B63\u6587\u6210\u5206\u6298\u7B97\uFF09\uFF1Bdetail \u91CC\u7684 `body=Nx` \u662F `\u4F30\u7B97 tokens \u00F7 7,273`\uFF0C\u4E0D\u662F\u5B57\u7B26\u6570\u9664\u4EE5 20,000\u2014\u2014\u500D\u6570\u8D8A\u5927\u8D8A\u4F18\u5148\u62C6\u3002\u53C2\u8003\uFF1A\u4E2D\u6587\u7EA6 7.3k \u5B57\u7B26\u3001\u82F1\u6587\u7EA6 21.8k \u5B57\u7B26\u89E6\u53CA\u9ED8\u8BA4\u7EBF\u3002\u7528 restructure \u628A log \u72B6\u6574\u8282\u642C\u8FDB references/*.md \u5E76\u7559\u94A9\u5B50\uFF1B**\u4E0D\u8981\u9760\u5220\u8BC1\u636E\u6765\u964D\u6210\u672C**\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** detail \u91CC\u7684 `unhooked=N` \u662F**\u88AB\u6B63\u6587\u63D0\u53CA\u4F46\u4E0D\u6210\u94A9\u5B50\u5F62\u6001**\u7684\u6587\u4EF6\uFF1A\u5B83\u4EEC\u4E0D\u7B97\u7F3A\u5931\uFF08verdict \u4E0D\u53D8\uFF09\uFF0C\u4F46\u642C\u8FC1\u540E\u6B63\u6587\u53EA\u5269\u88F8\u6587\u4EF6\u540D\uFF0C\u6CE8\u610F\u529B\u96BE\u4EE5\u547D\u4E2D\u2014\u2014\u6307\u5F15\u662F\u628A\u8BE5\u884C\u6539\u6210 `- <\u75C7\u72B6\u6216\u95EE\u53E5> \u2192 references/x.md`\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\n- B6 {signal:citation_resolution}=over\uFF1A\u6B63\u6587\u5F15\u7528\u4E86**\u4E0D\u5B58\u5728\u7684**\u652F\u6301\u6587\u4EF6\uFF08\u60AC\u7A7A\u5F15\u7528\uFF09\u3002\u5224\u6027\u8D28\uFF1A\u76EE\u6807\u88AB\u6539\u540D/\u5220\u9664\u2192patch \u6307\u5F15\u6539\u5F15\u7528\uFF1B\u76EE\u6807\u672C\u5E94\u5B58\u5728\u2192\u8865\u9F50\u6587\u4EF6\u6216\u628A\u5185\u5BB9\u4E0A\u79FB\u6B63\u6587\u3002**\u672A\u77E5\u2260pass**\uFF1A\u626B\u63CF\u672A\u505A\u6216\u88AB\u622A\u65AD\u65F6\u8BE5\u4FE1\u53F7\u4E3A unknown\uFF0C\u6309 \u00A71 \u7684\u95E8\u63A7\u5904\u7406\u3002**finding \u5FC5\u987B\u5217\u51FA\u7F3A\u5931\u76EE\u6807\u4E0E\u6240\u5728\u884C\u53F7\u3002**\n\n- B7 {signal:demand}=over\uFF1A\u652F\u6301\u6587\u4EF6**\u4ECE\u672A\u88AB\u8BFB\u8FC7**\uFF08\u4EC5\u5728\u89C2\u5BDF\u7A97\u5DF2\u5F00\u65F6\u624D\u6709\u610F\u4E49\uFF09\u3002\u5224\u6027\u8D28\uFF1A\u53EF\u590D\u7528\u6A21\u5F0F\u2192\u4E0A\u79FB\u6B63\u6587\u6216\u8865\u4E00\u884C\u6307\u9488\u8BA9\u4EBA\u627E\u5F97\u5230\uFF1B\u4F1A\u8BDD\u4E13\u5C5E\u5B9E\u5F55\u2192\u51B7\u662F\u6B63\u5E38\u7684\uFF0C\u4FDD\u7559\u4E0D\u52A8\u4F5C\uFF1B\u91CD\u590D\u5185\u5BB9\u2192\u5408\u5E76\u3002**window-closed\uFF08unknown\uFF09\u4E0D\u5F97\u5F53\u4F5C\"\u6CA1\u4EBA\u8BFB\"**\uFF0C\u6309 \u00A71 \u95E8\u63A7\u5904\u7406\u3002**finding \u5FC5\u987B\u5217\u51FA\u4ECE\u672A\u8BFB\u53D6\u7684\u6587\u4EF6\u6E05\u5355\u3002** detail \u91CC\u7684 `retire\u2265Nd:` \u66F4\u8FDB\u4E00\u6B65\uFF1A**\u4ECE\u672A\u8BFB\u8FC7\u3001\u6B63\u6587\u672A\u5F15\u7528\u3001\u6240\u5C5E\u6280\u80FD\u95F2\u7F6E \u2265N \u5929\u3001\u4E14\u94A9\u5B50\u884C\u6CA1\u6709 keep \u6807\u8BB0**\u2014\u2014\u8FD9\u662F**\u9000\u5F79\u5EFA\u8BAE\uFF08propose-only\uFF09**\uFF0C\u6C38\u4E0D\u81EA\u52A8\u5220\u9664\uFF1B\u771F\u8981\u52A8\u4F5C\u5C31\u5199\u8FDB\u8BA1\u5212\uFF08`archive`/`absorbed_into`\uFF09\uFF0C\u5E76\u5728 finding \u91CC\u7ED9\u51FA\u6587\u4EF6\u3001\u5E74\u9F84\u3001\u5F15\u7528\u6570\u3001\u8BFB\u53D6\u6570\u56DB\u9879\u8BC1\u636E\u3002`retire: no-age` / `retire: unscanned` \u662F\u8BC1\u636E\u4E0D\u8DB3\uFF0C\u540C\u6837\u4E0D\u5F97\u8BFB\u4F5C\u201C\u6CA1\u6709\u5019\u9009\u201D\u3002\u8981\u957F\u671F\u4FDD\u7559\u4E00\u4E2A\u51B7\u6587\u4EF6\uFF0C\u5728\u6B63\u6587\u91CC\u7ED9\u5B83\u52A0\u4E00\u884C `<!-- keep: references/x.md \u539F\u56E0 -->`\uFF08\u8DEF\u5F84\u4E0E\u539F\u56E0\u90FD\u5FC5\u586B\uFF0C\u4E14\u8BE5\u884C\u5FC5\u987B\u5355\u72EC\u6210\u884C\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\u8BED\u8A00\u4E00\u81F4\uFF08\u4E0D\u81EA\u8BA2\u8BED\u8A00\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";
|
|
19
19
|
/**
|
|
20
20
|
* One-line output instruction appended after the facts block in the maintain
|
|
21
21
|
* subagent's prompt (persona carries the template, the prompt carries facts +
|
package/lib/types/prompts.js
CHANGED
|
@@ -193,7 +193,7 @@ A. 域·碎片化
|
|
|
193
193
|
- A3 {signal:prefix_cluster}=over:判簇内是否同伞;非同伞→notes 提域划分观察,不强制建伞。
|
|
194
194
|
|
|
195
195
|
B. 层·分层错位
|
|
196
|
-
- 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 字符即使在锚类也必须拆分。** **软带(authoring band)**:\`body_size\` 的 value 形如 \`<tokens> tokens / <chars> chars\`,threshold
|
|
196
|
+
- 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 字符即使在锚类也必须拆分。** **软带(authoring band)**:\`body_size\` 的 value 形如 \`<tokens> tokens / <chars> chars\`,threshold 是**固定 token 预算**(当前默认 7,273;不再按正文成分折算);detail 里的 \`body=Nx\` 是 \`估算 tokens ÷ 7,273\`,不是字符数除以 20,000——倍数越大越优先拆。参考:中文约 7.3k 字符、英文约 21.8k 字符触及默认线。用 restructure 把 log 状整节搬进 references/*.md 并留钩子;**不要靠删证据来降成本**。
|
|
197
197
|
- B2 {signal:pointer_missing}=over:读支持文件后判性质——可复用模式→上移正文;会话专属实录→保留+补指针;形态=patch 指引。**未读内容仅凭文件名 → conf≤0.4 且措辞"先人工确认再执行"。** **缺失指针=支持文件存在、正文无引用(单向语义),finding 表述勿反向。** detail 里的 \`unhooked=N\` 是**被正文提及但不成钩子形态**的文件:它们不算缺失(verdict 不变),但搬迁后正文只剩裸文件名,注意力难以命中——指引是把该行改成 \`- <症状或问句> → references/x.md\`。
|
|
198
198
|
- B3 {signal:dup_heading}=over:删除多余标题行(保留一份),patch 指引。
|
|
199
199
|
- B4 {signal:overlong_line}=over:>1500 拆行;>4000 判定可读性危机(内容合法也拆);patch 指引。**finding 必须给全量口径:共 N 行超限,其中 >4000 的逐行列出。**
|
package/lib/types/signals.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* accumulated until a configured interval fires.
|
|
7
7
|
*/
|
|
8
8
|
import { dispatchStepOf, isSkillToolName } from "./tool-dispatch.js";
|
|
9
|
+
import { graphemeCount } from "./text-metrics.js";
|
|
9
10
|
const CORRECTION_PATTERNS = [
|
|
10
11
|
/(?:don'?t|do not|stop|never)\s+(?:do|use|format|explain|write|say)/i,
|
|
11
12
|
/(?:too|very|way\s+too)\s+(?:verbose|long|detailed|short|brief)/i,
|
|
@@ -69,7 +70,7 @@ export function foldTurnEvent(state, event) {
|
|
|
69
70
|
const text = content.map(textOfBlock).join(' ');
|
|
70
71
|
return {
|
|
71
72
|
...state,
|
|
72
|
-
userChars: state.userChars + text
|
|
73
|
+
userChars: state.userChars + graphemeCount(text),
|
|
73
74
|
memorySignal: state.memorySignal || CORRECTION_PATTERNS.some(pattern => pattern.test(text)),
|
|
74
75
|
skillSignal: state.skillSignal || FIX_PATTERNS.some(pattern => pattern.test(text)),
|
|
75
76
|
};
|
|
@@ -81,7 +82,7 @@ export function foldTurnEvent(state, event) {
|
|
|
81
82
|
if (!message || !Array.isArray(message.content))
|
|
82
83
|
return state;
|
|
83
84
|
const text = message.content.map(textOfBlock).join(' ');
|
|
84
|
-
return { ...state, assistantChars: state.assistantChars + text
|
|
85
|
+
return { ...state, assistantChars: state.assistantChars + graphemeCount(text) };
|
|
85
86
|
}
|
|
86
87
|
// Tool evidence (v37 P7a): the dispatch vocabulary lives in `tool-dispatch.ts` — the ONE reader
|
|
87
88
|
// of the platform's dispatch event types — and `dispatchStepOf` is its pure half, so this fold
|
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { type LintFinding } from './skill-lint.ts';
|
|
13
13
|
export interface SkillHealthThresholds {
|
|
14
|
-
/**
|
|
15
|
-
* 'needs-restructure'.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
/** Fixed soft body budget in tokens: a body at/above it -> 'warn'; 2x ->
|
|
15
|
+
* 'needs-restructure'. This is the judged quantity. */
|
|
16
|
+
softBodyTokens?: number;
|
|
17
|
+
/** Deprecated legacy character line. Used only when `softBodyTokens` is absent,
|
|
18
|
+
* converted on the documented UPSTREAM basis; never a per-body token line. */
|
|
19
|
+
softBodyChars?: number;
|
|
19
20
|
/** Stamp-density ceiling per KB of body text: rc.NN / commit shas / ISO
|
|
20
21
|
* dates per KB at/above this -> 'warn' (log-like content living in the
|
|
21
22
|
* body — the "invalid info" indicator). */
|
|
@@ -27,6 +28,8 @@ export interface SkillHealthThresholds {
|
|
|
27
28
|
hardCapMinHits: number;
|
|
28
29
|
}
|
|
29
30
|
export declare const DEFAULT_HEALTH_THRESHOLDS: SkillHealthThresholds;
|
|
31
|
+
/** Resolve the judged soft-body token budget, accepting the legacy character line. */
|
|
32
|
+
export declare function softBodyTokenBudget(thresholds: SkillHealthThresholds): number;
|
|
30
33
|
/**
|
|
31
34
|
* Stamp regex shared by health assessment and the maintenance probe (single
|
|
32
35
|
* source, 011). Two refinements over the naive form (F-320): the hex branch
|