Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/ratnesh-maurya/cursor-claude-personasnpx agentmods add rules/ratnesh-maurya/cursor-claude-personas/rules-calculate-metadataWrote 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/ratnesh-maurya/cursor-claude-personas/rules-calculate-metadata)<a href="https://agentmods.dev/rules/ratnesh-maurya/cursor-claude-personas/rules-calculate-metadata"><img src="https://agentmods.dev/badge/rules/ratnesh-maurya/cursor-claude-personas/rules-calculate-metadata/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/ratnesh-maurya/cursor-claude-personas/rules-calculate-metadata"><img src="https://agentmods.dev/badge/rules/ratnesh-maurya/cursor-claude-personas/rules-calculate-metadata.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.00011 | $0.00668 |
| Opus 5.5 | $0.00004 | $0.00267 |
| Sonnet 5.5 | $0.00002 | $0.00134 |
| Haiku 4.5 | $0.00001 | $0.00067 |
Grade A, and why
calculate-metadata scanned grade A with 1 finding 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 1mo 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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
const response = await fetch(props.dataUrl, {signal: abortSignal}); How it starts
The opening of the file, as written. The whole thing — 105 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Using calculateMetadata
Use calculateMetadata on a <Composition> to dynamically set duration, dimensions, and transform props before rendering.
<Composition id="MyComp" component={MyComponent} durationInFrames={300} fps={30} width={1920} height={1080} defaultProps={{videoSrc: 'https://remotion.media/video.mp4'}} calculateMetadata={calculateMetadata} />
Setting duration based on a video
Use the getMediaMetadata() function from the mediabunny/metadata skill to get the video duration:
import {CalculateMetadataFunction} from 'remotion';
import {getMediaMetadata} from '../get-media-metadata';
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
const {durationInSeconds} = await getMediaMetadata(props.videoSrc);
return {
durationInFrames: Math.ceil(durationInSeconds * 30),
};
};
Matching dimensions of a video
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
const {durationInSeconds, dimensions} = await getMediaMetadata(props.videoSrc);
return {
durationInFrames: Math.ceil(durationInSeconds * 30),
width: dimensions?.width ?? 1920,
height: dimensions?.height ?? 1080,
};
};
Setting duration based on multiple videos
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
const metadataPromises = props.videos.map((video) => getMediaMetadata(video.src));
const allMetadata = await Promise.all(metadataPromises);
const totalDuration = allMetadata.reduce((sum, meta) => sum + meta.durationInSeconds, 0);
return {
durationInFrames: Math.ceil(totalDuration * 30),
};
};
Setting a default outName
Set the default output filename based on props:
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
return {
defaultOutName: `video-${props.id}.mp4`,
};
};
Transforming props
Fetch data or transform props before rendering:
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props, abortSignal}) => {
const response = await fetch(props.dataUrl, {signal: abortSignal});
const data = await response.json();
return {
props: {
...props,
fetchedData: data,
},
};
};
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.
- 1mo ago First seen · 105 lines · 11 tokens per session scan A b258c788fb33
calculate-metadata is a cursor rule published in the GitHub repository ratnesh-maurya/cursor-claude-personas (12 stars, last pushed 7mo ago), licensed MIT. It adds 11 tokens to every session and 668 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other cursor rules, from other repositories
cursor
You are working on the checkout service. Preserve transaction integrity and auditability.
orchestrator-main
Rules for the main orchestrator agent in multi-agent workflows.
lean
Answer densely. Cut filler, keep all technical signal.
react_hooks
React Hooks best practices for frontend package.
python
Python best practices with type hints, async patterns, and modern idioms.
general-python-project-rules
General Python project rules for all Python files in the project. Enforces specific Python versions and class usage.