If an AI coding agent rewrote a file and left a comment such as // ... existing code ..., # rest of the file unchanged or /* other methods remain the same */ where real code used to be, Lost Code Finder shows exactly which lines disappeared and puts them back from the last git commit. It checks every file that changed since the last commit, so you find these places before you commit, not after a user reports a missing feature.
// last commit // after the agent's edit
fun total(items: List<Item>): Int { fun total(items: List<Item>): Int {
var sum = 0 // ... existing code ...
for (i in items) sum += i.price }
return sum
}
TODO: implement, raise NotImplementedError, Kotlin TODO("Not yet implemented") and Rust todo!().In IDEs that include the built-in MCP server, the plugin adds a read-only tool, find_lost_code. Its answer starts with NO LOST CODE FOUND or LOST CODE FOUND: n places and, for each place where lines were removed, the committed code with those lines marked, so an agent can put the lines back itself before it says a rewrite is done. Enable Settings | Tools | MCP Server and connect your agent there.
This is a paid product that we keep working on. Questions sent to gramshift.official@gmail.com get an answer within two business days for serious problems and within five business days for everything else, and errors inside the plugin can be reported straight from the IDE's error dialog.
If those lines were in your last git commit, they are still there. In IntelliJ IDEA, PyCharm, WebStorm and other JetBrains IDEs, Lost Code Finder finds every such placeholder comment added since the last commit, lists the lines of the last commit that were deleted there, and restores them as one undoable command when the comment simply replaced the code. Where the agent also wrote new code in the same place, it copies the committed code or opens the diff with the last commit so you can put the lines back by hand.
Run Tools | Find Lost Code. The plugin compares every file that changed since the last git commit with its committed version and reports placeholder comments such as "// ... existing code ...", "# rest of the file unchanged" or "<!-- ... -->" on added lines, together with the lines of the last commit that were deleted in that place.
Yes, in IDEs that include the built-in MCP server. The read-only tool find_lost_code answers NO LOST CODE FOUND or LOST CODE FOUND, and for each place where lines were removed it includes the committed code with the removed lines marked, so the agent can put the lines back before it reports the task as done.
Only when you confirm, and only where every change in that place is a placeholder comment replacing lines. The IDE's diff viewer shows the result first, the place becomes identical to the last commit, and one Undo reverts it. Nothing is restored if the file changed since the search.
No. The plugin makes no network connections; it reads the files of the open project and runs the git command installed on your machine. The find_lost_code tool returns the matching lines only to the AI agent you connected.
Files up to 2 MB are compared, at most 300 changed or new files per search. Deleted and renamed files and files inside submodules are not compared. Lines deleted more than 3 unchanged lines away from the comment are not part of the finding. If a file differs from the last commit by more than 2,000 added and deleted lines, nothing in that file is restored automatically. The project must be inside a git repository with at least one commit, and only changes since the last commit are checked: if an agent's edit was already committed, it is not reported, and lines that were never committed cannot be shown or restored.
The plugin makes no network connections and does not send your code or files anywhere: it reads the files of the open project and runs the git command installed on your machine. If an error occurs inside the plugin, the IDE may offer to send an error report to JetBrains Marketplace. See the Privacy Notice.
Lost Code Finder on JetBrains Marketplace · All GRAMSHIFT plugins · Support: gramshift.official@gmail.com