The Problem
Codebases are full of structured text that must maintain precise formatting: Markdown tables, checklists, document outlines, Tailwind class strings, JSON configuration files, and code with strict indentation. When your AI assistant edits these files using string replacement, it must rewrite the structure surrounding the change, and that's where things break.
The issue isn't that the assistant doesn't understand what you want. It's that string replacement forces it to echo and rewrite content that should never have been touched in the first place.
What Goes Wrong Without Structure Preservation
ASCII tables. A developer asks their assistant to insert a new value in the Nth column of a Markdown table. The agent has no concept of columns; it must rewrite the entire table row, or multiple rows, just to place one value. Even a modest change risks misaligned columns, corrupted cell boundaries, and formatting errors in rows that were supposed to remain untouched.
Document outlines. A developer creates a plan memo as an outline with section headers, then asks the agent to populate individual sections out of order, writing the Methodology section before the Introduction. The agent can create the outline, but inserting content into a specific section requires replacing the header and surrounding content to anchor the string replacement. Headers get rewritten, blank lines shift, and populating section 4 before section 2 risks corrupting placeholders for sections that haven't been filled yet.
Tailwind class strings. A developer asks their assistant to add responsive breakpoint classes to a component's className. The class string already contains 20+ utility classes. The agent must read the entire string, echo it back, and replace it with the same string plus the new classes. Any class reordering, whitespace shift, or accidental deletion creates a subtle styling bug that passes linting but breaks the layout.
How Mouse Preserves Structure
With Mouse, the assistant can target the precise location within structured content without touching the surrounding structure.
Columnar Edits for Tables and Checklists
Mouse's columnar editing targets specific column positions across a range of lines. To insert a value in the Nth column of a table, the assistant specifies the column range and the content. Mouse edits only that column, leaving every other cell untouched. To mark checkboxes in a checklist, the assistant targets the checkbox column on the specific lines. The item descriptions are never read or echoed.
Line-Level Inserts for Document Outlines
Populating a section in a document outline requires inserting content after a specific line, not replacing the header. Mouse's insert operation places new content precisely between existing headers without touching the headers themselves. Sections can be populated in any order, and each insertion references the original file's line numbers. When using batch editing, all insertions reference the original file state, so there is no line-drift between operations.
Character-Level Precision for Class Strings and Config Files
Adding classes to a Tailwind className string is a character-level insertion: new classes placed at a specific character offset within the string. Mouse performs this insertion without echoing or rewriting the surrounding classes. The same approach works for JSON configuration files: inserting a new key-value pair at a specific position without disturbing the existing formatting or key order.
Prompting for Structure Preservation
You don't need to specify which Mouse operation to use. Just describe what should change and what shouldn't:
"Insert the new column values into the table without modifying the existing columns or table structure."
"Add the Methodology section content after the Methodology header. Don't rewrite any headers or touch other sections."
"Add
md:w-1/2 lg:w-1/3to the className. Don't rewrite or reorder the existing classes."
Your assistant determines the most efficient way to perform the edit within that constraint. For more details on the operations Mouse provides, see the Edit Operations Reference.
Next Steps
Structure preservation matters most when the cost of getting it wrong is high. The next page covers another high-stakes pattern: Safe Deletion and Code Cleanup.