DeepSHPlugins
dsh-auto-evolve 项目预览
GITHUB / COMMUNITY PROJECT

dsh-auto-evolve

Agent 与自动化TypeScriptMIT

一个自我进化的 DeepSeek Harness 插件:观察代理的运行方式,通过 LLM 对其自身资产提出改进方案,在沙箱试运行代理中验证每个方案,只应用通过验证的变更——带版本化账本,出现性能回退时自动回滚。

3 Starslispking 更新时间 2026-08-25
访问 GitHub 仓库
dsh-auto-evolve 项目预览

项目介绍

中文

一个自我进化的 DeepSeek Harness 插件:观察代理的运行方式,通过 LLM 对其自身资产提出改进方案,在沙箱试运行代理中验证每个方案,只应用通过验证的变更——带版本化账本,出现性能回退时自动回滚。

English

A self-evolving plugin for DeepSeek Harness: it observes how the agent runs, proposes improvements to its own assets via the LLM, validates each proposal inside a sandboxed trial agent, and applies only verified mutations — with a versioned ledger and automatic rollback on regression.

项目信息与收录信号

快照 2026-09-11
作者 / 组织
lispking
仓库
lispking/dsh-auto-evolve
GitHub Stars
3
Forks
0
开发语言
TypeScript
许可证
MIT
最近推送
2026-08-25
Manifest
数据中检测到声明

公开仓库不自动等于可商用;许可证与当前兼容性以原项目文档为准。Manifest 和数据评分不构成安装安全认证。

数据评分

59/ 100
维护活跃
89
文档与实用信息
85
生态关注度
17
安装便捷信号
100
项目声明信号
100

近 17 天仍在更新;README 含完整安装与使用说明;关注度尚低(3)。

评分来自已有数据快照的五维模型,仅作浏览参考,不是实际使用评测或安全检测结论。

安装与使用

所有项目资料与许可均以对应 GitHub 仓库为准。

dsh plugin --profile web add github:lispking/dsh-auto-evolve

复制命令不会自动执行。请先阅读仓库文档,确认环境要求与许可证。

项目截图

仓库 README

GitHub 原文

已保存的仓库文档快照;文档抓取时间未记录,可能与上方目录介绍处于不同版本。安装前请核对当前仓库说明。

dsh-auto-evolve

A self-evolving plugin for DeepSeek Harness (dsh). It observes how the agent runs, proposes improvements to *its own* assets via the LLM, validates each proposal inside a sandboxed trial agent, and applies only verified mutations — with a versioned ledger and automatic rollback on regression.

中文

The idea. Instead of shipping a static skill set, the plugin owns a small *genome* of evolvable assets (skills, tool-result post-processors, prompt sections, guard policies). Every runtime signal (tool failures, repeated calls, request errors) is collected; when a threshold crosses, a proposal cycle drafts a mutation, a sandboxed agent replays the failing episode with and without the change, and the change is applied only if the trial shows measurable improvement. Every mutation is versioned in a durable ledger and can be rolled back.

How it works

Observe ──▶ Propose ──▶ Validate ──▶ Apply ──▶ (observe again, for regressions)
  │             │            │            │
  tools/result  ctx.llm      sandboxed    ctx.skills.register + ledger
  request-error (stream)     sub-agent    disposer kept for rollback

The evolution loop

