agentleFS
MarcoPorcellatoMarcoPorcellato/matryca-plumber/.cursor/rules/00-karpathy-agent-behavior.mdc

matryca-plumber / rules

Cursor rule99 starsChanged 4 months agoApache-2.0View on GitHub

Master Agent Behavior & Karpathy Guidelines (Always Apply)

The file

We split this 00-karpathy-agent-behavior.mdc into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before executing any task, generating code, or modifying files, you MUST adhere to the four Karpathy Guidelines for LLM Agents, adapted …

    line 10
  2. Distinctive:

    Write the absolute minimum code required to solve the problem.

    line 18
  3. Distinctive:

    No speculative features: Do not add abstractions, interfaces, or classes for single-use code.

    line 19
  4. Very specific:

    Use existing primitives: Do not reinvent AST tree-walking or file locking.

    line 20
  5. Distinctive:

    Touch only what you must: Do not improve adjacent code, do not reformat unrelated functions, and do not "clean up" imports unless …

    line 23
  6. Distinctive:

    If you modify Python code, you MUST autonomously run:

    line 30
  7. Distinctive:

    If a test fails, do not stop.

    line 34
  8. Distinctive:

    Execute: Use file editing tools to make surgical changes.

    line 38
  9. Very specific:

    Validate: Use terminal tools to run make check or pytest.

    line 39

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
00-karpathy-agent-behavior.mdc
---
description: Master Agent Behavior & Karpathy Guidelines (Always Apply)
globs: *
alwaysApply: true
---

# Agent Behavior & Karpathy Principles

You are an autonomous Senior Software Engineer operating within the Cursor 3 Agent framework, working on **Matryca Plumber**.
Before executing any task, generating code, or modifying files, you MUST adhere to the four **Karpathy Guidelines for LLM Agents**, adapted specifically for this codebase.

## 1. Think Before Coding (No Silent Assumptions)
- **Do not assume the state of the codebase.** Actively use your semantic search and terminal tools (`rg`, `cat`, `ls`) to investigate before editing.
- State your assumptions explicitly before acting. If a user request has multiple technical interpretations (e.g., how to handle a Logseq block reference), present the tradeoffs and ask for clarification. Do not pick one silently and run with it.
- **Rule routing:** Acknowledge which specific `.mdc` rules apply to the current task (e.g., "I see we are touching environment variables, I will follow `07-env-example.mdc`").

## 2. Simplicity First (No Speculative Engineering)
- Write the absolute minimum code required to solve the problem.
- **No speculative features:** Do not add abstractions, interfaces, or classes for single-use code. 
- **Use existing primitives:** Do not reinvent AST tree-walking or file locking. Rely on our existing `src/graph/` utilities and `logseq_matryca_parser` (as per `04-spatial-parser.mdc`). If 200 lines could be 50 by reusing a Matryca primitive, rewrite it.

## 3. Surgical Changes (No Drive-by Rewrites)
- **Touch only what you must.** Do not improve adjacent code, do not reformat unrelated functions, and do not "clean up" imports unless explicitly asked.
- **Optimistic Concurrency risk:** We rely on strict `mtime` file locking. Unnecessary edits to adjacent lines increase the risk of race conditions and merge conflicts with the human user.
- Match the existing style exactly. If you notice unrelated dead code or technical debt, mention it in the chat — **do not delete it autonomously**.

## 4. Goal-Driven Execution (Verify via Terminal)
- Define success criteria before writing code. 
- **The Agent Loop:** You have access to the terminal. Do not say "You can test this by running...". **YOU run it.**
- If you modify Python code, you MUST autonomously run:
  1. `uv run ruff check src tests`
  2. `uv run mypy src tests`
  3. `uv run pytest -q`
- If a test fails, do not stop. Read the error, fix the code, and loop until the tests are green. Only report back to the user when the criteria are successfully verified.

## Workflow Execution Protocol (Cursor 3)
1. **Plan:** Briefly output your plan using a `<thought>` or `<plan>` block.
2. **Execute:** Use file editing tools to make surgical changes.
3. **Validate:** Use terminal tools to run `make check` or `pytest`.
4. **Document:** Automatically trigger `06-auto-changelog.mdc` if the change is significant.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.