nuwa-skill
alchaincyf
你想蒸馏的下一个员工,何必是同事。蒸馏任何人的思维方式——心智模型、决策启发式、表达DNA。Distill how anyone thinks.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:juanweimao/dsh-long-session
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Formerly
dsh-cold-open. The cold-open mechanism is unchanged; the name now says what it fixes.
English | 简体中文
Long-lived DeepSeek Harness sessions grow without bound: every event stays in memory, so a 435k-event session costs 6.1 GB RSS and takes 134 s to open.
This project lets the desktop host open such a session from a checkpoint + a lazy zstd frame window instead of decoding and materializing the whole log:
| before | after | |
|---|---|---|
| resident memory | 6.1 GB | ~1 GB |
| open a session | 134 s | a few seconds |
| first message local prep (after seeding) | ~40 s | 1–2 s |
| second message onward | — | normal |
It does not switch sessions, fork them, or rewrite the log. The session id and its history stay exactly where they are.
Also in this repository:
heap/— the Windows patch that raises the desktop host's V8 heap ceiling from ~4 GB to 16 GB (an in-place, byte-for-byte edit of/lib/main.jsinsideapp.asar). Long sessions with a large search index need it; apply it with DSH fully closed, from an external tool.
⚠️ Prerequisite: the patch must be applied from outside DSH. Do not let the assistant running inside DSH execute it: if the session restarts mid-patch, it goes offline and cannot say "that step was wrong". Searching for this repo, reading the docs, and reviewing afterwards inside DSH are all fine.
Every DSH update wipes this setup. Updating or reinstalling the desktop app replaces
app.asarand the extracted runtime, so both the heap patch (heap/) and the runtime patches (patch/) must be re-applied afterwards. The scripts are idempotent and abort on anchor drift instead of half-patching.
Unofficial. Not affiliated with or endorsed by DeepSeek. The runtime patches depend on DSH internals and are version-specific. Modifying the client may violate the product's terms of service — use at your own risk, and back up
~/.dshfirst.
Three independent layers:
plugins/dsh-surface-checkpoint) — on turn/end, compaction/end, session/created and session/disposed it snapshots SurfaceManager._state plus derived values (title, request context, tool history, token meter state) and atomically writes ~/.dsh/surface-checkpoints/<id>.json (~240 KB).patch/apply-cold-open.cjs + patch/cold-open.js) — the decode step stops after the header frame and returns a lazy window over the log's zstd frames. Session construction is hydrated from the checkpoint with a private tail view; validation only covers events after the checkpoint cut. A dense frame index is built on first far random read and persisted as <id>.idx (2.7 MB).plugins/dsh-coldopen-status) — /coldopen in a session, and Settings → Cold Open lists every checkpoint/index/log with sizes and ages.Every validation failure falls back to the original full restore; a cold read that cannot be served throws instead of returning undefined. See docs/design.md for the full architecture and the 35-item pitfall list.
surfaceOp: "replace" boundary).resources/dsh-runtime (the usual desktop patch setup).Copy plugins/dsh-surface-checkpoint and plugins/dsh-coldopen-status into %USERPROFILE%\.dsh\plugins\, then link them into the desktop profile's node_modules (junctions on Windows):
mklink /J "%USERPROFILE%\.dsh\profiles\desktop\node_modules\dsh-surface-checkpoint" "%USERPROFILE%\.dsh\plugins\dsh-surface-checkpoint"
mklink /J "%USERPROFILE%\.dsh\profiles\desktop\node_modules\dsh-coldopen-status" "%USERPROFILE%\.dsh\plugins\dsh-coldopen-status"
Add them to %USERPROFILE%\.dsh\profiles\desktop\cordis.patch.yml:
- insert:
- id: surface-checkpoint
name: 'dsh-surface-checkpoint'
- id: coldopen-status
name: 'dsh-coldopen-status'
node patch\apply-cold-open.cjs "D:\DeepSeek Harness\resources\dsh-runtime"
The script copies cold-open.js into @deepseek-ai/dsh-session/lib/, patches 13 runtime files by anchors, runs node --check on each result, and aborts as a whole if an anchor drifted. It is idempotent.
echo 1 > "%USERPROFILE%\.dsh\cold-open.on"
Restart DSH. The first open is a seeding run: the first message is still slow once (the token meter replays the log), but turn/end writes derived into the checkpoint and the frame index lands on disk. Restart once more — from then on the first message is fast.
/coldopen%USERPROFILE%\.dsh\cold-open.log: attach ok, hydrate ok, index loadedDelete %USERPROFILE%\.dsh\cold-open.on and restart. The patches stay installed but inert; the desktop returns to the original full restore.
To remove completely: drop the two insert entries from cordis.patch.yml, remove the node_modules junctions, and delete patch/apply-cold-open.cjs from your reapply suite.
toolHistory is checkpointed without its headers table (67 MB in the example session); a developer/message in the tail that references a pre-checkpoint header may resolve fewer tool additions.attachCheckpoint rejects it and falls back to a full restore; the next turn/end re-seeds._state.nodes aliasing the checkpoint array: the fold mutated the checkpoint, so a second hydration in the same process re-applied the tail (411 = 232 + 179). Fixed by copying the array ([...checkpoint.nodes]).docs/design.md §8).session/created captures keep the previously loaded checkpoint (with its derived values) instead of rewriting it at a new cut. Without this, every restart dropped the token-meter state and the first message replayed the whole log — the old "open it twice" workaround.dsh-session-query-sqlite) observes every live session per search: it used to clone every event (~6 GB on the example session), hash a JSON string of all events, and rewrite all 187k FTS rows — ~45 s per search. Observations now extend by the appended events only (searching itself grows the log), a replacement (compaction) relabels only the shadowed rows, and the index appends only new rows. The live index is persistent (live_sessions/live_docs with an active flag), so the first search after a restart seeds from the stored rows instead of re-decoding the log. Results collapse duplicate and near-duplicate snippets (4-char shingles, Jaccard ≥ 0.8), cache rows for deleted sessions are pruned on the next search, and the search tools' own call/result events are kept out of the index so a search no longer matches its previous output.MIT for this repository. The patch script contains modified portions of DeepSeek's MIT-licensed @deepseek-ai/* packages; see THIRD-PARTY-NOTICES.md.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: memory。