dsh-prompt-balance
Manifest validMeasures what your assembled system prompt is actually made of - rules, identity, workspace policy, tool descriptions - in bytes and percentages, then moves the operating protocol ahead of the rule bl
dsh-prompt-balance
Measure what your system prompt is actually made of — then make sure the model reads the operating protocol before it reads the prohibitions.
Works on DeepSeek Harness (DSH). Two hooks, no build step, no dependencies.
The problem
Long-running agents accumulate rules: an AGENTS.md that grew to 65 KB, a workspace
policy, a template guide, a data-security annex. Nobody measures the result. In one real
case the breakdown was 65% rules / 10.7% identity — the model's first screen of text was
fourteen kilobytes of "don't", almost nothing about who it was working for or what good work
looked like.
Two consequences follow:
- You cannot argue about prompt quality without numbers. "My prompt feels bloated" is not actionable; "rules are 42,331 bytes of 64,902, and they sit first" is.
- Order matters. Instructions near the front of the assembly carry more weight than the same instructions buried after a wall of constraints.
What it does
| Hook | Effect |
|---|---|
system-prompt/assemble | Writes every section's byte size to ~/.dsh/prompt-balance.log, then prepends one short <operator-protocol> block before all rule sections. Idempotent: it will not stack a second gate. |
agent/pre-step | AGENTS.md arrives as an ordinary message, so context compression treats it as history and can summarize the specifics away. This hook prefixes a ~250-byte identity digest so the "who am I serving" frame survives the fold. |
Install
dsh plugin --profile desktop add dsh-prompt-balance
# or, to try a local checkout first:
dsh plugin --profile desktop add link:/absolute/path/to/dsh-prompt-balance
Restart the app. The plugin logs one line at install and one line per assembly, so you can verify it is live:
tail -f ~/.dsh/prompt-balance.log
Configure — this is the part that matters
Out of the box the identity block is a placeholder. The gate only earns its keep when it
names a real person doing real work. Create ~/.dsh/prompt-balance.json:
{
"identity": [
"I am the assistant to one person: a regional manager running a multi-city store network",
"Their output is analysis, slide decks, and operating ledgers.",
"",
"Their five recurring failures: claiming done without verifying, coarse self-review,",
"pasting parts without classifying them, skipping workflow steps, acting before review.",
"",
"So: concrete things first, structure second; every conclusion carries its source;",
"find the flaws yourself before shipping."
],
"gate": [
"You serve one person, not a ticket queue. Six checks before you answer:",
"1. Enumerate before you abstract...",
"2. Specific beats categorical..."
]
}
Both keys are optional and independent:
identity— a string array, joined with newlines. Used in the gate and in the pre-step digest.gate— a string array. First line is the framing sentence, the rest are the numbered checks.
Delete the file to return to defaults. Nothing else in the plugin is configurable, and it never writes to your config.
What you get in the log
[2026-10-30T07:12:44.118Z] installed: system-prompt/assemble hook active (gate prepend + composition log; config C:\Users\you\.dsh\prompt-balance.json)
[2026-10-30T07:12:51.902Z] assemble: sections=30 in=19805B out=20862B gate=1057B rules=12943B (65.4%) top=genui:fence:5068 dsh-taste-skill:2949 identity:2402
[2026-10-30T07:12:51.905Z] pre-step: instructions 14289B -> 14539B (changed=true)
in/out/gate are byte counts, so you can prove the cost of the gate itself. rules is
the sum of sections whose names match instruction|agents|workspace|memory|rule; if your
host names its sections differently, that number is meaningless — read the top= list instead.
Compatibility
- DSH kernel
0.2.1-rc.*and later. Verified against@deepseek-ai/dsh-system-promptlib/index.js:398— the waterfall passes(assembly, context, next), three parameters. A handler declared with four parameters throwsnext is not a functionand takes every tool call down with it; this plugin declares three. - Node 20+. No runtime dependencies.
- Nothing throws at import time: a failed loader entry makes the desktop app show its recovery dialog, so every step is wrapped and reported to the log instead.
Uninstall
dsh plugin --profile desktop remove dsh-prompt-balance
The log file stays at ~/.dsh/prompt-balance.log; delete it yourself if you want it gone.
License
MIT.
Comments
Loading…
Similar plugins
Turns a one-line DSH draft into a complete task brief (role / goal / constraints / output format). The engine is a byte-verified port of linshenkx/prompt-optimizer (three modes, 10 templates identical
★ 0
dsh plugin --profile web add @benrong/dsh-prompt-polishby laoer
A per-command sandbox allow-list for the bash tool: a rule names a CLI and the writable roots it gets, so allow-listed programs such as lark-cli and gh run inside the kernel sandbox with the workspace
★ 0
MIT
JavaScript
Oct 30, 2026
dsh plugin --profile web add dsh-whitelist-auto-approvalby AIMentalModel
Prompt manager for DSH: imports prompts from JSON or Markdown sources and DSH's own system sections, then controls what is injected into the system prompt — per prompt, or per agent preset — with titl
★ 0
JavaScript
Nov 1, 2026
dsh plugin --profile web add @local/prompt-managerby 1015677515
Captures the agent's own self-reported mistakes into a categorised lesson library that is re-injected into the system prompt every turn (each captured draft is confirmed or edited by the user before i
★ 5
MIT
JavaScript
Oct 20, 2026
dsh plugin --profile web add github:1015677515/dsh-prompt-ErrorNotes-deskStandalone prompt assembly with a source registry, custom text, strategy editing and previews, and per-session strategy snapshots through DSH public hooks.
★ 0
MIT
JavaScript
dsh plugin --profile web add dsh-prompt-assemblerby ZhenHuangLab
Policy-driven Git sync for DSH settings and profile configuration, with secret-aware projections, conflict review, and per-line apply controls.
★ 0
MIT
TypeScript
Aug 16, 2026
dsh plugin --profile web add dsh-sync