Overview
The workspace is IronClaw’s persistent memory system. It provides a filesystem-like API for storing notes, logs, and context, backed by PostgreSQL with full-text and semantic search.Filesystem Metaphor
The workspace looks and feels like a file tree:Paths are virtual. There’s no actual filesystem - everything is stored in PostgreSQL with path-based indexing.
Core Operations
Identity Files
Core files that shape agent behavior.MEMORY.md - Long-term curated memory
MEMORY.md - Long-term curated memory
Purpose: Important facts, decisions, and preferences worth remembering across sessions.Usage:
- Agent appends new learnings during conversations
- User curates periodically (remove stale, consolidate duplicates)
- Loaded into system prompt for every session
- Keep concise - this affects token usage
IDENTITY.md - Agent personality
IDENTITY.md - Agent personality
Purpose: Define agent’s name, vibe, and personality.Usage:
- Loaded into system prompt
- Agent evolves this over time
- User can edit directly
SOUL.md - Core values
SOUL.md - Core values
Purpose: Behavioral boundaries and ethical guidelines.Usage:
- Loaded into system prompt
- Defines what the agent should/shouldn’t do
- User-editable for customization
AGENTS.md - Operational instructions
AGENTS.md - Operational instructions
Purpose: Session routine and operational guidelines.Usage:
- Loaded at session start
- Tells agent what to do each session
- Memory management guidelines
USER.md - User context
USER.md - User context
Purpose: Information about the user.Usage:
- Agent fills in as it learns
- User can edit directly
- Loaded into system prompt
HEARTBEAT.md - Periodic checklist
HEARTBEAT.md - Periodic checklist
Purpose: Tasks for the heartbeat system to check periodically.Usage:
- Read by heartbeat runner (2-4x/day)
- If empty (or all comments), heartbeat is skipped
- Add tasks when you want periodic checks
Daily Logs
Automatic session notes keyed by date. Path Format:daily/YYYY-MM-DD.md
Usage:
- New file created each day
- Last 2 days loaded into system prompt
- Older logs remain searchable
Hybrid Search
Combines full-text (BM25) and semantic (vector) search using Reciprocal Rank Fusion.Search Architecture
How It Works
1
Indexing
When you write a document:
- Content is chunked (500 chars, 50 char overlap)
- Each chunk gets embedded (1536-dim vector)
- Stored in PostgreSQL with pgvector extension
- BM25 index built for full-text search
2
Query Processing
When you search:
- Query string is embedded
- Two parallel searches:
- BM25 full-text search
- Vector cosine similarity search
- Results merged using RRF
- Top-k returned sorted by fused score
Search Configuration
Search Results
Reciprocal Rank Fusion
RRF combines rankings from multiple sources:- Better than Pure Vector
- Better than Pure BM25
Vector search alone misses exact keyword matches:
Chunking Strategy
Documents are split into overlapping chunks for better search recall.- Prevents splitting mid-concept
- Improves search recall
- Context preserved across chunks
System Prompt Integration
Identity files are automatically loaded into the system prompt.Prompt Building
AGENTS.md- Agent InstructionsSOUL.md- Core ValuesUSER.md- User ContextIDENTITY.md- IdentityMEMORY.md- Long-Term Memory (only in direct sessions, never groups)daily/today.md- Today’s Notesdaily/yesterday.md- Yesterday’s Notes
Database Schema
Documents Table
Chunks Table
Embedding Providers
Multiple embedding provider options:- OpenAI (Default)
- NEAR AI
- Ollama (Local)
Model: Cost: ~$0.02 per 1M tokens
text-embedding-3-smallDimensions: 1536Configuration:Memory Tools
Tools for interacting with workspace:memory_search - Hybrid search
memory_search - Hybrid search
memory_write - Write/create file
memory_write - Write/create file
memory_read - Read file
memory_read - Read file
memory_tree - Browse structure
memory_tree - Browse structure
Workspace Hygiene
Automatic maintenance to keep workspace clean. Hygiene Tasks:1
Deduplication
- Detect near-duplicate documents
- Merge or delete duplicates
- Consolidate redundant information
2
Staleness Detection
- Identify outdated documents
- Flag for review or deletion
- Archive old daily logs
3
Embedding Backfill
- Find chunks without embeddings
- Generate missing embeddings
- Update search index
4
Index Optimization
- Rebuild BM25 indices
- Optimize vector index (IVFFLAT)
- Vacuum deleted chunks
- Runs during heartbeat (if enabled)
- Manual trigger via
/hygienecommand - Background task (configurable interval)
Best Practices
Memory Management
Memory Management
- Keep MEMORY.md concise - This loads into every prompt
- Use daily logs for ephemeral notes - Auto-rotates
- Create project subdirectories - Organize by topic
- Curate periodically - Remove stale content
- Search before asking - Agent should check memory first
Path Organization
Path Organization
Daily Log Usage
Daily Log Usage
Do:
- Append session summaries
- Log important decisions
- Track progress on tasks
- Store long-term facts (use MEMORY.md)
- Put sensitive data (use secrets store)
- Create manual daily logs (auto-generated)
Next Steps
Memory Tools
Using memory_search, memory_write, and memory_read
Search Configuration
Tuning hybrid search parameters
Identity Setup
Configuring agent personality and behavior
Heartbeat System
Setting up periodic background checks