agentleFS
SentryKnown publishergetsentry/sentry-kubernetes/AGENTS.md

sentry-kubernetes

AGENTS.md500 starsChanged 8 months agoApache-2.0View on GitHub

Use Go modules: go mod tidy, go mod download AI commits MUST include:

  • 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

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

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use Go modules: go mod tidy, go mod download

    line 5
  2. Distinctive:

    Follow Sentry commit conventions

    line 35
  3. Distinctive:

    Never writes to the Kubernetes API

    line 51
  4. Very specific:

    Run go fix ./... to apply Go modernizations (also in pre-commit)

    line 69

≈ “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

Package Manager

Use Go modules: go mod tidy, go mod download

Build & Dev Commands

CommandDescription
make buildBuild the Go module
make build-distBuild optimized production binary to dist/
make build-dockerBuild Docker image
make testRun all tests
make test-coverageRun tests with coverage report
make vetRun go vet static analysis
make lintRun golangci-lint
make lint-fixLint with auto-fix
make formatFormat code and tidy modules
make mod-tidyCheck go.mod tidiness (CI check)
make fmt-checkCheck formatting (CI check)
make upgrade-depsUpdate all dependencies
make helpShow all available commands

Commit Attribution

AI commits MUST include:

Co-Authored-By: (the agent model's name and attribution byline)

Commit Messages

  • Follow Sentry commit conventions
  • Format: <type>(<scope>): <subject>
  • Types: feat, fix, ref, perf, docs, test, build, ci, chore
  • Imperative mood, no period, max 70 chars

Project Structure

  • cmd/agent/main.go - Application entry point
  • internal/agent/ - All business logic and handlers
  • k8s/manifests/ - Kubernetes deployment manifests
  • k8s/errors/ - Test error scenario manifests
  • .github/workflows/ - CI/CD pipelines

Architecture

  • Read-only Kubernetes agent - watches cluster events, sends to Sentry
  • Never writes to the Kubernetes API
  • Uses informers for Jobs, CronJobs, Deployments, ReplicaSets
  • Uses watchers for Events and Pods
  • Enhancers enrich Sentry events with K8s metadata
  • Supports custom DSNs via k8s.sentry.io/dsn annotation

Setup

  • First-time setup: make init (installs Brew deps, Go modules, pre-commit hooks)
  • Pre-commit hooks run: build, test, go fix, vet, lint, and dprint formatting

Key Conventions

  • Logging: github.com/rs/zerolog
  • K8s client: k8s.io/client-go v0.35
  • Error reporting: github.com/getsentry/sentry-go
  • Docker: multi-stage build, gcr.io/distroless/static:nonroot runtime
  • RBAC: read-only (watch, list, get only)
  • Run go fix ./... to apply Go modernizations (also in pre-commit)

Environment Variables

  • SENTRY_DSN - Required. Sentry project DSN
  • SENTRY_ENVIRONMENT - Sentry environment name
  • SENTRY_K8S_WATCH_NAMESPACES - Comma-separated namespaces, __all__ for all
  • SENTRY_K8S_MONITOR_CRONJOBS - 1 to enable Crons integration
  • SENTRY_K8S_CUSTOM_DSNS - 1 to enable per-resource DSN annotations
  • SENTRY_K8S_LOG_LEVEL - trace/debug/info/warn/error/fatal/panic/disabled
  • SENTRY_K8S_GLOBAL_TAG_* - Custom tags (prefix stripped)
  • SENTRY_K8S_CLUSTER_CONFIG_TYPE - auto/in-cluster/out-cluster

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.