<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alexander Voß</title>
    <description>The latest articles on DEV Community by Alexander Voß (@alex-ac).</description>
    <link>https://dev.to/alex-ac</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3901189%2F6455d8c3-1bbf-402b-b596-682ebec864e5.png</url>
      <title>DEV Community: Alexander Voß</title>
      <link>https://dev.to/alex-ac</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alex-ac"/>
    <language>en</language>
    <item>
      <title>@agent — Code Annotations for AI Agents</title>
      <dc:creator>Alexander Voß</dc:creator>
      <pubDate>Mon, 27 Apr 2026 20:48:07 +0000</pubDate>
      <link>https://dev.to/alex-ac/agent-code-annotations-for-ai-agents-2b7h</link>
      <guid>https://dev.to/alex-ac/agent-code-annotations-for-ai-agents-2b7h</guid>
      <description>&lt;h1&gt;
  
  
  &lt;code&gt;@agent&lt;/code&gt; — Code Annotations for AI Agents
&lt;/h1&gt;

&lt;p&gt;AI agents are now a routine part of how code gets read, refactored, and extended. They are a fourth audience alongside humans, compilers, and IDEs — but unlike the other three, they have no established annotation vocabulary written &lt;em&gt;to&lt;/em&gt; them.&lt;/p&gt;

&lt;p&gt;The repository &lt;a href="https://github.com/codebasedlearning/agent-annotations-spec.git" rel="noopener noreferrer"&gt;https://github.com/codebasedlearning/agent-annotations-spec.git&lt;/a&gt; proposes one.&lt;/p&gt;




&lt;h2&gt;
  
  
  The problem in one paragraph
&lt;/h2&gt;

&lt;p&gt;When an agent opens a file in a multi-repo codebase, it sees the file. It does not automatically see that an enum in the Python backend must stay in sync with its counterpart in the Kotlin mobile client, that a client-side validation function is &lt;em&gt;not&lt;/em&gt; the authoritative enforcement point, or that a regex pattern in one module implicitly constrains a constructor in another. A human architect carries that knowledge as hard-won context. An agent reconstructs it from naming and structure — or gets it wrong. And it starts over from scratch in every new session.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;@agent&lt;/code&gt; annotations are a convention for making that knowledge explicit, inline, where the code lives.&lt;/p&gt;




&lt;h2&gt;
  
  
  What it looks like
&lt;/h2&gt;

&lt;p&gt;Two enums in two languages, two repositories, zero shared interface — linked by a single ident:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# acme.hub / src / errors.py
&lt;/span&gt;
&lt;span class="c1"&gt;# @agent sync "error-codes"  Kept in sync manually — no codegen
&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ErrorCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;enum&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Enum&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;NOT_FOUND&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;not_found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;FORBIDDEN&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;forbidden&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;CONFLICT&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;conflict&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="c1"&gt;// acme.clients / api / ErrorCode.kt&lt;/span&gt;

&lt;span class="c1"&gt;// @agent sync "error-codes"&lt;/span&gt;
&lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;NameErrors&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"not_found"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nc"&gt;FORBIDDEN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"forbidden"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nc"&gt;CONFLICT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"conflict"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A reader — human or agent — encountering either file immediately knows the other exists and knows to keep the content in sync. No URI, no build step, no schema. The ident &lt;code&gt;"error-codes"&lt;/code&gt; is the link.&lt;/p&gt;

&lt;p&gt;A more consequential example — the difference between a gate and a hint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# @agent enforced-by "email-uniqueness"  UI feedback only — server is the real gate; this check can be bypassed
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;check_email_available&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# @agent enforces "email-uniqueness"  Authoritative — client check is UX only, never remove this
&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;create_user&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;asyncpg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Connection&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An agent that doesn't know the distinction might remove the server check as redundant. That's a security bug, not a style issue.&lt;/p&gt;




&lt;h2&gt;
  
  
  Format
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@agent [command] [ident] [comment]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Place in any line comment or docstring, adjacent to the symbol it describes. Works in every language that supports comments. No tooling required — &lt;code&gt;grep -r "@agent" .&lt;/code&gt; is enough to find all annotations across a codebase.&lt;/p&gt;

&lt;p&gt;Commands include &lt;code&gt;sync&lt;/code&gt;, &lt;code&gt;defines&lt;/code&gt;, &lt;code&gt;defined-by&lt;/code&gt;, &lt;code&gt;related-to&lt;/code&gt;, &lt;code&gt;enforces&lt;/code&gt;, &lt;code&gt;enforced-by&lt;/code&gt;, &lt;code&gt;assumes&lt;/code&gt;, &lt;code&gt;guarantees&lt;/code&gt;, &lt;code&gt;affects&lt;/code&gt;, &lt;code&gt;deprecated&lt;/code&gt;, and &lt;code&gt;keep&lt;/code&gt;. A bare &lt;code&gt;@agent&lt;/code&gt; with no command is a valid free-form note.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Full specification can be found here &lt;a href="https://github.com/codebasedlearning/agent-annotations-spec.git" rel="noopener noreferrer"&gt;https://github.com/codebasedlearning/agent-annotations-spec.git&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Status
&lt;/h2&gt;

&lt;p&gt;Early draft. The command vocabulary is stable enough to use; the ident convention and &lt;code&gt;agentref://&lt;/code&gt; URI scheme are more provisional. Feedback via issues is welcome — especially reports from real codebases on what works, what is awkward, and what is missing.&lt;/p&gt;

&lt;p&gt;The most useful thing anyone can do right now is the five-minute test: take a file with non-obvious cross-project relationships, ask an agent what would break if you changed it, add &lt;code&gt;@agent&lt;/code&gt; annotations, and ask again. The delta is the evidence.&lt;/p&gt;

&lt;p&gt;I'd love to hear your feedback.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>agents</category>
      <category>softwaredevelopment</category>
      <category>coding</category>
    </item>
  </channel>
</rss>
