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.
npx agentmods add commands/eddiesanjuan/markupr/refactorgit clone --depth 1 https://github.com/eddiesanjuan/markuprWrote 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/commands/eddiesanjuan/markupr/refactor)<a href="https://agentmods.dev/commands/eddiesanjuan/markupr/refactor"><img src="https://agentmods.dev/badge/commands/eddiesanjuan/markupr/refactor.svg" alt="Measured on agentmods" 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 | $0.00000 | $0.01098 |
| Opus 5 | $0.00000 | $0.00549 |
| Sonnet 5 | $0.00000 | $0.00220 |
| Haiku 4.5 | $0.00000 | $0.00110 |
Grade A, and why
refactor 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 4d 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 — 129 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor -- Safe Refactoring with Test Guard Rails
Perform incremental, test-guarded refactoring of a specified area of the markupr codebase. Every change is validated by re-running the test suite to ensure nothing breaks.
Target area: $ARGUMENTS
If no argument is provided, ask the user what area to refactor. Examples:
- A specific file:
src/main/SessionController.ts - A module:
src/main/pipeline/ - A pattern:
error handling,IPC layer,AI pipeline
Instructions
1. Establish Baseline -- Run Tests First
cd ~/Projects/markupr && npm test -- --run 2>&1
Record the baseline: total tests, passed, failed. If any tests are ALREADY failing, report them and ask the user whether to proceed (refactoring on a red test suite is risky).
2. Read and Analyze the Target Code
Read the target file(s) thoroughly. Identify refactoring opportunities specific to markupr's Electron + React + TypeScript stack:
Electron Main Process (src/main/)
- SessionController FSM: overly complex state transitions, duplicated guard clauses
- IPC handlers in
src/main/ipc/: handlers doing too much work (should delegate to services) - CrashRecovery: deeply nested try/catch, unclear recovery paths
- Pipeline steps: tight coupling between PostProcessor, TranscriptAnalyzer, FrameExtractor
- Settings: redundant validation that Zod should handle
React Renderer (src/renderer/)
- Components over 200 lines that should be split (especially
App.tsx,SettingsPanel.tsx,SessionReview.tsx) - Props drilling that should use React context or composition
useEffectcleanup functions missing for event subscriptions viawindow.markupr.*- Inline styles or magic numbers that should be Tailwind utilities or constants
- State that lives in components but should be lifted or extracted to hooks
Shared / Cross-cutting
- Type definitions in
src/shared/types.tsthat have grown too large (split by domain) - Duplicated type definitions between main and renderer
- String-based IPC channel names that could benefit from a type-safe wrapper
- Error handling patterns that swallow errors silently
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.
- 4d ago First seen · 129 lines · 0 tokens per session scan A 93efd11ef953
refactor is a command published in the GitHub repository eddiesanjuan/markupr (18 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,098 tokens. 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 commands, from other repositories
process
Process one or more YouTube videos (or a playlist) into structured knowledge.
kg_navigator
Knowledge graph specialist for entity relationships across videos.
video_specialist
Deep-dive analyst for processed video content. Use to answer specific questions about what was said, strategies mentioned, or claims made in a video.
voxpip
Watch any video and get a transcript — even without an API key. Extends /watch with a local speech-to-text fallback.
package-assistant
Convert an OfficeCLI skill into a fully wired Wayland assistant preset, or update an existing one.
pre-ship
Run the pre-ship quality gate checklist before publishing your agent.