Install
openclaw skills install workspace-tempManage temporary files in workspace temp directory. All non-essential files must go to temp/, keeping workspace root clean. Auto-detects workspace from openclaw.json config.
openclaw skills install workspace-tempNote: This skill requires access to
~/.openclaw/openclaw.json(to readagents.defaults.workspace) and thesessions_listtool (to get current session ID). It is NOT enabled by default (always: false). Users must explicitly enable it in their config.
Ensure all temporary/cached files go to <workspace>/temp/<session_id>/, never pollute the workspace root.
This skill requires the following access:
| Resource | Purpose | Justification |
|---|---|---|
~/.openclaw/openclaw.json | Read agents.defaults.workspace configuration | Required to determine the workspace path where temp/ directory will be created. Read-only access to single config file. |
sessions_list tool | Get current session ID | Required to create isolated temp directories per session (prevents file conflicts between concurrent sessions). |
| External file system | Read user-specified files | Required when user asks to process files from outside the workspace. Files are only read and copied to temp directory. |
Note: The sessions_list tool and external file access are runtime capabilities documented here for transparency.
This skill operates under strict safety constraints:
<workspace>/temp/<session_id>/ only⚠️ Sensitive Data: Files processed through this skill may temporarily contain sensitive data in the temp directory. Avoid processing files with passwords, keys, or secrets.
⚠️ Behavioral Guarantee: The promise not to modify pre-existing workspace files is a best-effort guarantee, not technical enforcement. The instruction guides the agent but cannot prevent all edge cases.
~/.openclaw/openclaw.json to get agents.defaults.workspacesessions_list<workspace>/temp/<session_id>/ as the temp directoryDefinition: All files and directories in the workspace root at the time this skill is installed.
These files remain unchanged:
Additional Note: Files manually added to the workspace root by the user after installation will also not be modified or deleted by this skill. However, users are encouraged to follow the principle: "Non-temporary files go in the root directory, temporary files go in temp/."
Definition: Files read from or downloaded from outside the workspace.
These files must go to temp/:
Not Temporary Files:
1. Read ~/.openclaw/openclaw.json
2. Extract agents.defaults.workspace
3. Get current session ID via sessions_list
4. Temp dir = <workspace>/temp/<session_id>/
Example:
E:/OpenClaw/workspaceabc123E:/OpenClaw/workspace/temp/abc123/Always determine temp dir dynamically:
// Pseudocode
const config = readFile('~/.openclaw/openclaw.json');
const workspace = config.agents.defaults.workspace;
// Get current session ID via sessions_list tool
const sessions = sessions_list();
const currentSession = sessions.find(s => s.key.includes('main'));
const sessionId = currentSession ? currentSession.sessionId : generateFallbackId();
const tempDir = path.join(workspace, 'temp', sessionId);
// Error handling: ensure directory creation succeeds
try {
ensureDirExists(tempDir);
} catch (error) {
throw new Error(`Failed to create temp directory: ${tempDir}. Reason: ${error.message}. Please check permissions or disk space.`);
}
Error Handling Principles:
temp/ or <session_id>/ directory cannot be created (e.g., insufficient permissions, disk full), a clear error message must be provided<workspace>/temp/<session_id>/<workspace>/temp/<session_id>/<workspace>/temp/<session_id>/User says: "Read the report.txt from my desktop"
~/.openclaw/openclaw.json to get workspace<workspace>/temp/<session_id>/report.txtUser says: "Download this image"
<workspace>/temp/<session_id>/image.jpgUser says: "Convert this PDF"
<workspace>/temp/<session_id>/, clean up after conversionWhen the user explicitly requests cleanup assistance (e.g., "Check my temp directory", "Clean up temp files"), evaluate the following conditions and offer appropriate actions:
| Trigger | Condition | Action | User Options |
|---|---|---|---|
| Large Directory | Temp directory > 500MB | Alert: "Your temp directory is using X GB. Clean up?" | "Clean up" (delete) / "Keep" / "I'll do it myself" (provide path) |
| Old Files | Files older than 7 days | Alert: "Found X files older than 7 days. Clean up?" | Same as above |
| Session Residuals | Current session temp not empty | Alert: "This session created X temporary files. Keep or clean up?" | Same as above |
| Status Check | User asks for temp status | Report: size, file count, oldest files, then offer cleanup | Same as above |
<session_id>/ directory should be cleaned when session endstemp/ at any timetemp/ only contains temporary files; cleanup never affects original workspace filesImportant: Do NOT proactively interrupt users with cleanup reminders. Only check and offer cleanup when explicitly requested.
~/.openclaw/openclaw.json