Skip to main content

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.
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
Example:
Purpose: Define agent’s name, vibe, and personality.Usage:
  • Loaded into system prompt
  • Agent evolves this over time
  • User can edit directly
Example:
Purpose: Behavioral boundaries and ethical guidelines.Usage:
  • Loaded into system prompt
  • Defines what the agent should/shouldn’t do
  • User-editable for customization
Example:
Purpose: Session routine and operational guidelines.Usage:
  • Loaded at session start
  • Tells agent what to do each session
  • Memory management guidelines
Example:
Purpose: Information about the user.Usage:
  • Agent fills in as it learns
  • User can edit directly
  • Loaded into system prompt
Example:
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
Example:

Daily Logs

Automatic session notes keyed by date. Path Format: daily/YYYY-MM-DD.md Usage:
Auto-rotation:
  • New file created each day
  • Last 2 days loaded into system prompt
  • Older logs remain searchable
Example Log:
Combines full-text (BM25) and semantic (vector) search using Reciprocal Rank Fusion.

Search Architecture

How It Works

1

Indexing

When you write a document:
  1. Content is chunked (500 chars, 50 char overlap)
  2. Each chunk gets embedded (1536-dim vector)
  3. Stored in PostgreSQL with pgvector extension
  4. BM25 index built for full-text search
2

Query Processing

When you search:
  1. Query string is embedded
  2. Two parallel searches:
    • BM25 full-text search
    • Vector cosine similarity search
  3. Results merged using RRF
  4. Top-k returned sorted by fused score

Search Configuration

Search Results

Example:

Reciprocal Rank Fusion

RRF combines rankings from multiple sources:
Why RRF?
Vector search alone misses exact keyword matches:

Chunking Strategy

Documents are split into overlapping chunks for better search recall.
Overlap Benefits:
  • 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

Assembled from:
  1. AGENTS.md - Agent Instructions
  2. SOUL.md - Core Values
  3. USER.md - User Context
  4. IDENTITY.md - Identity
  5. MEMORY.md - Long-Term Memory (only in direct sessions, never groups)
  6. daily/today.md - Today’s Notes
  7. daily/yesterday.md - Yesterday’s Notes
Example Result:
MEMORY.md is never loaded in group chat contexts to prevent leaking personal information.

Database Schema

Documents Table

Chunks Table

Embedding Providers

Multiple embedding provider options:
Model: text-embedding-3-smallDimensions: 1536Configuration:
Cost: ~$0.02 per 1M tokens

Memory Tools

Tools for interacting with workspace:
Returns ranked results with path, content, and scores.
Automatically indexes content for search.
Returns file content.
Lists files and directories.

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
Configuration:
Trigger:
  • Runs during heartbeat (if enabled)
  • Manual trigger via /hygiene command
  • Background task (configurable interval)

Best Practices

  1. Keep MEMORY.md concise - This loads into every prompt
  2. Use daily logs for ephemeral notes - Auto-rotates
  3. Create project subdirectories - Organize by topic
  4. Curate periodically - Remove stale content
  5. Search before asking - Agent should check memory first
Use descriptive paths that reflect content hierarchy.
Do:
  • Append session summaries
  • Log important decisions
  • Track progress on tasks
Don’t:
  • 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