agentleFS
MigoXLabMigoXLab/dingo/.cursor/rules/evaluator-development.mdc

dingo / rules

Cursor rule757 starsChanged 7 months agoApache-2.0View on GitHub

Guide for developing new evaluators (rules, LLMs, agents)

We split this evaluator-development.mdc into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every evaluator must return EvalDetail with:

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 6,350 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
evaluator-development.mdc
---
description: Guide for developing new evaluators (rules, LLMs, agents)
globs:
  - dingo/model/**/*.py
---

# Evaluator Development Guide

## Architecture

```
Model (registry)
├── Rule evaluators  → @Model.rule_register(metric_type, groups)
│   └── BaseRule.eval(input_data) → EvalDetail
├── LLM evaluators   → @Model.llm_register(name)
│   └── BaseOpenAI.eval(input_data) → EvalDetail
└── Agent evaluators → @Model.llm_register(name)
    └── BaseAgent.eval(input_data) → EvalDetail
```

## Key Files

| File | Purpose |
|------|---------|
| `dingo/model/model.py` | `Model` class with `rule_register`, `llm_register`, `load_model` |
| `dingo/model/rule/base.py` | `BaseRule` base class |
| `dingo/model/llm/base_openai.py` | `BaseOpenAI` base class for LLM evaluators |
| `dingo/model/llm/agent/base_agent.py` | `BaseAgent` base class for agent evaluators |
| `dingo/io/input/data.py` | `Data` model (input to evaluators) |
| `dingo/io/output/eval_detail.py` | `EvalDetail` model (output from evaluators) |

## Registration Groups

Rules belong to groups that determine when they run:

- `default` — runs in default evaluation
- `pretrain` — pre-training data quality
- `benchmark` — benchmark evaluation
- `sft` — supervised fine-tuning data
- `rag` — RAG system evaluation
- `hallucination` — hallucination detection

## EvalDetail Contract

Every evaluator must return `EvalDetail` with:

| Field | Type | Description |
|-------|------|-------------|
| `metric` | str | Evaluator class name (`cls.__name__`) |
| `status` | bool | `True` = issue found, `False` = no issue |
| `label` | List[str] | Quality labels (e.g., `['QUALITY_GOOD']` or `['QUALITY_BAD_COMPLETENESS.RuleName']`) |
| `reason` | List[str] | Human-readable explanation of the finding |
| `score` | float | Optional numeric score (0.0–1.0) |
| `extra` | Dict | Optional extra metadata |

## Data Field Access

Since `Data` uses `extra = "allow"`, always access non-standard fields safely:

```python
# Safe access patterns
raw_data = getattr(input_data, 'raw_data', {})
context = getattr(input_data, 'context', None)
reference = getattr(input_data, 'reference', '')

# For RAG evaluators, common field access pattern
question = input_data.prompt or raw_data.get("question", "")
answer = input_data.content or raw_data.get("answer", "")
```

## Multi-Field Evaluation

Evaluators receive data after field mapping. The `fields` config maps source fields to standard Data fields:

```json
{
  "fields": {"content": "description", "prompt": "title"},
  "evals": [{"name": "RuleAbnormalChar"}]
}
```

The evaluator sees `input_data.content` = value of source field `description`.

## Tool Registration (for Agents)

```python
from dingo.model.llm.agent.tools.tool_registry import tool_register
from dingo.model.llm.agent.tools.base_tool import BaseTool

@tool_register
class MyTool(BaseTool):
    name = "my_tool"
    description = "What this tool does"

    def execute(self, **kwargs):
        # tool logic
        return result
```

Download now (ZIP)

  • Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.

    Of the Cursor rule files we read, the 3,978 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository7 other files it gives its agents.

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.