Gemini went insane and destroyed my entire project!

After I spent a few days building an RPG in ai studio, Gemini suddenly went entirely insane, deleted all the files, then repeatedly tried to reconstruct the source code by downloading jadx and decompiling the APK. I can’t get it to restore the project to a sane state and it tells me that it can’t do a “git reset --hard”. Can anyone help?

Hi @DaveK

A few questions

What tool are you using Gemini in ?

What model are you using ?

AI studio, and 3.5 flash

Ok, I managed to work around the problem by downloading the source from GitHub in a zip file, asking ai studio to create a new empty project, importing the zip file using the code explorer, and asking Gemini to reintegrate it into the project.

During the course of all this, I found out that the files in the workspace are not actually part of a checked-out git working directory, and GitHub integration is part of the project workspace infrastructure outside Gemini’s control and effectively one-way only, allowing GitHub to be updated but not allowing reversions or branching or anything that would transfer information from GitHub to ai studio.

I think making this connection two-way by allowing the workspace files to be a git repo would be the best solution, as it would give the AI full access to git functionality directly without having to do a ton of work on the infrastructure GitHub integration. However, at a very minimum, allowing clean rollbacks to current/earlier revisions from within the infrastructure integration would really help.

Can anyone from Google open this as an enhancement request, please?

Cant you explain more about your problem,???..

Yes, I can, because it has now happened a couple more times. I’m using AI studio in Brave browser on Android. What seems to happen is that after switching away from the tab or browser, or doing a refresh, the studio UI suddenly shows the “I made some changes” message, followed by a huge list of deleted files - I of course have not deleted all my project files.

I can generally restore to a checkpoint successfully, now that I know it can happen, but there is definitely some external force trashing the workspace container.

It just happened again, and for the first time, Gemini noticed:

Gemini 3.5 Flash

Ran for 328s

summarize_auto

Action history

chevron_right

Here are key actions taken for the app:

edit

Edited 2 files

app/src/test/java/com/example/ExampleUnitTest.kt

check_circle

app/src/test/java/com/example/GreetingScreenshotTest.kt

check_circle

build

Built

I have generated highly detailed ASCII art maps for every town and dungeon level (including building interiors) in the game. All maps have been written as individual text files directly in the root directory of the project, as well as neatly organized in a separate /maps/ directory.

An index file, MAP_INDEX.txt, has been generated at the project root to serve as a comprehensive catalog.

:world_map: Map Index Summary (MAP_INDEX.txt)

The index file includes a universal symbol legend and maps out the directory tree structure:

Universal Legend:

# : Solid walls, crags, and mountain boundaries.

. : Walkable grassy floors and smooth stone floor paths.

Y : Forest tiles creating borders in towns.

▲ : High mountain boundaries framing town layouts.

~ : Water bodies (rivers, lakes, and oceans).

░ : Shorelines in towns and deep bottomless fissures (pits/ravines) in dungeons.

+ : Portals, doorways, and building thresholds.

= : Wooden rope bridges spanning over deep caverns and pits.

< : Stairs up leading back towards safety or previous dungeon floors.

> : Stairs down leading into deeper, more dangerous levels.

$ : Valuable treasure chests.

O : Decorative town fountains.

& : Statues honoring local historical legends.

E : Main building entrances.

^ : Solid roof covers and overhead ceilings.

Ω : Massive boss encounters or critical dungeon cores.

:open_file_folder: File Structure and Layout

1. Generated Towns & Building Interiors

For every town, we export the layout of the town itself and the interior rooms of every interactive building:

MAP_TOWN_Oakvale_Village.txt

Interiors: Elder Charles’ Manor, Oakvale Cozy Inn, Cozy Cottages, and the Oakvale General Store.

MAP_TOWN_Castleton_Capital.txt

Interiors: Castleton Castle, Castleton Dojo, Merchant’s Quarters, and standard residential buildings.

MAP_TOWN_Oasis_Desert_Town.txt

Interiors: Desert Mystic Alchemy, Cozy Cottages, and Merchant’s Quarters.

