The post has been translated automatically. Original language: Russian
Usually, the rules for an AI agent follow the same pattern. The agent made a mistake — in AGENTS.md a new line has appeared. I made a mistake again — another paragraph. Six months later, there are dozens of pages in the file, and the agent still violates some of what is written there.
In early December, Grok Bot developer Lauren Tan (@poteto in X) posted an idea with the opposite approach: to transfer as many text rules as possible to the code, types, linters and tests. She believes that almost all unstructured text is a burden for agents in the repository and may even worsen the performance of the model. Therefore, its benefits should be checked by runs (evals), and what can be made obvious from the code should be transferred to the code.
What prompta does
First, the agent collects all the texts for the models: AGENTS.md , skills, editor's rules, specifications. He assigns each requirement to one of three groups. The first is that it is already visible from the code or types, it is deleted. The second is something that is checked automatically.: such a rule becomes a linter, compiler check, test, or CI step, and the text is also deleted. The third is solutions that are not formalized. You can keep them if they are short.
Then the remaining text is checked by experiment. They take one or two common tasks from the repository and write down a rule before launching: how noticeable should the gain be in order for the text to remain. The agent solves tasks in three ways — with all instructions, only with subject ones, and with minimal root ones — with three clean runs each.
Then they look at the run records to see which files the agent actually opened. A separate model blindly evaluates the results: it is shown only diffs and collected artifacts, without branch names and commit hashes. The final report shows which documents were never useful, and where the extra text helped and where it hindered. The text that does not reach the threshold is deleted. If the agent then starts making mistakes again in the same place, this is closed with a test or a linter, and not with a new paragraph.
Lauren has not published her measurements — so far this is an idea and a ready-made product that she suggests trying.
How is it with us
We have come to a similar conclusion in practice. A ban written down in words is sooner or later forgotten by the agent in a long session. A script scanner in the build or a hook that stops a dangerous command before it starts is triggered every time. We still have things in the text files that cannot be translated into verification: why such an architectural decision was made in the project and what follows from it.
Therefore, when you want to add another "never do X" to the agent, you should first consider whether it is possible to catch X with a linter or a test. This is usually faster than dealing with the consequences later.
The original prompta is in X from @poteto.
Обычно с правилами для ИИ-агента всё идёт по одной схеме. Агент ошибся — в AGENTS.md появилась новая строчка. Ошибся снова — ещё абзац. Через полгода в файле десятки страниц, и агент всё равно нарушает часть того, что там написано.
В начале декабря разработчица Grok Bot Лорен Тан (@poteto в X) выложила промпт с обратным подходом: перенести как можно больше текстовых правил в код, типы, линтеры и тесты. Она считает, что почти весь неструктурированный текст для агентов в репозитории — обуза и может даже ухудшать работу модели. Поэтому его пользу надо проверять прогонами (evals), а то, что можно сделать очевидным из кода, переносить в код.
Что делает промпт
Сначала агент собирает все тексты для моделей: AGENTS.md, навыки, правила редактора, спецификации. Каждое требование он относит к одной из трёх групп. Первая — то, что и так видно из кода или типов, это удаляется. Вторая — то, что проверяется автоматически: такое правило становится линтером, проверкой компилятора, тестом или шагом CI, а текст тоже удаляется. Третья — решения, которые не формализуешь. Их можно оставить, если они короткие.
Дальше оставшийся текст проверяют экспериментом. Берут одну-две обычные задачи из репозитория и до запуска записывают правило: насколько заметным должен быть выигрыш, чтобы текст остался. Агент решает задачи в трёх вариантах — со всеми инструкциями, только с предметными и с минимальными корневыми, — по три чистых прогона на каждый.
Потом по записям прогонов смотрят, какие файлы агент на самом деле открывал. Результаты вслепую оценивает отдельная модель: ей показывают только диффы и собранные артефакты, без названий веток и хешей коммитов. В итоговом отчёте видно, какие документы ни разу не пригодились и где лишний текст помог, а где помешал. Текст, который не дотянул до порога, удаляют. Если агент потом снова начнёт ошибаться в том же месте, это закрывают тестом или линтером, а не новым абзацем.
Своих замеров Лорен не публиковала — пока это идея и готовый промпт, который она предлагает попробовать.
Как это у нас
Мы пришли к похожему на практике. Запрет, записанный словами, в длинной сессии агент рано или поздно забывает. Скрипт-сканер в сборке или хук, который останавливает опасную команду до запуска, срабатывает каждый раз. В текстовых файлах у нас остались вещи, которые в проверку не переведёшь: почему в проекте принято такое архитектурное решение и что из этого следует.
Поэтому, когда хочется дописать агенту ещё одно «никогда не делай X», сначала стоит прикинуть, нельзя ли поймать X линтером или тестом. Обычно это быстрее, чем потом разбирать последствия.
Оригинал промпта — в X у @poteto.
Comments 4
Newest Popular