Coding agents often need to change one section in a README. The usual shortcuts—regex replacement or regenerating the whole file—can silently cross a structural boundary.
I built Texio, an MIT-licensed Rust CLI that gives agents a smaller, fail-closed interface for Markdown: list real headings, inspect one section, preview one replacement, then apply it explicitly.
Here is a small failure case. The second heading-shaped line is only example text inside a fence:
# Demo
## Installation
old command
```md
## Installation
example only
```
## Usage
keep this
A text regex can mistake the fenced line for a section boundary. Texio parses the document structure instead:
cargo install texio-cli --version 0.1.2 --locked
texio headings demo.md --json
texio replace demo.md \
--section Installation \
--text 'cargo install texio-cli --locked' \
--dry-run
The dry run prints a unified diff and leaves the file unchanged. Replace --dry-run with --write only after reviewing that diff. If Installation is missing or appears more than once as a real heading, Texio refuses to write instead of guessing.
I also packaged this workflow as an Agent Skill for Codex, Claude Code, and compatible clients. The instructions make agents inspect headings, preview the exact edit, write it, and check the repository diff:
npx --yes skills@1.5.26 add \
https://github.com/Allra-Fintech/texio/tree/2141d66531ad10a748e11c566428fba3e80c7e4e/skills/texio-markdown \
--skill texio-markdown
The checked-in four-fixture benchmark passed 4/4 cases with Texio, 3/4 with an idealized whole-file baseline, and 2/4 with the disclosed regex proxy. That is a small mechanics benchmark, not a claim about every Markdown document, model, or token bill.
I maintain Texio. I would especially value examples of repository automation that currently rewrites a README or uses a multiline regex to replace one named section.
Disclosure: I wrote and verified the project claims, commands, and results. AI tools assisted with development and editing this article; the DEV disclosure tier is “AI-Assisted (Some AI).”