byu

byu

Phoenix `phx.new` generator and AGENTS.md

@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project.

My initial shotgun all-over the place unorganized reactions:

  1. I like the idea of the community having a set of AI instructions that works well for elixir projects, which brings together experimentation from all parts of the community… As someone that just wants to “be productive” and doesn’t want to waste time “prompt engineering” an AGENTS.md file from my own frustrations… seeing what others have done/shared is nice.
  2. The merged AGENTS.md reads like an “Elixir + Phoenix + Ecto” best practices or a conventions document… Phoenix has great guides, Credo is like a best practice enforcer.
  3. Is the generator a place for this? Or would a separate community contributed “Phoenix AI Suggestions Package” (maybe credo?) that usage_rules uses to add to AGENTS.md be a better place?
  4. Is there a Phoenix project’s AI Policy, like Ash Framework: AI Policy - #6 by zachdaniel ?

I’m just curious about what the community thinks about elixir plus AI agents instructions in general.

Most Liked Switch mode

zachdaniel

zachdaniel

Creator of Ash

It already exists, and the Phoenix AGENTS.md will be compatible with the format. usage_rules v1.2.6 — Documentation

chrismccord

chrismccord

Creator of Phoenix

AGENTS.md is for LLMs so I wouldn’t necessarily call it a best practice or convention doc, but there will of course be overlap. The goals with this are gap-filling for SOTA LLMs to supplement their “world knowledge” only, rather than an exhaustive set of guidelines (which exist as phoenix guides). Less capable models will need more gap filling, but also being less capable they will have less world knowledge and I haven’t yet seen lower tier/local models cross be able to really cross the gap regardless of context stuffing. On the other hand, most state of the art models are closely on par with one another gap wise. Surprisingly so even. You can shop the AGENTS.md around to gpt-4.1/claude/gemini 2.5 pro/grok4 and get more or less similar results.

The generator is indeed the place for this :slight_smile:

usage_rules is great, and zach is doing some great work there! It’s hard to beat a dependency free static file value wise at this point. As folks want to customize and extend their own rules they can bring in usage_rules to manage that process and aggregate their other deps that also provide rules. I don’t think credo makes sense at all in this flow. I do think that a mix task that aggregates AGENTS.md across your deps makes total sense, and it’s one thing that fell out of the Elixir contributors summit that Zach kindly took on the burden of running with. As the community standardizes on this stuff and libraries adopt AGENTS.md I could absolutely see deep integration with a mix task/lib out of the box, but in any case, the file must be there when you run phx.new, so even if we made it library generated, it would to be programmatically run inside phx.new to ensure it’s there out of the box.

Not at this time

anibal

anibal

I just generated a new phoenix app and noticed the AGENTS.md was pretty much the same as a few months ago and after doing some digging, as afar as I understand, it is basically one year old. Spent the weekend Fable tokens running evals on it and it looks like 90+ percent of it is no longer relevant, the model priors work just fine.

This experiment took 234 runs, for 3 models, with 7 tasks with and without Usage Rules, not all rules were tested, but for those the up-to-date models (Sonnet 5, Opus 4.8 and Fable 5) scored 94% of compliance, removing 23 of the 29 rules rules had no effect.

I am familiar with Elixir/Phoenix… but that’s it, so I am not suggesting an alternate version.

The harness Claude Code built to run the tests is available in Github is fully vibed, full disclaimer, in case you find it useful. And here is an artifact with the annotated AGENTS.mdfile that provides a quick overview of what was found.

Last Post!

josevalim

josevalim

Creator of Elixir

This is really cool @anibal, awesome job!

When Chris generated those rules, he did so by creating different apps. Given agents can run tasks for longer, what I would do is to have the tasks themselves be the creation of a new app, with features that exercise those paths.

So what I would do:

  1. Ask your agent to generate the specification of three small apps that exercise the features there: authentication, forms, etc. The apps should be small, a todo list that can be shared with teams, a water ingestion tracker, etc.

  2. Evaluate the generation with and without the rules

Would you be willing to run such evals again? Thank you!

Where Next?

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2976 91332 914
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
zachdaniel
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses: I had hope...
New

We're in Beta

About us Mission Statement