Blog My Happy PlaceGemma Lara Savill

Value your code, why the .aiexclude file matters

By Gemma Lara Savill
Published at May 11, 2024

Value

This week marked a significant leap forward in my journey with AI development! Gemini AI is finally integrated within Android Studio for my region.

As most Android developers know, Android Studio is the go-to IDE for building Android apps. This integration brings AI significantly closer to the development process. No longer is it a separate tool accessed online; it's now embedded within my core coding environment, a familiar and essential part of my daily workflow.

My first impulse was to protect any proprietary code from the AI in the cloud. I do not want to share all my code. Of course, you can share some code, not all code is equally valuable. Now we have to assess the value of our code.

Value your code

Every project you handle has high value:

  • there are business use cases
  • code that is obfuscated before going out to production
  • configuration files with secrets
  • CI scripts
  • local configuration files that contain local setup info

Never forget how valuable the code you handle is for someone.

Taking control

Android Studio offers robust control over AI interaction. It utilizes a strict opt-in system, ensuring developers are aware before sharing any code. For version-controlled projects, you can leverage an .aiexclude file, similar to a .gitignore file. Interestingly, this file overrides individual developer settings. So, even if another developer chooses to share all their code with Gemini, downloading your project with an empty .aiexclude file prevents any code sharing.

This makes the .aiexclude file a good option for shared projects, as it gives you a source-code level restriction.

Want to share your code with Android Studio's AI Context, but keep certain files private? An empty .aiexclude file will exclude everything by default. Alternatively, you can use it like a .gitignore file. Just list the specific files or folders you want to hide from the AI features within the .aiexclude file. This is ideal for projects with code you're comfortable sharing, but where you also have secret keys or configuration files that should stay private.

Looking forward

I must say I pause and enjoy these moments, committing an .aiexclude file to a code repository for the first time. It's a small act, but it reflects the bigger picture: the dawn of a new era in development. This era demands crucial choices: how much do we share, and how much control are we comfortable relinquishing to AI tools?

Will .aiexclude files become the norm for managing AI interaction in code? While currently specific to Android Studio, this concept could lead to similar exclusion mechanisms in other IDEs. This raises the question: are we heading towards a standardized approach for controlling AI involvement in development across environments?

Nonetheless, I think this is a great move from Google, prioritizing developer control. The ability to manage AI interaction with code through .aiexclude files is a welcome addition to our development toolset.

Here is a more technical read about this.

Legend

IDE: Integrated Development Environment