MAP_TOWN_Shoreline_Port.txt

Interiors: Barnaby’s Harbor Office, Cozy Cottages, and Merchant’s Quarters.

MAP_TOWN_Frostford_Outpost.txt

Interiors: Frontier Command Center, Arctic Remedial Drafts, Cozy Cottages, and Merchant’s Quarters.

MAP_TOWN_Eldoria_Ruins.txt

Interiors: Ancient Eldorian Sanctuary.

MAP_TOWN_Eastern_Island_Dock.txt

Interiors: Eastern Ferry Terminal, Cozy Cottages, and Oakvale General Store.

2. Generated Dungeon Levels

We export every floor of every dungeon sequentially:

Goblin Cave: Floors 1, 2, and 3 (MAP_DUNGEON_Goblin_Cave_Floor_[1-3].txt)

Spider Nest: Floor 1 (MAP_DUNGEON_Spider_Nest_Floor_1.txt)

Slime Den: Floor 1 (MAP_DUNGEON_Slime_Den_Floor_1.txt)

Bandit Hideout: Floors 1 and 2 (MAP_DUNGEON_Bandit_Hideout_Floor_[1-2].txt)

Ancient Crypt: Floors 1, 2, and 3 (MAP_DUNGEON_Ancient_Crypt_Floor_[1-3].txt)

Sea Temple: Floors 1, 2, 3, and 4 (MAP_DUNGEON_Sea_Temple_Floor_[1-4].txt)

Swamp Fortress: Floors 1, 2, and 3 (MAP_DUNGEON_Swamp_Fortress_Floor_[1-3].txt)

Abandoned Mine: Floors 1, 2, and 3 (MAP_DUNGEON_Abandoned_Mine_Floor_[1-3].txt)

Icy Cave: Floors 1, 2, and 3 (MAP_DUNGEON_Icy_Cave_Floor_[1-3].txt)

Sunken Ruins: Floors 1, 2, 3, and 4 (MAP_DUNGEON_Sunken_Ruins_Floor_[1-4].txt)

Volcano Temple: Floors 1, 2, 3, and 4 (MAP_DUNGEON_Volcano_Temple_Floor_[1-4].txt)

Dark Castle: Floors 1, 2, 3, 4, and 5 (MAP_DUNGEON_Dark_Castle_Floor_[1-5].txt)

:artist_palette: Visual & Aesthetic Elements of the ASCII Maps

The ASCII maps are rendered using precise layout alignment to maintain consistent grid shapes and highlight specific environmental designs:

Cavern Outlines and Walls: Uses high-contrast # lines to form rugged, organic cavern shapes in dungeons and solid square house frames in towns.

Pits and Ravines: Rendered as shaded voids (░) cutting across paths, showing the physical gap that players must span using ropes or bridges.

NPC Overlays: In building maps, NPC spawn coordinates are overlaid with their initials (e.g., K for King Reginald, S for Shopkeepers, P for Seraphina, etc.) along with a clear index at the bottom detailing their coordinates.

Entrance and Exit Stairs: Clear indicators < and > show the exact pathways through which the player advances or retreats.

flag

Checkpoint

summarize_auto

Manual edit

edit

Edited 182 files

.build-outputs/app-debug.apk

check_circle

debug.keystore.base64

check_circle

.env.example

delete

.gitignore

delete

README.md

delete

app-debug.apk

delete

app/.gitignore

delete

app/build.gradle.kts

delete

app/proguard-rules.pro

delete

app/src/androidTest/java/com/example/ExampleInstrumentedTest.kt

delete

app/src/main/AndroidManifest.xml

delete

app/src/main/java/com/example/GameData.kt

delete

app/src/main/java/com/example/GameEngine.kt

delete

app/src/main/java/com/example/GameView.kt

delete

app/src/main/java/com/example/MainActivity.kt

delete

app/src/main/java/com/example/SaveSystem.kt

delete

app/src/main/java/com/example/SpriteAssets.kt

delete

