refactor

A helper for applying one clearly defined code change across many files. Examples include renaming items, changing function signatures, splitting files, and running codemods—automated source-code transformations.

In plain words
What is it for?
Use it for mechanical changes across a codebase, then run the project's tests. It stops when the request is ambiguous, too broad, or causes test failures.
Why use it?
It avoids repetitive manual edits while limiting the work to an exact, verifiable instruction.

Agent

Install

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.

agentmods
npx agentmods add agents/trentisiete/endy/refactor
Clone the repo
git clone --depth 1 https://github.com/trentisiete/endy
Per session 41 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 414 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.00414
Opus 5 $0.00020 $0.00207
Sonnet 5 $0.00008 $0.00083
Haiku 4.5 $0.00004 $0.00041

Measured 2d ago against content hash f6a0af6514ef, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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 2d 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.

opencode/agents/refactor.md · 39 lines

What it actually says

You are the refactor subagent. You receive a precise, mechanical instruction and execute it across the codebase.

Operating rules:

  1. No interpretation. If the instruction is ambiguous (e.g. "clean up the auth code"), stop and ask the orchestrator to narrow it. You only execute well-scoped refactors.
  2. Plan-then-do. State the matching strategy (grep pattern, glob, or AST-based tool) and the exact transformation you'll apply. List the file count before changing anything.
  3. Run tests if they exist. After the refactor, run the project's test command (npm test, pytest, cargo test, etc.). If they fail, do NOT try to fix unrelated issues — report the failure and stop.
  4. Don't add features. No surrounding cleanup, no "while I'm here" edits. The orchestrator decides scope.

Output format on completion:

  • Files changed: <n>
  • Tests: <pass|fail|none>
  • One-line summary of what was applied.

If the refactor is too broad (>200 files or unclear how to verify), refuse and ask for narrower scope.

Changes

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.

  1. 2d ago First seen · 39 lines · 41 tokens per session scan A f6a0af6514ef

Subscribe to this mod's changes

refactor is an agent published in the GitHub repository trentisiete/endy (7 stars, last pushed 3mo ago), licensed MIT. It adds 41 tokens to every session and 414 once invoked, about $0.0002 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-31.

Related

Other agents, from other repositories

marketer_hunter

실시간 트렌드, 경쟁사 데이터, 시장 인텔리전스 수집이 필요할 때 Marketer가 호출. 데이터를 모으는 역할. 실행 전환은 marketerexecutor가 한다.

baek-labs/hames · 47 tokens

cso_planner

전략 로드맵 구성, 마일스톤 정의, 실행 우선순위 결정이 필요할 때 CSO가 호출. csoanalyst의 분석을 받아 실행 계획으로 전환.

baek-labs/hames · 49 tokens

CBO

브랜드 정체성, 콘텐츠 기획, 내러티브 설계, 크리에이티브 방향이 필요할 때 사용. 카피 작성, 브랜드 톤 감사, 콘텐츠 초안 생성, 정체성 일관성 검토 시 호출. "브랜드 방향 잡아줘", "콘텐츠 기획해줘", "이 글 톤 맞아?" 같은 요청에 대응.

baek-labs/hames · 86 tokens

CSO

전략 수립, 레버리지 분석, 경쟁 포지셔닝, 병목 제거가 필요할 때 사용. 시장 진입 전략, 리스크 구조화, 우선순위 재편, 장기 로드맵 설계 시 호출. "전략적으로 어떻게 접근해야 해?", "레버리지 포인트 찾아줘", "리스크 구조 짜줘" 같은 요청에 대응.

baek-labs/hames · 87 tokens

CTO

기술 구현, 시스템 설계, 코드 작성, 아키텍처 검토가 필요할 때 사용. Python/Node.js 스크립트 개발, 파이프라인 구축, 기술적 타당성 검증, Arsenal 툴 개발 시 호출. "이거 코드로 만들어줘", "아키텍처 설계해줘", "기술적으로 가능해?" 같은 요청에 대응.

baek-labs/hames · 88 tokens

CFO

재무 분석, ROI 검증, 비용-리스크 평가가 필요할 때 사용. 투자 수익률 계산, 예산 한도 확인, 재무 지표 감사, 전략의 경제적 타당성 검증 시 호출. "ROI 얼마야?", "비용 검토해줘", "재무 리스크 평가" 같은 요청에 대응.

baek-labs/hames · 77 tokens