dsh-task-inbox
English | 中文
Overview
Turn DeepSeek Harness into a file-driven autonomous worker for another AI agent (Antigravity, Claude Code, Codex) or automation script.
An upstream orchestrator writes a task file into an inbox directory and waits with zero token cost. Broad codebase exploration, multi-file edits, and iterative test-fix loops all happen inside a Harness conversation, and only a concise summary comes back — your orchestrator's context window and token budget stay small no matter how much work the worker does. Every task runs in a real workspace session inside DSH, so you can watch it live, step in, or take over at any time.
Key Features
- Protect orchestrator context & budget. Execution is decoupled over plain files with zero-token waiting; heavy tool traffic stays in Harness while only the distilled summary returns.
- Observable & take-over ready. New sessions attach to the workspace matching the task's
cwd, making every worker turn visible and interactive in the DSH GUI instead of an opaque background job. - Ready-to-use cross-agent Skill. Ships with
skills/dsh-worker/(SKILL.md+ zero-dependency Node 22+ clientdsh-inbox.mjs) for Antigravity, Claude Code, Codex, and other skill-enabled agents. - Full asynchronous control plane. Supports cross-session concurrency with per-session FIFO queueing, read-only live progress sampling, timeout-free checkpointing, permission approval forwarding (so tasks do not stall waiting for a human at the DSH window), and cancellation with reason.
Table of Contents
- Key Features
- Installation
- Quick Start
- Upstream Agent Integration (Skill)
- Compatibility
- How It Works & Scheduling
- File Protocol
- Configuration & Archiving
- Known Limitations
- Development
Installation
Desktop (Recommended)
Open the plugin manager in DeepSeek Harness Desktop and paste this repository's GitHub URL:
https://github.com/CJYLZS/dsh-task-inbox
Restart the app after installing. The built lib/ artifacts are committed to the repository, so no local build step is required.
Web / CLI (Alternative)
If you manage a standalone Web / CLI profile:
dsh plugin --profile web add github:CJYLZS/dsh-task-inbox
Update to the latest commit on the default branch or remove the plugin:
dsh plugin --profile web update dsh-task-inbox
dsh plugin --profile web remove dsh-task-inbox
Restart Harness after installing or updating.
Quick Start
Get your first delegated task running in three steps:
1. Start watching an inbox
Run the slash command in any Harness conversation:
/inbox on # watch the default inbox directory
/inbox on D:\work\inbox # or watch an explicit absolute directory
/inbox status # show watched dir, running & queued tasks
/inbox off # stop watching (cancels running tasks)
Recommended for dedicated workers: enable
autoWatch: truein plugin settings (or setinboxDir/ exportDSH_INBOX_DIR). The watcher then starts automatically on every launch and resumes seamlessly across restarts.
2. Install the bundled Skill in your orchestrator
Copy or symlink skills/dsh-worker/ into your upstream agent's skills directory:
- Antigravity:
~/.gemini/config/skills/dsh-worker(or.agents/skills/dsh-workerin your project) - Claude Code:
~/.claude/skills/dsh-worker - Codex / other skill-enabled tools: your tool's skills folder
3. Probe liveness and dispatch a task
# 1) Verify the worker is watching
node skills/dsh-worker/scripts/dsh-inbox.mjs status
# 2) Dispatch a read-only investigation
node skills/dsh-worker/scripts/dsh-inbox.mjs dispatch \
--cwd "/abs/path/to/your-repo" \
--mode read-only \
--checkpoint 300 \
--body "Trace the auth token refresh flow and report key file paths and concurrency risks."
DSH opens a session under the matching workspace, runs the turn, and returns the concise summary along with session_id. Pass --session <session_id> on follow-up dispatches to keep the warm conversation context.
Upstream Agent Integration (Skill)
skills/dsh-worker/scripts/dsh-inbox.mjs is a zero-dependency Node 22+ CLI wrapping atomic writes, liveness probes, checkpoint polling, permission approvals, and cancellation:
# Check worker liveness, running/queued tasks, and query response bound
node skills/dsh-worker/scripts/dsh-inbox.mjs status
# Dispatch a task (--body / --body-file / stdin; --mode read-only|edit|full-access)
node skills/dsh-worker/scripts/dsh-inbox.mjs dispatch \
--cwd "/abs/path/to/repo" \
--mode edit \
--checkpoint 300 \
--body-file task.txt
# Wait on an already-dispatched task (after --no-wait or a checkpoint exit)
node skills/dsh-worker/scripts/dsh-inbox.mjs wait <task-id> --checkpoint 300
# Read-only status and live progress query for one task
node skills/dsh-worker/scripts/dsh-inbox.mjs task <task-id> [--limit 5] [--window-sec 0]
# Answer a forwarded permission request (--wait resumes waiting for the task result)
node skills/dsh-worker/scripts/dsh-inbox.mjs approve <approval-id> --wait
node skills/dsh-worker/scripts/dsh-inbox.mjs reject <approval-id> --wait --reason "out of scope"
# Cancel a queued or running task
node skills/dsh-worker/scripts/dsh-inbox.mjs cancel <task-id> --reason "plan changed"
Inbox directory resolution matches the plugin: --dir > $DSH_INBOX_DIR > $DSH_HOME/inbox > ~/.dsh/inbox.
Exit Codes
| Code | dispatch / wait / approve --wait / reject --wait |
approve / reject (no --wait) |
cancel |
|---|---|---|---|
0 |
Task finished (done) |
Decision accepted | Cancel acknowledged |
1 |
Task failed (error, e.g. session-busy) |
Decision refused or expired | Cancel refused |
2 |
Worker not watching or CLI usage error | Worker not watching or CLI error | Worker not watching or CLI error |
3 |
Checkpoint reached (task still running; live progress printed) |
Receipt timed out | Ack timed out |
4 |
Approval required (paused on permission; details + progress printed) |
— | — |
Compatibility
- DeepSeek Harness:
>= 0.2.2-rc.1(developed and verified against0.2.2-rc.5). - Node.js:
>= 22.19(also required by the bundleddsh-inbox.mjsscript). - Coexistence: Registers only
/inboxand one directory watcher. It takes over no official service rows and adds no model tools, so it works cleanly alongside plugins such asdsh-remote-development.
How It Works & Scheduling
Upstream agent inbox/ This plugin
| | |
|-- 1. write task-<id>.tmp.md | |
|-- 2. rename -> task-<id>.md -------> | -- 3. atomic claim (.running)|
| | |-- 4. run turn
| [optional] query/cancel/approval | <======= live control =====> |
|-- 5. wait (0 tokens) | <-- 6. result-<id>.md -------|
|<-- 7. read concise summary | |
- Concurrent across sessions, FIFO within a session. Tasks without
session_ideach get their own ephemeral lane and run concurrently; tasks targeting the samesession_idqueue FIFO in that session's lane. - Immediate reject on external busy sessions. If a targeted
session_idis currently busy outside the inbox (e.g. an active GUI turn), the plugin immediately publishes anerror(session-busy) result rather than interleaving prompts. - Workspace attachment. New sessions attach to the workspace for
cwd(creating it if needed) so every worker session appears grouped and controllable in the GUI. modedrives both prompt and sandbox.read-only→read-only,edit→workspace-write(confined tocwd),full-access→danger-full-access(unrestricted machine writes; use only with explicit user approval).- No hard task timeout. The plugin never kills a healthy long turn on a timer. The client's
--checkpoint(default300s) simply queries progress and exits3, leaving the continue-vs-cancel decision to the orchestrator. - Approval forwarding. When an inbox-dispatched turn hits a permission check, the plugin intercepts
approval/requestonly for that task's session and forwards it to the upstream viaapproval-<id>.md. Other GUI sessions continue prompting normally. - Scan order & durability. Each scan processes
cancel → approval decision → query → task, so control traffic never waits behind long turns. Claims use atomic cross-processrename, outputs publish via.tmp+ rename, and.runningleftovers after a crash/restart settle aserrorinstead of silently re-running an edit task on a half-modified tree.
File Protocol
All upstream writes must be atomic: write <prefix>-<id>.tmp.md first, then rename to <prefix>-<id>.md (any filename containing .tmp. is ignored).
IDs must start with an ASCII letter or digit, contain no path separators or whitespace, and never end with .tmp or .running. cancel_id must not start with ack-; approval_id reserves the decision- and ack- prefixes.
1. Tasks: task-<id>.md → result-<id>.md
Task file (upstream writes):
---
task_id: "20261201-152001"
cwd: "d:/code/my-project"
session_id: ""
mode: "edit"
---
Find and fix the concurrent token refresh bug under src/auth/, then run the auth tests.
Report only: root cause, changed files, test results.
| Field | Required | Meaning |
|---|---|---|
task_id |
No | If present, must match the filename. |
cwd |
Yes | Absolute working directory and sandbox boundary for read-only / edit. |
session_id |
No | Empty opens a new session; non-empty continues that session. |
mode |
No | read-only (default), edit, or full-access. |
Result file (plugin writes):
---
task_id: "20261201-152001"
status: "done"
session_id: "session-3f2a91c4"
cwd: "d:/code/my-project"
duration_sec: 42
---
Root cause: both callers cleared the in-flight promise before it settled.
Edited `src/auth/refresh.ts`. `npm test auth` 12/12 passing.
status is done or error; error results include an error field explaining why.
2. Queries: query-<id>.md → answer-<id>.md
Answered directly from the plugin's in-memory state — no model call, no queueing behind active turns — within worst_case_ms (default ~1150 ms).
| Field | Required | Meaning |
|---|---|---|
query_id |
No | If present, must match the filename. |
kind |
Yes | status (inbox overview) or task (single task state). |
target |
For task |
Task ID to inspect. |
progress_limit |
No | Max progress samples when running (default 5, clamped to 20). |
progress_window_sec |
No | Limit samples to the last N seconds (0 or omitted = whole turn). |
Answer bodies are always a single JSON object:
kind: "status"reports watched directory, earliest activerunningtask (plusrunning_idswhen multiple tasks run concurrently), aggregatedqueuedIDs, andlast.kind: "task"reportsstate(unknown/queued/running/finished).- When
finished, includes the result fields and body. - When
running, includesprogress:session_id,elapsed_sec,last_activity_sec_ago,tool_calls,last_tool,window_sec,omitted_entries, andrecent(assistant text only, capped at 300 chars/entry; no reasoning or tool payloads). While paused on a permission prompt,progressalso includespending_approval: { approval_id, tool_name, reason }.
- When
Malformed queries still receive an answer (ok: "false" + error). Silence past worst_case_ms means the plugin is not loaded or not watching that directory.
3. Permission Approvals: approval-<id>.md → approval-decision-<id>.md → approval-ack-<id>.md
When forwardApprovals: true (default) and a worker turn hits a permission check:
- Plugin writes
approval-<id>.md(<id>is<task_id>-<6-hex>): frontmatter carriesapproval_id,task_id,session_id,tool_name(and optionalcall_id,reason); JSON body carriesdisplay_reason,tool_arguments(capped at 2000 chars), and aprogresssnapshot. - Upstream writes
approval-decision-<id>.md: frontmatter requiresdecision: "allow" | "reject"and accepts optionalapproval_id,task_id,reason. - Plugin writes
approval-ack-<id>.md: reportsokandoutcome(allowed/rejected/expired/unknown).allowgrants a single call (allowed-once);rejectdenies that call while letting the turn continue and adapt.
4. Cancellation: cancel-<id>.md → cancel-ack-<id>.md
Requires target and accepts optional cancel_id and reason. Answered in the same scan pass with outcome:
cancelled_queued: removed from its lane;result-<target>.mdis immediately written aserror/cancelled.cancelling_running: active turn aborted; result publishes via the normal path (error: "cancelled").already_finished: existing result left untouched.unknown: task ID not found.
When reason is non-empty, Reason: <reason> is appended to the cancelled result body.
Configuration & Archiving
All options are optional and configurable via the DSH plugin settings page or cordis.patch.yml:
| Option | Default | When it takes effect | Description |
|---|---|---|---|
inboxDir |
"" |
On load or next /inbox on |
Explicit absolute inbox path; empty falls back to default resolution. |
autoWatch |
false |
On load only | Start watching the default inbox automatically when the plugin loads. |
archiveAfterHours |
0 |
Immediately | Move spent output files older than N hours into archive/YYYY-MM/ (0 disables). |
forwardApprovals |
true |
Immediately | Forward permission prompts for inbox sessions to upstream; false delegates to GUI. |
maxResultChars |
20000 |
Immediately | Maximum model output characters kept in result-*.md. |
maxProgressChars |
2000 |
Immediately | Total character budget for progress.recent; oldest entries drop first. |
sweepIntervalMs |
1000 |
On watcher start | Fallback directory scan interval in ms (min 50); fs.watch is the fast path. |
Archiving
Two independent options:
- Consumer-driven (recommended): pass
--archive(or setDSH_INBOX_ARCHIVE=1) todsh-inbox.mjsso each read result/answer/receipt is moved into<inboxDir>/archive/. - Age-based: set
archiveAfterHours > 0to move aged output files (result-*,answer-*,cancel-ack-*,approval-ack-*) intoarchive/YYYY-MM/. Pending requests (task-*,query-*,cancel-*,approval-*,approval-decision-*),.runningclaims, and.tmpfiles are never moved.
Note: once a result file is archived,
taskqueries for that ID answerunknown.
Known Limitations
full-accesshas no directory boundary. It setsdanger-full-access; use only when the user explicitly authorizes machine-wide writes.- IDs must be unique per request. Reusing an already-settled
task_id,query_id,cancel_id, orapproval_idwill not re-run the request. - Approval boundaries.
allowapplies once per call;rejectdoes not abort the turn; the plugin retains the most recent 200 settled approval IDs in memory to distinguishexpiredfromunknown; restarting or stopping the watcher withdraws pendingapproval-*.mdfiles. - Progress is in-memory only. Visible only while a task is
running; cleared on restart. - Stopped watcher does not answer. Requests written while
/inbox offwait until/inbox on. - Creating or resuming cold sessions requires
sessionController. Provided by Web / Desktop bundles; stripped profiles without it returnerroron new/cold sessions. - No dedicated status panel UI yet. Options are editable in the DSH plugin settings page; live status is inspected via
/inbox statusordsh-inbox.mjs status.
Development
pnpm install
pnpm run typecheck
pnpm test # Node 24 native type stripping (node --test); no tsx, no enums or parameter properties
pnpm run build # emits lib/, which is committed to the repository
Licensed under MIT. This repository is authorized for listing and display on DSH Plugin (https://dsh-plugin.org/).
No comments yet. Be the first to write one.