Working Backwards: A Decision Plugin That Assumes Failure Before You Make the Final Call

Preface

DeepSeek Harness (DSH) plugin ecosystem emphasizes “everything is a plugin,” and the plugin system allows the host to mount extensions. In agent or toolchain development, you often need to reason through risks before making a decision — a small utility many teams build in-house. But building your own means maintaining state storage, a UI, and host integration, which is no small cost. zhang-1239/dsh-nitui turns the “pre-mortem” into a DSH plugin: it doesn’t make the decision for you; it simply assumes that six months from now the decision has already failed, works backward to list the most likely causes of failure, and attaches a verification action that can be completed within 30 minutes to each one.

What It Is

nitui is a plugin for DeepSeek Harness, maintained by zhang-1239. It standardizes the “pre-mortem” process: three questions, one autopsy card, and a 30-minute verification action attached to each failure cause. The plugin also maintains a “hidden thread” that silently records your actual trade-off decisions locally and, when a similar choice reappears, surfaces a three-line reminder at the bottom of the conversation reminding you how you chose last time. All data is written exclusively to local JSONL files — no uploads, no telemetry.

Core Features

The Visible Path: Pre-Mortem

  1. What’s been making you hesitate lately? — Describe in one sentence the choice that’s still undecided.
  2. Suppose this decision fails six months from now — what’s the most likely cause? — One or two causes is fine. You can also click a model-suggested candidate and rephrase it in your own words.
  3. A follow-up question — generated by the model based on ②, designed to push you to be more specific about a particular failure cause (a timeline, a dollar figure, someone’s exact words, an observable symptom). Skippable.

Once submitted, you get an “autopsy card”: the failure scenario, 3–5 failure causes, a 30-minute verification action under each cause, and a reference-only lean. If the model is unavailable, the flow won’t get stuck — the card degrades to “organizing what you wrote” and is clearly labeled as such.

The Hidden Thread: Past Choices

  • When the conversation reveals “choosing among options,” a recall is prepared; when it reveals “the decision is made,” a low-confidence choice is logged.
  • Recall has three gates: same domain, same trade-off direction, and enough records accumulated in that domain to hit the threshold. If any gate isn’t met, no prompt is shown.
  • Each domain has a default vocabulary; custom domains and keywords are supported; cross-domain recall never fires.
  • In Settings you can turn off logging and recall, adjust the threshold (strict / standard / aggressive), review “what I’ve logged,” or export and clear records.
  • The model can also participate via the log_choice / recall_choice tools, but the hidden thread doesn’t depend on the model: when the model doesn’t cooperate, keyword rules still work.

Installation & Activation

Requires a DSH instance with the plugin system (dsh web or DSH Desktop).

Install from a local directory (for development):

dsh plugin --profile web add file:/path/to/nitui

Windows example:

dsh plugin --profile web add file:D:\shiqianyanshika\plugin

Install from npm (after release):

dsh plugin --profile web add @zhangxij/dsh-nitui

After installing, restart or refresh DSH:
- A “Squeeze” button appears at the top-left of the input box;
- A “My Deductions” entry appears in the left sidebar;
- In the “Squeeze” card, click ⚙ → “Full Settings” to tune the hidden thread and layout.

Typical Usage

  1. Click “Squeeze” above the input box.
  2. Answer the three questions in sequence; the three candidates under ② are there to get you started — click one to fill it into the input box, then rephrase it in your own words.
  3. Click “Generate” to get the autopsy card; you can “Collapse” it or “Squeeze again.”
  4. In “My Deductions,” filter and sort by status (All / In Progress / Completed / Cancelled) and domain; supports continuing, renaming, and deleting.
  5. Hidden-thread recalls appear at the bottom of the conversation; click “×” to suppress that category for 7 days, or click “View all records” to go to the Settings page.

Data & Privacy

Data Directory

The data directory is resolved in the following order; the first match wins:
1. Plugin config config.dataRoot (the config.dataRoot field in cordis.patch.yml);
2. Environment variable DSH_NITUI_DATA;
3. data/ inside the repo — dev-only: the plugin directory is not under node_modules, and data/ already exists (only created after running node seed.js);
4. User directory ~/.nitui (on Windows: C:\Users\<your-username>\.nitui).

