sideroom-dsh
rmrdeveloper/sideroom-dsh
DeepSeek Harness 质量层:编码规范门禁、机械规则检查,以及编辑结束时的审查提示。
安装
dsh plugin --profile web add github:rmrdeveloper/sideroom-dshREADME
sideroom-dsh
Quality layer for DeepSeek Harness, ported from sideroom-pi.
The agent has to load the coding rules before it edits, the lines it adds are checked mechanically, and a turn cannot end silently after a mutation: it gets one review request that names the loaded guide and the project checks.
Published as @rmrdeveloper/sideroom-dsh.
Status
Host-side port. Working today:
| Piece | Behavior |
|---|---|
| Guidelines gate | write, edit, apply_patch, and str_replace_editor are denied until the contract and every target guide are loaded |
| Rule engine | blocking and note rules over added lines only, with a per-rule circuit breaker |
| Review | one request at turn end, after a successful mutation, carrying the checks status |
| Checks | detects the project command, confirms the exact command in its own directory, feeds the review |
| Skills | packaged sideroom skills plus an optional monorepo scan |
| Jev review | advisory notes from TypeSafe's classifier over changed code, plans, questionnaires and completed tasks; off without a key |
Not ported yet: the TUI board, the edited-files strip, sideroom_ask, the browser companion,
sideroom_research, and the active half of persona (sideroom_persona, the always-on reminder and the
prose and artifact enforcement). The persona guide itself is packaged and registered as a skill.
How it behaves
Guidelines gate
Before the first mutation of a turn, the agent calls sideroom_guidelines with a target path. The tool
returns the 20 canonical rules plus the compact idiomatic guide for that language (and any project-local
extensions in .dsh/sideroom/guidelines.md or .dsh/sideroom/languages/<guide>.md) and unlocks the
mutation tools for the turn. Only that tool counts: a full read of the packaged asset is not observed,
and a failed or partial load does not unlock anything. The loaded set resets when ttlTurns expires or
when the session compacts, clears, or resumes (force: true reloads the contract on demand).
apply_patch and str_replace_editor use the same gate and rules. A multi-file patch lists every target
whose guide is missing, and blocking violations are reported across every offending file in one rejection.
Unrecognized languages get the contract only. Set guidelines.gateUnrecognized: true to gate them too;
the rules still run only for known languages.
Rules
Only the added lines are inspected, computed with positional diffing so unchanged surrounding context is
not re-flagged. Three rules block; the rest are notes appended to the tool result (or attached as
additionalContexts in Programmatic Tool Calling and value-bearing tool results):
- Block: braced conditionals, explicit
any, swallowed errors. - Note: clear names, stale comments, commented-out code, debug artifacts, suppressed type errors
(
@ts-ignoreand@ts-nocheck;@ts-expect-erroris allowed).
Strings and comments are masked before the checks, so 'any', anyValue, and a comment that
mentions @ts-ignore do not count. A rule that blocks degradeAfter calls in a turn becomes a note until
resetAfter clean checks, so the agent cannot dead-lock on one rule.
apply_patch checks the lines its hunks add, per file. str_replace_editor checks create, str_replace,
and insert; view is not a mutation.
Review
After a successful mutation, turn end sends a steering message (up to review.maxPasses, or capped by
review.subagents for subagents): re-check every changed file against the loaded guide, address any
remaining mechanical notes, and run the relevant formatter, linter, type checks, and tests. When checks
observed a green run of the detected command after the latest mutation in that directory, the review
reuses it instead of asking for a rerun; when the latest run failed, the review names the failed check.
The review is skipped when the turn is aborted, and it is cleared when the next turn starts, so a mutation from an earlier turn never produces a late review.
Checks
The tracker detects the project command from package.json and the lockfile (check → test → lint →
typecheck → types), pytest -q from pyproject.toml, setup.py, or pytest.ini, go test ./... from
go.mod, cargo test from Cargo.toml, and make check from a Makefile.
A result turns green only when the shell command matches the detected command (or a direct equivalent such
as npm test/npm run test, bun test/bun run test, or pytest/uv run pytest/poetry run pytest),
ran in that directory (respecting shell workdir), completed cleanly in the foreground (exitCode === 0,
not timed out or backgrounded), and started after the latest mutation there. Extra arguments,
cd other && ..., newlines, and joined commands are not confirmed. A failed rerun marks the check failed,
a mutation invalidates green (and re-detects after package.json edits), and a new turn resets state.
Jev review
An optional pass from TypeSafe's classifier over the rules that no mechanical check can decide. It is off
by default, makes no request without a key, never blocks, and never enters the system prompt: notes ride
the end-of-turn review, the plan result, the questionnaire result or the todo result. The contract,
configuration, privacy and limits are in docs/jev.md.
The Web client adds a compact Jev chip below the composer. It reports the key state, captures a key
through a masked field into the profile's credential store, and shows the Host status on demand. The key
panel names the source, hides the write controls while the environment wins, confirms a removal and reports
the result; the status panel renders /jev status as labelled rows. /jev status prints the same report
from any client. The key never enters the session or the configuration file.
Install
Requires DeepSeek Harness 0.2.2-rc.1 or a later 0.2.x release. The manifest declares
engines.dsh as >=0.2.2-rc.1 <0.3.0-0, so the Harness refuses the bundle on a version it was not built
against instead of loading it half-broken.
From the app
Plugins → Add plugin, paste @rmrdeveloper/sideroom-dsh, then Install. Switch the bundle on if it
stays off (Enable now). The Plugin manager writes the profile dependency and the bundle selection for
you; with HMR the bundle loads without a restart.
From the CLI
For a profile the dsh CLI owns (web, headless, or a custom profile):
dsh plugin --profile web add @rmrdeveloper/sideroom-dsh
dsh plugin add forwards to pnpm in that profile. Select the bundle afterwards — from the Plugins page, or
by adding @rmrdeveloper/sideroom-dsh to dsh.profile.bundles in the profile's package.json — and
restart the profile when it does not use HMR. The desktop profile belongs to the Desktop app, so manage
that one from the app itself.
Configuration
The bundle patch ships these defaults:
- insert:
- id: sideroom
name: '@rmrdeveloper/sideroom-dsh'
config:
guidelines: { enabled: true, gateUnrecognized: false, ttlTurns: 1 }
rules:
enabled: true
blocking: [braced-conditionals, explicit-any, swallowed-errors]
notes:
- clear-names
- stale-comments
- commented-code
- debug-artifacts
- suppressed-type-errors
degradeAfter: 3
resetAfter: 5
review: { enabled: true, maxPasses: 2, skipWhenVerified: false, subagents: once }
prompt: { contract: true, explain: true }
checks: { enabled: true }
skills:
enabled: true
packaged: true
monorepo: true
maxDepth: 3
include: []
exclude: []
jev:
enabled: false
keyEnv: TYPESAFE_API_KEY
endpoint: https://api.typesafe.ai/v1/systemone
model: jev-latest
cutoff: 0.8
gate: 0.6
maxNotes: 3
timeoutMs: 3000
maxRelatedFiles: 4
scanForConsumers: false
reviewPlans: true
reviewWorkflows: true
calibrate: false
Every block is optional; the defaults above apply to missing keys. Unknown keys warn, and a wrong type fails the bundle at load instead of silently disabling a gate.
Development
npm install
npm run build
npm run lint
npm run lint:fix
npm test
npm run check
npm run mutation
npm run mutation builds and runs Stryker over the compiled lib/ with the TAP runner and per-test
coverage. The report lands in reports/ (ignored), and the 80% break threshold fails the run when the
mutation score drops below 80%.
All internal imports use the @/* alias (@/config.js), declared in tsconfig.json through baseUrl
and paths. tsc does not rewrite path mappings, so the build runs tsc-alias after tsc; the compiled
lib/ uses relative imports and the plugin keeps working on plain Node.
tsc compiles index.ts and src/ (except src/client/) into lib/, and the bundle loads
lib/index.js. Tests live next to the file they cover (src/checks/tracker.test.ts, index.test.ts)
and compile to lib/**/*.test.js, which is ignored and excluded from the package. lib/ is committed
so the plugin works from a clone without a build step; run npm run build before committing source
changes.
src/client/ is the browser half. main.ts exports the plugin, plugin.ts wires the store, the
locale dictionaries and the composer-dock slot, store.ts talks to the Host through the injected
Remote ports, model/ holds the pure view models (report.ts, key-view.ts, status-view.ts),
components/ renders with the harness UI primitives (Modal, Button, Input, Pill,
StateDot), and styles/jev.css keeps only token-based layout. npm run build:client bundles that
tree with esbuild into the single client.js artifact the client loader serves; react,
react/jsx-runtime and @deepseek-ai/dsh-client-ui-primitives stay external and resolve from the
browser platform table. tsconfig.client.json type-checks the tree, and src/client-module.test.ts
loads the built artifact through a stub module loader.
npm run lint runs ESLint with the type-aware rules, @stylistic formatting, and no-comments. The
Husky pre-commit hook chains lint-staged, npm run check, and npm run mutation with && on every
commit: staged .ts and .mjs files are fixed first, and the commit lands only when the type check, the
lint, the tests, the pack check, and the mutation run all pass.
npm run check runs the type check, the lint, the tests, check:skills (frontmatter,
routing metadata, links, examples, and host alignment for every packaged skill), and then
check:pack, which packs the tarball the way npm publish would, asserts the file list,
the patch row name, the locales, the icon and engines.dsh, and loads the entry point
from the extracted tarball.
Releasing
Changesets plus GitHub Actions; CI publishes through npm trusted publishing. The runbook — first manual
publish, npm trust, the npm environment, and what to check afterwards — is in
docs/publishing.md.
Attribution
MIT. Ported from sideroom-pi. Every skill except
sideroom-persona adapts one from Matt Pocock's skills
(MIT, Copyright (c) 2026 Matt Pocock).