Zing Forum

Reading

Slice Workflow: An AI-Driven Large-Scale Code Refactoring Tool Based on Vertical Slicing

Slice is an AI workflow orchestration tool for developers. It uses the vertical slicing methodology to break down large refactoring tasks into independently executable small pieces, each running in a separate Git worktree to ensure the safety of the main codebase.

AI编程代码重构垂直切片Git工作流Claude Code智能体编排自动化开发TypeScriptCLI工具
Published 2026-04-16 07:46Recent activity 2026-04-16 07:49Estimated read 7 min
Slice Workflow: An AI-Driven Large-Scale Code Refactoring Tool Based on Vertical Slicing
1

Section 01

Slice Workflow: A Slicing Solution for AI-Driven Large-Scale Code Refactoring

Slice Workflow is an AI workflow orchestration tool for developers, designed to address core pain points in AI-assisted large-scale code refactoring or feature development: the traditional one-time completion model easily leads to context window overflow, error accumulation, and hard-to-rollback risks. It adopts the vertical slicing methodology to split large tasks into independently executable small pieces, each running in an isolated Git worktree to ensure the safety of the main codebase. This article will detail this tool from aspects such as background, core concepts, workflow, and architecture.

2

Section 02

Background: Pain Points of AI-Assisted Large-Scale Code Refactoring

With the popularity of AI-assisted programming today, developers face the core challenge of enabling AI agents to handle large-scale code refactoring tasks safely and efficiently. In the traditional model, completing all work at once is prone to issues like context window overflow (AI cannot handle excessive code volume), error accumulation (one error affects the whole), and difficulty in rollback (modifications directly affect the main codebase). Slice Workflow is exactly the solution designed to address these pain points.

3

Section 03

Core Concept of Slice Workflow: Vertical Slicing Methodology

Slice is a CLI tool developed based on TypeScript/Node.js. Its core idea draws on the 'vertical slice' concept from agile development: splitting complex tasks into small, independent deliverable units, each of which can be built, tested, and verified independently. Unlike horizontal layered development (completing all database layers first before handling API layers), vertical slicing emphasizes end-to-end functional completeness. For example, a slice for user registration functionality includes all content of the database model, API endpoint, frontend form, and validation logic.

4

Section 04

Core Workflow of Slice: A Closed Loop from Requirement to PR

Slice's core workflow consists of five closed-loop phases:

  1. RFC Draft Phase: Developers collaborate with AI to clarify requirements and convert vague goals into technical specifications;
  2. Draft Refinement Phase: AI analyzes the existing codebase, identifies technical debt, dependencies, and architectural constraints;
  3. Slice Planning Phase: The agent creates an execution plan, including slice definition, track files (recording execution paths), and template generation;
  4. Slice Execution Phase: Each slice runs in a separate Git worktree, optimizing the context window, controlling the blast radius (no impact on the main directory), and ensuring auditability;
  5. Handover Phase: Automatically creates a Pull Request with detailed implementation documents to simplify the review process.
5

Section 05

Technical Architecture Highlights: Reliable, Flexible, and Intelligent

Slice's technical architecture has multiple highlights:

  • Multi-runtime support: Claude Code CLI (suitable for production) and OpenCode SDK (supports over 75 models, suitable for local/experimental use);
  • State management: Machine state is stored in SQLite (atomic writes, crash recovery), while human state uses the filesystem (PROGRESS.md, tracks directory, readable and traceable);
  • Agent isolation: Git worktrees ensure slices run in parallel without interference, and failed slices can be easily discarded;
  • Evaluation-optimization loop: After slice execution, the evaluator checks quality, and the implementer fixes issues to improve output quality.
6

Section 06

Applicable Scenarios: Which Tasks Are Suitable for Slice?

Slice Workflow is particularly suitable for the following scenarios:

  1. Legacy code modernization: Gradually migrate old codebases to new architectures;
  2. Large-scale refactoring: Framework upgrades, API refactoring, module splitting;
  3. Feature iterative development: Split large features into independently deliverable increments;
  4. Codebase splitting: Migrate from monolithic applications to microservices architectures.
7

Section 07

Summary and Outlook: A New Paradigm for AI-Assisted Development

Slice Workflow represents a new paradigm for AI-assisted development: instead of letting AI complete all work at once, it treats AI as part of an orchestratable, monitorable, and rollbackable automated workflow. This slicing mindset not only applies to AI-driven development but also provides a reference for human team collaboration. As AI programming capabilities improve, safely and efficiently utilizing these capabilities becomes a core competency for teams, and Slice Workflow offers a solution worth trying.