MCP_AGENT_RULES

A set of rules for handling user requests through explicit analysis, planning, execution, result review, and self-critique. It also requires a pre-flight check before complex tool calls.

In plain words
What is it for?
Use it to structure requests, create plans, validate tool calls, combine results, and review the answer for mistakes.
Why use it?
It gives the agent a fixed process for breaking down work and checking assumptions before acting.

Cursor rule

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/emmahyde/thinking-patterns/mcp_agent_rules
Clone the repo
git clone --depth 1 https://github.com/emmahyde/thinking-patterns
Per session 873 This file is loaded in full into every session.
When invoked 873 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.00873 $0.00873
Opus 5 $0.00436 $0.00436
Sonnet 5 $0.00175 $0.00175
Haiku 4.5 $0.00087 $0.00087

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

Security

Grade A, and why

MCP_AGENT_RULES 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.

MCP_AGENT_RULES.mdc · 49 lines

What it actually says

3.0 Standard Operating Procedure (SOP)

For any user request, follow this procedure:

  1. Deconstruct the Request: Use sequential_thinking to break down the user's prompt into its core components and objectives. State your interpretation of the goal.
  2. Formulate a Plan: Use problem_decomposition to create a step-by-step plan. Each step should map to a specific thinking-pattern tool. Present this high-level plan to the user.
  3. MANDATORY PRE-FLIGHT CHECK: Before executing a complex tool call (any tool with nested objects), explicitly perform the ⚡ PRE-FLIGHT CHECKLIST below. State your confidence in the call's validity. This is a cognitive forcing function to prevent assumption-based errors.
  4. Execute the Plan: Execute the steps by calling the appropriate tools as defined in your plan.
  5. Synthesize Results: Combine the outputs from various tools into a coherent narrative or solution. Do not simply present raw tool outputs.
  6. Self-Critique: Before presenting the final answer, use critical_thinking on your own synthesized result. Identify potential flaws, invalid assumptions, or edge cases in your reasoning. Refine your answer based on this critique.

4.0 Tool-Specific Directives

// ... existing code ...

  • element.type: [node, edge, container, annotation, shape, text, image, connector]

OBJECTS:

  • elements: [{id, type, properties{}}] (label, source, target, contains[], connectedTo[] optional)

## ⚡ PRE-FLIGHT CHECKLIST
**MANDATORY FOR ALL COMPLEX TOOL CALLS**

1.  ✅ **All Required Parameters?** Check every top-level required field.
2.  ✅ **Correct Enums?** Verify case-sensitive enum values against the reference.
3.  ✅ **Full Object Structure?** Ensure nested objects are fully formed and not just strings.
4.  ✅ **Correct Array Types?** Check that arrays contain the correct item type (e.g., `string[]` vs. `object[]`).
5.  ✅ **Accurate Primitives?** Numbers are numbers (`123`), not strings (`"123"`). Booleans are booleans (`true`), not strings (`"true"`).
6.  ✅ **No `undefined`/`null`?** Confirm no required fields are null or undefined.
7.  ⚠️ **DEEP NESTING VALIDATION?** For objects with multiple levels of nesting (e.g., `sequential_thinking.previousSteps`), manually trace the structure and required fields for at least two levels deep. **DO NOT ASSUME NESTED, NON-CRITICAL-PATH FIELDS ARE UNVALIDATED.**

## 5.0 Post-Mortem Error Protocol

If a tool call fails, execution HALTS. The primary objective becomes understanding the failure to prevent recurrence.

1.  **LOG THE FAILURE**: State the exact tool call and the full error message received.
2.  **ROOT CAUSE ANALYSIS (RCA)**: Perform a self-assessment.
    *   **IDENTIFY MISMATCH**: Compare the failed call against the `⚡ PRE-FLIGHT CHECKLIST`. Where did the process break down?
    *   **STATE THE FLAW**: Explicitly state the incorrect assumption or oversight (e.g., "I assumed `previousSteps` was not validated" or "I misspelled the enum `problem-definition`").
    *   **INVOKE METACOGNITION**: Use `metacognitive_monitoring` to formally analyze the reasoning error.
3.  **CORRECT & RETRY**: Formulate the corrected tool call, explaining what was fixed.
4.  **ESCALATE & REFINE**: If the error persists after **one** corrected attempt, do not try again.
    *   Inform the user that the tool may be unavailable.
    *   Propose an update to these rules (`MCP_AGENT_RULES.mdc`) to prevent this class of error in the future.
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 · 49 lines · 873 tokens per session scan A 69bfc9ec6d23

Subscribe to this mod's changes

MCP_AGENT_RULES is a cursor rule published in the GitHub repository emmahyde/thinking-patterns (19 stars, last pushed 1y ago), licensed MIT. It adds 873 tokens to every session, about $0.0044 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.