ai-text-editor

Inspect, search, navigate, and edit text or raw-byte files through a revision-guarded server protocol.

Updated Aug 4, 2026
One-click install
npx skills add https://github.com/tschallacka/ai-skills --skill ai-text-editor-tschallacka
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ai-text-editor
Source: https://github.com/tschallacka/ai-skills/tree/main/ai-text-editor
Command: npx skills add https://github.com/tschallacka/ai-skills --skill ai-text-editor-tschallacka

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Agents editing files through ad-hoc shell commands lose track of document state, apply edits against stale coordinates, and corrupt files when external processes change them. This Skill provides a server-owned editing protocol where every mutation is guarded by a revision, every search hit is addressable by id, and external changes are detected and resolved explicitly. ## Core Features & Use Cases - Revision-guarded editing: insert, replace, undo, redo, and save all require the current revision, with optional expected-text verification and match-id targeting from search results, so edits never apply to stale coordinates. - Multi-mode inspection and search: read files as UTF-8 text, raw bytes, or hex rows, and search with exact, wildcard, regex (Rust/PCRE2), and six fuzzy modes, with paged results persisted in SQLite. - Large-file and recovery support: files above 256 MiB use bounded reads and acknowledged streaming large-edit jobs, journaled edits survive crashes, and external changes are resolved via reload, merge, backup, or force-save. - Use Case: An agent needs to rename a function across a 300 MB log file: it opens the file, runs a bounded exact-text search, confirms the hit with preview lines, applies a replace by match-id, and saves with the returned revision. ## Quick Start Ask the agent to open a file with ai-text-editor, search it for a specific string, and replace that match using the reported revision.

Frequently Asked Questions about ai-text-editor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I edit a file safely with ai-text-editor?▼

Open or read the file first to obtain a revision, then call insert, replace, or save with that revision. Mutations with missing or stale revisions are refused, and you can target a search hit directly by its match-id without computing byte offsets.

How do I search large files without loading them into memory?▼

Provide an explicit line or byte range on every search of a large tab; unbounded scans are refused. Matches persist incrementally in SQLite chunks, and you page through results with the returned pager key, offset, and limit.

Does ai-text-editor work on Windows?▼

Yes. On Windows the client autostarts a loopback-TCP server on an ephemeral port with a per-start private token, discovered the same way as the Unix socket. Every command works unchanged, and TCP endpoints must stay private to the host.

What happens when another process changes the file on disk?▼

Responses report disk_diverged and external_change_pending flags, and mutations are blocked until resolve_external chooses reload, merge, keep, backup, or an acknowledged force-save. Backup preserves the external bytes atomically before any overwrite.

Why was my edit refused with stale_revision or match_id_stale?▼

The document changed after you read the revision or ran the search, so the server refuses to apply coordinates that may no longer be correct. Re-read the file or re-run the search to get a fresh revision or match-id, then retry the edit.

Can ai-text-editor handle binary or non-UTF-8 files?▼

Yes. Open the tab with document-mode raw_bytes or hex_view to inspect and edit exact bytes; invalid UTF-8 is never silently replaced in text mode. A tab's mode is fixed for its lifetime, so close and reopen to change it.