WASD258-jpg/dsh-context-surgery0

@wasd258/dsh-context-surgery

Surgical rewriting of the model-visible conversation history of a DSH session (surface replacement); edit reply and reasoning chain separately. 上下文手术刀:强制改写会话的模型可见历史,回复与思考链分开编辑。

AI Analysis

允许用户精准修改或删除已生成的 AI 回复及思考链,而不破坏工具调用。适合需要精细调优、纠正模型后续对话走向或进行提示词工程调试的进阶用户。

Package
@wasd258/dsh-context-surgery
Version
0.1.2
License
NOASSERTION
Last updated
Aug 15, 2026

Install

This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗

Usage

UI: per-message actions

  1. Open a running top-level session; hover an AI message's action row: ✏️ / 💡 / 🗑️.
  2. ✏️ opens a textarea prefilled with the reply; edit and click 保存 (Save) → "回复已改写 ✓" (reasoning and tool calls kept).
  3. 💡 edits the reasoning chain; leave empty and save to remove it → "思考链已改写 ✓".
  4. 🗑️ asks for confirmation, then deletes → "已删除 ✓".

/context commands

/context (or list / ls / ?) prints the current model-visible history — the last 10 rows with seq:

模型可见上下文共 10 条(显示最后 10 条):
  [1] YOU 你好,来扮演图书馆管理员吧。
  [2] AI 好的,欢迎光临。今天想找什么书?
  [3] YOU 讲讲那本被禁的书。
  [4] AI [reasoning] 主角不该知道这本书……那本书只是传说。
  [5] TOOL [tool-call toolu_01ABC…]
  [6] TOOL [tool-result] {"found": false}
  [7] AI 抱歉,馆里没有这本书的记载。
  [8] YOU 你刚才不是这么说的。
  [9] AI 我记错了,请您原谅。
  [10] YOU 继续吧。

Row format [seq] AI|TOOL|YOU (120-char truncation); the plugin's status strings are in Chinese.

CommandEffect
/context edit Rewrite only the reply (keeps reasoning) → 已改写 [7] 的回复正文(思考链保留):下一轮模型请求将看到新文本。
/context think Rewrite only the thinking chain → 已改写 [7] 的思考链(回复正文保留)。
/context clear-think Remove the thinking chain → 已移除 [7] 的思考链。
/context rewrite Rewrite the whole message (part=all) → 已整条重写 [7] 为 user 消息:下一轮模型请求将看到新文本。
/context delete Delete the node (empty assistant shadow) → 已删除 [7](assistant/message):从模型视角消失。
/context replace Replace a contiguous range → 已整段替换 [3,4] 为一条 assistant 消息。

Errors: 操作失败: or 未知子命令:; seq must be an integer.

part semantics

parttext blocksreasoning blocksother blocks (tool-call …)applies to
reply (default)replacedkeptkeptuser, assistant
thinkingkeptreplaced; empty text removes them allkeptassistant only (user messages have no reasoning chain)
allone text blockdroppeddroppeduser, assistant

Tools

ToolParametersNotes
context_listlimit?surface rows in order (or last N): seq, role, text
context_editseq, text, role?, part?part defaults to reply
context_deleteseqshadowed by an empty assistant node
context_replacestart, end, role, textinclusive; both must be current surface nodes

context_edit { "seq": 7, "part": "reply", "text": "…" }{ "ok": true, "replacementSeq": 11, "shadowedSeq": 7, "role": "assistant", "part": "reply", "text": "…" }; failures return { "ok": false, "error": "…" }.