DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

CuberSome /

CuberSome/dsh-auto-archive-echo

Verified

dsh自动归档功能

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@84e12807

dsh-auto-archive-echo

Idle-based automatic session archiving for DeepSeek Harness. Three days without a touch and a session gets tucked away — never deleted, never interrupting a running turn.

中文说明 · Changelog · Configuration


Why

DeepSeek Harness only archives sessions manually: hover a session row in the sidebar, click archive, confirm. Twice is fine. Two hundred times is not.

Measured on a real machine: 1,325 sessions, 429.8 MB under ~/.dsh/sessions, of which 1,200 (91%) had seen no activity for over 72 hours. Nobody is going to click through those one by one.

dsh-auto-archive-echo does it on a schedule: scan stored sessions, archive the ones that have gone quiet long enough, leave everything else alone.

$ dsh-auto-archive-echo --idle-hours 72
session storage : C:\Users\me\.dsh\sessions
artifacts       : 1325 (429.8 MB on disk)
idle over 72h   : 1200 (91%)

oldest 6 idle sessions:

  idle(h)  size      workspace                   session
  -------  --------  --------------------------  --------
  930      34.1 KB   C-Users-me-Documents-d...   8686da47
  930      150.0 KB  C-Users-me-Documents-d...   5248205e
  930      469.3 KB  D-workspace-C               45b97372

What it does and does not do

✅ Archives idle sessions Through the official WorkspaceRegistry.archiveSession() — the same path the sidebar button uses
✅ Deletes nothing Session files, event logs and usage records stay exactly where they are; archiving only removes a session from the default view and blocks new model steps
✅ Never interrupts running work When the host reports a session as active, that session is skipped for the pass
✅ Leaves pinned sessions alone Pinned means "still in use"
✅ Leaves delegated sessions alone Sessions with origin: 'subagent' are skipped by default, so a multi-agent task is never split apart
✅ Lets you watch first dryRun: true logs what it would do and archives nothing
❌ Does not archive brand-new sessions minSessionAgeHours gives freshly created sessions a protection window
❌ Does not thrash the same session Archived sessions carry a cooldown, so reopening one does not get it archived again on the next pass

Install

From the plugin market

Search dsh-auto-archive-echo in the DSH plugin market, install, restart.

From npm

dsh plugin add dsh-auto-archive-echo              # default profile
dsh plugin --profile desktop add dsh-auto-archive-echo

From a local checkout

git clone <your-repo> dsh-auto-archive-echo
dsh plugin add link:"$PWD/dsh-auto-archive-echo"

The package ships its own cordis.patch.yml (declared through dsh.bundle.patch in package.json), so installing is enough — no manual edit of the profile patch file. Configuration and code changes take effect after restarting DSH.

Configuration

Two ways in, pick one.

Settings page (recommended)

The plugin ships its own configuration page. Two ways in, either works:

Settings → Auto Archive

Plugin market → Installed → the dsh-auto-archive-echo card → Configure

All twelve fields get a bilingual description, range validation and the right control for their type.

Four buttons sit at the top of the page:

Button What it does
Save Writes the staged edits as one batch. Edits stay local until you save, so a half-typed number never reaches the config
Undo Drops the staged edits and shows the values currently in effect
Scan now Runs one pass immediately instead of waiting for the interval — always a preview (dry-run forced on); the summary appears on the page and in the log
Archive now Runs one pass that really archives (dry-run forced off), behind a confirmation. For "keep preview on normally, clean up by hand occasionally"

Once a pass has actually archived something, one more button appears — Undo last archive (N). It puts every session from that pass back into the list and drops their cooldown entries; leaving the cooldown behind would mean a restored session cannot be archived again for 48 hours, which is only half an undo. It calls POST /auto-archive-echo/api/undo.

The allowed range of every number input comes from the schema the host hands down, not from a copy baked into the page. Out-of-range input is not rewritten while you type: the field turns red, states the range ("must not exceed 86400 (allowed 90–86400)"), and Save refuses to send it.

The twelve fields are grouped into Basics / Safety / Advanced: the ones you touch routinely (idle threshold, dry-run, master switch) first; the ones that prevent collateral damage (minimum age, cooldown, per-pass ceiling, exemptions, excluded directories) second; interval and startup delay last.

Every pass also lists which sessions it would touch — idle hours, working directory, and the first eight characters of the session id, oldest first, capped at 20 rows. A bare count leaves you unable to tell a correct threshold from a catastrophic one.

They are written to the same cordis.patch.yml shown below, so both routes always address one source of truth. Saving needs no restart — the next scan uses the new values.

The page reads and writes through the host's configForms client service, which performs validation from the schema the plugin declares. The plugin only draws widgets; it never keeps a second copy of the configuration. A manual scan goes through POST /auto-archive-echo/api/run, a fenced host route, because the browser side has no access to workspaceRegistry.

Hand-written config

Every key is optional. Override defaults in your profile's cordis.patch.yml:

- id: dsh-auto-archive-echo
  name: dsh-auto-archive-echo
  config:
    idleHours: 72
    dryRun: true
Key Default Meaning
enabled true Master switch. false loads the plugin without scheduling any scan.
idleHours 72 Hours of inactivity before a session is archived. Fractions allowed (0.5).
checkIntervalMinutes 30 Scan period in minutes.
startupDelaySeconds 90 Delay before the first pass, to stay out of the harness's own startup IO.
minSessionAgeHours 24 A session must be at least this old. Set it above idleHours to give new sessions a protection window.
rearchiveCooldownHours 48 After this plugin archives a session, it will not auto-archive-echo it again for this long. This is what stops a session you reopened from being archived right back.
skipPinned true Skip pinned sessions.
skipSubagentSessions true Skip delegated (origin: 'subagent') sessions.
dryRun false Log what would be archived without archiving. Worth one pass before enabling for real.
maxArchivesPerRun 100 Cap per pass, so the first run cannot archive a thousand sessions at once. 0 means no ceiling — only use it when you really do want the whole backlog gone in one pass.
excludeCwds [] Working-directory prefix denylist, matched segment-wise: D:/work never excludes D:/workshop.
logEachArchive false One log line per archived session instead of a single summary line.

