Preface¶
Sessions are independent, yet the same pitfalls keep resurfacing. Searching before debugging, and automatically surfacing confirmed entries when a tool errors out, turns the loop of “symptom → root cause → fix → how to verify” into a cross-session, searchable ledger. That’s exactly what the dsh-solution-ledger plugin for DeepSeek Harness (DSH) does.
What It Is¶
dsh-solution-ledger is a global problem-solving ledger: it records pitfalls you’ve stepped into and trade-offs you’ve made, searches before you debug, and automatically surfaces confirmed entries when a tool fails. It doesn’t rely on the model’s self-discipline to check—whenever a tool call fails, the plugin grabs the raw error text, matches it against the ledger, and if there’s a hit, appends a summary to the result so the model sees it within the same step.
Core Features¶
Two Tools¶
The plugin exposes two tools: solution_log and solution_search. Both have standard JSON Schema parameters (type: 'object' + properties + a string-array required), which DSH passes through to the provider as-is.
solution_log¶
Writes a new record. New entries default to draft (draft). Drafts do not participate in auto-push; only entries confirmed as confirmed are automatically surfaced.
It accepts only two kinds of things: issues with non-obvious root causes, and trade-offs where a viable alternative was genuinely rejected. Do not record—implementation notes, design decisions that rejected nothing, or information readily obtainable from code or documentation.
The criterion is three questions; if any answer is “no,” don’t record it:
- Will a future session encounter the same situation again?
- Can the answer be obtained by glancing at code or documentation?
- If not recorded, would that session genuinely waste time?
If a record will never appear in an error message and will never change anyone’s next decision, it’s a log entry, not a ledger entry.
A draft that is never hit by any search or push within 30 days is automatically archived (draftArchiveAfterDays). Even if you occasionally write in an implementation note, low-usage records will sink on their own—no manual cleanup needed. Archiving does not mean deletion: the entry remains in the file and can be “unarchived” from the UI to restore it.
Parameters (required/optional):
kind:troubleshoot(a fixed failure) ordecision(a chosen/rejected path)domain:environment/tooling/code/config/process/other— the first search dimensiontitle: a one-sentence conclusion, not a topic tagproblem: the symptom observed, or the dilemma facedresolution: the effective fix, or the final choicerejected: required for decisions—the rejected alternatives and reasonsverify: how to confirm the fix—what command to run, what to expectsignals: error codes, command names, file names, or other strings that can be matched verbatim by future raw error text; auto-matching depends on thistags: 2–6 lowercase reuse wordsscope:machine(local paths/permissions/installed tools) /project(single-repo conventions) /generalplatform: fill in only when the entry is strongly platform-specificstatus:draft(default) /confirmed/deprecatedreplaces: an existing entry id—in-place update instead of a new entrysupersedes: another existing entry id—this entry replaces it
Before writing, a near-duplicate probe is performed. If a highly similar entry exists, its id is listed in the result, prompting you to use replaces to merge.
replaces and supersedes are not the same thing:
replaces: the same record is corrected; old content is overwritten in place, no history kept.supersedes: the old entry remains in the ledger as history, its status is set todeprecated, and it stops participating in auto-push and search ranking; the panel shows a “supersedes / is superseded by” link.
The criterion: was the old content wrong or outdated? Wrong → use replaces (don’t accumulate garbage). Outdated → use supersedes (leave a trail). An entry cannot supersede itself, nor can it use both replaces and supersedes pointing to the same id on itself—such calls are rejected outright. A superseded entry is archived on the next write, following the same rules as archiveAfterDays, so it disappears from search but not from the file.
solution_search¶
Searches the ledger. query can be the raw error text or an option you’re currently weighing.
Scoring weights (high to low): signals hit → tags → domain → title tokens → body tokens; platform mismatch incurs a penalty, cross-directory machine entries incur a penalty, deprecated entries are heavily downweighted.
Auto-Push¶
The tools/post-execute hook: when a tool fails, it grabs the error text (error.message / error.info.code / text blocks in the result) to match against. When a confirmed entry with a score ≥ pushMinScore is hit, a summary is appended to the end of the result.
Constraints:
- Only
confirmedentries are pushed; drafts and superseded entries are never pushed - The same failure pattern is pushed only once (deduplicated by tool name + error prefix, retaining the most recent 20)
- A single summary is ≤ 200 characters
- If the lookup itself errors, it silently returns—never turning the original error into a worse one
Storage¶
Storage file: $DSH_HOME/solution-ledger.json (overridable via statePath). Writes use “temp file + rename” to guarantee atomicity. On read failure or JSON corruption, it starts with an empty ledger rather than crashing the plugin.
{ "version": 1, "entries": { "<id>": { "id": "...", "title": "..." } } }
Hit counts from searches are accumulated in memory and batch-flushed to disk every 30 seconds—otherwise every query would require a disk write.
UI¶
An additional ledger icon appears in the sidebar icon row (order: 30, between dsh-context and dsh-ppt.workbench; each item in sidebar.panellist maps to a panel with the same key in main). Clicking it opens the ledger panel in the central area:
- Search box + type/status filters
- Each entry is expandable: title, problem, resolution, rejected alternatives, verification method, tags—all directly editable, saved on blur
- Status actions: confirm (draft → confirmed; only confirmed entries participate in auto-push), revert to draft, deprecate, archive, delete
- When expanded, if the entry has a supersedes relationship, the top displays “Supersedes
<id>” or “Is superseded by<id>” (read-only) - The top shows total count and per-status counts; the bottom shows the actual storage file path
The Host half registers six routes for this: GET /solution-ledger/list, POST /solution-ledger/update, POST /solution-ledger/delete, GET /solution-ledger/update-check, POST /solution-ledger/backup, GET /solution-ledger/backups.
Route Access Control¶
These six routes listen on loopback. Any webpage in the user’s browser can send requests to 127.0.0.1. Since 0.2.5, all six routes share a single guardrail (lib/guard.js). Before entering any handler, it passes through ctx.connection.requestRejection():
- Host/Origin fencing: blocks DNS rebinding and cross-site calls;
Sec-Fetch-Site: cross-sitegets a 403 outright - Login cookie: requests that pass the fence but lack authentication get a 401
- If the
connectionservice is unavailable, return 403 (fail closed); if the check itself throws, also treat as 403
Rejected responses contain only the plain text unauthorized / forbidden, with no ledger content.
Update Check¶
When the panel opens, it checks once whether a newer version exists. If found, a notification appears at the top. Clicking “Go Update” navigates to the Plugins page, specifically this plugin’s detail page, where the native Update button completes the installation. The plugin does not install itself—updateBundle uninstalls the old version before installing the new one, and the very plugin handling this request is the one being uninstalled; a mid-operation disconnect is inevitable. Navigating over to use DSH’s native confirmation dialog, progress indicator, and failure rollback is more reliable than reimplementing all of that.
Why Not Use DSH’s Built-in Version List¶
pluginManager.listVersions() runs pnpm view under the hood, querying whichever registry pnpm is configured to use. In mainland China, pnpm defaults to registry.npmmirror.com, and the mirror sync lags: on the official registry, dsh-solution-ledger’s latest is 0.2.3, but on the mirror it’s 0.2.2; at the time, the 0.2.3 metadata and tarball on the mirror both returned 404. Adding ?t= timestamps and sending no-cache headers didn’t help either—it wasn’t HTTP caching; the mirror server simply hadn’t synced yet. So during the window right after a release, checks going through the mirror uniformly report “already up to date”—exactly when you most need to see the new version.
So here: the official registry is queried first, the mirror serves as a cross-check. When both respond and the mirror is behind, the notification explicitly states npmjs v0.2.4 / npmmirror v0.2.3 and reminds you to switch the source to registry.npmjs.org during installation; otherwise the Plugins page will error because the mirror can’t fetch that version.
Two Gates Before Updating¶
Clicking “Go Update” doesn’t immediately navigate away. There are two intermediate steps, and if either fails, the navigation is blocked:
Gate 1: Can the source actually serve the tarball? A version number in dist-tags doesn’t mean the tarball is downloadable—the mirror has exhibited cases where the tag exists but the file returns 404. So a GET with Range: bytes=0-0 is sent to the target version, querying both the official registry and the mirror, checking for a real status code (200 / 206 counts as available). If all sources fail to serve it, the navigation is refused, because the update at that point would become “uninstalled the old version but nothing to install”—far worse than not updating at all. The panel displays the measured status of each source, for example:
Source status · registry.npmjs.org 206 / registry.npmmirror.com 404
Gate 2: Is there a backup of the old version? Before navigating, the entire currently running package directory is copied to $DSH_HOME/solution-ledger-backups/<version>-<timestamp>/, excluding node_modules and .git. updateBundle only upgrades, never downgrades, and a published version could itself be broken—without this copy, there’s no local fallback.
The backup directory itself is a complete, installable package, so rollback is a single command:
dsh plugin --profile <profile> name add file:<backup_dir>
The directory also contains backup.json (version, timestamp, file count, source) and RESTORE.md (rollback steps; for link installations, the git checkout approach is documented). If the backup fails, a confirmation dialog asks whether to proceed anyway; the default is to not proceed.
Caching¶
One check result is reused for updateCheckTtlMs (default 5 minutes). Deliberately set very short: if the window is too long, “check for updates” degrades into the very lie it was designed to solve. The re-check button carries ?force=1, bypassing the cache directly.
Configuration¶
Modify in the config section of your cordis.patch.yml:
| Key | Default | Description |
|---|---|---|
pushOnToolError |
true |
Whether to auto-push matching entries when a tool fails |
pushMinScore |
12 |
Minimum relevance score for auto-push. Matches below this threshold don’t interrupt the model |
maxEntries |
2000 |
Hard cap; when exceeded, the oldest archived entries are deleted by update time |
archiveAfterDays |
90 |
Entries not hit for this many days are removed from search (not deleted) |
draftArchiveAfterDays |
30 |
Drafts never hit, older than this many days, are auto-archived (not deleted) |
statePath |
'' |
If empty, uses $DSH_HOME/solution-ledger.json |
updateCheck |
true |
Whether to check for new versions at the top of the panel |
updateCheckTtlMs |
300000 |
How long a check result is reused. Don’t increase—longer means you’ll miss freshly released versions |
updateCheckTimeoutMs |
8000 |
Timeout for a single registry query |
updateCheckPackage |
'dsh-solution-ledger' |
Which package to check; only change if you fork and rename |
updateCheckRegistry |
'https://registry.npmjs.org' |
Authoritative source, queried first. Releases are visible here first |
updateCheckMirror |
'https://registry.npmmirror.com' |
Cross-check mirror; lag will be flagged. Set to empty string to skip the cross-check |
backupOnUpdate |
true |
Whether to back up the current version before navigating to update |
backupPath |
'' |
If empty, uses $DSH_HOME/solution-ledger-backups |
Limitations¶
- No semantic search. Matching is based on tokens and substrings, relying on
signalsbeing written precisely. The closer it reads like a real error message, the higher the hit rate. - The UI cannot create new entries. The sidebar panel allows viewing, editing, confirming, deprecating, archiving, and deleting, but new entries must go through
solution_log. - Single-process. Storage is a local file; two DSH processes writing simultaneously will overwrite each other.
decisionentries are not auto-pushed. Choosing a technical path doesn’t produce an error event; these entries can only be found via activesolution_search.- Update check reports, doesn’t install. Clicking “Go Update” only navigates to the Plugins page; whether to install and which version is decided by the confirmation dialog there. When the mirror lags, the installation step may still require switching to the official registry.
- Update check requires outbound network access. If it can’t reach the registry, it reports that honestly—it won’t fabricate a result from cache; on failure, the specific reason is displayed.
Installation & Enablement¶
Install from npm (Recommended)¶
npm i dsh-solution-ledger
Or let DSH install and enable it directly:
dsh plugin --profile <profile_name> add dsh-solution-ledger
You can also open the Web Plugins page, click Add, and enter dsh-solution-ledger.
Install from GitHub¶
dsh plugin --profile <profile_name> add github:Catwb/dsh-solution-ledger
Suitable for tracking the latest commits; the npm version is more stable.
After installation, a ledger icon appears in the sidebar icon row. After modifying plugin code, toggle the plugin off and on in the Plugins page to reload the Host half; the browser side also requires a page refresh.
When you disable this plugin, the sidebar icon and panel are revoked along with the Host half, but the frontend code already loaded in the browser requires a page refresh to disappear—this has nothing to do with the plugin’s cleanup logic; it’s determined by how the frontend bundle is loaded.
Typical Usage¶
- Use
solution_logto write akind: troubleshootrecord, filling inproblem,resolution,signals(error codes/commands/file names, etc.), andverify(how to confirm the fix). - The next time the same error occurs,
solution_searchmatches the raw error text, and on a hit, a summary is automatically appended to the end of the result. - To update a record, use
replacesto point to the old entry id—overwrite in place rather than creating a new one. - To replace an old entry while preserving history, use
supersedesto point to the old entry id; set this entry’s status toconfirmedand the old entry’s status todeprecated. - In the sidebar panel, confirm drafts (draft → confirmed); only confirmed entries participate in auto-push.
Use Cases & Notes¶
Suitable for scenarios requiring cross-session accumulation of troubleshooting and decision trade-offs, such as operations, debugging complex systems, and technology selection. The plugin runs with the current DSH process’s permissions; review the source code and license before installing.
Closing¶
Turn “symptom → root cause → fix → how to verify” into cross-session, searchable ledger entries. Search before debugging; auto-surface confirmed entries when tools error out. Directory page and GitHub links below.