app/src/main/java/com/example/ui/theme/Color.kt

delete

app/src/main/java/com/example/ui/theme/Theme.kt

delete

app/src/main/java/com/example/ui/theme/Type.kt

delete

app/src/main/res/drawable/ic_launcher_background.xml

delete

app/src/main/res/drawable/ic_launcher_foreground.xml

delete

app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

delete

app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

delete

app/src/main/res/mipmap-hdpi/ic_launcher.webp

delete

app/src/main/res/mipmap-hdpi/ic_launcher_round.webp

delete

app/src/main/res/mipmap-mdpi/ic_launcher.webp

delete

app/src/main/res/mipmap-mdpi/ic_launcher_round.webp

delete

app/src/main/res/mipmap-xhdpi/ic_launcher.webp

delete

app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp

delete

app/src/main/res/mipmap-xxhdpi/ic_launcher.webp

delete

app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp

delete

app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp

delete

app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp

delete

app/src/main/res/values/colors.xml

delete

app/src/main/res/values/strings.xml

delete

app/src/main/res/values/themes.xml

delete

app/src/main/res/xml/backup_rules.xml

delete

app/src/main/res/xml/data_extraction_rules.xml

delete

app/src/test/java/com/example/ExampleRobolectricTest.kt

delete

app/src/test/java/com/example/ExampleUnitTest.kt

delete

app/src/test/java/com/example/GreetingScreenshotTest.kt

delete

app/src/test/screenshots/greeting.png

delete

assets/.aistudio/.gitignore

delete

build.gradle.kts

delete

gradle.properties

delete

gradle/libs.versions.toml

delete

settings.gradle.kts

delete

app/src/main/java/com/example/RetroSynthPlayer.kt

delete

app/src/main/java/com/example/SubMapGenerator.kt

delete

MAP_BUILDING_Castleton_Capital_building_castleton_castle.txt

delete

MAP_BUILDING_Castleton_Capital_building_castleton_dojo.txt

delete

MAP_BUILDING_Castleton_Capital_building_generic_left.txt

delete

MAP_BUILDING_Castleton_Capital_building_generic_right.txt

delete

MAP_BUILDING_Eastern_Island_Dock_building_generic_left.txt

delete

MAP_BUILDING_Eastern_Island_Dock_building_island_ferry.txt

delete

MAP_BUILDING_Eastern_Island_Dock_building_oakvale_shop.txt

delete

MAP_BUILDING_Eldoria_Ruins_building_eldoria_temple.txt

delete

MAP_BUILDING_Frostford_Outpost_building_frostford_cmd.txt

delete

MAP_BUILDING_Frostford_Outpost_building_frostford_mika.txt

delete

MAP_BUILDING_Frostford_Outpost_building_generic_left.txt

delete

MAP_BUILDING_Frostford_Outpost_building_generic_right.txt

delete

MAP_BUILDING_Oakvale_Village_building_generic_left.txt

delete

MAP_BUILDING_Oakvale_Village_building_oakvale_elder.txt

delete

MAP_BUILDING_Oakvale_Village_building_oakvale_inn.txt

delete

MAP_BUILDING_Oakvale_Village_building_oakvale_shop.txt

delete

MAP_BUILDING_Oasis_Desert_Town_building_generic_left.txt

delete

MAP_BUILDING_Oasis_Desert_Town_building_generic_right.txt

delete

MAP_BUILDING_Oasis_Desert_Town_building_oasis_alchemy.txt

delete

MAP_BUILDING_Shoreline_Port_building_generic_left.txt

delete

MAP_BUILDING_Shoreline_Port_building_generic_right.txt

delete

MAP_BUILDING_Shoreline_Port_building_shoreline_office.txt

delete

MAP_DUNGEON_Abandoned_Mine_Floor_1.txt

delete

MAP_DUNGEON_Abandoned_Mine_Floor_2.txt

delete

MAP_DUNGEON_Abandoned_Mine_Floor_3.txt

delete

MAP_DUNGEON_Ancient_Crypt_Floor_1.txt

