mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
feat(memory): provenance-gated memory with dreaming on by default (#114819)
* feat(memory): add provenance and recall metadata to the memory index * feat(memory): provenance-gated promotion and capture hygiene * feat(dreaming): LLM consolidation with deterministic gates, on by default * feat(active-memory): deterministic recall lane with escalation default * feat(memory): user model file and standing intents * docs(memory): document the memory architecture * fix(memory): live-QA fixes — metadata writers, provenance classes, intent scope, claim accumulation
This commit is contained in:
committed by
GitHub
parent
4c2d06be2b
commit
28630a9a65
@@ -67,11 +67,12 @@ Before proposing or building a custom system, feature, workflow, tool, integrati
|
||||
## Memory system (recommended)
|
||||
|
||||
- Daily log: `memory/YYYY-MM-DD.md` (create `memory/` if needed).
|
||||
- Long-term memory: `MEMORY.md` for durable facts, preferences, and decisions.
|
||||
- User model: `USER.md` for dated active or superseded directives about stable preferences and profile facts.
|
||||
- Long-term memory: `MEMORY.md` for durable non-profile facts and decisions.
|
||||
- Lowercase `memory.md` is legacy repair input only; do not keep both root files on purpose.
|
||||
- On session start, read today + yesterday + `MEMORY.md` when present.
|
||||
- Before writing memory files, read them first; write only concrete updates, never empty placeholders.
|
||||
- Capture: decisions, preferences, constraints, open loops.
|
||||
- Capture preferences as directives in `USER.md`; capture decisions, constraints, and open loops in durable or daily memory as appropriate.
|
||||
- Avoid secrets unless explicitly requested.
|
||||
|
||||
## Tools
|
||||
|
||||
@@ -361,8 +361,16 @@ All under `memory.search.query`:
|
||||
| `maxResults` | `number` | `6` | Max memory hits returned before injection |
|
||||
| `minScore` | `number` | `0.35` | Minimum relevance score to include a hit |
|
||||
|
||||
Hybrid retrieval remains enabled; MMR and temporal decay remain disabled by
|
||||
the built-in engine policy.
|
||||
Hybrid retrieval remains enabled. The builtin engine always applies a fixed
|
||||
30-day recency half-life to dated daily notes and a fixed importance
|
||||
multiplier after hybrid relevance. `MEMORY.md`, `USER.md`, and other evergreen
|
||||
memory files do not decay. Nullable importance is neutral, so no migration or
|
||||
new tuning key is required for existing indexes.
|
||||
|
||||
Strong trigger matches on promoted, trusted entries can inject up to three
|
||||
compact memories on eligible interactive turns. Today, root `MEMORY.md` and
|
||||
`USER.md` are the curated eligible tier. Daily notes and transcripts are never
|
||||
auto-injected.
|
||||
|
||||
### Full example
|
||||
|
||||
@@ -646,12 +654,13 @@ For conceptual behavior and slash commands, see [Dreaming](/concepts/dreaming).
|
||||
|
||||
### User settings
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
| -------------------------------------- | --------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `enabled` | `boolean` | `false` | Enable or disable dreaming entirely |
|
||||
| `frequency` | `string` | `0 3 * * *` | Optional cron cadence for the full dreaming sweep |
|
||||
| `model` | `string` | default model | Optional Dream Diary subagent model override |
|
||||
| `phases.deep.maxPromotedSnippetTokens` | `number` | `160` | Maximum estimated tokens kept from each short-term recall snippet promoted into `MEMORY.md`; provenance metadata remains visible |
|
||||
| Key | Type | Default | Description |
|
||||
| --------------------------------------- | --------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `enabled` | `boolean` | `true` | Enable or disable dreaming entirely |
|
||||
| `frequency` | `string` | `0 3 * * *` | Optional cron cadence for the full dreaming sweep |
|
||||
| `model` | `string` | default model | Optional Dream Diary subagent model override |
|
||||
| `phases.deep.maxPromotedSnippetTokens` | `number` | `160` | Maximum estimated tokens kept from each short-term recall snippet promoted into `MEMORY.md`; provenance metadata remains visible |
|
||||
| `phases.deep.maxPriorEntryLossFraction` | `number` | `0.25` | Reject a consolidation rewrite that removes more than this fraction of prior entries |
|
||||
|
||||
### Example
|
||||
|
||||
@@ -680,6 +689,8 @@ For conceptual behavior and slash commands, see [Dreaming](/concepts/dreaming).
|
||||
<Note>
|
||||
- Dreaming writes machine state to `memory/.dreams/`.
|
||||
- Dreaming writes human-readable narrative output to `DREAMS.md` (or existing `dreams.md`).
|
||||
- Deep consolidation stores the prior `MEMORY.md` in SQLite-backed plugin state and records rewrite counts and highlights in `DREAMS.md`.
|
||||
- Untrusted and system-derived candidates are structurally excluded before consolidation and durable promotion.
|
||||
- `dreaming.model` uses the existing plugin subagent trust gate; set `plugins.entries.memory-core.subagent.allowModelOverride: true` before enabling it.
|
||||
- Dream Diary retries once with the session default model when the configured model is unavailable. Trust or allowlist failures are logged and are not silently retried.
|
||||
- The light/deep/REM phase policy and thresholds are internal behavior, not user-facing config.
|
||||
|
||||
@@ -28,16 +28,23 @@ Do not manually reread startup files unless:
|
||||
You wake up fresh each session. These files are your continuity:
|
||||
|
||||
- **Daily notes:** `memory/YYYY-MM-DD.md` (create `memory/` if needed) - raw logs of what happened
|
||||
- **Long-term:** `MEMORY.md` - your curated memories, like a human's long-term memory
|
||||
- **User model:** `USER.md` - durable preferences and profile facts written as active directives
|
||||
- **Long-term:** `MEMORY.md` - durable non-profile facts and decisions
|
||||
|
||||
Capture what matters: decisions, context, things to remember. Skip secrets unless asked to keep them.
|
||||
|
||||
### MEMORY.md - Your Long-Term Memory
|
||||
### USER.md - Durable User Directives
|
||||
|
||||
- Write stable preferences, communication style, relationships, and active-project context as imperative directives such as `Always`, `Never`, or `Prefer`.
|
||||
- Precede each directive with `<!-- observed: YYYY-MM-DD | status: active -->`.
|
||||
- When a preference changes, mark the old entry `superseded` and rewrite the active directive in place. Never leave contradictory active directives.
|
||||
|
||||
### MEMORY.md - Durable Facts and Decisions
|
||||
|
||||
- Load **only in the main session** (direct chats with your human). Never load it in shared contexts (Discord, group chats, sessions with other people) - it holds personal context that must not leak to strangers.
|
||||
- Read, edit, and update it freely in main sessions.
|
||||
- Write significant events, thoughts, decisions, opinions, lessons learned - the distilled essence, not raw logs.
|
||||
- Periodically review daily files and fold what's worth keeping into MEMORY.md.
|
||||
- Write significant events, decisions, lessons learned, and other durable non-profile facts - the distilled essence, not raw logs.
|
||||
- Periodically review daily files. Fold stable user directives into `USER.md` and durable non-profile facts or decisions into `MEMORY.md`.
|
||||
|
||||
### Write It Down
|
||||
|
||||
@@ -129,11 +136,11 @@ Track your checks in a workspace file of your choosing, for example `memory/hear
|
||||
|
||||
**Stay quiet (`HEARTBEAT_OK`) when:** it's late night (23:00-08:00) unless urgent; the human is clearly busy; nothing is new since the last check; you checked <30 minutes ago.
|
||||
|
||||
**Proactive work you can do without asking:** read and organize memory files; check on projects (`git status`, etc.); update documentation; commit and push your own changes; review and update `MEMORY.md`.
|
||||
**Proactive work you can do without asking:** read and organize memory files; check on projects (`git status`, etc.); update documentation; commit and push your own changes; review and update `USER.md` and `MEMORY.md`.
|
||||
|
||||
### Memory Maintenance
|
||||
|
||||
Every few days, use a heartbeat to read recent `memory/YYYY-MM-DD.md` files, identify what's worth keeping long-term, fold it into `MEMORY.md`, and remove outdated entries. Daily files are raw notes; `MEMORY.md` is curated wisdom.
|
||||
Every few days, use a heartbeat to read recent `memory/YYYY-MM-DD.md` files and identify what's worth keeping long-term. Update active user directives in `USER.md`, fold durable non-profile material into `MEMORY.md`, and remove outdated entries. Daily files are raw notes; `USER.md` and `MEMORY.md` are curated layers.
|
||||
|
||||
Be helpful without being annoying: check in a few times a day, do useful background work, respect quiet time.
|
||||
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
---
|
||||
summary: "User profile record"
|
||||
summary: "Durable user preference and profile directives"
|
||||
title: "USER template"
|
||||
read_when:
|
||||
- Bootstrapping a workspace manually
|
||||
---
|
||||
|
||||
# USER.md - About Your Human
|
||||
# USER.md - User Model
|
||||
|
||||
_Learn about the person you're helping. Update this as you go._
|
||||
Store stable user preferences and profile facts as directives that can guide future sessions.
|
||||
|
||||
- **Name:**
|
||||
- **What to call them:**
|
||||
- **Pronouns:** _(optional)_
|
||||
- **Timezone:**
|
||||
- **Notes:**
|
||||
Use one directive per entry:
|
||||
|
||||
## Context
|
||||
```md
|
||||
<!-- observed: YYYY-MM-DD | status: active -->
|
||||
|
||||
_(What do they care about? What projects are they working on? What annoys them? What makes them laugh? Build this over time.)_
|
||||
- Prefer concise progress updates during implementation work.
|
||||
```
|
||||
|
||||
---
|
||||
- Begin each directive with an imperative such as `Always`, `Never`, or `Prefer`.
|
||||
- Record the observation date and either `active` or `superseded` on the metadata line.
|
||||
- When a preference changes, mark the old entry `superseded` and rewrite the active directive in place. Never append a contradictory active directive.
|
||||
- Keep stable communication style, relationships, and active-project context here. Put durable non-profile facts and decisions in `MEMORY.md`.
|
||||
|
||||
The more you know, the better you can help. But remember — you're learning about a person, not building a dossier. Respect the difference.
|
||||
## Directives
|
||||
|
||||
<!-- observed: YYYY-MM-DD | status: active -->
|
||||
|
||||
- Prefer ...
|
||||
|
||||
## Related
|
||||
|
||||
|
||||
Reference in New Issue
Block a user