Input prediction for the DSH composer: your next prompt suggested as ghost text after each turn, accepted with Tab. (autocomplete / input prediction / prompt suggestion)
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-suggest-ghost
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:dsh-plugin-collection/dsh-suggest-ghost
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
dsh-suggest-ghost
English | 简体中文
Input prediction plugin for DeepSeek Harness Web: after each turn completes, one auxiliary LLM call predicts your next prompt and renders it as ghost text in the input box when the draft is empty; while you type, it completes from the current conversation history by prefix match. Tab accepts the whole suggestion, → accepts word by word.
What it is
A pure plugin mount (host listens to turn events + client-side DOM overlay) — no changes to any DSH core code. Three modes switch automatically:
- LLM next-suggestion (empty draft): after every completed turn, the last round of conversation is sanitized and sent to the suggestion model (inherits the main request route by default, no extra config) to produce "the sentence you are most likely to type next" — the same experience as Claude Code.
- History prefix completion (non-empty draft): zsh-autosuggestions style — finds prefix-matching entries in conversation history, scores by recency first, with in-session frequency and cross-session hotness as secondary signals, and renders the remaining part in gray. Full/half-width punctuation, whitespace, and case differences do not affect matching. Immediate, no network.
- Pause completion (non-empty draft): once typing pauses for
inlineDelayMs(default 100ms) a completion request goes out and the rest of the sentence appears as ghost text at the caret; Tab accepts the whole thing,→accepts word by word. Latency expectation:inlineDelayMsonly decides when the request is sent; the model itself measured 1.1-17s (42 generations in the real environment on 2026-10-20: fastest 1100ms, median 4900ms, slowest 16986ms), so waiting a moment after pausing usually shows nothing yet. Typing again aborts the in-flight request and restarts it - and a completion that already arrived is still shown per the alignment rule, not dropped; every such outcome is visible in the host log (completion-preempted/completion-aborted/completion-timeout).
Ghost text is rendered as a DOM overlay approximation (follows the input's font and scroll), not depending on the official setGhost input capability, so it works on rc.6; keystrokes are not intercepted during IME composition.
Preview

① History prefix completion (non-empty draft) — type "list do" and the ghost completes the remainder of that historical message:

② LLM next-suggestion (empty draft, auto-predicts your next step after a turn ends):

Dark text = what you typed; gray = ghost suggestion. Tab accepts the whole suggestion, → accepts word by word. Ghost text follows the input's font and scroll rendering — it never overlaps or steals focus; if you don't like it, just ignore it and keep typing and it disappears — zero cost.
Installation
From npm (recommended — prebuilt, no approval needed):
dsh plugin --profile web add dsh-suggest-ghost
One-line install from GitHub (build artifacts are committed to the repo, no local build needed):
dsh plugin --profile web add "github:WuJiaoJue/dsh-suggest-ghost"
Or from source:
git clone https://github.com/dsh-plugin-collection/dsh-suggest-ghost.git
cd dsh-suggest-ghost && pnpm install && pnpm run build
dsh plugin --profile web add .
After installing, restart dsh web and hard-refresh the page with Ctrl+Shift+R. Works out of the box with no configuration required.
Configuration
All settings live in the Suggest ghost card in Settings → Plugins and take effect immediately after saving:
card copy (field labels/hints, buttons, badges) follows the host DSH UI language. This plugin ships Chinese and English copy only; the host's other UI languages (Japanese, Spanish, French, German, Russian, Portuguese) resolve to English — the same direction the host itself declares for those locales via fallback: "en", so a Japanese interface never gets handed a Chinese card. Hosts without a locale service still fall back to Chinese. Updates in real time when the language is switched in Settings, without a refresh.
| Group | Fields |
|---|---|
| LLM next-suggestion | enable toggle, max output tokens, max suggestion chars, reference turns, transcript char budget, timeout (ms), accept key, provider / model route (leave empty to inherit the main request), suggestion reasoning effort suggestionReasoningEffort (empty by default = not sent), suggestion prompt suggestionPrompt (empty by default = built-in template) |
| Pause completion | enable toggle, pause duration (default 100ms), min input chars (pause), completion length cap, completion context cap completionContextChars (default 2000), completion reasoning effort completionReasoningEffort (empty by default = not sent), completion prompt completionPrompt (empty by default = built-in template) |
| History prefix completion | enable toggle, cross-session search, max history entries, min input chars (history) — the keys live under Shortcuts |
| Shortcuts | all six actions are rebindable: acceptKey (accept the next suggestion), localAcceptKey (accept history / pause completion, Tab by default), wordAcceptKey (word-by-word accept, → by default), regenKey (another suggestion, Alt+G by default), dismissKey (hide the ghost, Esc by default; empty = give the action up), forgetKey (never suggest this line again, Alt+X by default; see below)plus two action switches that live on their own rows; the hint-line switch sits under Appearance. |
| Reading the table | One row per action, grouped by which arbitration table owns it (next suggestion / history · pause completion / all forms). The grouping is projected from KEY_TABLES, the same data the conflict check reads — it is not a layout choice. The status on the right (off / not bound / shared key) is also computed from that table, so the UI cannot promise a key that does nothing; a shared key row names the winner, as ownerOfKey decides it rather than as fixed copy. |
| Forget a line | With a ghost on screen, press Alt+X and that line leaves the candidate pool for good: it stops being completed and stops counting toward hotness (retyping it does not bring it back), and it is removed from Hotness management. Restore entries one by one — or all at once — from the Ignored list in the same section |
| Hotness management | frequent cross-session phrases list: pin (exempt from eviction, always leads candidates), delete, manual add (pinned by default), clear all — takes effect immediately, no save needed |
Why the effort defaults to empty: reasoningEffort is declared per provider and per model, it is not a global switch. 9 of the 18 models in this profile declare no reasoningEfforts at all (efficient / fast / lite, …), and sending any effort to those is rejected by the adapter before the request goes out (UNSUPPORTED_REASONING_EFFORT, measured 0-20ms). So an empty string means the plugin does not write the key and the route keeps its own default. An effort the model does not declare still does not cost you the suggestion: the host retries once without it and logs effort_rejected=1. Do not use it as a "thinking off" switch either — only routes that explicitly declare off / none accept those values (qfmodel rejects even off; its profile declares low/medium/xhigh).
How much time an effort saves depends on the model: measured in one sandbox,
qfmodeltook 1468ms by default and 828ms withlow(≈1.8x), whileefficienttakes 6238ms by default. Switching the model is the bigger lever (≈4x). First-delta latency, delta counts and the requested effort are now on the trace lines (suggestion generated …/completion generated …, carryingfirst_text_delta_ms/first_reasoning_delta_ms/outcome=empty|filtered).
You can also override by id in cordis.patch.yml (as initial values for the above):
- id: suggest-ghost
config:
maxInputBytes: 4096 # framed user prompt byte cap
maxOutputTokens: 512 # suggestion output token cap
timeoutMs: 60000 # auxiliary request deadline (ms)
maxRecentTurns: 1 # most recent completed turns sent to the suggestion model
maxTranscriptChars: 12000 # transcript char budget
completionContextChars: 2000 # completion context char cap (the smaller of this and the budget wins)
maxSuggestionChars: 240 # visible suggestion char cap
acceptKey: Tab # accept shortcut (next suggestion)
localAcceptKey: Tab # accept shortcut (history / pause completion)
wordAcceptKey: Right # word-by-word accept (`Right` = bare arrow key)
dismissKey: Escape # hide the ghost (empty = do not take the action over)
forgetKey: Alt+X # never suggest this line again (empty = do not take the action over)
regenKey: Alt+G # "another suggestion" shortcut
llmEnabled: true # LLM suggestion toggle
suggestionReasoningEffort: '' # effort for the suggestion call (empty = do not send)
completionReasoningEffort: '' # effort for the completion call (same semantics)
suggestionPrompt: '' # prompt for the next-suggestion call (empty = built-in template)
completionPrompt: '' # prompt for the pause completion (same semantics)
How much history a continuation reads (two caps)
The pause-completion path reads the smaller of:
- Transcript character budget (
maxTranscriptChars, default 12000) — shared by both generation paths; - Completion context cap (
completionContextChars, default 2000) — an extra ceiling on completions only.
Why completions need their own cap: they run on the path where you are waiting (they fire after a 100 ms pause by default), and a longer context means a slower first chunk — so this cap belongs to the same family of latency guards as the completion reasoning effort.
The cap always existed; it was just a constant buried in the code. The consequence: raising the transcript budget to 50000 left the history a continuation reads unchanged (measured: 12000 / 50000 / 200000 all yielded roughly 3 messages), and nothing in the UI explained why. It is now a visible default — raise it if you want more context; larger is more accurate but slower. Zero or negative values are rejected, since they would leave the continuation with no context at all and it would only echo your draft.
The default of 2000 keeps behaviour byte-for-byte identical to before.
Custom prompts
Both generation paths expose their system prompt in the settings card —
Suggestion prompt (suggestionPrompt) and Completion prompt (completionPrompt),
one multi-line box each, up to 6000 characters.
Empty means the built-in template, byte for byte. Both keys default to empty, so leaving them alone changes nothing about today's behaviour. Whitespace-only counts as empty too: a template of spaces and newlines hands the model a prompt with no instruction at all, which shows up as "it rambles but nothing failed" — harder to diagnose than falling back.
Any text you type becomes the template, with three placeholders:
Placeholder Expands to Why it is there {{builtin}}the whole built-in template add your own rules around the built-in ones without copying a full prompt, and without losing its dozen prohibitions by replacing it wholesale {{language}}the output language detected for this turn the language still comes from the Suggestion language setting; a custom prompt does not override it {{maxChars}}that path's character cap the cap stays a setting ( maxSuggestionChars/ completion length cap) instead of getting baked into a copied templateAn unrecognised
{{xxx}}is sent as-is: silently dropping it would look like it worked, and throwing would fail the whole generation in silence — both are harder to debug than passing it through.Example — keep the built-in rules and add one of your own:
{{builtin}} One more rule: never suggest committing, pushing, or anything else not already asked for.No restart needed. The write goes through the kernel's volatile channel; the host marks its live view dirty on
settings/document-updatedand re-reads it before the next generation, so the very next turn uses the new prompt. The trace lines end withprompt=custom/prompt=builtinto answer "which one did this turn use" — that reading comes from the generation itself, not from re-reading the config when it lands (by then it may be a newer value).The 6000-character cap measures the template; what
{{builtin}}expands to is not counted against it.Output sanitising and filtering do not loosen because you wrote your own prompt: the character caps, the single-line rule and the echo filter still apply. A custom prompt changes what the model is asked for, not what it is allowed to output.
Security
- Only the last round of conversation is sent to the suggestion model, with common credentials auto-masked before sending; output is purified and unqualified replies are silently discarded
- Fully bounded end to end: input bytes / output tokens / timeout capped; re-entry guarded within the same turn, new turns invalidate stale generations, unloading aborts in-flight requests
Compatibility
Current status (2026-10-30): six generations are supported — 0.1.2-rc.1 / 0.1.5-rc.3 / 0.1.7-rc.1 / 0.1.7-rc.2 / 0.2.0-rc.2 / 0.2.1-rc.2. 0.2.2-alpha.2 is registered in the generation
table and passes the assembly / admission / type / projection faces, but it is a prerelease line and
not a promise about 0.2.2 proper. 0.1.1-rc.2 was dropped: its front end has no
remote.settings service, and cordis parks a whole fiber when a declared inject cannot be resolved —
the hard-constraint evidence and the control experiment live in scripts/cross-kernel/FINDINGS.md.
Everything below that mentions 0.1.1-rc.2 is historical.
| DSH kernel | admission gate | assembly + projection | type face | UI face (real GUI screenshot) |
|---|---|---|---|---|
0.1.2-rc.1 |
⚪ no evaluator in this generation ⇒ undetermined | ✅ | ✅ | ✅ FINDINGS §13 |
0.1.5-rc.3 |
⚪ same ⇒ undetermined | ✅ | ✅ | ✅ FINDINGS §13 |
0.1.7-rc.1 |
✅ peers only | ✅ | ✅ | ✅ FINDINGS §13 |
0.1.7-rc.2 |
✅ peers only | ✅ | ✅ | ✅ FINDINGS §8 / §12 |
0.2.0-rc.2 |
✅ peers only | ✅ | ✅ | ✅ FINDINGS §8 |
0.2.1-rc.2 |
✅ engines.dsh decides alone |
✅ | ✅ | ✅ FINDINGS §8 / §12 |
0.2.2-alpha.2 |
✅ engines.dsh decides alone |
✅ | ✅ | ⏳ undetermined (FINDINGS §20.6 — not green) |
Three reading rules: undetermined ≠ green (the first two generations have no gate at all, so an assembly GREEN does not prove admission was verified); an enumerated peer list ≠ the kernel's matching rule (see the two-calibre note below); and the UI face is the only one that answers "did the user actually see it" — it is also the one the other four faces most easily hide.
Peer enumeration, and the hard gate that starts at 0.2.0
Peer deps are written as an explicit generation list (^0.1.2-rc.1 || ^0.1.5-rc.1 || ^0.1.7-rc.2 || ^0.2.0-rc.2 — all six @deepseek-ai/dsh-* peers carry exactly this string) rather than >=0.1.2-rc.1.
The reason splits into two calibres, and they must not be conflated (measured 2026-10-30, FINDINGS §20.4):
- Install side (npm/pnpm resolving peers, no
includePrerelease): node-semver excludes prereleases from every range unless a comparator carries the same[major.minor.patch]tuple, so^0.1.2-rc.1is false for0.1.5-rc.1, and so is*— no range spans generations, and every new rc needs another entry. ✅ Fixed 2026-11-09 (issue #149): peerDependencies now includes^0.2.2-alpha.2, so the install side matches 0.2.2 prereleases. - Admission side (what the kernel actually runs:
semver.satisfies(v, range, { includePrerelease: true })): measured,^0.1.2-rc.1covers all of 0.1.x (including0.1.7-rc.1),^0.2.0-rc.2covers everything in>=0.2.0-rc.2 <0.2.2-0(including0.2.1-rc.5), and^0.2.2-alpha.2covers everything in>=0.2.2-alpha.2 <0.2.3-0(including0.2.2-rc.1) — while all of those are false on npm's calibre.
⇒ "Add an enumeration entry" is an install-side concern, not an admission requirement. That is why this repo
did not widen its peer ranges for an alpha line (doing so writes an unverified generation into the support
claim); when 0.2.2 ships both calibres cover it automatically, and the work is one new row in the generation
table plus a re-run.
At 0.2.0 this stopped being an install-time hint and became a load-time hard rejection. While composing a profile the kernel checks each peer with semver.satisfies(runtimeVersion, range, { includePrerelease: true }) and skips the whole bundle on a miss:
dsh: skipping profile bundle "dsh-suggest-ghost": Error: Plugin … is incompatible
with dsh 0.2.0-rc.2: peerDependencies {…}
Two details worth remembering:
- the gate passes
includePrerelease: true, but that is not a blank cheque:^0.2.0(without the rc) is still false for0.2.0-rc.2(false under both calibres) — admitting that generation takes the rc-carrying lower bound; dsh plugin allow-versiongrants an exact-version exemption, which bypasses the check rather than fixing it. On the admission side the real fix is registering the generation inscripts/cross-kernel/generations.mjsand re-running it; only the install side is fixed by adding an enumeration entry.
The 0.1.7 settings rework (the only substantial source change)
0.1.7 removed the whole settings.yaml system, so the plugin's data channel had to move:
0.1.5 |
0.1.7+ |
|
|---|---|---|
| User-editable options | ctx.settings.register(ns, schema, …) |
per-field .volatile() in Config; the kernel projects the plugin's own Config schema into a form, ns = Loader entry id |
| host → client | _push on a SettingsScope |
ctx.settings.update(ns, {_push, _hot}) (both volatile: _push = suggestion cell, _hot = hotness/history cell) |
| client reads | settingsScope.bind(ns).get() |
remote.settings.describe() (first read + event-driven re-read) |
| client → host | scope.set('_ops', …) |
remote.settings.mutate(ns, [{op:'set',path:['_ops'],…}]) |
| change signal (host) | scope.watch |
settings/document-updated(ns, revision) event |
| change signal (client) | scope.subscribe |
remote.$on('settings/document-updated') |
The payload shape is unchanged (the _push / _ops JSON, including the suggestionSessionId / historySessionId ownership guards) — only the carrier moved, so the client's parsing and ownership logic needed no rewrite.
Three details that only surface when you try them:
Configmust not be marked.volatile()as a whole, andz.object({…}).volatile().dictmust not be spread back in — the former exposes the strategy parameters as form fields too, the latter drops each field's ownmetaduring flattening and makes the entire form invisible. Mark per field.- A volatile field resolves to a reference (cosmokit's
Volatile<T>), not a bare value, so reads must go through.get().flattenConfig()flattens those references into plain values so the rest of the plugin is generation-agnostic; it also accepts bare values, so0.1.5and earlier keep working. provider/modelchanged fromz.string().min(1)to.default(''): once they are form fields, being required means the plugin "cannot start until filled in", while the intended meaning of empty is "inherit the main request's route".
Other cross-generation choices
- No
settingsNamespace(): the helper was removed in0.1.2, and importing it at runtime makes the whole module fail to link. It only validated and returned the branded string unchanged, so the code asserts the literal instead ('suggest-ghost' as SettingsNamespace). - No
deepFreezeimport:0.1.1exports it fromdsh-llm,0.1.2moved it into the newdsh-util-valuesand stopped re-exporting it — and that package does not exist on0.1.1, so switching the import source would only break the other generation.src/generate.tsships an equivalent implementation (iterative traversal, cycle-safe, skipsAbortSignal). - The client bundle takes no types from
@deepseek-ai/dsh-client-runtime: that package is0.1.1-only and was split out in0.1.2.lib/client.jswas measured to have zero kernel imports (onlyreact), so it is generation-independent; the minimalctx.remoteface is declared client-side (seeRemoteLikeinsrc/client/index.ts). source.kindis'user', not'plugin':0.1.7dropped thepluginkind and theschedulekind it added does not exist on0.1.5, so the two generations have no overlap. The field only builds a one-shot LLM request payload; it is not persisted or projected.
Known trade-offs
- Old settings do migrate: a value tweaked on the
0.1.5settings page was measured restoring as-is on0.2.0— the profile document holds non-default values today (historyMaxEntries: 77,historyCrossSession: true), and a restart reads that persisted value rather than the previous run's memory. - Two host→client cells, one write:
_pushcarries only{suggestion (+frame/final), suggestionSessionId, completion (+final), error}while_hotcarries only{hot, total, history, historySessionId}. Each cell has its own fingerprint, so a pure hotness change no longer rewrites the suggestion cell; when both are dirty they are merged into a singlesettings.update. Absent cell = keep current value, never clear (a new client on an old host still has no_hotand must not wipe the hotness list). - After a host upgrade, refresh the page (no host restart needed). The client bundle is served by
that same host (
lib/client.js), so version skew only affects tabs that were already open before the upgrade — and the two cells behave differently there (verified against the old code, not assumed): the hotness list goes empty (the old code maps an absenthottonull,src/client/index.ts:1840-1842at1c205d6), while the history ring merely stops updating (the old code treats an omittedhistoryas keep-current). Suggestions are unaffected — they still ride in_push. Neither means data loss: the authoritative store of the hotness table is thesuggest_ghost_hotnessdomain (src/hotness-store.ts:44-45) and_hotis only the snapshot handed to the client, so a refresh brings both back. - Hot-cell write-coalescing window (1000 ms): only hot-only changes are coalesced (rapid
typing, a burst of ops); the suggestion cell is always written immediately and is never
delayed by the window, and both
pullandcomplete(the op the client sends while composing) yield it — the window is abandoned exactly when someone is about to use the hot table. The post-restore re-push and plugin unload also bypass the window. User-visible cost: the hot table's ranking may lag by ≤1.5 s — the suggestion itself is unaffected. Measured on real session logs with the pure scoring function (120 sessions / 8134 judgements): the unconditional rate of "nothing offered this time" is ≈ 0.033 % (3 cases), while a snapshot lagging a whole turn costs 12.6 % — the visible cost of a staleness window depends on the ratio user input cadence ÷ staleness bound (measured here: median inter-input gap 341 s, only 0.29 % ≤ 1.5 s), not on the window size itself. Recompute withnode --experimental-strip-types scripts/hot-window-staleness.mjs/scripts/hot-window-timeline.mjs(deliberately not wired intotest:smoke). Under programmatic bursts (adjacent inputs ≤1.5 s) that 12.6 % becomes a real cost — see issue #63. - Do not treat "volatile fields are not persisted" as a guarantee: this plugin's
_ops/_pushare written into the profile document, and the clear-after-consume write is refused as a nested transaction, so a payload stays on disk and a fresh instance replays it at boot (measured in an isolated instance: one leftovercompletewas consumed before any client connected). See the cold-start section above and issue #22. - No polling on the client: what
0.1.7removed along withsettingsScopeis onlyscope.subscribe. The kernel has a separate Host→client event channel —ctx.remote.$on('settings/document-updated'), on dsh-api-remotes' forwarding allowlist (modeemit). The kernel's own settings page drivesSettingsDescribeMirroroff exactly that. This plugin subscribes the same way, sodescribe()is issued only when the host actually pushes_push, plus once at startup and once perconnection/reset.
How to reproduce: build an isolated profile for the kernel under test (point $DSH_HOME at a temp directory and hardlink its node_modules to that kernel tree with cp -al, so upward resolution cannot leak into the other generation), then check manifest composition with dsh --profile <p> --dump-config — on 0.2.0 this is the step that surfaces the peer-gate rejection — and watch plugin loading via dsh --profile <p> "say hi" and dsh --profile <p> -- --no-open --port <p>. Headless runs stop at MISSING_CREDENTIAL (the temp home has no credentials) — a point after plugins have loaded.
Development
src/index.ts host entry: turn/end(completed) → bounded suggestion generation
src/coldstart.ts cold-start semantics (pure): ring seeding from the log, turn-based staleness, _push read-back, suggestion tracking
src/generate.ts transcript extraction → sanitization → ctx.llm.stream → purification
src/transcript.ts pure transcript logic: char + UTF-8 byte dual-budget trimming (unit-testable)
src/sanitize.ts sanitize / purify / semantic filter / truncation (pure functions)
src/settings.ts settings namespace + host→client cells (_push = suggestion, _hot = hotness/history) + client→host ops channel (_ops, tail-write coalescing)
src/hotness.ts cross-session hotness table (incremental dedup, min-heap eviction, bounded memory, pin/manage APIs)
src/hotness-store.ts hotness persistence (storageDomain unit, turn-boundary coalesced writes, restore-on-restart, ops application)
src/projection.ts suggestGhost projection last-wins fold
src/client/ ghost rendering, history matching, word splitting, shortcuts, settings card
scripts/ smoke tests and session log replay
Read this before touching the settings channel
_ops / _push / _hot / _residual are every channel this plugin writes into settings
(_push and _hot are the two host→client cells the client reads; _residual is a
host-internal cell holding a suggestion whose session never checked in, #56 — the client
never reads it, so it stays out of the projection surface), and three separate bugs came
from that channel's semantics, not from business logic: mutate()'s third argument means "the
revision I read" rather than "the value I want to overwrite", so a refused write can look like a
successful one; a zod schema and a TS union are two separate truths, so adding an operation to only
one of them drops payloads in silence; and a single-slot last-wins snapshot cannot carry a payload
that exists for one moment, because the reader sees whatever was newest when it read. Three more that
bite repeatedly: a volatile reference captured by apply(ctx, config) freezes after the first config
write, settings/document-updated never reaches the plugin's own ctx, and any settings write issued
from inside that event callback is refused as HMR transactions cannot be nested (the AsyncLocalStorage
transaction survives await, so deferring by a tick does not escape it). A separate section there
explains why traces have to go to stdout: ctx.logger writes nowhere in a healthy process, so the only
runtime-visible channel is console.log tee'd into the host log, and this plugin tags those traces with
[dsh-suggest-ghost][ops-trace] to keep them distinguishable from debug noise.
Contribution flow on Gitea (the correct tea comment form and why the wrong one
fails silently, branch/PR rules, lib/ and main-checkout discipline) lives in
docs/gitea-workflow.md.
docs/internals-cordis-settings-pitfalls.md covers each as symptom, root cause, correct usage, wrong usage, with file:line and commit evidence. Every claim there is graded as fixed, awaiting a host restart, kernel contract, or plugin-local experience, and a pre-change checklist is at the end.
Which copy the host actually loads
The host loads the worktree that <profile>/node_modules/dsh-suggest-ghost resolves to, not the one
you are editing. On this machine:
~/.dsh/profiles/web/node_modules/dsh-suggest-ghost
-> ~/workspace/dsh-plugins/dsh-suggest-ghost
Two related facts decide whether a verification round counts:
lib/is committed to this repository. The host importslib/index.js(package.jsonmain) andlib/client.js(exports["./client"]).src/*.tsis only source: editsrc/, skip the build, restart the host, and it loads the previous bytecode.- Several git worktrees can exist at once (unavoidable when issues are fixed in parallel), and the symlink points at exactly one of them. Changes built in any other copy never reach the host.
Both checks are read-only:
node scripts/artifact-freshness.mjs # is lib/ older than src/ (2s tolerance); which copy is deployed
node scripts/gitignore-check.mjs # tracked files covered by an ignore rule; fatal exits non-zero
The second check guards a silent failure mode. lib/ has to stay tracked, so any rule that covers it
(build/, lib/, src/ in .gitignore, or a rule in ~/.config/git/ignore) makes newly created
files in that directory stay out of the index. The files are on disk, the build succeeds,
git status looks clean, and git checkout cannot restore them, because git never knew they existed.
One trap in the check itself: git check-ignore skips tracked paths unless you pass --no-index,
which is precisely the case worth catching.
Order of work, so a fix is not lost between editing and verifying:
- Change your worktree, run
pnpm run test:smoke, continue only when it is green. - Run
node build.mjsand commitsrc/andlib/together. - Run
node scripts/artifact-freshness.mjsto confirm the build is current and the deployed copy is the one you want the host to load. - Only then ask for a restart. Never verify uncommitted work: concurrent sessions and external tools write to this working tree without warning, and committed content is the only thing that comes back.
Applying host-side changes without a restart
After editing src/index.ts and running node build.mjs, the default configuration needs a host
restart. That is a profile setting, not a platform limit: @deepseek-ai/dsh-hmr reloads plugin
source, but this profile composes it as config: { root: [] }, and its README says an empty root
keeps "only explicit configuration watches", i.e. the profile's config files only.
A second reason is the one developers trip over: the default ignored is
["**/node_modules", "**/.*", "cache", "data"], and during development this plugin lives at
profiles/web/node_modules/dsh-suggest-ghost (a link: dependency). Even root: ["."] would
not watch it, because the ignore pattern excludes that path.
To watch it, append this to the profile's cordis.patch.yml (keep root narrow so Chokidar does
not walk all of node_modules):
- id: hmr
disabled: false
config:
root:
- node_modules/dsh-suggest-ghost/lib
ignored: []
debounce: 100
Validate the overlay without booting: dsh --profile web --patch <file> --dump-config, then check
that id: hmr carries those three keys and no other entry changed.
Once it is on, the log tells you whether a reload happened, so you never verify stale bytecode
again. Rather than doing this by hand, pnpm run sandbox (scripts/dev-sandbox.mjs) handles it: its own
DSH_HOME, its own copy of the plugin artifacts, automatic port avoidance, removal of leftover payloads
that would otherwise be replayed at boot, and it prints the greps worth watching. The script itself carries
no plugin-specific knowledge; that lives in this repo's package.json under sandbox (entry, rewrites,
disable, greps).
Every mount prints one line:
[dsh-suggest-ghost][ops-trace] apply called; artifact mtime=<mtime of the loaded lib/index.js>
touch lib/index.js, then look for that line again. A new mtime means the new build is in memory;
an unchanged mtime means the process is still running the previous bytes, so whatever the
verification shows is not about your change. Client-side work needs no host restart at all: the
browser module graph is loaded separately, so a page refresh is enough.
Limitation: reloads run inside the kernel's
runExclusivetransaction, so settings writes the plugin issues from an event callback are refused during reload as well (pitfall 1.5 indocs/internals-cordis-settings-pitfalls.md). A failed_opsclear right after a reload is expected; judge the reload by theapply calledmtime, not by that failure.
Cold-start semantics (why it works right after a restart)
"No data after a restart" is a misreading: history lives in the session log, and the host re-sends the suggestion after checking it semantically. The old design used time as the criterion (invalidate on restart, seed only when an event arrives), which left two gaps. It now uses semantics:
- The history ring is a cache of the session log: on a pull miss it is recomputed from the log (
ringFor), so there is no "seeding moment" and therefore no race where a pull arrives before the first event. Live sessions maintain it incrementally. - A suggestion is valid iff its turn is still the session's last completed turn (
suggestionIsCurrent). The host runs that check on every state assembly: still valid → restored as-is (your last suggestion is there when the page opens, no need to wait for a new turn); provably stale → cleared. - All three push paths (pull reply / turn end / hotness-restore re-push) share one state assembler
(
statePushOf), and the client pulls at the single point where a session binding succeeds.
Difference from 0.1.5: there
_pushlanded insettings.yaml, so the previous suggestion could be read back after a restart. On0.1.7+volatile fields are not persisted, so the last suggestion must be regenerated after a restart — it returns as soon as the next turn completes. History prefix completion and the hotness panel keep working throughout, since they read the session log and the storage domain rather than a volatile field. Do not confuse this with your settings values, which do live in the profile document and do migrate (see Known trade-offs).
pnpm run build # tsc compiles host + esbuild bundles client → lib/
pnpm run test:smoke # pure-function smoke tests (incl. hotness persistence and cold-start semantics)
pnpm run test:e2e # end-to-end over the real stacks: hotness persist→restore; cold-start reconciliation/pull
pnpm run replay # replay the completion pipeline with real session logs
pnpm run sandbox # boot an isolated second DSH instance (no restart; live artifacts untouched)
pnpm run sandbox:check # composition check only; sandbox:deploy <dir> installs a build only
Known limitations
- The cross-session hotness table is now persisted (host storage domain, lands in
~/.dsh/storages/suggest_ghost_hotness.json): frequencies survive restarts instead of accumulating from zero; on hosts without the storage domain (older versions) it automatically degrades to in-memory only - After a restart, history completion and the previous suggestion are available immediately (the criterion is semantic, not restart timing); a suggestion for a new turn still requires that turn to finish — that is inherent to "predict the next prompt", not a startup delay
- The management panel lists and filters the pushed top-K snapshot (50 entries by default; "N total" shows the full count); host-side search beyond the top-K is not implemented
- Delete only clears the current tally — typing the same text again re-counts; pin is the "never evicted" semantic
- LLM suggestions cover only the current session; to include text from other sessions as candidates, enable "cross-session search"
- Every completed turn triggers one suggestion model call (regardless of whether the input box has content); disable it in settings to save tokens if not needed
License
MIT © wujue. The security and generation pipelines are implemented with reference to dsh-suggest-prompt (MIT).
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 10696
Task board for the dsh web GUI: a sidebar multi-column kanban whose cards run in real DSH agent sessions and can also be scheduled with cron expressions, executed host-side even with the browser closed.
zhu1090093659/dsh-web#packages/dsh-web-all★ 10696
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 8484
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7509
A fixed-corner whale widget for the DSH web GUI — balance, today's usage and per-turn cost with peak/off-peak pricing, editable balance-alert and daily-budget bubbles, a module-based custom bubble queue with A/B weighted choices and random lines or images, 30+ vendor templates (OpenAI, OpenRouter, Kimi, SiliconFlow, Ark, Zhipu, MiniMax and more) with per-model balance and subscription quota, plus task-end sound, imported audio, custom roles and a resource manager. Local-only, no telemetry.
omdsh-dev/DSH-better-sidebar★ 5395
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
omdsh-dev/dsh-genui★ 1082
Interactive UI components rendered inline in replies: layout, charts, forms, quizzes, mermaid, 3D scenes, and an action event loop back to the model.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.