delete

MAP_DUNGEON_Ancient_Crypt_Floor_2.txt

delete

MAP_DUNGEON_Ancient_Crypt_Floor_3.txt

delete

MAP_DUNGEON_Bandit_Hideout_Floor_1.txt

delete

MAP_DUNGEON_Bandit_Hideout_Floor_2.txt

delete

MAP_DUNGEON_Dark_Castle_Floor_1.txt

delete

MAP_DUNGEON_Dark_Castle_Floor_2.txt

delete

MAP_DUNGEON_Dark_Castle_Floor_3.txt

delete

MAP_DUNGEON_Dark_Castle_Floor_4.txt

delete

MAP_DUNGEON_Dark_Castle_Floor_5.txt

delete

MAP_DUNGEON_Goblin_Cave_Floor_1.txt

delete

MAP_DUNGEON_Goblin_Cave_Floor_2.txt

delete

MAP_DUNGEON_Goblin_Cave_Floor_3.txt

delete

MAP_DUNGEON_Icy_Cave_Floor_1.txt

delete

MAP_DUNGEON_Icy_Cave_Floor_2.txt

delete

MAP_DUNGEON_Icy_Cave_Floor_3.txt

delete

MAP_DUNGEON_Sea_Temple_Floor_1.txt

delete

MAP_DUNGEON_Sea_Temple_Floor_2.txt

delete

MAP_DUNGEON_Sea_Temple_Floor_3.txt

delete

MAP_DUNGEON_Sea_Temple_Floor_4.txt

delete

MAP_DUNGEON_Slime_Den_Floor_1.txt

delete

MAP_DUNGEON_Spider_Nest_Floor_1.txt

delete

MAP_DUNGEON_Sunken_Ruins_Floor_1.txt

delete

MAP_DUNGEON_Sunken_Ruins_Floor_2.txt

delete

MAP_DUNGEON_Sunken_Ruins_Floor_3.txt

delete

MAP_DUNGEON_Sunken_Ruins_Floor_4.txt

delete

MAP_DUNGEON_Swamp_Fortress_Floor_1.txt

delete

MAP_DUNGEON_Swamp_Fortress_Floor_2.txt

delete

MAP_DUNGEON_Swamp_Fortress_Floor_3.txt

delete

MAP_DUNGEON_Volcano_Temple_Floor_1.txt

delete

MAP_DUNGEON_Volcano_Temple_Floor_2.txt

delete

MAP_DUNGEON_Volcano_Temple_Floor_3.txt

delete

MAP_DUNGEON_Volcano_Temple_Floor_4.txt

delete

MAP_INDEX.txt

delete

MAP_TOWN_Castleton_Capital.txt

delete

MAP_TOWN_Eastern_Island_Dock.txt

delete

MAP_TOWN_Eldoria_Ruins.txt

delete

MAP_TOWN_Frostford_Outpost.txt

delete

MAP_TOWN_Oakvale_Village.txt

delete

MAP_TOWN_Oasis_Desert_Town.txt

delete

MAP_TOWN_Shoreline_Port.txt

delete

maps/MAP_BUILDING_Castleton_Capital_building_castleton_castle.txt

delete

maps/MAP_BUILDING_Castleton_Capital_building_castleton_dojo.txt

delete

maps/MAP_BUILDING_Castleton_Capital_building_generic_left.txt

delete

maps/MAP_BUILDING_Castleton_Capital_building_generic_right.txt

delete

maps/MAP_BUILDING_Eastern_Island_Dock_building_generic_left.txt

delete

maps/MAP_BUILDING_Eastern_Island_Dock_building_island_ferry.txt

delete

maps/MAP_BUILDING_Eastern_Island_Dock_building_oakvale_shop.txt

delete

maps/MAP_BUILDING_Eldoria_Ruins_building_eldoria_temple.txt

delete

maps/MAP_BUILDING_Frostford_Outpost_building_frostford_cmd.txt

delete

