Hierarchical AI Guidelines

AI guidelines are a fairly simple concept. Every time you ask AI to do some edit, CodeVROOM includes them in the prompt in a separate “general guidelines” section.

Overview

Guidelines can be defined globally (stored in %LOCALAPPDATA%\CodeVROOM on Windows or ~/.codevroom on Linux/Mac) or per workspace. You can open the guideline editor via AI->Manage Guidelines:

Guidelines can be enabled/disabled globally by unchecking the corresponding checkbox, and you can also enable/disable them for a particular editing session via the AI Context window:

If you are running language models on a slow GPU and want to heavily reduce the prompt size, you can uncheck individual guidelines, and CodeVROOM will immediately show you how it affects the prompt.

Typical Use

Guidelines are useful when your coding style or other preferences differ from what the model typically produces. E.g. when we started using collection expressions in C# ([“foo”, “bar”]), some models were not very familiar with them, and kept changing them back into the older syntax (new string[]{“foo”, “bar”}). It’s not very difficult to decline such edits via the reviewing GUI or to tell “don’t change [] to new()“, but it’s annoying to do that every time.

A rather concise guideline like this fixed it once and for all:

If you encounter collection expressions in the code (e.g. [x, y] instead of new int[]{x, y}), do not change them back to old-style expressions. The C# compiler handles them correctly.

Language models have no problem ignoring irrelevant instructions, so guidelines don’t have to make sense for every edit. If the guideline says “don’t change collection expressions” and the code outright doesn’t contain any collection expressions, the model will simply ignore it.

The only drawback is that all active guidelines contribute to the context window usage (and token costs), so if you want to define guidelines for a specific rare task, you can use AI techniques instead.