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 | $0.00005 | $0.00334 |
| Sonnet 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 8d 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.
- 8d 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 (8 stars, last pushed 5mo ago), licensed MIT. It adds 11 tokens to every session and 668 once invoked, about $0.0001 per session on Opus 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
springboot-jpa-best-practices
A set of Chinese-language rules for structuring Java Spring Boot applications that use JPA, a library for database access.
nestjs-core-module-guidelines
A set of NestJS rules for application-wide request and error handling. Global filters handle exceptions, middleware manages requests, guards manage permissions, and interceptors manage request processing.
code-style-and-improvements
A collection of more than 132 coding rules covering areas such as frontend, backend, artificial intelligence, and DevOps.
fastapi-performance-optimization
Rules for improving FastAPI performance through caching, efficient data conversion, and delayed loading of large datasets or API responses.
fastapi-blocking-operations
Guidelines for avoiding blocking work in FastAPI applications. Blocking work makes the server wait instead of handling other requests.
naming-conventions-rule
A small set of naming rules for TypeScript, Node.js, and Next.js projects. It defines how directories and React components should be named and exported.