Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: add app association to memories

Adam Eivy385944cce217
diff --git a/server/lib/memoryValidation.js b/server/lib/memoryValidation.js
index ab5331053e..e630e4998b 100644
--- a/server/lib/memoryValidation.js
+++ b/server/lib/memoryValidation.js
@@ -38,7 +38,8 @@ export const memoryCreateSchema = z.object({
importance: z.number().min(0).max(1).optional().default(0.5),
relatedMemories: z.array(z.string().uuid()).optional().default([]),
sourceTaskId: z.string().optional(),
- sourceAgentId: z.string().optional()
+ sourceAgentId: z.string().optional(),
+ sourceAppId: z.string().nullable().optional()
});
// Full memory schema (includes system-generated fields)
diff --git a/server/routes/memory.js b/server/routes/memory.js
index cf748e8966..82bd573124 100644
--- a/server/routes/memory.js
+++ b/server/routes/memory.js
@@ -190,11 +190,7 @@ router.put('/:id', asyncHandler(async (req, res) => {
if (validation.data.content) {
const embedding = await embeddings.generateMemoryEmbedding(updated);
if (embedding) {
- // Update embedding in storage
- const embeddingsData = await memory.loadEmbeddings?.() || {};
- embeddingsData.vectors = embeddingsData.vectors || {};
- embeddingsData.vectors[updated.id] = embedding;
- // Note: This would need to be exposed from memory.js
+ await memory.updateMemoryEmbedding(updated.id, embedding);
}
}
diff --git a/server/services/memoryExtractor.js b/server/services/memoryExtractor.js
index 6389d38160..aa8bb47fb2 100644
--- a/server/services/memoryExtractor.js
+++ b/server/services/memoryExtractor.js
@@ -299,13 +299,17 @@ export async function extractAndStoreMemories(agentId, taskId, output, task = nu
const created = [];
+ // Extract appId from task metadata if available
+ const sourceAppId = task?.metadata?.app || null;
+
// Auto-save high confidence memories
for (const mem of highConfidence) {
const embedding = await generateMemoryEmbedding(mem);
const memory = await createMemory({
...mem,
sourceAgentId: agentId,
- sourceTaskId: taskId
+ sourceTaskId: taskId,
+ sourceAppId
}, embedding);
created.push(memory);
}
@@ -318,6 +322,7 @@ export async function extractAndStoreMemories(agentId, taskId, output, task = nu
...mem,
sourceAgentId: agentId,
sourceTaskId: taskId,
+ sourceAppId,
status: 'pending_approval'
}, embedding);
pendingMemories.push(memory);