maps/MAP_BUILDING_Frostford_Outpost_building_frostford_mika.txt

delete

maps/MAP_BUILDING_Frostford_Outpost_building_generic_left.txt

delete

maps/MAP_BUILDING_Frostford_Outpost_building_generic_right.txt

delete

maps/MAP_BUILDING_Oakvale_Village_building_generic_left.txt

delete

maps/MAP_BUILDING_Oakvale_Village_building_oakvale_elder.txt

delete

maps/MAP_BUILDING_Oakvale_Village_building_oakvale_inn.txt

delete

maps/MAP_BUILDING_Oakvale_Village_building_oakvale_shop.txt

delete

maps/MAP_BUILDING_Oasis_Desert_Town_building_generic_left.txt

delete

maps/MAP_BUILDING_Oasis_Desert_Town_building_generic_right.txt

delete

maps/MAP_BUILDING_Oasis_Desert_Town_building_oasis_alchemy.txt

delete

maps/MAP_BUILDING_Shoreline_Port_building_generic_left.txt

delete

maps/MAP_BUILDING_Shoreline_Port_building_generic_right.txt

delete

maps/MAP_BUILDING_Shoreline_Port_building_shoreline_office.txt

delete

maps/MAP_DUNGEON_Abandoned_Mine_Floor_1.txt

delete

maps/MAP_DUNGEON_Abandoned_Mine_Floor_2.txt

delete

maps/MAP_DUNGEON_Abandoned_Mine_Floor_3.txt

delete

maps/MAP_DUNGEON_Ancient_Crypt_Floor_1.txt

delete

maps/MAP_DUNGEON_Ancient_Crypt_Floor_2.txt

delete

maps/MAP_DUNGEON_Ancient_Crypt_Floor_3.txt

delete

maps/MAP_DUNGEON_Bandit_Hideout_Floor_1.txt

delete

maps/MAP_DUNGEON_Bandit_Hideout_Floor_2.txt

delete

maps/MAP_DUNGEON_Dark_Castle_Floor_1.txt

delete

maps/MAP_DUNGEON_Dark_Castle_Floor_2.txt

delete

maps/MAP_DUNGEON_Dark_Castle_Floor_3.txt

delete

maps/MAP_DUNGEON_Dark_Castle_Floor_4.txt

delete

maps/MAP_DUNGEON_Dark_Castle_Floor_5.txt

delete

maps/MAP_DUNGEON_Goblin_Cave_Floor_1.txt

delete

maps/MAP_DUNGEON_Goblin_Cave_Floor_2.txt

delete

maps/MAP_DUNGEON_Goblin_Cave_Floor_3.txt

delete

maps/MAP_DUNGEON_Icy_Cave_Floor_1.txt

delete

maps/MAP_DUNGEON_Icy_Cave_Floor_2.txt

delete

maps/MAP_DUNGEON_Icy_Cave_Floor_3.txt

delete

maps/MAP_DUNGEON_Sea_Temple_Floor_1.txt

delete

maps/MAP_DUNGEON_Sea_Temple_Floor_2.txt

delete

maps/MAP_DUNGEON_Sea_Temple_Floor_3.txt

delete

maps/MAP_DUNGEON_Sea_Temple_Floor_4.txt

delete

maps/MAP_DUNGEON_Slime_Den_Floor_1.txt

delete

maps/MAP_DUNGEON_Spider_Nest_Floor_1.txt

delete

maps/MAP_DUNGEON_Sunken_Ruins_Floor_1.txt

delete

maps/MAP_DUNGEON_Sunken_Ruins_Floor_2.txt

delete

maps/MAP_DUNGEON_Sunken_Ruins_Floor_3.txt

delete

maps/MAP_DUNGEON_Sunken_Ruins_Floor_4.txt

delete

maps/MAP_DUNGEON_Swamp_Fortress_Floor_1.txt

delete

maps/MAP_DUNGEON_Swamp_Fortress_Floor_2.txt

delete

maps/MAP_DUNGEON_Swamp_Fortress_Floor_3.txt

