@lmzhen/dsh-evolution-core 0.3.67 → 0.3.69
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 +766 -232
- package/lib/types/constants.d.ts +14 -0
- package/lib/types/curator.d.ts +21 -1
- package/lib/types/events.d.ts +10 -0
- package/lib/types/evolution-events.d.ts +9 -6
- package/lib/types/io.d.ts +65 -0
- package/lib/types/memory-store.d.ts +79 -13
- package/lib/types/prompts.d.ts +6 -6
- package/lib/types/skill-store.d.ts +101 -22
- package/lib/types/threats.d.ts +3 -0
- package/package.json +1 -1
package/lib/types/constants.d.ts
CHANGED
|
@@ -83,4 +83,18 @@ export declare const EVOLUTION_WRITE_TOOLS: readonly ["memory", "skill_manage"];
|
|
|
83
83
|
* 0.3.16 (T-4): moved here from skill-store.ts so drift-signals (pure, no IO)
|
|
84
84
|
* can reference it without importing the skill-store module. */
|
|
85
85
|
export declare const AUTHORING_DESCRIPTION_BAR = 60;
|
|
86
|
+
/** V27 G2.4: the largest millisecond delay a timer accepts. `AbortSignal.timeout`
|
|
87
|
+
* (and `setTimeout`) coerce anything larger to 1ms after a Node warning, so a
|
|
88
|
+
* timeout configured above this ceiling silently collapses to "immediately
|
|
89
|
+
* aborted". The curator's review timeout and the review timeout each carried
|
|
90
|
+
* their own copy of the literal; the bound is one protocol constant.
|
|
91
|
+
* (v19 P2-10 corrected the value from 2^32-1 to Node's real 2^31-1 ceiling.) */
|
|
92
|
+
export declare const MAX_TIMER_DELAY_MS = 2147483647;
|
|
93
|
+
/** V27 G2.4: the model each review/curation leg defaults to. The policy schema,
|
|
94
|
+
* the policy resolver and the curator's LLM nomination pass each carried their
|
|
95
|
+
* own copy of these strings — a deployment that changed the policy default used
|
|
96
|
+
* to leave the curator passing a different model than the reviews. */
|
|
97
|
+
export declare const DEFAULT_MEMORY_REVIEW_MODEL = "deepseek-v4-flash";
|
|
98
|
+
export declare const DEFAULT_SKILL_REVIEW_MODEL = "deepseek-v4-pro";
|
|
99
|
+
export declare const DEFAULT_CURATOR_MODEL = "deepseek-v4-pro";
|
|
86
100
|
//# sourceMappingURL=constants.d.ts.map
|
package/lib/types/curator.d.ts
CHANGED
|
@@ -40,7 +40,13 @@ export interface CuratorResult {
|
|
|
40
40
|
}
|
|
41
41
|
export interface CuratorArchivedSkill {
|
|
42
42
|
name: string;
|
|
43
|
-
|
|
43
|
+
/** v28 G4.3 (CUR-03): the on-disk archive destination. OMITTED when the run
|
|
44
|
+
* only knows the nominal `.archive/<name>` location — consolidation sources
|
|
45
|
+
* archive through SkillLibrary.archive(), which stamps a
|
|
46
|
+
* `<name>-<stamp>[-<rand>]` suffix on collision. A synthesized path sent
|
|
47
|
+
* operators to a directory that may not exist; the real destination is on
|
|
48
|
+
* the `evolution/skill-mutated` event (`archivedPath`). */
|
|
49
|
+
path?: string;
|
|
44
50
|
reason: string;
|
|
45
51
|
}
|
|
46
52
|
export interface CuratorFailedSkill {
|
|
@@ -57,7 +63,17 @@ export interface CuratorRunReport {
|
|
|
57
63
|
llmNominations: string[];
|
|
58
64
|
archiveCandidates: string[];
|
|
59
65
|
archived: CuratorArchivedSkill[];
|
|
66
|
+
/** Failures attributable to a SKILL NAME (`<name>: …`). V27 CUR-2: this field
|
|
67
|
+
* is the skill-attributable subset only — run-level facts (an abort, a phase
|
|
68
|
+
* that could not start) live in `aborted`/`unattributed` so a report can no
|
|
69
|
+
* longer show `failed: 0` for a run that was cut short. */
|
|
60
70
|
failed: CuratorFailedSkill[];
|
|
71
|
+
/** V27 CUR-2: the run stopped early (e.g. disposed mid-run, timeout). The
|
|
72
|
+
* string names the phase that did not complete; absent on a full run. */
|
|
73
|
+
aborted?: string;
|
|
74
|
+
/** V27 CUR-2: error strings that could not be attributed to a skill name.
|
|
75
|
+
* They were previously collected in memory and then dropped on write. */
|
|
76
|
+
unattributed?: string[];
|
|
61
77
|
/** Consolidations actually executed this run (source absorbed into target). */
|
|
62
78
|
consolidated?: CuratorConsolidation[];
|
|
63
79
|
snapshotPath?: string;
|
|
@@ -75,6 +91,10 @@ export interface CuratorReportInput {
|
|
|
75
91
|
archiveCandidates: readonly string[];
|
|
76
92
|
archived: readonly CuratorArchivedSkill[];
|
|
77
93
|
failed: readonly CuratorFailedSkill[];
|
|
94
|
+
/** V27 CUR-2: run-level abort reason (see CuratorRunReport.aborted). */
|
|
95
|
+
aborted?: string;
|
|
96
|
+
/** V27 CUR-2: errors with no skill name to attribute them to. */
|
|
97
|
+
unattributed?: readonly string[];
|
|
78
98
|
consolidated?: readonly CuratorConsolidation[];
|
|
79
99
|
snapshotPath?: string;
|
|
80
100
|
llmReviewEnabled?: boolean;
|
package/lib/types/events.d.ts
CHANGED
|
@@ -39,12 +39,22 @@ export interface EvolutionPlanAppliedEvent {
|
|
|
39
39
|
policyFingerprint?: string | undefined;
|
|
40
40
|
memoryApplied: number;
|
|
41
41
|
skillApplied: number;
|
|
42
|
+
/** Validation rejects ONLY (see the contract note below). V27 R-03: a plan op
|
|
43
|
+
* that was skipped because the session had not read the skill is NOT a
|
|
44
|
+
* validation reject and now travels in `skippedUnread`. */
|
|
42
45
|
rejectedOps: number;
|
|
43
46
|
/** 0.3.31 (V5-19): execution-layer failures — ops that reached execution but
|
|
44
47
|
* did not land (non-throw `ok:false` results). `rejectedOps` counts only
|
|
45
48
|
* VALIDATION rejects; a consumer that treats rejectedOps as "work not done"
|
|
46
49
|
* would otherwise miss a partial application. */
|
|
47
50
|
executionFailures?: number | undefined;
|
|
51
|
+
/** V27 R-03: "not done" has a third, independent cause — an op naming a skill
|
|
52
|
+
* this session never read (the review pipeline refuses to touch unread
|
|
53
|
+
* skills). It is neither a validation reject nor an execution failure, so it
|
|
54
|
+
* has its own field; folding it into `rejectedOps` broke that field's stated
|
|
55
|
+
* contract and made the replay leaderboard penalize one refusal twice
|
|
56
|
+
* (rejectedOps weight AND the executionFailures dimension). */
|
|
57
|
+
skippedUnread?: number | undefined;
|
|
48
58
|
/** First execution-layer failure message (abort reason or op failure). */
|
|
49
59
|
executionError?: string | undefined;
|
|
50
60
|
evidenceQuotes?: number | undefined;
|
|
@@ -8,12 +8,15 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Usage events (C semantics, rc.73+): `type:'usage'` records are the
|
|
10
10
|
* OBSERVATION WINDOW ANCHOR — written once, when the library's first observed
|
|
11
|
-
* read (`view_count` 0 -> 1) happens.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* and `window.opened` pins
|
|
11
|
+
* read (`view_count` 0 -> 1) happens. The anchor is the durable timeline record
|
|
12
|
+
* of that moment: the churn-suppression gate itself (`usageObserved()`) reads
|
|
13
|
+
* the usage SIDECAR's own first-view evidence, since reads were invisible to it
|
|
14
|
+
* pre-A2 and no sidecar record can reach `view_count > 0` without the same
|
|
15
|
+
* 0 -> 1 transition. `counts` on the event is a cumulative library-wide
|
|
16
|
+
* snapshot (skills/views/use/patches) at that moment, and `window.opened` pins
|
|
17
|
+
* the window start for the timeline. (V27 G3.3: `verify-event-pairing` requires
|
|
18
|
+
* every persisted type to have a production reader or a declared external
|
|
19
|
+
* contract — this one is the latter.)
|
|
17
20
|
*
|
|
18
21
|
* Rotation (rc.71, 007 design): when the active log reaches
|
|
19
22
|
* `EVENT_LOG_ROTATE_AT` the older half is split into an archive
|
package/lib/types/io.d.ts
CHANGED
|
@@ -146,6 +146,71 @@ export declare const LOCK_BODY_RE: RegExp;
|
|
|
146
146
|
* `*.lock`) — callers leave such files alone. A shape-matching body always
|
|
147
147
|
* yields a number (possibly `0`, which `isProcessAlive` treats as dead). */
|
|
148
148
|
export declare function parseLockBody(body: string): number | null;
|
|
149
|
+
/**
|
|
150
|
+
* V27 G0.2 (EVO-IO-01): the write lock named by this claim is no longer ours
|
|
151
|
+
* at the commit point — a takeover reclaimed it while we were inside the
|
|
152
|
+
* critical section. The lock layer converts this into a retry of the whole
|
|
153
|
+
* read-modify-write; it must never reach a caller as a successful write.
|
|
154
|
+
*/
|
|
155
|
+
export declare class LostWriteLock extends Error {
|
|
156
|
+
constructor();
|
|
157
|
+
}
|
|
158
|
+
/** V27 G1.1: the three takeover windows, as protocol constants at ONE place
|
|
159
|
+
* (the inline copies that used to live in the acquisition loop, plus the dead
|
|
160
|
+
* branch's bare `1000`, are gone). */
|
|
161
|
+
/** A named holder that is gone, past this age, is reclaimed. Fits inside the
|
|
162
|
+
* `lockAttempts * 50ms` retry budget so a dead holder's lock is reachable
|
|
163
|
+
* within one budget (v19 gate arithmetic: budget >= 2 x threshold). */
|
|
164
|
+
export declare const DEAD_LOCK_TAKEOVER_MS = 1000;
|
|
165
|
+
/** No body at all: nothing attributes the lock to a holder, so this is the one
|
|
166
|
+
* branch that cannot probe liveness — it must outlast any plausible stall
|
|
167
|
+
* between create and body write (V27 G0.2: 1s was below what a loaded machine
|
|
168
|
+
* actually took, which let a peer delete a live holder's lock). */
|
|
169
|
+
export declare const EMPTY_LOCK_TAKEOVER_MS = 30000;
|
|
170
|
+
/** A body with no parseable pid (crash mid-write): 1h, far above any legal hold
|
|
171
|
+
* and far below "forever". */
|
|
172
|
+
export declare const LOCK_TEAR_TAKEOVER_MS = 3600000;
|
|
173
|
+
/**
|
|
174
|
+
* V27 G1.3: the error `commitTmp` throws when the rename landed but the parent
|
|
175
|
+
* directory fsync failed — the bytes ARE visible, only their durability is
|
|
176
|
+
* unconfirmed. A consumer that treats it as a plain failure reports "not
|
|
177
|
+
* written" for a write that happened (and a two-phase caller may try to roll
|
|
178
|
+
* back a visible write). Every transaction consumer must therefore treat this
|
|
179
|
+
* shape as SUCCESS-with-warning, never as a rejection.
|
|
180
|
+
*/
|
|
181
|
+
export declare function isCommittedWarning(error: unknown): boolean;
|
|
182
|
+
/** V27 G1.1: the takeover branches, as a value. */
|
|
183
|
+
export type TakeoverDecision = 'none' | 'dead' | 'empty' | 'corrupt';
|
|
184
|
+
/** V27 G1.1: one lock observation, plus the liveness probe for its pid. */
|
|
185
|
+
export interface TakeoverProbe {
|
|
186
|
+
/** Raw lock body. An empty string means the file exists with no content. */
|
|
187
|
+
body: string;
|
|
188
|
+
/** Lock mtime in epoch ms. */
|
|
189
|
+
mtimeMs: number;
|
|
190
|
+
/** Liveness probe for a pid (injected so the decision is a pure function). */
|
|
191
|
+
alive: (pid: number) => boolean;
|
|
192
|
+
/** Evaluation instant (defaults to now). */
|
|
193
|
+
nowMs?: number;
|
|
194
|
+
/** Threshold overrides — production callers use the protocol defaults. */
|
|
195
|
+
deadAfterMs?: number;
|
|
196
|
+
emptyAfterMs?: number;
|
|
197
|
+
corruptAfterMs?: number;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* V27 G1.1: the lock-takeover decision as ONE pure function, so the protocol is
|
|
201
|
+
* testable and exhaustive instead of being an inline expression inside the
|
|
202
|
+
* acquisition loop:
|
|
203
|
+
* - `none` the lock is fresh, or its holder is alive → wait, never steal;
|
|
204
|
+
* - `dead` a named holder that is gone, past the dead threshold;
|
|
205
|
+
* - `empty` no body at all: nothing attributes it to a holder, so only the
|
|
206
|
+
* wide `emptyAfterMs` window may reclaim it;
|
|
207
|
+
* - `corrupt` a body with no parseable pid (a crash mid-write), past the 1h
|
|
208
|
+
* tear threshold.
|
|
209
|
+
* The age thresholds compare against `nowMs - mtimeMs` with `>` so a lock whose
|
|
210
|
+
* age EQUALS the threshold is not yet reclaimed (the boundary the v19 gate fix
|
|
211
|
+
* pinned).
|
|
212
|
+
*/
|
|
213
|
+
export declare function decideTakeover(probe: TakeoverProbe): TakeoverDecision;
|
|
149
214
|
/**
|
|
150
215
|
* Build the Node IO backend. `lockAttempts` scales the write-lock retry budget
|
|
151
216
|
* (attempts × 50ms); the default 40 (~2s, rc.69) covers production contention,
|
|
@@ -100,6 +100,25 @@ export declare class MemoryStore {
|
|
|
100
100
|
* silently overwritten.
|
|
101
101
|
*/
|
|
102
102
|
private oversizedRefusal;
|
|
103
|
+
/**
|
|
104
|
+
* The ONE memory write skeleton (V27 G2.5): oversized read-guard pre-transact,
|
|
105
|
+
* one transaction over the target path, and the C-01 structured refusal when a
|
|
106
|
+
* backend never invokes the task. `addChained` and `applyBatchChained` supply
|
|
107
|
+
* only their own in-transaction core, so the two write paths cannot drift in
|
|
108
|
+
* their guard order, their missing-file handling or their error text.
|
|
109
|
+
*
|
|
110
|
+
* @param target - memory target being written
|
|
111
|
+
* @param core - the in-transaction read-modify-write for the locked body
|
|
112
|
+
* @param shrinkOnly - v29 MEM-02: every queued operation REMOVES an entry
|
|
113
|
+
* (the recovery path for a limit lowered under existing content). The
|
|
114
|
+
* oversized read-guard is skipped for these batches: a canonical file
|
|
115
|
+
* written under a ≥10× higher limit trips the `limit × 10` byte bound, and
|
|
116
|
+
* the guard's "fix the file manually" refusal would pre-empt exactly the
|
|
117
|
+
* shrink recovery MEM-01 advertises. The load is bounded by what the store
|
|
118
|
+
* itself wrote under the old limit.
|
|
119
|
+
* @returns the core's result, or the oversized / contract-violation refusal
|
|
120
|
+
*/
|
|
121
|
+
private chainedWrite;
|
|
103
122
|
add(target: MemoryTarget, facts: string): Promise<MemoryApplyResult>;
|
|
104
123
|
private addChained;
|
|
105
124
|
/**
|
|
@@ -108,26 +127,73 @@ export declare class MemoryStore {
|
|
|
108
127
|
* (`current`) — never a second IO read. `write: null` means "no change".
|
|
109
128
|
*/
|
|
110
129
|
private addCore;
|
|
111
|
-
/**
|
|
112
|
-
|
|
130
|
+
/**
|
|
131
|
+
* The single drift evaluation. `raw` is in canonical form when it byte-matches
|
|
132
|
+
* `render(normalizeEntries(raw))`; anything else means it was edited outside
|
|
133
|
+
* MemoryStore (empty/`§`-only entries, stray blank lines, leading or trailing
|
|
134
|
+
* delimiters — structural anomalies the writer would quietly normalize away).
|
|
135
|
+
* Both write paths derive this from their locked view and `detectDrift` from
|
|
136
|
+
* a fresh read, so a write and a later read can never disagree about the same
|
|
137
|
+
* bytes.
|
|
138
|
+
*
|
|
139
|
+
* An absent, empty, or whitespace-only body is the "never written" state
|
|
140
|
+
* (rc.42 audit P1-6): it parses to zero entries, and the canonical form
|
|
141
|
+
* `'\n'` can never byte-match it, so flagging it would permanently refuse
|
|
142
|
+
* every write path — including the repairs the model would need to make.
|
|
143
|
+
* Such files are adopted instead of flagged.
|
|
144
|
+
*
|
|
145
|
+
* Returns one of:
|
|
146
|
+
* - `'external'` — non-canonical body, i.e. real external modification. This
|
|
147
|
+
* includes the Hermes-parity signal #2 (an entry larger than the whole-file
|
|
148
|
+
* limit): that shape is only meaningful as external evidence on a
|
|
149
|
+
* NON-canonical body, because free-form external appends never render
|
|
150
|
+
* canonically.
|
|
151
|
+
* - `'over-limit'` — v28 MEM-01: a CANONICAL body whose entries exceed the
|
|
152
|
+
* CURRENT configured limit. Those bytes were written by this store under a
|
|
153
|
+
* previous (higher) limit, so they are not external drift; treating them as
|
|
154
|
+
* such misattributed a config change to an "external editor" and bricked
|
|
155
|
+
* every write path (the advertised recovery — remove/consolidate — is
|
|
156
|
+
* exactly what the drift gate refused). Callers route this state to a
|
|
157
|
+
* config-naming refusal and let shrink-only batches through.
|
|
158
|
+
* - `null` — no drift: writable as-is.
|
|
159
|
+
*
|
|
160
|
+
* @param target - memory target whose char limit bounds one parsed entry
|
|
161
|
+
* @param raw - on-disk body, or `null` when the file does not exist
|
|
162
|
+
*/
|
|
163
|
+
private driftKind;
|
|
164
|
+
/** External-drift predicate: canonical-form violations only (see
|
|
165
|
+
* {@link driftKind}). `detectDrift` and the write paths share it, so a write
|
|
166
|
+
* and a later read never disagree about the same bytes. */
|
|
167
|
+
private drifted;
|
|
168
|
+
/**
|
|
169
|
+
* Drift refusal for a body already read under the write lock, or `null` when
|
|
170
|
+
* writing may proceed. Both write paths return this unchanged, so their
|
|
171
|
+
* refusals stay byte-identical and each carries the same backup.
|
|
172
|
+
*
|
|
173
|
+
* The `'over-limit'` state never refuses shrink-only batches (`shrinkOnly`):
|
|
174
|
+
* removing entries is the advertised recovery for a limit lowered under
|
|
175
|
+
* existing content, and the batch's own final limit check still gates the
|
|
176
|
+
* result.
|
|
177
|
+
*
|
|
178
|
+
* @param target - memory target that owns the drifted file
|
|
179
|
+
* @param raw - locked file body
|
|
180
|
+
* @param shrinkOnly - every queued operation removes an entry (no growth)
|
|
181
|
+
* @returns the refusal to hand back, or `null` to continue writing
|
|
182
|
+
*/
|
|
183
|
+
private driftRefusal;
|
|
113
184
|
applyBatch(target: MemoryTarget, operations: MemoryOperation[]): Promise<MemoryApplyResult>;
|
|
114
185
|
private applyBatchChained;
|
|
115
186
|
/** Batch RMW inside the transaction. `write: null` = failure/no-op, disk untouched. */
|
|
116
187
|
private applyBatchCore;
|
|
117
188
|
renderContext(): Promise<string>;
|
|
118
189
|
/**
|
|
119
|
-
* Detect on-disk drift
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* edited outside MemoryStore. Purely single-canonical content reaches the
|
|
124
|
-
* same serialization and returns false, so a normal write is never flagged.
|
|
190
|
+
* Detect on-disk drift for a caller that holds no locked view: `true` when the
|
|
191
|
+
* file is not in canonical form, or when its size trips the read guard. The
|
|
192
|
+
* write paths apply the same predicate (`drifted`) to the body they read under
|
|
193
|
+
* the lock, so a write and a follow-up read agree about the same bytes.
|
|
125
194
|
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* `'\n'` can never byte-match it and every write path was permanently
|
|
129
|
-
* refused with "External drift detected" — including the repairs the model
|
|
130
|
-
* would need to make. Such files are adopted instead of flagged.
|
|
195
|
+
* @param target - memory target to inspect
|
|
196
|
+
* @returns whether the file on disk counts as externally drifted
|
|
131
197
|
*/
|
|
132
198
|
detectDrift(target: MemoryTarget): Promise<boolean>;
|
|
133
199
|
}
|
package/lib/types/prompts.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* changes semantically: the bundle digest is the fail-closed signal for
|
|
4
4
|
* review workers, so a stale id across deployments must be distinguishable.
|
|
5
5
|
*/
|
|
6
|
-
export declare const PROMPT_BUNDLE_VERSION =
|
|
7
|
-
export declare const PROMPT_BUNDLE_ID = "dsh-evolution@
|
|
6
|
+
export declare const PROMPT_BUNDLE_VERSION = 17;
|
|
7
|
+
export declare const PROMPT_BUNDLE_ID = "dsh-evolution@17";
|
|
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
|
-
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
|
|
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
|
|
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: update, patch, delete, or write support files ONLY into skills you loaded or read in THIS session. On the plan channel ops on unread skills are rejected; direct writes have no such guard, so treat the rule as binding. 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 this pass may not update them. They also cannot be archived by any writer (the foreground included): remove the .pinned marker first. Foreground and delegated-subagent update/patch 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
|
+
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: update, patch, delete, or write support files ONLY into skills you loaded or read in THIS session. On the plan channel ops on unread skills are rejected; direct writes have no such guard, so treat the rule as binding. 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 this pass may not update them. They also cannot be archived by any writer (the foreground included): remove the .pinned marker first. Foreground and delegated-subagent update/patch 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.";
|
|
11
11
|
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.";
|
|
12
12
|
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.";
|
|
13
13
|
export declare const COMPLETION_SKILL_REVIEW_PROMPT = "[Auto-review \u2014 Skills \u00B7 task complete]\nYour current task now appears complete. Before wrapping up, review the approach and update the skill library via skill_manage.\n\nFollow the skills review policy: be ACTIVE, prefer class-level umbrellas, patch ONLY skills loaded or read this session, and capture non-trivial techniques and user corrections. Do NOT capture environment-dependent failures, negative claims about tools, or one-off task narratives.\n\nDo NOT modify output files or re-run the task. If you are still mid-task, ignore this.";
|
|
@@ -40,9 +40,9 @@ export declare const MAINTAIN_OUTPUT_INSTRUCTION = "\u6309\u6A21\u677F\u5951\u7E
|
|
|
40
40
|
*/
|
|
41
41
|
export declare const SKILLS_GUIDANCE = "Skills guidance:\n\u2022 After completing a complex task (5+ tool calls), fixing a tricky error, or discovering a non-trivial workflow, save the approach as a skill with skill_manage so you can reuse it next time.\n\u2022 When using a skill and finding it outdated, incomplete, or wrong, patch it immediately with skill_manage (action='patch') \u2014 don't wait to be asked. Skills that aren't maintained become liabilities.";
|
|
42
42
|
/** Subagent-channel variant: same review policy, channel-limited deliverable (M-2). */
|
|
43
|
-
export declare const SKILL_REVIEW_PLAN_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
|
|
43
|
+
export declare const SKILL_REVIEW_PLAN_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: update, patch, delete, or write support files ONLY into skills you loaded or read in THIS session. On the plan channel ops on unread skills are rejected; direct writes have no such guard, so treat the rule as binding. 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 this pass may not update them. They also cannot be archived by any writer (the foreground included): remove the .pinned marker first. Foreground and delegated-subagent update/patch 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.\n\nCHANNEL (subagent): this review channel mounts only the read-only `skill` tool \u2014 you have NO `skill_manage`, NO `memory`. Your deliverable is the structured JSON plan below (outputSchema). Describe the patches/creates you RECOMMEND in the plan; never narrate actions you took.";
|
|
44
44
|
/** Subagent-channel variant of the combined review (M-2). */
|
|
45
|
-
export declare const COMBINED_REVIEW_PLAN_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
|
|
45
|
+
export declare const COMBINED_REVIEW_PLAN_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: update, patch, delete, or write support files ONLY into skills you loaded or read in THIS session. On the plan channel ops on unread skills are rejected; direct writes have no such guard, so treat the rule as binding. 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 this pass may not update them. They also cannot be archived by any writer (the foreground included): remove the .pinned marker first. Foreground and delegated-subagent update/patch 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.\n\nCHANNEL (subagent): this review channel mounts only the read-only `skill` tool \u2014 you have NO `skill_manage`, NO `memory`. Your deliverable is the structured JSON plan below (outputSchema). Describe the patches/creates you RECOMMEND in the plan; never narrate actions you took.";
|
|
46
46
|
export declare function reviewPrompt(kind: 'memory' | 'skill' | 'combined', channel?: 'agent' | 'plan'): string;
|
|
47
47
|
export interface PromptBundle {
|
|
48
48
|
id: string;
|