2.11 -- Workspace Structure
Context
OpenClaw organizes its data in a workspace (~/.openclaw/). This folder is created automatically on first launch. Understanding its structure is essential for debugging, backup, and extending the system.
Annotated Directory Tree
~/.openclaw/
βββ workspace/ # Main working directory
β βββ knowledge/ # Knowledge base injected into context
β β βββ domain/ # Domain-specific knowledge
β β βββ system/ # System knowledge (auto-updated)
β βββ memory/ # Persistent memory between sessions
β β βββ MEMORY.md # Main memory file
β β βββ *.md # Thematic memory files
β βββ sessions/ # Session history
β β βββ YYYY-MM-DD/ # Organized by date
β β βββ session-ID.json # Each session with context and exchanges
β βββ skills/ # Dynamically loaded capabilities
β β βββ builtin/ # Built-in skills (not modifiable)
β β βββ custom/ # Your personalized skills
β βββ agents/ # Agent definitions
β βββ default.json # Default agent
β βββ custom/ # Your personalized agents
βββ config.json # Main configuration (section 12)
βββ credentials.json # Tokens and access (encrypted)
βββ logs/ # OpenClaw internal logs
βββ openclaw.log
Role of Each Folder
knowledge/
Contains documents that the agent can consult to answer questions. The domain/ subfolder is yours: place your business documents, specifications, and internal guides there.
$ ls ~/.openclaw/workspace/knowledge/
memory/
Persistent memory. The MEMORY.md file is read automatically at each session. Agents store what they need to remember between conversations there.
$ cat ~/.openclaw/workspace/memory/MEMORY.md
sessions/
Complete history of each conversation. Useful for debugging and auditing. Old sessions can be archived.
skills/
Skills are capabilities that the agent can invoke. The custom/ folder allows you to add your own skills without touching built-in skills.
agents/
Agent definitions with their system instructions, authorized skills, and parameters. The default.json file is used when no agent is specified.
Permissions and Ownership
The entire ~/.openclaw/ folder must belong to your user:
$ ls -la ~/.openclaw/
If it doesn't:
$ sudo chown -R $USER:$USER ~/.openclaw/
Backing Up the Workspace
The workspace contains valuable data (memory, knowledge, sessions). Include it in your backups:
$ tar -czf ~/backups/openclaw-workspace-$(date +%Y%m%d).tar.gz ~/.openclaw/workspace/
Do NOT back up credentials.json in an unencrypted backup.
Common Mistakes
- Modifying files in
builtin/: These files are overwritten with each update. Use thecustom/folder for your changes. - Deleting
MEMORY.md: The agent loses all its memory. Back up this file regularly. - Workspace created by root: If you accidentally ran
sudo openclaw, files will belong to root. Fix this withchown. - Sessions taking up too much space: After a few months, the
sessions/folder can become large. Archive old sessions.
Verification
$ ls -la ~/.openclaw/
$ ls -la ~/.openclaw/workspace/
$ cat ~/.openclaw/workspace/memory/MEMORY.md
Expected results: - The folder exists and belongs to your user - The subdirectories knowledge/, memory/, sessions/, skills/, agents/ exist - MEMORY.md is readable
Estimated Time
10 minutes (exploration and understanding).
Proposer une modification sur GitHub