Skip to content

🤯 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.

✨ 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.md
index 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. Capture
personal background, roles, relationships, demographics, self-concept, and the
small 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., community
support 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.ts
index 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 = z
memoryType: 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 = z
title: 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 null
diff --git a/src/server/services/memory/userMemory/extract.ts b/src/server/services/memory/userMemory/extract.ts
index 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,