← 返回
开发者工具 中文

Workspace Temp

Manage temporary files in workspace temp directory. All non-essential files must go to temp/, keeping workspace root clean. Auto-detects workspace from openc...
在工作区临时目录管理临时文件。非必要文件须放入 temp/,保持根目录整洁。自动从 openc... 检测工作区。
lichenyang-zk
开发者工具 clawhub v1.1.5 1 版本 99849.6 Key: 无需
★ 1
Stars
📥 644
下载
💾 4
安装
1
版本
#latest

概述

> Note: This skill requires access to ~/.openclaw/openclaw.json (to read agents.defaults.workspace) and the sessions_list tool (to get current session ID). It is NOT enabled by default (always: false). Users must explicitly enable it in their config.

Workspace Temp Skill

Purpose

Ensure all temporary/cached files go to /temp//, never pollute the workspace root.

Required Permissions

This skill requires the following access:

ResourcePurposeJustification
----------------------------------
~/.openclaw/openclaw.jsonRead agents.defaults.workspace configurationRequired to determine the workspace path where temp/ directory will be created. Read-only access to single config file.
sessions_list toolGet current session IDRequired to create isolated temp directories per session (prevents file conflicts between concurrent sessions).
External file systemRead user-specified filesRequired 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.

Security & Privacy

Skill Safety Guarantees

This skill operates under strict safety constraints:

  • No Code Execution: Does not execute arbitrary code, shell commands, or external programs
  • Isolated Write Scope: All write operations restricted to /temp// only
  • Read-Only External Access: External files are only read and copied, never modified in place
  • Temporary Only: Files are designed to be deleted; no permanent storage outside workspace

User Privacy & Security Notes

⚠️ 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.

How It Works

  1. Read ~/.openclaw/openclaw.json to get agents.defaults.workspace
  2. Get current session unique ID via sessions_list
  3. Use /temp// as the temp directory
  4. Auto-create the directory if it doesn't exist

File Classification Rules

🔒 Original Files (Existing Before Skill Installation)

Definition: All files and directories in the workspace root at the time this skill is installed.

These files remain unchanged:

  • AGENTS.md, SOUL.md, USER.md, TOOLS.md
  • MEMORY.md, HEARTBEAT.md, IDENTITY.md
  • memory/ directory and its contents
  • .git/ directory
  • Any files existing before installation

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/."

🗑️ Temporary Files (Must Go to temp/)

Definition: Files read from or downloaded from outside the workspace.

These files must go to temp/:

  • Files read from user-specified external locations
  • Downloaded files
  • Intermediate files during conversion/processing

Not Temporary Files:

  • Files generated by OpenClaw itself (e.g., session logs, internal caches)
  • Files explicitly requested by the user to be saved to the workspace

Dynamic Temp Directory Resolution

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:

  • If workspace is E:/OpenClaw/workspace
  • If session ID is abc123
  • Then temp dir is E:/OpenClaw/workspace/temp/abc123/

Procedures

Step 1: Get Temp Directory

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:

  • If temp/ or / directory cannot be created (e.g., insufficient permissions, disk full), a clear error message must be provided
  • Never fall back to writing files to the workspace root directory
  • Operation terminates; retry after user resolves the issue

Step 2: Handle External Files

  1. Copy files to /temp//
  2. Read/process from temp
  3. Optionally clean up after processing

Step 3: Handle Downloads

  1. Download directly to /temp//
  2. Optionally clean up after processing

Step 4: Handle Generated Files

  1. Write to /temp//
  2. Delete after use

Examples

User says: "Read the report.txt from my desktop"

  • ❌ Wrong: Read desktop path directly
  • ✅ Correct:
  1. Read ~/.openclaw/openclaw.json to get workspace
  2. Copy to /temp//report.txt
  3. Read content from temp

User says: "Download this image"

  • ❌ Wrong: Download to workspace root
  • ✅ Correct: Download to /temp//image.jpg

User says: "Convert this PDF"

  • ❌ Wrong: Generate intermediate files in root directory
  • ✅ Correct: Generate in /temp//, clean up after conversion

Cleanup Policy

When the user explicitly requests cleanup assistance (e.g., "Check my temp directory", "Clean up temp files"), evaluate the following conditions and offer appropriate actions:

Cleanup Triggers & Actions

TriggerConditionActionUser Options
------------------------------------------
Large DirectoryTemp directory > 500MBAlert: "Your temp directory is using X GB. Clean up?""Clean up" (delete) / "Keep" / "I'll do it myself" (provide path)
Old FilesFiles older than 7 daysAlert: "Found X files older than 7 days. Clean up?"Same as above
Session ResidualsCurrent session temp not emptyAlert: "This session created X temporary files. Keep or clean up?"Same as above
Status CheckUser asks for temp statusReport: size, file count, oldest files, then offer cleanupSame as above

Cleanup Scope

  • Skill-Initiated: Intermediate files should be deleted immediately after use
  • Session-End: Current session's / directory should be cleaned when session ends
  • Manual: Users can clear any subdirectory under temp/ at any time
  • Safety: temp/ only contains temporary files; cleanup never affects original workspace files

Important: Do NOT proactively interrupt users with cleanup reminders. Only check and offer cleanup when explicitly requested.

Notes

  • Temp directory follows workspace configuration and adapts automatically
  • If workspace changes, temp directory follows automatically
  • Always use absolute paths to avoid ambiguity
  • Never touch original files existing before installation
  • This skill is NOT enabled by default - users must explicitly enable it in ~/.openclaw/openclaw.json

版本历史

共 1 个版本

  • v1.1.5 当前
    2026-03-19 11:08 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 427 📥 118,383
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,471
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,522