- Startseite
- Plugins
- Sitzungen & Nachrichten
- dsh-clear-command
L
dsh-clear-command
liufeicc/dsh-clear-command
Adds a /clear command that clears one conversation's model-visible context while keeping the session itself.
Installation
dsh plugin --profile web add github:liufeicc/dsh-clear-commandREADME
English | 中文
dsh-clear-command
Local DSH bundle: a /clear command that empties one conversation's model
context while keeping the session itself.
What it adds
- One Host row that registers the global command
clear, so/clearappears in every composed command surface (Web composer slash menu, CLI) for every session.
Behaviour
/clearclears the conversation's model-visible history: the agent no longer sees any earlier message, and its next request starts from the system prompt plus one marker line.- The session is untouched: same session id, title, workspace membership, sidebar position, and a complete durable log. This is a clear, not a delete, and not a new session.
- The clear is one positional surface replacement written into the session log —
the mechanism
/compactuses — so it survives reloads and replays deterministically. - Because the Web transcript is derived from append-origin log events, the earlier messages remain readable on screen and in the log; only what the model sees is emptied.
/clearruns on the agent's idle phase (runMaintenance, the same reservation manual compaction uses): while a turn, a queued wake, or another maintenance task owns the agent, the command reports that and changes nothing.- The invocation is recorded in the session log as the ordinary
command/run/command/donepair, so the result appears as a command row in the transcript.
Notes and limits
- The leading
system/messagesurface node is preserved, because it is the agent's instructions; everything after it is shadowed. - The marker line is English (
[Earlier conversation cleared by the user; …]) because it enters the model's context, while the command's own user-facing copy is Simplified Chinese, matching the bundle's shipped UI language. - Nothing here touches archived sessions, other sessions, or their files.
Files
index.js— the whole plugin: command registration plus the surface replacement.cordis.patch.yml— inserts the single Host row.locale/{en,zh}.json— Plugin Manager display metadata.icon.svg— Plugin Manager artwork.test/clear-contract.mjs— offline contract test. It replays a real session log (zstdcata~/.dsh/sessions/**/session.v*.jsonl.zstd) into a detachedSession, applies exactly the range and appendindex.jsperforms, and prints the resulting surface and derived model messages:node test/clear-contract.mjs <log.jsonl.zstd>.
Development
The profile links this directory (link: in the profile's package.json).
Host code is loaded by the Loader, so a change needs the row to be reloaded
(profile restart), unlike the client half of dsh-split-workspaces, which
dsh-client-hmr reloads on edit.
License
This project is released under the MIT License — see LICENSE for the full text.
Ähnliche Plugins
Z
dsh-web-ui (dsh-chat-recovery)
zhu1090093659/dsh-web-ui
6.2kvor 2 MonatenSitzungen & NachrichtenApache-2.0
R
billion-context
ranxianglei/billion-context
5.1kvor 3 StundenSitzungen & Nachrichten
L
dsh-synapse
liangmianya/dsh-synapse
687vor 5 TagenSitzungen & NachrichtenMIT
M
dsh-archive-manager
michengai/dsh-archive-manager
316vor 4 TagenSitzungen & NachrichtenApache-2.0