Passer au contenu principal
L

rocky-mem-dsh

linyu19872008/rocky-mem-dsh

Engineering experience ledger for DSH: standing preferences at session start, provenance-backed lessons before work, and explicit applicability conditions.

Installer

dsh plugin --profile web add github:linyu19872008/rocky-mem-dsh

README

Rocky, the rocky-mem mascot

rocky-mem-dsh

Your agent stops re-learning what your team already knows.
A DeepSeek Harness bundle for the rocky-mem experience ledger.

ci npm license DSH version
English · 中文


The problem

Every session starts from zero. The last investigation — what was tried, what failed, why the fix worked, and under which conditions it breaks again — lives in a chat log nobody reads. A commit records what changed, not why.

rocky-mem keeps that ledger. This plugin decides when to hand it to the agent, and gets out of the way the rest of the time.

What you get

  • Context before the first turn. Preferences and pinned lessons for the working directory arrive as one tagged block — no tool call, no prompt.
  • Six tools (mcp__rockymem__*) for search, write, read, feedback.
  • The rocky-mem skill, so the agent knows when a recorded lesson must not be applied.
  • Silent degradation: if the ledger is down, the session is unaffected.

Injected context block

/rockymem status output

Quick start

Two moving parts: the ledger daemon, and this bundle.

# 1. the server (see its README for go install / prebuilt binaries)
rockymem serve --dsn sqlite://$HOME/.local/share/rocky-mem/rocky-mem.db

# 2. the bundle
dsh plugin --profile web add rocky-mem-dsh
#    or: install "rocky-mem-dsh" from the Plugins page

# 3. restart dsh web

What you should see: start a new session. Its first message contains a <rockymem-context kind="standing"> block with your preferences. Ask the agent to run /rockymem status — it reports the endpoint, contract version, and how many packs were injected:

rocky-mem — http://127.0.0.1:7432
contract 1 · server 0.2.2 · features context,search,get,…,mcp.streamable-http
injected 1 · skipped none
inject=on preStep=off budget=500/400

Nothing to inject yet? Record a preference once (mem_remember) or a lesson (mem_record), then open another new session.

How it works

LayerResponsibilityLives in
Correctnessgates, ranking, pack assembly, conflict handlingthe rocky-mem server
Timingwhen to inject, budgets, circuit breaker, degradationthis plugin
Behaviourhow the agent should use the toolsthe rocky-mem skill
agent/created ──▶ rockymem-runtime ──HTTP──▶ POST /api/v1/context ──▶ agent.inject()
agent/pre-step ─▶ (opt-in) ────────────────▶ POST /api/v1/search  ──▶ appended message
tool call ─────▶ dsh-mcp-client ──stdio───▶ rockymem mcp ──▶ the daemon

The plugin holds no knowledge of its own: it reads doctor to see what the server supports, asks for a pack, and injects it. The server owns every decision about what is true.

Configuration

Everything has a working default. Overrides go in the profile's cordis.patch.yml, keyed by entry id (rockymem-runtime, mcp-rockymem).

KeyDefaultMeaning
endpointhttp://127.0.0.1:7432daemon base URL (ROCKYMEM_URL wins)
tokenFile~/.local/share/rocky-mem/rocky-mem.tokenbearer token (ROCKYMEM_TOKEN wins)
doctorCacheMs60000capability-probe cache
inject.enabledtruesession-start injection
inject.onSources[startup, clear]SessionStartSource values that receive it
inject.budgetTokens500pack ceiling
inject.timeoutMs150hard per-call budget
preStep.enabledfalsetask-time retrieval
preStep.budgetTokens400pack ceiling per turn
preStep.minPromptChars12shorter prompts are never searched

The token is written by rockymem serve next to its database (<db-stem>.token, mode 600) or under $ROCKYMEM_HOME/pg-<hash>/.

Turn on task-time retrieval

agent/pre-step runs on every step, so this is opt-in:

- id: rockymem-runtime
  config:
    preStep:
      enabled: true

It makes retrieval deterministic instead of hoping the model calls mem_search, at the cost of one HTTP call and up to 400 tokens per turn.

Measured on a real store, 6 realistic queries at budget=400:

ResultQueriesApprox. tokens
Hit an experience section1250
Matched only the standing preference542 each

The standing preference is already injected at session start, so five of six injections would have been pure duplication. That is why a pack with no ## Applies or ## Do not use section is skipped, and why the default is off.

Transports

The MCP entry ships on stdio: rockymem mcp reads the token file itself and proxies to a running daemon, so no secret appears in configuration.

Switch to Streamable HTTP when the daemon is remote, or when you would rather not spawn a child process per client:

- id: mcp-rockymem
  config:
    transport: streamable-http
    url: http://127.0.0.1:7432/mcp
    headers:
      Authorization: !!js '`Bearer ${process.env.ROCKYMEM_TOKEN}`'

The HTTP transport is stateless; GET /mcp answers 405 by design.

Failure behaviour

A memory service that is down must never slow a session down.

SituationBehaviour
daemon stoppedno injection; one warning at load; session unaffected
call exceeds the budgetthat injection is dropped
3 consecutive failurescircuit opens for 60 s; no calls are attempted
doctor lacks contextinjection skipped (older server)
subagent sessionnever injected
pack has no experience sectionskipped (task-time only)

Privacy

  • Talks only to the endpoint you configure; no telemetry, no other hosts.
  • Sends the working directory, and when preStep is on, the first prompt of a turn — only to that daemon.
  • Never reads the rocky-mem database or configuration files, and runs no install-time scripts.

Details and the threat model: SECURITY.md.

Compatibility

This bundleDSHrocky-mem contract
0.1.x>= 0.2.2-rc.11
Node^22.19 or >=24—

engines.dsh is declared because the bundle uses agent/pre-step and ctx.skills.registerProvider. Marketplace cards filter on it, so an "incompatible" label on the Plugins page means the DSH release is too old — not that the plugin is broken.

Troubleshooting

SymptomCheck
No context block appears/rockymem status — injected 0 plus a skip reason
skipped no-featurethe server predates context; upgrade rocky-mem
skipped disabledsomething ran /rockymem off in this process
skipped empty-packthe ledger has nothing for this directory yet — record something
Tools missing from the modelrockymem mcp failed to spawn; run it in a terminal and read the error
daemon unreachable at loadrockymem serve is not running, or endpoint is wrong

Server-side diagnosis: rockymem doctor --dsn <your DSN>.

Uninstall

Remove the bundle on the Plugins page (or dsh plugin --profile web remove rocky-mem-dsh). The daemon and its database are separate and untouched — remove them only if you want the ledger gone.

Development

npm test                       # 15 cases, no daemon, no network
npm pack --dry-run             # the exact file list that ships
node scripts/check-readme.mjs  # bilingual structure + links + locale metadata

Read CONTRIBUTING.md before a change: the rule that matters most is that a failed memory service must never become a failed session.

rocky-memthe ledger server, MCP contract, ADRs
rocky-mem-skillthe portable skill for other hosts
DeepSeek Harnessthe host this bundle plugs into

License

MIT — see LICENSE. By participating you agree to the code of conduct.

Plugins associés