add_long_term_memory
Store persistent memories with custom JavaScript triggers that activate based on conversation context, keywords, or specific conditions to provide relevant information when needed.
Instructions
Add a new long-term memory with a trigger condition. The trigger is JavaScript code that determines when this memory should be activated. Available context: context.messages (array), context.conversation_id (string), context.participants (object). Available functions: match_keys(messages, keywords, scope, depth), match_keys_all(messages, keywords, scope, depth).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| prompt | Yes | ||
| trigger | Yes | ||
| createdContext | No | ||
| recentMessages | No |
Input Schema (JSON Schema)
{
"properties": {
"createdContext": {
"_def": {
"description": "Optional context about when/why this memory was created",
"innerType": {
"_def": {
"checks": [],
"coerce": false,
"typeName": "ZodString"
},
"~standard": {
"vendor": "zod",
"version": 1
}
},
"typeName": "ZodOptional"
},
"~standard": {
"vendor": "zod",
"version": 1
}
},
"name": {
"_def": {
"checks": [],
"coerce": false,
"description": "Unique name for the memory",
"typeName": "ZodString"
},
"~standard": {
"vendor": "zod",
"version": 1
}
},
"prompt": {
"_def": {
"checks": [],
"coerce": false,
"description": "The memory content to be recalled when triggered",
"typeName": "ZodString"
},
"~standard": {
"vendor": "zod",
"version": 1
}
},
"recentMessages": {
"_def": {
"description": "Optional recent messages to auto-generate createdContext",
"innerType": {
"_def": {
"exactLength": null,
"maxLength": null,
"minLength": null,
"type": {
"_cached": null,
"_def": {
"catchall": {
"_def": {
"typeName": "ZodNever"
},
"~standard": {
"vendor": "zod",
"version": 1
}
},
"typeName": "ZodObject",
"unknownKeys": "strip"
},
"~standard": {
"vendor": "zod",
"version": 1
}
},
"typeName": "ZodArray"
},
"~standard": {
"vendor": "zod",
"version": 1
}
},
"typeName": "ZodOptional"
},
"~standard": {
"vendor": "zod",
"version": 1
}
},
"trigger": {
"_def": {
"checks": [],
"coerce": false,
"description": "JavaScript code that returns true/false to determine if memory should activate. Example: \"match_keys(context.messages, ['birthday'], 'any') || new Date().getMonth() === 6\"",
"typeName": "ZodString"
},
"~standard": {
"vendor": "zod",
"version": 1
}
}
},
"required": [
"name",
"prompt",
"trigger"
],
"type": "object"
}