dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
中文 | English
Knowing what a skill can actually do *before* you execute it — that is consciousness strength. Dreaming raises it by measuring every skill call and correcting skill boundaries overnight, so skills are invoked precisely and tokens are not wasted on descriptions that merely *look* right.
Dreaming is a global DeepSeek Harness plugin (Host plugin + Web panel). It is not a logging plugin; it is a capability self-model:
A skill description is a *claim*. Claims and reality often disagree:
Dreaming closes the loop: measure → judge → write the boundary back → measure again. The metric is rising consciousness and falling wasted tokens, not the number of log lines.
┌──────────── every skill call ────────────┐
user/agent ── skill ─┤ tools/pre-execute │
│ ├─ record the task context (truncated) │
│ └─ concurrent probe: a cheap LLM call │
│ predicting fit / expected use / │
│ pitfalls / capability gap │
├─ tools/result: record the skill body and │
│ the load outcome │
├─ tools/post-execute: append measured │
│ history + prediction + learned │
│ boundaries to the skill result │
├─ session/event: observe later assistant/ │
│ tool/user events until turn end │
└─ judge: expectation vs reality → score / │
root cause / reusable rules │
│
┌──────────────┴──────────────┐
│ capability belief per skill │
│ consciousness / calibration │
│ boundary accuracy / waste │
└──────────────┬──────────────┘
│
global awareness section in the system prompt
+ annotation appended to the skill result
│
┌──────────┴──────────┐
│ nightly dream (timer)│
│ pick mismatches → │
│ reflect → edit the │
│ description/boundary │
│ → backup + journal + │
│ revert │
└─────────────────────┘Inside tools/pre-execute the plugin registers an episode before the skill runs and starts a budgeted LLM call concurrently (default probe.mode = 'inline'; it uses ctx.llm.stream directly and does not create a sub-session or pollute the conversation). The probe returns a structured prediction:
fit (0–1): whether and how well the skill fits this task;expected_use: the concrete steps the model is expected to take;success_signals: what using it correctly would look like;likely_pitfalls: the most likely traps;capability_gap: a capability the task needs that the skill may not actually provide;cheaper_alternative: a cheaper path when the skill is not needed.Why not a sub-agent by default: a full sub-agent's fixed prompt + tool schemas + multi-step reasoning usually costs more than the skill body it is meant to save. The probe is a single, low-temperature, structured, sampled call. probe.mode = 'subagent' remains available for cases that genuinely need an agent-shaped observer.tools/result records the skill load; session/event collects a bounded trace from the load point: assistant text, tool-call sequence (name/outcome/summary), user corrections, and the turn/end reason. The window closes at the same turn's turn/end, or after observe.maxTurnExtensionMs / observe.maxEvents. Closed sessions are never read again and the window does not stay in memory.
After the turn, one cheap judge call produces:
score (0–100) and verdict (matched / partial / missed / misapplied);predictionAccuracy: agreement between prediction and reality;capabilityGap: difference between what the description claims and what was delivered;mismatches, rootCause (description / instructions / selection / user / execution);reusableRule: a rule that can be reused next time;cost.wastedEstimate: a conservative estimate of wasted tokens.Each skill keeps a belief: load count, verdict distribution, fit history, cost, learned boundaries. Core metrics:
Metric · Definition · Question it answers fitAccuracy · 1 − Brier score (predicted fit vs. actual success) · Does it predict *itself* accurately? boundaryAccuracy · 1 − share of judged calls with a capability gap · Is its stated boundary accurate? precision · 1 − misapplied / judged (judged calls only) · When it was called, was it on topic? consciousness · 100 × (0.45·fitAccuracy + 0.30·boundaryAccuracy + 0.25·precision) · The combined consciousness score wasteRate · wasted tokens / loaded skill tokens · How much did it waste? confidence · <3 / <10 / ≥10 judged → low / medium / high · How trustworthy is the score?
No fake high score with few samples: confidence = low is reported, and both the panel and the model-facing text say so.Dreaming · capability awareness, appears only when there is enough evidence, at most prompt.maxSkills lines, explicitly marked as observed tendency and not overriding the skill's own instructions.prompt.annotationMaxChars characters are appended to the result:probe.attachDeadlineMs);The model sees this after reading the skill body and before acting, so it can adjust immediately.
dream.time (default 03:30, local time zone, configurable IANA zone) triggers a run; catch-up and jitter are supported. Each run:
caseWindowDays) missed / misapplied / low-score cases, grouped by skill (at most maxCasesPerSkill cases per skill, maxSkillsPerRun skills per run);description edit, a body capability-boundary section, reusable rules, confidence;dream.editableSources (default user-dsh, user-agents), path-checked against the user skill roots (realpath), backup first, atomic replace, sha256 verified;before together with an explicitly estimated afterEstimate.Body edits use markers so repeated dreams only replace the block between them and never rewrite your hand-written body or other frontmatter:
## Capability boundaries (Dreaming · auto-maintained)
...Requires DSH ≥ 0.2.1-0 (see engines.dsh).
Install from this Git repository (the plugin is distributed from GitHub; npm publishing is planned).
In the Harness Plugins page, paste the repository URL:
https://github.com/puppetcat-fire/dsh-plugin-dreamingor from the CLI for a profile:
dsh plugin --profile <profile> add git+https://github.com/puppetcat-fire/dsh-plugin-dreaming.gitA profile-level bundle takes effect for all sessions and survives restarts. Remove it from the Plugins page, or with plugin_manager(action="remove_bundle", target="dsh-plugin-dreaming").
Runtime packages (@deepseek-ai/dsh-tools,@deepseek-ai/dsh-llm,@deepseek-ai/schemastery,@deepseek-ai/cordis) are provided by Harness; they are declared aspeerDependenciesand need no separate install.
All configuration lives in the profile's cordis.patch.yml (or a home patch). The plugin exports no editable volatile fields, so Settings shows no generic form; Settings → Dreaming is a read-only observability page. Defaults are defined in lib/config.js. The most useful keys:
Key · Default · Meaning enabled · true · Master switch dataDir · '' · Data directory; empty = $DSH_HOME/dreaming probe.enabled · true · Predict on skill load probe.mode · 'inline' · inline (recommended, cheap) or subagent probe.sampleRate · 1 · Sampling rate; known-gap skills are always probed probe.attachDeadlineMs · 1500 · How long the skill result waits for the probe; on timeout only history is attached probe.maxPerHour · 120 · Hourly probe cap judge.enabled · true · Judge after the turn observe.maxTurnExtensionMs · 600000 · Hard cap on the observation window prompt.awarenessSection · true · Inject the global awareness section prompt.annotateSkillResult · true · Annotate the skill result prompt.refreshMinutes · 10 · Minimum refresh interval for the global section (KV-cache friendly) dream.enabled · true · Nightly dream dream.time · '03:30' · Local wall-clock time HH:MM dream.timeZone · '' · IANA zone; empty uses the process zone dream.scoreThreshold · 78 · Below this score a judged episode is a mismatch case dream.autoApply · false · false records suggestions only; true applies validated edits with backup and revert dream.editableSources · ['user-dsh','user-agents'] · Skill sources that may be edited on disk dream.dailyTokenBudget · 60000 · Daily dream token budget run.maxConcurrent · 2 · Concurrent probe/judge calls store.retainDays · 120 · Episode retention store.maxEpisodes · 4000 · Episode cap
Example (probe office skills only and opt into automatic edits):
- id: dreaming
config:
probe:
sampleRate: 0.5
attachDeadlineMs: 1200
dream:
time: '04:10'
timeZone: Asia/Shanghai
autoApply: trueSettings → Dreaming · consciousness strength (settings.section, order 95):
The panel only reads /dreaming/api/* (a Host prefix route: JSON only, Origin check on POST, request-size limit). Every write goes through the same revert path as the dream engine.
$DSH_HOME/dreaming/ (episodes.jsonl, state.json, dreams.json, edits.json, backups/);edits.json stores the full pre-edit text and sha256 of the one skill file this plugin modified (in the local data directory only; never sent to a model, never shown in the panel/API);backups//SKILL.md; edits.json records the before/after sha256;debug level only lengths and timings are logged..catch; every timer and AbortController is owned and released on unload;store offline and sessions are unaffected;conflict — your edits are never clobbered;Under the default configuration:
dream.dailyTokenBudget.If one wrong load wastes 3–8k tokens, cutting misuse by 10% is enough to pay for this overhead. The panel shows both “probe + judge spend” and “estimated waste avoided”, so you can tune sampling up or down.
cd dsh-plugin-dreaming
npm test # node --test --test-isolation=none "test/*.test.mjs"
# or run a single file:
node test/config.test.mjs
node test/stats.test.mjs
node test/store.test.mjsARCHITECTURE.md: the full design contract, Harness extension points, data schemas, module interfaces and failure posture;node:test only. CI runs the same suite on Windows.dream.autoApply is false, so dreams journal proposals without touching files. Enable it explicitly to correct descriptions/boundaries (backups, journal, conflict detection and revert still apply).dream.mode is recorded truthfully as inline and logs one warning.SKILL.md is a symlink the plugin refuses to write (symlink-path) and only records a suggestion, so the link is never replaced by a regular file./dreaming/api/ has no extra auth beyond the loopback binding (POST has an Origin check). Do not expose the profile's listener on a non-loopback address without adding authentication, and treat the data directory and backups as local user data.accepted:true immediately and runId may be null — the actual run id is in the next journal refresh.probe.mode = 'subagent' creates a real sub-session, costs significantly more and is subject to delegation depth/capacity; failures fall back to inline.