WASD258-jpg/dsh-context-surgery ↗★ 0
@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 분석
允许用户精准修改或删除已生成的 AI 回复及思考链,而不破坏工具调用。适合需要精细调优、纠正模型后续对话走向或进行提示词工程调试的进阶用户。
설치
검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 README 읽기 ↗
Usage
UI: per-message actions
- Open a running top-level session; hover an AI message's action row: ✏️ / 💡 / 🗑️.
- ✏️ opens a textarea prefilled with the reply; edit and click 保存 (Save) → "回复已改写 ✓" (reasoning and tool calls kept).
- 💡 edits the reasoning chain; leave empty and save to remove it → "思考链已改写 ✓".
- 🗑️ 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.
| Command | Effect |
|---|---|
/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
| part | text blocks | reasoning blocks | other blocks (tool-call …) | applies to |
|---|---|---|---|---|
reply (default) | replaced | kept | kept | user, assistant |
thinking | kept | replaced; empty text removes them all | kept | assistant only (user messages have no reasoning chain) |
all | one text block | dropped | dropped | user, assistant |
Tools
| Tool | Parameters | Notes |
|---|---|---|
context_list | limit? | surface rows in order (or last N): seq, role, text |
context_edit | seq, text, role?, part? | part defaults to reply |
context_delete | seq | shadowed by an empty assistant node |
context_replace | start, end, role, text | inclusive; 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": "…" }.