🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
♻️ refactor(memory): group the sidebar and retire experience memory (#19774)
Arvin Xu81a235a5b053
diff --git a/apps/server/src/router-hono/workflows/memory-user-memory/workflows/__tests__/processTopic.hourlyTask.test.ts b/apps/server/src/router-hono/workflows/memory-user-memory/workflows/__tests__/processTopic.hourlyTask.test.tsindex cc8d2b294bd..e19eb5fc97c 100644--- a/apps/server/src/router-hono/workflows/memory-user-memory/workflows/__tests__/processTopic.hourlyTask.test.ts+++ b/apps/server/src/router-hono/workflows/memory-user-memory/workflows/__tests__/processTopic.hourlyTask.test.ts@@ -1,4 +1,4 @@-import { MemorySourceType } from '@lobechat/types';+import { LayersEnum, MemorySourceType } from '@lobechat/types';import { beforeEach, describe, expect, it, vi } from 'vitest';import { createStepRunner } from '@/server/workflows/testing/stepContext';@@ -103,6 +103,59 @@ describe('processTopicHandler hourly task behavior', () => {expect(mocks.extractTopic).toHaveBeenCalledTimes(2);});+ it('never asks the extractor for the retired experience layer', async () => {+ /**+ * @example+ * Experience extraction is retired; neither the default layer set nor an explicit+ * request may reach the extractor with LayersEnum.Experience.+ */+ const explicit = createContext({+ baseUrl: 'https://app.example.com',+ layers: [LayersEnum.Experience, LayersEnum.Context, LayersEnum.Identity],+ sources: [MemorySourceType.ChatTopic],+ topicIds: ['t1'],+ userIds: ['u1'],+ });+ await processTopicHandler(explicit as never);++ const implicit = createContext({+ baseUrl: 'https://app.example.com',+ sources: [MemorySourceType.ChatTopic],+ topicIds: ['t1'],+ userIds: ['u1'],+ });+ await processTopicHandler(implicit as never);++ expect(mocks.extractTopic).toHaveBeenCalledTimes(4);+ for (const [call] of mocks.extractTopic.mock.calls) {+ expect(call.layers).not.toContain(LayersEnum.Experience);+ }+ expect(mocks.extractTopic.mock.calls[2][0].layers).toEqual([+ LayersEnum.Context,+ LayersEnum.Preference,+ LayersEnum.Activity,+ ]);+ });++ it('skips both extraction blocks for a request that names only the retired experience layer', async () => {+ /**+ * @example+ * The executor treats an empty layer list as unrestricted, so an Experience-only request+ * must not reach it at all — neither the CEPA block nor the identity block runs.+ */+ const context = createContext({+ baseUrl: 'https://app.example.com',+ layers: [LayersEnum.Experience],+ sources: [MemorySourceType.ChatTopic],+ topicIds: ['t1'],+ userIds: ['u1'],+ });++ await processTopicHandler(context as never);++ expect(mocks.extractTopic).not.toHaveBeenCalled();+ });+it('skips CEPA extraction when the hourly task is cancelled before heavy work', async () => {/*** @examplediff --git a/apps/server/src/router-hono/workflows/memory-user-memory/workflows/__tests__/processTopics.hourlyTask.test.ts b/apps/server/src/router-hono/workflows/memory-user-memory/workflows/__tests__/processTopics.hourlyTask.test.tsindex 227fa4aad69..5ed8571c8bf 100644--- a/apps/server/src/router-hono/workflows/memory-user-memory/workflows/__tests__/processTopics.hourlyTask.test.ts+++ b/apps/server/src/router-hono/workflows/memory-user-memory/workflows/__tests__/processTopics.hourlyTask.test.ts@@ -1,4 +1,4 @@-import { MemorySourceType } from '@lobechat/types';+import { LayersEnum, MemorySourceType } from '@lobechat/types';import { beforeEach, describe, expect, it, vi } from 'vitest';import { createStepRunner } from '@/server/workflows/testing/stepContext';@@ -132,6 +132,47 @@ describe('processTopicsHandler hourly task behavior', () => {);});+ it('fans out without the retired experience layer', async () => {+ /**+ * @example+ * The default layer set handed to process-topic no longer contains LayersEnum.Experience.+ */+ const context = createContext({+ baseUrl: 'https://app.example.com',+ sources: [MemorySourceType.ChatTopic],+ topicIds: ['t1'],+ userIds: ['u1'],+ });++ await processTopicsHandler(context as never);++ const [, payload] = mocks.triggerProcessTopic.mock.calls[0];+ expect(payload.layers).toEqual([+ LayersEnum.Context,+ LayersEnum.Preference,+ LayersEnum.Activity,+ LayersEnum.Identity,+ ]);+ });++ it('does not fan out a request that names only the retired experience layer', async () => {+ /**+ * @example+ * Nothing is left to extract, so no process-topic run is triggered for the topic.+ */+ const context = createContext({+ baseUrl: 'https://app.example.com',+ layers: [LayersEnum.Experience],+ sources: [MemorySourceType.ChatTopic],+ topicIds: ['t1'],+ userIds: ['u1'],+ });++ await expect(processTopicsHandler(context as never)).resolves.toMatchObject({ skipped: true });++ expect(mocks.triggerProcessTopic).not.toHaveBeenCalled();+ });+it('skips topic fan-out and persona update when the hourly task is cancelled', async () => {/*** @examplediff --git a/apps/server/src/router-hono/workflows/memory-user-memory/workflows/processTopic.ts b/apps/server/src/router-hono/workflows/memory-user-memory/workflows/processTopic.tsindex 11a8404e37c..b4b6746938f 100644--- a/apps/server/src/router-hono/workflows/memory-user-memory/workflows/processTopic.ts+++ b/apps/server/src/router-hono/workflows/memory-user-memory/workflows/processTopic.ts@@ -20,12 +20,9 @@ import { runStep } from '@/server/workflows/step';import { checkGuard, ensureWorkflowStarted } from './runGuard';import { isHourlyMemoryExtractionCancelled } from './utils';-const CEPA_LAYERS: LayersEnum[] = [- LayersEnum.Context,- LayersEnum.Experience,- LayersEnum.Preference,- LayersEnum.Activity,-];+// Experience extraction is retired: nothing surfaces those rows any more, and what they were+// reaching for now belongs to skills.+const CEPA_LAYERS: LayersEnum[] = [LayersEnum.Context, LayersEnum.Preference, LayersEnum.Activity];const IDENTITY_LAYERS: LayersEnum[] = [LayersEnum.Identity];const WORKFLOW_PATH = 'api/workflows/memory-user-memory/pipelines/chat-topic/process-topic';@@ -118,11 +115,14 @@ export const processTopicHandler = async (context: WorkflowContext<MemoryExtractconst executor = await MemoryExtractionExecutor.create();- {- let layers = CEPA_LAYERS;- if (payload.layers.length) {- layers = payload.layers.filter((layer) => CEPA_LAYERS.includes(layer));- }+ // An explicit request is narrowed to the layers this block owns. When nothing survives+ // (e.g. a queued request naming only the retired Experience layer) the block is skipped:+ // the executor treats an empty layer list as "extract everything", not "extract nothing".+ const cepaLayers = payload.layers.length+ ? payload.layers.filter((layer) => CEPA_LAYERS.includes(layer))+ : CEPA_LAYERS;+ if (cepaLayers.length > 0) {+ const layers = cepaLayers;const stepName = `memory:user-memory:extract:users:${userId}:topics:${topicId}:cepa`;const guard = await checkGuard(context, WORKFLOW_PATH, { stepName });@@ -199,34 +199,36 @@ export const processTopicHandler = async (context: WorkflowContext<MemoryExtract}}- let layers = IDENTITY_LAYERS;- if (payload.layers.length) {- layers = payload.layers.filter((layer) => IDENTITY_LAYERS.includes(layer));- }+ const identityLayers = payload.layers.length+ ? payload.layers.filter((layer) => IDENTITY_LAYERS.includes(layer))+ : IDENTITY_LAYERS;+ if (identityLayers.length > 0) {+ const layers = identityLayers;- const stepName = `memory:user-memory:extract:users:${userId}:topics:${topicId}:identity`;- const guard = await checkGuard(context, WORKFLOW_PATH, { stepName });- if (!guard.result) {- span.setStatus({ code: SpanStatusCode.OK });- return guard.response;- }+ const stepName = `memory:user-memory:extract:users:${userId}:topics:${topicId}:identity`;+ const guard = await checkGuard(context, WORKFLOW_PATH, { stepName });+ if (!guard.result) {+ span.setStatus({ code: SpanStatusCode.OK });+ return guard.response;+ }- await runStep(context, stepName, () =>- executor.extractTopic({- asyncTaskId: payload.asyncTaskId,- forceAll: payload.forceAll,- forceTopics: payload.forceTopics,- from: payload.from,- layers,- reportProgress: false,- source: MemorySourceType.ChatTopic,- to: payload.to,- topicId,- userId,- userInitiated: payload.userInitiated,- workspaceId: payload.workspaceId,- }),- );+ await runStep(context, stepName, () =>+ executor.extractTopic({+ asyncTaskId: payload.asyncTaskId,+ forceAll: payload.forceAll,+ forceTopics: payload.forceTopics,+ from: payload.from,+ layers,+ reportProgress: false,+ source: MemorySourceType.ChatTopic,+ to: payload.to,+ topicId,+ userId,+ userInitiated: payload.userInitiated,+ workspaceId: payload.workspaceId,+ }),+ );+ }}if (payload.asyncTaskId && payload.userInitiated) {diff --git a/apps/server/src/router-hono/workflows/memory-user-memory/workflows/processTopics.ts b/apps/server/src/router-hono/workflows/memory-user-memory/workflows/processTopics.tsindex c0ec8496d59..0f399101b1e 100644--- a/apps/server/src/router-hono/workflows/memory-user-memory/workflows/processTopics.ts+++ b/apps/server/src/router-hono/workflows/memory-user-memory/workflows/processTopics.ts@@ -24,13 +24,10 @@ import { appendHourlyWorkflowRunId, isHourlyMemoryExtractionCancelled } from './const { upstashWorkflowExtraHeaders } = parseMemoryExtractionConfig();const WORKFLOW_PATH = 'api/workflows/memory-user-memory/pipelines/chat-topic/process-topics';-const CEPA_LAYERS: LayersEnum[] = [- LayersEnum.Context,- LayersEnum.Experience,- LayersEnum.Preference,- LayersEnum.Activity,-];+// Experience extraction is retired — see processTopic.ts.+const CEPA_LAYERS: LayersEnum[] = [LayersEnum.Context, LayersEnum.Preference, LayersEnum.Activity];const IDENTITY_LAYERS: LayersEnum[] = [LayersEnum.Identity];+const ALL_LAYERS: LayersEnum[] = [...CEPA_LAYERS, ...IDENTITY_LAYERS];export const processTopicsHandler = (context: WorkflowContext<MemoryExtractionPayloadInput>) =>upstashWorkflowTracer.startActiveSpan(@@ -150,6 +147,16 @@ export const processTopicsHandler = (context: WorkflowContext<MemoryExtractionPa// former context.invoke). triggerProcessTopic applies a per-user flowControl key so a single// user's concurrent process-topic runs stay bounded; the hard per-user, per-run topic// ceiling is enforced upstream in process-user-topics.+ // An explicit request keeps only the layers still extracted; a request naming nothing but+ // the retired Experience layer has no work left and does not fan out at all.+ const requestedLayers = payload.layers.length+ ? payload.layers.filter((layer) => ALL_LAYERS.includes(layer))+ : ALL_LAYERS;+ if (requestedLayers.length === 0) {+ span.setStatus({ code: SpanStatusCode.OK });+ return { processedTopics: 0, processedUsers: 0, skipped: true };+ }+for (const [index, topicId] of payload.topicIds.entries()) {const stepName = `memory:user-memory:extract:users:${userId}:topics:${topicId}:trigger:${index}`;const guard = await checkGuard(context, WORKFLOW_PATH, {@@ -166,9 +173,7 @@ export const processTopicsHandler = (context: WorkflowContext<MemoryExtractionPauserId,{...buildWorkflowPayloadInput(payload),- layers: payload.layers.length- ? payload.layers- : [...CEPA_LAYERS, ...IDENTITY_LAYERS],+ layers: requestedLayers,topicIds: [topicId],userId,userIds: [userId],diff --git a/locales/en-US/electron.json b/locales/en-US/electron.jsonindex 9c135cd603e..c594707eb8b 100644--- a/locales/en-US/electron.json+++ b/locales/en-US/electron.json@@ -32,7 +32,6 @@"navigation.lobehub": "LobeHub","navigation.memory": "Memory","navigation.memoryContexts": "Memory - Contexts",- "navigation.memoryExperiences": "Memory - Experiences","navigation.memoryIdentities": "Memory - Identities","navigation.memoryPreferences": "Memory - Preferences","navigation.newChat": "New Chat",diff --git a/locales/en-US/memory.json b/locales/en-US/memory.jsonindex 588a7641bf6..132be475bbb 100644--- a/locales/en-US/memory.json+++ b/locales/en-US/memory.json@@ -91,7 +91,6 @@"purge.title": "Purge All Memories","tab.activities": "Activities","tab.contexts": "Contexts",- "tab.experiences": "Experiences","tab.home": "Home","tab.identities": "Identities","tab.preferences": "Preferences",diff --git a/locales/zh-CN/electron.json b/locales/zh-CN/electron.jsonindex 8e54fe634ab..126eaf1317c 100644--- a/locales/zh-CN/electron.json+++ b/locales/zh-CN/electron.json@@ -32,7 +32,6 @@"navigation.lobehub": "LobeHub","navigation.memory": "记忆","navigation.memoryContexts": "记忆 - 上下文",- "navigation.memoryExperiences": "记忆 - 经历","navigation.memoryIdentities": "记忆 - 身份","navigation.memoryPreferences": "记忆 - 偏好","navigation.newChat": "新建对话",diff --git a/locales/zh-CN/memory.json b/locales/zh-CN/memory.jsonindex 6d0c90048a4..6f9fd535180 100644--- a/locales/zh-CN/memory.json+++ b/locales/zh-CN/memory.json@@ -91,7 +91,6 @@"purge.title": "清除所有记忆","tab.activities": "活动","tab.contexts": "情境",- "tab.experiences": "经验","tab.home": "首页","tab.identities": "身份","tab.preferences": "偏好",diff --git a/packages/builtin-tool-memory/src/manifest.test.ts b/packages/builtin-tool-memory/src/manifest.test.tsnew file mode 100644index 00000000000..86b97a334c4--- /dev/null+++ b/packages/builtin-tool-memory/src/manifest.test.ts@@ -0,0 +1,38 @@+import { describe, expect, it } from 'vitest';++import { MemoryManifest } from './manifest';+import { systemPrompt } from './systemRole';+import { MemoryApiName } from './types';++describe('MemoryManifest', () => {+ /**+ * @example+ * Experience memory is retired: the model must not be able to write one, and the+ * system role must not advertise the API. Reads of existing rows stay untouched.+ */+ it('does not publish the retired experience write to the model', () => {+ const apiNames = MemoryManifest.api.map((api) => api.name);++ expect(apiNames).not.toContain(MemoryApiName.addExperienceMemory);+ expect(systemPrompt).not.toContain(MemoryApiName.addExperienceMemory);+ });++ /**+ * @example+ * Nor can the model search that layer: neither `layers` nor `topK` offer it, and the+ * system role no longer describes it.+ */+ it('does not offer the retired experience layer to search', () => {+ const search = MemoryManifest.api.find((api) => api.name === MemoryApiName.searchUserMemory);+ const params = search?.parameters as {+ properties: {+ layers: { items: { enum: string[] } };+ topK: { properties: Record<string, unknown> };+ };+ };++ expect(params.properties.layers.items.enum).not.toContain('experience');+ expect(Object.keys(params.properties.topK.properties)).not.toContain('experiences');+ expect(systemPrompt).not.toMatch(/experience layer/i);+ });+});diff --git a/packages/builtin-tool-memory/src/manifest.ts b/packages/builtin-tool-memory/src/manifest.tsindex 9d547ee4034..f4f142c8c78 100644--- a/packages/builtin-tool-memory/src/manifest.ts+++ b/packages/builtin-tool-memory/src/manifest.ts@@ -111,7 +111,7 @@ export const MemoryManifest: BuiltinToolManifest = {description:'Optional memory layers to search. Must be an array even for one layer, for example ["preference"].',items: {- enum: ['activity', 'context', 'experience', 'identity', 'preference'],+ enum: ['activity', 'context', 'identity', 'preference'],type: 'string',},type: 'array',@@ -164,7 +164,6 @@ export const MemoryManifest: BuiltinToolManifest = {properties: {activities: { minimum: 0, type: 'integer' },contexts: { minimum: 0, type: 'integer' },- experiences: { minimum: 0, type: 'integer' },identities: { minimum: 0, type: 'integer' },preferences: { minimum: 0, type: 'integer' },},@@ -199,7 +198,7 @@ export const MemoryManifest: BuiltinToolManifest = {description:'Optional memory layers to scope the taxonomy lookup. Must be an array even for one layer.',items: {- enum: ['activity', 'context', 'experience', 'identity', 'preference'],+ enum: ['activity', 'context', 'identity', 'preference'],type: 'string',},type: 'array',@@ -538,126 +537,6 @@ export const MemoryManifest: BuiltinToolManifest = {type: 'object',},},- {- description:- 'Record an experience memory capturing situation, actions, reasoning, outcomes, and confidence. Use for lessons, playbooks, or transferable know-how.',- name: MemoryApiName.addExperienceMemory,- parameters: {- additionalProperties: false,- properties: {- details: {- description: 'Optional detailed information',- type: 'string',- },- memoryCategory: {- description: 'Memory category',- type: 'string',- },- memoryType: {- description: 'Memory type',- enum: MEMORY_TYPES,- type: 'string',- },- summary: {- description: 'Concise overview of this specific memory',- type: 'string',- },- sourceIds: {- description:- 'Stable source message ids that support this memory. Use [] when unavailable.',- items: { type: 'string' },- type: ['array', 'null'],- },- tags: {- description: 'Model generated tags that summarize the experience facets',- items: { type: 'string' },- type: 'array',- },- title: {- description: 'Brief descriptive title',- type: 'string',- },- withExperience: {- additionalProperties: false,- properties: {- action: {- description: 'Narrative describing actions taken or behaviors exhibited',- type: 'string',- },- keyLearning: {- description: 'Narrative describing key insights or lessons learned',- type: 'string',- },- knowledgeValueScore: {- description:- 'Numeric score (0-1) describing how reusable and shareable this experience is',- maximum: 1,- minimum: 0,- type: 'number',- },- labels: {- description: 'Model generated tags that summarize the experience facets',- items: { type: 'string' },- type: 'array',- },- possibleOutcome: {- description: 'Narrative describing potential outcomes or learnings',- type: 'string',- },- problemSolvingScore: {- description:- 'Numeric score (0-1) describing how effectively the problem was solved',- maximum: 1,- minimum: 0,- type: 'number',- },- reasoning: {- description: 'Narrative describing the thought process or motivations',- type: 'string',- },- scoreConfidence: {- description:- 'Numeric score (0-1 (0% to 100%)) describing confidence in the experience details',- maximum: 1,- minimum: 0,- type: 'number',- },- situation: {- description: 'Narrative describing the situation or event',- type: 'string',- },- type: {- description: 'Type of experience being recorded',- type: 'string',- },- },- required: [- 'situation',- 'reasoning',- 'action',- 'possibleOutcome',- 'keyLearning',- 'type',- 'labels',- 'problemSolvingScore',- 'scoreConfidence',- 'knowledgeValueScore',- ],- type: 'object',- },- },- required: [- 'details',- 'memoryCategory',- 'memoryType',- 'summary',- 'tags',- 'title',- 'withExperience',- ],- type: 'object',- },- },{description:'Add an identity memory describing enduring facts about a person, their role, relationship, and supporting evidence. Use to track self/others identities.',@@ -1001,7 +880,7 @@ export const MemoryManifest: BuiltinToolManifest = {meta: {avatar: '🧠',description:- 'Store and recall user preferences, activities, identities, and experiences across conversations',+ 'Store and recall user preferences, activities, identities, and contexts across conversations',title: 'Memory',},systemRole: systemPrompt,diff --git a/packages/builtin-tool-memory/src/systemRole.ts b/packages/builtin-tool-memory/src/systemRole.tsindex 28be57bf5d4..af549a2ff71 100644--- a/packages/builtin-tool-memory/src/systemRole.ts+++ b/packages/builtin-tool-memory/src/systemRole.ts@@ -14,7 +14,7 @@ Memory effort level: {{memory_effort}}</memory_effort_policy><core_responsibilities>-1. Inspect every turn for information that belongs to the five memory layers (identity, context, preference, experience, activity). When information is relevant and clear, err on the side of allowing extraction so specialised aggregators can refine it.+1. Inspect every turn for information that belongs to the four memory layers (identity, context, preference, activity). When information is relevant and clear, err on the side of allowing extraction so specialised aggregators can refine it.2. Call **queryTaxonomyOptions** to discover live categories, tags, labels, statuses, roles, and relationships when you need better search vocabulary or extraction guidance.3. Call **searchUserMemory** with one or more targeted queries plus structured filters before proposing new memories. Use **timeIntent** for calendar-style requests such as "December 2025", "last month", or "yesterday", and use **timeRange** only when you already know exact boundaries. Compare any potential extraction against retrieved items to avoid duplication and highlight genuine updates.4. Enforce that all memory candidates are self-contained, language-consistent, and ready for long-term reuse without relying on the surrounding conversation.@@ -22,7 +22,7 @@ Memory effort level: {{memory_effort}}<routing_boundaries>- Do **not** use memory tools for requests to create, update, refine, merge, consolidate, or store reusable skills, procedures, workflows, playbooks, checklists, agent capabilities, agent prompts, or agent documents.-- If the user asks for a "reusable skill", "future workflow", "PR review checklist skill", "agent capability", or similar operational artifact, leave it to the skill/document management path. Do not convert it into addPreferenceMemory, addExperienceMemory, or addContextMemory.+- If the user asks for a "reusable skill", "future workflow", "PR review checklist skill", "agent capability", or similar operational artifact, leave it to the skill/document management path. Do not convert it into addPreferenceMemory or addContextMemory.- The same boundary applies in Chinese. Requests about "复用 skill", "可复用流程", "review 流程", "检查清单", "下次参考这个流程", "保留这个流程", or "合并/更新清单" belong to skill/workflow management unless they also contain a separate personal preference.- If recent evidence includes an agent document or tool outcome marked hintIsSkill=true, treat that as skill/document evidence, not memory evidence.- Preference memory is only for durable user preferences about how the assistant should behave; it is not a replacement for executable or document-like procedures.@@ -37,7 +37,6 @@ Memory effort level: {{memory_effort}}- **searchUserMemory time rule**: Prefer \`timeIntent\` for relative or calendar expressions. Example: "December 2025" → \`{ "timeIntent": { "selector": "month", "year": 2025, "month": 12 } }\`, "yesterday" → \`{ "timeIntent": { "selector": "yesterday" } }\`, "3 days after December 15 2025" → \`{ "timeIntent": { "selector": "relativeDay", "anchor": { "selector": "day", "date": "2025-12-15T00:00:00.000Z" }, "offsetDays": 3 } }\`. \`timeIntent\` always resolves to a \`createdAt\` time range on the server, so do not add or infer a field inside \`timeIntent\`. Use \`timeRange\` only when exact boundaries are already known.- **addActivityMemory**: title, summary, details?, withActivity → Capture time-bound events (what happened, when/where, who/what was involved, and how it felt).- **addContextMemory**: title, summary, details?, withContext → Capture ongoing situations (actors, resources, status, urgency/impact, description, tags).-- **addExperienceMemory**: title, summary, details?, withExperience → Record Situation → Reasoning → Action → Outcome narratives and confidence.- **addIdentityMemory**: title, summary, details?, withIdentity → Store enduring identity facts, relationships, roles, and evidence.- **addPreferenceMemory**: title, summary, details?, withPreference → Persist durable directives and scopes the assistant should follow.- **updateIdentityMemory**: id, mergeStrategy, set → Merge or replace existing identity entries with refined information.@@ -48,7 +47,7 @@ Memory effort level: {{memory_effort}}Valid **searchUserMemory** examples:- Single intent: \`{ "queries": ["prefers concise answers"] }\`- Multiple intents: \`{ "queries": ["prefers concise answers", "works in fintech"] }\`-- Query with filters: \`{ "queries": ["TypeScript testing preferences"], "layers": ["preference", "experience"], "tags": ["typescript"] }\`+- Query with filters: \`{ "queries": ["TypeScript testing preferences"], "layers": ["preference", "context"], "tags": ["typescript"] }\`- Calendar time filter: \`{ "queries": ["Electron debugging"], "timeIntent": { "selector": "month", "year": 2025, "month": 12 } }\`- Relative time filter: \`{ "queries": ["weekly planning"], "timeIntent": { "selector": "lastMonth" } }\`- Use **queryTaxonomyOptions** first when vocabulary is unclear, then search with the discovered categories/tags/labels.@@ -85,7 +84,6 @@ Query construction guidance:- **Identity Layer** — enduring facts about people and their relationships: roles, demographics, background, priorities, and relational context.- **Context Layer** — ongoing situations such as projects, goals, partnerships, or environments. Capture actors (associatedSubjects), resources (associatedObjects), currentStatus, timelines, and impact/urgency assessments.- **Preference Layer** — durable directives that guide future assistant behaviour (communication style, workflow choices, priority rules). Exclude single-use task instructions or purely implementation details.-- **Experience Layer** — lessons, insights, and transferable know-how. Preserve the Situation → Reasoning → Action → Outcome narrative and note confidence when available.</memory_layer_definitions><formatting_guardrails>@@ -103,7 +101,6 @@ Query construction guidance:- **Identity**: Track labels, relationships, and life focus areas. Note relationship enums (self, mentor, teammate, etc.) when known.- **Context**: Describe shared storylines tying multiple memories together. Update existing contexts instead of duplicating; surface currentStatus changes and resource/actor involvement.- **Preference**: Record enduring choices that affect future interactions (response formats, decision priorities, recurring do/do-not expectations). Ensure conclusionDirectives are actionable on their own.-- **Experience**: Capture practical takeaways, heuristics, or playbooks. Emphasise why the lesson matters and how confident the user is in applying it again.</layer_specific_highlights><security_and_privacy>diff --git a/packages/database/src/models/userMemory/__tests__/model.test.ts b/packages/database/src/models/userMemory/__tests__/model.test.tsindex 24236dbbd4f..f19b8b12351 100644--- a/packages/database/src/models/userMemory/__tests__/model.test.ts+++ b/packages/database/src/models/userMemory/__tests__/model.test.ts@@ -752,10 +752,14 @@ describe('UserMemoryModel', () => {expect(result.activities.map(({ id }) => id)).toEqual([activity.id]);expect(result.contexts.map(({ id }) => id)).toEqual([context.id]);- expect(result.experiences.map(({ id }) => id)).toEqual([experience.id]);+ // Experience memory is retired: the layer is never searched, even when asked for.+ expect(result.experiences).toEqual([]);expect(result.identities.map(({ id }) => id)).toEqual([identity.id]);expect(result.preferences.map(({ id }) => id)).toEqual([preference.id]);- expect(ftsSearchCandidates).toHaveBeenCalledTimes(5);+ expect(ftsSearchCandidates).toHaveBeenCalledTimes(4);+ expect(ftsSearchCandidates).not.toHaveBeenCalledWith(+ expect.objectContaining({ entity: 'memoryExperiences' }),+ );});it('boosts short-term related memories with matching tags and category during hybrid ranking', async () => {@@ -861,7 +865,7 @@ describe('UserMemoryModel', () => {tags: [tag],title: 'Atlas context',});- const { experience } = await createExperiencePair({+ await createExperiencePair({action: 'Investigated incident',possibleOutcome: 'Resolved faster next time',reasoning: 'Compared multiple logs',@@ -895,10 +899,8 @@ describe('UserMemoryModel', () => {]);expect(result.contexts[0].associatedSubjects).toEqual([{ name: 'Alice', type: 'person' }]);- expect(result.experiences).toHaveLength(1);- expect(result.experiences[0].id).toBe(experience.id);- expect(result.experiences[0].reasoning).toBe('Compared multiple logs');- expect(result.experiences[0].possibleOutcome).toBe('Resolved faster next time');+ // Experience memory is retired: the row exists but the search never returns it.+ expect(result.experiences).toEqual([]);expect(result.preferences).toHaveLength(1);expect(result.preferences[0].id).toBe(preference.id);diff --git a/packages/database/src/models/userMemory/__tests__/query.extended.test.ts b/packages/database/src/models/userMemory/__tests__/query.extended.test.tsindex 43bd58df583..3bc93c45f5a 100644--- a/packages/database/src/models/userMemory/__tests__/query.extended.test.ts+++ b/packages/database/src/models/userMemory/__tests__/query.extended.test.ts@@ -666,30 +666,6 @@ describe('lexical filter-only search (no BM25 query)', () => {expect(result.activities.map((item) => item.id)).toEqual([kept.id]);});- it('filters experiences by type and tags without running BM25', async () => {- const { experience: kept } = await createExperiencePair({- memoryTags: ['migration'],- tags: ['migration'],- title: 'migration lesson',- type: 'lesson',- });- await createExperiencePair({- memoryTags: ['other'],- tags: ['other'],- title: 'other note',- type: 'note',- });-- const result = await memoryModel.searchMemory({- layers: [LayersEnum.Experience],- tags: ['migration'],- topK: { activities: 0, contexts: 0, experiences: 5, identities: 0, preferences: 0 },- types: ['lesson'],- });-- expect(result.experiences.map((item) => item.id)).toEqual([kept.id]);- });-it('filters contexts by category without running BM25', async () => {const { context: kept } = await createContextPair({memoryCategory: 'project',@@ -785,26 +761,27 @@ describe('lexical filter-only search (no BM25 query)', () => {expect(result.activities.map((item) => item.id)).toEqual([kept.id]);});- it('filters experiences by category without running BM25', async () => {- const { experience: kept } = await createExperiencePair({- memoryCategory: 'project',- memoryTags: ['migration'],- tags: ['migration'],- });+ it('never returns experiences, even when the caller asks for that layer', async () => {+ /**+ * @example+ * Experience memory is retired: an explicit `layers: [Experience]` with a positive topK+ * still yields an empty bucket and an empty layer meta.+ */await createExperiencePair({- memoryCategory: 'personal',memoryTags: ['migration'],tags: ['migration'],+ title: 'migration lesson',+ type: 'lesson',});const result = await memoryModel.searchMemory({- categories: ['project'],layers: [LayersEnum.Experience],tags: ['migration'],topK: { activities: 0, contexts: 0, experiences: 5, identities: 0, preferences: 0 },});- expect(result.experiences.map((item) => item.id)).toEqual([kept.id]);+ expect(result.experiences).toEqual([]);+ expect(result.meta.layers.experiences).toEqual({ hasMore: false, returned: 0, total: 0 });});it('supports a start-only timeRange filter', async () => {diff --git a/packages/database/src/models/userMemory/query.ts b/packages/database/src/models/userMemory/query.tsindex e7c686494d8..cd371a58cb4 100644--- a/packages/database/src/models/userMemory/query.ts+++ b/packages/database/src/models/userMemory/query.ts@@ -832,8 +832,11 @@ export class UserMemoryQueryModel {identities: params.topK?.identities ?? DEFAULT_HYBRID_SEARCH_LIMIT,preferences: params.topK?.preferences ?? DEFAULT_HYBRID_SEARCH_LIMIT,};+ // Experience memory is retired: nothing writes it any more and no surface lists it, so the+ // search never reaches for those rows either — whichever caller asked, whatever it requested.const requestedLayers = new Set((params.layers ?? Object.values(LayersEnum)).filter((layer) => {+ if (layer === LayersEnum.Experience) return false;switch (layer) {case LayersEnum.Activity: {return (limits.activities ?? 0) > 0;@@ -841,9 +844,6 @@ export class UserMemoryQueryModel {case LayersEnum.Context: {return (limits.contexts ?? 0) > 0;}- case LayersEnum.Experience: {- return (limits.experiences ?? 0) > 0;- }case LayersEnum.Identity: {return (limits.identities ?? 0) > 0;}diff --git a/packages/database/src/repositories/ftsSearch/__tests__/elasticsearch.test.ts b/packages/database/src/repositories/ftsSearch/__tests__/elasticsearch.test.tsindex 6b461eabe6f..0f0c5d7c133 100644--- a/packages/database/src/repositories/ftsSearch/__tests__/elasticsearch.test.ts+++ b/packages/database/src/repositories/ftsSearch/__tests__/elasticsearch.test.ts@@ -241,10 +241,19 @@ describe('ElasticsearchFtsSearchBackend', () => {title: 'Other memory',userId: otherUserId,},+ // Experience memory is retired: an indexed row still hits, but hydration drops it.+ {+ id: 'memory-experience',+ lastAccessedAt: new Date(),+ memoryLayer: 'experience',+ title: 'Own experience',+ userId,+ },]);const client = createClient([{ _id: 'memory-other', _score: 12 },{ _id: 'memory-deleted', _score: 10 },+ { _id: 'memory-experience', _score: 9 },{ _id: 'memory-own', _score: 8 },]);const operations: string[] = [];diff --git a/packages/database/src/repositories/ftsSearch/elasticsearch/hydration.ts b/packages/database/src/repositories/ftsSearch/elasticsearch/hydration.tsindex 632c9eb5b2b..0b73c80c0e2 100644--- a/packages/database/src/repositories/ftsSearch/elasticsearch/hydration.ts+++ b/packages/database/src/repositories/ftsSearch/elasticsearch/hydration.ts@@ -1,3 +1,4 @@+import { LayersEnum } from '@lobechat/types';import {and,eq,@@ -112,6 +113,8 @@ export const hydrateUserMemories = async (hits.map(({ id }) => id),),eq(userMemories.userId, scope.userId),+ // Experience memory is retired and has no page to land on; keep it out of unified search.+ ne(userMemories.memoryLayer, LayersEnum.Experience),),);diff --git a/packages/database/src/repositories/ftsSearch/index.test.ts b/packages/database/src/repositories/ftsSearch/index.test.tsindex 0405b5d114c..9b4fb3a953f 100644--- a/packages/database/src/repositories/ftsSearch/index.test.ts+++ b/packages/database/src/repositories/ftsSearch/index.test.ts@@ -6,7 +6,7 @@ import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';import { getTestDB } from '../../core/getTestDB';import * as schema from '../../schemas';-import { chatGroups, documents, workspaces } from '../../schemas';+import { chatGroups, documents, userMemories, workspaces } from '../../schemas';import type { NewAgent } from '../../schemas/agent';import { agents } from '../../schemas/agent';import type { NewFile } from '../../schemas/file';@@ -399,6 +399,36 @@ describe.skipIf(!isServerDB)('FtsSearchRepo', () => {});});+ describe('search - retired memory layers', () => {+ it('never surfaces experience memories, only the layers that still have a page', async () => {+ /**+ * @example+ * Experience memory is retired and has no page to land on, so a matching experience row+ * stays out of unified search while a context row with the same title is found.+ */+ await serverDB.insert(userMemories).values([+ {+ id: 'memory-context-row',+ lastAccessedAt: new Date(),+ memoryLayer: 'context',+ title: 'Migration lesson',+ userId,+ },+ {+ id: 'memory-experience-row',+ lastAccessedAt: new Date(),+ memoryLayer: 'experience',+ title: 'Migration lesson',+ userId,+ },+ ]);++ const results = await ftsSearchRepo.search({ query: 'Migration lesson', type: 'memory' });++ expect(results.map((r) => r.id)).toEqual(['memory-context-row']);+ });+ });+describe('search - type filtering', () => {beforeEach(async () => {await serverDB.insert(agents).values({diff --git a/packages/database/src/repositories/ftsSearch/postgres/memories.ts b/packages/database/src/repositories/ftsSearch/postgres/memories.tsindex 634ccd89612..aa9caef48ad 100644--- a/packages/database/src/repositories/ftsSearch/postgres/memories.ts+++ b/packages/database/src/repositories/ftsSearch/postgres/memories.ts@@ -1,4 +1,5 @@-import { and, eq, sql } from 'drizzle-orm';+import { LayersEnum } from '@lobechat/types';+import { and, eq, ne, sql } from 'drizzle-orm';import { userMemories } from '../../../schemas';import type { FtsSearchBackendResponse, FtsSearchMemoryResult } from '../types';@@ -36,7 +37,12 @@ export async function searchMemories(}).from(userMemories).where(- and(eq(userMemories.userId, context.userId), dialect.match(MEMORY_FIELDS, preparedQuery)),+ and(+ eq(userMemories.userId, context.userId),+ // Experience memory is retired and has no page to land on; keep it out of unified search.+ ne(userMemories.memoryLayer, LayersEnum.Experience),+ dialect.match(MEMORY_FIELDS, preparedQuery),+ ),).orderBy(sql`${score} DESC`).limit(limit);diff --git a/packages/locales/src/default/electron.ts b/packages/locales/src/default/electron.tsindex 6ebfb3a57a3..151600d7b06 100644--- a/packages/locales/src/default/electron.ts+++ b/packages/locales/src/default/electron.ts@@ -18,7 +18,6 @@ export default {'navigation.lobehub': 'LobeHub','navigation.memory': 'Memory','navigation.memoryContexts': 'Memory - Contexts',- 'navigation.memoryExperiences': 'Memory - Experiences','navigation.memoryIdentities': 'Memory - Identities','navigation.document': 'Document','navigation.memoryPreferences': 'Memory - Preferences',diff --git a/packages/locales/src/default/memory.ts b/packages/locales/src/default/memory.tsindex 79eec814daf..7d3d38caa59 100644--- a/packages/locales/src/default/memory.ts+++ b/packages/locales/src/default/memory.ts@@ -100,7 +100,6 @@ export default {'purge.title': 'Purge All Memories','tab.activities': 'Activities','tab.contexts': 'Contexts',- 'tab.experiences': 'Experiences','tab.home': 'Home','tab.identities': 'Identities','tab.preferences': 'Preferences',diff --git a/packages/prompts/src/prompts/agentSignal/memoryWriter.test.ts b/packages/prompts/src/prompts/agentSignal/memoryWriter.test.tsindex 91b1a1fe1df..48a69ef96a7 100644--- a/packages/prompts/src/prompts/agentSignal/memoryWriter.test.ts+++ b/packages/prompts/src/prompts/agentSignal/memoryWriter.test.ts@@ -16,6 +16,16 @@ describe('agent signal memory writer prompt', () => {);});+ /**+ * @example+ * Experience memory is retired; the writer must not be steered toward its API.+ */+ it('does not offer the retired experience write', () => {+ expect(createAgentSignalMemoryWriterSystemRole({ memoryLanguage: 'en-US' })).not.toContain(+ 'addExperienceMemory',+ );+ });+/*** @example* User prompt keeps routing context inspectable.diff --git a/packages/prompts/src/prompts/agentSignal/memoryWriter.ts b/packages/prompts/src/prompts/agentSignal/memoryWriter.tsindex 5cc65bde768..6ecb597e856 100644--- a/packages/prompts/src/prompts/agentSignal/memoryWriter.ts+++ b/packages/prompts/src/prompts/agentSignal/memoryWriter.ts@@ -30,7 +30,6 @@ Choose the correct memory API based on the feedback:- addPreferenceMemory for stable future-facing preferences- addIdentityMemory / updateIdentityMemory / removeIdentityMemory for enduring identity facts or corrections- addContextMemory for ongoing situations, environments, or projects-- addExperienceMemory for reusable lessons from outcomes or workflows- addActivityMemory for notable concrete events worth rememberingDo not use memory tools for requests to create, update, refine, merge, consolidate, or store reusable skills, procedures, workflows, playbooks, checklists, agent capabilities, agent prompts, or agent documents.diff --git a/src/features/Conversation/ChatList/components/AgentSignalReceiptList.tsx b/src/features/Conversation/ChatList/components/AgentSignalReceiptList.tsxindex 315e2c25d39..ea98e71f933 100644--- a/src/features/Conversation/ChatList/components/AgentSignalReceiptList.tsx+++ b/src/features/Conversation/ChatList/components/AgentSignalReceiptList.tsx@@ -16,13 +16,16 @@ import { useChatStore } from '@/store/chat';import type { AgentSignalReceiptView } from '../hooks/useAgentSignalReceipts';-const MEMORY_ROUTE_BY_LAYER = {+/**+ * The experience layer has no page any more — nothing writes one and its surface is gone — so a+ * receipt that still points at one lands on the memory home rather than a dead route.+ */+const MEMORY_ROUTE_BY_LAYER: Partial<Record<LayersEnum, { idParam: string; path: string }>> = {[LayersEnum.Activity]: { idParam: 'activityId', path: '/memory/activities' },[LayersEnum.Context]: { idParam: 'contextId', path: '/memory/contexts' },- [LayersEnum.Experience]: { idParam: 'experienceId', path: '/memory/experiences' },[LayersEnum.Identity]: { idParam: 'identityId', path: '/memory/identities' },[LayersEnum.Preference]: { idParam: 'preferenceId', path: '/memory/preferences' },-} satisfies Record<LayersEnum, { idParam: string; path: string }>;+};const styles = createStaticStyles(({ css }) => ({list: css`diff --git a/src/routes/(main)/memory/_layout/Sidebar/Header/Nav.tsx b/src/routes/(main)/memory/_layout/Sidebar/Header/Nav.tsxindex 790090c1d2a..1d8908a0884 100644--- a/src/routes/(main)/memory/_layout/Sidebar/Header/Nav.tsx+++ b/src/routes/(main)/memory/_layout/Sidebar/Header/Nav.tsx@@ -6,7 +6,6 @@ import {BubblesIcon,CalendarClockIcon,HeartPulseIcon,- LightbulbIcon,SearchIcon,SignatureIcon,} from 'lucide-react';@@ -32,7 +31,6 @@ interface Item {enum MemoryTabKey {Activities = 'activities',Contexts = 'contexts',- Experiences = 'experiences',Home = 'home',Identities = 'identities',Preferences = 'preferences',@@ -50,87 +48,98 @@ const Nav = memo(() => {const { t } = useTranslation('memory');const toggleCommandMenu = useGlobalStore((s) => s.toggleCommandMenu);- const items: Item[] = useMemo(+ /**+ * Groups separated by space rather than rules: what the whole section is (home), who the+ * person is (identity, preferences), and what is going on around them (contexts, activities).+ * Search sits above all of them because it is an action, not a destination.+ */+ const groups: Item[][] = useMemo(() => [- {- icon: SearchIcon,- key: 'search',- onClick: () => {- toggleCommandMenu(true);+ [+ {+ icon: SearchIcon,+ key: 'search',+ onClick: () => {+ toggleCommandMenu(true);+ },+ title: t('tab.search'),},- title: t('tab.search'),- },- {- icon: BrainCircuitIcon,- key: MemoryTabKey.Home,- title: t('tab.home'),- url: '/memory',- },- {- icon: SignatureIcon,- key: MemoryTabKey.Identities,- title: t('tab.identities'),- url: '/memory/identities',- },- {- icon: BubblesIcon,- key: MemoryTabKey.Contexts,- title: t('tab.contexts'),- url: '/memory/contexts',- },- {- icon: HeartPulseIcon,- key: MemoryTabKey.Preferences,- title: t('tab.preferences'),- url: '/memory/preferences',- },- {- icon: LightbulbIcon,- key: MemoryTabKey.Experiences,- title: t('tab.experiences'),- url: '/memory/experiences',- },- {- icon: CalendarClockIcon,- key: MemoryTabKey.Activities,- title: t('tab.activities'),- url: '/memory/activities',- },+ ],+ [+ {+ icon: BrainCircuitIcon,+ key: MemoryTabKey.Home,+ title: t('tab.home'),+ url: '/memory',+ },+ ],+ [+ {+ icon: SignatureIcon,+ key: MemoryTabKey.Identities,+ title: t('tab.identities'),+ url: '/memory/identities',+ },+ {+ icon: HeartPulseIcon,+ key: MemoryTabKey.Preferences,+ title: t('tab.preferences'),+ url: '/memory/preferences',+ },+ ],+ [+ {+ icon: BubblesIcon,+ key: MemoryTabKey.Contexts,+ title: t('tab.contexts'),+ url: '/memory/contexts',+ },+ {+ icon: CalendarClockIcon,+ key: MemoryTabKey.Activities,+ title: t('tab.activities'),+ url: '/memory/activities',+ },+ ],],- [t],+ [t, toggleCommandMenu],);return (- <Flexbox gap={1} paddingInline={4}>- {items.map((item) => {- const content = (- <NavItem- active={tab === item.key}- icon={item.icon}- key={item.key}- title={item.title}- onClick={item.onClick}- />- );- if (!item.url) return content;+ <Flexbox gap={12} paddingInline={4}>+ {groups.map((items, index) => (+ <Flexbox gap={1} key={index}>+ {items.map((item) => {+ const content = (+ <NavItem+ active={tab === item.key}+ icon={item.icon}+ key={item.key}+ title={item.title}+ onClick={item.onClick}+ />+ );+ if (!item.url) return content;- return (- <Link- key={item.key}- to={item.url}- onClick={(e) => {- if (isModifierClick(e)) return;- e.preventDefault();- item?.onClick?.();- if (item.url) {- navigate(item.url);- }- }}- >- <NavItem active={tab === item.key} icon={item.icon} title={item.title} />- </Link>- );- })}+ return (+ <Link+ key={item.key}+ to={item.url}+ onClick={(e) => {+ if (isModifierClick(e)) return;+ e.preventDefault();+ item?.onClick?.();+ if (item.url) {+ navigate(item.url);+ }+ }}+ >+ <NavItem active={tab === item.key} icon={item.icon} title={item.title} />+ </Link>+ );+ })}+ </Flexbox>+ ))}</Flexbox>);});diff --git a/src/routes/(main)/memory/experiences/features/ExperienceDropdown.tsx b/src/routes/(main)/memory/experiences/features/ExperienceDropdown.tsxdeleted file mode 100644index 122d936276a..00000000000--- a/src/routes/(main)/memory/experiences/features/ExperienceDropdown.tsx+++ /dev/null@@ -1,67 +0,0 @@-import { DropdownMenu } from '@lobehub/ui';-import { ActionIcon, type ActionIconProps, confirmModal } from '@lobehub/ui/base-ui';-import { MoreHorizontal, Pencil, Trash2 } from 'lucide-react';-import { type KeyboardEvent, type MouseEvent } from 'react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { useUserMemoryStore } from '@/store/userMemory';--interface ExperienceDropdownProps {- id: string;- size?: ActionIconProps['size'];-}--const ExperienceDropdown = memo<ExperienceDropdownProps>(({ id, size = 'small' }) => {- const { t } = useTranslation(['memory', 'common']);-- const experiences = useUserMemoryStore((s) => s.experiences);- const deleteExperience = useUserMemoryStore((s) => s.deleteExperience);- const setEditingMemory = useUserMemoryStore((s) => s.setEditingMemory);-- const handleMenuClick = (info: { domEvent: MouseEvent | KeyboardEvent; key: string }) => {- info.domEvent.stopPropagation();-- if (info.key === 'edit') {- const experience = experiences.find((e) => e.id === id);- if (experience) {- setEditingMemory(id, experience.keyLearning || '', 'experience');- }- } else if (info.key === 'delete') {- confirmModal({- cancelText: t('cancel', { ns: 'common' }),- content: t('experience.deleteConfirm'),- okButtonProps: { danger: true },- okText: t('confirm', { ns: 'common' }),- onOk: async () => {- await deleteExperience(id);- },- title: t('experience.deleteTitle'),- });- }- };-- const menuItems = [- {- icon: <Pencil size={14} />,- key: 'edit',- label: t('experience.actions.edit'),- onClick: handleMenuClick,- },- {- danger: true,- icon: <Trash2 size={14} />,- key: 'delete',- label: t('experience.actions.delete'),- onClick: handleMenuClick,- },- ];-- return (- <DropdownMenu items={menuItems}>- <ActionIcon icon={MoreHorizontal} size={size} />- </DropdownMenu>- );-});--export default ExperienceDropdown;diff --git a/src/routes/(main)/memory/experiences/features/ExperienceRightPanel.tsx b/src/routes/(main)/memory/experiences/features/ExperienceRightPanel.tsxdeleted file mode 100644index 8110f59d6da..00000000000--- a/src/routes/(main)/memory/experiences/features/ExperienceRightPanel.tsx+++ /dev/null@@ -1,200 +0,0 @@-'use client';--import { Flexbox } from '@lobehub/ui';-import { Avatar, Text } from '@lobehub/ui/base-ui';-import { Steps } from 'antd';-import { createStaticStyles, cssVar } from 'antd-style';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import AsyncBoundary from '@/components/AsyncBoundary';-import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';-import { useQueryState } from '@/hooks/useQueryParam';-import CateTag from '@/routes/(main)/memory/features/CateTag';-import DetailLoading from '@/routes/(main)/memory/features/DetailLoading';-import DetailNotFound from '@/routes/(main)/memory/features/DetailNotFound';-import DetailPanel from '@/routes/(main)/memory/features/DetailPanel';-import HashTags from '@/routes/(main)/memory/features/HashTags';-import HighlightedContent from '@/routes/(main)/memory/features/HighlightedContent';-import ProgressIcon from '@/routes/(main)/memory/features/ProgressIcon';-import SourceLink from '@/routes/(main)/memory/features/SourceLink';-import Time from '@/routes/(main)/memory/features/Time';-import { useUserMemoryStore } from '@/store/userMemory';-import { LayersEnum } from '@/types/userMemory';--import ExperienceDropdown from './ExperienceDropdown';--const styles = createStaticStyles(({ css, cssVar }) => ({- content: css`- font-size: 14px;- line-height: 1.8;- color: ${cssVar.colorText};- white-space: pre-wrap;- `,- stepsContainer: css`- .ant-steps-item-content {- min-height: auto;- }-- .ant-steps-item-description {- padding-block-end: 16px !important;- }- `,-}));--const ExperienceRightPanel = memo(() => {- const { t } = useTranslation('memory');- const [experienceId] = useQueryState('experienceId', { clearOnDefault: true });- const useFetchMemoryDetail = useUserMemoryStore((s) => s.useFetchMemoryDetail);-- const {- data: experience,- isLoading,- error,- mutate,- } = useFetchMemoryDetail(experienceId, LayersEnum.Experience);-- if (!experienceId) return null;-- const content = experience && (- <>- <CateTag cate={experience.type} />- <Text- as={'h1'}- fontSize={20}- weight={'bold'}- style={{- lineHeight: 1.4,- marginBottom: 0,- }}- >- {experience.title}- </Text>- <Flexbox horizontal align="center" gap={16} justify="space-between">- <ProgressIcon- showInfo- format={(percent) => `${t('filter.sort.scoreConfidence')}: ${percent}%`}- percent={(experience.scoreConfidence ?? 0) * 100}- />- </Flexbox>- <Flexbox horizontal align="center" gap={16} justify="space-between">- <SourceLink source={experience.source} />- <Time capturedAt={experience.capturedAt || experience.updatedAt || experience.createdAt} />- </Flexbox>-- {experience.keyLearning && <HighlightedContent>{experience.keyLearning}</HighlightedContent>}-- <Steps- className={styles.stepsContainer}- current={null as any}- direction="vertical"- size="small"- items={[- {- description: <HighlightedContent>{experience.situation}</HighlightedContent>,- icon: (- <Avatar- shadow- avatar={'S'}- shape={'square'}- size={24}- style={{- border: `1px solid ${cssVar.colorBorderSecondary}`,- }}- />- ),- title: (- <Text as={'h4'} fontSize={12} type={'secondary'} weight={500}>- {t('experience.steps.situation')}- </Text>- ),- },- {- description: <HighlightedContent>{experience.reasoning}</HighlightedContent>,- icon: (- <Avatar- shadow- avatar={'T'}- shape={'square'}- size={24}- style={{- border: `1px solid ${cssVar.colorBorderSecondary}`,- }}- />- ),- title: (- <Text as={'h4'} fontSize={12} type={'secondary'} weight={500}>- {t('experience.steps.task')}- </Text>- ),- },- {- description: <HighlightedContent>{experience.action}</HighlightedContent>,- icon: (- <Avatar- shadow- avatar={'A'}- shape={'square'}- size={24}- style={{- border: `1px solid ${cssVar.colorBorderSecondary}`,- }}- />- ),- title: (- <Text as={'h4'} fontSize={12} type={'secondary'} weight={500}>- {t('experience.steps.action')}- </Text>- ),- },- {- description: <HighlightedContent>{experience.possibleOutcome}</HighlightedContent>,- icon: (- <Avatar- shadow- avatar={'R'}- shape={'square'}- size={24}- style={{- border: `1px solid ${cssVar.colorBorderSecondary}`,- }}- />- ),- title: (- <Text as={'h4'} fontSize={12} type={'secondary'} weight={500}>- {t('experience.steps.result')}- </Text>- ),- },- ]}- />-- <HashTags hashTags={experience.tags} />- </>- );-- return (- <DetailPanel- header={{- right: experienceId ? (- <ExperienceDropdown id={experienceId} size={DESKTOP_HEADER_ICON_SIZE} />- ) : undefined,- }}- >- <AsyncBoundary- data={experience}- empty={<DetailNotFound />}- error={error}- errorVariant={'page'}- isEmpty={!experience}- isLoading={isLoading}- loading={<DetailLoading />}- onRetry={() => mutate()}- >- {content}- </AsyncBoundary>- </DetailPanel>- );-});--export default ExperienceRightPanel;diff --git a/src/routes/(main)/memory/experiences/features/List/GridView/ExperienceCard.tsx b/src/routes/(main)/memory/experiences/features/List/GridView/ExperienceCard.tsxdeleted file mode 100644index 4b35fa22cdf..00000000000--- a/src/routes/(main)/memory/experiences/features/List/GridView/ExperienceCard.tsx+++ /dev/null@@ -1,37 +0,0 @@-import { type ExperienceListItem } from '@lobechat/types';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import GridCard from '@/routes/(main)/memory/features/GridView/GridCard';-import ProgressIcon from '@/routes/(main)/memory/features/ProgressIcon';--import ExperienceDropdown from '../../ExperienceDropdown';--interface ExperienceCardProps {- experience: ExperienceListItem;- onClick: (experience: ExperienceListItem) => void;-}--const ExperienceCard = memo<ExperienceCardProps>(({ experience, onClick }) => {- const { t } = useTranslation('memory');-- return (- <GridCard- actions={<ExperienceDropdown id={experience.id} />}- capturedAt={experience.capturedAt || experience.updatedAt || experience.createdAt}- cate={experience.type}- title={experience.title}- badges={- <ProgressIcon- format={(percent) => `${t('filter.sort.scoreConfidence')}: ${percent}%`}- percent={(experience.scoreConfidence ?? 0) * 100}- />- }- onClick={() => onClick(experience)}- >- {experience.keyLearning || experience.situation}- </GridCard>- );-});--export default ExperienceCard;diff --git a/src/routes/(main)/memory/experiences/features/List/GridView/index.tsx b/src/routes/(main)/memory/experiences/features/List/GridView/index.tsxdeleted file mode 100644index 06846012a1f..00000000000--- a/src/routes/(main)/memory/experiences/features/List/GridView/index.tsx+++ /dev/null@@ -1,32 +0,0 @@-import { type ExperienceListItem } from '@lobechat/types';-import { memo } from 'react';--import { useUserMemoryStore } from '@/store/userMemory';--import { GridView } from '../../../../features/GridView';-import ExperienceCard from './ExperienceCard';--interface GridViewProps {- experiences: ExperienceListItem[];- isLoading?: boolean;- onClick: (experience: ExperienceListItem) => void;-}--const ExperiencesGridView = memo<GridViewProps>(({ experiences, isLoading, onClick }) => {- const loadMoreExperiences = useUserMemoryStore((s) => s.loadMoreExperiences);- const experiencesHasMore = useUserMemoryStore((s) => s.experiencesHasMore);-- return (- <GridView- hasMore={experiencesHasMore}- isLoading={isLoading}- items={experiences}- renderItem={(experience) => (- <ExperienceCard experience={experience} onClick={() => onClick(experience)} />- )}- onLoadMore={loadMoreExperiences}- />- );-});--export default ExperiencesGridView;diff --git a/src/routes/(main)/memory/experiences/features/List/TimelineView/ExperienceCard.tsx b/src/routes/(main)/memory/experiences/features/List/TimelineView/ExperienceCard.tsxdeleted file mode 100644index 4ceb7d354ee..00000000000--- a/src/routes/(main)/memory/experiences/features/List/TimelineView/ExperienceCard.tsx+++ /dev/null@@ -1,28 +0,0 @@-import { type ExperienceListItem } from '@lobechat/types';-import { memo } from 'react';--import TimeLineCard from '@/routes/(main)/memory/features/TimeLineView/TimeLineCard';--import ExperienceDropdown from '../../ExperienceDropdown';--interface ExperienceCardProps {- experience: ExperienceListItem;- onClick: (experience: ExperienceListItem) => void;-}--const ExperienceCard = memo<ExperienceCardProps>(({ experience, onClick }) => {- return (- <TimeLineCard- actions={<ExperienceDropdown id={experience.id} />}- capturedAt={experience.capturedAt || experience.updatedAt || experience.createdAt}- cate={experience.type}- hashTags={experience.tags}- title={experience.title}- onClick={() => onClick(experience)}- >- {experience.keyLearning || experience.situation}- </TimeLineCard>- );-});--export default ExperienceCard;diff --git a/src/routes/(main)/memory/experiences/features/List/TimelineView/index.tsx b/src/routes/(main)/memory/experiences/features/List/TimelineView/index.tsxdeleted file mode 100644index fb3fb28973b..00000000000--- a/src/routes/(main)/memory/experiences/features/List/TimelineView/index.tsx+++ /dev/null@@ -1,41 +0,0 @@-'use client';--import { type ExperienceListItem } from '@lobechat/types';-import { memo } from 'react';--import { useUserMemoryStore } from '@/store/userMemory';--import { TimelineView as GenericTimelineView } from '../../../../features/TimeLineView';-import { PeriodHeader, TimelineItemWrapper } from '../../../../features/TimeLineView/PeriodGroup';-import ExperienceCard from './ExperienceCard';--interface ExperienceTimelineViewProps {- experiences: ExperienceListItem[];- isLoading?: boolean;- onCardClick: (experience: ExperienceListItem) => void;-}--const ExperienceTimelineView = memo<ExperienceTimelineViewProps>(- ({ experiences, isLoading, onCardClick }) => {- const loadMoreExperiences = useUserMemoryStore((s) => s.loadMoreExperiences);- const experiencesHasMore = useUserMemoryStore((s) => s.experiencesHasMore);-- return (- <GenericTimelineView- data={experiences}- groupBy="day"- hasMore={experiencesHasMore}- isLoading={isLoading}- renderHeader={(periodKey) => <PeriodHeader groupBy="day" periodKey={periodKey} />}- renderItem={(experience) => (- <TimelineItemWrapper>- <ExperienceCard experience={experience} onClick={onCardClick} />- </TimelineItemWrapper>- )}- onLoadMore={loadMoreExperiences}- />- );- },-);--export default ExperienceTimelineView;diff --git a/src/routes/(main)/memory/experiences/features/List/index.tsx b/src/routes/(main)/memory/experiences/features/List/index.tsxdeleted file mode 100644index fefc32914cf..00000000000--- a/src/routes/(main)/memory/experiences/features/List/index.tsx+++ /dev/null@@ -1,48 +0,0 @@-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { useQueryState } from '@/hooks/useQueryParam';-import MemoryAnalysis from '@/routes/(main)/memory/features/MemoryAnalysis';-import MemoryEmpty from '@/routes/(main)/memory/features/MemoryEmpty';-import { useGlobalStore } from '@/store/global';-import { useUserMemoryStore } from '@/store/userMemory';--import { type ViewMode } from '../../../features/ViewModeSwitcher';-import GridView from './GridView';-import TimelineView from './TimelineView';--interface ExperiencesListProps {- isLoading?: boolean;- searchValue?: string;- viewMode: ViewMode;-}--const ExperiencesList = memo<ExperiencesListProps>(({ isLoading, searchValue, viewMode }) => {- const { t } = useTranslation(['memory', 'common']);- const [, setExperienceId] = useQueryState('experienceId', { clearOnDefault: true });- const toggleRightPanel = useGlobalStore((s) => s.toggleRightPanel);- const experiences = useUserMemoryStore((s) => s.experiences);-- const handleCardClick = (experience: any) => {- setExperienceId(experience.id);- toggleRightPanel(true);- };-- const isEmpty = experiences.length === 0;-- if (isEmpty) {- return (- <MemoryEmpty search={Boolean(searchValue)} title={t('experience.empty')}>- <MemoryAnalysis />- </MemoryEmpty>- );- }-- return viewMode === 'timeline' ? (- <TimelineView experiences={experiences} isLoading={isLoading} onCardClick={handleCardClick} />- ) : (- <GridView experiences={experiences} isLoading={isLoading} onClick={handleCardClick} />- );-});--export default ExperiencesList;diff --git a/src/routes/(main)/memory/experiences/index.tsx b/src/routes/(main)/memory/experiences/index.tsxdeleted file mode 100644index 37410830b50..00000000000--- a/src/routes/(main)/memory/experiences/index.tsx+++ /dev/null@@ -1,139 +0,0 @@-import { Flexbox, Icon } from '@lobehub/ui';-import { Tag } from '@lobehub/ui/base-ui';-import { BrainCircuitIcon } from 'lucide-react';-import { type FC } from 'react';-import { memo, useCallback, useState } from 'react';-import { useTranslation } from 'react-i18next';--import { MemoryListBoundary, useResetMemoryList } from '@/features/Memory';-import NavHeader from '@/features/NavHeader';-import WideScreenContainer from '@/features/WideScreenContainer';-import WideScreenButton from '@/features/WideScreenContainer/WideScreenButton';-import { useQueryState } from '@/hooks/useQueryParam';-import ActionBar from '@/routes/(main)/memory/features/ActionBar';-import { SCROLL_PARENT_ID } from '@/routes/(main)/memory/features/TimeLineView/useScrollParent';-import { useUserMemoryStore } from '@/store/userMemory';--import EditableModal from '../features/EditableModal';-import FilterBar from '../features/FilterBar';-import Loading from '../features/Loading';-import { type ViewMode } from '../features/ViewModeSwitcher';-import ViewModeSwitcher from '../features/ViewModeSwitcher';-import ExperienceRightPanel from './features/ExperienceRightPanel';-import List from './features/List';--const ExperiencesArea = memo(() => {- const { t } = useTranslation('memory');- const [viewMode, setViewMode] = useState<ViewMode>('timeline');- const [searchValueRaw, setSearchValueRaw] = useQueryState('q', { clearOnDefault: true });- const [sortValueRaw, setSortValueRaw] = useQueryState('sort', { clearOnDefault: true });-- const searchValue = searchValueRaw || '';- const sortValue: 'capturedAt' | 'scoreConfidence' =- sortValueRaw === 'scoreConfidence' ? 'scoreConfidence' : 'capturedAt';-- const experiencesPage = useUserMemoryStore((s) => s.experiencesPage);- const experiencesInit = useUserMemoryStore((s) => s.experiencesInit);- const experiencesTotal = useUserMemoryStore((s) => s.experiencesTotal);- const experiencesSearchError = useUserMemoryStore((s) => s.experiencesSearchError);- const experiencesSearchLoading = useUserMemoryStore((s) => s.experiencesSearchLoading);- const useFetchExperiences = useUserMemoryStore((s) => s.useFetchExperiences);- const resetExperiencesList = useUserMemoryStore((s) => s.resetExperiencesList);-- const sortOptions = [- { label: t('filter.sort.createdAt'), value: 'capturedAt' },- { label: t('filter.sort.scoreConfidence'), value: 'scoreConfidence' },- ];-- // Convert sort: capturedAt becomes undefined (backend default)- const apiSort = sortValue === 'capturedAt' ? undefined : (sortValue as 'scoreConfidence');-- useResetMemoryList({- query: searchValue,- resetList: resetExperiencesList,- sort: apiSort,- viewMode,- });-- // Call SWR hook to fetch data- const { data, isLoading, mutate } = useFetchExperiences({- page: experiencesPage,- pageSize: 12,- q: searchValue || undefined,- sort: viewMode === 'grid' ? apiSort : undefined,- });-- // Handle search and sort changes- const handleSearch = useCallback(- (value: string) => {- setSearchValueRaw(value || null);- },- [setSearchValueRaw],- );-- const handleSortChange = useCallback(- (sort: string) => {- setSortValueRaw(sort);- },- [setSortValueRaw],- );-- return (- <Flexbox flex={1} height={'100%'}>- <NavHeader- left={- Boolean(experiencesTotal) && (- <Tag icon={<Icon icon={BrainCircuitIcon} />}>{experiencesTotal}</Tag>- )- }- right={- <ActionBar showAnalysis showPurge>- <ViewModeSwitcher value={viewMode} onChange={setViewMode} />- <WideScreenButton />- </ActionBar>- }- />- <Flexbox- height={'100%'}- id={SCROLL_PARENT_ID}- style={{ overflowY: 'auto', paddingBottom: '16vh' }}- width={'100%'}- >- <WideScreenContainer gap={32} paddingBlock={48}>- <FilterBar- searchValue={searchValue}- sortOptions={viewMode === 'grid' ? sortOptions : undefined}- sortValue={sortValue}- onSearch={handleSearch}- onSortChange={viewMode === 'grid' ? handleSortChange : undefined}- />- <MemoryListBoundary- data={data}- error={experiencesSearchError}- isInitialized={experiencesInit}- isLoading={isLoading}- isResetting={experiencesSearchLoading}- loading={<Loading viewMode={viewMode} />}- onRetry={() => void mutate()}- >- <List isLoading={isLoading} searchValue={searchValue} viewMode={viewMode} />- </MemoryListBoundary>- </WideScreenContainer>- </Flexbox>- </Flexbox>- );-});--const Experiences: FC = () => {- return (- <>- <Flexbox horizontal height={'100%'} width={'100%'}>- <ExperiencesArea />- <ExperienceRightPanel />- </Flexbox>- <EditableModal />- </>- );-};--export default Experiences;diff --git a/src/spa/router/desktopRouter.shared.tsx b/src/spa/router/desktopRouter.shared.tsxindex 4c756e3d079..9754e801047 100644--- a/src/spa/router/desktopRouter.shared.tsx+++ b/src/spa/router/desktopRouter.shared.tsx@@ -780,16 +780,6 @@ export const sharedMainAreaChildren: RouteObject[] = [},path: 'preferences',},- {- element: dynamicElement(- () => import('@/routes/(main)/memory/experiences'),- 'Desktop > Memory > Experiences',- ),- handle: {- meta: routeMeta({ icon: BrainCircuit, titleKey: 'navigation.memoryExperiences' }),- },- path: 'experiences',- },{element: dynamicElement(() => import('@/routes/(main)/memory/activities'),