You Can Finally Pin the Blame on AI-Written Code: Key Takeaways from the Agent Trace Spec

2 min read

Agent Trace is an open-source spec that turns "who / which AI wrote this code" into structured data you can record and query. This post covers the spec's goals, contributor types, and Trace Record structure. It's worth a look for developers and for teams that care about traceability and compliance, since it'll make future code reviews and audits easier. The spec is open and tool-agnostic; if tools like Cursor and Claude Code all support writing to it, it'll be a big help for audits.

As more and more code gets written by agents like Cursor and Claude Code, one question is going to matter more and more: Was this code written by a human or by AI? And which model was used?

Agent Trace, an open protocol recently published by Cursor, was built for exactly this. It's an open spec (currently at the RFC stage) whose goal is to let "AI contributions" be recorded in version control just like human authors.

Agent Trace concept: tracking attribution for code written by humans and AI together

What Is Agent Trace?

Agent Trace is an open-source spec for tracking "who wrote this code," especially attribution between AI and human contributions.

The spec defines a tool-agnostic format so that any compatible tool can read and write this attribution data.

Why Do We Need Agent Trace?

The motivation is simple: agents are writing more and more code, and people need to know which parts are AI-generated and which were written by humans. And it's not just about knowing "was it AI or not"; you also want to be able to link back to the model used, and even the conversation behind it.

Agent Trace defines the format for "attribution data." Any spec-compliant tool can read and write it, so you're not locked into a single vendor.

Agent Trace spec goals and contributor types

What the Spec Aims to Achieve

  • Interoperability: Any compatible tool can read and write attribution data
  • Granularity: Supports attribution down to the "file" and "line" level
  • Extensibility: Vendors can add their own metadata without breaking compatibility
  • Readable by both humans and agents: You can understand it without special tools

What It Deliberately Leaves Out

Agent Trace doesn't deal with code "ownership" or copyright. It doesn't track training data sources, doesn't judge whether AI output is good or bad, and doesn't dictate what UI to use. It's purely a data format and a concept.

Contributor Types

Every code change can be tagged with its source:

TypeDescription
humanWritten by a human
aiGenerated by AI
mixedA human edited AI output, or AI edited human code
unknownCan't be determined

You can also include a model_id (for example anthropic/claude-opus-4-5-20251101), following the naming conventions of models.dev.

Trace Record structure: version, file list, and line ranges

What Does a Trace Record Look Like?

A trace includes: version, ID, timestamp, version control info (git / jj / hg / svn), tool name and version, and a "file list."

Under each file there's a list of "conversations," and each conversation has:

  • URL: Links back to the conversation that produced this code
  • Contributor type
  • Line range: start_line, end_line

When needed, you can also add a content_hash, so the same contribution can still be matched up even after the code gets moved around.

Conclusion

Agent Trace turns "who / which AI wrote this code" into structured data you can record and query, and the format is open and tool-agnostic. For teams that care about traceability and compliance, it's worth getting familiar with now.

If tools like Cursor and Claude Code all end up supporting writing Agent Trace data, you'll be able to see "who changed this part and which model they used" right during code review or compliance audits. That'll be a big help for team collaboration and auditing.

References

  1. Agent Trace official site

Keywords

Agent Trace, AI code attribution, Cursor, Claude Code, open-source spec, RFC, code tracing, structured data, version control, dev collaboration