If any step resolves to a path inside node_modules, it falls back to ~/.nitui. An installed package will never write data into its own install directory.

The directory contains four files:
- sessions.jsonl: pre-mortem session events (start / answers / followup / done / cancel / delete / rename); the list view is derived by folding these events.
- choices.jsonl: hidden-thread choice records (log / delete).
- recalls.jsonl: recall and mute records (recall / mute).
- config.json: hidden-thread settings and layout preferences.

Privacy & Permissions

  • No external network requests: the plugin has no telemetry, analytics, fonts, CDN, or third-party APIs. The browser side only fetches same-origin /nitui/* endpoints and carries DSH’s dsh-auth-* session credentials. The host first performs a same-origin check (mismatched Origin and Host → immediate 403), then calls ctx.connection.requestRejection for the DSH access check: requests without valid DSH credentials return 401, cross-site requests return 403 — both before any route logic.
  • Model requests: when generating ② candidates, the ③ follow-up, and the autopsy card, your three-question input is sent via DSH’s llm service to your configured model provider. No conversation history or hidden-thread records are sent. Requests are issued by the host; the plugin never talks to a model API directly.
  • Reading conversations: when the hidden thread is enabled, the text of new user messages is read to determine “in a trade-off” vs. “already decided”; only the derived choice record is written locally — the full message is not stored.
  • File access: only reads and writes the data directory listed above; no scanning of other directories, no writes into node_modules.
  • HTTP surface: only same-origin routes registered: GET /nitui/state, POST /nitui/action, GET /nitui/choices, GET /nitui/recall; every request passes the DSH access check (ctx.connection.requestRejection) first — unauthorized 401, untrusted origin 403; body size capped at 64 KiB, application/json only.
  • Two tools exposed to the model: log_choice (record a choice) and recall_choice (read-only recall), plus a system prompt instructing the model to log only after the user has actually decided.
  • Disabling: turn off “Log choices and recall on similar choices” in Settings to stop the hidden thread from logging and recalling; the visible path remains fully usable on its own.

Backup & Cleanup

  • Backup: stop DSH, then copy the entire data directory.
  • Wipe: stop DSH and delete the data directory; or use “Clear All” on the Settings page (clears only choices.jsonl and recalls.jsonl).
  • Export: “Export JSON” on the Settings page exports only hidden-thread choice records, not deduction sessions.
  • Uninstalling the plugin does not delete the data directory — manual cleanup is required.

Known Limitations

  • Chinese-first: UI strings are in Chinese; locale/zh.json and locale/en.json currently contain only the plugin-marketplace title and description — the interface itself is not i18n-ized.
  • The hidden thread is heuristic: domain detection relies on keywords, trade-off direction on regex, and “decided” detection on regex as well. It will misfire, miss, and sometimes treat “just comparing” as a choice. Thresholds and muting can mitigate but not eliminate this.
  • Depends on model quality: the follow-up question and AI-suggested failure causes are only as good as your current model. When the model is unavailable, the card degrades to organizing your input without adding failure causes.
  • Single machine, single user: no accounts, sync, or collaboration; data is plain-text JSON on disk, unencrypted.
  • Append-only, no compaction: sessions.jsonl and choices.jsonl grow indefinitely; deletion is a tombstone and doesn’t immediately shrink the file.
  • Incomplete export: only hidden-thread choice records can be exported; deduction sessions have no export feature yet.
  • Dev-mode data directory switch: if data/ exists in the repo, the dev-mode plugin will use it preferentially over ~/.nitui. If you ran seed.js and can’t see your original records, check this first; delete data/ in the repo to fall back to the user directory.

Use Cases

Suited for teams or individuals who need to systematically reason through risks before making decisions in a DSH environment, especially those who want to track their trade-off patterns over the long term. The plugin runs with the privileges of the current DSH process — review the source code and license before installing.

Summary

nitui integrates the “pre-mortem” and “choice logging” tools into a DSH plugin. The visible path provides a structured deduction workflow; the hidden thread records historical choices locally. All data is written to local JSONL files exclusively — no external network requests are made. Ideal for users who want to reason through risks before decisions in DSH and track their trade-off habits over time.

  • Plugin directory: https://www.skillhub.cn/plugins/zhang-1239/dsh-nitui
  • GitHub: https://github.com/zhang-1239/dsh-nitui
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye