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/catlog22/claude-code-workflow/refactor-cyclegit clone --depth 1 https://github.com/catlog22/Claude-Code-WorkflowWhat 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.00029 | $0.08208 |
| Opus 5 | $0.00015 | $0.04104 |
| Sonnet 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 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.
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.
- 2d 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,134 stars, last pushed 2mo ago), licensed MIT. It adds 29 tokens to every session and 8,208 once invoked, about $0.0001 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-30.
Other commands, from other repositories
verify-claim
Walk a claim through the SIFT method (Stop, Investigate, Find better coverage, Trace).
beat-brief
Draft a daily beat briefing from the files in sample-docs/.
cross-review
Run GitHub Copilot CLI and OpenAI Codex against the current git diff for cross-model review.
step-research
Always research before proposing a fix. The Untether bug you're chasing is often a known upstream engine quirk, a previously-fixed regression, or a documented config gotcha.
whats-next
Show current project status and suggest next steps.
ox-session-pause
belongs in the ox CLI JSON output (guidance field), not here. Skills are agent-specific wrappers; ox serves all agents (Codex, etc.). --> Suspend the current session recording. Local cache continues to receive entries, but the upload at stop time will exclude the suspended range.