DSH Plugins Marketplace

DSH Plugins

Plugins

/

Memory & Context

/

dsh-pitfall-memory

d

dsh-pitfall-memory

Manifest valid

Failure memory for DeepSeek Harness. Captures tool failures as they happen, classifies them with 16 built-in rules into lessons pairing a symptom with a fix, adds session/daily/weekly summaries, and i

UI (client)hasBundlePatch

dsh-pitfall-memory

Long-term failure memory for DeepSeek Harness: records tool failures as they happen, folds them into reusable lessons, and injects a short briefing into later sessions so the same pitfall is hit once.

It is not a replacement for AGENTS.md. AGENTS.md holds rules you wrote by hand; this plugin grows the rules your hand-written file has not covered yet, from what actually failed at runtime.

中文说明见 README.zh.md。

What it does

Four-layer convergence, computed on every read — nothing here is a separately hand-written document:

L1 observation   raw failure evidence: command, output, exit code
        │  rule classification + signature normalization
L2 lesson        one row per signature: symptom + the fix, with an occurrence count
        │  grouped by root cause
L3 pattern       why this area keeps failing (restricted token / sandbox boundary / runtime resolution …)
        │  first sentence of each fix, ranked by severity
L4 rule          the executable short list shown first in the briefing

Three summary periods:

periodtriggerartifact
per sessionagent/disposed and plugin teardownsummaries/session-<id>.md: captured, new, re-offended
dailylazy, on the first briefing render of the daysummaries/daily-YYYY-MM-DD.md: root-cause ranking, highlights
weeklylazy, once the ISO week rolls oversummaries/weekly-YYYY-Www.md: 7-day roll-up plus rules worth promoting into AGENTS.md

Install

node scripts/install.mjs --dry-run      # preview the plan
node scripts/install.mjs                # copy into <profile>/node_modules and add to dsh.profile.bundles

Then restart DSH. The briefing and the pitfall_* tools appear right away; the settings page needs the restart, because dsh-client-modules scans dsh.client declarations only at process start.

Injection channel

The briefing is registered as a dynamic context section:

ctx.inject(['systemPrompt'], (scope) => {
  scope.systemPrompt.context({ name: 'pitfall:briefing', order: 950, text: render })
})

It rides along with the Current runtime context snapshot of every request, so it works regardless of when the plugin was loaded — including sessions restored after a restart.

A note for plugin authors: returning extra messages from an agent/pre-step waterfall listener is not enough — in testing, the constructed messages never reached the session log. Use systemPrompt.context, which is what the in-box sandbox-policy, user-approval and subagent plugins do.

Web settings page

Settings → Plugins → Pitfall memory, two tabs (requires the DSH restart to appear):

  • Lessons — counts, a status filter, expandable symptom/fix per row, and re-activate / resolve / mute actions.
  • Summaries — the latest daily and weekly summary, with a regenerate button.

The host half mounts plain JSON endpoints through webServer.register:

endpointmethodpurpose
/dsh-pitfall-memory/api/overviewGETcounts, status split, rule cards, heartbeat
/dsh-pitfall-memory/api/listGETlessons (?status=, ?category=)
/dsh-pitfall-memory/api/summariesGETlatest daily / weekly
/dsh-pitfall-memory/api/set-statusPOST{ id, status }
/dsh-pitfall-memory/api/refreshPOSTrecompute daily + weekly

A request carrying an Origin header must match the loopback Host, otherwise it gets 403.

Tools

toolpurpose
pitfall_listlist lessons (by status / category / project scope)
pitfall_rememberrecord a "root cause + fix" the model worked out
pitfall_resolvemark resolved / muted / active
pitfall_reviewreview the current session: new, repeated, or resolved-then-reoffended
pitfall_summarygenerate or read the session / daily / weekly summary

Built-in rules

16 classification rules cover the failure classes this kind of environment actually produces: sandbox boundary violations, restricted-token operations (pipes, pip, mkdtemp), runtime resolution (store-aliased python), CJK encoding, Git identity, network and credential errors, unknown tools, and a generic non-zero-exit fallback. Anything unrecognized lands in one of the two fallbacks instead of being dropped.

On first run the store is seeded with 14 lessons describing this environment's known pitfalls, so the very first session already has something to inject.

Configuration

Line config lives in cordis.patch.yml and can be overridden per id pitfall-memory in the profile's own patch file:

