rolemule-core

Shared coding rules for the RoleMule application, including its name, error handling, JSON output and background tasks. They require API errors to use defined error types and codes instead of generic HTTP errors.

In plain words
What is it for?
Use them when adding API endpoints, raising authentication or validation errors, handling missing resources, reporting service failures or configuring background work in RoleMule.
Why use it?
They keep errors consistent for clients and make failures easier to classify, test and troubleshoot. They also prevent code from using the wrong application name or response format.

Cursor rule for Claude Code

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.

agentmods
npx agentmods add rules/eliornl/rolemule/rolemule-core
Clone the repo
git clone --depth 1 https://github.com/eliornl/rolemule

Made for: Claude Code.

Per session 2,609 This file is loaded in full into every session.
When invoked 2,609 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.02609 $0.02609
Opus 5 $0.01305 $0.01305
Sonnet 5 $0.00522 $0.00522
Haiku 4.5 $0.00261 $0.00261

Measured 2d ago against content hash 3feb334cbd82, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rolemule-core 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 2d 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.

.claude/rules/rolemule-core.mdc · 135 lines

How it starts

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

RoleMule Core Conventions

App Name

The product name is RoleMule. Use settings.app_name in templates. The repo/folder name is rolemule.

Standardized Error System

Never raise bare HTTPException — always use APIError or the factory functions from utils/error_responses.py.

from utils.error_responses import APIError, ErrorCode, create_error_response
from utils.error_responses import unauthorized_error, forbidden_error, not_found_error, validation_error, rate_limit_error, internal_error, no_api_key_error

# Raise typed errors
raise APIError(ErrorCode.AUTH_INVALID_CREDENTIALS, "Invalid email or password", status_code=401)

# Or use convenience constructors
raise not_found_error("Workflow session")
raise unauthorized_error()
raise rate_limit_error(retry_after=3600)
raise no_api_key_error()   # when neither user key nor server key is configured

Error codes follow a namespace pattern:

  • AUTH_1xxx — authentication/authorization
  • VAL_2xxx — validation
  • RES_3xxx — resource not found/conflict
  • RATE_4xxx — rate limiting
  • EXT_5xxx — external service errors
  • CFG_6xxx — configuration errors (e.g. missing API key)
  • INT_9xxx — internal server errors

Personal access tokens (PAT)

Long-lived CLI/automation auth (rm_pat_ prefix). Implementation: utils/personal_access_tokens.py, migration 20260708_024, API POST/GET/DELETE /api/v1/auth/tokens. get_current_user and WebSocket auth check PAT before JWT. Plaintext shown once on create; SHA-256 hash stored. Revoke all user PATs on password change, password reset, and account delete (with JWT invalidation).

CFG_6001 — No API Key (no_api_key_error())

Use no_api_key_error() (HTTP 422, error_code: "CFG_6001") whenever an LLM-backed endpoint is called but the user is not ready to run LLM. Never use validation_error() for this case — the dedicated code lets the frontend detect it and render a targeted "Add your API key → Settings" prompt instead of a generic error toast.

Read the full file on GitHub · 135 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. 2d ago First seen · 135 lines · 2,609 tokens per session scan A 3feb334cbd82

Subscribe to this mod's changes

rolemule-core is a cursor rule published in the GitHub repository eliornl/rolemule (37 stars, last pushed 3d ago), licensed MIT. It adds 2,609 tokens to every session, about $0.0130 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.