🤯 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
✨ feat(userMemories): use honorific title for identity memory (#11039)
Nekoab61c69fefc8
diff --git a/packages/memory-user-memory/src/prompts/layers/identity.md b/packages/memory-user-memory/src/prompts/layers/identity.mdindex abb57aa522c..296c93ac32b 100644--- a/packages/memory-user-memory/src/prompts/layers/identity.md+++ b/packages/memory-user-memory/src/prompts/layers/identity.md@@ -23,6 +23,9 @@ Extract **ALL** identity layer information from the conversation. Capturepersonal background, roles, relationships, demographics, self-concept, and thesmall but meaningful signals people often overlook:+- Craft `title` as a concise honorific-style phrase that pairs strength/impact with domain or milestone (e.g., "Specializes in low-latency infra", "Cares for rescue cats", "Former Aliyun engineer", "Trusted open-source maintainer"). Avoid bare job titles.+- Only set `role` when the conversation states one (e.g., "platform engineer", "caregiver"); do not invent defaults. Keep it neutral and aligned to the evidence.+- Highlights and recognition that feel meaningful or surprising (e.g., communitysupport for an open-source maintainer, a sponsor, a compliment from a mentor)- Achievements and milestones that shape how the user sees themselves (career,diff --git a/packages/memory-user-memory/src/schemas/identity.ts b/packages/memory-user-memory/src/schemas/identity.tsindex 7a42ce6b254..77d997ed2b0 100644--- a/packages/memory-user-memory/src/schemas/identity.ts+++ b/packages/memory-user-memory/src/schemas/identity.ts@@ -47,14 +47,18 @@ export const AddIdentityActionSchema = zmemoryType: MemoryTypeSchema.describe('Memory type'),summary: z.string().describe('Concise overview of this specific memory'),tags: z.array(z.string()).describe('Model generated tags that summarize the identity facets'),- title: z.string().describe('Brief descriptive title'),+ title: z+ .string()+ .describe('Honorific-style, concise descriptor (strength + domain/milestone), avoid bare job titles; e.g., "Trusted open-source maintainer", "Specializes in low-latency infra", "Former Aliyun engineer", "Cares for rescue cats"'),withIdentity: z.object({description: z.string(),episodicDate: z.union([z.string(), z.null()]),extractedLabels: z.array(z.string()),relationship: RelationshipEnum,- role: z.string(),+ role: z+ .string()+ .describe('Role explicitly mentioned for this identity entry (e.g., "platform engineer", "caregiver"); keep neutral and only use when evidence exists'),scoreConfidence: z.number(),sourceEvidence: z.union([z.string(), z.null()]),type: IdentityTypeEnum,@@ -90,7 +94,7 @@ export const UpdateIdentityActionSchema = ztitle: z.string().nullable()- .describe('Brief descriptive title, use null for omitting the field'),+ .describe('Honorific-style, concise descriptor (strength + domain/milestone), avoid bare job titles; e.g., "Trusted open-source maintainer", "Specializes in low-latency infra", "Former Aliyun engineer", "Cares for rescue cats"; use null for omitting the field'),withIdentity: z.object({description: z.string().nullable(),@@ -101,7 +105,10 @@ export const UpdateIdentityActionSchema = z.string().describe(`Possible values: ${RELATIONSHIP_ENUM.join(' | ')}`).nullable(),- role: z.string().nullable(),+ role: z+ .string()+ .describe('Role explicitly mentioned for this identity entry (e.g., "platform engineer", "caregiver"); keep existing when not updated; use null for omitting the field')+ .nullable(),scoreConfidence: z.number().nullable(),sourceEvidence: z.string().nullable(),// TODO: OpenAI requires `required` fields to be always present, while enum fields cannot be nulldiff --git a/src/server/services/memory/userMemory/extract.ts b/src/server/services/memory/userMemory/extract.tsindex 6dcf10852fa..5b4a6b419b3 100644--- a/src/server/services/memory/userMemory/extract.ts+++ b/src/server/services/memory/userMemory/extract.ts@@ -723,14 +723,15 @@ export class MemoryExtractionExecutor {const res = await userMemoryModel.addIdentityEntry({base: {capturedAt: job.sourceUpdatedAt,- details: action.withIdentity.description,+ details: action.details,detailsVector1024: detailsVector ?? undefined,memoryCategory: 'people',memoryLayer: LayersEnum.Identity,memoryType: TypesEnum.People,metadata,- summary: action.withIdentity.description,+ summary: action.summary,summaryVector1024: summaryVector ?? undefined,+ title: action.title,},identity: {capturedAt: job.sourceUpdatedAt,