offline

offline is a cursor rule for Cursor from getsentry/sentry-java. It costs 4 tokens per session (1,092 once invoked), scanned A, original, MIT.

Guidance for how the Java SDK stores monitoring data when a device or server is offline. It covers caching events for later delivery and retrying them after connectivity returns.

In plain words
What is it for?
Use it when configuring offline caching, checking retry behavior, handling rate limits, or working on the SDK’s transport and envelope storage.
Why use it?
It prevents captured errors and other monitoring data from being lost during network outages, when caching is enabled.

Cursor rule for Cursor

About the project

getsentry/sentry-java is a Java and Android software development kit for sending application errors, events, and diagnostic information to Sentry. It is used by developers working with Java, Android, Kotlin, and other JVM-based applications to monitor software behavior. The catalogue rules, skills, instructions, and setting support workflows around this SDK.

getsentry/sentry-java · 1,349 stars · on GitHub

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/offline
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 offline

README.md
[![agentmods](https://agentmods.dev/badge/rules/getsentry/sentry-java/offline.svg)](https://agentmods.dev/rules/getsentry/sentry-java/offline)
Your own site
<a href="https://agentmods.dev/rules/getsentry/sentry-java/offline"><img src="https://agentmods.dev/badge/rules/getsentry/sentry-java/offline.svg" alt="Measured on agentmods" height="20"></a>
Per session 4 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,092 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original 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.00004 $0.01092
Opus 5 $0.00002 $0.00546
Sonnet 5 $0.00001 $0.00218
Haiku 4.5 $0.00000 $0.00109

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

Security

Grade A, and why

offline 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 yesterday.

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/offline.mdc · 88 lines

How it starts

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

Java SDK Offline behaviour

By default offline caching is enabled for Android but disabled for JVM. It can be enabled by setting SentryOptions.cacheDirPath.

For Android, AndroidEnvelopeCache is used. For JVM, if cache path has been configured, EnvelopeCache will be used.

Any error, event, transaction, profile, replay etc. is turned into an envelope and then sent into ITransport.send. The default implementation is AsyncHttpTransport.

If an envelope is dropped due to rate limit and has previously been cached (Cached hint) it will be discarded from the IEnvelopeCache.

AsyncHttpTransport.send will enqueue an AsyncHttpTransport.EnvelopeSender task onto an executor.

Any envelope that doesn't have the Cached hint will be stored in IEnvelopeCache by the EventSender task. Previously cached envelopes (Cached hint) will have a noop cache passed to AsyncHttpTransport.EnvelopeSender and thus not cache again. It is also possible cache is disabled in general.

An envelope being sent directly from SDK API like Sentry.captureException will not have the Retryable hint.

In case the SDK is offline, it'll mark the envelope to be retried if it has the Retryable hint. If the envelope is not retryable and hasn't been sent to offline cache, it's recorded as lost in a client report.

In case the envelope can't be sent due to an error or network connection problems it'll be marked for retry if it has the Retryable hint. If it's not retryable and hasn't been cached, it's recorded as lost in a client report.

In case the envelope is sent successfully, it'll be discarded from cache.

The SDK has multiple mechanisms to deal with envelopes on disk.

  • OutboxSender: Sends events coming from other SDKs like NDK that wrote them to disk.
  • io.sentry.EnvelopeSender: This is the offline cache.

Both of these are set up through an integration (SendCachedEnvelopeIntegration) which is configured to use SendFireAndForgetOutboxSender or SendFireAndForgetEnvelopeSender.

io.sentry.EnvelopeSender is able to pick up files in the cache directory and send them. It will trigger sending envelopes in cache dir on init and when the connection status changes (e.g. the SDK comes back online, meaning it has Internet connection again).

Read the full file on GitHub · 88 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. yesterday First seen · 88 lines · 4 tokens per session scan A c0c6bb0bc778

Subscribe to this mod's changes

offline is a cursor rule published in the GitHub repository getsentry/sentry-java (1,349 stars, last pushed today), licensed MIT. It adds 4 tokens to every session and 1,092 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.