dsh-pitfalls: Compiling Pitfalls into Searchable Archives

Preface

When running agents in DSH, the same error or build failure often reappears across different sessions. The root cause you spent two hours tracking down last time gets rediscovered from scratch in the next conversation—not because the model is “dumb,” but because sessions aren’t persistent, and there’s no project-bound “lesson library.”

Common workarounds include jotting things down in notes or a wiki, but the model doesn’t automatically check those. Or hoping the model remembers to consult docs first—until tasks get complex and it forgets. Enter the community plugin dsh-pitfalls (maintained by superSizzzz): it captures pitfalls as structured entries (symptom, how you fell in, how to solve it) and provides retrieval tools. It also injects reminders into the session—with matching historical solutions—when the same tool fails repeatedly past a threshold.

What Is This

dsh-pitfalls is a Cordis plugin for DeepSeek Harness, categorized as a “memory” capability. It doesn’t make extra model calls; instead, it counts tool failures in the event stream and performs local retrieval against jsonl archives.

The problems it solves boil down to three points: Remember (write entries after solving or working around issues), Search (check history before acting), and Watch (remind the model to check entries when failures cascade). What counts as a “pitfall” is left to the model to judge via tool descriptions—the plugin doesn’t pre-empt conclusions, avoiding archives cluttered with noise like “wrong command typed.”

Core Features

Three Functions and Their Triggers

Capability What It Does Who Triggers
Remember pitfall_record writes a pitfall entry Model, after the issue is solved or worked around
Search pitfall_search / pitfall_show look up history Model, before modifying code or running commands
Watch Injects reminders (optionally with matching history) when the same tool fails consecutively past a threshold Plugin, by monitoring tool results

The default threshold is 2 consecutive failures for the same tool; any single success resets the counter. Reminders are throttled: no duplicates within 10 minutes in the same session, with a maximum of 4 reminders per session.

Four Tools

Tool When to Use
pitfall_search When hitting errors, build failures, or unexpected behavior—before acting; use error keywords plus module/command/filename as clues
pitfall_record When an issue took significant effort to understand and has been solved or worked around
pitfall_show When you pick an entry from search results to view full details
pitfall_update When a better solution emerges later, or it was only worked around initially—append notes without overwriting the original entry

Archive Structure and Storage

When writing, both project and global archives get a copy with the same ID; when reading, current workspace project archives are checked first, supplemented by global ones if needed, with each result annotated for source.

Type Location Purpose
Project archive <workspace>/.dsh/pitfalls/ Travels with the project, persists across machines or long absences
Global archive ~/.dsh/pitfalls/ Fallback and backup; used exclusively in temp dirs or when no workspace exists

Typical files in the directory:

<workspace>/.dsh/pitfalls/           or   ~/.dsh/pitfalls/
├── entries.jsonl      source of truth, one complete snapshot per line
├── cards/<id>.md      readable card for individual entries
└── INDEX.md           index in reverse chronological order

Each record corresponds to pitfall_record fields: Symptom symptom, How you fell in cause, How it was solved solution, Evidence evidence, Scope/Tags area / tags. IDs look like p-20261004-164512-a3f9; status is one of resolved / bypassed / unresolved.

Permissions and Boundaries (Verify Before Installing)

Behavior described in the plugin README includes: no network requests, no shell command execution; registers 4 pitfall_* tools; optionally appends “record pitfalls, search before starting” rules to system prompt (can be disabled); only injects reminders during consecutive failures without rewriting user messages; writes only to archive directories and optional log files. The plugin runs with the same permissions as the current dsh process—read the GitHub repo source and MIT license before installing.

Installation and Activation

Environment requirements (from the official README):

Item Requirement
dsh ≥ 0.1.7-rc.2
Node ≥ 22.6
Profile web / tui / headless all supported; install once per profile

Run in the target profile (example for web):

dsh plugin --profile web add github:superSizzzz/dsh-pitfalls

dsh reads the package’s dsh.bundle.patch and merges it into the current profile—no manual config writing needed. It’s active by default; quiet during normal operation, with visible behavior only during consecutive failures or when the model actively calls the tools.

Uninstall:

dsh plugin --profile web remove dsh-pitfalls

Existing archives aren’t deleted by the plugin—they remain in the workspace .dsh/pitfalls/ and ~/.dsh/pitfalls/ as plain text, which you can keep or delete freely.

Typical Usage

How Automatic Reminders Look

When, for example, npm run build fails twice in a row and similar entries exist in the project archive, the session might see an injection like below (from the README example, paths and clues generalized):

[Pitfall Archive] `npm run build` failed twice consecutively.
Clues: TS2339 Property 'createReport' does not exist | src/report/export.ts

There's a similar entry in this project's archive—check if it applies directly:
- `p-20261004-164512-a3f9` | resolved | this project | tsconfig's types not included
  How it was solved: add @types/node to compilerOptions.types, don't use triple-slash

If this pitfall differs from above (or the above solution doesn't work this time), after
solving or working around it, use `pitfall_record` to log a new pitfall, and optionally
use `pitfall_update` to append notes to the old entry.

If neither archive has a suitable match, the plugin indicates it might be a new issue and suggests recording it after solving—rather than forcing irrelevant entries. Retrieval prefers empty results over wrong solutions.

Model-Side Workflow

  1. Encountering an error or abnormal behavior: first pitfall_search, using error fragments, command names, and file paths as query.
  2. After hitting a match: pitfall_show to view details; if reusable, follow the solution in the archive.
  3. New issues or when old solutions fail: after solving or working around, pitfall_record to write an entry; use pitfall_update to append later improvements.

Optional Configuration

Configuration is written in the profile patch’s config section with id: pitfalls; saves trigger hot reload if the profile has patchReload: live. Common field examples:

- id: pitfalls
  config:
    failureStreak: 3
    projectStore: false
Field Default Meaning
enabled true Master switch
autoDetect true Whether to auto-monitor tool failures
failureStreak 2 Consecutive failure threshold
matchHistory true Whether to include historical solutions in reminders
reminderCooldownMs 600000 Minimum interval between reminders in the same session (milliseconds)
maxRemindersPerSession 4 Maximum reminders per session
systemPromptSection true Whether to write the system prompt rules section
projectStore true Whether to write project archives
projectDir .dsh/pitfalls Project archive relative path
backupToGlobal true Whether to keep a global backup when writing project entries

To verify the plugin loaded and archive paths are active, set logPath in config; after loading, the log will show a line with event: "applied" containing actual globalDir, projectDir, etc.

Use Cases and Caveats

Who It’s For: Agent users doing long-term development or operations in fixed repos with DSH; teams wanting to keep “pitfalls encountered in this project” alongside the repo (.dsh/pitfalls/), optionally version-controlled or added to .gitignore.

Things to Note:

  • The project directory gains a .dsh/pitfalls/; if you don’t want to commit it, ignore that path or disable projectStore to keep only global archives.
  • Reminders are only injected to the top-level session; failures in subagent sessions won’t get injections—related pitfalls need to be reflected in the main agent’s results and recorded.
  • When workspace path isn’t available, only global archives are written.
  • The community directory SkillHub plugin page and GitHub are independent information sources, with no official affiliation to DeepSeek / High-Flyer; the current package version is 0.1.0, and GitHub stars are per the repo page.

Conclusion

dsh-pitfalls transforms “lessons learned” from personal notes into a local archive that DSH can search and proactively surface: the model handles recording and searching, while the plugin intervenes on objective signals like consecutive failures, reducing the time spent repeatedly diagnosing the same pitfall from scratch.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye