llm-safe-write for Openclaw

A reliable file-writing workflow skill for AI agents designed to eliminate JSON truncation and encoding errors when handling large files or CJK characters.

thinkdonk
v0.1.0
Jun 5, 2026
0
507
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install llm-safe-write

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install llm-safe-write using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is llm-safe-write?

The llm-safe-write skill provides a robust, incremental strategy for writing large files or content containing CJK (Chinese, Japanese, Korean) and special characters. Standard AI file writing tools often fail due to transport-layer JSON truncation when multi-byte characters cross internal buffer boundaries, leading to compilation failures or incomplete code blocks. This skill mitigates that vulnerability entirely.

By leveraging Openclaw Skills, AI agents adopt a proactive skeleton and target-edit approach rather than executing direct, high-risk writes. It guarantees technical accuracy and reliability across long source files, complex configuration schemas, and multi-lingual data payloads without losing critical text or breaking execution environments.

llm-safe-write Use Cases

  • Writing source code or technical documentation files that exceed 50 lines.
  • Injecting Chinese, Japanese, Korean, or specialized non-ASCII strings directly into application files.
  • Recovering immediately after an agent's standard file tool fails with Unterminated string or truncation errors.
  • Initializing multi-function scripts in Python, JavaScript, or TypeScript without risk of silent transport corruption.

How llm-safe-write Works

  1. File Evaluation: The agent assesses the file length and character encoding before writing. If it exceeds 50 lines or contains non-ASCII characters, it routes to this specialized skill workflow.
  2. Skeleton Construction: The agent creates an ASCII-only file framework under 50 lines, swapping complex content and CJK strings with highly unique, descriptive placeholders.
  3. Initial Structural Write: The agent writes the lightweight skeleton file securely to the storage environment.
  4. Incremental Content Injection: The agent invokes targeted, short edit operations changing fewer than 30 lines at a time to replace placeholders with real code or multi-byte text.
  5. Post-Write Verification: A spot-check reads the boundaries of the file to verify completeness, reporting success concisely without leaking internal tool operations.

llm-safe-write Setup

To deploy this module within your Openclaw Skills runtime environment, verify that your active agent configuration includes the necessary file manipulation permissions for reading, writing, and editing.

No standalone terminal setup is needed, but the target file directories must exist beforehand to prevent filesystem errors:

mkdir -p /path/to/target/directory

llm-safe-write Data Schema & Taxonomy

The skill manages tracking and insertion operations across file formats by standardizing layout boundaries with strict code-comment anchors:

File Type Anchor Taxonomy Structure Live Implementation Example
Python # PLACEHOLDER_name pass # PLACEHOLDER_process_data
JavaScript / TypeScript // PLACEHOLDER_name // PLACEHOLDER_render_view
JSON / Data Schemas Same-type valid literal defaults "meta_title": "PLACEHOLDER_seo"

This deliberate schema ensures that files maintain formatting validity and remain parseable throughout the incremental update cycle.

llm-safe-write Advanced Features

  • Multi-Format Architectural Parsing: Context-aware workflows tailored specifically for Python classes, JS/TS functions, structured YAML configurations, and Markdown sections.
  • Automated Collision Recovery: Implements contextual expanding and precise replacement hooks to automatically bypass error types such as matching ambiguity or stale file views.
  • Stable Boundary Anchoring: Utilizes last-line tracking replication algorithms to append code cleanly onto massive legacy files without risking a full-file transport reserialization error.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*