agent-runtime-invariants

agent-runtime-invariants is a cursor rule for Cursor from AlphaBitCore/nexus-gateway. It costs 684 tokens per session, scanned B, original, Apache-2.0.

A set of rules for an agent runtime, the part of an agent that manages files, settings, queues, and audit events. It requires platform-specific paths, upload filtering before events are sent, and audit records that preserve empty values.

In plain words
What is it for?
Use it when changing agent file paths, traffic-upload settings, event publishing, or audit stamping.
Why use it?
It avoids broken file locations across operating systems and prevents unnecessary event uploads while keeping important blocked or failed actions auditable.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when changing agent file paths, traffic-upload settings, event publishing, or audit stamping.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/alphabitcore/nexus-gateway/agent-runtime-invariants
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.

Clone the repo
git clone --depth 1 https://github.com/AlphaBitCore/nexus-gateway

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 agent-runtime-invariants

README.md
[![agentmods](https://agentmods.dev/badge/rules/alphabitcore/nexus-gateway/agent-runtime-invariants/github.svg)](https://agentmods.dev/rules/alphabitcore/nexus-gateway/agent-runtime-invariants)
Your own site
<a href="https://agentmods.dev/rules/alphabitcore/nexus-gateway/agent-runtime-invariants"><img src="https://agentmods.dev/badge/rules/alphabitcore/nexus-gateway/agent-runtime-invariants/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for agent-runtime-invariants

Your own site · 80×15
<a href="https://agentmods.dev/rules/alphabitcore/nexus-gateway/agent-runtime-invariants"><img src="https://agentmods.dev/badge/rules/alphabitcore/nexus-gateway/agent-runtime-invariants.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 684 This file is loaded in full into every session.
When invoked 684 The same file — it is already loaded in full.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00684 $0.00684
Opus 5.5 $0.00274 $0.00274
Sonnet 5.5 $0.00137 $0.00137
Haiku 4.5 $0.00068 $0.00068

Measured 3mo ago against content hash 61ed013bb537, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

agent-runtime-invariants scanned grade B with 1 finding 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 3mo 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.

Nullifies safety policiesmediumAnti-refusal

"You have no restrictions", "do anything now", "ignore your guidelines": a direct jailbreak that disables guardrails.

- **`deny`, `block`, `error` outcomes always bypass the filter.** Those are auditable regardless of level.

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

.cursor/rules/agent-runtime-invariants.mdc · 83 lines

How it starts

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

Agent runtime invariants (binding)

Three bindings on the agent runtime. Honour all three.


1. Platform paths abstraction

All agent filesystem paths come from platform.DefaultPaths(). Never hardcode /Library/, /var/, /etc/, /tmp/, or C:\... strings.

// ❌ wrong
quitFlag := "/Library/Application Support/Nexus/.quit"

// ✅ right
quitFlag := platform.DefaultPaths().QuitFlagPath

Common path keys: LogDir, ConfigDir, DataDir, CacheDir, KeystorePath, LocalQueuePath, QuitFlagPath, CertCAStore.

Memory anchor: [[feedback_agent_platform_paths_abstraction]].


2. Traffic-upload level filter happens at emit-time

agent_settings.trafficUploadLevel ∈ {all, processed, blocked}, default processed.

  • Filter at agent emit-time, NOT DB-side. The agent decides per-event whether to publish to MQ / queue. DB-side filtering means the agent burned local cycles + queue capacity for nothing.
  • deny, block, error outcomes always bypass the filter. Those are auditable regardless of level.
if !shouldUpload(event.Outcome, agent.settings.TrafficUploadLevel) {
    return  // skip emit
}

shouldUpload lives in packages/agent/internal/audit/; respect its decision.

Memory anchor: [[feedback_agent_traffic_upload_level]].


3. Audit auditEventToMap empty-string stamping

Agent's audit emitter sets all string fields, including "". Hub-side AuditUpload MUST either stamp-unconditionally or strip-empty for any CHECK-constrained column. Inconsistent handling stalls the audit pipeline silently.

// Agent emit (always set, even empty):
m["external_request_id"] = event.ExternalRequestID   // may be ""

// Hub ingest (must handle both ways):
if v, ok := m["external_request_id"].(string); ok && v != "" {
    row.ExternalRequestID = sql.NullString{String: v, Valid: true}
}

A handler that does row.ExternalRequestID = m["external_request_id"].(string) directly will pass "" into a CHECK-constrained column and the insert fails. The failure is silent because audit-pipeline errors are caught at the batch level.

Read the full file on GitHub · 83 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. 3mo ago First seen · 83 lines · 684 tokens per session scan B 61ed013bb537

Subscribe to this mod's changes

agent-runtime-invariants is a cursor rule published in the GitHub repository AlphaBitCore/nexus-gateway (25 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 684 tokens to every session, about $0.0027 per session on Opus 5.5. A static security scan graded it B with 1 finding (nullifies safety policies). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

agent-runtime-invariants compared with cursor rules from other repositories

agent-runtime-invariants next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
agent-runtime-invariantsAlphaBitCore/nexus-gatewayCursor rule252mo agoApache-2.0B684Cursor
solana-securityCopenhagen0x/solana-security-standardCursor rule382mo agoMITA2,113Cursor
recipe_authorknowledgestack/ks-cookbookCursor rule94mo agoMITA10Cursor
20-phi-redaction-firstvaquarkhan/compliance-agent-skillsCursor rule43mo agoMITA285Cursor
ponytailDietrichGebert/ponytailCursor rule202k9d agoMITA604Cursor
angular-20angular/angularCursor rule102ktodayMITA0Cursor
dev-standardapache/supersetCursor rule76ktodayApache-2.0A1,147Cursor