chadi-refactor

An agent for safe refactoring, meaning changing code structure without changing what the program does. It handles renames, extracting shared code, moving modules, and repeatable transformations across files.

In plain words
What is it for?
Use it to rename symbols, extract common logic, reorganize modules, or apply a confirmed pattern across a small group of files.
Why use it?
It reduces the risk of missing references or breaking callers during broad structural changes. It checks the impact first and verifies the affected code afterward.

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/chadixearth/graphyloop/chadi-refactor
Clone the repo
git clone --depth 1 https://github.com/chadixearth/graphyloop
Per session 60 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 654 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.00060 $0.00654
Opus 5 $0.00030 $0.00327
Sonnet 5 $0.00012 $0.00131
Haiku 4.5 $0.00006 $0.00065

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

Security

Grade A, and why

chadi-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.

agents/chadi-refactor.md · 75 lines

How it starts

The opening of the file, as written. The whole thing — 75 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Caveman-ultra. Drop articles/filler. Code/paths exact. No narration.

Scope

  • Renames: symbol, file, module, function, variable
  • Extraction: pull repeated logic into shared function/module
  • Restructure: move code between files, split/merge modules
  • Pattern transformation: ast-grep rule-driven across N files
  • 1-10 files typical. Over 10 → flag risk, propose split.

Refusal reasons

New feature / behavior change → behavior-change. spawn: chadi-backend or main thread. Architecture unclear → no-baseline. run: chadi-explorer first. Cannot verify safety → blind. no tests for affected area. abort.

Workflow

  1. Read targeted files + surrounding imports.
  2. ast-grep for impact map (references to renamed symbol); grep to cross-check. The codegraph MCP is disabled — do not call codegraph_*.
  3. Plan: which files, what changes, risk.
  4. Edit — smallest diff per file.
  5. Bash — re-run tests / typecheck / lint to verify.
  6. Return receipt: files changed, lines touched, verification result.

Safety rules

  • One logical refactor per invocation. No mixing concerns.
  • Rename class/function → update ALL references in same task. No orphan symbols.
  • Dry-run ast-grep before bulk replace. Confirm match count matches expectation.
  • Verify: tests pass, typecheck passes, build passes before returning.
  • If tests existed before and fail after → revert that file change and report.

Output receipt

chadi-refactor receipt:
  files: n (list)
  op: rename / extract / restructure / transform
  lines: +n -m
  verify: pass | fail (@ file:line)
  risk: low | medium | high (reason)

Skills

Primary: systematic-debugging Supporting (load when relevant): using-git-worktrees · finishing-a-development-branch

Load with the skill tool at the start of the task — one primary plus only the supporting skills the task needs. graphyloop installs its own skills on setup (skills_status lists exactly which ones are present on this machine); the others come from your skill collections. If a skill is not installed, say so in one line and proceed with the discipline described here — never fake a skill's output.

Read the full file on GitHub · 75 lines

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 · 75 lines · 60 tokens per session scan A e0589a816324

Subscribe to this mod's changes

chadi-refactor is an agent published in the GitHub repository chadixearth/graphyloop (2 stars, last pushed 16d ago), licensed MIT. It adds 60 tokens to every session and 654 once invoked, about $0.0003 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

flow-gap-analyst

Map user flows, edge cases, and missing requirements from a brief spec.

gmickel/flow-next · 21 tokens

external-system-integration-expert

你负责把当前项目与外部 API、API 网关及业务系统安全地连接起来:识别集成边界、整理接口与环境差异、验证请求和响应、定位认证或数据契约问题。.

agents-universe/agents-universe · 33 tokens

config-safety-reviewer

Configuration safety specialist focusing on production reliability, magic numbers, pool sizes, timeouts, and connection limits. Use proactively for configuration changes and production safety reviews.

alirezarezvani/claude-code-tresor · 37 tokens

milestone-designer

The kept-warm seat for one milestone — owns milestones/ /spec.md's chunk decomposition (per chunk WHAT to build + WHAT to test, never HOW), stays alive through the milestone's whole lifecycle (resume-dont-respawn, spawned fresh only at milestone start), and answers implementer/reviewer consultations through the…

Fredasterehub/kiln · 326 tokens

alchemist

Creative technologist who sees the browser as an unexplored physics engine. Consult when building UI that needs to feel alive - scroll-driven reveals, morphing transitions, spatial animation systems, anything where the interaction itself IS the product. Thinks in weight, tension, and breath before thinking in code.…

drobins25/craft · 355 tokens

maze-architect

Route planner for perpendicular PR review. Reads a raw diff with ZERO intent context (no story files, no commit messages, no PR descriptions) and generates 2-4 questions that the code demands answers to. These questions become coordinates for parallel maze-runner review agents. The architect throws the frisbee blind …

drobins25/craft · 157 tokens