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.
git clone --depth 1 https://github.com/greyhaven-ai/sygaldryWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/greyhaven-ai/sygaldry/mirascope-and-lilypad-best-practices)<a href="https://agentmods.dev/rules/greyhaven-ai/sygaldry/mirascope-and-lilypad-best-practices"><img src="https://agentmods.dev/badge/rules/greyhaven-ai/sygaldry/mirascope-and-lilypad-best-practices/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/greyhaven-ai/sygaldry/mirascope-and-lilypad-best-practices"><img src="https://agentmods.dev/badge/rules/greyhaven-ai/sygaldry/mirascope-and-lilypad-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00008 | $0.01243 |
| Opus 5 | $0.00004 | $0.00622 |
| Sonnet 5 | $0.00002 | $0.00249 |
| Haiku 4.5 | $0.00001 | $0.00124 |
Grade A, and why
mirascope-and-lilypad-best-practices 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 13d 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.
How it starts
The opening of the file, as written. The whole thing — 99 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Mirascope and Lilypad Best Practices
This rule outlines best practices for using @Mirascope and @Lilypad in this codebase. Follow these guidelines to ensure maintainable, scalable, and idiomatic LLM-powered features with robust observability.
1. Prompt Templates
- Always use
@prompt_templatedecorators for prompt construction. Prefer prompt templates over shorthand string or list returns for clarity and reusability. - Keep prompt logic modular: define each prompt as a separate function, ideally in a
prompts/module. - Type all prompt template arguments for clarity and static analysis.
- Inject chat history and context using template arguments, not global state.
2. Response Models
- Define a Pydantic response model for every LLM call. Use the
response_modelargument in the call decorator (e.g.,@llm.call(provider="openai", model="gpt-4o-mini", ..., response_model=MyModel)). - Validate and parse LLM outputs using these models to ensure structured, reliable results.
- Store response models in a dedicated module (e.g.,
schemas/llm_responses.py).
3. Tools as Functions
- Write tools as plain functions using Mirascope's functional tool API, not as subclasses of
BaseToolunless absolutely necessary. - Annotate tool arguments and return types for all tool functions.
- Register tools using the appropriate Mirascope decorator or registry pattern.
- Keep tool logic stateless and side-effect free where possible.
4. Parallel and Async Calls
- Prefer
async deffor all LLM calls and tool functions to maximize concurrency. - Use Mirascope's async and parallel APIs to batch or parallelize LLM/tool calls when possible.
- Avoid blocking I/O in any LLM, tool, or agent logic.
5. Agent and Call Structure
- Organize agents, prompts, tools, and calls in separate modules for clarity.
- Use chaining and composition: build complex agent flows by composing prompt templates, tools, and LLM calls.
- Document each agent, tool, and prompt with clear docstrings and usage examples.
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.
- 13d ago First seen · 99 lines · 8 tokens per session scan A 5075ba37c1fa
mirascope-and-lilypad-best-practices is a cursor rule published in the GitHub repository greyhaven-ai/sygaldry (11 stars, last pushed 4mo ago), licensed MIT. It adds 8 tokens to every session and 1,243 once invoked, about $0.0000 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.
Other cursor rules, from other repositories
tensorflow
TensorFlow: Keras, model training, production deployment.
006_Program_of_Thought_Tutorial
DSPY 3 Program of Thought Tutorial - Production code reasoning system from official DSPy 3.0.1 tutorial.
standards-data-eng
Mandatory standards for Python and SQL data pipelines.
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.