[Feature] Built-in persistent long-term memory for agents #1345
Replies: 12 comments 2 replies
|
sorry dude i had to steal this idea, implementing it now on my own local agents. |
|
We have been working on this exact problem as two independent DeepSeek Harness community plugins. They provide a local implementation today without modifying the DSH chat/provider core. Structured Session Memory
Instead of an unbounded transcript dump, it maintains governed sections for:
The model can merge new facts and replace conflicting information, while the user can inspect and edit what was stored. This handles the small, high-priority layer of long-term memory: identity, preferences, project operating rules and agent state that should survive restarts. Local RAG for scalable history and project knowledge
It deliberately does not index every raw chat turn. Only committed DSH compression summaries are deduplicated and persisted. Models receive the standard Retrieval stays local: BM25+ works without a vector model, while an explicitly started local embedding model adds vector retrieval and RRF fusion. Documents and summaries are visible, editable, logically deletable and versioned for rollback; results retain timestamps, turn/sequence ranges and source locations. Together they cover both parts of this proposal:
The two packages are independent and can be installed or removed separately. Both keep user data under DSH Home. The Local RAG architecture and combined deployment notes are documented in Discussion #1109. These are community plugins rather than an official built-in DSH backend, but they can serve as a concrete reference for an upstream memory interface: stable session identity, explicit model tools, post-commit persistence hooks, provenance, user-visible governance and non-destructive versioning. |
|
The gap is real, and a few community plugins already fill it locally. One more route, focused on bounded + auditable: dsh plugin --profile web add dsh-memory-gate
|
|
Whatever backend lands, what kept ours useful over months of daily use was write discipline more than storage. Three rules did most of the work. Memory points at the source of truth instead of copying it. A note recording where project state lives cannot contradict the file it points at. A copy eventually always does, and a memory that contradicts its source is worse than no memory. Every write is one of add, update, delete, or no-op against the existing store, never a blind append. Append-only memory grows until the useful facts drown in near-duplicates. The agent verifies before asserting. A memory entry is a point-in-time claim, so it gets checked against current state before being acted on, and pruned when wrong. Structurally, a small index loads at session start and typed topic files load on demand, with a size ceiling on the index. That keeps per-session cost flat as the store grows. Documented here: Memory points, it doesn't mirror |
|
These write rules match our experience closely — especially "write a supersede, never blind-append" and "verify before asserting". We built the second one into dsh-memory-gate as CBDC (Claim → Belief → Decision → Consumption): every memory passes a use/verify/ignore decision before it can enter context, and |
|
这里再补一条“直接复用现成生态”的路线:Pi 的 dsh plugin --profile web add pi2dsh@0.11.0
dsh plugin --profile web add pi-hermes-memory它覆盖了原帖要求的两部分:
这条链路已经做过真正的跨进程验证:会话/进程 A 写入一条 memory,完全新进程 B 能通过 |
|
This is exactly the spec we needed — the 60%-overlap update-instead-of-append rule and the cadenced consolidation turn |
|
内置长期记忆的诉求一直有(#1345/#1822 记忆体/#1448 等都是),官方如果做内置记忆 seam,社区那些记忆插件(dsh-sgme/AgentSoul/dsh-memory)就能挂上来。 我们第 15 章生态报告把"记忆/人格 seam"列为官方能力缝之一,这帖正好佐证:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/15-ecosystem-report.md |
|
This is the retrieval/transcript side of the cross-session knowledge problem, complementary to this "persistent memory" (write/discipline) discussion: a first-class way to search the actual past conversation text (WB-style --- 这是"跨会话知识"的检索/原文一侧,与"长期记忆/持久存储"(写入与纪律)互补:让 agent/人直接搜到过去真实聊过的话,而非依赖已提炼的摘要。已另开 Ideas 帖 → #4752。 |
|
A slice of this exists as a plugin today, for one specific kind of memory: what you keep telling the agent. (Disclosure: I maintain it.) Tacit watches the turns that go badly plus your own corrective messages, distills them into short directives It deliberately does not try to be general task memory: no facts/episodes store, no read/write interface for the agent. So a built-in structured backend like this proposal would still be needed for that layer ,Tacit would happily sit on top of it for the preference layer. |
|
@hackernotfound Thanks for the disclosure and for drawing the boundary so precisely. Tacit covering the preference/correction layer — as visible, editable directives with a source/cost receipt — is a great fit for that slice, and your explicit "no general task memory behind it" is exactly why a structured built-in seam is still needed for the rest. Agree they're complementary rather than competing: a native auto-load of the user's markdown-memory / injection layer (the #5333 ask) could let something like Tacit sit on top for the preference layer. I'll keep #5333 scoped to the markdown-memory + injection seam so it doesn't overlap with Tacit. |
Uh oh!
There was an error while loading. Please reload this page.
Currently the agent only has in-session context (window + goal/todo tools); there is no cross-session persistent memory. After a session ends or restarts, context is lost. Projects work around this by keeping external memory in docs/git.
Request:
This would let an agent resume / continue work in a new session without re-reading everything from scratch.
Use case
Operator keeps preferences and project state in long-term memory so a new agent run can pick up where the last one left off.All reactions