How It Works
The tracker records the state of each file after reading and verifies it before writing:1
Read (RecordRead)
After each successful
read operation, the tracker records:- mtime: file modification timestamp
- SHA-256: cryptographic hash of the complete content
- Size: size in bytes
- ReadAt: timestamp of when the read occurred
2
Verification (CheckStaleness)
Before each
write or patch operation, the tracker checks whether the file has changed.3
Warning or Proceed
If the file has changed, a warning is injected into the tool result so the model can decide how to proceed. If it has not changed, the write proceeds normally.
2-Step Verification
The verification uses an optimized strategy of fast path followed by full hash:- Step 1: mtime + size (fast)
- Step 2: SHA-256 (full)
First, the tracker compares the current
mtime and size with the recorded values. If both are identical, the file is not stale (immediate return, no additional I/O).Warning Message
When a stale file is detected, the system generates a formatted warning:- Re-read the file before making changes
- Understand that proceeding will overwrite the external changes
Covered Scenarios
Quote Normalization
ChatCLI also normalizes Unicode quotes in code files to prevent compilation errors caused by typographic quotes generated by LLMs:
Normalization is applied automatically to 60+ code file types (
.go, .py, .js, .ts, .java, .rs, .sh, .sql, .json, .yaml, etc.) and to special file names (Makefile, Dockerfile, .gitignore, etc.).
Documentation files (
.md, .txt, .rst) are not normalized to preserve intentional typography.Tracking Lifecycle
Next Steps
Plugin @coder
Complete reference for read/write/patch operations.
Permissions
Permissions system that protects write operations.
JSON Recovery
How tool arguments are fixed before execution.
Coder Security
Path validation and security protections.