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.
npx agentmods add rules/atlassian/forge-skills/global-state-warmstartgit clone --depth 1 https://github.com/atlassian/forge-skillsWrote 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.
[](https://agentmods.dev/rules/atlassian/forge-skills/global-state-warmstart)<a href="https://agentmods.dev/rules/atlassian/forge-skills/global-state-warmstart"><img src="https://agentmods.dev/badge/rules/atlassian/forge-skills/global-state-warmstart.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00015 | $0.01282 |
| Opus 5 | $0.00008 | $0.00641 |
| Sonnet 5 | $0.00003 | $0.00256 |
| Haiku 4.5 | $0.00002 | $0.00128 |
Grade A, and why
global-state-warmstart 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 5d ago.
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.
How it starts
The opening of the file, as written. The whole thing — 185 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Context
- Forge RuntimeV2 uses AWS Lambda which reuses runtime instances (warm starts). Module-level variables and global state persist across invocations, potentially from different tenants.
- Related CWE: CWE-668 (Exposure of Resource to Wrong Sphere), CWE-1189 (Improper Isolation of Shared Resources).
- Critical for multi-tenant Marketplace apps.
RuntimeV2 Behavior
┌─────────────────────────────────────┐
│ Lambda Container │
│ ┌─────────────────────────────────┐ │
│ │ Warm Start Reuse │ │
│ │ ┌─────────────────────────────┐ │ │
│ │ │ Invocation 1 (Tenant A) │ │ │
│ │ │ Sets: globalCache.data │ │ │
│ │ └─────────────────────────────┘ │ │
│ │ ↓ │ │
│ │ ┌─────────────────────────────┐ │ │
│ │ │ Invocation 2 (Tenant B) │ │ │
│ │ │ Reads: globalCache.data │ │ │ ← TENANT LEAK!
│ │ └─────────────────────────────┘ │ │
│ └─────────────────────────────────┘ │
└─────────────────────────────────────┘
Scope & Signals
- Dangerous patterns:
- Module-level variables outside handler functions.
- Caches without tenant-scoped keys.
- Global configuration objects modified at runtime.
- Feature flag caches shared across tenants.
- Sources: Any tenant-specific data (user info, configurations, API responses).
- Risk: Data from Tenant A accessible to Tenant B on subsequent invocations.
Vulnerable Patterns
// VULNERABLE - Module-level cache without tenant scoping
const issueCache = {}; // Persists across Lambda invocations!
export async function handler(payload, context) {
const issueId = payload.issueId;
if (!issueCache[issueId]) {
issueCache[issueId] = await fetchIssue(issueId);
}
return issueCache[issueId]; // May return data from another tenant
}
// VULNERABLE - Global configuration
let appConfig = null;
export async function getConfig(context) {
if (!appConfig) {
appConfig = await storage.get('config'); // Tenant A's config
}
return appConfig; // Tenant B gets Tenant A's config!
}
// VULNERABLE - Feature flags
const featureFlags = {};
export async function isFeatureEnabled(feature, context) {
if (!featureFlags[feature]) {
featureFlags[feature] = await checkFeature(feature);
}
return featureFlags[feature];
}
// VULNERABLE - User session/state
let currentUser = null;
export async function getCurrentUser(context) {
if (!currentUser) {
currentUser = await fetchUser(context.accountId);
}
return currentUser; // Wrong user for subsequent invocations!
}
Secure Patterns
// SECURE - Tenant-scoped cache keys
const cache = new Map();
function getCacheKey(tenantId, resourceId) {
return `${tenantId}:${resourceId}`;
}
export async function handler(payload, context) {
const tenantId = context.installContext.cloudId;
const cacheKey = getCacheKey(tenantId, payload.issueId);
if (!cache.has(cacheKey)) {
cache.set(cacheKey, await fetchIssue(payload.issueId));
}
return cache.get(cacheKey);
}
// SECURE - Fresh state per invocation
export async function handler(payload, context) {
// Create fresh state for each invocation
const state = {
config: null,
user: null
};
state.config = await storage.get('config');
state.user = await fetchUser(context.accountId);
return processRequest(payload, state);
}
// SECURE - Clear cache at invocation start
export async function handler(payload, context) {
// Reset relevant state
resetTenantState();
// Process with fresh context
return await processRequest(payload, context);
}
function resetTenantState() {
issueCache.clear();
configCache.clear();
userCache.clear();
}
// SECURE - Use WeakMap with tenant context as key
const tenantCaches = new WeakMap();
export async function getCache(context) {
const tenantKey = { id: context.installContext.cloudId };
if (!tenantCaches.has(tenantKey)) {
tenantCaches.set(tenantKey, new Map());
}
return tenantCaches.get(tenantKey);
}
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.
- 5d ago First seen · 185 lines · 15 tokens per session scan A 468fa37e44e6
global-state-warmstart is a cursor rule published in the GitHub repository atlassian/forge-skills (21 stars, last pushed 6d ago), licensed Apache-2.0. It adds 15 tokens to every session and 1,282 once invoked, about $0.0001 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-08-30.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
cli-error-handling
CLI command error handling patterns.
prefer-assertions-over-defensive-checks
Prefer assertions over defensive checks when data is guaranteed to be valid.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.
control-plane-descriptors
Control plane descriptor and instance implementation patterns.