Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
1965fc1
docs: add auto-memory implementation log
LaZzyMan Apr 1, 2026
9892e88
feat(core): add managed auto-memory storage scaffold
LaZzyMan Apr 1, 2026
7fb90fa
feat(core): load managed auto-memory index
LaZzyMan Apr 1, 2026
c19045e
feat(core): add managed auto-memory recall
LaZzyMan Apr 1, 2026
a5b6683
feat(core): add managed auto-memory extraction
LaZzyMan Apr 1, 2026
eefd3e9
feat(cli): add managed auto-memory dream commands
LaZzyMan Apr 1, 2026
2e0d717
feat(core): add auxiliary side-query foundation
LaZzyMan Apr 1, 2026
6741218
feat(memory): add model-driven recall selection
LaZzyMan Apr 1, 2026
a178725
feat(memory): add model-driven extraction planner
LaZzyMan Apr 1, 2026
ff1a5b3
feat(core): add background task runtime foundation
LaZzyMan Apr 1, 2026
611f7e0
feat(memory): schedule auto dream in background
LaZzyMan Apr 1, 2026
a258d20
feat(core): add background agent runner foundation
LaZzyMan Apr 1, 2026
c91e840
feat(memory): add extraction agent planner
LaZzyMan Apr 1, 2026
1ab3b0a
feat(core): add dream agent planner
LaZzyMan Apr 1, 2026
f6b80c6
feat(core): rebuild managed memory index
LaZzyMan Apr 1, 2026
6309b21
feat(memory): add governance status commands
LaZzyMan Apr 1, 2026
dadcb85
feat(memory): add managed forget flow
LaZzyMan Apr 1, 2026
85ed860
feat(core): harden background agent planning
LaZzyMan Apr 1, 2026
63f5392
feat(memory): complete managed parity closure
LaZzyMan Apr 3, 2026
223e8e6
test(memory): add managed lifecycle integration coverage
LaZzyMan Apr 3, 2026
e392a15
feat: same to cc
LaZzyMan Apr 7, 2026
bd2cbb8
feat(memory-ui): add memory saved notification and memory count badge
LaZzyMan Apr 8, 2026
9987f05
fix(memory-ui): auto-approve memory writes, collapse memory tool grou…
LaZzyMan Apr 8, 2026
ece00d6
fix(memory-ui): fix duplicate notification, broken ctrl+o, and Edit t…
LaZzyMan Apr 8, 2026
81d8d81
fix(dream): run /dream as a visible submit_prompt turn, not a silent …
LaZzyMan Apr 8, 2026
7898f59
fix(memory): auto-allow ls/glob/grep on memory base directory
LaZzyMan Apr 8, 2026
3ccba8a
fix(background): prevent permission prompt hangs in background agents
LaZzyMan Apr 8, 2026
37c8e6f
fix(memory): run auto extract through forked agent
LaZzyMan Apr 8, 2026
1737e27
refactor(memory): remove legacy extract fallback pipeline
LaZzyMan Apr 8, 2026
458843c
refactor(memory): move auxiliary files out of memory/ directory
LaZzyMan Apr 9, 2026
6298393
fix(memory): record lastDreamAt after manual /dream run
LaZzyMan Apr 9, 2026
53b239e
fix(memory): remove scope params from /remember in managed auto-memor…
LaZzyMan Apr 9, 2026
d331165
feat(ui): show '✦ dreaming' indicator in footer during background dream
LaZzyMan Apr 9, 2026
21c3f5a
refactor(memory): align dream/extract infrastructure with Claude Code…
LaZzyMan Apr 9, 2026
4073286
docs(memory): add user-facing memory docs, i18n for all locales, simp…
LaZzyMan Apr 10, 2026
dab99a3
merge main branch
LaZzyMan Apr 10, 2026
a35afce
refactor(memory): remove all Claude Code references from comments and…
LaZzyMan Apr 10, 2026
5203141
test(memory): remove empty placeholder test files that cause vitest t…
LaZzyMan Apr 10, 2026
03b6751
fix eslint
LaZzyMan Apr 10, 2026
303299f
fix test in windows
LaZzyMan Apr 10, 2026
69aaf53
fix test
LaZzyMan Apr 10, 2026
601d1a8
fix(memory): address critical review findings from PR #3087
LaZzyMan Apr 10, 2026
5cd4908
fix(memory): replace isAutoMemPath startsWith with path.relative()
LaZzyMan Apr 10, 2026
79d8418
feat(telemetry): add auto-memory telemetry instrumentation
LaZzyMan Apr 10, 2026
465fb05
refactor(telemetry): remove memory forget/remember telemetry events
LaZzyMan Apr 10, 2026
b74674d
change default value
LaZzyMan Apr 13, 2026
d7c07ed
Merge remote-tracking branch 'origin/main' into feat/auto-memory
LaZzyMan Apr 13, 2026
12acb93
fix forked agent
LaZzyMan Apr 13, 2026
61b320b
refactor(background): unify fork primitives into runForkedAgent + cle…
LaZzyMan Apr 13, 2026
8954b57
Merge remote-tracking branch 'origin/main' into feat/auto-memory
LaZzyMan Apr 13, 2026
d80f88d
fix(memory): address wenshao's critical review findings
LaZzyMan Apr 14, 2026
7a10c5e
fix test
LaZzyMan Apr 14, 2026
02d3895
fix ci test
LaZzyMan Apr 14, 2026
e58b24f
Merge remote-tracking branch 'origin/main' into feat/auto-memory
LaZzyMan Apr 14, 2026
33f7329
feat(memory): align extract/dream agents to Claude Code patterns
LaZzyMan Apr 14, 2026
4f9cc4e
move doc to design
LaZzyMan Apr 14, 2026
b84fef8
refactor(memory): unify extract+dream background task management into…
LaZzyMan Apr 15, 2026
f9ec977
refactor(background): introduce general-purpose BackgroundTaskHub
LaZzyMan Apr 15, 2026
2bf6de7
test(background): add BackgroundTaskHub unit tests and hub isolation …
LaZzyMan Apr 15, 2026
3dba6b7
refactor(memory): consolidate all memory state into MemoryManager
LaZzyMan Apr 16, 2026
b031234
Merge remote-tracking branch 'origin/main' into feat/auto-memory
LaZzyMan Apr 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
509 changes: 509 additions & 0 deletions docs/design/auto-memory/memory-system.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/developers/tools/_meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default {
'exit-plan-mode': 'Exit Plan Mode',
'web-fetch': 'Web Fetch',
'web-search': 'Web Search',
memory: 'Memory',
'mcp-server': 'MCP Servers',
sandbox: 'Sandboxing',
};
44 changes: 0 additions & 44 deletions docs/developers/tools/memory.md

