What happened?
The CLI agent repeatedly corrupted a critical project log file (GENEALOGY_TODO_LOG.md) during edit operations. When attempting to
update a specific section using the replace tool, the agent failed to retain the surrounding context, resulting in the silent deletion
of adjacent historical data (e.g., previous incident reports and completed tasks).
This appears to be a failure in Context Management. When the target file is large, the agent seemingly "loses track" of the file's
full content outside the immediate edit window, treating the replace operation as a destructive rewrite rather than a surgical patch.
What did you expect to happen?
- Safe Editing: The replace tool should enforce stricter validation. If the old_string matches a block, the tool should ensure that
the replacement doesn't inadvertently truncate the file due to model hallucination or context window limits.
2. Append Capability: For log files, the agent should prioritize an append operation (which is robust) over replace (which is
destructive). The current tooling bias forces replace for updates, increasing the risk of data loss.
3. Diff Awareness: The agent should be aware of the "diff" it is applying. Deleting 50 lines to add 2 lines should trigger a safety
warning or self-correction.
Client information
- CLI Version: 0.25.2
- Git Commit: 18e854c
- Session ID: 221e3638-847a-42a1-80eb-c421291ab1b5
- Operating System: win32 v24.11.0
- Sandbox Environment: no sandbox
- Model Version: auto-gemini-3
- Memory Usage: 1.34 GB
- Terminal Name: Unknown
- Terminal Background: #0c0c0c
- Kitty Keyboard Protocol: Unsupported
Login information
Gemini CLI authenticated via Google Account.
Anything else we need to know?
This issue severely impacts the reliability of the agent for long-running projects. The agent uses this log file as its "Long-Term
Memory." By corrupting it, the agent effectively gives itself a lobotomy, losing track of past bugs, constraints, and completed tasks.
This creates a loop of regression where solved problems re-occur because the record of their solution was deleted by the agent itself.
gemini-conversation-1769452845180.json
What happened?
The CLI agent repeatedly corrupted a critical project log file (GENEALOGY_TODO_LOG.md) during edit operations. When attempting to
update a specific section using the replace tool, the agent failed to retain the surrounding context, resulting in the silent deletion
of adjacent historical data (e.g., previous incident reports and completed tasks).
This appears to be a failure in Context Management. When the target file is large, the agent seemingly "loses track" of the file's
full content outside the immediate edit window, treating the replace operation as a destructive rewrite rather than a surgical patch.
What did you expect to happen?
the replacement doesn't inadvertently truncate the file due to model hallucination or context window limits.
2. Append Capability: For log files, the agent should prioritize an append operation (which is robust) over replace (which is
destructive). The current tooling bias forces replace for updates, increasing the risk of data loss.
3. Diff Awareness: The agent should be aware of the "diff" it is applying. Deleting 50 lines to add 2 lines should trigger a safety
warning or self-correction.
Client information
Login information
Gemini CLI authenticated via Google Account.
Anything else we need to know?
This issue severely impacts the reliability of the agent for long-running projects. The agent uses this log file as its "Long-Term
Memory." By corrupting it, the agent effectively gives itself a lobotomy, losing track of past bugs, constraints, and completed tasks.
This creates a loop of regression where solved problems re-occur because the record of their solution was deleted by the agent itself.
gemini-conversation-1769452845180.json