feature_flags

feature_flags is a cursor rule for Cursor from getsentry/sentry-java. It costs 2 tokens per session (528 once invoked), scanned A, original, MIT.

Java SDK APIs for recording which feature flags were evaluated on a scope or performance span. A feature flag is a setting that enables or disables behavior without changing the deployed code.

In plain words
What is it for?
Use it when adding, changing, limiting, or disabling feature-flag tracking in scopes, spans, or captured events.
Why use it?
It preserves the flag context attached to errors and performance data, making it easier to understand which configuration was active.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/getsentry/sentry-java/feature_flags
Clone the repo
git clone --depth 1 https://github.com/getsentry/sentry-java

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for feature_flags

README.md
[![agentmods](https://agentmods.dev/badge/rules/getsentry/sentry-java/feature_flags.svg)](https://agentmods.dev/rules/getsentry/sentry-java/feature_flags)
Your own site
<a href="https://agentmods.dev/rules/getsentry/sentry-java/feature_flags"><img src="https://agentmods.dev/badge/rules/getsentry/sentry-java/feature_flags.svg" alt="Measured on agentmods" height="20"></a>
Per session 2 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 528 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00002 $0.00528
Opus 5 $0.00001 $0.00264
Sonnet 5 $0.00000 $0.00106
Haiku 4.5 $0.00000 $0.00053

Measured today against content hash 43c58780e146, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

feature_flags scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/feature_flags.mdc · 45 lines

How it starts

The opening of the file, as written. The whole thing — 45 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Java SDK Feature Flags

There is a scope based and a span based API for tracking feature flag evaluations.

Scope Based API

The addFeatureFlag method can be used to track feature flag evaluations. It exists on Sentry static API as well as IScopes and IScope.

When using static API, IScopes or COMBINED scope type, Sentry will also invoke addFeatureFlag on the current span. This does not happen, when directly invoking addFeatureFlag on IScope (except for COMBINED scope type).

The maxFeatureFlags option controls how many flags are tracked per scope and also how many are sent to Sentry as part of events. Scope based feature flags can also be disabled by setting the value to 0. Defaults to 100 feature flag evaluations.

Order of feature flag evaluations is important as we only keep track of the last {maxFeatureFlag} items.

When a feature flag evaluation with the same name is added, the previous one is removed and the new one is stored so that it'll be dropped last. Refer to FeatureFlagBuffer fore more details. FeatureFlagBuffer has been optimized for storing scope based feature flag evaluations, especially clone performance.

When sending out an error event, feature flag buffers from all three scope types (global, isolation and current scope) are merged, choosing the newest {maxFeatureFlag} entries across all scope types. Feature flags are sent as part of the flags context.

Span Based API

It's also possible to use the addFeatureFlag method on ISpan (and by extension ITransaction). Feature flag evaluations tracked this way will not be added to the scope and thus won't be added to error events.

Each span has its own SpanFeatureFlagBuffer. When starting a child span, feature flag evaluations are NOT copied from the parent. Each span starts out with an empty buffer and has its own limit. SpanFeatureFlagBuffer has been optimized for storing feature flag evaluations on spans.

Spans have a hard coded limit of 10 feature flag evaluations. When full, new entries are rejected. Updates to existing entries are still allowed even if full.

Read the full file on GitHub · 45 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 45 lines · 2 tokens per session scan A 43c58780e146

Subscribe to this mod's changes

feature_flags is a cursor rule published in the GitHub repository getsentry/sentry-java (1,349 stars, last pushed today), licensed MIT. It adds 2 tokens to every session and 528 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.