This file was deleted.

Empty file removed docs/users/configuration/memory.md
Empty file.
9 changes: 9 additions & 0 deletions docs/users/configuration/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,15 @@ If you are experiencing performance issues with file searching (e.g., with `@` c
>
> **Migrating from `tools.core` / `tools.exclude` / `tools.allowed`:** These legacy settings are **deprecated** and automatically migrated to the new `permissions` format on first load. Prefer configuring `permissions.allow` / `permissions.deny` directly. Use `/permissions` to manage rules interactively.

#### memory

| Setting | Type | Description | Default |
| -------------------------------- | ------- | --------------------------------------------------------------------------------- | ------- |
| `memory.enableManagedAutoMemory` | boolean | Enable background extraction of memories from conversations. | `true` |
| `memory.enableManagedAutoDream` | boolean | Enable automatic consolidation (deduplication and cleanup) of collected memories. | `false` |

See [Memory](../features/memory) for details on how auto-memory works and how to use the `/memory`, `/remember`, and `/dream` commands.

#### permissions

The permissions system provides fine-grained control over which tools can run, which require confirmation, and which are blocked.
Expand Down
1 change: 1 addition & 0 deletions docs/users/features/_meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default {
'sub-agents': 'SubAgents',
arena: 'Agent Arena',
skills: 'Skills',
memory: 'Memory',
headless: 'Headless Mode',
checkpointing: {
display: 'hidden',
Expand Down
5 changes: 4 additions & 1 deletion docs/users/features/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ Commands for managing AI tools and models.
| `/model` | Switch model used in current session | `/model` |
| `/model --fast` | Set a lighter model for prompt suggestions | `/model --fast qwen3-coder-flash` |
| `/extensions` | List all active extensions in current session | `/extensions` |
| `/memory` | Manage AI's instruction context | `/memory add Important Info` |
| `/memory` | Open the Memory Manager dialog | `/memory` |
| `/remember` | Save a durable memory | `/remember Prefer terse responses` |
| `/forget` | Remove matching entries from auto-memory | `/forget <query>` |
| `/dream` | Manually run auto-memory consolidation | `/dream` |

### 1.5 Built-in Skills

Expand Down
166 changes: 166 additions & 0 deletions docs/users/features/memory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# Memory

Every Qwen Code session starts with a fresh context window. Two mechanisms carry knowledge across sessions so you don't have to re-explain yourself every time:

- **QWEN.md** — instructions *you* write once and Qwen reads every session
- **Auto-memory** — notes Qwen writes itself based on what it learns from you

---

## QWEN.md: your instructions to Qwen

QWEN.md is a plain text file where you write things Qwen should always know about your project or your preferences. Think of it as a permanent briefing that loads at the start of every conversation.

### What to put in QWEN.md

Add things you'd otherwise have to repeat every session:

- Build and test commands (`npm run test`, `make build`)
- Coding conventions your team follows ("all new files must have JSDoc comments")
- Architectural decisions ("we use the repository pattern, never call the database directly from controllers")
- Personal preferences ("always use pnpm, not npm")

Don't include things Qwen can figure out by reading your code. QWEN.md works best when it's short and specific — the longer it gets, the less reliably Qwen follows it.

### Where to create QWEN.md

| File | Who it applies to |
|---|---|
| `~/.qwen/QWEN.md` | You, across all your projects |
| `QWEN.md` in the project root | Your whole team (commit it to source control) |

You can have both. Qwen loads all QWEN.md files it finds when you start a session — your personal one plus any in the project.

If your repository already has an `AGENTS.md` file for other AI tools, Qwen reads that too. No need to duplicate instructions.

### Generate one automatically with `/init`

Run `/init` and Qwen will analyze your codebase to create a starter QWEN.md with build commands, test instructions, and conventions it finds. If one already exists, it suggests additions instead of overwriting.

### Reference other files

You can point QWEN.md at other files so Qwen reads them too:

```markdown
See @README.md for project overview.

# Conventions
- Git workflow: @docs/git-workflow.md
```

Use `@path/to/file` anywhere in QWEN.md. Relative paths resolve from the QWEN.md file itself.

---

## Auto-memory: what Qwen learns about you

Auto-memory runs in the background. After each of your conversations, Qwen quietly saves useful things it learned — your preferences, feedback you gave, project context — so it can use them in future sessions without you repeating yourself.

This is different from QWEN.md: you don't write it, Qwen does.

### What Qwen saves

Qwen looks for four kinds of things worth remembering:

| What | Examples |
|---|---|
| **About you** | Your role, background, how you like to work |
| **Your feedback** | Corrections you made, approaches you confirmed |
| **Project context** | Ongoing work, decisions, goals not obvious from the code |
| **External references** | Dashboards, ticket trackers, docs links you mentioned |

Qwen doesn't save everything — only things that would actually be useful next time.

### Where it's stored

Auto-memory files live at `~/.qwen/projects/<project>/memory/`. All branches and worktrees of the same repository share the same memory folder, so what Qwen learns in one branch is available in others.

Everything saved is plain markdown — you can open, edit, or delete any file at any time.

### Periodic cleanup

Qwen periodically goes through its saved memories to remove duplicates and clean up outdated entries. This runs automatically in the background once a day after enough sessions have accumulated. You can trigger it manually with `/dream` if you want it to run now.

While cleanup is running, **✦ dreaming** appears in the corner of the screen. Your session continues normally.

### Turning it on or off

Auto-memory is on by default. To toggle it, open `/memory` and use the switches at the top. You can turn off just the automatic saving, just the periodic cleanup, or both.

You can also set them in `~/.qwen/settings.json` (applies to all projects) or `.qwen/settings.json` (this project only):

```json
{
"memory": {
"enableManagedAutoMemory": true,
"enableManagedAutoDream": true
}
}
```

---

## Commands

### `/memory`

Opens the Memory panel. From here you can:

- Turn auto-memory saving on or off
- Turn periodic cleanup (dream) on or off
- Open your personal QWEN.md (`~/.qwen/QWEN.md`)
- Open the project QWEN.md
- Browse the auto-memory folder

### `/init`

Generates a starter QWEN.md for your project. Qwen reads your codebase and fills in build commands, test instructions, and conventions it discovers.

### `/remember <text>`

Immediately saves something to auto-memory without waiting for Qwen to pick it up automatically:

```
/remember always use snake_case for Python variable names
/remember the staging environment is at staging.example.com
```

### `/forget <text>`

Removes auto-memory entries that match your description:

```
/forget old workaround for the login bug
```

### `/dream`

Runs the memory cleanup now instead of waiting for the automatic schedule:

```
/dream
```

---

## Troubleshooting

### Qwen isn't following my QWEN.md

Open `/memory` to see which files are loaded. If your file isn't listed, Qwen can't see it — make sure it's in the project root or `~/.qwen/`.

Instructions work better when they're specific:
- ✓ `Use 2-space indentation for TypeScript files`
- ✗ `Format code nicely`

If you have multiple QWEN.md files with conflicting instructions, Qwen may behave inconsistently. Review them and remove any contradictions.

### I want to see what Qwen has saved

Run `/memory` and select **Open auto-memory folder**. All saved memories are readable markdown files you can browse, edit, or delete.

### Qwen keeps forgetting things

If auto-memory is on but Qwen doesn't seem to remember things across sessions, try running `/dream` to force a cleanup pass. Also check `/memory` to confirm both toggles are enabled.

For things you always want Qwen to remember, add them to QWEN.md instead — auto-memory is best-effort, QWEN.md is guaranteed.
2 changes: 1 addition & 1 deletion integration-tests/globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import * as os from 'node:os';
import {
QWEN_CONFIG_DIR,
DEFAULT_CONTEXT_FILENAME,
} from '../packages/core/src/tools/memoryTool.js';
} from '@qwen-code/qwen-code-core/src/memory/const.js';

const __dirname = dirname(fileURLToPath(import.meta.url));
const rootDir = join(__dirname, '..');
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,9 @@ export async function loadCliConfig(
output: {
format: outputSettingsFormat,
},
enableManagedAutoMemory: settings.memory?.enableManagedAutoMemory ?? true,
enableManagedAutoDream: settings.memory?.enableManagedAutoDream ?? false,
fastModel: settings.fastModel || undefined,
// Use separated hooks if provided, otherwise fall back to merged hooks
userHooks: hooksConfig?.userHooks ?? settings.hooks,
projectHooks: hooksConfig?.projectHooks,
Expand Down
32 changes: 32 additions & 0 deletions packages/cli/src/config/settingsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,38 @@ const SETTINGS_SCHEMA = {
},
},

memory: {
type: 'object',
label: 'Memory',
category: 'Memory',
requiresRestart: false,
default: {},
description: 'Settings for managed auto-memory.',
showInDialog: false,
properties: {
enableManagedAutoMemory: {
type: 'boolean',
label: 'Enable Managed Auto-Memory',
category: 'Memory',
requiresRestart: false,
default: true,
description:
'Enable background extraction of memories from conversations.',
showInDialog: false,
},
enableManagedAutoDream: {
type: 'boolean',
label: 'Enable Managed Auto-Dream',
category: 'Memory',
requiresRestart: false,
default: false,
description:
'Enable automatic consolidation (dream) of collected memories.',
showInDialog: false,
},
},
},

permissions: {
type: 'object',
label: 'Permissions',
Expand Down
39 changes: 39 additions & 0 deletions packages/cli/src/i18n/locales/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,45 @@ export default {
'Verwendung: /memory add [--global|--project] <zu merkender Text>',
'Attempting to save to memory {{scope}}: "{{fact}}"':
'Versuche im Speicher {{scope}} zu speichern: "{{fact}}"',
'Open auto-memory folder': 'Auto-Speicher-Ordner öffnen',
'Auto-memory: {{status}}': 'Auto-Speicher: {{status}}',
'Auto-dream: {{status}} · {{lastDream}} · /dream to run':
'Auto-Konsolidierung: {{status}} · {{lastDream}} · /dream zum Ausführen',
never: 'nie',
on: 'ein',
off: 'aus',
'❆ dreaming': '❆ konsolidiert',
'Remove matching entries from managed auto-memory.':
'Passende Einträge aus dem verwalteten Auto-Speicher entfernen.',
'Usage: /forget <memory text to remove>':
'Verwendung: /forget <zu entfernender Erinnerungstext>',
'No managed auto-memory entries matched: {{query}}':
'Keine verwalteten Auto-Speicher-Einträge gefunden: {{query}}',
'Show managed auto-memory status.':
'Status des verwalteten Auto-Speichers anzeigen.',
'Run managed auto-memory extraction for the current session.':
'Verwaltete Auto-Speicher-Extraktion für die aktuelle Sitzung ausführen.',
'Managed auto-memory root: {{root}}':
'Verwalteter Auto-Speicher-Stamm: {{root}}',
'Managed auto-memory topics:': 'Verwaltete Auto-Speicher-Themen:',
'No extraction cursor found yet.': 'Noch kein Extraktions-Cursor gefunden.',
'Cursor: session={{sessionId}}, offset={{offset}}, updated={{updatedAt}}':
'Cursor: Sitzung={{sessionId}}, Offset={{offset}}, Aktualisiert={{updatedAt}}',
'No chat client available to extract memory.':
'Kein Chat-Client verfügbar, um Erinnerungen zu extrahieren.',
'Managed auto-memory extraction is already running.':
'Verwaltete Auto-Speicher-Extraktion läuft bereits.',
'Managed auto-memory extraction found no new durable memories.':
'Verwaltete Auto-Speicher-Extraktion hat keine neuen dauerhaften Erinnerungen gefunden.',
'Consolidate managed auto-memory topic files.':
'Verwaltete Auto-Speicher-Themendateien konsolidieren.',
'Managed auto-memory dream found nothing to improve.':
'Auto-Speicher-Konsolidierung hat nichts zu verbessern gefunden.',
'Deduplicated entries: {{count}}': 'Deduplizierte Einträge: {{count}}',
'Save a durable memory using the save_memory tool.':
'Eine dauerhafte Erinnerung mit dem save_memory-Tool speichern.',
'Usage: /remember [--global|--project] <text to remember>':
'Verwendung: /remember [--global|--project] <zu merkender Text>',

// ============================================================================
// Commands - MCP
Expand Down
Loading
Loading