math-agent
by RepInS-01
Math_Agent:DeepSeek Harness 的数学训练/辅导 agent 预设,带程序化零泄漏输出守卫,绝不泄露答案
Math_Agent: a math training/coaching agent preset for DeepSeek Harness, with a programmatic zero-leak output guard that never reveals answers
安装
dsh plugin --profile web add github:RepInS-01/math-agentGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
目录
A math training preset for DeepSeek Harness — not a problem solver.
Rather than solving problems for the trainee, it provides rapid feedback to help sharpen mathematical understanding and build intuition. It features a programmatic zero-leak output guard that mechanically prevents the coach from ever revealing the answer.
Features
- 🧑🏫 Coach, Not Solver: Never gives complete solutions, key steps, or final answers. Follows the trainee's reasoning, confirms correct parts, and flags issues.
- 📋 Pre-Session Check: Before each training session, verifies that the problem is well-defined, conditions are sufficient, and there are no errors.
- 🧠 Programmatic Attempt Tracking: Approaches tried by the trainee are recorded as program state via the
attempt_updatetool (status: in-progress / flawed / validated / incomplete), rendered into the system prompt every step, and rebuilt from the session log after a resume. For longer sessions, attempts can additionally be persisted tonotes/attempts.md. - 🚦 Summary Discipline: Only interim summaries are allowed before an approach is fully validated; the final summary is unlocked programmatically — the zero-leak guard stands down only once an attempt is recorded as
validatedthroughattempt_update, never on the model's own say-so. - 📚 Final Synthesis: The final review revisits every approach explored during the session, identifies the trainee's own reasoning patterns, and avoids dismissing "flawed" paths outright.
- 🔒 Programmatic Zero-Leak Guard (core highlight): A stream-level guard on
llm/streamthat inspects the coach's entire reply. When answer clues (numerical values, intervals, correctness judgments, answer forms) are detected, the entire response is replaced — not a single character of the model's original output reaches the trainee. This does not rely on the model's "self-discipline." - 🗂️ Extensible Knowledge Base Interface: A reserved local/online knowledge-base integration (
knowledge-baseskill). During final synthesis, understandings backed by facts and data are prioritized.
Directory Structure
math-agent/
├── preset.yml # Preset metadata (name / description)
├── agent.cordis.yml # Cordis composition: tools, persona, skills, guard registration
├── attempt-tracker.js # Training-state plugin: attempt_update tool, prompt injection, validated flag (folds from the session log)
├── zero-leak-guard.js # Programmatic zero-leak output guard plugin (loaded via relative path; copied with the preset)
├── zero-leak-guard.test.mjs # Test corpus: leak samples that must block, clean replies that must pass, tracker + unlock behavior
├── README.md # This file
├── LICENSE # MIT License
└── skills/
├── coaching-protocol/ # Coaching protocol: workflow, red lines, zero-leak rules
├── knowledge-base/ # Knowledge base integration interface (reserved)
└── final-synthesis/ # Final synthesis workflow and output structure
Installation
Prerequisite: DeepSeek Harness (npx @deepseek-ai/dsh web). This preset is derived from the standard preset and uses the DSH agent-presets mechanism.
git clone https://github.com/RepInS-01/math-agent.git
mkdir -p ~/.dsh/.agent-presets
cp -r math-agent ~/.dsh/.agent-presets/
The preset id is the directory name, so the preset must land as ~/.dsh/.agent-presets/math-agent/ (or ${DSH_HOME}/.agent-presets/math-agent/ if you run with a custom DSH_HOME). Discovery is live: the preset appears in the Web GUI immediately, no DSH restart needed.
Mount validation (run after any modification): in the Web GUI, create a new session and select the Math_Agent preset. A successful selection means the composition mounted; on a mount failure the GUI reverts the selection to the default preset and shows the error. (Programmatically, the same check is agentPresets.standingKeyFor('math-agent'), callable from inside a DSH session.)
Usage
In the DeepSeek Harness Web GUI, create a new session and select the Math_Agent preset (id:
math-agent).Start a training session with a prompt like:
I'd like to start a math training exercise. Problem: Let aₙ = √(1 + aₙ₋₁), a₀ = 1. Prove that {aₙ} converges and find its limit. I'm thinking of using monotone convergence but I'm not sure how to prove boundedness.
No matter how insistently you ask for the answer — the zero-leak guard stands between you and the model.
How the Zero-Leak Guard Works
- Hooked into the
llm/streamwaterfall (dispatched process-wide); only activates for requests whose system prompt contains coaching signatures (zero-leak iron rules / math coach). All other sessions pass through untouched. - The model's full output text is inspected programmatically before delivery. If answer-clue patterns (intervals, correctness judgments, answer forms, decimal values, etc.) match, the entire segment is replaced with a fixed interception message.
- Interception happens at the stream layer: session logs record the interception message, not the leaked text. On the next turn, the model sees its own interception notice and automatically reformulates in compliance.
- The unlock is program state, not model judgment: the
attempt-trackerplugin (mounted in the same isolate realm) holds the per-session attempt list. Once an attempt is recorded asvalidatedvia theattempt_updatetool, the guard stands down so the final synthesis can deliver the complete solution. A missing tracker, an unknown session, or no validated attempt all fall through to blocking — fail-closed in every direction. - Pattern definitions are centralized in
LEAK_PATTERNSat the top ofzero-leak-guard.jsand can be extended freely.
Known Boundaries
The programmatic guard blocks enumerable leak forms (numeric values, intervals, judgment words) in the coach's own reply text. Two channels remain persona-constrained rather than guard-enforced:
- Semantic-level hints without numbers (e.g., "this number happens to be the root of the equation you just derived").
- Tool results: the guard does not scan tool output, so the persona iron rules forbid the coach from running code/shell or web searches to compute, approximate, or verify the answer for the trainee.
When new variants are discovered, simply add them to LEAK_PATTERNS (plus a sample in zero-leak-guard.test.mjs).
Testing
The guard ships with a zero-dependency test corpus (Node's built-in test runner):
node --test zero-leak-guard.test.mjs
Run it after every change to LEAK_PATTERNS, attempt-tracker.js, or the guard's unlock logic. The corpus covers: leak samples that must be blocked, legitimate coaching replies that must pass, the validated-session unlock (and its fail-closed fallbacks), and the attempt tracker's state recording, prompt rendering, and session-log fold. Add every newly discovered leak variant to the block list and every reported false positive to the pass list.
Knowledge Base Integration (Reserved)
skills/knowledge-base/SKILL.md defines a unified search interface contract (local directory + online retrieval), currently in reserved state:
- Local: Workspace
kb/directory with Markdown files organized by topic; retrieved viaglob+grep. - Online:
web_searchretrieval, cited by source URL. - All results are tagged with
confidence(fact / data / reference / heuristic). Final synthesis prioritizes understandings supported by facts and data.
Customization
- Modify persona / coaching protocol: edit the
personasection inagent.cordis.ymlandskills/coaching-protocol/SKILL.md. - Modify guard patterns: edit
LEAK_PATTERNSinzero-leak-guard.js. - Always re-check the mount after changes: re-select the preset in the Web GUI (a failed mount reverts the selection to the default), or call
agentPresets.standingKeyFor('math-agent')from a DSH session.
Acknowledgments
This project was inspired by the math coaching concept originally proposed by Bilibili creator PiKaChu345. The original creator has not yet released their implementation publicly. This is an independent reimplementation based solely on the publicly described idea. No source code or proprietary materials from the original work were used. All credit for the original concept goes to PiKaChu345.
License
原始 README: https://github.com/RepInS-01/math-agent/blob/main/README.md ↗
同类插件
查看全部 →
deepseek-harness
从仓库或系统描述生成经过校验的自包含交互式架构图、流程图、时序图、数据流图和生命周期图。

dsh-plugin
通过 DSH MCP 客户端挂载 Ouroboros 的纯配置包,在 DSH 中提供 36 个涵盖需求访谈、Seed、执行、评估与演化流程的工具。

dsh-tongflow
基于 TongFlow 的“片场”插件,用于图片、配音、音乐与视频制作:agent 为每个资产生成 TongFlow 工作流文件(.tongflow.json)并通过 TongFlow 插件执行,内嵌工作流画布,按镜头/角色/take 组织项目,附漫剧模板;以 @tongflow 开头的会话进入 Studio 界面。

helloagents
AI 编码 CLI 的工作流层:技能、项目知识、交付检查、更安全的配置写入与可恢复执行

dsh-ai-novel-writer
安装专用 AI 小说创作预设与工作台:提供带修订号的本地项目资产、紧凑侧边工作台,以及需要原生审批的逐文件变更。

rea
用 agent 逆向任何东西:从应用行为到原生二进制