nuwa-skill
alchaincyf
你想蒸馏的下一个员工,何必是同事。蒸馏任何人的思维方式——心智模型、决策启发式、表达DNA。Distill how anyone thinks.
NoneadChina/dsh-nonead-prompt-recall
A DeepSeek Harness plugin that gives the composer shell-style **prompt history recall**. Current version: **0.6.1**. - Press **↑** in an empty composer to load the last prompt you sent; - press **↑** again to walk further back; - press **↓** to walk forward and finally return to the empty draft;
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:NoneadChina/dsh-nonead-prompt-recall
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English · 简体中文
Two composer features for DeepSeek Harness: shell-style prompt history recall and one-click prompt optimization.
Current version: 0.8.7.
History recall
Prompt optimization
@ references are kept (their content never reaches the model), attachments and images neither block nor take part;| Situation | ↑ | ↓ |
|---|---|---|
| Empty composer | load history #1 (newest) | not intercepted |
| Browsing history (unedited) | load an older prompt | load a newer prompt / return to the empty draft |
| Hand-typed or edited draft | not intercepted, normal caret movement | not intercepted |
| Empty history | not intercepted | not intercepted |
@reference targets are stripped); the next ↑/↓ compares against the effective text, so walking back keeps working after such a fill.The package is public on npm: dsh-nonead-prompt-recall.
dsh-nonead-prompt-recall
dsh plugin --profile <profile-name> add dsh-nonead-prompt-recall
desktop profile can also use this)In DSH Desktop open the Plugins page, choose Add plugin, and enter the repository path (the box accepts a local directory):
D:/MyProgram/GitHub/dsh-nonead-prompt-recall
The desktop profile is owned exclusively by the Electron app; direct CLI installs against it are rejected:
error: profile "desktop" is managed exclusively by the Electron application
A local-directory install is linked (junction), not copied: edits in the checkout take effect after a page refresh (client half) or a host restart (host half).
dsh plugin --profile <profile-name> add "file:D:/MyProgram/GitHub/dsh-nonead-prompt-recall"
Refresh the page (or restart DSH Desktop) afterwards so the browser bundle loads.
Installing this plugin must never send DSH into recovery mode. If the starter logs
web boot: N entry did not activate, a client slot was taken over by another plugin — see Compatibility for the slot this plugin uses and why.
History:
test prompt 1);test prompt 1 should appear;Optimization:
帮我把这段代码改成 async, then click the sparkle button — the icon spins in place, the draft stays visible, and after the rewrite the icon becomes an undo arrow;@reference plus some text and optimize — the reference chip stays in place, only the text is rewritten;The history file can be inspected directly:
<DSH_HOME>/plugin-data/dsh-nonead-prompt-recall/history/<workspace-key>.json
Open Settings → 提示词历史 (the row is localized; an English UI reads Prompt History). The row uses a history glyph instead of the generic gear and sits directly above the desktop-only 桌面设置 row. The page fills the settings column as one full-width column and scrolls as a single surface: header → status strip → capture settings → history → prompt optimization (the last card at the bottom):
If the first load fails, the page shows the real error and a Retry button instead of staying on "Loading…".
Export downloads a timestamped JSON file through the browser. Import opens a file picker, parses the JSON in the page (8MB / 20,000-entry limits) and shows the file name, entry count, source workspace and the first five prompts before you confirm the merge.
Since 0.8.0 a sparkle button sits in the composer tool row, immediately to the right of the model selector (DSH renders that slot's outlet there; the button is nudged into place with order, so it never competes with DSH's own voice-input control).
State machine
| State | Icon | Click does |
|---|---|---|
| ready (draft has text) | sparkle | send one auxiliary request and start optimizing |
| optimizing | spinning arc, turning in place | cancel — the draft is untouched |
| done (rewrite landed) | undo arrow | restore the original draft (references included) |
| idle (empty / command draft / over limit) | greyed sparkle | nothing; the tooltip says why |
What it does with your draft
@ references are masked as ⟦C1⟧-style sentinels before the call and re-inserted at their new positions only if the model kept every sentinel in order. Their content never reaches the model, and a damaged response is discarded rather than written.max(60, 1.35 × input) characters (never more than 1,200), and one in-flight request per session.Feedback
| Situation | What you see |
|---|---|
| Rewrite landed | icon becomes the undo arrow; a polite live region announces it |
| Model judged the draft already clear | toast "Already clear enough; nothing changed", draft untouched |
| Model returned nothing | toast "The model returned nothing", draft untouched |
| You edited the draft meanwhile | toast "Input changed; result discarded", your edit wins |
| Reference structure changed | toast "Reference structure changed; optimization cancelled" |
| No model / adapter in this session | toast "No model available in this session" |
| Failure, timeout, upstream error | toast "Optimization failed; original kept" |
| You cancelled it | silence — no toast, no write |
Settings
Settings → 提示词历史 → Prompt optimization turns the button off entirely (hidden, not just disabled) and shows the built-in system prompt read-only: version badge, character count and a copy button. The switch saves on click; no page-level Save is needed, and the composer picks up the change immediately. The prompt itself is maintained by the plugin and ships with the version — there is no editor, by design.
Privacy
The draft goes to the session's model and nowhere else. The plugin logs stable error codes only — never your prompt text — and optimization produces no transcript message and no history entry.
/prompt-recall manages capture settings and the stored history. Settings persist
in settings.json next to the history files. Prompt optimization is UI-only today: it has no subcommand, and its switch lives in the settings page.
| Subcommand | Effect |
|---|---|
status / help |
show capture state, caps, retention and the entry count of this workspace |
on / off |
toggle capture (existing history is kept) |
max <n> |
entries kept per workspace (1–5000) |
keep <days> |
drop entries older than N days (0 = forever) |
clear confirm |
delete this workspace's history |
export |
write a JSON export under plugin-data/<plugin>/exports/ |
import <file> |
merge an exported file back (exact duplicates skipped) |
reset |
restore the default settings |
<DSH_HOME>/plugin-data/dsh-nonead-prompt-recall/
├── history/<workspace-key>.json # newest-first entries
├── settings.json # capture toggle, caps, retention, optimization switch
└── exports/<workspace-key>-<ts>.json
workspace-key = the first 24 hex characters of the SHA-256 of the normalized workspace path;{ version, cwd, updatedAt, entries: [{ text, at, sessionId? }] } with newest entries first;*.corrupt-<timestamp> and capture restarts from an empty list;exports/ is only used by the /prompt-recall export command — the settings page downloads the payload in memory and never writes it;settings.json carries the optimization block next to the capture settings:
{
"enabled": true,
"maxEntries": 500,
"retentionDays": 0,
"optimize": { "enabled": true, "maxChars": 8000 }
}
session/event (user/message, source.kind=user)
│
▼
lib/index.js ── HistoryStore ── per-workspace JSON
│
│ connection.rpc.handle('/dsh-nonead-prompt-recall')
│ ├── history / settings.* / history.* (history + settings)
│ ├── optimize → lib/optimize-host.js → ctx.llm.stream(...)
│ └── optimize.prompt → built-in prompt + version
▼
lib/client.js (browser)
├── conversation.input.shell(id).setDraft(draft) (history recall + undo)
└── conversation.input.right slot → src/optimize-button.js → optimize RPC
▲
└─ document keydown (capture) on [data-composer-input]
session/event, persists human prompts per workspace, and exposes /dsh-nonead-prompt-recall over Connection RPC (the channel name must be an absolute path). Endpoints: history, ping, settings.get, settings.set, history.clear, history.export, history.importPayload, optimize, optimize.prompt; history.export returns an in-memory payload and never writes a host file.lib/optimize-host.js): validates the payload (setting, text length, sessionId, reserved for one in-flight request per session), resolves the route (the pair the browser sends, otherwise the session's latest logged request/context), streams one ctx.llm.stream call with a 20-second deadline, cleans and classifies the output, and verifies the reference sentinels before returning. Failures map to stable prompt-recall/optimize-* codes; the model's error text is never echoed back or logged.[data-composer-input] in the document capture phase and writes the draft through the harness's own composer facade (never by poking the DOM), so draft persistence, the send button and Lexical's undo stack stay consistent. The optimize button is a separate module (src/optimize-button.js) registered into the composer's list slot and owning its own state machine and toast.window.__ModuleLoader__.load({ id, factory }), the contract of DSH's client module loader; the bundle is a single shared scope, so module-level identifiers are namespaced.The plugin follows the desktop app's language: whatever language is selected in Settings → General → Language (persisted as locale.preference) drives the settings page, the composer button, the /prompt-recall command output and the Plugins-page title/description. All eight languages DSH ships are covered:
| id | language | files |
|---|---|---|
zh |
简体中文 | locale/zh.json |
en |
English | locale/en.json |
ja |
日本語 | locale/ja.json |
es |
Español | locale/es.json |
fr |
Français | locale/fr.json |
de |
Deutsch | locale/de.json |
ru |
Русский | locale/ru.json |
pt |
Português (Brasil) | locale/pt.json |
Display metadata on the Plugins page comes from locale/<id>.json (lowercase ids, matching DSH's client locales); the settings page registers its dictionaries through ctx.locale.register(ns, DICTS) (src/i18n.js), and the command surface translates from lib/i18n.js. The 24 optimization strings live in src/i18n-optimize.js (keys prefixed opt*) and are merged into the same registered dictionary, so the settings card and the composer button always speak the same language. Both halves require the zh and en baselines and fall back to en, then to the key itself, for a missing translation. normalizeLocale() maps host values such as zh-CN, pt-BR or en_US onto the eight ids and returns en for anything unknown.
Each metadata file uses the meta namespace:
{ "meta": { "title": "Prompt Recall", "description": "…" } }
The host resolves these files through the package exports map, so "./locale/*": "./locale/*" must stay exported. package.json's description is the plain-string fallback for surfaces without locale data (and for npm). Documentation ships in English (README.md) and Simplified Chinese (README.zh.md).
npm run build:client # src/*.js -> lib/client.js
npm test # node:test (uses --test-isolation=none inside the Windows sandbox)
npm run check # build + syntax check + the whole suite
node scripts/build-client.mjs --check # fail when lib/client.js is stale
src/core.js holds the pure navigation decisions and src/optimize.js the pure optimization helpers (empty/limit checks, ⟦Cn⟧ masking and unmasking, draft document assembly) — both unit-testable.src/client.js is the browser integration (keyboard bridge, settings page, slot registration); src/optimize-button.js is the composer button and its state machine; scripts/build-client.mjs only strips ESM syntax and concatenates protocol → i18n-optimize → i18n → core → optimize → settings → optimize-button → client for the ModuleLoader (no third-party dependency).lib/index.js, lib/history-store.js, lib/message-text.js, lib/optimize-host.js and lib/optimize-prompt.js are plain Node modules and can be tested with node --test.setDraft), host-RPC branch tests with a fake llm, sentinel masking/unmasking, the client's disable rules and outcome mapping, dictionary key-set checks, settings persistence, and a settings-nav icon test; the real-window checklist is in docs/E2E.md..github/workflows/ci.yml) runs npm run check plus the bundle-sync guard on Node 24.PLUGIN_VERSION is read from package.json: bump the version there and add a CHANGELOG.md entry when releasing.[data-composer-input], conversation.input.shell(id).setDraft(), the cwd / retainedBy.mainView fields of the sessions.list snapshot, session/event's user/message, the conversation.input.right list slot (registered through ctx.slots.inject + ctx.slots.register), ctx.get('llm').stream(...) with its terminal finish chunk, Session.requestContext() for the last logged route, and settings.get / settings.set over the plugin's RPC channel.conversation.input.activity is deliberately not used: DSH declares it as a single-occupant slot and already mounts its voice-input button there. Registering a second occupant evicts it and the whole starter fails with web boot: 1 entry did not activate, which drops DSH into recovery mode. Keep new controls in list slots such as conversation.input.right.lib/index.js, lib/optimize-host.js, src/client.js and src/optimize-button.js (the changes are concentrated there).CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: prompt-recall。