Preface¶
DeepSeek Harness (DSH) compresses context by default only when a model’s window is 80% full. Compression summaries are an after-the-fact remedy: details are lost, and after two or three rounds of compression the model starts confusing identities—re-reading the same file, re-deriving decisions it already made.
The Construction Bench takes a different approach: it rotates the baton at the slice boundary. Each slice is a small, independently verifiable unit of work. When a slice is finished, the plugin measures the real context pressure once and decides whether to “continue” or “hand off.” At handoff, it writes a handoff note for the next slice to read—replacing the compression summary. The new session starts from that note, with a clean context.
The author ran a zero-model-call offline statistical pass over 169 historical sessions. The inflection points in tool behavior are roughly:
| Prompt size | Observation |
|---|---|
| After 200k tokens | File re-reading rate jumps noticeably |
| After 300k tokens | Edit failure rate doubles |
| After 400k tokens | Tool error rate rises |
So the default “Standard” tier places the handoff threshold at 250k tokens, sitting right at the first inflection point.
What It Is¶
dsh-construction is a workflow plugin for DSH, maintained by KirinMiao. Its core value proposition: it splits one long work order into a series of slices, one session per slice. After each slice is completed, it automatically measures context and, if the threshold is exceeded, writes a handoff note and opens a new session to continue. If the threshold is not exceeded, it keeps going in the same session. A sidebar panel manages all construction orders, per-slice progress, handoff history, and real-time telemetry.
Core Concepts¶
| Concept | Meaning |
|---|---|
| Construction Order | A work order: objective, acceptance criteria, constraints, and a slicing plan. Body limit: 200k characters. |
| Slice | A unit of work that can be independently accepted. A single construction order has at most 60 slices. |
| Slice Handoff | The builder calls construction complete_slice to report “this slice is done,” attaching changed files and verification evidence. |
| Handoff Note | A document written at handoff for the next slice to read: what the previous slice did, decisions and trade-offs, outstanding issues and landmines, and the next slice’s goal. |
| Gate Slice | A slice that makes no code changes and waits for a human or external review sign-off (kind: "gate"). |
| Modes | Standard construction, Crawl mode, and Relay mode, all sharing one panel. |
Core Features¶
- Per-slice construction: The plugin opens a new session; the builder works through slices one by one according to the plan. Each slice is accepted independently.
- Context measurement: Reads the current session’s prompt tokens, window utilization, and compression count, then applies one of three preset tiers to decide whether to hand off.
- Handoff: Executed as a background task with an idempotency key, failure backoff, and resume-after-restart. The handoff note is injected into the new session’s prompt.
- Write lock on old sessions: After a slice handoff, write tools in the old session are hard-rejected via
tools.guardand cancelled after 1.2 seconds, preventing two sessions from modifying files simultaneously. - Slice-handoff evidence:
verifycommands must have actually been executed and succeeded on the last run. Withoutverify, git is used to confirm real changes. - Human-in-the-loop exits: Three non-completion outcomes—
waiting/blocked/failed—can be answered directly from the panel, with the answer routed back to the current session. - Gates: Manual sign-off or an independent review session. After sign-off, the next slice advances automatically; on rejection, a re-open entry is preserved.
- Mid-flight plan edits:
amendlets you add, remove, or modify slices that have not started yet. Slices already in progress are untouched. - Revision numbers: All panel actions carry a
revision. A stale page acting on outdated state is rejected and prompted to refresh. - Stall detection: Planning exceeding 30 minutes, a single slice exceeding 3 hours, or waiting on a report exceeding 1 hour—only flagged, never acted on automatically. Recovery requires your explicit click.
- Crawl mode: One-sentence goal → questions & overview → parallel work packages → staged review → delivery summary.
- Relay mode: A sequence of pre-written prompts fed into the same session in order, with support for pause, retry, and skip.
- Bilingual docs: The UI is bilingual (Chinese and English); plugin metadata provides descriptions in both languages.
Installation¶
Requirements: DSH Desktop or Web edition, with the Web UI plugin pack installed (this plugin ships a browser-side panel).
git clone https://github.com/KirinMiao/dsh-construction.git
Then in DSH, choose either:
- GUI: Settings → Plugins → Add Plugin → select the cloned directory.
- Let the agent do it: Ask the agent to use
plugin_manager’sinstall_bundle, passing the absolute path to the directory.
After installation, refresh the page. A “Construction Bench” icon appears in the sidebar. The plugin persists with the profile.
To update from source: git pull, then reinstall the plugin (replacing an installed package requires a DSH restart to load the new server-side modules).
Typical Usage¶
Quick Start (5 Minutes)¶
- Click the “Construction Bench” icon in the sidebar.
- Click “Send Construction Order,” paste the full task text; confirm the working directory, handoff threshold, and grill tier.
- Send and start. The plugin opens a new session in that workspace, auto-decomposes into slices, and begins the first slice.
- The builder calls
complete_sliceafter finishing each slice. You don’t need to watch—the plugin decides whether to continue or hand off. - When your input is needed, the left panel’s “Needs You” section shows this order. Click the card and answer the question directly in the panel.
- When everything is done, the builder writes a completion report and calls
finish; the report is readable in the center panel.
Auditable text artifacts are left in the working directory:
<working_directory>/construction/<order_id>/
├── construction_order.md
├── handoff_note-01.md
├── handoff_note-02.md
└── completion_report.md
How to Write a Slice Plan¶
The builder calls the plan action of the construction tool to submit the slicing plan. Each element in the array is one slice:
| Field | Required | Description |
|---|---|---|
title |
Yes | Slice name, one sentence. |
goal |
No | What this slice should achieve; optional for gate slices. |
acceptance |
No | How “done” is defined. Required for gate slices: the criteria to check at sign-off. |
est_tokens |
No | Rough token estimate for this slice, used for proactive handoff; write 0 if unsure. |
kind |
No | work (default) or gate. |
gate_mode |
No | Gate only: manual (wait for human sign-off, default) or session (open a new review session). |
prompt |
No | Pre-written prompt for this slice, up to 20k characters. Carried into the handoff note and kickoff prompt. |
key / phase |
No | Step number and phase label, for human readability. |
executor |
No | deepseek / external / senior / subagent. |
model |
No | { provider, model, reasoning_effort }. Defaults to the session’s model if omitted. |
fresh_session |
No | Force a clean new session before this slice starts. |
A single plan call can also include scope / out_of_scope (string arrays): the allowed-to-change scope and the do-not-touch scope. These are written into prompts and handoff notes as reminders, not command-level blacklists.
Example:
{
"action": "plan",
"summary": "Split the import feature into four slices",
"scope": ["src/import/**", "test/import/**"],
"out_of_scope": ["src/export/**"],
"slices": [
{ "title": "Parser skeleton", "goal": "Define AST and parser entry point", "acceptance": "Unit tests cover three data sources", "est_tokens": 40000 },
{ "title": "Database integration", "goal": "Persist to DB with transactions", "acceptance": "Duplicate imports do not produce duplicate rows", "est_tokens": 60000 },
{ "title": "Error handling & retry", "goal": "Failures are retryable, errors are readable", "acceptance": "Recovers after fault injection", "est_tokens": 50000 },
{ "title": "Manual acceptance", "kind": "gate", "gate_mode": "manual", "acceptance": "Real data runs clean, no anomalies in logs" }
]
}
Slice Handoff Rules¶
The builder calls complete_slice to hand off a slice. Common fields:
| Field | Description |
|---|---|
summary |
What was done and the outcome; minimum 30 characters. |
changed_files |
Files changed, relative to the workspace. |
verify |
Verification evidence; each entry is { command, result }. |
decisions |
Decisions made, rejected alternatives and why. |
pitfalls |
Landmines, paths tried but failed. |
note |
Caveats for the next slice. |
outcome |
done (default) / waiting / blocked / failed. |
question |
Required for waiting / blocked: the question that needs a human decision or input. |
report |
For gate slices: full review report. For finish: full completion report. |
expected_revision |
Optional: the revision you see; if it doesn’t match, the handoff is rejected. |
After receiving a handoff, the plugin evaluates in order:
Compressed >= C times -> hand off
Current tokens >= budget -> hand off
Current tokens + next slice estimate >= budget -> hand off (per-session check, no need to wait for 2x)
Next slice estimate exceeds 600k hard cap -> hand off
Otherwise -> continue in the same session
Handoff is not a single synchronous call: the plugin first persists a “handoff pending” record and marks the next slice as “queued.” A background pump then creates the session, writes the handoff note, and sends the prompt. Failures back off at 2s → 4s → … → 60s. After a plugin restart, it resumes from the state file.
Evidence verification rules:
- With
verify: every command must appear in the current session’s tool-call log and have succeeded on its last execution (fail-then-fix counts as pass). - Without
verify: at least one file inchanged_filesmust show changes ingit status/git diff. Untracked files also count. - Mismatches are rejected; the error message specifies whether the command wasn’t run, the result failed, or no files were changed.
Three Modes¶
Switchable within the same panel. Every new order defaults to Standard construction; the other two require manual selection.
Standard Construction¶
As described above: one construction order, sliced, built slice by slice, hand off when the threshold is exceeded. Suited for tasks on the order of a few hours that can be decomposed into several verifiable steps.
Crawl Mode (Experimental)¶
For very large tasks of 5+ hours. Provide a one-sentence goal; the plugin opens an overarching lead session to perform a readiness check and ask questions, then writes an overview. After your confirmation, it decomposes into multiple work packages, each with its own standard construction order and a lead session. After each package completes, an independent review session self-checks. Once all pass, a final review and delivery summary are produced.
Key points:
- Before starting, clarify only-what-you-can-decide items (goal trade-offs, acceptance criteria, boundaries). Up to 8 questions per round.
- The overview must carry a fingerprint of the original goal and a verbatim echo to prevent goal drift during long runs. If the goal file is modified, execution pauses.
- Each work package gets its own directory (default:
<workspace>/.construction/<run_id>/<package_id>/). Apreparecommand can be configured to create agit worktree. Merging is done by a human. - Write protection: the overarching lead and review sessions cannot write files; package leads can only write within their own package and the declared write scope.
- Budget & watchdog: three axes—tokens / call count / duration—unset by default. No progress triggers a warning, then a pause.
- Hard evidence check for reviews: self-checks and final reviews must cite actually-executed commands or files that truly exist.
Relay Mode¶
No slicing, no handoff notes: a sequence of pre-written prompts is fed into the same session in order. When one finishes normally, the next is sent automatically.
- Single prompt limit: 20k characters; max 50 prompts; total 200k characters.
- Pause means “finish this one, then stop.” Stop cancels the session and clears queued messages.
- If one prompt errors, the entire relay pauses. The panel offers three exits: retry / skip / open session.
Panel¶
The sidebar icon’s top-right corner shows a “needs you” badge: construction orders awaiting your decision, failed, waiting on a report, or awaiting sign-off, plus Crawl and Relay runs that need your attention. The badge only appears when the count is greater than 0.
- Left panel: A fixed “Needs You” section at the top; other healthy orders collapsed into one-line summaries. Each order shows phase, slice progress, handoff count; potentially stalled orders are flagged.
- Center panel: Statistics for the current construction order, a segmented progress bar, the full order text, per-slice cards (summary / changed files / verification evidence / handoff reason), handoff history timeline, and the completion report.
- Right panel: Real-time telemetry—current session, prompt and window usage, handoff threshold, pressure level, compression count, live event stream, tier switching, and grill cards.
The right panel is auto-hidden in narrow windows (< 1120px).
Thresholds & Configuration¶
Three preset tiers, switchable at any time from the panel; each construction order records its own setting:
| Tier | Prompt Budget | Window Utilization | Compression Count |
|---|---|---|---|
| Conservative | 150,000 | 35% | ≥ 1 |
| Standard (default) | 250,000 | 50% | ≥ 1 |
| Relaxed | 350,000 | 60% | ≥ 2 |
There is also a 600k-token hard cap per slice: during planning, oversized slices are rejected as a safety net for extreme cases.
Other options:
- Permissions: At order creation, choose “Full Access” (default) or “Workspace Write Only.” The latter uses the
workspace-writepreset; out-of-bounds operations go through approval. - Grill tier: If the grill plugin (
dsh-grill) is installed, you can select “Off / On / Enforced.” Without the plugin, this option has no effect. - Model: You can specify a
modelper slice during planning. If omitted, the session default is used.
Use Cases¶
Suited for large refactoring tasks spanning a few hours and dozens of tool calls that can be decomposed into several verifiable steps. Context compression is an after-the-fact remedy; the Construction Bench moves the “handoff” to the slice boundary.
Caveats¶
- The plugin runs with the permissions of the current DSH process.
- Review the source code and license (MIT) before installing.
- Depends on DSH services:
tools,systemPrompt,workingDirectory,webServer,sessionController,agentTeams. - Optional dependencies include
workspaceChanges,tools.guard,tokenMeter/sessions,permission-presets, and others.
Ecosystem Context¶
DSH’s philosophy is “everything is a plugin.” The community plugin directory is an independent site with no official affiliation to DeepSeek / High-Flyer. Do not describe it as an official app store.
In Short¶
dsh-construction solves the context-degradation problem in long-running tasks by rotating the baton at slice boundaries, ensuring each slice is independently verifiable and auditable. It is well suited for tasks on the order of a few hours that can be decomposed into several verifiable steps.
- Plugin directory: https://www.skillhub.cn/plugins/KirinMiao/dsh-construction
- GitHub: https://github.com/KirinMiao/dsh-construction