Introduction¶
DSH’s “Archive” is just a tag. After DSH writes to archivedSessionIds in storages/workspace.json, the official archived-session-gate guarantees that the session “will not run model steps before restoration,” but it does not guarantee that the session stops taking up disk space: session logs still remain in .dsh/sessions/<workspace>/<sessionid>/, and projection records still remain in .dsh/storages/session_projcache/sessions/<id>.json.
The issue lies in the projection records using a JSON backend. Official comments state that read/write share a unified memory state, meaning all records reside in memory. According to measurements in the README: 2395 records / 169.5 MB JSON, of which 126 archived records take up 40.8 MB (24.1%), accounting for only 5% of the count. The archived ones are mostly long sessions, which happen to be the batch that takes up the most space.
The Slumber Pavilion introduced below handles this: it truly moves the log directory and projection records of archived sessions out of .dsh and into ~/DSH-Archive, providing tools for reading, restoring, and deleting. Maintained by AngleNaris, categorized under Memory.
What is it¶
Slumber Pavilion is a DSH plugin that does three things: checks archivedSessionIds periodically to find newly archived sessions; moves its log directory and projection records to ~/DSH-Archive (not deletes them); and records the source and destination in manifest.json so it can be restored at any time.
It is configuration-free: it works immediately after installation and loading, with no separate user configuration interface or parameters required for the user to set. Moving files is a design behavior of the plugin, not an optional action.
Core Features¶
A first scan occurs after loading for approximately 15 seconds, followed by background checks every 20 seconds. The plugin only moves sessions that have been marked as archived by DSH and does not proactively archive normal sessions. The host using DSH_HOME reads the archive area from that directory.
Moving preserves the original files and the restore manifest. archive_delete is a separate permanent deletion operation, irreversible, and does not have a confirmation prompt on tool invocation.
Reading Archived Content¶
This is what distinguishes the plugin from “just moving the files”: it cuts the multi-frame zstd logs of archived sessions based on the frame magic number 28 B5 2F FD and decompresses them one by one. This is because DSH’s session.v4.jsonl.zstd is a multi-frame format that is appended while writing, and Node’s zstdDecompressSync only decompresses the first frame and stops. Measurement result in the README: 60.6 MB session, total 31,528 frames, 56,701 lines, zero failures, compression ratio approx ×3.8.
Agent Tools¶
The plugin registers five tools that can be called directly in a chat:
| Tool | Function |
|---|---|
archive_list |
List archived sessions, sorted by size descending |
archive_read |
Read an archived session, supports keyword filter, compact to keep only dialogue turns, maxChars to truncate per entry |
archive_session |
Perform archive: mark + move immediately, no need to wait for background scan |
archive_restore |
Restore archive: move back to .dsh, unmark, clear manifest |
archive_delete |
Permanently delete an archived session (logs + projection file + manifest entry) |
Single match is a hard constraint: if an ID or snippet fuzzy matches multiple items, execution is rejected and candidates are listed to avoid moving the wrong session. Archiving a session that is currently running is rejected by default (WorkspaceActiveSessionError); adding stopActivity=true will first request to stop its work before archiving. It rejects archiving the very session that is executing this tool.
archive_session uses the host’s ctx.workspaceRegistry.archiveSession(), so the archive state is written into workspace.json by DSH itself, not by modifying files; after the mark is persisted, the plugin immediately executes a round of sweep() and reports the final directory in the return value.
The order of archive_restore is “Move files → unarchiveSession() → Clear manifest”. It is rejected if a directory with the same name already exists at the target location; the manifest records the original from, so it prioritizes moving back to the original location, and falls back to .dsh/sessions/<workspace>/<session ID> if there is no record; projection records are moved back as well, and those that already exist at the target are not overwritten. If unmarking fails, files are still moved, and a clear warning is returned stating “it is still considered archived, please cancel the archive in the interface.”
Installation and Enablement¶
Install Slumber Pavilion from the DSH plugin store and have the host load it; no configuration filling or plugin parameter modification is required.
When integrating manually into a profile, install the npm package in that profile directory:
npm install slumberpavilion
Then wrap it in bundles in the profile’s package.json:
"dependencies": {
"slumberpavilion": "^0.1.1"
},
"dsh": {
"profile": {
"bundles": [
"...",
"slumberpavilion"
]
}
}
Restart DSH. When developing locally, you can use a file: dependency with a symbolic link to replace the npm installation:
ln -s ../plugins/slumberpavilion ~/.dsh/profiles/desktop/node_modules/slumberpavilion
Typical Usage¶
Archiving and moving happens automatically by default, requiring no extra enabling. After installation, there are usually two paths, both with the same effect.
Method 1 is the command line, independent of DSH, and is always available:
node lib/cli.js list 20
node lib/cli.js read f8ab825e 上下文压缩 50
node lib/cli.js info f8ab825e
Method 2 is calling tools directly in the chat. To archive a session, first run archive_session with dryRun=true to see the target, and after confirming no issues, remove dryRun to execute. To restore, do the same: run dryRun first to see the target directory. archive_delete is irreversible and has no secondary confirmation, so make sure to run dryRun=true before calling it.
For manual restore, each entry in manifest.json records from (original path) and to (archive path). Move to back to from, then cancel the archive in the interface and delete that entry from the manifest.
Compatibility¶
- The DSH host range declared in the README is
>=0.2.1-rc.2 <0.4.0-0; the only desktop tested version recorded is DSH 0.2.1-rc.3. The range declaration does not mean other versions have been fully tested. - Node.js requires
>=22.15.0, used to read zstd session logs; the desktop version relies on its built-in Node.js. - The plugin depends on the host’s
toolsandworkspaceRegistryservices, as well as the internal layout ofsessions,storages/workspace.json, andstorages/session_projcache/sessions. Compatibility needs to be re-verified if the host changes these interfaces or file layouts. package.jsondeclares the host range indsh.engines.dshand retains the same value in the top-levelengines.dshfor compatibility reading. Both are publishing metadata and do not require user configuration.- The
Configschema andcordis.patch.ymlparameters in the source code are for Cordis host assembly, internal implementation, and testing, and do not mean this plugin provides a user settings interface.
Known Boundaries¶
Scanning only handles “archived” sessions; the archive mark is written by DSH. After moving, archivedSessionIds in workspace.json will not be cleaned up and will point to a non-existent session; the README notes that testing shows this does not affect startup, and the list is rendered based on projection records, so if the records are gone, they will not be displayed.
If session logs have been re-folded by DSH into new projection records, the next scan will move them again. The criteria cover manifest.json in both the top level and batch directories; earlier versions only read the top-level one, so old batch entries will be treated as if they haven’t been moved and will spin in vain every round.
archive_session only recognizes sessions still in .dsh/sessions on disk; if only the archived copy remains, please use archive_list / archive_read.
Applicable Scenarios and Notes¶
Suitable for DSH profiles with a large number of sessions, a high proportion of long archived sessions, and therefore where session_projcache residing in memory is significantly tight. Keeping these sessions in .dsh brings no value; moving them away saves memory and allows reading them back when needed.
A few points need attention before use. The plugin runs with the permissions of the current DSH process. It installs and moves files and modifies the manifest by itself. archive_delete is irreversible and has no confirmation prompt, so you should check the source code and license (this project is MIT) before installing. Before executing archive, restore, or delete operations, use dryRun=true to check the target path.
Additionally, troubleshooting information is written to %TEMP%\slumber-pavilion-diag.log, recording one line for apply, one line for whether defineTool was retrieved, and whether each tool was registered successfully. After reloading the plugin after changing code, check this file first.
Ending¶
Slumber Pavilion turns “Archive” from a mere tag-change action into a real action that moves logs and projection records out of the load path; they can be read back, moved back, or completely deleted when needed. Project address: Plugin page https://www.skillhub.cn/plugins/AngleNaris/slumberpavilion , Source code https://github.com/AngleNaris/slumberpavilion .