Introduction¶
When running models locally with DeepSeek Harness (DSH), models often tend to ignore context or repeatedly make known mistakes. The dsh-lessons plugin records these “dumb” moments, distills them into a checklist of lessons, and automatically injects them into the system prompt in subsequent conversations, thereby preventing the model from repeating the same errors.
What is it¶
This is a plugin designed for DeepSeek Harness (DSH). Its core logic is: Record mistakes → Distill into a checklist → Check before speaking next. The plugin is open-source and licensed under MIT.
Core Features¶
The plugin offers the following capabilities:
- Auto-Detection: Automatically identifies and records instances where the user expresses dissatisfaction with the AI (e.g., “You got it wrong again,” “No,” “Not answering the question”).
- Manual Entry: Directly inputs lessons via commands.
- Tool Error Logging: Optional feature to record scenarios where tool execution fails (disabled by default to reduce noise).
- Dynamic Injection: Registers real-time evaluated prompts via
systemPrompt.section(), taking effect immediately after recording without requiring a DSH restart. - Session-level Toggle: Each conversation can independently decide whether to enable lesson injection, or use commands within the conversation to turn it on/off.
- Visual Panel: The “AI Lessons” tab in the right sidebar of DSH, used for viewing, managing, adding, and previewing injected content.
Installation¶
Clone the repository and run the installation script:
git clone https://github.com/dusktin71-lang/dsh-lessons.git
cd dsh-lessons
node install.mjs
After installation, it is recommended to run the verification command to confirm the status:
node verify-install.mjs
Usage¶
Auto-Detection¶
When a user gives short negative feedback to the AI (under 120 characters and matching specific negative keywords), the plugin will automatically add it to the database. Falsely identified records can be deleted in the panel.
Manual Recording & Toggles¶
- Manual Entry: Input
记一下:<content>,记住:<content>, or/lesson <content>. - Enable/Disable Injection: Input
/lessons onor/lessons offin the conversation.
Panel Usage¶
DSH Right Sidebar → “AI Lessons”:
* Top Toggles: Controls the master switch, auto-detection, tool error logging, and whether it is active for the current conversation.
* Lesson List: Supports adding, disabling, or deleting entries individually.
* Injection Preview: View the actual text content the model will read.
* More Settings: Adjust limits such as max injection count, max characters per entry, default settings for new conversations, etc.
Configuration & Data¶
- Data Storage:
~/.dsh/ai-lessons/state.json. - Self-check Log:
~/.dsh/ai-lessons/boot.log(appends one line per startup, used to troubleshoot loading issues). - Browser-side Dependency: To display the right sidebar panel,
@deepseek-ai/dsh-client-ui-sidebar-rightmust be declared indsh.client.injectwithinpackage.json. If this declaration is missing, the plugin will not throw an error, but the panel will not appear.
Troubleshooting¶
If the “AI Lessons” tab does not appear in the right sidebar, please check the following:
- Dependency Check: Ensure
@deepseek-ai/dsh-client-ui-sidebar-rightis included in thedsh.client.injectarray. Missing this dependency causes the service to be absent, and callbacks will never execute. - Manual Expansion: Successful registration does not mean the panel expands automatically. You need to manually click to expand the right sidebar at the far right of the session title bar (mirror icon).
- View Logs: Check
~/.dsh/ai-lessons/boot.log, focusing on theeventfield in theclient-reportevents to confirm ifclient/applyandclient/tab-registeredappear.
Conclusion¶
dsh-lessons is suitable for developers who need to improve model performance in local environments through continuous feedback. It transforms scattered corrections into structured constraints, serving as a practical tool for building robust local agents.
Repository: https://github.com/dusktin71-lang/dsh-lessons