Prompt file imported from drexed/cmdx (
.cursor/commands/refresh-agent.md). Copyright stays with the author.
Refresh Agent
Role
You are a senior developer maintaining Cursor agent definitions that provide specialized AI personas for delegated work.
Context
This project uses custom agents (.cursor/agents/*.md) with YAML front-matter (name, description, tools) and a markdown body encoding project-specific facts: technology versions, conventions, anti-patterns, queue references, file patterns, etc.
Agents source their facts from several files that evolve independently:
| Source | What It Provides |
|---|---|
.cursor/rules/cursor.instructions.mdc |
Technology stack versions, architecture overview, development guidelines |
.cursor/skills/*/SKILL.md |
File-pattern conventions, detailed layer patterns, anti-patterns |
When these sources change, agent definitions drift. A stale agent gives outdated guidance.
Task
Refresh one or more agent definitions so they accurately reflect the current project state.
The user will specify which agent(s) to refresh (e.g. code-reviewer), or say "all" for a full sweep.
Steps
-
Read the agent — Parse the target
.cursor/agents/<name>.md: front-matter fields and every body section. Identify which source-of-truth files the agent's content depends on (versions, conventions, anti-patterns, queues, file patterns, review dimensions, etc.). -
Gather source-of-truth — Read only the sources relevant to the agent's content:
.cursor/rules/cursor.instructions.mdc— if the agent references stack versions or architecture.cursor/skills/*/SKILL.md— if the agent references file patterns, skill names, or layer-specific anti-patterns
-
Diff the agent vs sources — For each section of the agent, identify:
- Stale facts — versions, queue names, convention rules, or anti-patterns that no longer match their source
- Missing facts — rules, patterns, layers, or conventions present in sources but absent from the agent
- Orphaned facts — references to skills, instructions, directories, queues, or tools that no longer exist
- Inconsistencies — contradictions between what the agent states and what sources define
-
Update the agent — Apply targeted edits to bring facts in line with sources:
- Update version numbers, convention rules, anti-pattern tables, queue references, file patterns
- Add entries for new layers, conventions, or patterns the agent should cover
- Remove orphaned references
- Do not rewrite sections that are still accurate — make surgical edits
- Preserve the agent's voice, persona, structural layout, and section ordering
-
Validate — After updating:
- Confirm YAML front-matter parses correctly (
name,description,tools) - Confirm no section references a skill, instruction file, or directory that doesn't exist
- Confirm version numbers are internally consistent (no section says Rails 8.0 while another says 8.1)
- Confirm YAML front-matter parses correctly (
Constraints
- Do not modify source-of-truth files — only agent definitions under
.cursor/agents/ - Do not change an agent's purpose, persona, tone, or structural layout — only update factual content
- Do not add or remove sections — update existing sections with current facts
- Do not create new agent files — only refresh existing ones
- Preserve front-matter format and markdown style of each agent
- When an agent doesn't reference a particular source (e.g. no queue table), do not introduce one — keep the agent's scope as-is
Output
After refreshing, provide a summary table:
| Agent | Changes | Status |
|---|---|---|
code-reviewer |
Updated Rails version, added 2 anti-patterns, refreshed queue table | ✅ Updated |
some-other-agent |
No changes needed | ⏭️ Skipped |