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.
git clone --depth 1 https://github.com/catlog22/Claude-Code-WorkflowWrote 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/catlog22/claude-code-workflow/refactor-cycle)<a href="https://agentmods.dev/commands/catlog22/claude-code-workflow/refactor-cycle"><img src="https://agentmods.dev/badge/commands/catlog22/claude-code-workflow/refactor-cycle/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/commands/catlog22/claude-code-workflow/refactor-cycle"><img src="https://agentmods.dev/badge/commands/catlog22/claude-code-workflow/refactor-cycle.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.00029 | $0.08208 |
| Opus 5.5 | $0.00012 | $0.03283 |
| Sonnet 5.5 | $0.00006 | $0.01642 |
| Haiku 4.5 | $0.00003 | $0.00821 |
Grade A, and why
refactor-cycle 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 1mo 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 — 966 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Auto Mode
When --yes or -y: Auto-confirm prioritization, use recommended refactoring strategy, skip interactive checkpoints.
Workflow Refactor-Cycle Command
Quick Start
# Discover and fix tech debt in a module
/workflow:refactor-cycle "src/auth 模块的技术债务清理"
# Auto mode - fully autonomous
/workflow:refactor-cycle -y "支付服务重构优化"
# Project-wide scan
/workflow:refactor-cycle --scope=project "全项目技术债务扫描与重构"
# Continue interrupted session
/workflow:refactor-cycle --continue "认证模块"
Context Source: cli-explore-agent + Gemini/Claude multi-dimensional analysis
Output Directory: .workflow/.refactor/{session-id}/
Core Innovation: Debt-driven refactoring with regression-safe iterative execution and reflection
What & Why
Core Concept
Closed-loop tech debt lifecycle: Discover → Assess → Plan → Refactor → Validate → Reflect → Next — each refactoring item is executed, validated against regression, and reflected upon before proceeding.
vs Existing Commands:
- workflow:lite-fix: Single bug fix, no systematic debt analysis
- workflow-plan + execute: Generic implementation, no debt-aware prioritization or regression validation
- This command: Full debt lifecycle — discovery through multi-dimensional scan, prioritized execution with per-item regression validation
Value Proposition
- Systematic Discovery: Multi-dimensional scan (code quality, architecture, dependencies, test gaps, performance)
- Risk-Aware Prioritization: Impact × effort matrix with dependency-aware ordering
- Regression-Safe: Each refactoring item validated before proceeding to next
- Documented Reasoning: Every debt item, prioritization decision, and refactoring outcome recorded
Output Artifacts
2 core files + 1 trace directory:
| Artifact | Type | Description |
|---|---|---|
reflection-log.md |
Human-readable | ⭐ Debt inventory, prioritization rationale, per-item refactoring reflections, conclusions |
state.json |
Machine-readable | Debt items, priority queue, refactoring plans, validation results, iteration state |
.trace/ |
Raw logs | CLI analysis outputs, test outputs, diagnostics snapshots |
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.
- 1mo ago First seen · 966 lines · 29 tokens per session scan A b5a72e11a977
refactor-cycle is a command published in the GitHub repository catlog22/Claude-Code-Workflow (2,124 stars, last pushed 4mo ago), licensed MIT. It adds 29 tokens to every session and 8,208 once invoked, about $0.0001 per session on Opus 5.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-30.
Other commands, from other repositories
debug
Systematic debugging with hypotheses and evidence gathering.
wtfp:report-bug
Collect a reproducible bug report and publish it only after explicit user approval.
fix
Diagnose and fix bugs, errors, and issues in code.
verify-claim
Walk a claim through the SIFT method (Stop, Investigate, Find better coverage, Trace).
analyze-regression
Analyze details about a Component Readiness regression and suggest next steps.
reasoning-logic-vector
Analyze the logic flow direction (λobserve) to understand reasoning patterns and identify potential issues.