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/rubyroidlabs/rails_api_keys/contextgit clone --depth 1 https://github.com/rubyroidlabs/rails_api_keysWhat 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.00727 | $0.00727 |
| Opus 5 | $0.00364 | $0.00364 |
| Sonnet 5 | $0.00145 | $0.00145 |
| Haiku 4.5 | $0.00073 | $0.00073 |
Grade A, and why
context 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.
How it starts
The opening of the file, as written. The whole thing — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.
rails_api_keys Context
Single source of truth for engine state and architecture
Overview
Reusable Rails engine that issues and authenticates personal API keys. Intentionally thin: keys + auth helpers only. Public MIT-licensed gem.
Naming
- Gem / require / repo:
rails_api_keys - Module:
RailsApiKeys - Table:
rails_api_keys_api_keys - Generator:
rails_api_keys:install
Technology
- Rails engine (
>= 7.0), isolated namespaceRailsApiKeys - Active Record for
rails_api_keys_api_keys - No frontend, mailers, jobs, or mounted business routes
Public surface
has_api_keys (on owner models)
- Declares polymorphic
has_many :api_keysand registers the model as an allowed owner - Adds
create_api_key!(name:, permission:)→[record, raw_token](wrapsApiKey.generate_for!) - Multiple models may opt in (e.g.
User,Company) - Models without the macro cannot own keys
Configuration (RailsApiKeys.configure) — all optional
| Option | Default | Purpose |
|---|---|---|
token_prefix |
nil → "#{AppName.downcase}_ak_" |
Prefix for generated raw tokens |
owner_active |
uses active_for_authentication? when present |
Gate authenticate on owner liveness |
Host initializers should only set overrides; do not restate defaults.
RailsApiKeys::ApiKey
- Polymorphic
belongs_to :owner - Permissions:
read,read_write(immutable after create) generate_for!(owner:, name:, permission:)→[record, raw_token]authenticate(raw_token)→ active key if digest matches and owner active; toucheslast_used_atrevoke!setsrevoked_at- Stores
token_digest(SHA-256),token_display_prefix; never plaintext
RailsApiKeys::Authentication
authenticate_api_key!— Bearer token →current_api_key/current_api_owner; 401 on auth failure; GET/HEAD require read, other methods require write (403 if lacking)
Install
bin/rails generate rails_api_keys:install
bin/rails db:migrate
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.
- yesterday First seen · 97 lines · 727 tokens per session scan A 68efa394df7c
context is a cursor rule published in the GitHub repository rubyroidlabs/rails_api_keys (10 stars, last pushed 15d ago), licensed MIT. It adds 727 tokens to every session, about $0.0036 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-31.
Other cursor rules, from other repositories
upgrade-tests
// ✅ CORRECT: Upgrade package pattern await using ctx = testReactResource(appRouter, { server: { // server configuration }, client(opts) { return { links: [ httpLink({ url: opts.httpUrl, // client configuration }), ], }; }, }).
test-running
When running tests, use the --watch false flag to avoid watch mode.
middleware
When you need create a middleware to protect some page of Next.js app.
memory
Establishes a persistent memory protocol for capturing and retrieving knowledge, including storage strategies, context retrieval, and proactive memory management for continuous learning.
taskmaster
Comprehensive reference for Taskmaster MCP tools and CLI commands.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.