context-before-user
其他 活跃维护

context-before-user

n0pe-sled/context-before-user

在每条人类请求到达前,自动将注入的运行时上下文与技能上下文整理为用户角色轮次,确保模型始终基于完整背景作答。插件机制零侵入,保留原始信息顺序,提升多轮对话的连贯性与可控性。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
1
Open Issues
JavaScript
主要语言
None
开源协议
18 KB
仓库大小
2 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:n0pe-sled/context-before-user
git clone https://github.com/n0pe-sled/context-before-user.git
git clone git@github.com:n0pe-sled/context-before-user.git
README.md main

dsh-context-before-user

Host-only DeepSeek Harness plugin that keeps injected user-role context ahead
of the current human turn. At the public agent/pre-step waterfall it awaits
the normal DSH injectors, then stable-partitions the entering messages:

The resulting provider-visible order is:

system: assembled system prompt
...conversation history...
user: runtime-context snapshot
user: workspace instructions and skill catalog/instructions
user: current human request

The partition uses trusted provenance: messages with source.kind === "user"
stay in their original order at the end, and all other step messages stay in
their original order before them. Skill catalogs remain durable user-role
context turns. The system prompt is neither copied nor wrapped in a
<system-reminder>; it remains solely in request/header.system and the
provider's system slot.

The plugin uses agent/pre-step because loop-built llm/stream requests are
deep-frozen. Reordering here remains model-visible and logged, preserving exact
request reconstruction.

Existing durable history is never rewritten. The plugin fixes newly entering
step messages, so start a fresh session when validating the complete initial
transcript order.

Install

dsh plugin --profile web add ./context-before-user

Restart the profile after installation.

Verify

npm test

For an end-to-end check, export a harmless test session and confirm that the
runtime snapshot and skill catalog remain separate user-role messages before
the actual human request, and that the assembled system prompt appears only in
the request header/system slot.