A bad configuration is never silently ignored: unknown keys, wrong types and out-of-range values throw at plugin load time, naming the allowed keys and ranges.

How it works

Detecting idleness. A DSH SessionHeader carries createdAt but no updatedAt. The plugin enumerates every stored session with ctx.sessionPersistence.list() and reads the mtime of each session artifact (snapshot.location.path) — every appended event writes that file, so its mtime is the last activity time. Header creation time is the fallback when an artifact cannot be read.

Archiving. Through ctx.workspaceRegistry.archiveSession(id), without stopActivity. That means the host first asks workspace/session-activity whether anything is still running for the session; if so it throws WorkspaceActiveSessionError, which the plugin catches and counts as active. It never forces an archive with stopActivity: true.

After archiving. The archive is a registry-global set that affects visibility and admission only: an archived session hits ArchivedSessionGate and refuses new model steps. Its files stay on disk and it can be unarchived from the UI at any time.

State. The cooldown table lives at $DSH_HOME/storages/auto-archive-echo/state.json (default ~/.dsh/storages/auto-archive-echo/state.json) and is written atomically (temp file + rename). Losing it only loses the cooldown, never correctness.

Logging

Every line is prefixed with [auto-archive-echo] and goes to the host log file (for a desktop profile that is usually $DSH_HOME/logs/desktop-next.log). One pass produces one summary line:

[info] [auto-archive-echo] armed: idleHours=10, interval=30m, minAge=24h, cooldown=48h, DRY RUN
[info] [auto-archive-echo] manual scan requested from the settings page
[info] [auto-archive-echo] scan (manual): 1325 sessions, would archive 20/1200 | cfg idle>=10h, keep>=24h, every 30m, cooldown 48h, max 20, dry-run=on | skipped: alreadyArchived=42, notIdle=1032, tooYoung=31

Three parts of that line are what you debug with:

Part Question it answers
scan (manual) / scan (schedule) / scan (event) Who started this pass — the button, the timer, or ctx.emit('auto-archive-echo/run')
cfg idle>=10h, dry-run=on … The thresholds actually in force. Save on the settings page and this changes on the next pass — that is how you confirm a save landed
skipped: notIdle=1032 … Why each session was left alone, instead of a bare "skipped some"

Saving settings leaves a trace too — the plugin re-reads its configuration every pass and logs a line whenever the resolved signature moves:

[info] [auto-archive-echo] configuration changed: idle>=72h, keep>=24h, ... -> idle>=10h, keep>=24h, ...

The rest is graded by severity:

  • info — startup, config changes, scan summaries, manual requests, per-session archives when logEachArchive: true
  • warn — archive failures, listing timeouts, state that would not persist, cross-site requests fenced off, a manual pass that found the host services not ready
  • debug — short-lived "services not ready yet" skips, cooldown pruning counts, invalid requests (405/404)

Logging can never break a scan: if the host logger throws, the plugin swallows it and keeps going.

CLI preview

The package ships a read-only CLI so you can see what would happen before turning anything on:

dsh-auto-archive-echo                       # default 72h threshold
dsh-auto-archive-echo --idle-hours 24        # try another threshold
dsh-auto-archive-echo --top 20 --json        # machine readable
dsh-auto-archive-echo --dsh-home /path/.dsh  # explicit DSH home

It reads file metadata only — no session content is parsed and nothing is modified, moved or deleted. It cannot see pin state or the archive set, so the real plugin usually archives slightly fewer sessions than it reports.

FAQ

Is archiving the same as deleting? No. Every file stays; any archive can be undone from the UI.

Will it archive the session I am using right now? No. Active sessions are refused by the host, sessions idle for less than idleHours are never selected, and new sessions are protected by minSessionAgeHours.

I reopened an old session — will it be archived immediately? No. Archived sessions are protected by rearchiveCooldownHours (48 hours by default).

What is the safest way to enable it the first time? Run one pass with dryRun: true, check that the "would archive" ids look sane, then turn dryRun off. Keep maxArchivesPerRun at or below 100.

Where are the logs? In the host log, prefixed with [auto-archive-echo], one summary line per pass:

[auto-archive-echo] scan: 1325 sessions, archived 100/1200 | skipped: notIdle=125, pinned=3

How do I trigger a pass immediately? ctx.emit('auto-archive-echo/run') from another plugin or a console.

Compatibility

  • DSH >=0.2.0-rc.1 <0.4.0-0
  • Node >=20
  • Windows / macOS / Linux

The plugin is a plain cordis functional plugin (name + apply) that imports neither cordis nor any @deepseek-ai/* package; it only touches the services the host injects into ctx. That keeps a second runtime copy out of the process and keeps the plugin working across internal path changes.

Development

npm test        # 52 cases on node:test, no external dependency

Layout:

lib/config.js   defaults, key allowlist and validation
lib/scan.js     pure candidate-selection policy (unit-testable, no IO)
lib/state.js    cooldown persistence (atomic write)
lib/index.js    the cordis plugin: timer, scan, archive
lib/cli.js      read-only preview CLI

License

MIT

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout
—/ 5

No ratings yet

Verified DSH bundle

Commit 84e12807da9b

Community comments

No comments yet. Be the first to write one.