LayerModuleWhat it does
Observesrc/observeListens on tools/result and agent/request-error; records deduplicated signals (tool failures, no-progress repeats, request errors) into the durable observations table; fires onTrigger when a threshold crosses.
Proposesrc/proposeA bounded cycle snapshots the genome + recent observations, calls ctx.llm.stream() with a strict prompt, and validates the model output against a closed mutation vocabulary (add / patch / retire over skill / post-processor / prompt-section / guard-policy). Anything that fails parsing or schema validation is discarded — never applied. Mutations whose content fingerprint already matches a pending candidate are dropped, so the same patch is never re-trialed while awaiting validation.
Validatesrc/validateReplays the failing episode inside a fresh scoped sub-agent (ctx.agents.create + setup), once without the candidate mutations (baseline) and once with them (trial), then compares metrics: completion, tool failures, tool-call cost. Every kind with a runtime contribution — skill, tool-wrapper, guard-policy, post-processor — is exercised via the shared mutation applier (the same code the live apply path uses, so validation == deployment); prompt-section candidates are recorded but not auto-applied.
Applysrc/applyPromotes a validated candidate to the live genome: skills are registered on the plugin context via ctx.skills.register (immediately visible), the ledger records the apply with the previous content captured, and the disposer is kept for rollback.
Rollbacksrc/applyUnregisters the live contribution, restores the parent content as a fresh candidate, and writes a rollback ledger entry. On plugin disposal every live registration is torn down.

Safety boundaries

  • The mutation vocabulary is code, the content is model-generated. The LLM never invents asset kinds or operators; it only fills in payloads that pass the closed zod schema.
  • Validation is by execution, not by self-claim. A proposal is applied only when a sandboxed trial beats the baseline on observable metrics.
  • Cost is capped per cycle and per day. The budget gate (maxCostPerCycle / dailyBudget) bounds the proposal call and every trial replay in auto-apply; an exhausted cap pauses the loop instead of silently burning tokens.
  • Rollback is first-class. Every applied mutation keeps its disposer and its parent content; regression reverts the exact previous state.
  • Observe-only is the default. In observe mode the plugin never proposes — it just collects signals and logs triggers.

Installation

The plugin is a dsh bundle: install it with the official CLI in one command — no manual cordis.yml editing required.

# Install into the web profile (the default UI profile)
dsh plugin --profile web add dsh-auto-evolve

# Or into the TUI profile
dsh plugin --profile tui add dsh-auto-evolve

dsh plugin add initializes the profile if needed, installs the package, and automatically adds dsh-auto-evolve to the profile's bundle stack (dsh.profile.bundles). The bundled cordis.patch.yml registers the plugin row with the defaults below; restart dsh and the plugin is live.

Local development / source build:

git clone https://github.com/lispking/dsh-auto-evolve.git
cd dsh-auto-evolve
pnpm install
pnpm build
# Install your local checkout into a profile
dsh plugin --profile web add /absolute/path/to/dsh-auto-evolve

Custom configuration

The bundle applies a default config; to change it, override the row in your own profile patch (applied after every bundle layer):

# ~/.dsh/profiles/web/cordis.patch.yml
- id: self-evolve
  config:
    mode: auto-apply        # observe | propose | auto-apply
    observation:
      toolFailureThreshold: 3
      repeatThreshold: 3
      requestErrorThreshold: 3
      windowMs: 300000
    proposal:
      maxProposalsPerTrigger: 1
      maxEpisodesPerProposal: 5
      maxPromptChars: 24000
      maxTokens: 2000
    budget:
      maxCostPerCycle: 0       # 0 disables the per-cycle cap
      dailyBudget: 0           # 0 disables the daily cap
    validation:
      maxTrialMs: 30000
      maxToolCalls: 20
      maxTrialSteps: 12
      maxTrialTokens: 8000
    evolution:
      stallThreshold: 3
      stallPauseMs: 1800000
      cooldownMs: 600000
Note: a patch replaces the row's whole config rather than merging into it, so specify every field you want to keep. The plugin's peer services (storage, LLM, tools, skills) come from the dsh-base/web bundles — no extra setup.

Modes

ModeBehavior
observeCollect signals, fire triggers, never propose. Safe default.
proposeGenerate and persist candidate mutations when thresholds cross. Candidates await validation/application — manual approval via the evolve_apply operator tool, or via the exported API.
auto-applyRun the full loop: observe → propose → validate → apply verified mutations automatically, with automatic rollback when the same failure key recurs after an apply (regression watch). After repeated stalled cycles the loop pauses (convergence) and each failed/rolled-back key enters a cooldown, so it cannot thrash propose → fail → propose. The regression watch is persisted, so applied fixes stay monitored across plugin restarts.

