promp and memry

This commit is contained in:
legop3
2026-05-04 01:33:09 -04:00
parent d887997a5a
commit 26d59b6650
10 changed files with 205 additions and 36 deletions
@@ -0,0 +1,34 @@
module.exports = {
id: 'memory_event_add',
signature: 'memory_event_add(text, tags?)',
description: 'Append a short recent-event memory with optional tags.',
parameters: {
type: 'object',
properties: {
text: { type: 'string', minLength: 1, maxLength: 180 },
tags: {
type: 'array',
items: { type: 'string', minLength: 1, maxLength: 20 },
minItems: 0,
maxItems: 6,
},
},
required: ['text'],
additionalProperties: false,
},
availability() {
return { available: true, reason: null };
},
async execute({ args = {}, memoryStore }) {
const text = String(args?.text || '').trim().slice(0, 180);
if (!text) throw new Error('memory_event_add requires args.text');
const tags = Array.isArray(args?.tags)
? args.tags.map((tag) => String(tag || '').trim().toLowerCase().slice(0, 20)).filter(Boolean).slice(0, 6)
: [];
const next = memoryStore && typeof memoryStore === 'object' ? { ...memoryStore } : {};
const events = Array.isArray(next.events) ? [...next.events] : [];
events.push({ at: Date.now(), text, tags });
next.events = events.slice(-20);
return { ok: true, memory: next };
},
};