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/vk-org-resolutiongit clone --depth 1 https://github.com/AlphaBitCore/nexus-gatewayWrote 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/alphabitcore/nexus-gateway/vk-org-resolution)<a href="https://agentmods.dev/rules/alphabitcore/nexus-gateway/vk-org-resolution"><img src="https://agentmods.dev/badge/rules/alphabitcore/nexus-gateway/vk-org-resolution.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.00000 | $0.00740 |
| Opus 5 | $0.00000 | $0.00370 |
| Sonnet 5 | $0.00000 | $0.00148 |
| Haiku 4.5 | $0.00000 | $0.00074 |
Grade A, and why
vk-org-resolution 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 — 63 lines — stays where its author put it; the contents beside it link to each section on GitHub.
VK org resolution — two join chains (binding)
packages/ai-gateway/internal/platform/store/virtualkey.go:vkSelectSQL resolves VirtualKey → Organization through TWO independent chains:
| VK type | Chain |
|---|---|
application |
VirtualKey.projectId → Project → Organization |
personal |
VirtualKey.ownerId → NexusUser → Organization |
The SQL JOINs both and COALESCEs the application chain first.
Required SQL pattern
LEFT JOIN "Project" p ON vk."projectId" = p.id
LEFT JOIN "Organization" org ON p."organizationId" = org.id
LEFT JOIN "NexusUser" u ON vk."ownerId" = u.id
LEFT JOIN "Organization" u_org ON u."organizationId" = u_org.id
COALESCE(p."organizationId", u."organizationId") AS organization_id
COALESCE(org.name, u_org.name) AS organization_name
COALESCE(org.timezone, u_org.timezone) AS organization_timezone
When to apply
Touching any of:
vkSelectSQLitself (or any sibling SELECT that joins through Project/Org/NexusUser)- A new column on
traffic_eventthat depends on the VK's parent (timezone, billing account, primary AccountManager, parent org id) - A new VK type beyond
application/personal - The audit pipeline's
identityJSONB stamping
Why this matters
Latent bugs in the personal-VK code path hide indefinitely when traffic is dominated by application VKs — a missing join surfaces only on the first personal-VK request. Touching personal-VK-adjacent code without testing both VK types = silent NULL columns in prod. Memory anchor: [[feedback_vk_org_dual_join_chain]].
Forbidden
- "Simplifying" the SQL by dropping the second
LEFT JOINor theCOALESCE. The twoOrganizationjoins via different aliases (org,u_org) are load-bearing. - Adding a Go-side fallback in caller code (e.g. "if
meta.OrganizationID == ""then look upmeta.OwnerIDand readnexus_user.organizationId"). The fallback belongs in SQL — caller code reads the resolved value, not raw chains. - Adding a new VK-derived column without verifying it has both chains' coverage.
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 · 63 lines · 0 tokens per session scan A 603238aff624
vk-org-resolution is a cursor rule published in the GitHub repository AlphaBitCore/nexus-gateway (23 stars, last pushed 3d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 740 tokens. 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
ehs-ims-conventions
EHS IMS app — RBAC, data layer, tRPC, migrations, AI boundaries.
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.