modusensus / modusensus/dsh-mneme

runtime contexts (ctx.systemPrompt.context) never reach the model — dsh 0.1.5-rc.1

Open
#175 3 comments 0 reactions 1 assignee Claimed by @modusensus View on GitHub
bug
Dominant language
JavaScript
Stars
100
Forks
11
Avg merge
1h 21m
Merged PRs (30d)
106

Description

🇨🇳 TL;DR:`ctx.systemPrompt.context()` 注册的 `user-settings` / `memory` 两个块从未送达模型。`/api/dsh-mneme/features` 显示 `autoInject: true`,`/api/dsh-mneme/profile` 返回正确文本,但新会话里模型完全不知道画像内容;会话日志里也搜不到任何 runtime-context 快照。

---

## Environment

| | |
|---|---|
| dsh | `0.1.5-rc.1` |
| `@modusensus/dsh-mneme` | `0.8.0` |
| `@deepseek-ai/dsh-system-prompt` | `0.1.5-rc.2` |
| Node | `v22.22.3` |
| OS | Windows 11 (10.0.26200) |
| profile | `web` |

## Expected

The `[用户设置] 来自 dsh-mneme 的用户画像与规则:` block (profile + rules) should be injected at session start (and per the README, every turn), so the model knows the user profile.

## Actual

The model never receives it. In a fresh session, asking the agent "我的用户画像里写了什么?" returns nothing.

## Plugin side looks correct

1. `src/inject.js` registers both contexts:
- `ctx.systemPrompt.context({ name: "user-settings", order: 85, text: renderUserSettings })`
- `ctx.systemPrompt.context({ name: "memory", order: 90, text: (ctx) => ... })`
2. Gate is open — `GET /api/dsh-mneme/features` returns `"effective": { "autoInject": true, ... }`
3. Data is readable — `GET /api/dsh-mneme/profile` returns the configured profile text (redacted)
4. `settings.getProfile()` reads `user_settings.profile` (`src/settings.js:275`)
5. `@deepseek-ai/dsh-system-prompt` is present and enabled, with **no** `includeRuntimeContext` override (i.e. default `true`)
6. **No installed plugin calls `suppressRuntimeContext()`** (grepped all profile `node_modules`)

## Session-history evidence

Decompressed `$DSH_HOME/sessions//session-/session.v3.jsonl.zstd` — **431 concatenated zstd frames → 5.29 MB JSONL**.

> Note for anyone reproducing: the Node APIs `zstdDecompressSync` / `createZstdDecompress` only decode the **first** frame here, so the file has to be decompressed frame-by-frame via the `28 B5 2F FD` magic.

Searched for:

| needle | result |
|---|---|
| `Current runtime context. This snapshot supersedes earlier runtime-context snapshots.` | only in my own debug output, earliest at **95%** of the file |
| `[用户设置] 来自 dsh-mneme` | same |
| `- 用户画像:` (`lang.js` `profileLine` template) | 105 hits, **all after 97.3%**, all my own text |

So the runtime-context snapshot never materialized into session history.

## Caveat

I could not confirm whether DSH is supposed to persist runtime contexts into session history at all (it may be assembled per-request only). If it is not persisted, the session-log evidence is weak — in that case the primary symptom is the model-side one above.

## Working workaround

Re-enabling the built-in `agent-instructions` plugin (the `dsh-web-app` bundle ships it as `disabled: true`) and putting the profile/rules into `$DSH_HOME/AGENTS.md` **does** reach the model. So the problem looks specific to the `systemPrompt.context()` path on this DSH build.

## Question

Is this a plugin-side registration-shape issue for this DSH version, or a DSH-side change in how runtime contexts get materialized? Happy to run further diagnostics.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.