agentleFS
JetBrainsKnown publisherJetBrains/tracy/AGENTS.md

tracy

AGENTS.md79 starsChanged 9 months agoApache-2.0View on GitHub

Rules for AI agents modifying this codebase. Security - Never commit API keys or credentials - Never log secrets - Use environment variables for sensitive config Sensitive Content Redaction - Tracy redacts AI inputs/outputs by default — do not change this behavior - This is a security requirement, not a bug OpenTelemetry Conventions - Follow OpenTelemetry GenAI semantic conventions - Do not invent custom attribute names Runtime Gating - Spans emit only when SDK is installed via TracingManager.setSdk(...) AND isTracingEnabled…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

15 rules. About 1 is common, 10 are distinctive, and 4 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Common:

    Never commit API keys or credentials

    line 8
  2. Distinctive:

    Use environment variables for sensitive config

    line 10
  3. Distinctive:

    Follow OpenTelemetry GenAI semantic conventions

    line 17
  4. Distinctive:

    Do not invent custom attribute names

    line 18
  5. Distinctive:

    Keep diffs minimal — no drive-by refactoring

    line 26
  6. Distinctive:

    Do not add dependencies without justification

    line 27
  7. Distinctive:

    Add tests for behavior changes

    line 28
  8. Distinctive:

    Update examples if public API changes

    line 29
  9. Distinctive:

    Test across all supported Kotlin versions (1.9.0 – 2.3.0) when modifying plugin logic

    line 50
  10. Distinctive:

    Avoid tracing local (nested) functions

    line 51
  11. Distinctive:

    Use existing providers as reference.

    line 81
  12. Very specific:

    Create tracing/{provider}/ module, register it in settings.gradle.kts

    line 84
  13. Very specific:

    If multiple distinct API endpoints exist, implement EndpointApiHandler per endpoint and delegate from the adapter

    line 86
  14. Very specific:

    Add a public instrument(client) function — use patchOpenAICompatibleClient() for OpenAI-compatible SDKs, or reflection + …

    line 87
  15. Very specific:

    Write tests extending BaseAITracingTest, tag with @Tag("{provider}")

    line 88

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Agent Instructions

Rules for AI agents modifying this codebase.

Critical Rules

Security

  • Never commit API keys or credentials
  • Never log secrets
  • Use environment variables for sensitive config

Sensitive Content Redaction

  • Tracy redacts AI inputs/outputs by default — do not change this behavior
  • This is a security requirement, not a bug

OpenTelemetry Conventions

Runtime Gating

  • Spans emit only when SDK is installed via TracingManager.setSdk(...) AND isTracingEnabled is true
  • Missing SDK = no-op with minimal overhead — preserve this

Code Quality

  • Keep diffs minimal — no drive-by refactoring
  • Do not add dependencies without justification
  • Add tests for behavior changes
  • Update examples if public API changes

Build Commands

./gradlew build                    # full build
./gradlew allTests                 # all tests
./gradlew :tracing:core:allTests   # module tests
./gradlew publishAllToMavenLocal   # publish (NOT plain publish)

Skip provider tests: ./gradlew allTests -Dskip.llm.providers=openai,gemini,anthropic

Key Patterns

Context Propagation

  • withContext, launch propagate automatically
  • runBlocking, raw threads need manual propagation via currentSpanContextElement() / currentSpanContext()

Compiler Plugin

  • @Trace works only in Kotlin
  • Test across all supported Kotlin versions (1.9.0 – 2.3.0) when modifying plugin logic
  • Avoid tracing local (nested) functions

Module Layout

tracy/
├── tracing/
│   ├── core/                 # Core abstractions, @Trace, exporters, OkHttp support
│   ├── openai/               # OpenAI client integration
│   ├── anthropic/            # Anthropic client integration
│   ├── gemini/               # Gemini client integration
│   ├── ktor/                 # Ktor HTTP client integration
│   └── test-utils/           # Shared test utilities
├── plugin/
│   ├── gradle-tracy-plugin/  # Gradle plugin (selects correct compiler plugin)
│   └── tracy-compiler-plugin-*/  # Compiler plugins per Kotlin version (1.9.0–2.3.0)
├── examples/                 # Runnable usage examples
└── publishing/               # Composite build publishing logic

Module Organization

  1. tracing/core: TracingManager, LLMTracingAdapter, EndpointApiHandler, exporters, @Trace annotation
  2. tracing/{openai, anthropic, gemini}: Provider adapters extending LLMTracingAdapter, endpoint handlers, instrument() functions
  3. tracing/ktor: Ktor HTTP client tracing integration
  4. plugin/: Kotlin compiler plugins for @Trace annotation processing
  5. examples/: Reference implementations (keep in sync with API changes)

Adding a New Provider

Use existing providers as reference.

Steps:

  1. Create tracing/{provider}/ module, register it in settings.gradle.kts
  2. Extend LLMTracingAdapter(genAISystem) — override getRequestBodyAttributes, getResponseBodyAttributes, getSpanName, and abstract registerResponseStreamEvent
  3. If multiple distinct API endpoints exist, implement EndpointApiHandler per endpoint and delegate from the adapter
  4. Add a public instrument(client) function — use patchOpenAICompatibleClient() for OpenAI-compatible SDKs, or reflection + patchInterceptors() for others (see GeminiClient.kt)
  5. Write tests extending BaseAITracingTest, tag with @Tag("{provider}")

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.