fielddefaultmeaning
enabledtruemaster switch
seedtrueseed known pitfalls when the store is empty
summariestruesession / daily / weekly summaries
capturetruecapture tool failures
injecttruerender the briefing as a dynamic context
maxLessons12lessons in the "other frequent" section
maxInjectBytes6000UTF-8 byte ceiling for the briefing
minOccurrences1minimum occurrences before a lesson is injected
injectIntoSubagentsfalsealso brief subagent sessions
repeatWarntrueone-line reminder when a signature repeats within a session
projectScopedtrueonly this project's lessons plus global ones
maxFindingsPerSession200per-session capture cap
maxLessonsStored300store cap (seed and manual lessons are never evicted)
storeDiremptystorage dir; empty = <profile>/.dsh-pitfall-memory
captureTools[]capture only these tools (empty = all)

Storage

<profile>/.dsh-pitfall-memory/:

filecontent
lessons.jsonstructured lesson store (source of truth)
lessons.mdhuman-readable list with a rule-card section
observations.ndjsonraw failure evidence (append-only, rotates at 1 MB)
state.jsonroll-up progress (lastDaily / lastWeekly)
summaries/session, daily and weekly summaries (json + md)
.heartbeat.jsonlload and render heartbeats — the first stop when something "does not work"

A lesson belongs to a project, whose root is the nearest ancestor containing .git or AGENTS.md; lessons recorded with scope: global apply everywhere.

Troubleshooting

Run node scripts/doctor.mjs. It reports, in order:

  1. bundle mounted and files copied;
  2. lesson store present, with counts;
  3. heartbeat truth: apply-ok (loaded?) → context-render (rendering?) → settings-api-mounted (settings backend?);
  4. dsh.client declaration ready, with the restart reminder.

The same order works by hand on .heartbeat.jsonl.

Tests

node test/detect.test.mjs          # 16 — rule classification
node test/store.test.mjs           # 7  — merging, persistence, pruning
node test/render.test.mjs          # 6  — briefing rendering and byte caps
node test/summary.test.mjs         # 8  — four-layer convergence, daily/weekly
node test/smoke.test.mjs           # 6  — capture → store → inject → tools, end to end
node test/settings-api.test.mjs    # 4  — projections, routing, Origin checks
node test/client.test.mjs          # 3  — browser bundle exports, slot registration, render

50 tests, all plain Node with no DSH runtime required. Run the files individually: node --test test/ spawns child processes and fails with EPERM under a restricted token on Windows.

License

MIT

Comments

Loading…

Similar plugins

dsh-ai-lessons

by dusktin71-lang

记录 AI 的“愚蠢时刻”(被用户纠正、答非所问、工具报错等),把教训沉淀成可管理的清单,并在后续每一次对话中自动注入系统提示词,让本地模型不再重复犯同样的错。

Terminal & ClientsManifest valid

★ 0

MIT

JavaScript

Oct 12, 2026

dsh plugin --profile web add dsh-ai-lessons

On-demand memory for DeepSeek Harness: session logs are distilled into layered markdown (a summary, an index and per-topic files), and a mem_query tool returns only the matched entries rather than the

Memory & ContextManifest valid

★ 0

dsh plugin --profile web add dsh-memory-lite

by yan5236

Two-phase long-term memory plugin for DeepSeek Harness (DSH): per-session extraction + global consolidation, always-injected summary, and memory_list/read/search/add tools.

Sessions & MessagesManifest valid

★ 3

MIT

TypeScript

Aug 25, 2026

dsh plugin --profile web add @nanmicoder/dsh-memory

by 863683348

Local, auditable personal memory for DeepSeek Harness: preferences, project conventions, workflows and error lessons persisted as a changelogged JSON file in the workspace, with onboarding, auto proje

Memory & ContextSessions & MessagesManifest valid

★ 1

↓ 22/wk

JavaScript

Sep 11, 2026

dsh plugin --profile web add dsh-memory-setup

by wojiao42

文件型长期记忆:每个会话注入你自己的 Markdown 记忆文件,提供读写工具,并能查出 DSH_HOME 漂移;不读对话、不联网 · File-backed memory for DeepSeek Harness, with verifiable constraints

Memory & ContextSessions & MessagesManifest valid

★ 0

MIT

JavaScript

Oct 7, 2026

dsh plugin --profile web add dsh-memory-file

by aujurd22

Long-term memory for DeepSeek Harness: 15 FlyMemory MCP tools, automatic recall and capture hooks, and a supervised local engine.

Tools & CapabilitiesMemory & ContextSessions & MessagesManifest valid

★ 3

MIT

Python

Oct 31, 2026

dsh plugin --profile web add dsh-flymemory