惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
GbyAI
GbyAI
M
MIT News - Artificial intelligence
美团技术团队
罗磊的独立博客
雷峰网
雷峰网
量子位
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
D
Docker
小众软件
小众软件
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
WordPress大学
WordPress大学
V
V2EX
博客园_首页
腾讯CDC
The Cloudflare Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
@agent — Code Annotations for AI Agents
Alexander Vo · 2026-04-28 · via DEV Community

@agent — Code Annotations for AI Agents

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 to them.

The repository https://github.com/codebasedlearning/agent-annotations-spec.git proposes one.


The problem in one paragraph

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 not 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.

@agent annotations are a convention for making that knowledge explicit, inline, where the code lives.


What it looks like

Two enums in two languages, two repositories, zero shared interface — linked by a single ident:

# acme.hub / src / errors.py

# @agent sync "error-codes"  Kept in sync manually — no codegen
class ErrorCode(enum.Enum):
    NOT_FOUND    = "not_found"
    FORBIDDEN    = "forbidden"
    CONFLICT     = "conflict"

Enter fullscreen mode Exit fullscreen mode

// acme.clients / api / ErrorCode.kt

// @agent sync "error-codes"
enum class NameErrors(val value: String) {
    NOT_FOUND("not_found"),
    FORBIDDEN("forbidden"),
    CONFLICT("conflict"),
}

Enter fullscreen mode Exit fullscreen mode

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 "error-codes" is the link.

A more consequential example — the difference between a gate and a hint:

# @agent enforced-by "email-uniqueness"  UI feedback only — server is the real gate; this check can be bypassed
def check_email_available(email: str) -> bool: ...

Enter fullscreen mode Exit fullscreen mode

# @agent enforces "email-uniqueness"  Authoritative — client check is UX only, never remove this
async def create_user(email: str, conn: asyncpg.Connection) -> User: ...

Enter fullscreen mode Exit fullscreen mode

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


Format

@agent [command] [ident] [comment]

Enter fullscreen mode Exit fullscreen mode

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

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

Full specification can be found here https://github.com/codebasedlearning/agent-annotations-spec.git


Status

Early draft. The command vocabulary is stable enough to use; the ident convention and agentref:// 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.

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 @agent annotations, and ask again. The delta is the evidence.

I'd love to hear your feedback.