dsh-continual-evolve 0.1.0 → 0.2.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/README.md +149 -19
- package/README.zh.md +64 -21
- package/lib/apply.js +2 -0
- package/lib/approval.d.ts +19 -0
- package/lib/auto.d.ts +61 -1
- package/lib/auto.js +108 -2
- package/lib/benchmark.d.ts +14 -0
- package/lib/command.js +234 -5
- package/lib/evaluate.d.ts +36 -7
- package/lib/evaluate.js +157 -43
- package/lib/fate.d.ts +126 -0
- package/lib/fate.js +338 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +18 -2
- package/lib/mount.js +5 -0
- package/lib/planner.d.ts +8 -1
- package/lib/planner.js +27 -0
- package/lib/render.js +2 -1
- package/lib/review.d.ts +1 -1
- package/lib/review.js +17 -0
- package/lib/score.d.ts +22 -4
- package/lib/score.js +48 -7
- package/lib/skill.d.ts +10 -2
- package/lib/skill.js +34 -2
- package/lib/skillquality.d.ts +81 -0
- package/lib/skillquality.js +311 -0
- package/lib/tool.js +6 -3
- package/lib/types.d.ts +31 -0
- package/lib/types.js +19 -0
- package/lib/validate.js +25 -1
- package/lib/wrapup.d.ts +210 -0
- package/lib/wrapup.js +439 -0
- package/package.json +24 -14
package/README.md
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
[中文](README.zh.md) | English
|
|
4
4
|
|
|
5
5
|
[](https://awesome-dsh-plugin.com)
|
|
6
|
+
[](https://www.npmjs.com/package/dsh-continual-evolve)
|
|
6
7
|
[](https://github.com/ZK-Andy/dsh-continual-evolve/actions/workflows/ci.yml)
|
|
7
8
|
[](LICENSE)
|
|
8
9
|
[](package.json)
|
|
9
|
-
[]()
|
|
10
11
|
[]()
|
|
11
12
|
|
|
12
13
|
Continual self-evolution for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): a versioned, auditable, rollback-safe layer of harness state — prompt notes, memories, skills, and subagent specs — refined from session trajectories.
|
|
@@ -20,8 +21,11 @@ Continual self-evolution for [DeepSeek Harness](https://github.com/deepseek-ai/d
|
|
|
20
21
|
> scoring, non-regressive acceptance, rubric ACL). Since then the plugin
|
|
21
22
|
> keeps growing with usage-driven enhancements — the memory layer (ranked
|
|
22
23
|
> injection, trajectory citations, archive), per-installation rubric keys,
|
|
23
|
-
>
|
|
24
|
-
>
|
|
24
|
+
> plugin-owned file logging, the session wrap-up (`/evolve wrapup`), and
|
|
25
|
+
> the gate's automatic local-fate dimension (local entries get a promoted
|
|
26
|
+
> or archived exit on the gate's own cadence — consulted first, never
|
|
27
|
+
> written silently). See the Roadmap for the full shipped and candidate
|
|
28
|
+
> lists.
|
|
25
29
|
|
|
26
30
|
## Background
|
|
27
31
|
|
|
@@ -102,24 +106,39 @@ dsh-continual-evolve/
|
|
|
102
106
|
│ ├── render.ts # bounded prompt rendering
|
|
103
107
|
│ ├── inject.ts # dynamic system-prompt section (prompt notes + delegation specs, ranked injection)
|
|
104
108
|
│ ├── source.ts # trajectory citations (sessionId + event seqs of distilled entries)
|
|
105
|
-
│ ├── auto.ts # auto-review gate (turn/compaction triggers + audit, global-aware view)
|
|
109
|
+
│ ├── auto.ts # auto-review gate (turn/compaction triggers + audit, global-aware view, local-fate phase)
|
|
110
|
+
│ ├── fate.ts # gate local-fate dimension — auto promote/archive of local entries (consulted first, cooldown)
|
|
106
111
|
│ ├── notify.ts # gate visibility — follow-up notice after an approved auto-refine
|
|
107
112
|
│ ├── goal.ts # goal-driven evolution rounds (/evolve goal)
|
|
108
113
|
│ ├── review.ts # gate LLM judgment (declines local duplicates of globally covered topics)
|
|
109
114
|
│ ├── approval.ts # human approval for global edits
|
|
110
115
|
│ ├── skill.ts # skill materialization ($DSH_HOME/skills/)
|
|
116
|
+
│ ├── skillquality.ts # skill standard in the loop (skill-creator template reading + frontmatter code checks)
|
|
111
117
|
│ ├── mount.ts # hot-mounted skill plugins (loader.create + boot restore)
|
|
112
118
|
│ ├── benchmark.ts # benchmark store
|
|
113
119
|
│ ├── rubric.ts # rubric ACL (AES-256-GCM envelopes, auto-generated local key)
|
|
114
120
|
│ ├── logfile.ts # plugin-owned file logging (JSONL exporter + rotation)
|
|
115
121
|
│ ├── score.ts # code-owned aggregation + acceptance rule
|
|
116
|
-
│ ├── evaluate.ts # evaluation
|
|
122
|
+
│ ├── evaluate.ts # two-stage evaluation runner (executor evidence → independent reviewer) + failure-cell protocol
|
|
117
123
|
│ ├── pool.ts # bounded-concurrency worker pool for evaluation runs
|
|
118
124
|
│ ├── store.ts # store layout + snapshots + result history
|
|
119
|
-
│
|
|
120
|
-
└──
|
|
125
|
+
│ ├── service.ts # evolution engine (onApplied hook)
|
|
126
|
+
│ └── wrapup.ts # session wrap-up lifecycle (promote / split-promote → global, guarded archive; shared proposal builders)
|
|
127
|
+
└── test/ # 23 files, 290 tests
|
|
121
128
|
```
|
|
122
129
|
|
|
130
|
+
## Install
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# from npm (installs and activates — ships its own bundle patch)
|
|
134
|
+
dsh plugin --profile web add dsh-continual-evolve
|
|
135
|
+
|
|
136
|
+
# or from source (first GitHub installs require approving the allowBuilds build step)
|
|
137
|
+
dsh plugin --profile web add github:ZK-Andy/dsh-continual-evolve
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Swap `web` for your profile name (`headless`, or a custom profile).
|
|
141
|
+
|
|
123
142
|
## In-session usage (after restart)
|
|
124
143
|
|
|
125
144
|
```
|
|
@@ -128,6 +147,8 @@ dsh-continual-evolve/
|
|
|
128
147
|
/evolve history applied refinements (ids for rollback)
|
|
129
148
|
/evolve rollback <id> deterministically revert a refinement
|
|
130
149
|
/evolve plan [msg] LLM planner against the current store
|
|
150
|
+
/evolve wrapup assess this session's local entries: promote reusable ones to the
|
|
151
|
+
global store (approval required), archive session-specific ones
|
|
131
152
|
/evolve archive <id> hide an entry from injection (data kept, restorable)
|
|
132
153
|
/evolve unarchive <id> restore an archived entry
|
|
133
154
|
/evolve log [tail N] [session <id>] show the recent plugin log (default 50 lines; optional per-session filter)
|
|
@@ -145,7 +166,7 @@ Model-facing tools: `evolve_list`, `evolve_add`, `evolve_update`, `evolve_delete
|
|
|
145
166
|
|
|
146
167
|
## Memory layer
|
|
147
168
|
|
|
148
|
-
Beyond the persisted store itself,
|
|
169
|
+
Beyond the persisted store itself, four features keep injected memory
|
|
149
170
|
"understanding you" as entries grow (gap analysis vs. Mem0 / Letta / Zep /
|
|
150
171
|
LangMem; no external services — everything is pure functions):
|
|
151
172
|
|
|
@@ -166,11 +187,82 @@ LangMem; no external services — everything is pure functions):
|
|
|
166
187
|
`/evolve unarchive <id>` restores it. Archived entries are marked
|
|
167
188
|
`[archived]` in `evolve_list` and skipped by injection; the overflow count
|
|
168
189
|
excludes them.
|
|
190
|
+
- **Session wrap-up** — a session's local entries otherwise become orphans when
|
|
191
|
+
it ends (later sessions never see them). `/evolve wrapup` gives them an exit.
|
|
192
|
+
Each entry is audited mechanically — global-coverage is judged by **title
|
|
193
|
+
similarity only** (a bare id collision with a different title is intentionally
|
|
194
|
+
NOT coverage; the actual matching global titles are shown to the assessor so
|
|
195
|
+
it judges against real content) — then classified as `promote` / `archive` /
|
|
196
|
+
`keep`. Promotions move reusable entries into the global store **through the
|
|
197
|
+
human approval gate**, keeping their trajectory citation and adding a
|
|
198
|
+
`sourcedFromLocal=<session>:<id>` back-link; the local copy is stamped
|
|
199
|
+
`promotedTo` and retired from injection so it is never offered again.
|
|
200
|
+
**Split promotion** (A-form): a mixed entry (durable facts + session snapshot)
|
|
201
|
+
can be archived while carrying a cleaned `promote` sub-object — only the
|
|
202
|
+
durable part lands globally, the snapshot stays in the archive. A **symmetric
|
|
203
|
+
archive guard** requires user confirmation before an archive that is NOT
|
|
204
|
+
globally covered AND was distilled from real user messages hides that content
|
|
205
|
+
from future sessions (over-archiving gets the same protection as
|
|
206
|
+
over-writing); operational entries still archive silently. Everything stays
|
|
207
|
+
snapshot/versioned/rollbackable.
|
|
208
|
+
- **Gate local-fate (automatic wrap-up)** — the same wrap-up machinery now
|
|
209
|
+
runs inside the auto-review gate on its own cadence (`fateIntervalTurns`),
|
|
210
|
+
so local entries get their exit while the session is still running instead
|
|
211
|
+
of waiting for a manual `/evolve wrapup`. On each due gate run the audited
|
|
212
|
+
candidates are classified by the assessor and partitioned by the same
|
|
213
|
+
deterministic guards; the user is consulted FIRST before anything governed
|
|
214
|
+
lands (one dialog covering promotes, split promotions and review-required
|
|
215
|
+
archives — the consultSkillEdits pattern, with a decline cooldown). Covered
|
|
216
|
+
or operational entries still archive silently, and at compaction the gate
|
|
217
|
+
never opens a dialog: only silent archives apply, governed actions are
|
|
218
|
+
deferred with an audit record pointing at `/evolve wrapup`. Every fate
|
|
219
|
+
decision lands in `reviews.jsonl` (`approved` / `declined` / `deferred` /
|
|
220
|
+
`assessed` / `failed`) and applied actions are visible via a follow-up
|
|
221
|
+
notice. Apply writes are byte-identical to the wrap-up command (shared
|
|
222
|
+
proposal builders).
|
|
169
223
|
- **Global-aware gate** — the auto-review gate and planner judge the merged
|
|
170
224
|
global + local state with every entry's real scope labeled, so a topic
|
|
171
225
|
already covered by a global entry is declined instead of being re-sedimented
|
|
172
226
|
as a local duplicate.
|
|
173
227
|
|
|
228
|
+
## Skill standard in the loop
|
|
229
|
+
|
|
230
|
+
The planner and the auto-review gate are raw `ctx.llm` calls — they do not
|
|
231
|
+
live in an agent session, so they cannot load skills through the `skill`
|
|
232
|
+
tool. To keep self-evolved skills on the quality bar, the plugin references
|
|
233
|
+
the **skill-creator** / **skill-audit** skills (user-level skills distilled
|
|
234
|
+
by the author from the official deepseek-harness 11 skills; template facts
|
|
235
|
+
verified against deepseek-harness `47f9438`) at runtime — they stay the
|
|
236
|
+
single source of truth on disk, nothing is copied:
|
|
237
|
+
|
|
238
|
+
- Every planning call receives a `<skill_quality_standard>` block: the
|
|
239
|
+
`skill-creator/references/template.md` facts when those skills are
|
|
240
|
+
installed (`<dshHome>/skills/`), or a builtin distilled guide otherwise
|
|
241
|
+
(~1KB, low-frequency calls). The planner must ground skill proposals in a
|
|
242
|
+
REAL trigger scenario from the trajectory, must not duplicate the
|
|
243
|
+
official 11 skills or existing entries, and self-checks every proposed
|
|
244
|
+
skill against the 7 structural features.
|
|
245
|
+
- The gate judges skill-related trajectories against the skill-audit
|
|
246
|
+
dimensions (frontmatter routing, structural features, paragraph skeleton,
|
|
247
|
+
duplication) and declines proposals that would not meet the standard.
|
|
248
|
+
- The mechanical frontmatter rules of `validate-frontmatter.mjs` are
|
|
249
|
+
code-enforced at apply time: skill bodies must not open with a second
|
|
250
|
+
`---` block (it would shadow the generated frontmatter), and resource
|
|
251
|
+
references may not escape the skill directory. After materialization the
|
|
252
|
+
rendered SKILL.md is re-checked and dangling `references/`/`scripts/`
|
|
253
|
+
links are logged as warnings.
|
|
254
|
+
- **Two skill forms** — `executable` skills keep the python reference
|
|
255
|
+
contract (hot-mountable as tools); `guidance` skills are SKILL.md
|
|
256
|
+
documents with no reference, the form for recurring multi-step workflows
|
|
257
|
+
(session start/end routines, handoff procedures). Code enforces the
|
|
258
|
+
split: a guidance skill must NOT carry a reference or arguments contract.
|
|
259
|
+
- **User-governed skill creation** — the gate never writes a skill
|
|
260
|
+
silently: when the planner proposes skill edits, the user is asked
|
|
261
|
+
(固化/不固化) before they land; a rejected candidate is not offered
|
|
262
|
+
again within a cooldown window. The rest of a proposal proceeds
|
|
263
|
+
regardless, so memory/prompt distillation is never blocked by a skill
|
|
264
|
+
decision.
|
|
265
|
+
|
|
174
266
|
## Logging
|
|
175
267
|
|
|
176
268
|
Plugin-owned file logging: every cordis log message (from this plugin or any
|
|
@@ -203,11 +295,35 @@ profile (optional; the file log remains the baseline that always exists).
|
|
|
203
295
|
The loop: freeze a reference score → evolve a candidate (`/evolve plan`) →
|
|
204
296
|
run the same case × run matrix against the post-refinement state → the
|
|
205
297
|
**code-owned** acceptance rule keeps the candidate only if the overall mean
|
|
206
|
-
strictly improves with no case regressing (Self-Harness style).
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
298
|
+
strictly improves with no case regressing (Self-Harness style).
|
|
299
|
+
|
|
300
|
+
**Evaluator/scorer separation (two-stage, gap A1)** — each case × run unit
|
|
301
|
+
is a PAIR of fresh subagents:
|
|
302
|
+
|
|
303
|
+
1. the **executor** performs the task with its tools and records **concrete
|
|
304
|
+
evidence** of what it did and found — it NEVER sees the rubric, so the
|
|
305
|
+
agent under test cannot optimize toward or self-grade against the grading
|
|
306
|
+
criteria;
|
|
307
|
+
2. an **independent reviewer** grades that evidence strictly against the
|
|
308
|
+
rubric (the only branch that receives the decrypted rubric), eliminating
|
|
309
|
+
the "self-produced and self-scored" bias.
|
|
310
|
+
|
|
311
|
+
Each cell records the executor's session id, so a score can be drilled back
|
|
312
|
+
to the exact transcript that produced it (trace evidence pointer, gap A4).
|
|
313
|
+
|
|
314
|
+
**Failure-cell protocol (gap A2)** — a unit that cannot produce a score
|
|
315
|
+
(rubric decrypt error, executor/reviewer crash, protocol error) is recorded
|
|
316
|
+
as a **failed** cell, NEVER a zero: aggregation excludes failed cells from
|
|
317
|
+
every mean and counts them (`/evolve benchmark status` shows `(N failed)`),
|
|
318
|
+
and the acceptance rule rejects a round with more failed cells than
|
|
319
|
+
`maxFailedCells` (0 by default) instead of silently averaging a 0 into the
|
|
320
|
+
mean.
|
|
321
|
+
|
|
322
|
+
Aggregation and decisions live in `src/score.ts`. Rubric isolation is by
|
|
323
|
+
construction (the planner never sees rubric files, and the executor branch
|
|
324
|
+
never decrypts); a rejection is recorded in the scoreboard and the
|
|
325
|
+
refinement is rolled back automatically (`autoRollbackOnReject`, on by
|
|
326
|
+
default).
|
|
211
327
|
|
|
212
328
|
### Real recorded run (ACCEPT)
|
|
213
329
|
|
|
@@ -221,10 +337,11 @@ acceptance:
|
|
|
221
337
|
| re-evaluate | `/evolve benchmark run lint_convention candidate <id>` | **100** — evaluator ran `evolve_list`, hit the memory, quoted it verbatim |
|
|
222
338
|
| decision | — | `overall: 90 → 100` · `lint_knowledge: 90 → 100` · **DECISION: ACCEPTED** |
|
|
223
339
|
|
|
224
|
-
The
|
|
225
|
-
harness state under test (grep, `evolve_list`) and
|
|
226
|
-
|
|
227
|
-
|
|
340
|
+
The executor does not grade model common sense — it inspects the actual
|
|
341
|
+
harness state under test (grep, `evolve_list`) and records what it found;
|
|
342
|
+
the independent reviewer grades that record. A harness change measurably
|
|
343
|
+
moves the score. Earlier runs in the same session
|
|
344
|
+
produced honest `REJECTED` decisions (0 → 0 stub cases, and 100 → 100
|
|
228
345
|
where the baseline was already perfect).
|
|
229
346
|
|
|
230
347
|
## Configuration
|
|
@@ -245,6 +362,8 @@ where the baseline was already perfect).
|
|
|
245
362
|
| `logLevel` | `1` | file log level: 0=error, 1=info, 2=warn, 3=debug |
|
|
246
363
|
| `logMaxBytes` | 5 MiB | rotate the log to `plugin.log.1` when it exceeds this size |
|
|
247
364
|
| `autoRollbackOnReject` | `true` | after a benchmark decision rejects a candidate, roll the refinement back automatically (same engine path as `/evolve rollback` — deterministic, snapshotted, audited) |
|
|
365
|
+
| `localFate` | `true` | gate local-fate dimension: the gate audits the session's local entries on its own cadence and proposes promote/archive — consulted first, never written silently (only meaningful with `autoReview`) |
|
|
366
|
+
| `fateIntervalTurns` | follows `reviewIntervalTurns` | minimum turns between local-fate assessments on the turn-interval path (compaction is unconditional) |
|
|
248
367
|
|
|
249
368
|
Example (profile `cordis.patch.yml`):
|
|
250
369
|
|
|
@@ -261,6 +380,7 @@ Example (profile `cordis.patch.yml`):
|
|
|
261
380
|
|
|
262
381
|
```bash
|
|
263
382
|
pnpm install # install dev deps
|
|
383
|
+
pnpm dev # tsc --watch
|
|
264
384
|
pnpm build # tsc -> lib/
|
|
265
385
|
pnpm test # vitest run
|
|
266
386
|
pnpm lint # oxlint src test
|
|
@@ -268,6 +388,7 @@ pnpm lint # oxlint src test
|
|
|
268
388
|
|
|
269
389
|
Hit a wall? See [`docs/FAQ.md`](docs/FAQ.md) — real failure/fix records (service planes, schema DSL, structured output, gate counting, verifying prompt injection).
|
|
270
390
|
|
|
391
|
+
Where we still lag behind prime-agent `/refine` and penguin-harness — and what to build next: [`docs/gap-analysis.md`](docs/gap-analysis.md) (P0 shipped: evaluator/scorer separation, failure-cell protocol; next: P1 runtime provenance checks, usage statistics, auto-decay).
|
|
271
392
|
|
|
272
393
|
## Roadmap
|
|
273
394
|
|
|
@@ -282,8 +403,17 @@ Hit a wall? See [`docs/FAQ.md`](docs/FAQ.md) — real failure/fix records (servi
|
|
|
282
403
|
- **gate-proposed archiving** — stale entries are a first-class refine target: the planner can emit `action: "archive"` (kind + id only), which stamps `metadata.archivedAt` through the normal apply path — snapshot, version bump, audit event, and a deterministic rollback inverse that restores the pre-archive state. Archive hides from injection but never deletes; re-archiving an archived entry is rejected, and the base system prompt stays immutable
|
|
283
404
|
- **automatic rollback on benchmark rejection** — the acceptance loop is closed: when the code-owned decision rejects a candidate, the refinement is reverted automatically through the same engine path as `/evolve rollback` (deterministic inverse edits, snapshotted and audited; configurable via `autoRollbackOnReject`, on by default). Failures report the manual fallback instead of throwing
|
|
284
405
|
- **per-session log filtering** — `/evolve log [tail N] [session <id>]` keeps only the lines mentioning a given session id (exact token match, drawn from the rendered message and raw args); gate records now carry the session id in their log line
|
|
285
|
-
|
|
286
|
-
|
|
406
|
+
- **skill standard in the loop** — the planner and gate now author and judge skill entries against the skill-creator/skill-audit standard (author-distilled from the official deepseek-harness 11 skills): every plan call injects the `template.md` facts (builtin distilled guide as fallback) as `<skill_quality_standard>`; apply code-enforces the frontmatter mechanics (no shadowing `---`, no escaping resource refs); materialized SKILL.md files are re-checked and dangling resource references are logged;
|
|
407
|
+
- **guidance skills + user-governed creation** — a second skill form (SKILL.md documents without a python reference) lets recurring workflows be proposed as skills; the gate offers every auto-created skill to the user (固化/不固化) before it lands, with a rejection cooldown — skills grow under governance, never silently
|
|
408
|
+
- **2026-08-17 wrap-up wave (done)**:
|
|
409
|
+
- **`/evolve wrapup`** — a session's local entries get a real exit at session end: mechanical audit (local candidates + global-coverage detection; coverage judges **title similarity only** — a bare id collision with a different title is deliberately NOT coverage, and the real matching global titles are shown to the assessor) → LLM classification (`promote` / `archive` / `keep` + A-form split promotion: archive a mixed entry while promoting a cleaned durable sub-object) → deterministic guards re-checked at apply time (promote can never write a global duplicate; the symmetric archive guard requires user confirmation before an uncovered, user-sourced archive hides content; splits that duplicate a global topic drop to plain archive) → one human approval gate for every global create
|
|
410
|
+
- **gate local-fate dimension** — the wrap-up machinery now runs inside the auto-review gate on its own cadence (`fateIntervalTurns`, compaction unconditional): local entries are audited, classified and partitioned while the session is still running; governed actions are consulted first (one dialog, decline cooldown), covered/operational entries archive silently, compaction applies only silent archives and defers governed actions with an audit record; every decision lands in `reviews.jsonl` and applied actions get a follow-up notice. Apply writes are shared with the wrap-up command (byte-identical proposals)
|
|
411
|
+
- **2026-08-17 gap P0 (done)**:
|
|
412
|
+
- **evaluator/scorer separation** — benchmark evaluation is now two-stage (gap A1): the executor performs the task and records concrete evidence without ever seeing the rubric; an independent reviewer grades that evidence against the rubric (the only branch that decrypts it). The assessed agent can no longer optimize toward or self-grade against the criteria.
|
|
413
|
+
- **failure-cell protocol** — cells carry `status: ok|failed` (gap A2): failed units are excluded from every mean and counted, and the acceptance rule rejects rounds with failures beyond `maxFailedCells` (0 default) instead of averaging a zero into the mean. Scoreboard status/run surfaces failed counts and per-cell reasons.
|
|
414
|
+
- **trace evidence pointer** — each cell records the executor's session id (gap A4), so a score drills back to the exact transcript that earned it
|
|
415
|
+
|
|
416
|
+
The upcoming/candidates list is empty for now — future work is driven by real usage.
|
|
287
417
|
|
|
288
418
|
## License
|
|
289
419
|
|
package/README.zh.md
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
5
|
[](https://awesome-dsh-plugin.com)
|
|
6
|
+
[](https://www.npmjs.com/package/dsh-continual-evolve)
|
|
6
7
|
[](https://github.com/ZK-Andy/dsh-continual-evolve/actions/workflows/ci.yml)
|
|
7
8
|
[](LICENSE)
|
|
8
9
|
[](package.json)
|
|
9
|
-
[]()
|
|
10
11
|
[]()
|
|
11
12
|
|
|
12
13
|
[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh`)的持续自进化插件:一套**版本化、可审计、可回滚**的 harness 状态层——提示词补充、记忆、技能、子代理规格——从会话轨迹中沉淀而来。
|
|
13
14
|
|
|
14
|
-
> **状态:全部阶段完成,进入长期维护。** Phase 1–3 交付了完整进化闭环:纯核心引擎、模型工具与 `/evolve` 命令、自动 review 门禁(回合间隔 + 压缩检查点、全局写入人工审批)、真实系统提示词注入(prompt 补充 + 委派规格,空 store 零 token 成本)、benchmark 驱动验证闭环(代码所有计分、非退化接受、rubric ACL)。此后插件随真实使用持续增强——记忆层(排序注入、轨迹引用、归档)、每安装实例独立的 rubric
|
|
15
|
+
> **状态:全部阶段完成,进入长期维护。** Phase 1–3 交付了完整进化闭环:纯核心引擎、模型工具与 `/evolve` 命令、自动 review 门禁(回合间隔 + 压缩检查点、全局写入人工审批)、真实系统提示词注入(prompt 补充 + 委派规格,空 store 零 token 成本)、benchmark 驱动验证闭环(代码所有计分、非退化接受、rubric ACL)。此后插件随真实使用持续增强——记忆层(排序注入、轨迹引用、归档)、每安装实例独立的 rubric 密钥、插件自带文件日志、会话收尾(`/evolve wrapup`)、以及门禁的自动 local 归宿维度(local 条目在门禁自有节奏下获得提升或归档的归宿——先征询、绝不静默写入)。已交付与候选清单见"路线图"。
|
|
15
16
|
|
|
16
17
|
## 背景
|
|
17
18
|
|
|
@@ -79,24 +80,39 @@ dsh-continual-evolve/
|
|
|
79
80
|
│ ├── render.ts # 有界提示词渲染
|
|
80
81
|
│ ├── inject.ts # 动态系统提示词段(prompt 补充 + 委派规格,打分排序注入)
|
|
81
82
|
│ ├── source.ts # 轨迹引用(沉淀条目的 sessionId + 事件 seq)
|
|
82
|
-
│ ├── auto.ts # 自动 review 门禁(回合/压缩触发 + 审计,global
|
|
83
|
+
│ ├── auto.ts # 自动 review 门禁(回合/压缩触发 + 审计,global 感知视图,local 归宿阶段)
|
|
84
|
+
│ ├── fate.ts # 门禁 local 归宿维度——自动提议 local 条目提升/归档(先征询、带冷却)
|
|
83
85
|
│ ├── notify.ts # 门禁可见性——approved 自动沉淀后发送可见通知
|
|
84
86
|
│ ├── goal.ts # goal 驱动的进化轮次(/evolve goal)
|
|
85
87
|
│ ├── review.ts # 门禁 LLM 判断(拒绝 global 已覆盖主题的 local 重复沉淀)
|
|
86
88
|
│ ├── approval.ts # 全局写入人工审批
|
|
87
89
|
│ ├── skill.ts # 技能物化($DSH_HOME/skills/)
|
|
90
|
+
│ ├── skillquality.ts # 自进化环中的技能标准(skill-creator 模板读取 + frontmatter 代码校验)
|
|
88
91
|
│ ├── mount.ts # 技能热挂载插件(loader.create + 启动恢复)
|
|
89
92
|
│ ├── benchmark.ts # benchmark 存储
|
|
90
93
|
│ ├── rubric.ts # rubric ACL(AES-256-GCM 密文信封,自动生成本地密钥)
|
|
91
94
|
│ ├── logfile.ts # 插件自带文件日志(JSONL exporter + 轮转)
|
|
92
95
|
│ ├── score.ts # 代码所有聚合 + 接受规则
|
|
93
|
-
│ ├── evaluate.ts #
|
|
96
|
+
│ ├── evaluate.ts # 两段式评估执行器(执行者产证据 → 独立评审者评分)+ 失败格协议
|
|
94
97
|
│ ├── pool.ts # 评估运行的有界并发工作池
|
|
95
98
|
│ ├── store.ts # store 布局 + 快照 + 结果历史
|
|
96
|
-
│
|
|
97
|
-
└──
|
|
99
|
+
│ ├── service.ts # 进化引擎(onApplied 钩子)
|
|
100
|
+
│ └── wrapup.ts # 会话收尾生命周期(提升/拆解提升到 global、带守卫的归档;共享 proposal 构造器)
|
|
101
|
+
└── test/ # 23 个文件,290 个测试
|
|
98
102
|
```
|
|
99
103
|
|
|
104
|
+
## 安装
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# 从 npm 安装(安装即激活,自带 bundle patch)
|
|
108
|
+
dsh plugin --profile web add dsh-continual-evolve
|
|
109
|
+
|
|
110
|
+
# 或从源码安装(首次 GitHub 安装需按提示授权 allowBuilds 构建步骤)
|
|
111
|
+
dsh plugin --profile web add github:ZK-Andy/dsh-continual-evolve
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
将 `web` 换成你的 profile 名(`headless`,或自定义 profile)。
|
|
115
|
+
|
|
100
116
|
## 会话内用法(安装后)
|
|
101
117
|
|
|
102
118
|
```
|
|
@@ -105,6 +121,8 @@ dsh-continual-evolve/
|
|
|
105
121
|
/evolve history 已应用的 refinement(回滚用 id)
|
|
106
122
|
/evolve rollback <id> 确定性回滚某个 refinement
|
|
107
123
|
/evolve plan [msg] LLM 规划器
|
|
124
|
+
/evolve wrapup 评估本会话 local 条目:可复用的提升到 global(需审批),
|
|
125
|
+
会话特有的一次性条目归档
|
|
108
126
|
/evolve archive <id> 归档条目——不再注入(数据保留,可恢复)
|
|
109
127
|
/evolve unarchive <id> 恢复已归档条目
|
|
110
128
|
/evolve log [tail N] [session <id>] 查看最近插件日志(默认 50 行;可加会话过滤)
|
|
@@ -127,8 +145,20 @@ dsh-continual-evolve/
|
|
|
127
145
|
- **打分排序注入**——某类条目超过 6 条封顶时,注入块不再固定取前 6 条:先按与 agent 最近直接用户消息的相关度打分(关键词/BM25 级别,标题命中权重 2×),再按新鲜度排序(`updated_at`,30 天半衰期),让"最新 + 最相关"的条目填满封顶。空 store 零 token 行为不变。
|
|
128
146
|
- **轨迹引用**——每条新沉淀条目都会记录 `metadata.sourceSession` + `metadata.sourceSeqs`,指向它蒸馏自的直接用户消息(DSH 会话是事件溯源、seq 连续,引用可展开回持久会话日志)。列表显示 `src=<sessionId>:<seqs>`;旧条目不迁移也不报错。
|
|
129
147
|
- **归档**——`/evolve archive <id>` 让条目不再注入(`metadata.archivedAt`,数据保留、与快照/回滚兼容),`/evolve unarchive <id>` 恢复。归档条目在 `evolve_list` 中标记 `[archived]`,注入跳过,溢出计数不含它们。
|
|
148
|
+
- **会话收尾**——否则会话结束时的 local 条目会变成孤岛(后续会话永远看不到)。`/evolve wrapup` 给它们一个归宿:先机械审计——**全局覆盖只看标题相似**(裸同 id 但标题迥异**不算**覆盖;实际命中的全局标题会展示给分类器,让它对照真实内容判断)——再由模型逐条分类为 `promote` / `archive` / `keep`。提升把可复用条目写入 global store——**经人工审批门禁**,保留轨迹引用并追加 `sourcedFromLocal=<session>:<id>` 反向回引;本地副本随后盖 `promotedTo` 戳退出注入,永不再被提议。**拆解提升(A 形)**:混合条目(持久事实 + 会话快照)可整体归档、同时带一个清洗过的 `promote` 子对象——只有持久部分落进 global,快照留在归档里。**对称归档守卫**:未被全局覆盖、且源自真实用户消息的归档,先征求用户确认才隐藏内容(防过度归档与防过度写入获得同等保护);操作性条目仍静默归档。一切仍走快照/版本/可回滚。
|
|
149
|
+
- **门禁 local 归宿(自动收尾)**——同一套 wrap-up 机制现在以内置节奏(`fateIntervalTurns`)跑在自动 review 门禁里:local 条目在会话进行中就能获得归宿,不必等手动 `/evolve wrapup`。每次到期的门禁运行都会审计候选条目、由分类器分类、再经同一套确定性守卫划分;任何治理动作落地前**先征询用户**(一个弹窗覆盖提升、拆解提升与需确认归档——consultSkillEdits 模式,带拒绝冷却)。被全局覆盖或操作性条目仍静默归档;压缩时刻门禁绝不弹窗:只做静默归档,治理动作以审计记录推迟并指向 `/evolve wrapup`。每次 fate 决策都落进 `reviews.jsonl`(`approved` / `declined` / `deferred` / `assessed` / `failed`),已执行动作通过后续通知可见。应用写入与 wrapup 命令逐字节一致(共享 proposal 构造器)。
|
|
130
150
|
- **global 感知门禁**——自动 review 门禁与规划器评审的是合并后的 global + local 状态,每条条目标注真实 scope;global 已覆盖的主题会被 declined,不再重复沉淀为 local 条目。
|
|
131
151
|
|
|
152
|
+
## 自进化环中的技能标准
|
|
153
|
+
|
|
154
|
+
规划器与自动门禁是裸 `ctx.llm` 调用——不在 agent 会话内,无法通过 `skill` 工具加载技能。为了让自进化长出的技能保持在质量线上,插件在运行时引用 **skill-creator** / **skill-audit** 技能(作者从官方 deepseek-harness 11 个技能蒸馏的自建技能,模板事实核验自官方源码 `47f9438`;留在磁盘上作为单一事实源,零复制):
|
|
155
|
+
|
|
156
|
+
- **每次规划调用注入 `<skill_quality_standard>` 块**:`skill-creator/references/template.md` 事实(技能已安装时,位于 `<dshHome>/skills/`),否则用内置精华版兜底(约 1KB,低频调用)。规划器必须把技能提案锚定在轨迹中的**真实触发场景**、不得重复官方 11 技能或已有条目,并逐条自检 7 条结构特征。
|
|
157
|
+
- **门禁按 skill-audit 维度评审**技能相关轨迹(frontmatter 路由、结构特征、段落骨架、防重复),不达标的提案 declined 并说明改进方向。
|
|
158
|
+
- **机械 frontmatter 规则代码强制**(移植 `validate-frontmatter.mjs`):技能正文不得以第二个 `---` 块开头(会遮蔽自动生成的 frontmatter)、资源引用不得越出技能目录;物化后对渲染产物复检,悬空 `references/`/`scripts/` 引用记 warn 日志。
|
|
159
|
+
- **两种技能形态**——`executable`(可执行,保留 python reference 契约,可热挂载为工具)与 `guidance`(指导型:SKILL.md 文档、无 reference,用于反复出现的多步流程,如会话开始/结束、交接流程)。代码强制区分:guidance 技能**不得**携带 reference 或 arguments 契约。
|
|
160
|
+
- **用户治理的技能创建**——门禁绝不静默写技能:规划器提议技能编辑时,先问用户(固化/不固化)再落地;被拒候选在冷却窗口内不再打扰。提案其余部分(记忆/提示词沉淀)不受影响照常进行——技能决策永不阻塞普通沉淀。
|
|
161
|
+
|
|
132
162
|
## 日志
|
|
133
163
|
|
|
134
164
|
插件自带文件日志:所有 cordis 日志消息(本插件或其他插件)追加写入 `<dshHome>/evolve/plugin.log`(JSONL、0600,超过 `logMaxBytes` 轮转到 `plugin.log.1`)。与 `dsh web` 的启动方式无关——无需安装额外组件、不依赖启动脚本。查看方式:
|
|
@@ -143,7 +173,7 @@ tail -f ~/.dsh/evolve/plugin.log # 实时跟随
|
|
|
143
173
|
## benchmark 驱动验证(Phase 3)
|
|
144
174
|
|
|
145
175
|
```
|
|
146
|
-
/evolve benchmark new <title>
|
|
176
|
+
/evolve benchmark new <title> [runs] 创建 benchmark(runs = 每个 case 重复次数,默认 1)
|
|
147
177
|
/evolve benchmark add-case <bid> <title> <statement> <rubric>
|
|
148
178
|
/evolve benchmark list 列出 benchmark
|
|
149
179
|
/evolve benchmark status <bid> 查看计分板 + 决策
|
|
@@ -152,7 +182,17 @@ tail -f ~/.dsh/evolve/plugin.log # 实时跟随
|
|
|
152
182
|
/evolve benchmark run <bid> candidate <refinementId> 评估进化后状态 → 决策
|
|
153
183
|
```
|
|
154
184
|
|
|
155
|
-
闭环:冻结参考分 → 进化候选(`/evolve plan`)→ 用同一 case × run 矩阵复测进化后状态 → **代码所有**的接受规则只在总体均值严格提高且无 case 退化时保留候选(Self-Harness
|
|
185
|
+
闭环:冻结参考分 → 进化候选(`/evolve plan`)→ 用同一 case × run 矩阵复测进化后状态 → **代码所有**的接受规则只在总体均值严格提高且无 case 退化时保留候选(Self-Harness 风格)。
|
|
186
|
+
|
|
187
|
+
**评估者/评分者分离(两段式,差距 A1)**——每个 case × run 单元是一对全新子代理:
|
|
188
|
+
1. **执行者**用工具完成任务并记录**具体证据**(做了什么、查到了什么)——它**永远看不到 rubric**,被测 agent 无法朝评分标准优化、也无法自评;
|
|
189
|
+
2. **独立评审者**严格按 rubric 给证据打分(唯一接收解密 rubric 的分支),消除"自产自审"偏差。
|
|
190
|
+
|
|
191
|
+
每个 cell 记录执行者会话 id——分数可下钻回产生该证据的确切会话轨迹(Trace 证据指针,差距 A4)。
|
|
192
|
+
|
|
193
|
+
**失败格协议(差距 A2)**——无法产出分数的单元(rubric 解密失败、执行者/评审者崩溃、协议错误)记为**失败格**,**绝不是 0 分**:聚合从所有均值中排除失败格并计数(`/evolve benchmark status` 显示 `(N failed)`),接受规则在失败格超过 `maxFailedCells`(默认 0)时拒绝整轮,而不是把 0 平均进均值。
|
|
194
|
+
|
|
195
|
+
聚合与决策都在 `src/score.ts`。rubric 隔离靠构造(规划器的提示词永远不含 rubric 文件、执行者分支永不解密);拒绝会记录进 scoreboard 并自动回滚该 refinement(`autoRollbackOnReject`,默认开)。
|
|
156
196
|
|
|
157
197
|
### 真实运行记录(ACCEPT)
|
|
158
198
|
|
|
@@ -165,7 +205,7 @@ tail -f ~/.dsh/evolve/plugin.log # 实时跟随
|
|
|
165
205
|
| 复测 | `/evolve benchmark run lint_convention candidate <id>` | **100**——评估器跑 `evolve_list` 命中记忆并逐字引用 |
|
|
166
206
|
| 决策 | — | `overall: 90 → 100` · `lint_knowledge: 90 → 100` · **DECISION: ACCEPTED** |
|
|
167
207
|
|
|
168
|
-
|
|
208
|
+
执行者评的不是模型常识,而是**实际检查被测 harness 状态**(grep、`evolve_list`)并记录产出,再由独立评审者按 rubric 评分——所以 harness 的改动会真实地反映在分数上。同一会话早些时候还产生过诚实的 `REJECTED` 决策(0→0 占位符 case、100→100 满分基线无法超越)。
|
|
169
209
|
|
|
170
210
|
## 配置
|
|
171
211
|
|
|
@@ -185,6 +225,8 @@ tail -f ~/.dsh/evolve/plugin.log # 实时跟随
|
|
|
185
225
|
| `logLevel` | `1` | 文件日志级别:0=error、1=info、2=warn、3=debug |
|
|
186
226
|
| `logMaxBytes` | 5 MiB | 超过该大小轮转到 `plugin.log.1` |
|
|
187
227
|
| `autoRollbackOnReject` | `true` | benchmark 决策拒绝候选后自动回滚该 refinement(与 `/evolve rollback` 同一引擎路径——确定性、快照、审计) |
|
|
228
|
+
| `localFate` | `true` | 门禁 local 归宿维度:门禁按自有节奏审计本会话 local 条目并提议提升/归档——先征询、绝不静默写入(仅 `autoReview` 开启时有效) |
|
|
229
|
+
| `fateIntervalTurns` | 跟随 `reviewIntervalTurns` | 回合间隔路径上两次 local 归宿评估的最小间隔(压缩时刻无条件触发) |
|
|
188
230
|
|
|
189
231
|
示例(profile `cordis.patch.yml`):
|
|
190
232
|
|
|
@@ -197,16 +239,6 @@ tail -f ~/.dsh/evolve/plugin.log # 实时跟随
|
|
|
197
239
|
reviewIntervalTurns: 6
|
|
198
240
|
```
|
|
199
241
|
|
|
200
|
-
## 安装
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
# 从 npm 安装(安装即激活,自带 bundle patch)
|
|
204
|
-
dsh plugin --profile web add dsh-continual-evolve
|
|
205
|
-
|
|
206
|
-
# 或从源码安装
|
|
207
|
-
dsh plugin --profile web add /path/to/dsh-continual-evolve
|
|
208
|
-
```
|
|
209
|
-
|
|
210
242
|
## 开发
|
|
211
243
|
|
|
212
244
|
```bash
|
|
@@ -219,6 +251,8 @@ pnpm lint # oxlint src test
|
|
|
219
251
|
|
|
220
252
|
遇到问题先看 [`docs/FAQ.md`](docs/FAQ.md)(真实踩坑记录:服务平面、schema DSL、结构化输出、门禁计数、注入验证等)。
|
|
221
253
|
|
|
254
|
+
对照 prime-agent `/refine` 与 penguin-harness 的差距与下一步实施项(P0 已交付:评估者/评分者分离、失败格协议;下一步 P1:运行实证校验、使用率统计、自动衰减):[`docs/gap-analysis.md`](docs/gap-analysis.md)。
|
|
255
|
+
|
|
222
256
|
## 路线图
|
|
223
257
|
|
|
224
258
|
**已交付**
|
|
@@ -232,8 +266,17 @@ pnpm lint # oxlint src test
|
|
|
232
266
|
- **门禁提议归档**——过时条目是一等 refine 目标:规划器可输出 `action: "archive"`(仅需 kind + id),代码经正常 apply 通道盖 `metadata.archivedAt` 戳——快照、版本 +1、审计事件、以及恢复归档前状态的确定性回滚逆编辑。归档隐藏于注入但绝不删除;重复归档被拒绝;基础系统提示词保持不可变
|
|
233
267
|
- **benchmark 拒绝自动回滚**——接受闭环已闭合:代码所有决策拒绝候选时,refinement 经与 `/evolve rollback` 相同的引擎路径自动撤销(确定性逆编辑、快照 + 审计;`autoRollbackOnReject` 配置,默认开)。失败时给出手动回滚提示而不是抛错
|
|
234
268
|
- **日志按会话过滤**——`/evolve log [tail N] [session <id>]` 只保留提及指定会话 id 的行(精确 token 匹配,取自渲染消息与原始 args);门禁记录的行现在携带会话 id
|
|
235
|
-
|
|
236
|
-
|
|
269
|
+
- **自进化环中的技能标准**——规划器与门禁现在按 skill-creator/skill-audit 标准(作者蒸馏自官方 deepseek-harness 11 技能)创作与评审技能条目:每次规划注入 `template.md` 事实(内置精华版兜底)为 `<skill_quality_standard>`;apply 代码强制 frontmatter 机械规则(禁止遮蔽 `---`、禁止越界资源引用);物化后的 SKILL.md 复检,悬空资源引用记日志;
|
|
270
|
+
- **guidance 技能形态 + 用户治理创建**——第二种技能形态(无 python reference 的 SKILL.md 文档技能)让反复出现的流程可以被提议为技能;门禁把每次自动创建的技能先交给用户决定(固化/不固化)再落地,带拒绝冷却——技能在治理下生长,绝不静默写入
|
|
271
|
+
- **2026-08-17 收尾 wave(完成)**:
|
|
272
|
+
- **`/evolve wrapup`**——会话结束时 local 条目有了真正的归宿:先机械审计(local 候选 + 全局覆盖检测;**覆盖只看标题相似**——裸同 id 但标题迥异**不算**覆盖,真正命中的全局标题会展示给分类器)→ LLM 分类(`promote` / `archive` / `keep` + A 形拆解提升:混合条目整体归档、同时提升清洗出的持久子对象)→ 应用时刻确定性守卫复检(promote 永不写出全局重复;对称归档守卫要求用户确认后才隐藏未被覆盖、源自真实对话的条目;清洗标题撞全局主题的拆解降级为普通归档)→ 所有全局 create 走一个人工审批门
|
|
273
|
+
- **门禁 local 归宿维度**——wrap-up 机制现在以内置节奏(`fateIntervalTurns`,压缩时刻无条件)跑在自动 review 门禁里:local 条目在会话进行中被审计、分类、划分;治理动作先征询(一个弹窗、拒绝冷却),被覆盖/操作性条目静默归档,压缩时刻只做静默归档并以审计记录推迟治理动作;每次决策落进 `reviews.jsonl`,已执行动作发后续通知。应用写入与 wrapup 命令共享构造器(逐字节一致)
|
|
274
|
+
- **2026-08-17 差距 P0(完成)**:
|
|
275
|
+
- **评估者/评分者分离**——benchmark 评估改为两段式(差距 A1):执行者完成任务并记录具体证据、**永远看不到 rubric**;独立评审者按 rubric 给证据评分(唯一解密 rubric 的分支)。被测 agent 无法朝评分标准优化、也无法自评
|
|
276
|
+
- **失败格协议**——cell 带 `status: ok|failed`(差距 A2):失败格从所有均值中排除并计数,接受规则在失败格超过 `maxFailedCells`(默认 0)时拒绝整轮,而不是把 0 平均进均值。scoreboard status/run 展示失败数与逐格原因
|
|
277
|
+
- **Trace 证据指针**——每个 cell 记录执行者会话 id(差距 A4),分数可下钻回产生它的确切会话轨迹
|
|
278
|
+
|
|
279
|
+
候选/待办清单暂时为空——后续工作随真实使用驱动。
|
|
237
280
|
|
|
238
281
|
## License
|
|
239
282
|
|
package/lib/apply.js
CHANGED
|
@@ -82,6 +82,7 @@ export function applyRefinementProposal(state, proposal, options) {
|
|
|
82
82
|
: {}),
|
|
83
83
|
}
|
|
84
84
|
: {};
|
|
85
|
+
const skillKind = edit.skill_kind ?? before?.skill_kind;
|
|
85
86
|
const after = {
|
|
86
87
|
id,
|
|
87
88
|
kind: edit.kind,
|
|
@@ -91,6 +92,7 @@ export function applyRefinementProposal(state, proposal, options) {
|
|
|
91
92
|
scope: before?.scope ?? options.scope ?? "local",
|
|
92
93
|
reference: edit.reference ?? before?.reference ?? {},
|
|
93
94
|
arguments: edit.arguments ?? before?.arguments ?? {},
|
|
95
|
+
...(skillKind !== undefined ? { skill_kind: skillKind } : {}),
|
|
94
96
|
metadata: { ...sourceMetadata, ...(edit.metadata ?? before?.metadata ?? {}) },
|
|
95
97
|
source: "evolve",
|
|
96
98
|
created_at: before?.created_at ?? now,
|
package/lib/approval.d.ts
CHANGED
|
@@ -6,6 +6,25 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { Context } from "@deepseek-ai/cordis";
|
|
8
8
|
import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
9
|
+
export interface QuestionService {
|
|
10
|
+
ask(request: {
|
|
11
|
+
questions: {
|
|
12
|
+
id: string;
|
|
13
|
+
question: string;
|
|
14
|
+
options?: {
|
|
15
|
+
label: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
}[];
|
|
18
|
+
}[];
|
|
19
|
+
agent?: Agent;
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
answers?: {
|
|
23
|
+
id: string;
|
|
24
|
+
selected?: string[];
|
|
25
|
+
}[];
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
9
28
|
/**
|
|
10
29
|
* Ask the user to approve a global edit. Throws when the service is missing,
|
|
11
30
|
* the user declines, or the question cannot be answered.
|
package/lib/auto.d.ts
CHANGED
|
@@ -1,17 +1,57 @@
|
|
|
1
1
|
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Agent } from "@deepseek-ai/dsh-agent";
|
|
3
|
+
import type { HarnessState, RefinementEdit, RefinementProposal } from "./types.js";
|
|
3
4
|
import type { EvolutionEngine } from "./service.js";
|
|
5
|
+
import { type AutoRefineReason } from "./review.js";
|
|
4
6
|
export interface AutoReviewConfig {
|
|
5
7
|
intervalTurns: number;
|
|
6
8
|
maxInputChars: number;
|
|
7
9
|
budgetTokens: number;
|
|
8
10
|
/** Queue a visible follow-up notice after an approved, applied gate run. */
|
|
9
11
|
notifyOnAutoReview: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Local-fate dimension (#11 P2): the gate audits the session's local
|
|
14
|
+
* entries on its own cadence and proposes promote/archive (consulted
|
|
15
|
+
* first — never written silently). Off disables the whole dimension.
|
|
16
|
+
*/
|
|
17
|
+
localFate: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Minimum turns between local-fate assessments on the turn-interval path
|
|
20
|
+
* (compaction is unconditional). Independent of the review cadence so
|
|
21
|
+
* goal-driven sessions (gate every round) do not pay an assessment per
|
|
22
|
+
* round.
|
|
23
|
+
*/
|
|
24
|
+
fateIntervalTurns: number;
|
|
10
25
|
}
|
|
11
26
|
export interface GateState {
|
|
12
27
|
turns: number;
|
|
13
28
|
lastReviewAt: number;
|
|
14
29
|
running: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Per-candidate turn at which the user last rejected a skill proposal;
|
|
32
|
+
* consulted skill proposals are not offered again within the cooldown
|
|
33
|
+
* window (skills are governed resources — no nagging).
|
|
34
|
+
*/
|
|
35
|
+
skillRejects: Map<string, number>;
|
|
36
|
+
/** Turn at which the local-fate dimension last assessed (cadence). */
|
|
37
|
+
lastFateAt: number;
|
|
38
|
+
/**
|
|
39
|
+
* Per-candidate-set turn at which the user last declined a local-fate
|
|
40
|
+
* proposal; declined sets are not offered again within the cooldown
|
|
41
|
+
* window (the consultSkillEdits pattern — no nagging).
|
|
42
|
+
*/
|
|
43
|
+
fateRejects: Map<string, number>;
|
|
44
|
+
}
|
|
45
|
+
/** Turns a rejected skill candidate stays silent before being offered again. */
|
|
46
|
+
export declare const SKILL_CONSULT_COOLDOWN_TURNS = 10;
|
|
47
|
+
export interface ReviewRecord {
|
|
48
|
+
timestamp: string;
|
|
49
|
+
sessionId: string;
|
|
50
|
+
reason: AutoRefineReason;
|
|
51
|
+
turnsSinceLastReview: number;
|
|
52
|
+
outcome: "approved" | "declined" | "failed" | "assessed" | "deferred";
|
|
53
|
+
rationale?: string;
|
|
54
|
+
refinementId?: string;
|
|
15
55
|
}
|
|
16
56
|
/**
|
|
17
57
|
* Count completed turns from agent/status transitions alone. The runtime
|
|
@@ -31,4 +71,24 @@ export declare function registerAutoReview(ctx: Context, engine: EvolutionEngine
|
|
|
31
71
|
* local state (baseline checks compare local entries only).
|
|
32
72
|
*/
|
|
33
73
|
export declare function loadGateHarnessView(engine: EvolutionEngine, sessionId: string): HarnessState;
|
|
74
|
+
/**
|
|
75
|
+
* Split a proposal into skill edits and everything else. Skill edits are the
|
|
76
|
+
* governed part: they need explicit user consent before the gate applies
|
|
77
|
+
* them, while the remaining edits flow through the normal auto path.
|
|
78
|
+
*/
|
|
79
|
+
export declare function splitSkillEdits(proposal: RefinementProposal): {
|
|
80
|
+
skillEdits: RefinementEdit[];
|
|
81
|
+
otherEdits: RefinementEdit[];
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Ask the user whether to solidify proposed skill edits (guidance or
|
|
85
|
+
* executable) into the harness. Returns true when every skill edit is
|
|
86
|
+
* consented. Never writes a skill silently:
|
|
87
|
+
* - no question service available → false (conservative);
|
|
88
|
+
* - the same candidate was rejected within the cooldown window → false
|
|
89
|
+
* without asking again (no nagging);
|
|
90
|
+
* - the user declines → false and the rejection is recorded for cooldown;
|
|
91
|
+
* - the question call fails/aborts → false (conservative).
|
|
92
|
+
*/
|
|
93
|
+
export declare function consultSkillEdits(ctx: Context, agent: Agent, skillEdits: RefinementEdit[], gate: GateState): Promise<boolean>;
|
|
34
94
|
//# sourceMappingURL=auto.d.ts.map
|