Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(store): publish MemoryStored event on successful memory write

Steven Enamakel183c170f76ae
diff --git a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
index 01c603ae15..438f4899a9 100644
--- a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
+++ b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
@@ -1,4 +1,5 @@
import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import { describe, expect, it } from 'vitest';
import type { SubagentActivity } from '../../../store/chatRuntimeSlice';
diff --git a/crates/openhuman-core/src/memory/tools/store.rs b/crates/openhuman-core/src/memory/tools/store.rs
index 3edbacdc80..8dd579e4da 100644
--- a/crates/openhuman-core/src/memory/tools/store.rs
+++ b/crates/openhuman-core/src/memory/tools/store.rs
@@ -203,7 +203,20 @@ impl Tool for MemoryStoreTool {
)
.await
{
- Ok(()) => Ok(ToolResult::success(format!("Stored memory: {display_key}"))),
+ Ok(()) => {
+ // Fires once per tool call (not per driver read), so this
+ // does not carry the hot-path flooding risk the guard's own
+ // success path avoids (see `memory::guard::audit` docs) —
+ // and, unlike that layer, this is exactly the discrete,
+ // per-turn action the chat surface's `memory_activity`
+ // indicator wants to light up on. Never carries `content`.
+ crate::core::bus::BUS.publish(crate::core::events::DomainEvent::MemoryStored {
+ key: key.clone(),
+ category: category.to_string(),
+ namespace: namespace.clone(),
+ });
+ Ok(ToolResult::success(format!("Stored memory: {display_key}")))
+ }
Err(e) => Ok(ToolResult::error(format!("Failed to store memory: {e}"))),
}
}