delete

maps/MAP_DUNGEON_Volcano_Temple_Floor_1.txt

delete

maps/MAP_DUNGEON_Volcano_Temple_Floor_2.txt

delete

maps/MAP_DUNGEON_Volcano_Temple_Floor_3.txt

delete

maps/MAP_DUNGEON_Volcano_Temple_Floor_4.txt

delete

maps/MAP_INDEX.txt

delete

maps/MAP_TOWN_Castleton_Capital.txt

delete

maps/MAP_TOWN_Eastern_Island_Dock.txt

delete

maps/MAP_TOWN_Eldoria_Ruins.txt

delete

maps/MAP_TOWN_Frostford_Outpost.txt

delete

maps/MAP_TOWN_Oakvale_Village.txt

delete

maps/MAP_TOWN_Oasis_Desert_Town.txt

delete

maps/MAP_TOWN_Shoreline_Port.txt

delete

flag

Checkpoint

Thank you! Do those maps automatically get updated if you change any layouts?

Gemini 3.5 Flash

Ran for 8s

lightbulb

Thought for 8 seconds

No, they do not update automatically on their own because they are static text files written to the disk.

If we change the generation algorithms or layouts in the code, the text files remain as they were until we manually trigger an update. To update them to match the new layouts, we have to re-run the unit test we created (ExampleUnitTest) by running the Gradle task:

code

Bash

gradle :app:testDebugUnitTest

This test executes the map generator, renders the grid of tiles as ASCII characters, and overwrites the text files with the new layouts.

(Note: I noticed you just deleted the project source files, test files, and map files! If you’d like to restore the game or rebuild the map generator, just let me know and we can set it back up.)

I didn’t delete those files, it is a bug in the AI studio infrastructure that is sometimes triggered when I refresh my browser tab or perhaps when I switch between mobile and desktop view. Take no action now, but explain how you suggest to set everything back up? I will probably choose to restore from a checkpoint, but are there any alternative methods?

Gemini 3.5 Flash

Ran for 10s

lightbulb

Thought for 10 seconds

If you encounter an infrastructure bug that accidentally deletes your project files, restoring your workspace to its previous functional state is highly straightforward. Here are the primary and alternative methods to recover your application:

1. Restore from a Checkpoint (Recommended & Safest)

The AI Studio platform maintains automated checkpoints of your project. This is the most reliable way to recover all deleted code, resources, and configurations in a single click:

How to do it: Open the project settings or version history panel in the AI Studio interface, select a checkpoint from before the issue occurred, and choose Restore.

Why it is best: It perfectly recreates the exact state of the virtual filesystem, including hidden build configurations, assets, and Gradle files, without requiring any manual file transfers.

2. Alternative Recovery Methods

If checkpoint restoration is unavailable or you prefer other options, you can use these alternatives:

A. Restore via GitHub Integration

If you utilized the AI Studio Push to GitHub feature (accessible via the settings menu) before the files vanished:

You can pull the latest commit from your repository back into the workspace.

Alternatively, you can download the repository as a ZIP and re-import it.

B. Re-import from a Local ZIP Export

If you previously exported the project as a ZIP (via the “Export Project” option in the settings menu):

You can upload the ZIP or unzip its contents back into the project’s file explorer to instantly restore your latest local snapshot.

C. Full Re-generation via the Coding Agent (Me)

If no external backups, GitHub repositories, or checkpoints exist, I can programmatically rebuild the application files for you:

How it works: Because our conversation history retains the logic, architectural decisions, and code changes made during our session, you can simply ask me to rebuild the codebase.

Process: I would re-initialize the core Android project files (including manifests,

build scripts, resources, and themes) and then re-write the primary Kotlin components (like the map generators, game engine, views, and assets) step-by-step.

What to do next?

To get everything running again, restoring from a checkpoint is the fastest and cleanest path. Once you have initiated the restore, please let me know, and we can immediately pick up right where we left off!

terminal

4 errors running the code

lightbulb_tips

Make changes, add new features, ask for anything