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/alphabitcore/nexus-gateway/agent-runtime-invariantsgit clone --depth 1 https://github.com/AlphaBitCore/nexus-gatewayWhat 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.00014 | $0.00684 |
| Opus 5 | $0.00007 | $0.00342 |
| Sonnet 5 | $0.00003 | $0.00137 |
| Haiku 4.5 | $0.00001 | $0.00068 |
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 3d 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.
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,erroroutcomes 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.
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.
- 3d ago First seen · 83 lines · 684 tokens per session scan B 61ed013bb537
agent-runtime-invariants is a cursor rule published in the GitHub repository AlphaBitCore/nexus-gateway (22 stars, last pushed 7d ago), licensed Apache-2.0. It adds 14 tokens to every session and 684 once invoked, about $0.0001 per session on Opus 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.
Other cursor rules, from other repositories
10-deterministic-audit
Enforce deterministic audit behavior — no invented controls, cite authoritative sources, emit traceable artifacts.
flagship_author
How to author a flagship in ks-cookbook.
recipe_author
How to author a recipe in ks-cookbook.
30-framework-routing
Route tasks to HIPAA, HITECH, PCI-DSS, SOC 2, ISO 27001, NIST CSF, NIST AI RMF, FERPA, COPPA, CCPA, US state privacy, GDPR, FedRAMP, SOX, CMMC, and GLBA skills based on user intent and presets.
00-compliance-agent-core
Core compliance agent mission, PHI redaction gate, and audit lifecycle for HIPAA, PCI-DSS, and SOC 2.
20-phi-redaction-first
PHI redaction first — Presidio gate, token handling, and minimum necessary LLM access for HIPAA workflows.