Add workspace and memory system (OpenClaw-inspired)

Implements persistent memory for agents with hybrid search:

- Database-backed workspace with PostgreSQL (not filesystem)
- Memory documents: MEMORY.md, daily logs, identity files
- Chunked content with FTS (tsvector) + vector (pgvector) indexes
- Reciprocal Rank Fusion (RRF) for hybrid search combining BM25 and semantic
- Memory tools: memory_search, memory_write, memory_read
- Proactive heartbeat system for periodic execution (30 min default)
- OpenAI embeddings provider (text-embedding-3-small)

Key patterns from OpenClaw:
- "Memory is files, not RAM" - explicit persistence required
- Two-tier memory: daily logs (raw) + curated MEMORY.md
- Session isolation via user_id/agent_id scoping

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
Illia Polosukhin
2026-02-02 21:18:47 -08:00
co-authored by Claude Opus 4.5
parent 8c38566378
commit 4e238e60ac
15 changed files with 2999 additions and 0 deletions
+2
View File
@@ -49,6 +49,7 @@ pub mod history;
pub mod llm;
pub mod safety;
pub mod tools;
pub mod workspace;
pub use config::Config;
pub use error::{Error, Result};
@@ -62,4 +63,5 @@ pub mod prelude {
pub use crate::llm::LlmProvider;
pub use crate::safety::{SanitizedOutput, Sanitizer};
pub use crate::tools::{Tool, ToolOutput, ToolRegistry};
pub use crate::workspace::{DocType, MemoryDocument, Workspace};
}