A comment-based annotation system (@agents tags) for source code. Language-agnostic, no AST parsing. Tags live in comments and provide structured context about files and code locations for AI coding agents and humans.
SPEC.md— full specification for the@agentstag format (syntax, fields, naming, references, parsing rules)README.md— project overview and usage examplesgit-agent-tags/— Rust CLI tool that installs as agit agent-tagssubcommand
Rust project built with Cargo. Parses @agents tags from source files, builds a reference graph, detects stale headers, and outputs context.
Key source files:
src/main.rs— CLI entry point and subcommand dispatchsrc/parser.rs— tag parsing (file headers and inline tags)src/graph.rs— reference graph constructionsrc/check.rs— validation (broken references, stale headers)src/cache.rs— index caching in.git/agent-headers/src/config.rs— configurationsrc/git.rs— git integration helpers
Build and test: cd git-agent-tags && cargo build && cargo test
All parsing and output behavior must match SPEC.md. When in doubt, the spec is the source of truth. Key rules:
- File headers must appear in the first 30 lines
- Inline tags use
@agents:(with colon), headers use@agents(without) Related:paths are repo-root-relative- Fragment references (
file.ts#tag-name) are validated - Output format is Markdown sections sorted by path then line number