Operator tools

The plugin registers a small set of agent-callable tools (dsh exposes no chat-command framework; in an agent harness the operator surface is tools). Ask the agent to inspect or drive the loop — no manual API calls needed:

ToolParamsWhat it does
evolve_status—Health summary: mode, generation, asset status counts, ledger/observation totals, convergence pause state, regression watch size.
evolve_candidates—List candidate mutations awaiting validation or manual application.
evolve_applyassetIdApply one candidate immediately (manual approval), registering it live.
evolve_rollbackassetIdRoll back an applied asset, restoring its previous content as a candidate.
evolve_cycle—Trigger one cycle manually: materialize candidates (propose) or run the full validate-and-apply loop (auto-apply).

Availability by mode: all five tools are registered in every mode; evolve_apply / evolve_rollback need the applier (mounted in propose and auto-apply), and evolve_cycle needs an LLM provider and rejects in observe mode.

Configuration

FieldDefaultMeaning
modeobserveEvolution mode (see above).
observation.toolFailureThreshold3Tool-failure burst count that triggers a cycle.
observation.repeatThreshold3Identical-call count treated as a no-progress loop.
observation.requestErrorThreshold3LLM request-error count that triggers a cycle.
observation.windowMs300000Rolling window (ms) over which signal counts aggregate.
proposal.maxProposalsPerTrigger1Max mutations per proposal.
proposal.maxEpisodesPerProposal5Max observations rendered into the proposal prompt.
proposal.maxPromptChars24000Prompt size cap (bounds cost).
proposal.maxTokens2000Max output tokens for one proposal call.
budget.maxCostPerCycle0 (off)Max tokens spendable in one cycle: the proposal call plus every trial replay in auto-apply. 0 disables the cap.
budget.dailyBudget0 (off)Max tokens spendable in one UTC day across all cycles. 0 disables the cap.
validation.maxTrialMs / maxToolCalls30000 / 20Trial wall-clock and tool-call caps.
validation.maxTrialSteps / maxTrialTokens12 / 8000Trial model-step and per-request token caps.
evolution.stallThreshold3Consecutive stalled cycles before auto-apply pauses.
evolution.stallPauseMs1800000How long an auto-apply pause lasts (ms) before it resumes.
evolution.cooldownMs600000Per-key cooldown (ms) after a failed or rolled-back cycle.

Programmatic API

import { SelfEvolveStore, SelfEvolveApplier, runProposalCycle, validateMutations } from 'dsh-auto-evolve'

// Run one proposal cycle (persists candidate assets).
const materialized = await runProposalCycle(ctx, store, { provider, model, maxTokens: 2000 })

// Validate a candidate: baseline vs trial replay, returns the verdict.
const { baseline, trial, comparison } = await validateMutations(ctx, {
  provider,
  model,
  episode: 'replay of the failing scenario',
  mutations: [candidateAsset],
  bounds: { maxTrialMs: 30_000, maxToolCalls: 20 },
})

// Apply a validated candidate (registers the skill live) or roll it back.
await applier.applyCandidate(candidate.id, trialId, 'validated')
await applier.rollback(candidate.id, 'regression observed')

Development

pnpm build   # tsc + tsdown → lib/
pnpm test    # vitest (unit + integration over a memory storage backend)

The test suite covers the pure decision logic (metrics comparison, mutation schema, thresholds) and the full wiring (durable store, observation collector, proposal cycle with a scripted LLM adapter, apply/rollback with the real skill registry).

License

MIT

使用前核对

安装步骤、兼容版本与授权范围以原项目当前文档为准。Stars 和评分是快照中的导航信号。

安装与排错 · 项目问题反馈

同类项目