File Writer OpenClaw Skill
Safely write or append text content to files ONLY in /home/alfred/.openclaw/workspace/scratch. Creates backups before overwriting ({filename}.bak, .bak.1, et...
v1.0.0
Recently Updated
Updated Today
Installation
clawhub install scratch-file-writer
Requires npm i -g clawhub
193
Downloads
0
Stars
0
current installs
0 all-time
1
Versions
Power your OpenClaw skills with
the best open-source models.
Drop-in OpenAI-compatible API. No data leaves Europe.
Explore Inference APIGLM
GLM 5
$1.00 / $3.20
per M tokens
Kimi
Kimi K2.5
$0.60 / $2.80
per M tokens
MiniMax
MiniMax M2.5
$0.30 / $1.20
per M tokens
Qwen
Qwen3.5 122B
$0.40 / $3.00
per M tokens
File Writer Skill
Quick Start
- Base directory: /home/alfred/.openclaw/workspace/scratch. All paths relative to this (e.g., "notes.txt" or "subdir/log.md").
- Sanitize: Reject if path contains '../', starts with '/', or has non-text extensions (allow only .txt, .md, .log, .json).
- Primary tools: 'write' for saving, 'read' for checks/backups, 'exec' for mkdir -p (fallback to message if unavailable).
- Mode: Write (default/overwrite with backup), append (if specified).
Step-by-Step Workflow
- Parse query: Extract rel_path (e.g., "subdir/notes.txt"), content, mode (write/append; infer from phrases like "update" = write).
- If missing (e.g., "write that information"), use message to ask for rel_path/content.
- Sanitize: Validate rel_path (no escapes, safe extension). Compute full_path = base_dir + rel_path.
- Create subdirs if needed: Extract parent from rel_path; call 'exec'("mkdir -p [base_dir]/[parent]") or message: "Please run
mkdir -p [full_parent]and confirm." - Check existence (call 'read' on full_path):
- If exists and write mode: Create backup (read content, find unique .bak.N path, 'write' to it).
- Confirm overwrite/append: Use message ("Confirm [action] on [file]? Yes/No").
- Execute:
- Write: 'write' full_path with content.
- Append: 'read' existing, concatenate content, 'write' back.
- Handle errors: Reply with details; log via message ("Wrote [bytes] to [full_path] at [timestamp]").
- If tools fail, fallback: Message requesting user runs
echo "[content]" > [full_path]or>>for append.
Safety Guidelines
- Limits: Max 50k chars; reject binary/large.
- Backups: Always for overwrites; increment .bak.N until unique (e.g., check with 'read').
- Sensitive paths: If contains 'secret' or 'key', double-confirm.
- No auto-mkdir if exec unavailable: Require user confirmation/action.
- See references/safety.md for patterns.
Edge Cases
- Empty content: Reject with "Content required."
- Non-existent for append: Treat as write.
- Existing .bak: Increment (e.g., .bak.1, .bak.2; use loop with 'read' to find next).
- Invalid path: "Invalid: Must be relative text file in scratch."
- Large content: Reject or chunk (multiple writes if over limit).
Bundled Resources
- scripts/backup_file.sh: Fallback Bash for creating backups if tools limited.
- references/safety.md: Sanitization and confirmation patterns.
Statistics
Downloads 193
Stars 0
Current installs 0
All-time installs 0
Versions 1
Comments 0
Created Mar 17, 2026
Updated Apr 22, 2026
Author
Nagilem
@nagilem
Latest Changes
v1.0.0 · Mar 17, 2026
Initial version for scratch writes
Quick Install
clawhub install scratch-file-writer Related Skills
Other popular skills you might find useful.
Chat with 100+ AI Models in one App.
Use Claude, ChatGPT, Gemini alongside with EU-Hosted Models like Deepseek, GLM-5, Kimi K2.5 and many more.