Safer line edits
The edit tool needs an exact text match. The edit_lines tool (hashline) edits by line numbers from the model’s last read, with a hash proving the file has not changed since.
If the hash still matches, the edit applies. If the file drifted, tsforge tries recovery instead of silently writing to the wrong lines.
Always on.
Read format
Section titled “Read format”When the model reads a file with hashline enabled, it sees:
¶src/app.ts#3F2A1:import { foo } from "./foo";2:export function main() {}¶path#HASH is the anchor. HASH is four hex characters from the file contents at read time.
Edit format
Section titled “Edit format”| Operation | Syntax |
|---|---|
| Replace lines | replace N..M: then lines prefixed with + |
| Delete lines | delete N or delete N..M |
| Insert lines | insert before N: or insert after N: |
Line numbers are 1-based. Multiple ops apply bottom-up so line numbers stay stable.
If the hash is stale
Section titled “If the hash is stale”| Result | Meaning |
|---|---|
| Hash matches | edit applies |
| Hash mismatch | tsforge tries a 3-way merge from a snapshot |
| Merge fails | model must re-read and retry |
→ File ops · Big picture